Module models

Module models 

Source
Expand description

bgp-models module defines the basic BGP and MRT message data structures.

This library aims to provide building blocks for downstream libraries working with BGP and MRT messages such as MRT bgpkit-parser or BGP table constructor.

§Supported RFCs

Most of the structs defined in this library are named after the formal definitions in a number of RFCs. Here is a list of them:

§BGP

  • RFC 2042: Registering New BGP Attribute Types
  • RFC 3392: Capabilities Advertisement with BGP-4
  • RFC 4271: A Border Gateway Protocol 4 (BGP-4)
  • RFC 5065: Autonomous System Confederations for BGP
  • RFC 6793: BGP Support for Four-Octet Autonomous System (AS) Number Space
  • RFC 7911: Advertisement of Multiple Paths in BGP (ADD-PATH)
  • RFC 9072: Extended Optional Parameters Length for BGP OPEN Message Updates
  • RFC 9234: Route Leak Prevention and Detection Using Roles in UPDATE and OPEN Messages

§MRT

  • RFC 6396: Multi-Threaded Routing Toolkit (MRT) Routing Information Export Format
  • RFC 6397: Multi-Threaded Routing Toolkit (MRT) Border Gateway Protocol (BGP) Routing Information Export Format with Geo-Location Extensions
  • RFC 8050: Multi-Threaded Routing Toolkit (MRT) Routing Information Export Format with BGP Additional Path Extensions

§Communities

§Communities
§Extended Communities
  • RFC 4360: BGP Extended Communities Attribute
  • RFC 5668: 4-Octet AS Specific BGP Extended Community
  • RFC 5701: IPv6 Address Specific BGP Extended Community Attribute
  • RFC 7153: IANA Registries for BGP Extended Communities Updates 4360, 5701
  • RFC 8097: BGP Prefix Origin Validation State Extended Community
§Large Communities

§Other Informational

  • RFC 4384: BGP Communities for Data Collection BCP 114
  • RFC 8195: Use of BGP Large Communities (informational)
  • RFC 8642: Policy Behavior for Well-Known BGP Communities

Modules§

attributes
BGP attribute structs
bgp4mp
MRT BGP4MP structs
capabilities
community
elem
error
BGP error code module that maintains explicit error codes assigned by IANA.
flowspec
linkstate
BGP Link-State data structures based on RFC 7752
nlri
operators
role
table_dump
MRT table dump version 1 and 2 structs
table_dump_v2
MRT table dump version 2 structs
tunnel_encap
BGP Tunnel Encapsulation data structures based on RFC 9012

Structs§

AsPath
AsPathRouteIter
Asn
ASN – Autonomous System Number
AttrFlags
The high-order bit (bit 0) of the Attribute Flags octet is the Optional bit. It defines whether the attribute is optional (if set to 1) or well-known (if set to 0).
AttrRaw
Attribute
BGP Attribute struct with attribute value and flag
Attributes
Convenience wrapper for a list of attributes
Bgp4MpMessage
BGP4MP message.
Bgp4MpStateChange
BGP4MP state change message.
BgpElem
BgpElem represents a per-prefix BGP element.
BgpNotificationMessage
BgpOpenMessage
BGP Open Message
BgpUpdateMessage
BGP Update Message.
BitmaskOperator
Bitmask operator for Flow-Spec components (RFC 8955 Section 4.2.2)
Capability
BGP Capability.
CommonHeader
MRT common header.
FlowSpecNlri
Flow Specification NLRI containing an ordered list of components
FlowSpecTrafficAction
Flow-Spec Traffic Action Extended Community
FlowSpecTrafficMarking
Flow-Spec Traffic Marking Extended Community
FlowSpecTrafficRate
Flow-Spec Traffic Rate Extended Community
FourOctetAsExtCommunity
Four-Octet AS Specific Extended Community
GeoPeer
Geo-location peer entry - RFC 6397
GeoPeerTable
RFC 6397: Geo-location peer table
Ipv4AddrExtCommunity
IPv4 Address Specific Extended Community
Ipv6AddrExtCommunity
LargeCommunity
Large community structure as defined in RFC8092
LinkDescriptor
Link Descriptor TLVs
LinkStateAttribute
BGP Link-State Attributes
LinkStateNlri
BGP Link-State NLRI structure
MetaCommunitiesIter
MpReachableNlri
MpUnreachableNlri
MrtRecord
MrtRecord is a wrapper struct that contains a header and a message.
NetworkPrefix
A representation of a network prefix with an optional path ID.
Nlri
Network Layer Reachability Information
NodeDescriptor
Node Descriptor TLVs
NumericOperator
Numeric operator for Flow-Spec components (RFC 8955 Section 4.2.1)
OpaqueExtCommunity
Opaque Extended Community
OptParam
Peer
Peer struct.
PeerIndexTable
peer index table.
PeerType
PrefixDescriptor
Prefix Descriptor TLVs
RibAfiEntries
AFI/SAFI-Specific RIB Subtypes.
RibEntry
RIB entry.
RibGenericEntries
RIB generic entries subtype.
RouteDistinguisher
Route Distinguisher for VPN next-hops - RFC 4364, Section 4.1 An 8-byte value used to distinguish VPN routes with potentially overlapping address spaces
SubTlv
Sub-TLV structure for Tunnel Encapsulation
TableDumpMessage
TableDump message version 1
Tlv
TLV (Type-Length-Value) structure for Link-State information
TunnelEncapAttribute
BGP Tunnel Encapsulation Attribute
TunnelEncapTlv
Tunnel Encapsulation TLV
TwoOctetAsExtCommunity
Two-Octet AS Specific Extended Community

Enums§

Afi
AFI – Address Family Identifier
AsPathSegment
Enum of AS path segment.
AsnLength
AS number length: 16 or 32 bits.
AttrType
Attribute types.
AttributeCategory
Category of an attribute.
AttributeValue
The AttributeValue enum represents different kinds of Attribute values.
Bgp4MpEnum
BGP4MP message types.
Bgp4MpType
BGP4MP message subtypes.
BgpError
BGP Error Subcode enum.
BgpErrorCode
BgpMessage
BgpMessageType
BgpModelsError
BgpRole
BGP Role
BgpState
BGP states enum.
CapabilityValue
Parsed BGP capability values
CeaseNotification
BGP Cease NOTIFICATION message subcodes
Community
ElemType
ElemType
EntryType
MRT entry type.
ExtendedCommunity
Extended Communities.
ExtendedCommunityType
Type definitions of extended communities
FiniteStateMachineError
BGP Finite State Machine Error Subcodes
FlowSpecComponent
Individual Flow-Spec component types as defined in RFC 8955/8956
FlowSpecError
Flow-Spec parsing and validation errors
LinkAttributeType
Link Attribute TLV Types
LinkDescriptorType
Link Descriptor Sub-TLV Types
MessageHeaderError
Message Header Error subcodes
MetaCommunity
MrtMessage
NextHopAddress
enum that represents the type of the next hop address.
NlriType
BGP Link-State NLRI Types as defined in RFC 7752 and IANA registry
NodeAttributeType
Node Attribute TLV Types
NodeDescriptorType
Node Descriptor Sub-TLV Types
OpenError
OPEN Message Error subcodes
Origin
ParamValue
PrefixAttributeType
Prefix Attribute TLV Types
PrefixDescriptorType
Prefix Descriptor Sub-TLV Types
ProtocolId
Protocol Identifier as defined in RFC 7752
RouteRefreshError
BGP ROUTE-REFRESH Message Error subcodes
Safi
SAFI – Subsequent Address Family Identifier
SubTlvType
BGP Tunnel Encapsulation Sub-TLV Types
TableDumpV2Message
TableDump message version 2 enum
TableDumpV2Type
TableDump version 2 subtypes.
TunnelType
BGP Tunnel Encapsulation Types as defined in RFC 9012 and IANA registry
UpdateError
UPDATE Message Error subcodes

Functions§

address_family
encode_flowspec_nlri
Encode Flow-Spec NLRI to byte data
get_deprecated_attr_type
option_to_string_communities
parse_flowspec_nlri
Parse Flow-Spec NLRI from byte data according to RFC 8955/8956
validate_role_pairs
Validate the local-remote BGP Role pairs.

Type Aliases§

BgpIdentifier
SegmentIntoIter
SegmentIter
SegmentIterMut