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
- RFC 1977: BGP Communities Attribute
§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
- RFC 8092: BGP Large Communities
§Other Informational
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
- AsPath
Route Iter - Asn
- ASN – Autonomous System Number
- Attr
Flags - 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
- Bgp4
MpMessage - BGP4MP message.
- Bgp4
MpState Change - BGP4MP state change message.
- BgpElem
- BgpElem represents a per-prefix BGP element.
- BgpNotification
Message - BgpOpen
Message - BGP Open Message
- BgpUpdate
Message - BGP Update Message.
- Bitmask
Operator - Bitmask operator for Flow-Spec components (RFC 8955 Section 4.2.2)
- Capability
- BGP Capability.
- Common
Header - MRT common header.
- Flow
Spec Nlri - Flow Specification NLRI containing an ordered list of components
- Flow
Spec Traffic Action - Flow-Spec Traffic Action Extended Community
- Flow
Spec Traffic Marking - Flow-Spec Traffic Marking Extended Community
- Flow
Spec Traffic Rate - Flow-Spec Traffic Rate Extended Community
- Four
Octet AsExt Community - Four-Octet AS Specific Extended Community
- GeoPeer
- Geo-location peer entry - RFC 6397
- GeoPeer
Table - RFC 6397: Geo-location peer table
- Ipv4
Addr ExtCommunity - IPv4 Address Specific Extended Community
- Ipv6
Addr ExtCommunity - Large
Community - Large community structure as defined in RFC8092
- Link
Descriptor - Link Descriptor TLVs
- Link
State Attribute - BGP Link-State Attributes
- Link
State Nlri - BGP Link-State NLRI structure
- Meta
Communities Iter - MpReachable
Nlri - MpUnreachable
Nlri - MrtRecord
- MrtRecord is a wrapper struct that contains a header and a message.
- Network
Prefix - A representation of a network prefix with an optional path ID.
- Nlri
- Network Layer Reachability Information
- Node
Descriptor - Node Descriptor TLVs
- Numeric
Operator - Numeric operator for Flow-Spec components (RFC 8955 Section 4.2.1)
- Opaque
ExtCommunity - Opaque Extended Community
- OptParam
- Peer
- Peer struct.
- Peer
Index Table - peer index table.
- Peer
Type - Prefix
Descriptor - Prefix Descriptor TLVs
- RibAfi
Entries - AFI/SAFI-Specific RIB Subtypes.
- RibEntry
- RIB entry.
- RibGeneric
Entries - RIB generic entries subtype.
- Route
Distinguisher - 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
- Table
Dump Message - TableDump message version 1
- Tlv
- TLV (Type-Length-Value) structure for Link-State information
- Tunnel
Encap Attribute - BGP Tunnel Encapsulation Attribute
- Tunnel
Encap Tlv - Tunnel Encapsulation TLV
- TwoOctet
AsExt Community - Two-Octet AS Specific Extended Community
Enums§
- Afi
- AFI – Address Family Identifier
- AsPath
Segment - Enum of AS path segment.
- AsnLength
- AS number length: 16 or 32 bits.
- Attr
Type - Attribute types.
- Attribute
Category - Category of an attribute.
- Attribute
Value - The
AttributeValueenum represents different kinds of Attribute values. - Bgp4
MpEnum - BGP4MP message types.
- Bgp4
MpType - BGP4MP message subtypes.
- BgpError
- BGP Error Subcode enum.
- BgpError
Code - BgpMessage
- BgpMessage
Type - BgpModels
Error - BgpRole
- BGP Role
- BgpState
- BGP states enum.
- Capability
Value - Parsed BGP capability values
- Cease
Notification - BGP Cease NOTIFICATION message subcodes
- Community
- Elem
Type - ElemType
- Entry
Type - MRT entry type.
- Extended
Community - Extended Communities.
- Extended
Community Type - Type definitions of extended communities
- Finite
State Machine Error - BGP Finite State Machine Error Subcodes
- Flow
Spec Component - Individual Flow-Spec component types as defined in RFC 8955/8956
- Flow
Spec Error - Flow-Spec parsing and validation errors
- Link
Attribute Type - Link Attribute TLV Types
- Link
Descriptor Type - Link Descriptor Sub-TLV Types
- Message
Header Error - Message Header Error subcodes
- Meta
Community - MrtMessage
- Next
HopAddress - enum that represents the type of the next hop address.
- Nlri
Type - BGP Link-State NLRI Types as defined in RFC 7752 and IANA registry
- Node
Attribute Type - Node Attribute TLV Types
- Node
Descriptor Type - Node Descriptor Sub-TLV Types
- Open
Error - OPEN Message Error subcodes
- Origin
- Param
Value - Prefix
Attribute Type - Prefix Attribute TLV Types
- Prefix
Descriptor Type - Prefix Descriptor Sub-TLV Types
- Protocol
Id - Protocol Identifier as defined in RFC 7752
- Route
Refresh Error - BGP ROUTE-REFRESH Message Error subcodes
- Safi
- SAFI – Subsequent Address Family Identifier
- SubTlv
Type - BGP Tunnel Encapsulation Sub-TLV Types
- Table
Dump V2Message - TableDump message version 2 enum
- Table
Dump V2Type - TableDump version 2 subtypes.
- Tunnel
Type - BGP Tunnel Encapsulation Types as defined in RFC 9012 and IANA registry
- Update
Error - 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.