rotonda 0.4.2

composable, programmable BGP engine
Documentation
filter-map my-module {
    define {
        rx_tx bgp_msg: BgpUpdateMessage;
    }

    term afi-safi-unicast {
        match {
            bgp_msg.nlris.afi != IPV4;
        }
    }

    action send-message {
        asn-encounter-report.send({
            name: "local-broker", // this name can be used by a target to select only messages intended for it
            topic: "testing",
            message: String.format("🤭 I encountered {}", "1818")
        });
    }

    apply {
        filter match afi-safi-unicast matching {
            send-message;
        };
    }
}

filter bmp-in-filter {
    // Uncomment to use ASN filtering
    define {
        rx msg: BmpMessage;
        filtered_asn = 65000;
    }

    term has_asn {
    // Compare the ASN for BMP message types that have a Per Peer Header.
    // Other message types not mentioned here lack the Per Peer Header and so
    // do not have a matching ASN and are treated as such. 
       match msg with {
           PeerDownNotification(pd_msg) -> pd_msg.per_peer_header.asn == filtered_asn,
           PeerUpNotification(pu_msg) -> pu_msg.per_peer_header.asn == filtered_asn,
           RouteMonitoring(rm_msg) -> rm_msg.per_peer_header.asn == filtered_asn,
           StatisticsReport(sr_msg) -> sr_msg.per_peer_header.asn == filtered_asn,
       }
    }

    apply {
        filter match has_asn matching {
            return reject;
        };
        accept;
    }
}

output-stream asn-encounter-report contains Message {
    name: String, // this is the name of the target that should consume this message
    topic: String, // the meaning of this is target type specific
    message: String // this can be one or many fields of any type?
}