Standard Library

functionCommunity(raw: u32) Community
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 and false. Several boolean operations can be used with booleans, such as && (logical and), || (logical or) and not.

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 the AS prefix followed by a number.

AS0
AS1010
AS4294967295
methodAsn.fmt() String

Return the formatted string for asn

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
methodIpAddr.is_ipv6() bool

Returns true if this address is an IPv6 address, and false otherwise.

1.1.1.1.is_ipv6() # -> false
::.is_ipv6()      # -> true
methodIpAddr.to_canonical() IpAddr

Converts this address to an IPv4 if it is an IPv4-mapped IPv6 address, otherwise it returns self as-is.

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 the Prefix.new function. This operator takes an IpAddr and a u8 as operands.

1.1.1.0 / 8
192.0.0.0.0 / 24
static methodPrefix.new(ip: IpAddr, len: u8) Prefix

Construct a new prefix

A prefix can also be constructed with the / operator.

Prefix.new(192.169.0.0, 16)

# or equivalently
192.169.0.0 / 16
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"
methodString.to_uppercase() String

Create a new string with all characters converted to lowercase

"quiet".to_uppercase() # -> "QUIET"
methodString.repeat(n: u32) String

Repeat a string n times and join them

"ha".repeat(6) # -> "hahahahahaha"
typeRoute

A single announced or withdrawn path

methodRoute.prefix_matches(to_match: Prefix) bool

Check whether the prefix for this RotondaRoute matches

methodRoute.aspath_contains(to_match: Asn) bool

Check whether the AS_PATH contains the given Asn

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

methodRoute.has_attribute(to_match: u8) bool

Check whether this RotondaRoute contains the given Path Attribute

methodRoute.fmt_aspath() String

Return a formatted string for the AS_PATH

methodRoute.fmt_aspath_origin() String

Return a formatted string for the AS_PATH origin

methodRoute.fmt_communities() String

Return a formatted string for the Standard Communities

methodRoute.fmt_large_communities() String

Return a formatted string for the Large Communities

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_peer_down() Unit

Log a PeerDown event

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.print(msg: String) Unit

Print a message to standard error

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.

methodLog.write_entry() Unit

Finalize this entry and ensure it will be written to the output

Calling this method will close the log entry that is currently being composed, and ensures a subsequent call to [entry] returns a new, empty LogEntry.

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.aspath_contains(to_match: Asn) bool

Check whether the AS_PATH contains the given Asn

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

methodBgpMsg.has_attribute(to_match: u8) bool

Check whether this message contains the given Path Attribute

methodBgpMsg.announcements_count() u32

Return the number of announcements in this message

methodBgpMsg.withdrawals_count() u32

Return the number of withdrawals in this message

methodBgpMsg.fmt_aspath() String

Return a formatted string for the AS_PATH

methodBgpMsg.fmt_aspath_origin() String

Return a formatted string for the AS_PATH origin

methodBgpMsg.fmt_communities() String

Return a formatted string for the Standard Communities

methodBgpMsg.fmt_large_communities() String

Return a formatted string for the Large Communities

methodBgpMsg.fmt_pcap() String

Format this message as hexadecimal Wireshark input

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 the BmpMsg. returns false if no PPH is present.

methodBmpMsg.is_route_monitoring() bool

Check whether this message is of type ‘RouteMonitoring’

methodBmpMsg.is_peer_down() bool

Check whether this message is of type ‘PeerDownNotification’

methodBmpMsg.aspath_contains(to_match: Asn) bool

Check whether the AS_PATH contains the given Asn

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.announcements_count() u32

Return the number of announcements in this message

methodBmpMsg.withdrawals_count() u32

Return the number of withdrawals in this message

methodBmpMsg.fmt_aspath() String

Return a formatted string for the AS_PATH

methodBmpMsg.fmt_aspath_origin() String

Return a string of the AS_PATH origin for this BmpMsg.

methodBmpMsg.fmt_communities() String

Return a string for the Standard Communities in this BmpMsg.

methodBmpMsg.fmt_large_communities() String

Return a string for the Large Communities in this BmpMsg.

methodBmpMsg.fmt_pcap() String

Format this message as hexadecimal Wireshark input

typePerPeerHeader

BMP Per Peer Header