Standard Library
- contextoutput: Log
- constantLOCALHOSTV6: IpAddr
The IPv6 address pointing to localhost:
::1
- constantNO_ADVERTISE: Community
The well-known NO_ADVERTISE community (RFC1997)
- constantLOCALHOSTV4: IpAddr
The IPv4 address pointing to localhost:
127.0.0.1
- constantNO_EXPORT: Community
The well-known NO_EXPORT community (RFC1997)
- constantNO_EXPORT_SUBCONFED: Community
The well-known NO_EXPORT_SUBCONFED community (RFC1997)
- constantNO_PEER: Community
The well-known NO_PEER community (RFC3765)
- typeUnit
The unit type that has just one possible value. It can be used when there is nothing meaningful to be returned.
- typebool
The boolean type
This type has two possible values:
true
andfalse
. 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.
- 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 theAS
prefix followed by a number.AS0 AS1010 AS4294967295
- typeIpAddr
An IP address
Can be either IPv4 or IPv6.
# 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.new
function. This operator takes anIpAddr
and au8
as 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".contains("hay") # -> true "haystack".contains("trees") # -> false
- methodString.ends_with(suffix: String) bool
Check whether a string end with a given suffix
"haystack".contains("stack") # -> true "haystack".contains("black") # -> false
- methodString.to_lowercase() String
Create a new string with all characters converted to lowercase
"LOUD".to_lowercase() # -> "loud"
- typeRoute
A single announced or withdrawn path
- methodRoute.prefix_matches(to_match: Prefix) bool
Check whether the prefix for this
RotondaRoute
matches
- 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
RotondaRoute
contains the given Standard Community
- methodRoute.contains_large_community(to_match: LargeCommunity) bool
Check whether this
RotondaRoute
contains the given Large Community
- 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) Unit
Log the given prefix (NB: this method will likely be removed)
- methodLog.log_matched_asn(asn: Asn) Unit
Log the given ASN (NB: this method will likely be removed)
- methodLog.log_matched_origin(origin: Asn) Unit
Log the given ASN as origin (NB: this method will likely be removed)
- methodLog.log_matched_community(community: u32) Unit
Log the given community (NB: this method will likely be removed)
- methodLog.log_custom(id: u32, local: u32) Unit
Log a custom entry in forms of a tuple (NB: this method will likely be removed)
- methodLog.entry() LogEntryPtr
Get the current/new entry
A
LogEntry
is only written to the output if [write_entry
] is called on it after populating its fields.
- typeInsertionInfo
Information from the RIB on an inserted route
- typeLogEntry
Entry to log to file/mqtt
- typeLogEntryPtr
Entry to log to file/mqtt
- methodLogEntryPtr.custom(custom_msg: String) Unit
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.
- methodLogEntryPtr.origin_as(msg: BmpMsg) LogEntryPtr
Log the AS_PATH origin ASN for the given message
- methodLogEntryPtr.peer_as(msg: BmpMsg) LogEntryPtr
Log the peer ASN for the given message
- methodLogEntryPtr.as_path_hops(msg: BmpMsg) LogEntryPtr
Log the number of AS_PATH hops for the given message
- methodLogEntryPtr.conventional_reach(msg: BmpMsg) LogEntryPtr
Log the number of conventional announcements for the given message
- methodLogEntryPtr.conventional_unreach(msg: BmpMsg) LogEntryPtr
Log the number of conventional withdrawals for the given message
- methodLogEntryPtr.mp_reach(msg: BmpMsg) LogEntryPtr
Log the number of MultiProtocol announcements for the given message
- methodLogEntryPtr.mp_unreach(msg: BmpMsg) LogEntryPtr
Log the number of MultiProtocol withdrawals for the given message
- methodLogEntryPtr.log_all(msg: BmpMsg) LogEntryPtr
Log all the built-in features for the given message
- typeBgpMsg
BGP UPDATE message
- 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
- typeCommunity
A BGP Standard Community (RFC1997)
- typeLargeCommunity
A BGP Large Community (RFC8092)
- typeBmpMsg
BMP Message
- methodBmpMsg.is_ibgp(asn: Asn) bool
Check whether this is an iBGP message based on a given
asn
Return true if
asn
matches the asn in theBmpMsg
. returns false if no PPH is present.
- 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
- methodBmpMsg.fmt_communities() String
Return a string for the Standard Communities in this
BmpMsg
.
- typePerPeerHeader
BMP Per Peer Header