Standard Library
- contextoutput: Log
- contextrpki: Rpki
- contextasn_lists: AsnLists
- contextprefix_lists: PrefixLists
- contextmetrics: Metrics
- constantNO_PEER: Community
The well-known NO_PEER community (RFC3765)
- constantNO_EXPORT_SUBCONFED: Community
The well-known NO_EXPORT_SUBCONFED community (RFC1997)
- constantNO_EXPORT: Community
The well-known NO_EXPORT community (RFC1997)
- constantLOCALHOSTV4: IpAddr
The IPv4 address pointing to localhost:
127.0.0.1
- constantNO_ADVERTISE: Community
The well-known NO_ADVERTISE community (RFC1997)
- constantLOCALHOSTV6: IpAddr
The IPv6 address pointing to localhost:
::1
- typebool
The boolean type
This type has two possible values:
trueandfalse. Several boolean operations can be used with booleans, such as&&(logical and),||(logical or) andnot.
- typeu8
The unsigned 8-bit integer type
This type can represent integers from 0 up to (and including) 255.
- typeu16
The unsigned 16-bit integer type
This type can represent integers from 0 up to (and including) 65535.
- typeu32
The unsigned 32-bit integer type
This type can represent integers from 0 up to (and including) 4294967295.
- typeu64
The unsigned 64-bit integer type
This type can represent integers from 0 up to (and including) 18446744073709551615.
- typei8
The signed 8-bit integer type
This type can represent integers from -128 up to (and including) 127.
- typei16
The signed 16-bit integer type
This type can represent integers from -32768 up to (and including) 32767.
- typei32
The signed 32-bit integer type
This type can represent integers from -2147483648 up to (and including) 2147483647.
- typei64
The signed 64-bit integer type
This type can represent integers from -9223372036854775808 up to (and including) 9223372036854775807.
- typef32
The 32-bit floating point type
- methodf32.round() f32
Returns the nearest integer to self. If a value is half-way between two integers, round away from 0.0.
- typef64
The 64-bit floating point type
- methodf64.round() f64
Returns the nearest integer to self. If a value is half-way between two integers, round away from 0.0.
- typeAsn
An ASN: an Autonomous System Number
An AS number can contain a number of 32-bits and is therefore similar to a
u32. However, AS numbers cannot be manipulated with arithmetic operations. An AS number is constructed with theASprefix followed by a number.AS0 AS1010 AS4294967295
- typeIpAddr
An IP address
Can be either IPv4 or IPv6.
For IPv4, only dot-separated quad notation is supported.
# IPv4 examples 127.0.0.1 0.0.0.0 255.255.255.255 # IPv6 examples 0:0:0:0:0:0:0:1 ::1 ::
- methodIpAddr.eq(b: IpAddr) bool
Check whether two IP addresses are equal
A more convenient but equivalent method for checking equality is via the
==operator.An IPv4 address is never equal to an IPv6 address. IP addresses are considered equal if all their bits are equal.
192.0.0.0 == 192.0.0.0 # -> true ::0 == ::0 # -> true 192.0.0.0 == 192.0.0.1 # -> false 0.0.0.0 == 0::0 # -> false # or equivalently: 192.0.0.0.eq(192.0.0.0) # -> true
- methodIpAddr.is_ipv4() bool
Returns true if this address is an IPv4 address, and false otherwise.
1.1.1.1.is_ipv4() # -> true ::.is_ipv4() # -> false
- typePrefix
An IP address prefix: the combination of an IP address and a prefix length
A prefix can be constructed with the
/operator or with thePrefix.newfunction. This operator takes anIpAddrand au8as operands.1.1.1.0 / 8 192.0.0.0.0 / 24
- typeString
The string type
- methodString.append(b: String) String
Append a string to another, creating a new string
"hello".append(" ").append("world") # -> "hello world"
- methodString.contains(needle: String) bool
Check whether a string contains another string
"haystack".contains("hay") # -> true "haystack".contains("corn") # -> false
- methodString.starts_with(prefix: String) bool
Check whether a string starts with a given prefix
"haystack".starts_with("hay") # -> true "haystack".starts_with("trees") # -> false
- methodString.ends_with(suffix: String) bool
Check whether a string end with a given suffix
"haystack".ends_with("stack") # -> true "haystack".ends_with("black") # -> false
- methodString.to_lowercase() String
Create a new string with all characters converted to lowercase
"LOUD".to_lowercase() # -> "loud"
- methodString.to_uppercase() String
Create a new string with all characters converted to uppercase
"quiet".to_uppercase() # -> "QUIET"
- typeRoute
A single announced or withdrawn path
- methodRoute.prefix_matches(to_match: Prefix) bool
Check whether the prefix for this
RotondaRoutematches
- methodRoute.match_aspath_origin(to_match: Asn) bool
Check whether the AS_PATH origin matches the given
Asn
- methodRoute.contains_community(to_match: Community) bool
Check whether this
RotondaRoutecontains the given Standard Community
- methodRoute.contains_large_community(to_match: LargeCommunity) bool
Check whether this
RotondaRoutecontains the given Large Community
- typePathAttributes
The Path attributes pertaining to a certain Route
- methodPathAttributes.otc() Asn?
- methodPathAttributes.contains_community(to_match: Community) bool
- methodPathAttributes.contains_large_community(to_match: LargeCommunity) bool
- methodPathAttributes.aspath() aspath?
- typeRouteContext
Contextual information pertaining to the Route
- typeProvenance
Session/state information
- methodProvenance.peer_asn() Asn
Return the peer ASN
- typeLog
Machinery to create output entries
- methodLog.log_prefix(prefix: Prefix) ()
Log the given prefix (NB: this method will likely be removed)
- methodLog.log_matched_origin(origin: Asn) ()
Log the given ASN as origin (NB: this method will likely be removed)
- methodLog.log_matched_community(community: Community) ()
Log the given community (NB: this method will likely be removed)
- methodLog.log_custom(id: u32, local: u32) ()
Log a custom entry in forms of a tuple (NB: this method will likely be removed)
- typeRpki
RPKI information retrieved via RTR
- methodRpki.check_rov(rr: Route) RovStatus
Perform Route Origin Validation on the route
This sets the ‘rpki_info’ for this Route to Valid, Invalid or NotFound (RFC6811).
In order for this method to have effect, a ‘rtr-in’ connector should be configured, and it should have received VRP data from the connected RP software.
- typeVrpUpdate
A single announced or withdrawn VRP
- typeOriginAsn
Origin ASN
Represents an optional ASN.
- typeAsnLists
Named lists of ASNs
- methodAsnLists.contains_origin(name: String, origin: OriginAsn) bool
Returns ‘true’ if the named list contains
originThis method returns false if the list does not exist, or if
origindoes not actually contain anAsn. The latter could occur for announcements with an empty ‘AS_PATH’ attribute (iBGP).
- typePrefixLists
Named lists of prefixes
- methodPrefixLists.add(name: String, s: String) ()
Add a named prefix list
- methodPrefixLists.contains(name: String, prefix: Prefix) bool
Returns ‘true’ if
prefixis in the named list
- methodPrefixLists.covers(name: String, prefix: Prefix) bool
Returns ‘true’ if
prefixor a less-specific is in the named list
- typeMetrics
User-defined Prometheus style metrics
- typeIngressInfo
Information pertaining to the source of the Message or Route
- methodIngressInfo.peer_asn() Asn
- methodIngressInfo.peer_address() IpAddr
- typeInsertionInfo
Information from the RIB on an inserted route
- typeLogEntry
Entry to log to file/mqtt
- methodLogEntry.custom(custom_msg: String) ()
Log a custom message based on the given string
By setting a custom message for a
LogEntry, all other fields are ignored when the entry is written to the output. Combining the custom message with the built-in fields is currently not possible.
- methodLogEntry.timestamped_custom(custom_msg: String) ()
Log a custom, timestamped message based on the given string
Also see [
custom].
- methodLogEntry.as_path_hops(msg: BmpMsg) LogEntry
Log the number of AS_PATH hops for the given message
- methodLogEntry.conventional_reach(msg: BmpMsg) LogEntry
Log the number of conventional announcements for the given message
- methodLogEntry.conventional_unreach(msg: BmpMsg) LogEntry
Log the number of conventional withdrawals for the given message
- methodLogEntry.mp_reach(msg: BmpMsg) LogEntry
Log the number of MultiProtocol announcements for the given message
- typeBgpMsg
BGP UPDATE message
- methodBgpMsg.aspath_origin() OriginAsn
Returns the right-most
Asnin the ‘AS_PATH’ attributeNote that the returned value is of type
OriginAsn, which optionally contains anAsn. In case of empty an ‘AS_PATH’ (e.g. in iBGP) this method will still return anOriginAsn, though representing ‘None’.
- methodBgpMsg.match_aspath_origin(to_match: Asn) bool
Check whether the AS_PATH origin matches the given
Asn
- methodBgpMsg.contains_community(to_match: Community) bool
Check whether this message contains the given Standard Community
- methodBgpMsg.contains_large_community(to_match: LargeCommunity) bool
Check whether this message contains the given Large Community
- typeLargeCommunity
A BGP Large Community (RFC8092)
- static methodLargeCommunity.from(s: String) LargeCommunity
- typeBmpMsg
BMP Message
- methodBmpMsg.is_ibgp(asn: Asn) bool
Check whether this is an iBGP message based on a given
asnReturn true if
asnmatches the asn in theBmpMsg. returns false if no PPH is present.
- methodBmpMsg.aspath_origin() OriginAsn
Returns the right-most
Asnin the ‘AS_PATH’ attributeNote that the returned value is of type
OriginAsn, which optionally contains anAsn. In case of empty an ‘AS_PATH’ (e.g. in iBGP) this method will still return anOriginAsn, though representing ‘None’.When called on BMP messages not of type ‘RouteMonitoring’, the ‘None’-variant is returned as well.
- methodBmpMsg.match_aspath_origin(to_match: Asn) bool
Check whether the AS_PATH origin matches the given
Asn
- methodBmpMsg.contains_community(to_match: Community) bool
Check whether this message contains the given Standard Community
- methodBmpMsg.contains_large_community(to_match: LargeCommunity) bool
Check whether this message contains the given Large Community
- methodBmpMsg.has_attribute(to_match: u8) bool
Check whether this message contains the given Path Attribute
- typePerPeerHeader
BMP Per Peer Header
- typeRovStatus
ROV status of a
Route
- typeRovStatusUpdate
ROV update of a
Route- methodRovStatusUpdate.prefix() Prefix
Returns the prefix of the updated route
- methodRovStatusUpdate.origin() Asn
Returns the origin
asnfrom the ‘AS_PATH’ of the updated route
- methodRovStatusUpdate.peer_asn() Asn
Returns the peer
asnfrom which the route was received
- methodRovStatusUpdate.has_changed() bool
Returns ‘true’ if the new status differs from the old status
- methodRovStatusUpdate.previous_status() RovStatus
Returns the old status of the route
- methodRovStatusUpdate.current_status() RovStatus
Returns the new status of the route
- methodRovStatusUpdate.fmt() String
Return a formatted string for
rov_update