Internet-Draft BMP YANG Network Telemetry Message July 2026
Graf, et al. Expires 3 January 2027 [Page]
Workgroup:
NMOP
Internet-Draft:
draft-netana-nmop-message-broker-bmp-telemetry-msg-03
Published:
Intended Status:
Standards Track
Expires:
Authors:
TG. Graf
Swisscom
PL. Lucente
NTT
LR. Rodoni
Swisscom
MY. Younsi
INSA-Lyon

BMP YANG Model for Network Telemetry Messages

Abstract

This document defines an BGP Monitoring Protocol (BMP) message schema extension in YANG to be used at data collection to transform Network Telemetry messages into external systems such as Message Brokers.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on 3 January 2027.

Table of Contents

1. Introduction

Nowadays network operators are using BGP Monitoring Protocol (BMP) [RFC7854] to monitor the BGP peerings and RIB's. With [I-D.ietf-nmop-message-broker-telemetry-message] a machine and human readable extensible Network Telemetry message schema in YANG [RFC7950] has been defined.

Network operators organize their data in a Data Mesh [Deh22] where a Message Broker such as Apache Kafka [Kaf11] or Apache Pulsar [Pul16] facilitates the exchange of messages among data processing components.

With YANG Message Keys for Message Broker Integration [I-D.netana-nmop-yang-message-broker-message-key] how Dimensional YANG data can be indexed and addressed in Message Brokers are being described.

This document describes how [I-D.ietf-nmop-message-broker-telemetry-message] defined Network Telemetry message is being extended to support BMP data transformation to YANG at the Network Telemetry data collector and being indexed and addressed in Message Broker based on [I-D.netana-nmop-yang-message-broker-message-key] principles at the YANG Message Broker Producer.

2. Conventions and Definitions

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

2.1. Terminology

The following terms are used as defined in [I-D.ietf-nmop-terminology]:

  • Network Telemetry
  • Network Analytics
  • Value
  • State
  • Change

The following terms are used as defined in [I-D.ietf-nmop-yang-message-broker-integration]:

  • Message Broker
  • YANG Message Broker Producer
  • YANG Message Broker Consumer

The following terms are used as defined in Apache Kafka [Kaf11] and Apache Pulsar [Pul16] Message Broker:

  • Subject: Is used for Messages within a Topic sharing the same schema tree and also to identify a unique schema tree within a schema registry.
  • Topic: A communication channel for publishing and subscribing messages with one or more subjects and partitions.
  • Topic Compaction: The act of compressing messages in a topic to the latest state. As used with Apache Pulsar. Apache Kafka uses the term Log Compaction with identical meaning.
  • Partition: Messages in a topic are spread over hash buckets where a hash bucket refers to a partition being stored on one message broker node. Message ordering is guaranteed within a partition.
  • Message: A piece of structured data sent between data processing components to facilitate communication in a distributed system
  • Message Key: Message Key: Metadata associated with a message to facilitate deterministic hash bucketing and indexing for instantiated YANG data.
  • Partition Key: Metadata associated with a message to facilitate deterministic hash bucketing for instantiated YANG data. Also known as ordering key or routing key.

The following terms are used as defined in [RFC7854]:

  • BMP
  • BMP Message
  • Adj-RIB-In
  • Pre-policy Adj-RIB-In
  • Post-Policy Adj-RIB-In

The following terms are used as defined in [RFC8671]:

  • Adj-RIB-Out
  • Pre-policy Adj-RIB-Out
  • Post-policy Adj-RIB-Out

The following terms are used as defined in [RFC9069]:

  • BGP Instance
  • Loc-RIB

This document defines the following term:

  • BMP Index: A unique identifier created depending on BMP Message Type from multiple BMP and BGP data dimensions. The BMP Index is used to generate the Message Key. See Section 5.1.

3. Relationship to other documents

3.1. Relationship to draft-ietf-nmop-message-broker-telemetry-message

[I-D.ietf-nmop-message-broker-telemetry-message] defines, using the 'ietf-telemetry-message' YANG module, a base Network Telemetry Message schema used between Section 4.6 of Message Broker Producer [I-D.ietf-nmop-yang-message-broker-integration] and Section 4.7 of Message Broker Consumer [I-D.ietf-nmop-yang-message-broker-integration], and using the 'ietf-yang-push-telemetry-message' YANG module, an extension that supports YANG-Push specific subscription metadata.

This document defines two BMP YANG modules Section 4.1, Section 4.4 and two BGP YANG modules Section 4.3, Section 4.2 which populates the anydata "payload" node defined in the 'ietf-telemetry-message' YANG module of [I-D.ietf-nmop-message-broker-telemetry-message].

3.2. Relationship to draft-ietf-idr-bgp-model

[I-D.ietf-idr-bgp-model] defines the 'ietf-bgp' YANG module along with the following submodules: 'iana-bgp-community-types', 'iana-bgp-notification', 'iana-bgp-rib-types', 'iana-bgp-types', 'ietf-bgp-capabilities', 'ietf-bgp-common', 'ietf-bgp-common-multiprotocol', 'ietf-bgp-common-structure', 'ietf-bgp-neighbor', 'ietf-bgp-policy', 'ietf-bgp-rib', 'ietf-bgp-rib-attributes', and 'ietf-bgp-rib-tables'.

This document defines two new standalone YANG modules, 'ietf-bgp-rib-entry' and 'ietf-bgp-open', that import 'ietf-bgp'. The 'ietf-bgp-rib-entry' module adapts the groupings exposed by the 'ietf-bgp-rib', 'ietf-bgp-rib-attributes', and 'ietf-bgp-rib-tables' submodules and restructures them into a 'rib-entry' grouping that represents a single BGP RIB entry suitable for serialization in a Telemetry Message on a Message Broker. The 'clear-routes' YANG grouping has been omitted since a Telemetry Message covers only operational metrics. The 'ietf-bgp-open' module exposes BGP OPEN message fields for use in BMP Peer Up notifications.

Because 'ietf-bgp-rib-attributes' and 'ietf-bgp-rib-tables' are YANG submodules that Section 7.2.2 of belong to [RFC7950] the 'ietf-bgp' main module, they cannot be imported independently. This document therefore, imports the full 'ietf-bgp' module, which includes BGP configuration and policy content that is not required for telemetry purposes.

Once 'ietf-bgp-rib-attributes' and 'ietf-bgp-rib-tables' are restructured as standalone importable modules, this document could be simplified to import only those specific modules rather than the entire 'ietf-bgp' and its submodules. Such a change requires coordination with the [I-D.ietf-idr-bgp-model] authors on an appropriate timeline. This section will be removed if and once those changes are in place.

The [I-D.ietf-idr-bgp-model] authors are honored under Appendix "Contributors" for their contribution to the BGP YANG modelling this document uses.

3.3. Relationship to draft-ietf-grow-bmp-yang

[I-D.ietf-grow-bmp-yang] defines with 'ietf-bmp' YANG module the configuration and monitoring of BMP. While there is no direct relationship between this document and its defined YANG modules, it is worth mentioning that the with [I-D.ietf-grow-bmp-yang] subscribed BMP data is being transformed at BMP monitoring stations to Message Brokers as described in this document.

4. BMP YANG Modules

The 'ietf-bmp-telemetry-message' YANG module defines the top-level BMP message structure. It carries a mandatory version leaf from the BMP Common Header, an optional session-metadata presence container derived from the BMP Initiation message, and a message-type choice covering all seven BMP message types: route-monitoring, statistics-report, peer-down-notification, peer-up-notification, initiation-message, termination-message, and route-mirroring-message.

The 'ietf-bgp-rib-entry' module provides the rib-entry grouping used by route-monitoring and route-mirroring messages. It selects between five RIB table types — loc-rib, adj-rib-in-pre, adj-rib-in-post, adj-rib-out-pre, and adj-rib-out-post — via a nested rib-type choice. Each route entry contains the prefix, optional path-id for ADD-PATH, BGP path attributes, and community attributes.

The 'ietf-bgp-open' module provides the bgp-open grouping, which carries the BGP OPEN message fields: protocol version, Autonomous System number, hold time, BGP identifier, and the negotiated capability list. It is used in peer-up-notification for both the sent and received OPEN messages.

The 'ietf-bmp-tlv' module provides TLV groupings modeling the decoded content of BMP TLV Value fields. The common grouping — carrying sequence number, typed timestamps, and extended peer-header flags — is used across all seven BMP message types. Additional groupings are message-type-specific: information for initiation and peer-up messages, termination for termination messages, peer-down for Loc-RIB peer-down with reason code 6, and route-monitoring for path status and VRF/Table Name in route-monitoring messages.

A BMP Initiation message is sent once per BMP session when the TCP connection is established and provides router identity information such as sys-name, sys-descr, and optional free-form strings. Because subsequent per-peer messages (Route Monitoring, Statistics Report, Peer Up, Peer Down) carry no equivalent identity information, a Network Telemetry collector acting as a YANG Message Broker Producer SHOULD cache the Initiation message content for each BMP session and populate session-metadata in every downstream message it emits. This makes each Message Broker message self-contained for consumers that did not observe or store the Initiation message directly. The session-metadata container is absent when the collector has not yet received or cached the Initiation message for that session.


module: ietf-bmp-telemetry-message

  structure message:
    +-- session-metadata!
    |  +-- string*           string
    |  +-- sys-descr?        string
    |  +-- sys-name?         string
    |  +-- vrf-table-name?   string
    +-- version             uint8
    +-- (message-type)?
       +--:(route-monitoring)
       |  +-- route-monitoring
       |     +-- peer-type             peer-type
       |     +-- peer-flags
       |     |  +-- ipv6-peer?        boolean
       |     |  +-- post-policy?      boolean
       |     |  +-- legacy-as-path?   boolean
       |     |  +-- adj-rib-out?      boolean
       |     |  +-- filtered?         boolean
       |     +-- peer-distinguisher    rt-types:route-distinguisher
       |     +-- peer-address          inet:ip-address
       |     +-- peer-as               uint32
       |     +-- peer-bgp-id           inet:ipv4-address
       |     +-- timestamp?            yang:date-and-time
       |     +-- afi-safi-type         identityref
       |     +-- rib-entry
       |     |  +-- (afi-safi)
       |     |     +--:(ipv4-unicast)
       |     |     |  +-- ipv4-unicast
       |     |     |     +-- (rib-type)
       |     |     |        +--:(loc-rib)
       |     |     |        |  +-- loc-rib
       |     |     |        |     +-- route
       |     |     |        |        +-- prefix
       |     |     |        |        |     inet:ipv4-prefix
       |     |     |        |        +-- origin?
       |     |     |        |        |     union
       |     |     |        |        +-- path-id?
       |     |     |        |        |     uint32
       |     |     |        |        +-- attributes
       |     |     |        |        |  +-- origin
       |     |     |        |        |  |     bt:bgp-origin-attr-type
       |     |     |        |        |  +-- as-path
       |     |     |        |        |  |  +-- segment*
       |     |     |        |        |  |     +-- type?
       |     |     |        |        |  |     |     bt:as-path-segment-type
       |     |     |        |        |  |     +-- member*
       |     |     |        |        |  |           inet:as-number
       |     |     |        |        |  +-- next-hop?
       |     |     |        |        |  |     inet:ip-address
       |     |     |        |        |  +-- link-local-next-hop?
       |     |     |        |        |  |     inet:ipv6-address
       |     |     |        |        |  +-- med?
       |     |     |        |        |  |     uint32
       |     |     |        |        |  +-- local-pref?
       |     |     |        |        |  |     uint32
       |     |     |        |        |  +-- as4-path
       |     |     |        |        |  |  +-- segment*
       |     |     |        |        |  |     +-- type?
       |     |     |        |        |  |     |     bt:as-path-segment-type
       |     |     |        |        |  |     +-- member*
       |     |     |        |        |  |           inet:as-number
       |     |     |        |        |  +-- aggregator
       |     |     |        |        |  |  +-- as?
       |     |     |        |        |  |  |     inet:as-number
       |     |     |        |        |  |  +-- identifier?
       |     |     |        |        |  |        yang:dotted-quad
       |     |     |        |        |  +-- aggregator4
       |     |     |        |        |  |  +-- as4?
       |     |     |        |        |  |  |     inet:as-number
       |     |     |        |        |  |  +-- identifier?
       |     |     |        |        |  |        yang:dotted-quad
       |     |     |        |        |  +-- atomic-aggregate?
       |     |     |        |        |  |     boolean
       |     |     |        |        |  +-- originator-id?
       |     |     |        |        |  |     yang:dotted-quad
       |     |     |        |        |  +-- cluster-list*
       |     |     |        |        |  |     yang:dotted-quad
       |     |     |        |        |  +-- aigp-metric?
       |     |     |        |        |        uint64
       |     |     |        |        +-- community*
       |     |     |        |        |     union
       |     |     |        |        +-- ext-community*
       |     |     |        |        |     bct:bgp-ext-community-type
       |     |     |        |        +-- ext-community-raw*
       |     |     |        |        |     string
       |     |     |        |        +-- ipv6-ext-community*
       |     |     |        |        |     bct:bgp-ipv6-ext-community-type
       |     |     |        |        +-- ipv6-ext-community-raw*
       |     |     |        |        |     string
       |     |     |        |        +-- large-community*
       |     |     |        |        |     bct:bgp-large-community-type
       |     |     |        |        +-- last-modified?
       |     |     |        |        |     yang:timeticks
       |     |     |        |        +-- eligible-route?
       |     |     |        |        |     boolean
       |     |     |        |        +-- ineligible-reason?
       |     |     |        |        |     identityref
       |     |     |        |        +-- unknown-attributes
       |     |     |        |        |  +-- unknown-attribute*
       |     |     |        |        |        [attr-type]
       |     |     |        |        |     +-- attr-type     uint8
       |     |     |        |        |     +-- optional?     boolean
       |     |     |        |        |     +-- transitive?   boolean
       |     |     |        |        |     +-- partial?      boolean
       |     |     |        |        |     +-- extended?     boolean
       |     |     |        |        |     +-- attr-len?     uint16
       |     |     |        |        |     +-- attr-value?   binary
       |     |     |        |        +-- reject-reason?
       |     |     |        |              union
       |     |     |        +--:(adj-rib-in-pre)
       |     |     |        |  +-- adj-rib-in-pre
       |     |     |        |     +-- route
       |     |     |        |        +-- prefix
       |     |     |        |        |     inet:ipv4-prefix
       |     |     |        |        +-- path-id?
       |     |     |        |        |     uint32
       |     |     |        |        +-- attributes
       |     |     |        |        |  +-- origin
       |     |     |        |        |  |     bt:bgp-origin-attr-type
       |     |     |        |        |  +-- as-path
       |     |     |        |        |  |  +-- segment*
       |     |     |        |        |  |     +-- type?
       |     |     |        |        |  |     |     bt:as-path-segment-type
       |     |     |        |        |  |     +-- member*
       |     |     |        |        |  |           inet:as-number
       |     |     |        |        |  +-- next-hop?
       |     |     |        |        |  |     inet:ip-address
       |     |     |        |        |  +-- link-local-next-hop?
       |     |     |        |        |  |     inet:ipv6-address
       |     |     |        |        |  +-- med?
       |     |     |        |        |  |     uint32
       |     |     |        |        |  +-- local-pref?
       |     |     |        |        |  |     uint32
       |     |     |        |        |  +-- as4-path
       |     |     |        |        |  |  +-- segment*
       |     |     |        |        |  |     +-- type?
       |     |     |        |        |  |     |     bt:as-path-segment-type
       |     |     |        |        |  |     +-- member*
       |     |     |        |        |  |           inet:as-number
       |     |     |        |        |  +-- aggregator
       |     |     |        |        |  |  +-- as?
       |     |     |        |        |  |  |     inet:as-number
       |     |     |        |        |  |  +-- identifier?
       |     |     |        |        |  |        yang:dotted-quad
       |     |     |        |        |  +-- aggregator4
       |     |     |        |        |  |  +-- as4?
       |     |     |        |        |  |  |     inet:as-number
       |     |     |        |        |  |  +-- identifier?
       |     |     |        |        |  |        yang:dotted-quad
       |     |     |        |        |  +-- atomic-aggregate?
       |     |     |        |        |  |     boolean
       |     |     |        |        |  +-- originator-id?
       |     |     |        |        |  |     yang:dotted-quad
       |     |     |        |        |  +-- cluster-list*
       |     |     |        |        |  |     yang:dotted-quad
       |     |     |        |        |  +-- aigp-metric?
       |     |     |        |        |        uint64
       |     |     |        |        +-- community*
       |     |     |        |        |     union
       |     |     |        |        +-- ext-community*
       |     |     |        |        |     bct:bgp-ext-community-type
       |     |     |        |        +-- ext-community-raw*
       |     |     |        |        |     string
       |     |     |        |        +-- ipv6-ext-community*
       |     |     |        |        |     bct:bgp-ipv6-ext-community-type
       |     |     |        |        +-- ipv6-ext-community-raw*
       |     |     |        |        |     string
       |     |     |        |        +-- large-community*
       |     |     |        |        |     bct:bgp-large-community-type
       |     |     |        |        +-- last-modified?
       |     |     |        |        |     yang:timeticks
       |     |     |        |        +-- eligible-route?
       |     |     |        |        |     boolean
       |     |     |        |        +-- ineligible-reason?
       |     |     |        |        |     identityref
       |     |     |        |        +-- unknown-attributes
       |     |     |        |        |  +-- unknown-attribute*
       |     |     |        |        |        [attr-type]
       |     |     |        |        |     +-- attr-type     uint8
       |     |     |        |        |     +-- optional?     boolean
       |     |     |        |        |     +-- transitive?   boolean
       |     |     |        |        |     +-- partial?      boolean
       |     |     |        |        |     +-- extended?     boolean
       |     |     |        |        |     +-- attr-len?     uint16
       |     |     |        |        |     +-- attr-value?   binary
       |     |     |        |        +-- reject-reason?
       |     |     |        |              union
       |     |     |        +--:(adj-rib-in-post)
       |     |     |        |  +-- adj-rib-in-post
       |     |     |        |     +-- route
       |     |     |        |        +-- prefix
       |     |     |        |        |     inet:ipv4-prefix
       |     |     |        |        +-- path-id?
       |     |     |        |        |     uint32
       |     |     |        |        +-- attributes
       |     |     |        |        |  +-- origin
       |     |     |        |        |  |     bt:bgp-origin-attr-type
       |     |     |        |        |  +-- as-path
       |     |     |        |        |  |  +-- segment*
       |     |     |        |        |  |     +-- type?
       |     |     |        |        |  |     |     bt:as-path-segment-type
       |     |     |        |        |  |     +-- member*
       |     |     |        |        |  |           inet:as-number
       |     |     |        |        |  +-- next-hop?
       |     |     |        |        |  |     inet:ip-address
       |     |     |        |        |  +-- link-local-next-hop?
       |     |     |        |        |  |     inet:ipv6-address
       |     |     |        |        |  +-- med?
       |     |     |        |        |  |     uint32
       |     |     |        |        |  +-- local-pref?
       |     |     |        |        |  |     uint32
       |     |     |        |        |  +-- as4-path
       |     |     |        |        |  |  +-- segment*
       |     |     |        |        |  |     +-- type?
       |     |     |        |        |  |     |     bt:as-path-segment-type
       |     |     |        |        |  |     +-- member*
       |     |     |        |        |  |           inet:as-number
       |     |     |        |        |  +-- aggregator
       |     |     |        |        |  |  +-- as?
       |     |     |        |        |  |  |     inet:as-number
       |     |     |        |        |  |  +-- identifier?
       |     |     |        |        |  |        yang:dotted-quad
       |     |     |        |        |  +-- aggregator4
       |     |     |        |        |  |  +-- as4?
       |     |     |        |        |  |  |     inet:as-number
       |     |     |        |        |  |  +-- identifier?
       |     |     |        |        |  |        yang:dotted-quad
       |     |     |        |        |  +-- atomic-aggregate?
       |     |     |        |        |  |     boolean
       |     |     |        |        |  +-- originator-id?
       |     |     |        |        |  |     yang:dotted-quad
       |     |     |        |        |  +-- cluster-list*
       |     |     |        |        |  |     yang:dotted-quad
       |     |     |        |        |  +-- aigp-metric?
       |     |     |        |        |        uint64
       |     |     |        |        +-- community*
       |     |     |        |        |     union
       |     |     |        |        +-- ext-community*
       |     |     |        |        |     bct:bgp-ext-community-type
       |     |     |        |        +-- ext-community-raw*
       |     |     |        |        |     string
       |     |     |        |        +-- ipv6-ext-community*
       |     |     |        |        |     bct:bgp-ipv6-ext-community-type
       |     |     |        |        +-- ipv6-ext-community-raw*
       |     |     |        |        |     string
       |     |     |        |        +-- large-community*
       |     |     |        |        |     bct:bgp-large-community-type
       |     |     |        |        +-- last-modified?
       |     |     |        |        |     yang:timeticks
       |     |     |        |        +-- eligible-route?
       |     |     |        |        |     boolean
       |     |     |        |        +-- ineligible-reason?
       |     |     |        |        |     identityref
       |     |     |        |        +-- best-path?
       |     |     |        |        |     boolean
       |     |     |        |        +-- unknown-attributes
       |     |     |        |        |  +-- unknown-attribute*
       |     |     |        |        |        [attr-type]
       |     |     |        |        |     +-- attr-type     uint8
       |     |     |        |        |     +-- optional?     boolean
       |     |     |        |        |     +-- transitive?   boolean
       |     |     |        |        |     +-- partial?      boolean
       |     |     |        |        |     +-- extended?     boolean
       |     |     |        |        |     +-- attr-len?     uint16
       |     |     |        |        |     +-- attr-value?   binary
       |     |     |        |        +-- reject-reason?
       |     |     |        |              union
       |     |     |        +--:(adj-rib-out-pre)
       |     |     |        |  +-- adj-rib-out-pre
       |     |     |        |     +-- route
       |     |     |        |        +-- prefix
       |     |     |        |        |     inet:ipv4-prefix
       |     |     |        |        +-- path-id?
       |     |     |        |        |     uint32
       |     |     |        |        +-- attributes
       |     |     |        |        |  +-- origin
       |     |     |        |        |  |     bt:bgp-origin-attr-type
       |     |     |        |        |  +-- as-path
       |     |     |        |        |  |  +-- segment*
       |     |     |        |        |  |     +-- type?
       |     |     |        |        |  |     |     bt:as-path-segment-type
       |     |     |        |        |  |     +-- member*
       |     |     |        |        |  |           inet:as-number
       |     |     |        |        |  +-- next-hop?
       |     |     |        |        |  |     inet:ip-address
       |     |     |        |        |  +-- link-local-next-hop?
       |     |     |        |        |  |     inet:ipv6-address
       |     |     |        |        |  +-- med?
       |     |     |        |        |  |     uint32
       |     |     |        |        |  +-- local-pref?
       |     |     |        |        |  |     uint32
       |     |     |        |        |  +-- as4-path
       |     |     |        |        |  |  +-- segment*
       |     |     |        |        |  |     +-- type?
       |     |     |        |        |  |     |     bt:as-path-segment-type
       |     |     |        |        |  |     +-- member*
       |     |     |        |        |  |           inet:as-number
       |     |     |        |        |  +-- aggregator
       |     |     |        |        |  |  +-- as?
       |     |     |        |        |  |  |     inet:as-number
       |     |     |        |        |  |  +-- identifier?
       |     |     |        |        |  |        yang:dotted-quad
       |     |     |        |        |  +-- aggregator4
       |     |     |        |        |  |  +-- as4?
       |     |     |        |        |  |  |     inet:as-number
       |     |     |        |        |  |  +-- identifier?
       |     |     |        |        |  |        yang:dotted-quad
       |     |     |        |        |  +-- atomic-aggregate?
       |     |     |        |        |  |     boolean
       |     |     |        |        |  +-- originator-id?
       |     |     |        |        |  |     yang:dotted-quad
       |     |     |        |        |  +-- cluster-list*
       |     |     |        |        |  |     yang:dotted-quad
       |     |     |        |        |  +-- aigp-metric?
       |     |     |        |        |        uint64
       |     |     |        |        +-- community*
       |     |     |        |        |     union
       |     |     |        |        +-- ext-community*
       |     |     |        |        |     bct:bgp-ext-community-type
       |     |     |        |        +-- ext-community-raw*
       |     |     |        |        |     string
       |     |     |        |        +-- ipv6-ext-community*
       |     |     |        |        |     bct:bgp-ipv6-ext-community-type
       |     |     |        |        +-- ipv6-ext-community-raw*
       |     |     |        |        |     string
       |     |     |        |        +-- large-community*
       |     |     |        |        |     bct:bgp-large-community-type
       |     |     |        |        +-- last-modified?
       |     |     |        |        |     yang:timeticks
       |     |     |        |        +-- eligible-route?
       |     |     |        |        |     boolean
       |     |     |        |        +-- ineligible-reason?
       |     |     |        |        |     identityref
       |     |     |        |        +-- unknown-attributes
       |     |     |        |        |  +-- unknown-attribute*
       |     |     |        |        |        [attr-type]
       |     |     |        |        |     +-- attr-type     uint8
       |     |     |        |        |     +-- optional?     boolean
       |     |     |        |        |     +-- transitive?   boolean
       |     |     |        |        |     +-- partial?      boolean
       |     |     |        |        |     +-- extended?     boolean
       |     |     |        |        |     +-- attr-len?     uint16
       |     |     |        |        |     +-- attr-value?   binary
       |     |     |        |        +-- reject-reason?
       |     |     |        |              union
       |     |     |        +--:(adj-rib-out-post)
       |     |     |           +-- adj-rib-out-post
       |     |     |              +-- route
       |     |     |                 +-- prefix
       |     |     |                 |     inet:ipv4-prefix
       |     |     |                 +-- path-id?
       |     |     |                 |     uint32
       |     |     |                 +-- attributes
       |     |     |                 |  +-- origin
       |     |     |                 |  |     bt:bgp-origin-attr-type
       |     |     |                 |  +-- as-path
       |     |     |                 |  |  +-- segment*
       |     |     |                 |  |     +-- type?
       |     |     |                 |  |     |     bt:as-path-segment-type
       |     |     |                 |  |     +-- member*
       |     |     |                 |  |           inet:as-number
       |     |     |                 |  +-- next-hop?
       |     |     |                 |  |     inet:ip-address
       |     |     |                 |  +-- link-local-next-hop?
       |     |     |                 |  |     inet:ipv6-address
       |     |     |                 |  +-- med?
       |     |     |                 |  |     uint32
       |     |     |                 |  +-- local-pref?
       |     |     |                 |  |     uint32
       |     |     |                 |  +-- as4-path
       |     |     |                 |  |  +-- segment*
       |     |     |                 |  |     +-- type?
       |     |     |                 |  |     |     bt:as-path-segment-type
       |     |     |                 |  |     +-- member*
       |     |     |                 |  |           inet:as-number
       |     |     |                 |  +-- aggregator
       |     |     |                 |  |  +-- as?
       |     |     |                 |  |  |     inet:as-number
       |     |     |                 |  |  +-- identifier?
       |     |     |                 |  |        yang:dotted-quad
       |     |     |                 |  +-- aggregator4
       |     |     |                 |  |  +-- as4?
       |     |     |                 |  |  |     inet:as-number
       |     |     |                 |  |  +-- identifier?
       |     |     |                 |  |        yang:dotted-quad
       |     |     |                 |  +-- atomic-aggregate?
       |     |     |                 |  |     boolean
       |     |     |                 |  +-- originator-id?
       |     |     |                 |  |     yang:dotted-quad
       |     |     |                 |  +-- cluster-list*
       |     |     |                 |  |     yang:dotted-quad
       |     |     |                 |  +-- aigp-metric?
       |     |     |                 |        uint64
       |     |     |                 +-- community*
       |     |     |                 |     union
       |     |     |                 +-- ext-community*
       |     |     |                 |     bct:bgp-ext-community-type
       |     |     |                 +-- ext-community-raw*
       |     |     |                 |     string
       |     |     |                 +-- ipv6-ext-community*
       |     |     |                 |     bct:bgp-ipv6-ext-community-type
       |     |     |                 +-- ipv6-ext-community-raw*
       |     |     |                 |     string
       |     |     |                 +-- large-community*
       |     |     |                 |     bct:bgp-large-community-type
       |     |     |                 +-- last-modified?
       |     |     |                 |     yang:timeticks
       |     |     |                 +-- eligible-route?
       |     |     |                 |     boolean
       |     |     |                 +-- ineligible-reason?
       |     |     |                 |     identityref
       |     |     |                 +-- unknown-attributes
       |     |     |                 |  +-- unknown-attribute*
       |     |     |                 |        [attr-type]
       |     |     |                 |     +-- attr-type     uint8
       |     |     |                 |     +-- optional?     boolean
       |     |     |                 |     +-- transitive?   boolean
       |     |     |                 |     +-- partial?      boolean
       |     |     |                 |     +-- extended?     boolean
       |     |     |                 |     +-- attr-len?     uint16
       |     |     |                 |     +-- attr-value?   binary
       |     |     |                 +-- reject-reason?
       |     |     |                       union
       |     |     +--:(ipv6-unicast)
       |     |        +-- ipv6-unicast
       |     |           +-- (rib-type)
       |     |              +--:(loc-rib)
       |     |              |  +-- loc-rib
       |     |              |     +-- route
       |     |              |        +-- prefix
       |     |              |        |     inet:ipv6-prefix
       |     |              |        +-- origin?
       |     |              |        |     union
       |     |              |        +-- path-id?
       |     |              |        |     uint32
       |     |              |        +-- attributes
       |     |              |        |  +-- origin
       |     |              |        |  |     bt:bgp-origin-attr-type
       |     |              |        |  +-- as-path
       |     |              |        |  |  +-- segment*
       |     |              |        |  |     +-- type?
       |     |              |        |  |     |     bt:as-path-segment-type
       |     |              |        |  |     +-- member*
       |     |              |        |  |           inet:as-number
       |     |              |        |  +-- next-hop?
       |     |              |        |  |     inet:ip-address
       |     |              |        |  +-- link-local-next-hop?
       |     |              |        |  |     inet:ipv6-address
       |     |              |        |  +-- med?
       |     |              |        |  |     uint32
       |     |              |        |  +-- local-pref?
       |     |              |        |  |     uint32
       |     |              |        |  +-- as4-path
       |     |              |        |  |  +-- segment*
       |     |              |        |  |     +-- type?
       |     |              |        |  |     |     bt:as-path-segment-type
       |     |              |        |  |     +-- member*
       |     |              |        |  |           inet:as-number
       |     |              |        |  +-- aggregator
       |     |              |        |  |  +-- as?
       |     |              |        |  |  |     inet:as-number
       |     |              |        |  |  +-- identifier?
       |     |              |        |  |        yang:dotted-quad
       |     |              |        |  +-- aggregator4
       |     |              |        |  |  +-- as4?
       |     |              |        |  |  |     inet:as-number
       |     |              |        |  |  +-- identifier?
       |     |              |        |  |        yang:dotted-quad
       |     |              |        |  +-- atomic-aggregate?
       |     |              |        |  |     boolean
       |     |              |        |  +-- originator-id?
       |     |              |        |  |     yang:dotted-quad
       |     |              |        |  +-- cluster-list*
       |     |              |        |  |     yang:dotted-quad
       |     |              |        |  +-- aigp-metric?
       |     |              |        |        uint64
       |     |              |        +-- community*
       |     |              |        |     union
       |     |              |        +-- ext-community*
       |     |              |        |     bct:bgp-ext-community-type
       |     |              |        +-- ext-community-raw*
       |     |              |        |     string
       |     |              |        +-- ipv6-ext-community*
       |     |              |        |     bct:bgp-ipv6-ext-community-type
       |     |              |        +-- ipv6-ext-community-raw*
       |     |              |        |     string
       |     |              |        +-- large-community*
       |     |              |        |     bct:bgp-large-community-type
       |     |              |        +-- last-modified?
       |     |              |        |     yang:timeticks
       |     |              |        +-- eligible-route?
       |     |              |        |     boolean
       |     |              |        +-- ineligible-reason?
       |     |              |        |     identityref
       |     |              |        +-- unknown-attributes
       |     |              |        |  +-- unknown-attribute*
       |     |              |        |        [attr-type]
       |     |              |        |     +-- attr-type     uint8
       |     |              |        |     +-- optional?     boolean
       |     |              |        |     +-- transitive?   boolean
       |     |              |        |     +-- partial?      boolean
       |     |              |        |     +-- extended?     boolean
       |     |              |        |     +-- attr-len?     uint16
       |     |              |        |     +-- attr-value?   binary
       |     |              |        +-- reject-reason?
       |     |              |              union
       |     |              +--:(adj-rib-in-pre)
       |     |              |  +-- adj-rib-in-pre
       |     |              |     +-- route
       |     |              |        +-- prefix
       |     |              |        |     inet:ipv6-prefix
       |     |              |        +-- path-id?
       |     |              |        |     uint32
       |     |              |        +-- attributes
       |     |              |        |  +-- origin
       |     |              |        |  |     bt:bgp-origin-attr-type
       |     |              |        |  +-- as-path
       |     |              |        |  |  +-- segment*
       |     |              |        |  |     +-- type?
       |     |              |        |  |     |     bt:as-path-segment-type
       |     |              |        |  |     +-- member*
       |     |              |        |  |           inet:as-number
       |     |              |        |  +-- next-hop?
       |     |              |        |  |     inet:ip-address
       |     |              |        |  +-- link-local-next-hop?
       |     |              |        |  |     inet:ipv6-address
       |     |              |        |  +-- med?
       |     |              |        |  |     uint32
       |     |              |        |  +-- local-pref?
       |     |              |        |  |     uint32
       |     |              |        |  +-- as4-path
       |     |              |        |  |  +-- segment*
       |     |              |        |  |     +-- type?
       |     |              |        |  |     |     bt:as-path-segment-type
       |     |              |        |  |     +-- member*
       |     |              |        |  |           inet:as-number
       |     |              |        |  +-- aggregator
       |     |              |        |  |  +-- as?
       |     |              |        |  |  |     inet:as-number
       |     |              |        |  |  +-- identifier?
       |     |              |        |  |        yang:dotted-quad
       |     |              |        |  +-- aggregator4
       |     |              |        |  |  +-- as4?
       |     |              |        |  |  |     inet:as-number
       |     |              |        |  |  +-- identifier?
       |     |              |        |  |        yang:dotted-quad
       |     |              |        |  +-- atomic-aggregate?
       |     |              |        |  |     boolean
       |     |              |        |  +-- originator-id?
       |     |              |        |  |     yang:dotted-quad
       |     |              |        |  +-- cluster-list*
       |     |              |        |  |     yang:dotted-quad
       |     |              |        |  +-- aigp-metric?
       |     |              |        |        uint64
       |     |              |        +-- community*
       |     |              |        |     union
       |     |              |        +-- ext-community*
       |     |              |        |     bct:bgp-ext-community-type
       |     |              |        +-- ext-community-raw*
       |     |              |        |     string
       |     |              |        +-- ipv6-ext-community*
       |     |              |        |     bct:bgp-ipv6-ext-community-type
       |     |              |        +-- ipv6-ext-community-raw*
       |     |              |        |     string
       |     |              |        +-- large-community*
       |     |              |        |     bct:bgp-large-community-type
       |     |              |        +-- last-modified?
       |     |              |        |     yang:timeticks
       |     |              |        +-- eligible-route?
       |     |              |        |     boolean
       |     |              |        +-- ineligible-reason?
       |     |              |        |     identityref
       |     |              |        +-- unknown-attributes
       |     |              |        |  +-- unknown-attribute*
       |     |              |        |        [attr-type]
       |     |              |        |     +-- attr-type     uint8
       |     |              |        |     +-- optional?     boolean
       |     |              |        |     +-- transitive?   boolean
       |     |              |        |     +-- partial?      boolean
       |     |              |        |     +-- extended?     boolean
       |     |              |        |     +-- attr-len?     uint16
       |     |              |        |     +-- attr-value?   binary
       |     |              |        +-- reject-reason?
       |     |              |              union
       |     |              +--:(adj-rib-in-post)
       |     |              |  +-- adj-rib-in-post
       |     |              |     +-- route
       |     |              |        +-- prefix
       |     |              |        |     inet:ipv6-prefix
       |     |              |        +-- path-id?
       |     |              |        |     uint32
       |     |              |        +-- attributes
       |     |              |        |  +-- origin
       |     |              |        |  |     bt:bgp-origin-attr-type
       |     |              |        |  +-- as-path
       |     |              |        |  |  +-- segment*
       |     |              |        |  |     +-- type?
       |     |              |        |  |     |     bt:as-path-segment-type
       |     |              |        |  |     +-- member*
       |     |              |        |  |           inet:as-number
       |     |              |        |  +-- next-hop?
       |     |              |        |  |     inet:ip-address
       |     |              |        |  +-- link-local-next-hop?
       |     |              |        |  |     inet:ipv6-address
       |     |              |        |  +-- med?
       |     |              |        |  |     uint32
       |     |              |        |  +-- local-pref?
       |     |              |        |  |     uint32
       |     |              |        |  +-- as4-path
       |     |              |        |  |  +-- segment*
       |     |              |        |  |     +-- type?
       |     |              |        |  |     |     bt:as-path-segment-type
       |     |              |        |  |     +-- member*
       |     |              |        |  |           inet:as-number
       |     |              |        |  +-- aggregator
       |     |              |        |  |  +-- as?
       |     |              |        |  |  |     inet:as-number
       |     |              |        |  |  +-- identifier?
       |     |              |        |  |        yang:dotted-quad
       |     |              |        |  +-- aggregator4
       |     |              |        |  |  +-- as4?
       |     |              |        |  |  |     inet:as-number
       |     |              |        |  |  +-- identifier?
       |     |              |        |  |        yang:dotted-quad
       |     |              |        |  +-- atomic-aggregate?
       |     |              |        |  |     boolean
       |     |              |        |  +-- originator-id?
       |     |              |        |  |     yang:dotted-quad
       |     |              |        |  +-- cluster-list*
       |     |              |        |  |     yang:dotted-quad
       |     |              |        |  +-- aigp-metric?
       |     |              |        |        uint64
       |     |              |        +-- community*
       |     |              |        |     union
       |     |              |        +-- ext-community*
       |     |              |        |     bct:bgp-ext-community-type
       |     |              |        +-- ext-community-raw*
       |     |              |        |     string
       |     |              |        +-- ipv6-ext-community*
       |     |              |        |     bct:bgp-ipv6-ext-community-type
       |     |              |        +-- ipv6-ext-community-raw*
       |     |              |        |     string
       |     |              |        +-- large-community*
       |     |              |        |     bct:bgp-large-community-type
       |     |              |        +-- last-modified?
       |     |              |        |     yang:timeticks
       |     |              |        +-- eligible-route?
       |     |              |        |     boolean
       |     |              |        +-- ineligible-reason?
       |     |              |        |     identityref
       |     |              |        +-- best-path?
       |     |              |        |     boolean
       |     |              |        +-- unknown-attributes
       |     |              |        |  +-- unknown-attribute*
       |     |              |        |        [attr-type]
       |     |              |        |     +-- attr-type     uint8
       |     |              |        |     +-- optional?     boolean
       |     |              |        |     +-- transitive?   boolean
       |     |              |        |     +-- partial?      boolean
       |     |              |        |     +-- extended?     boolean
       |     |              |        |     +-- attr-len?     uint16
       |     |              |        |     +-- attr-value?   binary
       |     |              |        +-- reject-reason?
       |     |              |              union
       |     |              +--:(adj-rib-out-pre)
       |     |              |  +-- adj-rib-out-pre
       |     |              |     +-- route
       |     |              |        +-- prefix
       |     |              |        |     inet:ipv6-prefix
       |     |              |        +-- path-id?
       |     |              |        |     uint32
       |     |              |        +-- attributes
       |     |              |        |  +-- origin
       |     |              |        |  |     bt:bgp-origin-attr-type
       |     |              |        |  +-- as-path
       |     |              |        |  |  +-- segment*
       |     |              |        |  |     +-- type?
       |     |              |        |  |     |     bt:as-path-segment-type
       |     |              |        |  |     +-- member*
       |     |              |        |  |           inet:as-number
       |     |              |        |  +-- next-hop?
       |     |              |        |  |     inet:ip-address
       |     |              |        |  +-- link-local-next-hop?
       |     |              |        |  |     inet:ipv6-address
       |     |              |        |  +-- med?
       |     |              |        |  |     uint32
       |     |              |        |  +-- local-pref?
       |     |              |        |  |     uint32
       |     |              |        |  +-- as4-path
       |     |              |        |  |  +-- segment*
       |     |              |        |  |     +-- type?
       |     |              |        |  |     |     bt:as-path-segment-type
       |     |              |        |  |     +-- member*
       |     |              |        |  |           inet:as-number
       |     |              |        |  +-- aggregator
       |     |              |        |  |  +-- as?
       |     |              |        |  |  |     inet:as-number
       |     |              |        |  |  +-- identifier?
       |     |              |        |  |        yang:dotted-quad
       |     |              |        |  +-- aggregator4
       |     |              |        |  |  +-- as4?
       |     |              |        |  |  |     inet:as-number
       |     |              |        |  |  +-- identifier?
       |     |              |        |  |        yang:dotted-quad
       |     |              |        |  +-- atomic-aggregate?
       |     |              |        |  |     boolean
       |     |              |        |  +-- originator-id?
       |     |              |        |  |     yang:dotted-quad
       |     |              |        |  +-- cluster-list*
       |     |              |        |  |     yang:dotted-quad
       |     |              |        |  +-- aigp-metric?
       |     |              |        |        uint64
       |     |              |        +-- community*
       |     |              |        |     union
       |     |              |        +-- ext-community*
       |     |              |        |     bct:bgp-ext-community-type
       |     |              |        +-- ext-community-raw*
       |     |              |        |     string
       |     |              |        +-- ipv6-ext-community*
       |     |              |        |     bct:bgp-ipv6-ext-community-type
       |     |              |        +-- ipv6-ext-community-raw*
       |     |              |        |     string
       |     |              |        +-- large-community*
       |     |              |        |     bct:bgp-large-community-type
       |     |              |        +-- last-modified?
       |     |              |        |     yang:timeticks
       |     |              |        +-- eligible-route?
       |     |              |        |     boolean
       |     |              |        +-- ineligible-reason?
       |     |              |        |     identityref
       |     |              |        +-- unknown-attributes
       |     |              |        |  +-- unknown-attribute*
       |     |              |        |        [attr-type]
       |     |              |        |     +-- attr-type     uint8
       |     |              |        |     +-- optional?     boolean
       |     |              |        |     +-- transitive?   boolean
       |     |              |        |     +-- partial?      boolean
       |     |              |        |     +-- extended?     boolean
       |     |              |        |     +-- attr-len?     uint16
       |     |              |        |     +-- attr-value?   binary
       |     |              |        +-- reject-reason?
       |     |              |              union
       |     |              +--:(adj-rib-out-post)
       |     |                 +-- adj-rib-out-post
       |     |                    +-- route
       |     |                       +-- prefix
       |     |                       |     inet:ipv6-prefix
       |     |                       +-- path-id?
       |     |                       |     uint32
       |     |                       +-- attributes
       |     |                       |  +-- origin
       |     |                       |  |     bt:bgp-origin-attr-type
       |     |                       |  +-- as-path
       |     |                       |  |  +-- segment*
       |     |                       |  |     +-- type?
       |     |                       |  |     |     bt:as-path-segment-type
       |     |                       |  |     +-- member*
       |     |                       |  |           inet:as-number
       |     |                       |  +-- next-hop?
       |     |                       |  |     inet:ip-address
       |     |                       |  +-- link-local-next-hop?
       |     |                       |  |     inet:ipv6-address
       |     |                       |  +-- med?
       |     |                       |  |     uint32
       |     |                       |  +-- local-pref?
       |     |                       |  |     uint32
       |     |                       |  +-- as4-path
       |     |                       |  |  +-- segment*
       |     |                       |  |     +-- type?
       |     |                       |  |     |     bt:as-path-segment-type
       |     |                       |  |     +-- member*
       |     |                       |  |           inet:as-number
       |     |                       |  +-- aggregator
       |     |                       |  |  +-- as?
       |     |                       |  |  |     inet:as-number
       |     |                       |  |  +-- identifier?
       |     |                       |  |        yang:dotted-quad
       |     |                       |  +-- aggregator4
       |     |                       |  |  +-- as4?
       |     |                       |  |  |     inet:as-number
       |     |                       |  |  +-- identifier?
       |     |                       |  |        yang:dotted-quad
       |     |                       |  +-- atomic-aggregate?
       |     |                       |  |     boolean
       |     |                       |  +-- originator-id?
       |     |                       |  |     yang:dotted-quad
       |     |                       |  +-- cluster-list*
       |     |                       |  |     yang:dotted-quad
       |     |                       |  +-- aigp-metric?
       |     |                       |        uint64
       |     |                       +-- community*
       |     |                       |     union
       |     |                       +-- ext-community*
       |     |                       |     bct:bgp-ext-community-type
       |     |                       +-- ext-community-raw*
       |     |                       |     string
       |     |                       +-- ipv6-ext-community*
       |     |                       |     bct:bgp-ipv6-ext-community-type
       |     |                       +-- ipv6-ext-community-raw*
       |     |                       |     string
       |     |                       +-- large-community*
       |     |                       |     bct:bgp-large-community-type
       |     |                       +-- last-modified?
       |     |                       |     yang:timeticks
       |     |                       +-- eligible-route?
       |     |                       |     boolean
       |     |                       +-- ineligible-reason?
       |     |                       |     identityref
       |     |                       +-- unknown-attributes
       |     |                       |  +-- unknown-attribute*
       |     |                       |        [attr-type]
       |     |                       |     +-- attr-type     uint8
       |     |                       |     +-- optional?     boolean
       |     |                       |     +-- transitive?   boolean
       |     |                       |     +-- partial?      boolean
       |     |                       |     +-- extended?     boolean
       |     |                       |     +-- attr-len?     uint16
       |     |                       |     +-- attr-value?   binary
       |     |                       +-- reject-reason?
       |     |                             union
       |     +-- path-status!
       |     |  +-- invalid?                    boolean
       |     |  +-- best?                       boolean
       |     |  +-- nonselected?                boolean
       |     |  +-- primary?                    boolean
       |     |  +-- backup?                     boolean
       |     |  +-- non-installed?              boolean
       |     |  +-- best-external?              boolean
       |     |  +-- add-path?                   boolean
       |     |  +-- filtered-inbound-policy?    boolean
       |     |  +-- filtered-outbound-policy?   boolean
       |     |  +-- stale?                      boolean
       |     |  +-- suppressed?                 boolean
       |     |  +-- reason-code?
       |     |        path-status-reason-code
       |     +-- vrf-table-name?       string
       |     +-- sequence-number?      uint64
       |     +-- timestamps* [timestamp-type]
       |     |  +-- timestamp-type    timestamp-type
       |     |  +-- timestamp         yang:date-and-time
       |     +-- extended-flags!
       |        +-- ipv6-peer?        boolean
       |        +-- post-policy?      boolean
       |        +-- legacy-as-path?   boolean
       |        +-- adj-rib-out?      boolean
       |        +-- filtered?         boolean
       +--:(statistics-report)
       |  +-- statistics-report
       |     +-- peer-type             peer-type
       |     +-- peer-flags
       |     |  +-- ipv6-peer?        boolean
       |     |  +-- post-policy?      boolean
       |     |  +-- legacy-as-path?   boolean
       |     |  +-- adj-rib-out?      boolean
       |     |  +-- filtered?         boolean
       |     +-- peer-distinguisher    rt-types:route-distinguisher
       |     +-- peer-address          inet:ip-address
       |     +-- peer-as               uint32
       |     +-- peer-bgp-id           inet:ipv4-address
       |     +-- timestamp?            yang:date-and-time
       |     +-- statistics-type?      string
       |     +-- statistics-data?      uint64
       |     +-- sequence-number?      uint64
       |     +-- timestamps* [timestamp-type]
       |     |  +-- timestamp-type    timestamp-type
       |     |  +-- timestamp         yang:date-and-time
       |     +-- extended-flags!
       |        +-- ipv6-peer?        boolean
       |        +-- post-policy?      boolean
       |        +-- legacy-as-path?   boolean
       |        +-- adj-rib-out?      boolean
       |        +-- filtered?         boolean
       +--:(peer-down-notification)
       |  +-- peer-down-notification
       |     +-- peer-type             peer-type
       |     +-- peer-flags
       |     |  +-- ipv6-peer?        boolean
       |     |  +-- post-policy?      boolean
       |     |  +-- legacy-as-path?   boolean
       |     |  +-- adj-rib-out?      boolean
       |     |  +-- filtered?         boolean
       |     +-- peer-distinguisher    rt-types:route-distinguisher
       |     +-- peer-address          inet:ip-address
       |     +-- peer-as               uint32
       |     +-- peer-bgp-id           inet:ipv4-address
       |     +-- timestamp?            yang:date-and-time
       |     +-- reason                peer-down-reason-code
       |     +-- peer-down
       |     |  +-- vrf-table-name?   string
       |     +-- sequence-number?      uint64
       |     +-- timestamps* [timestamp-type]
       |     |  +-- timestamp-type    timestamp-type
       |     |  +-- timestamp         yang:date-and-time
       |     +-- extended-flags!
       |        +-- ipv6-peer?        boolean
       |        +-- post-policy?      boolean
       |        +-- legacy-as-path?   boolean
       |        +-- adj-rib-out?      boolean
       |        +-- filtered?         boolean
       +--:(peer-up-notification)
       |  +-- peer-up-notification
       |     +-- peer-type             peer-type
       |     +-- peer-flags
       |     |  +-- ipv6-peer?        boolean
       |     |  +-- post-policy?      boolean
       |     |  +-- legacy-as-path?   boolean
       |     |  +-- adj-rib-out?      boolean
       |     |  +-- filtered?         boolean
       |     +-- peer-distinguisher    rt-types:route-distinguisher
       |     +-- peer-address          inet:ip-address
       |     +-- peer-as               uint32
       |     +-- peer-bgp-id           inet:ipv4-address
       |     +-- timestamp?            yang:date-and-time
       |     +-- local-address?        inet:ip-address
       |     +-- local-port?           inet:port-number
       |     +-- remote-port?          inet:port-number
       |     +-- sent-open
       |     |  +-- version           uint8
       |     |  +-- my-as             uint32
       |     |  +-- hold-time         uint16
       |     |  +-- bgp-identifier    inet:ipv4-address
       |     |  +-- capabilities* [code index]
       |     |     +-- code     uint8
       |     |     +-- index    uint8
       |     |     +-- name?    identityref
       |     |     +-- value
       |     |        +-- mpbgp
       |     |        |  +-- afi?    iana-rt-types:address-family
       |     |        |  +-- safi?   iana-rt-types:bgp-safi
       |     |        |  +-- name?   identityref
       |     |        +-- graceful-restart
       |     |        |  +-- flags?
       |     |        |  |     bt:graceful-restart-flags
       |     |        |  +-- unknown-flags?   bits
       |     |        |  +-- restart-time?
       |     |        |  |     bt:graceful-restart-time-type
       |     |        |  +-- afi-safis*
       |     |        |     +-- afi?
       |     |        |     |     iana-rt-types:address-family
       |     |        |     +-- safi?
       |     |        |     |     iana-rt-types:bgp-safi
       |     |        |     +-- afi-safi-flags?
       |     |        |     |     bt:graceful-restart-flags-for-afi
       |     |        |     +-- afi-safi-unknown-flags?   bits
       |     |        +-- asn32
       |     |        |  +-- as?   inet:as-number
       |     |        +-- add-paths
       |     |           +-- afi-safis*
       |     |              +-- afi?    iana-rt-types:address-family
       |     |              +-- safi?   iana-rt-types:bgp-safi
       |     |              +-- mode?   enumeration
       |     +-- received-open
       |     |  +-- version           uint8
       |     |  +-- my-as             uint32
       |     |  +-- hold-time         uint16
       |     |  +-- bgp-identifier    inet:ipv4-address
       |     |  +-- capabilities* [code index]
       |     |     +-- code     uint8
       |     |     +-- index    uint8
       |     |     +-- name?    identityref
       |     |     +-- value
       |     |        +-- mpbgp
       |     |        |  +-- afi?    iana-rt-types:address-family
       |     |        |  +-- safi?   iana-rt-types:bgp-safi
       |     |        |  +-- name?   identityref
       |     |        +-- graceful-restart
       |     |        |  +-- flags?
       |     |        |  |     bt:graceful-restart-flags
       |     |        |  +-- unknown-flags?   bits
       |     |        |  +-- restart-time?
       |     |        |  |     bt:graceful-restart-time-type
       |     |        |  +-- afi-safis*
       |     |        |     +-- afi?
       |     |        |     |     iana-rt-types:address-family
       |     |        |     +-- safi?
       |     |        |     |     iana-rt-types:bgp-safi
       |     |        |     +-- afi-safi-flags?
       |     |        |     |     bt:graceful-restart-flags-for-afi
       |     |        |     +-- afi-safi-unknown-flags?   bits
       |     |        +-- asn32
       |     |        |  +-- as?   inet:as-number
       |     |        +-- add-paths
       |     |           +-- afi-safis*
       |     |              +-- afi?    iana-rt-types:address-family
       |     |              +-- safi?   iana-rt-types:bgp-safi
       |     |              +-- mode?   enumeration
       |     +-- information!
       |     |  +-- string*           string
       |     |  +-- sys-descr?        string
       |     |  +-- sys-name?         string
       |     |  +-- vrf-table-name?   string
       |     +-- sequence-number?      uint64
       |     +-- timestamps* [timestamp-type]
       |     |  +-- timestamp-type    timestamp-type
       |     |  +-- timestamp         yang:date-and-time
       |     +-- extended-flags!
       |        +-- ipv6-peer?        boolean
       |        +-- post-policy?      boolean
       |        +-- legacy-as-path?   boolean
       |        +-- adj-rib-out?      boolean
       |        +-- filtered?         boolean
       +--:(initiation-message)
       |  +-- initiation-message
       |     +-- string*            string
       |     +-- sys-descr?         string
       |     +-- sys-name?          string
       |     +-- vrf-table-name?    string
       |     +-- sequence-number?   uint64
       |     +-- timestamps* [timestamp-type]
       |     |  +-- timestamp-type    timestamp-type
       |     |  +-- timestamp         yang:date-and-time
       |     +-- extended-flags!
       |        +-- ipv6-peer?        boolean
       |        +-- post-policy?      boolean
       |        +-- legacy-as-path?   boolean
       |        +-- adj-rib-out?      boolean
       |        +-- filtered?         boolean
       +--:(termination-message)
       |  +-- termination-message
       |     +-- string*            string
       |     +-- reason             enumeration
       |     +-- sequence-number?   uint64
       |     +-- timestamps* [timestamp-type]
       |     |  +-- timestamp-type    timestamp-type
       |     |  +-- timestamp         yang:date-and-time
       |     +-- extended-flags!
       |        +-- ipv6-peer?        boolean
       |        +-- post-policy?      boolean
       |        +-- legacy-as-path?   boolean
       |        +-- adj-rib-out?      boolean
       |        +-- filtered?         boolean
       +--:(route-mirroring-message)
          +-- route-mirroring-message
             +-- peer-type             peer-type
             +-- peer-flags
             |  +-- ipv6-peer?        boolean
             |  +-- post-policy?      boolean
             |  +-- legacy-as-path?   boolean
             |  +-- adj-rib-out?      boolean
             |  +-- filtered?         boolean
             +-- peer-distinguisher    rt-types:route-distinguisher
             +-- peer-address          inet:ip-address
             +-- peer-as               uint32
             +-- peer-bgp-id           inet:ipv4-address
             +-- timestamp?            yang:date-and-time
             +-- afi-safi-type         identityref
             +-- rib-entry
             |  +-- (afi-safi)
             |     +--:(ipv4-unicast)
             |     |  +-- ipv4-unicast
             |     |     +-- (rib-type)
             |     |        +--:(loc-rib)
             |     |        |  +-- loc-rib
             |     |        |     +-- route
             |     |        |        +-- prefix
             |     |        |        |     inet:ipv4-prefix
             |     |        |        +-- origin?
             |     |        |        |     union
             |     |        |        +-- path-id?
             |     |        |        |     uint32
             |     |        |        +-- attributes
             |     |        |        |  +-- origin
             |     |        |        |  |     bt:bgp-origin-attr-type
             |     |        |        |  +-- as-path
             |     |        |        |  |  +-- segment*
             |     |        |        |  |     +-- type?
             |     |        |        |  |     |     bt:as-path-segment-type
             |     |        |        |  |     +-- member*
             |     |        |        |  |           inet:as-number
             |     |        |        |  +-- next-hop?
             |     |        |        |  |     inet:ip-address
             |     |        |        |  +-- link-local-next-hop?
             |     |        |        |  |     inet:ipv6-address
             |     |        |        |  +-- med?
             |     |        |        |  |     uint32
             |     |        |        |  +-- local-pref?
             |     |        |        |  |     uint32
             |     |        |        |  +-- as4-path
             |     |        |        |  |  +-- segment*
             |     |        |        |  |     +-- type?
             |     |        |        |  |     |     bt:as-path-segment-type
             |     |        |        |  |     +-- member*
             |     |        |        |  |           inet:as-number
             |     |        |        |  +-- aggregator
             |     |        |        |  |  +-- as?
             |     |        |        |  |  |     inet:as-number
             |     |        |        |  |  +-- identifier?
             |     |        |        |  |        yang:dotted-quad
             |     |        |        |  +-- aggregator4
             |     |        |        |  |  +-- as4?
             |     |        |        |  |  |     inet:as-number
             |     |        |        |  |  +-- identifier?
             |     |        |        |  |        yang:dotted-quad
             |     |        |        |  +-- atomic-aggregate?
             |     |        |        |  |     boolean
             |     |        |        |  +-- originator-id?
             |     |        |        |  |     yang:dotted-quad
             |     |        |        |  +-- cluster-list*
             |     |        |        |  |     yang:dotted-quad
             |     |        |        |  +-- aigp-metric?
             |     |        |        |        uint64
             |     |        |        +-- community*
             |     |        |        |     union
             |     |        |        +-- ext-community*
             |     |        |        |     bct:bgp-ext-community-type
             |     |        |        +-- ext-community-raw*
             |     |        |        |     string
             |     |        |        +-- ipv6-ext-community*
             |     |        |        |     bct:bgp-ipv6-ext-community-type
             |     |        |        +-- ipv6-ext-community-raw*
             |     |        |        |     string
             |     |        |        +-- large-community*
             |     |        |        |     bct:bgp-large-community-type
             |     |        |        +-- last-modified?
             |     |        |        |     yang:timeticks
             |     |        |        +-- eligible-route?
             |     |        |        |     boolean
             |     |        |        +-- ineligible-reason?
             |     |        |        |     identityref
             |     |        |        +-- unknown-attributes
             |     |        |        |  +-- unknown-attribute*
             |     |        |        |        [attr-type]
             |     |        |        |     +-- attr-type     uint8
             |     |        |        |     +-- optional?     boolean
             |     |        |        |     +-- transitive?   boolean
             |     |        |        |     +-- partial?      boolean
             |     |        |        |     +-- extended?     boolean
             |     |        |        |     +-- attr-len?     uint16
             |     |        |        |     +-- attr-value?   binary
             |     |        |        +-- reject-reason?
             |     |        |              union
             |     |        +--:(adj-rib-in-pre)
             |     |        |  +-- adj-rib-in-pre
             |     |        |     +-- route
             |     |        |        +-- prefix
             |     |        |        |     inet:ipv4-prefix
             |     |        |        +-- path-id?
             |     |        |        |     uint32
             |     |        |        +-- attributes
             |     |        |        |  +-- origin
             |     |        |        |  |     bt:bgp-origin-attr-type
             |     |        |        |  +-- as-path
             |     |        |        |  |  +-- segment*
             |     |        |        |  |     +-- type?
             |     |        |        |  |     |     bt:as-path-segment-type
             |     |        |        |  |     +-- member*
             |     |        |        |  |           inet:as-number
             |     |        |        |  +-- next-hop?
             |     |        |        |  |     inet:ip-address
             |     |        |        |  +-- link-local-next-hop?
             |     |        |        |  |     inet:ipv6-address
             |     |        |        |  +-- med?
             |     |        |        |  |     uint32
             |     |        |        |  +-- local-pref?
             |     |        |        |  |     uint32
             |     |        |        |  +-- as4-path
             |     |        |        |  |  +-- segment*
             |     |        |        |  |     +-- type?
             |     |        |        |  |     |     bt:as-path-segment-type
             |     |        |        |  |     +-- member*
             |     |        |        |  |           inet:as-number
             |     |        |        |  +-- aggregator
             |     |        |        |  |  +-- as?
             |     |        |        |  |  |     inet:as-number
             |     |        |        |  |  +-- identifier?
             |     |        |        |  |        yang:dotted-quad
             |     |        |        |  +-- aggregator4
             |     |        |        |  |  +-- as4?
             |     |        |        |  |  |     inet:as-number
             |     |        |        |  |  +-- identifier?
             |     |        |        |  |        yang:dotted-quad
             |     |        |        |  +-- atomic-aggregate?
             |     |        |        |  |     boolean
             |     |        |        |  +-- originator-id?
             |     |        |        |  |     yang:dotted-quad
             |     |        |        |  +-- cluster-list*
             |     |        |        |  |     yang:dotted-quad
             |     |        |        |  +-- aigp-metric?
             |     |        |        |        uint64
             |     |        |        +-- community*
             |     |        |        |     union
             |     |        |        +-- ext-community*
             |     |        |        |     bct:bgp-ext-community-type
             |     |        |        +-- ext-community-raw*
             |     |        |        |     string
             |     |        |        +-- ipv6-ext-community*
             |     |        |        |     bct:bgp-ipv6-ext-community-type
             |     |        |        +-- ipv6-ext-community-raw*
             |     |        |        |     string
             |     |        |        +-- large-community*
             |     |        |        |     bct:bgp-large-community-type
             |     |        |        +-- last-modified?
             |     |        |        |     yang:timeticks
             |     |        |        +-- eligible-route?
             |     |        |        |     boolean
             |     |        |        +-- ineligible-reason?
             |     |        |        |     identityref
             |     |        |        +-- unknown-attributes
             |     |        |        |  +-- unknown-attribute*
             |     |        |        |        [attr-type]
             |     |        |        |     +-- attr-type     uint8
             |     |        |        |     +-- optional?     boolean
             |     |        |        |     +-- transitive?   boolean
             |     |        |        |     +-- partial?      boolean
             |     |        |        |     +-- extended?     boolean
             |     |        |        |     +-- attr-len?     uint16
             |     |        |        |     +-- attr-value?   binary
             |     |        |        +-- reject-reason?
             |     |        |              union
             |     |        +--:(adj-rib-in-post)
             |     |        |  +-- adj-rib-in-post
             |     |        |     +-- route
             |     |        |        +-- prefix
             |     |        |        |     inet:ipv4-prefix
             |     |        |        +-- path-id?
             |     |        |        |     uint32
             |     |        |        +-- attributes
             |     |        |        |  +-- origin
             |     |        |        |  |     bt:bgp-origin-attr-type
             |     |        |        |  +-- as-path
             |     |        |        |  |  +-- segment*
             |     |        |        |  |     +-- type?
             |     |        |        |  |     |     bt:as-path-segment-type
             |     |        |        |  |     +-- member*
             |     |        |        |  |           inet:as-number
             |     |        |        |  +-- next-hop?
             |     |        |        |  |     inet:ip-address
             |     |        |        |  +-- link-local-next-hop?
             |     |        |        |  |     inet:ipv6-address
             |     |        |        |  +-- med?
             |     |        |        |  |     uint32
             |     |        |        |  +-- local-pref?
             |     |        |        |  |     uint32
             |     |        |        |  +-- as4-path
             |     |        |        |  |  +-- segment*
             |     |        |        |  |     +-- type?
             |     |        |        |  |     |     bt:as-path-segment-type
             |     |        |        |  |     +-- member*
             |     |        |        |  |           inet:as-number
             |     |        |        |  +-- aggregator
             |     |        |        |  |  +-- as?
             |     |        |        |  |  |     inet:as-number
             |     |        |        |  |  +-- identifier?
             |     |        |        |  |        yang:dotted-quad
             |     |        |        |  +-- aggregator4
             |     |        |        |  |  +-- as4?
             |     |        |        |  |  |     inet:as-number
             |     |        |        |  |  +-- identifier?
             |     |        |        |  |        yang:dotted-quad
             |     |        |        |  +-- atomic-aggregate?
             |     |        |        |  |     boolean
             |     |        |        |  +-- originator-id?
             |     |        |        |  |     yang:dotted-quad
             |     |        |        |  +-- cluster-list*
             |     |        |        |  |     yang:dotted-quad
             |     |        |        |  +-- aigp-metric?
             |     |        |        |        uint64
             |     |        |        +-- community*
             |     |        |        |     union
             |     |        |        +-- ext-community*
             |     |        |        |     bct:bgp-ext-community-type
             |     |        |        +-- ext-community-raw*
             |     |        |        |     string
             |     |        |        +-- ipv6-ext-community*
             |     |        |        |     bct:bgp-ipv6-ext-community-type
             |     |        |        +-- ipv6-ext-community-raw*
             |     |        |        |     string
             |     |        |        +-- large-community*
             |     |        |        |     bct:bgp-large-community-type
             |     |        |        +-- last-modified?
             |     |        |        |     yang:timeticks
             |     |        |        +-- eligible-route?
             |     |        |        |     boolean
             |     |        |        +-- ineligible-reason?
             |     |        |        |     identityref
             |     |        |        +-- best-path?
             |     |        |        |     boolean
             |     |        |        +-- unknown-attributes
             |     |        |        |  +-- unknown-attribute*
             |     |        |        |        [attr-type]
             |     |        |        |     +-- attr-type     uint8
             |     |        |        |     +-- optional?     boolean
             |     |        |        |     +-- transitive?   boolean
             |     |        |        |     +-- partial?      boolean
             |     |        |        |     +-- extended?     boolean
             |     |        |        |     +-- attr-len?     uint16
             |     |        |        |     +-- attr-value?   binary
             |     |        |        +-- reject-reason?
             |     |        |              union
             |     |        +--:(adj-rib-out-pre)
             |     |        |  +-- adj-rib-out-pre
             |     |        |     +-- route
             |     |        |        +-- prefix
             |     |        |        |     inet:ipv4-prefix
             |     |        |        +-- path-id?
             |     |        |        |     uint32
             |     |        |        +-- attributes
             |     |        |        |  +-- origin
             |     |        |        |  |     bt:bgp-origin-attr-type
             |     |        |        |  +-- as-path
             |     |        |        |  |  +-- segment*
             |     |        |        |  |     +-- type?
             |     |        |        |  |     |     bt:as-path-segment-type
             |     |        |        |  |     +-- member*
             |     |        |        |  |           inet:as-number
             |     |        |        |  +-- next-hop?
             |     |        |        |  |     inet:ip-address
             |     |        |        |  +-- link-local-next-hop?
             |     |        |        |  |     inet:ipv6-address
             |     |        |        |  +-- med?
             |     |        |        |  |     uint32
             |     |        |        |  +-- local-pref?
             |     |        |        |  |     uint32
             |     |        |        |  +-- as4-path
             |     |        |        |  |  +-- segment*
             |     |        |        |  |     +-- type?
             |     |        |        |  |     |     bt:as-path-segment-type
             |     |        |        |  |     +-- member*
             |     |        |        |  |           inet:as-number
             |     |        |        |  +-- aggregator
             |     |        |        |  |  +-- as?
             |     |        |        |  |  |     inet:as-number
             |     |        |        |  |  +-- identifier?
             |     |        |        |  |        yang:dotted-quad
             |     |        |        |  +-- aggregator4
             |     |        |        |  |  +-- as4?
             |     |        |        |  |  |     inet:as-number
             |     |        |        |  |  +-- identifier?
             |     |        |        |  |        yang:dotted-quad
             |     |        |        |  +-- atomic-aggregate?
             |     |        |        |  |     boolean
             |     |        |        |  +-- originator-id?
             |     |        |        |  |     yang:dotted-quad
             |     |        |        |  +-- cluster-list*
             |     |        |        |  |     yang:dotted-quad
             |     |        |        |  +-- aigp-metric?
             |     |        |        |        uint64
             |     |        |        +-- community*
             |     |        |        |     union
             |     |        |        +-- ext-community*
             |     |        |        |     bct:bgp-ext-community-type
             |     |        |        +-- ext-community-raw*
             |     |        |        |     string
             |     |        |        +-- ipv6-ext-community*
             |     |        |        |     bct:bgp-ipv6-ext-community-type
             |     |        |        +-- ipv6-ext-community-raw*
             |     |        |        |     string
             |     |        |        +-- large-community*
             |     |        |        |     bct:bgp-large-community-type
             |     |        |        +-- last-modified?
             |     |        |        |     yang:timeticks
             |     |        |        +-- eligible-route?
             |     |        |        |     boolean
             |     |        |        +-- ineligible-reason?
             |     |        |        |     identityref
             |     |        |        +-- unknown-attributes
             |     |        |        |  +-- unknown-attribute*
             |     |        |        |        [attr-type]
             |     |        |        |     +-- attr-type     uint8
             |     |        |        |     +-- optional?     boolean
             |     |        |        |     +-- transitive?   boolean
             |     |        |        |     +-- partial?      boolean
             |     |        |        |     +-- extended?     boolean
             |     |        |        |     +-- attr-len?     uint16
             |     |        |        |     +-- attr-value?   binary
             |     |        |        +-- reject-reason?
             |     |        |              union
             |     |        +--:(adj-rib-out-post)
             |     |           +-- adj-rib-out-post
             |     |              +-- route
             |     |                 +-- prefix
             |     |                 |     inet:ipv4-prefix
             |     |                 +-- path-id?
             |     |                 |     uint32
             |     |                 +-- attributes
             |     |                 |  +-- origin
             |     |                 |  |     bt:bgp-origin-attr-type
             |     |                 |  +-- as-path
             |     |                 |  |  +-- segment*
             |     |                 |  |     +-- type?
             |     |                 |  |     |     bt:as-path-segment-type
             |     |                 |  |     +-- member*
             |     |                 |  |           inet:as-number
             |     |                 |  +-- next-hop?
             |     |                 |  |     inet:ip-address
             |     |                 |  +-- link-local-next-hop?
             |     |                 |  |     inet:ipv6-address
             |     |                 |  +-- med?
             |     |                 |  |     uint32
             |     |                 |  +-- local-pref?
             |     |                 |  |     uint32
             |     |                 |  +-- as4-path
             |     |                 |  |  +-- segment*
             |     |                 |  |     +-- type?
             |     |                 |  |     |     bt:as-path-segment-type
             |     |                 |  |     +-- member*
             |     |                 |  |           inet:as-number
             |     |                 |  +-- aggregator
             |     |                 |  |  +-- as?
             |     |                 |  |  |     inet:as-number
             |     |                 |  |  +-- identifier?
             |     |                 |  |        yang:dotted-quad
             |     |                 |  +-- aggregator4
             |     |                 |  |  +-- as4?
             |     |                 |  |  |     inet:as-number
             |     |                 |  |  +-- identifier?
             |     |                 |  |        yang:dotted-quad
             |     |                 |  +-- atomic-aggregate?
             |     |                 |  |     boolean
             |     |                 |  +-- originator-id?
             |     |                 |  |     yang:dotted-quad
             |     |                 |  +-- cluster-list*
             |     |                 |  |     yang:dotted-quad
             |     |                 |  +-- aigp-metric?
             |     |                 |        uint64
             |     |                 +-- community*
             |     |                 |     union
             |     |                 +-- ext-community*
             |     |                 |     bct:bgp-ext-community-type
             |     |                 +-- ext-community-raw*
             |     |                 |     string
             |     |                 +-- ipv6-ext-community*
             |     |                 |     bct:bgp-ipv6-ext-community-type
             |     |                 +-- ipv6-ext-community-raw*
             |     |                 |     string
             |     |                 +-- large-community*
             |     |                 |     bct:bgp-large-community-type
             |     |                 +-- last-modified?
             |     |                 |     yang:timeticks
             |     |                 +-- eligible-route?
             |     |                 |     boolean
             |     |                 +-- ineligible-reason?
             |     |                 |     identityref
             |     |                 +-- unknown-attributes
             |     |                 |  +-- unknown-attribute*
             |     |                 |        [attr-type]
             |     |                 |     +-- attr-type     uint8
             |     |                 |     +-- optional?     boolean
             |     |                 |     +-- transitive?   boolean
             |     |                 |     +-- partial?      boolean
             |     |                 |     +-- extended?     boolean
             |     |                 |     +-- attr-len?     uint16
             |     |                 |     +-- attr-value?   binary
             |     |                 +-- reject-reason?
             |     |                       union
             |     +--:(ipv6-unicast)
             |        +-- ipv6-unicast
             |           +-- (rib-type)
             |              +--:(loc-rib)
             |              |  +-- loc-rib
             |              |     +-- route
             |              |        +-- prefix
             |              |        |     inet:ipv6-prefix
             |              |        +-- origin?
             |              |        |     union
             |              |        +-- path-id?
             |              |        |     uint32
             |              |        +-- attributes
             |              |        |  +-- origin
             |              |        |  |     bt:bgp-origin-attr-type
             |              |        |  +-- as-path
             |              |        |  |  +-- segment*
             |              |        |  |     +-- type?
             |              |        |  |     |     bt:as-path-segment-type
             |              |        |  |     +-- member*
             |              |        |  |           inet:as-number
             |              |        |  +-- next-hop?
             |              |        |  |     inet:ip-address
             |              |        |  +-- link-local-next-hop?
             |              |        |  |     inet:ipv6-address
             |              |        |  +-- med?
             |              |        |  |     uint32
             |              |        |  +-- local-pref?
             |              |        |  |     uint32
             |              |        |  +-- as4-path
             |              |        |  |  +-- segment*
             |              |        |  |     +-- type?
             |              |        |  |     |     bt:as-path-segment-type
             |              |        |  |     +-- member*
             |              |        |  |           inet:as-number
             |              |        |  +-- aggregator
             |              |        |  |  +-- as?
             |              |        |  |  |     inet:as-number
             |              |        |  |  +-- identifier?
             |              |        |  |        yang:dotted-quad
             |              |        |  +-- aggregator4
             |              |        |  |  +-- as4?
             |              |        |  |  |     inet:as-number
             |              |        |  |  +-- identifier?
             |              |        |  |        yang:dotted-quad
             |              |        |  +-- atomic-aggregate?
             |              |        |  |     boolean
             |              |        |  +-- originator-id?
             |              |        |  |     yang:dotted-quad
             |              |        |  +-- cluster-list*
             |              |        |  |     yang:dotted-quad
             |              |        |  +-- aigp-metric?
             |              |        |        uint64
             |              |        +-- community*
             |              |        |     union
             |              |        +-- ext-community*
             |              |        |     bct:bgp-ext-community-type
             |              |        +-- ext-community-raw*
             |              |        |     string
             |              |        +-- ipv6-ext-community*
             |              |        |     bct:bgp-ipv6-ext-community-type
             |              |        +-- ipv6-ext-community-raw*
             |              |        |     string
             |              |        +-- large-community*
             |              |        |     bct:bgp-large-community-type
             |              |        +-- last-modified?
             |              |        |     yang:timeticks
             |              |        +-- eligible-route?
             |              |        |     boolean
             |              |        +-- ineligible-reason?
             |              |        |     identityref
             |              |        +-- unknown-attributes
             |              |        |  +-- unknown-attribute*
             |              |        |        [attr-type]
             |              |        |     +-- attr-type     uint8
             |              |        |     +-- optional?     boolean
             |              |        |     +-- transitive?   boolean
             |              |        |     +-- partial?      boolean
             |              |        |     +-- extended?     boolean
             |              |        |     +-- attr-len?     uint16
             |              |        |     +-- attr-value?   binary
             |              |        +-- reject-reason?
             |              |              union
             |              +--:(adj-rib-in-pre)
             |              |  +-- adj-rib-in-pre
             |              |     +-- route
             |              |        +-- prefix
             |              |        |     inet:ipv6-prefix
             |              |        +-- path-id?
             |              |        |     uint32
             |              |        +-- attributes
             |              |        |  +-- origin
             |              |        |  |     bt:bgp-origin-attr-type
             |              |        |  +-- as-path
             |              |        |  |  +-- segment*
             |              |        |  |     +-- type?
             |              |        |  |     |     bt:as-path-segment-type
             |              |        |  |     +-- member*
             |              |        |  |           inet:as-number
             |              |        |  +-- next-hop?
             |              |        |  |     inet:ip-address
             |              |        |  +-- link-local-next-hop?
             |              |        |  |     inet:ipv6-address
             |              |        |  +-- med?
             |              |        |  |     uint32
             |              |        |  +-- local-pref?
             |              |        |  |     uint32
             |              |        |  +-- as4-path
             |              |        |  |  +-- segment*
             |              |        |  |     +-- type?
             |              |        |  |     |     bt:as-path-segment-type
             |              |        |  |     +-- member*
             |              |        |  |           inet:as-number
             |              |        |  +-- aggregator
             |              |        |  |  +-- as?
             |              |        |  |  |     inet:as-number
             |              |        |  |  +-- identifier?
             |              |        |  |        yang:dotted-quad
             |              |        |  +-- aggregator4
             |              |        |  |  +-- as4?
             |              |        |  |  |     inet:as-number
             |              |        |  |  +-- identifier?
             |              |        |  |        yang:dotted-quad
             |              |        |  +-- atomic-aggregate?
             |              |        |  |     boolean
             |              |        |  +-- originator-id?
             |              |        |  |     yang:dotted-quad
             |              |        |  +-- cluster-list*
             |              |        |  |     yang:dotted-quad
             |              |        |  +-- aigp-metric?
             |              |        |        uint64
             |              |        +-- community*
             |              |        |     union
             |              |        +-- ext-community*
             |              |        |     bct:bgp-ext-community-type
             |              |        +-- ext-community-raw*
             |              |        |     string
             |              |        +-- ipv6-ext-community*
             |              |        |     bct:bgp-ipv6-ext-community-type
             |              |        +-- ipv6-ext-community-raw*
             |              |        |     string
             |              |        +-- large-community*
             |              |        |     bct:bgp-large-community-type
             |              |        +-- last-modified?
             |              |        |     yang:timeticks
             |              |        +-- eligible-route?
             |              |        |     boolean
             |              |        +-- ineligible-reason?
             |              |        |     identityref
             |              |        +-- unknown-attributes
             |              |        |  +-- unknown-attribute*
             |              |        |        [attr-type]
             |              |        |     +-- attr-type     uint8
             |              |        |     +-- optional?     boolean
             |              |        |     +-- transitive?   boolean
             |              |        |     +-- partial?      boolean
             |              |        |     +-- extended?     boolean
             |              |        |     +-- attr-len?     uint16
             |              |        |     +-- attr-value?   binary
             |              |        +-- reject-reason?
             |              |              union
             |              +--:(adj-rib-in-post)
             |              |  +-- adj-rib-in-post
             |              |     +-- route
             |              |        +-- prefix
             |              |        |     inet:ipv6-prefix
             |              |        +-- path-id?
             |              |        |     uint32
             |              |        +-- attributes
             |              |        |  +-- origin
             |              |        |  |     bt:bgp-origin-attr-type
             |              |        |  +-- as-path
             |              |        |  |  +-- segment*
             |              |        |  |     +-- type?
             |              |        |  |     |     bt:as-path-segment-type
             |              |        |  |     +-- member*
             |              |        |  |           inet:as-number
             |              |        |  +-- next-hop?
             |              |        |  |     inet:ip-address
             |              |        |  +-- link-local-next-hop?
             |              |        |  |     inet:ipv6-address
             |              |        |  +-- med?
             |              |        |  |     uint32
             |              |        |  +-- local-pref?
             |              |        |  |     uint32
             |              |        |  +-- as4-path
             |              |        |  |  +-- segment*
             |              |        |  |     +-- type?
             |              |        |  |     |     bt:as-path-segment-type
             |              |        |  |     +-- member*
             |              |        |  |           inet:as-number
             |              |        |  +-- aggregator
             |              |        |  |  +-- as?
             |              |        |  |  |     inet:as-number
             |              |        |  |  +-- identifier?
             |              |        |  |        yang:dotted-quad
             |              |        |  +-- aggregator4
             |              |        |  |  +-- as4?
             |              |        |  |  |     inet:as-number
             |              |        |  |  +-- identifier?
             |              |        |  |        yang:dotted-quad
             |              |        |  +-- atomic-aggregate?
             |              |        |  |     boolean
             |              |        |  +-- originator-id?
             |              |        |  |     yang:dotted-quad
             |              |        |  +-- cluster-list*
             |              |        |  |     yang:dotted-quad
             |              |        |  +-- aigp-metric?
             |              |        |        uint64
             |              |        +-- community*
             |              |        |     union
             |              |        +-- ext-community*
             |              |        |     bct:bgp-ext-community-type
             |              |        +-- ext-community-raw*
             |              |        |     string
             |              |        +-- ipv6-ext-community*
             |              |        |     bct:bgp-ipv6-ext-community-type
             |              |        +-- ipv6-ext-community-raw*
             |              |        |     string
             |              |        +-- large-community*
             |              |        |     bct:bgp-large-community-type
             |              |        +-- last-modified?
             |              |        |     yang:timeticks
             |              |        +-- eligible-route?
             |              |        |     boolean
             |              |        +-- ineligible-reason?
             |              |        |     identityref
             |              |        +-- best-path?
             |              |        |     boolean
             |              |        +-- unknown-attributes
             |              |        |  +-- unknown-attribute*
             |              |        |        [attr-type]
             |              |        |     +-- attr-type     uint8
             |              |        |     +-- optional?     boolean
             |              |        |     +-- transitive?   boolean
             |              |        |     +-- partial?      boolean
             |              |        |     +-- extended?     boolean
             |              |        |     +-- attr-len?     uint16
             |              |        |     +-- attr-value?   binary
             |              |        +-- reject-reason?
             |              |              union
             |              +--:(adj-rib-out-pre)
             |              |  +-- adj-rib-out-pre
             |              |     +-- route
             |              |        +-- prefix
             |              |        |     inet:ipv6-prefix
             |              |        +-- path-id?
             |              |        |     uint32
             |              |        +-- attributes
             |              |        |  +-- origin
             |              |        |  |     bt:bgp-origin-attr-type
             |              |        |  +-- as-path
             |              |        |  |  +-- segment*
             |              |        |  |     +-- type?
             |              |        |  |     |     bt:as-path-segment-type
             |              |        |  |     +-- member*
             |              |        |  |           inet:as-number
             |              |        |  +-- next-hop?
             |              |        |  |     inet:ip-address
             |              |        |  +-- link-local-next-hop?
             |              |        |  |     inet:ipv6-address
             |              |        |  +-- med?
             |              |        |  |     uint32
             |              |        |  +-- local-pref?
             |              |        |  |     uint32
             |              |        |  +-- as4-path
             |              |        |  |  +-- segment*
             |              |        |  |     +-- type?
             |              |        |  |     |     bt:as-path-segment-type
             |              |        |  |     +-- member*
             |              |        |  |           inet:as-number
             |              |        |  +-- aggregator
             |              |        |  |  +-- as?
             |              |        |  |  |     inet:as-number
             |              |        |  |  +-- identifier?
             |              |        |  |        yang:dotted-quad
             |              |        |  +-- aggregator4
             |              |        |  |  +-- as4?
             |              |        |  |  |     inet:as-number
             |              |        |  |  +-- identifier?
             |              |        |  |        yang:dotted-quad
             |              |        |  +-- atomic-aggregate?
             |              |        |  |     boolean
             |              |        |  +-- originator-id?
             |              |        |  |     yang:dotted-quad
             |              |        |  +-- cluster-list*
             |              |        |  |     yang:dotted-quad
             |              |        |  +-- aigp-metric?
             |              |        |        uint64
             |              |        +-- community*
             |              |        |     union
             |              |        +-- ext-community*
             |              |        |     bct:bgp-ext-community-type
             |              |        +-- ext-community-raw*
             |              |        |     string
             |              |        +-- ipv6-ext-community*
             |              |        |     bct:bgp-ipv6-ext-community-type
             |              |        +-- ipv6-ext-community-raw*
             |              |        |     string
             |              |        +-- large-community*
             |              |        |     bct:bgp-large-community-type
             |              |        +-- last-modified?
             |              |        |     yang:timeticks
             |              |        +-- eligible-route?
             |              |        |     boolean
             |              |        +-- ineligible-reason?
             |              |        |     identityref
             |              |        +-- unknown-attributes
             |              |        |  +-- unknown-attribute*
             |              |        |        [attr-type]
             |              |        |     +-- attr-type     uint8
             |              |        |     +-- optional?     boolean
             |              |        |     +-- transitive?   boolean
             |              |        |     +-- partial?      boolean
             |              |        |     +-- extended?     boolean
             |              |        |     +-- attr-len?     uint16
             |              |        |     +-- attr-value?   binary
             |              |        +-- reject-reason?
             |              |              union
             |              +--:(adj-rib-out-post)
             |                 +-- adj-rib-out-post
             |                    +-- route
             |                       +-- prefix
             |                       |     inet:ipv6-prefix
             |                       +-- path-id?
             |                       |     uint32
             |                       +-- attributes
             |                       |  +-- origin
             |                       |  |     bt:bgp-origin-attr-type
             |                       |  +-- as-path
             |                       |  |  +-- segment*
             |                       |  |     +-- type?
             |                       |  |     |     bt:as-path-segment-type
             |                       |  |     +-- member*
             |                       |  |           inet:as-number
             |                       |  +-- next-hop?
             |                       |  |     inet:ip-address
             |                       |  +-- link-local-next-hop?
             |                       |  |     inet:ipv6-address
             |                       |  +-- med?
             |                       |  |     uint32
             |                       |  +-- local-pref?
             |                       |  |     uint32
             |                       |  +-- as4-path
             |                       |  |  +-- segment*
             |                       |  |     +-- type?
             |                       |  |     |     bt:as-path-segment-type
             |                       |  |     +-- member*
             |                       |  |           inet:as-number
             |                       |  +-- aggregator
             |                       |  |  +-- as?
             |                       |  |  |     inet:as-number
             |                       |  |  +-- identifier?
             |                       |  |        yang:dotted-quad
             |                       |  +-- aggregator4
             |                       |  |  +-- as4?
             |                       |  |  |     inet:as-number
             |                       |  |  +-- identifier?
             |                       |  |        yang:dotted-quad
             |                       |  +-- atomic-aggregate?
             |                       |  |     boolean
             |                       |  +-- originator-id?
             |                       |  |     yang:dotted-quad
             |                       |  +-- cluster-list*
             |                       |  |     yang:dotted-quad
             |                       |  +-- aigp-metric?
             |                       |        uint64
             |                       +-- community*
             |                       |     union
             |                       +-- ext-community*
             |                       |     bct:bgp-ext-community-type
             |                       +-- ext-community-raw*
             |                       |     string
             |                       +-- ipv6-ext-community*
             |                       |     bct:bgp-ipv6-ext-community-type
             |                       +-- ipv6-ext-community-raw*
             |                       |     string
             |                       +-- large-community*
             |                       |     bct:bgp-large-community-type
             |                       +-- last-modified?
             |                       |     yang:timeticks
             |                       +-- eligible-route?
             |                       |     boolean
             |                       +-- ineligible-reason?
             |                       |     identityref
             |                       +-- unknown-attributes
             |                       |  +-- unknown-attribute*
             |                       |        [attr-type]
             |                       |     +-- attr-type     uint8
             |                       |     +-- optional?     boolean
             |                       |     +-- transitive?   boolean
             |                       |     +-- partial?      boolean
             |                       |     +-- extended?     boolean
             |                       |     +-- attr-len?     uint16
             |                       |     +-- attr-value?   binary
             |                       +-- reject-reason?
             |                             union
             +-- information?          enumeration
             +-- sequence-number?      uint64
             +-- timestamps* [timestamp-type]
             |  +-- timestamp-type    timestamp-type
             |  +-- timestamp         yang:date-and-time
             +-- extended-flags!
                +-- ipv6-peer?        boolean
                +-- post-policy?      boolean
                +-- legacy-as-path?   boolean
                +-- adj-rib-out?      boolean
                +-- filtered?         boolean

Figure 1: YANG tree diagram for 'ietf-bmp-telemetry-message' module.

4.1. BMP Telemetry Message YANG Module

<CODE BEGINS> file "ietf-bmp-telemetry-message@2026-06-30.yang"


module ietf-bmp-telemetry-message {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-bmp-telemetry-message";
  prefix bmptm;

  import ietf-inet-types {
    prefix inet;
    reference
      "RFC 9911: Common YANG Data Types";
  }
  import ietf-yang-types {
    prefix yang;
    reference
      "RFC 9911: Common YANG Data Types";
  }
  import ietf-yang-structure-ext {
    prefix sx;
    reference
      "RFC 8791: YANG Data Structure Extensions";
  }
  import ietf-routing-types {
    prefix rt-types;
    reference
      "RFC 8294: Common YANG Data Types for the Routing Area.";
  }

  import ietf-bgp-open {
    prefix bgo;
    reference
      "RFC XXXX: YANG Model for a BGP OPEN Message.";
  }
  import ietf-bgp-rib-entry {
    prefix bre;
    reference
      "RFC XXXX: YANG Model for a BGP RIB Entry.";
  }
  import ietf-bmp-tlv {
    prefix btlv;
    reference
      "RFC XXXX: YANG Model for BMP TLVs.";
  }

  organization
    "IETF Draft";
  contact
    "Author:    Thomas Graf
                <mailto:thomas.graf@swisscom.com>
                Paolo Lucente
                <mailto:paolo@ntt.net>
                Leonardo Rodoni
                <mailto:leonardo.rodoni@swisscom.com>";

  description
    "Adds BMP specific subscription metadata to the data collection
     protocol provenance of the ietf-telemetry-message envelope.

     The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL',
     'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED',
     'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document
     are to be interpreted as described in BCP 14 (RFC 2119)
     (RFC 8174) when, and only when, they appear in all
     capitals, as shown here.

     Copyright (c) 2026 IETF Trust and the persons identified as
       authors of the code. All rights reserved.

     Redistribution and use in source and binary forms, with or without
     modification, is permitted pursuant to, and subject to the license
     terms contained in, the Revised BSD License set forth in Section
     4.c of the IETF Trust's Legal Provisions Relating to IETF Documents
     (https://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC XXXX; see the RFC
     itself for full legal notices.";

  revision 2026-06-30 {
    description
      "Initial revision.";
    reference
      "RFC XXXX";
  }

  typedef peer-type {
    type enumeration {
      enum global-instance-peer {
        value 0;
        description
          "Global Instance Peer";
        reference
          "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.2.";
      }
      enum rd-instance-peer {
        value 1;
        description
          "RD Instance Peer";
        reference
          "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.2.";
      }
      enum local-instance-peer {
        value 2;
        description
          "Local Instance Peer";
        reference
          "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.2.";
      }
      enum loc-rib-instance-peer {
        value 3;
        description
          "Loc-RIB Instance Peer";
        reference
          "RFC 9069: Support for Local RIB in the BGP Monitoring
           Protocol (BMP)";
      }
    }
    description
      "BMP Peer Type.";
    reference
      "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.2.";
  }

  grouping per-peer {
    description
      "BMP per-peer header.";
    reference
      "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.2.";
    leaf peer-type {
      type peer-type;
      mandatory true;
      description
        "BMP peer type from per-peer header.";
      reference
        "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.2.";
    }
    container peer-flags {
      when "not(../extended-flags)" {
        description
          "Present only when the Extended Flags TLV is absent.
           When extended-flags is present it is authoritative
           and peer-flags MUST NOT be emitted.";
      }
      description
        "BMP Per-Peer Header Flags decoded from the Per-Peer Header
         Flags field.";
      reference
        "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.2.";
      uses btlv:peer-header-flags;
    }
    leaf peer-distinguisher {
      type rt-types:route-distinguisher;
      mandatory true;
      description
        "BMP peer distinguisher from per-peer header.
         The routing instance on which the encapsulated PDU was
         received.";
      reference
        "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.2.";
    }
    leaf peer-address {
      type inet:ip-address;
      mandatory true;
      description
        "BMP peer IP address from per-peer header.";
      reference
        "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.2. The
         remote IP address associated with the TCP session over which
         the encapsulated PDU was received.";
    }
    leaf peer-as {
      type uint32;
      mandatory true;
      description
        "BMP peer autonomous system number from per-peer header. The
         Autonomous System number of the peer from which the
         encapsulated PDU was received.";
      reference
        "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.2.";
    }
    leaf peer-bgp-id {
      type inet:ipv4-address;
      mandatory true;
      description
        "BMP Peer BGP ID from per-peer header. The BGP Identifier of
         the peer from which the encapsulated PDU was received.";
      reference
        "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.2.";
    }
    leaf timestamp {
      type yang:date-and-time;
      description
        "BMP timestamp from the Per-Peer Header (RFC 7854 Section 4.2).
         Represents the time the encapsulated routes were received or
         installed in the Adj-RIB-In. Absent when the value was zero
         (unavailable) in the wire header.

         // TODO: check with bmp-tlv regarding authoritative timestamp
         The Timestamp TLV (message-timestamp in btlv:common) MAY
         also be present and carries a typed timestamp. When
         message-timestamp with type 'adj-rib-in-time' is present, it
         is the authoritative value for this same event; the other
         Timestamp TLV types (trigger-time, message-export-time,
         local-rib-time, adj-rib-out-time) carry additional timing
         information with no Per-Peer Header equivalent.";
      reference
        "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.2.;
         draft-ietf-grow-bmp-tlv: Section 5.6.1.";
    }
  }

  typedef peer-down-reason-code {
    type enumeration {
      enum local-system-closed-notification {
        value 1;
        description
          "The local system closed the session. A BGP PDU containing
           a BGP NOTIFICATION message that would have been sent to
           the peer follows the reason code.";
        reference
          "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.9.";
      }
      enum local-system-closed-fsm-event {
        value 2;
        description
          "The local system closed the session. No NOTIFICATION
           message was sent. A 2-byte field containing the FSM
           Event code follows the reason code.";
        reference
          "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.9.";
      }
      enum remote-system-closed-notification {
        value 3;
        description
          "The remote system closed the session with a NOTIFICATION
           message. The BGP PDU containing the NOTIFICATION follows
           the reason code.";
        reference
          "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.9.";
      }
      enum remote-system-closed-no-data {
        value 4;
        description
          "The remote system closed the session without a NOTIFICATION
           message. Includes any unexpected termination of the
           transport session.";
        reference
          "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.9.";
      }
      enum peer-de-configured {
        value 5;
        description
          "Information for this peer will no longer be sent to the
           monitoring station for configuration reasons.";
        reference
          "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.9.";
      }
      enum local-system-closed-tlv-data-follows {
        value 6;
        description
          "The local system closed the Loc-RIB instance peer session.
           TLV data follows (see btlv:peer-down), including the
           VRF/Table Name TLV if it was present in the Peer Up.";
        reference
          "RFC 9069: Support for Local RIB in BMP, Section 5.3.";
      }
    }
    description
      "BMP Peer Down reason codes.";
    reference
      "RFC 7854: Section 4.9; RFC 9069: Section 5.3.";
  }

  grouping mirroring {
    description
      "BMP Route Mirroring Information TLV content (type 1 in the
       Route Mirroring TLVs registry). Conveys a 2-byte information
       code about the mirrored message or message stream.";
    reference
      "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.7.";
    leaf information {
      type enumeration {
        enum error-pdu {
          value 0;
          description
            "Errored PDU. The contained message was found to have
             an error causing it to be treated-as-withdraw
             (RFC 7606). A BGP Message TLV MUST also be present.";
        }
        enum message-lost {
          value 1;
          description
            "Messages Lost. One or more messages may have been
             lost, e.g., due to buffer exhaustion.";
        }
      }
      description
        "Route Mirroring Information code.";
    }
  }

  // TODO: design better grouping for statistics
  grouping statistics {
    description
      "BMP Statistics.";
    reference
      "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.8.";
    leaf statistics-type {
      type string {
      }
      description
        "BMP statistics type. Defines the type of the statistic carried
         in the Stat Data field.";
    }
    leaf statistics-data {
      type uint64;
      description
        "BMP statistics data. Defines the value of the statistic.";
    }
  }

  grouping peer-up {
    description
      "BMP Peer Up Notification fields.";
    reference
      "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.10.";
    leaf local-address {
      type inet:ip-address;
      description
        "Local address from the Peer Up Notification. Set to
         '0::' for Loc-RIB Instance Peers.";
      reference
        "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.10.";
    }
    leaf local-port {
      type inet:port-number;
      description
        "Local port from the Peer Up Notification. Set to 0
         for Loc-RIB Instance Peers.";
      reference
        "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.10.";
    }
    leaf remote-port {
      type inet:port-number;
      description
        "Remote port from the Peer Up Notification. Set to 0
         for Loc-RIB Instance Peers.";
      reference
        "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.10.";
    }

    container sent-open {
      description
        "BGP OPEN message sent by the local router to its peer.";
      reference
        "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 4.2.
         RFC 7854: BGP Monitoring Protocol (BMP), Section 4.10.";
      uses bgo:bgp-open;
    }
    container received-open {
      description
        "BGP OPEN message received from the peer.";
      reference
        "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 4.2.
         RFC 7854: BGP Monitoring Protocol (BMP), Section 4.10.";
      uses bgo:bgp-open;
    }
  }

  sx:structure message {
    description
      "Augments telemetry-message-metadata with BMP specific
       subscription metadata";

    leaf version {
      type uint8;
      mandatory true;
      description
        "BMP version from common header.";
      reference
        "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.1.";
    }

    container session-metadata {
      presence
        "BMP Initiation message information cached by a collector
         to enrich this message with router identity context.";
      description
        "Optional metadata derived from the BMP Initiation message
         for this BMP session. A collector MAY populate sys-name,
         sys-descr or a free-form string leaf-list to make this
         message self-contained for consumers that did not process
         or store the Initiation message directly.";
      uses btlv:information;
    }

    choice message-type {
      description
        "BMP message type from common header.";
      reference
        "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.1.";
      case route-monitoring {
        container route-monitoring {
          description
            "BMP Route Monitoring message. Used for initial
             synchronization of Adj-RIBs-In and for ongoing
             incremental route monitoring.";
          uses per-peer;
          uses bre:rib-entry;
          uses btlv:route-monitoring;
          uses btlv:common;
        }
      }
      case statistics-report {
        container statistics-report {
          description
            "BMP Statistics Report message. Carries one or more
             counters reflecting activity on the monitored router.";
          uses per-peer;
          uses statistics;
          uses btlv:common;
        }
      }
      case peer-down-notification {
        container peer-down-notification {
          description
            "BMP Peer Down Notification message. Indicates that a
             peering session was terminated.";
          uses per-peer;
          leaf reason {
            type peer-down-reason-code;
            mandatory true;
            description
              "Reason why the peering session was closed.";
            reference
              "RFC 7854: BGP Monitoring Protocol (BMP), Section 4.9;
               RFC 9069: Support for Local RIB in BMP, Section 5.3.";
          }
          container peer-down {
            when "../reason = 'local-system-closed-tlv-data-follows'" {
              description
                "TLV data is present only when reason code 6 is
                 used (Loc-RIB instance peer session closed).";
            }
            description
              "Peer Down TLV data following reason code 6. Contains
               the VRF/Table Name TLV if it was present in the
               corresponding Peer Up notification.";
            uses btlv:peer-down;
          }
          uses btlv:common;
        }
      }
      case peer-up-notification {
        container peer-up-notification {
          description
            "BMP Peer Up Notification message. Indicates that a
             peering session has come up.";
          uses per-peer;
          uses peer-up;
          container information {
            presence
              "Information TLVs are present in this Peer Up
               notification";
            description
              "Optional Information TLVs at the end of the Peer Up
               message. For standard peers only the string type
               (type 0) is defined; for Loc-RIB Instance Peers the
               VRF/Table Name TLV (type 3, RFC 9069) MUST be
               included when a name is configured.";
            reference
              "RFC 7854: Section 4.10;
               RFC 9069: Section 5.2.1.";
            uses btlv:information;
          }
          uses btlv:common;
        }
      }
      case initiation-message {
        container initiation-message {
          description
            "BMP Initiation Message. Provides information about the
             monitored router. MUST be the first message sent after
             the TCP session comes up. The sysDescr and sysName
             TLVs MUST be present.";
          uses btlv:information;
          uses btlv:common;
        }
      }
      case termination-message {
        container termination-message {
          description
            "BMP Termination Message. Provides a reason why the
             monitored router is closing the BMP session.";
          uses btlv:termination;
          uses btlv:common;
        }
      }
      case route-mirroring-message {
        container route-mirroring-message {
          description
            "BMP Route Mirroring Message. Used for verbatim
             duplication of messages as received, e.g., for
             full-fidelity monitoring or error reporting.";
          uses per-peer;
          uses bre:rib-entry;
          uses mirroring;
          uses btlv:common;
        }
      }
    }
  }
}


<CODE ENDS>
Figure 2: BMP YANG 'ietf-bmp-telemetry-message' module.

4.2. BGP Open Message YANG Module

<CODE BEGINS> file "ietf-bgp-open@2026-06-30.yang"


module ietf-bgp-open {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-bgp-open";
  prefix bgo;

  import ietf-inet-types {
    prefix inet;
    reference
      "RFC 9911: Common YANG Data Types.";
  }

  // TODO: in the future import the single capabilities module if at idr
  // they decide to move from submodules to a modules
  import ietf-bgp {
    prefix bgp;
    reference
      "RFC XXXX: YANG Model for Border Gateway Protocol (BGP-4).";
  }

  organization
    "IETF Draft";
  contact
    "Author:    Thomas Graf
                <mailto:thomas.graf@swisscom.com>
                Paolo Lucente
                <mailto:paolo@ntt.net>
                Leonardo Rodoni
                <mailto:leonardo.rodoni@swisscom.com>";

  description
    "Defines a grouping for representing a BGP OPEN message as
     defined in RFC 4271. The BGP OPEN message is the first
     message sent by each side after a TCP connection is
     established and carries session parameters including the
     BGP version, the sender's AS number, the Hold Time, the
     BGP Identifier, and the list of optional capabilities.

     This module complements the ietf-bgp model by exposing the
     OPEN message fields in a standalone reusable grouping,
     intended for use by BMP and other BGP monitoring or
     telemetry protocols.

     Copyright (c) 2026 IETF Trust and the persons identified as
     authors of the code. All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject
     to the license terms contained in, the Revised BSD License
     set forth in Section 4.c of the IETF Trust's Legal
     Provisions Relating to IETF Documents
     (https://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC XXXX; see
     the RFC itself for full legal notices.

     The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL',
     'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED',
     'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document
     are to be interpreted as described in BCP 14 (RFC 2119)
     (RFC 8174) when, and only when, they appear in all
     capitals, as shown here.";

  revision 2026-06-30 {
    description
      "Initial revision.";
    reference
      "RFC XXXX";
  }

  grouping bgp-open {
    description
      "Fields from a BGP OPEN message.";
    reference
      "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 4.2.";
    leaf version {
      type uint8;
      mandatory true;
      description
        "BGP protocol version number carried in the OPEN message.
         The current BGP version number is 4.";
      reference
        "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 4.2.";
    }
    leaf my-as {
      type uint32;
      mandatory true;
      description
        "Autonomous System number of the BGP OPEN message sender.";
      reference
        "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 4.2.
         RFC 6793: BGP Support for Four-Octet Autonomous System (AS)
         Number Space.";
    }
    leaf hold-time {
      type uint16;
      units "seconds";
      mandatory true;
      description
        "Hold Time proposed by the sender in the BGP OPEN message.
         The Hold Time MUST be either zero or at least three seconds.";
      reference
        "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 4.2.";
    }
    leaf bgp-identifier {
      type inet:ipv4-address;
      mandatory true;
      description
        "BGP Identifier of the sender, set to an IP address assigned
         to that BGP speaker. The value is determined upon startup
         and is the same for every local interface and BGP peer.";
      reference
        "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 4.2.";
    }
    // TODO: check if we can ignore/need the index?
    list capabilities {
      key "code index";
      description
        "List of BGP capabilities carried in the BGP OPEN message,
         identified by the Capability Code and an index.
         The index covers the case where the same BGP Capability
         may be advertised more than once.";
      reference
        "RFC 5492: Capabilities Advertisement with BGP-4, Section 4.";
      uses bgp:bgp-capabilities-common;
    }
  }
}


<CODE ENDS>
Figure 3: BMP YANG 'ietf-bgp-open' module.

4.3. BGP RIB Entry YANG Module

<CODE BEGINS> file "ietf-bgp-rib-entry@2026-06-30.yang"


module ietf-bgp-rib-entry {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-bgp-rib-entry";
  prefix bre;

  import ietf-inet-types {
    prefix inet;
    reference
      "RFC 9911: Common YANG Data Types.";
  }
  import ietf-yang-types {
    prefix yang;
    reference
      "RFC 9911: Common YANG Data Types.";
  }
  import iana-bgp-types {
    prefix bt;
    reference
      "RFC XXXX: YANG Model for Border Gateway Protocol (BGP-4).";
  }

  // TODO: in the future import the single capabilities module if at idr
  // they decide to move from submodules to a modules
  import ietf-bgp {
    prefix bgp;
    reference
      "RFC XXXX: YANG Model for Border Gateway Protocol (BGP-4).";
  }

  organization
    "IETF Draft";
  contact
    "Author:    Thomas Graf
                <mailto:thomas.graf@swisscom.com>
                Paolo Lucente
                <mailto:paolo@ntt.net>
                Leonardo Rodoni
                <mailto:leonardo.rodoni@swisscom.com>";

  description
    "Defines a module for representing a single entry from a BGP
     Routing Information Base (RIB). The submodule supports entries
     from 5 logical RIB types per address family:

     loc-rib: An entry from the main BGP routing table for the local
     routing instance, containing best-path selections for each
     prefix. The key for the loc-rib entry corresponds either to a
     route in the adj-rib-in-post table or a route redistributed
     from another protocol.

     adj-rib-in-pre: An entry from the per-neighbor table containing
     the BGP routes received from the neighbor before any local
     input policy rules have been applied. This can be considered
     the 'raw' routes from a given neighbor.

     adj-rib-in-post: An entry from the per-neighbor table containing
     the routes received from the neighbor that are eligible for
     best-path selection after local input policy rules have been
     applied. The 'best-path' leaf is attached to the route selected
     by the BGP Decision Process (RFC 4271, Section 9.1). Such
     routes may be present in the loc-rib, described above,
     when local configuration determines that the BGP best-path will
     be used for that destination.

     adj-rib-out-pre: An entry from the per-neighbor table containing
     routes eligible for sending (advertising) to the neighbor before
     output policy rules have been applied.

     adj-rib-out-post: An entry from the per-neighbor table containing
     routes eligible for sending (advertising) to the neighbor after
     output policy rules have been applied.

     Copyright (c) 2026 IETF Trust and the persons identified as
     authors of the code. All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject to
     the license terms contained in, the Revised BSD License set
     forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents
     (https://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC XXXX
     (https://www.rfc-editor.org/info/rfcXXXX); see the RFC itself
     for full legal notices.

     The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
     NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED',
     'MAY', and 'OPTIONAL' in this document are to be interpreted as
     described in BCP 14 (RFC 2119) (RFC 8174) when, and only when,
     they appear in all capitals, as shown here.";

  revision 2026-06-30 {
    description
      "Initial Version";
    reference
      "RFC XXXX";
  }

  grouping bgp-common-route-attributes {
    description
      "BGP path attributes and communities.";
    uses bgp-path-attributes;
    uses bgp:bgp-community-attr-state;
    uses bgp:ext-community-attributes;
    uses bgp:ipv6-ext-community-attributes;
    uses bgp:large-community-attributes;
  }

  grouping bgp-path-attributes {
    description
      "BGP path attributes.";
    container attributes {
      description
        "BGP path attribute parameters.";
      leaf origin {
        type bt:bgp-origin-attr-type;
        mandatory true;
        description
          "BGP attribute defining the origin of the path information.";
        reference
          "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 5.1.1.";
      }
      container as-path {
        description
          "Enclosing container for the list of AS path segments.";
        reference
          "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 5.1.2.
           RFC 6793: BGP Support for Four-Octet Autonomous System (AS)
           Number Space.
           RFC 5065: Autonomous System Confederations for BGP.";
        list segment {
          uses bgp:bgp-as-path-segment;
          description
            "List of AS PATH segments.";
        }
      }
      leaf next-hop {
        type inet:ip-address;
        description
          "BGP next hop attribute.";
        reference
          "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 5.1.3.";
      }
      leaf link-local-next-hop {
        type inet:ipv6-address;
        description
          "Link-local next-hop when using RFC 2545 procedures.";
        reference
          "RFC 2545: Use of BGP-4 Multiprotocol Extensions for IPv6
           Inter-Domain Routing.";
      }
      leaf med {
        type uint32;
        description
          "BGP multi-exit discriminator attribute.";
        reference
          "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 5.1.4.";
      }
      leaf local-pref {
        type uint32;
        description
          "BGP local preference attribute.";
        reference
          "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 5.1.5.";
      }
      container as4-path {
        description
          "AS4_PATH attribute for 4-octet AS numbers in Adj-RIB-In/Out.
           Not populated in Loc-RIB.";
        reference
          "RFC 6793: BGP Support for Four-octet AS Number Space.";
        list segment {
          uses bgp:bgp-as-path-segment;
          description
            "List of AS PATH segments.";
        }
      }
      container aggregator {
        description
          "BGP AGGREGATOR attribute.";
        reference
          "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 5.1.7.
           RFC 6793: BGP Support for Four-octet AS Number Space.";
        leaf as {
          type inet:as-number;
          description
            "AS number of the aggregating router.";
          reference
            "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 5.1.7.";
        }
        leaf identifier {
          type yang:dotted-quad;
          description
            "BGP Identifier of the aggregating router.";
          reference
            "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 5.1.7.";
        }
      }
      container aggregator4 {
        description
          "AS4_AGGREGATOR attribute. Not populated in Loc-RIB.";
        reference
          "RFC 6793: BGP Support for Four-Octet Autonomous System (AS)
           Number Space.";
        leaf as4 {
          type inet:as-number;
          description
            "4-octet AS number of the aggregating router.";
          reference
            "RFC 6793: BGP Support for Four-Octet Autonomous System (AS)
             Number Space, Section 3.";
        }
        leaf identifier {
          type yang:dotted-quad;
          description
            "BGP Identifier of the aggregating router.";
          reference
            "RFC 6793: BGP Support for Four-Octet Autonomous System (AS)
             Number Space, Section 3.";
        }
      }
      leaf atomic-aggregate {
        type boolean;
        description
          "BGP ATOMIC_AGGREGATE attribute.";
        reference
          "RFC 4271: A Border Gateway Protocol 4 (BGP-4), Section 5.1.6.";
      }
      leaf originator-id {
        type yang:dotted-quad;
        description
          "BGP ORIGINATOR_ID attribute for route reflection.";
        reference
          "RFC 4456: BGP Route Reflection, Section 8.";
      }
      leaf-list cluster-list {
        type yang:dotted-quad;
        description
          "BGP CLUSTER_LIST attribute for route reflection.";
        reference
          "RFC 4456: BGP Route Reflection, Section 8.";
      }
      leaf aigp-metric {
        type uint64;
        description
          "BGP AIGP attribute.";
        reference
          "RFC 7311: The Accumulated IGP Metric Attribute for BGP.";
      }
    }
  }

  grouping ipv4-loc-rib-common {
    description
      "IPv4 Loc-RIB route entry.";
    container route {
      description
        "A single IPv4 Loc-RIB route entry.";
      leaf prefix {
        type inet:ipv4-prefix;
        mandatory true;
        description
          "The IPv4 prefix.";
      }
      uses bgp:bgp-loc-rib-common-keys;
      uses bgp-common-route-attributes;
      uses bgp:bgp-common-route-annotations-state;
      uses bgp:bgp-unknown-attr-top;
      uses bgp:rib-ext-route-annotations;
    }
  }

  grouping ipv6-loc-rib-common {
    description
      "IPv6 Loc-RIB route entry.";
    container route {
      description
        "A single IPv6 Loc-RIB route entry.";
      leaf prefix {
        type inet:ipv6-prefix;
        mandatory true;
        description
          "The IPv6 prefix.";
      }
      uses bgp:bgp-loc-rib-common-keys;
      uses bgp-common-route-attributes;
      uses bgp:bgp-common-route-annotations-state;
      uses bgp:bgp-unknown-attr-top;
      uses bgp:rib-ext-route-annotations;
    }
  }

  grouping ipv4-adj-rib-common {
    description
      "IPv4 Adj-RIB route entry (In-Pre, Out-Pre, Out-Post).";
    container route {
      description
        "A single IPv4 Adj-RIB route entry.";
      leaf prefix {
        type inet:ipv4-prefix;
        mandatory true;
        description
          "The IPv4 prefix.";
      }
      uses bgp:bgp-adj-rib-attr-state;
      uses bgp-common-route-attributes;
      uses bgp:bgp-common-route-annotations-state;
      uses bgp:bgp-unknown-attr-top;
      uses bgp:rib-ext-route-annotations;
    }
  }

  grouping ipv4-adj-rib-in-post {
    description
      "IPv4 Adj-RIB-In post-policy route entry.";
    container route {
      description
        "A single IPv4 Adj-RIB-In post-policy route entry.";
      leaf prefix {
        type inet:ipv4-prefix;
        mandatory true;
        description
          "The IPv4 prefix.";
      }
      uses bgp:bgp-adj-rib-attr-state;
      uses bgp-common-route-attributes;
      uses bgp:bgp-common-route-annotations-state;
      uses bgp:bgp-adj-rib-in-post-route-annotations-state;
      uses bgp:bgp-unknown-attr-top;
      uses bgp:rib-ext-route-annotations;
    }
  }

  grouping ipv6-adj-rib-common {
    description
      "IPv6 Adj-RIB route entry (In-Pre, Out-Pre, Out-Post).";
    container route {
      description
        "A single IPv6 Adj-RIB route entry.";
      leaf prefix {
        type inet:ipv6-prefix;
        mandatory true;
        description
          "The IPv6 prefix.";
      }
      uses bgp:bgp-adj-rib-attr-state;
      uses bgp-common-route-attributes;
      uses bgp:bgp-common-route-annotations-state;
      uses bgp:bgp-unknown-attr-top;
      uses bgp:rib-ext-route-annotations;
    }
  }

  grouping ipv6-adj-rib-in-post {
    description
      "IPv6 Adj-RIB-In post-policy route entry.";
    container route {
      description
        "A single IPv6 Adj-RIB-In post-policy route entry.";
      leaf prefix {
        type inet:ipv6-prefix;
        mandatory true;
        description
          "The IPv6 prefix.";
      }
      uses bgp:bgp-adj-rib-attr-state;
      uses bgp-common-route-attributes;
      uses bgp:bgp-common-route-annotations-state;
      uses bgp:bgp-adj-rib-in-post-route-annotations-state;
      uses bgp:bgp-unknown-attr-top;
      uses bgp:rib-ext-route-annotations;
    }
  }

  grouping rib-entry {
    description
      "Grouping for a BGP RIB entry organized by AFI-SAFI.";

    leaf afi-safi-type {
      type identityref {
        base bt:afi-safi-type;
      }
      mandatory true;
      description
        "AFI,SAFI name.";
    }

    container rib-entry {
      description
        "Encapsulates the route entry for a specific AFI-SAFI.";
      choice afi-safi {
        mandatory true;
        description
          "Choice of AFI-SAFI content, enforced by the afi-safi-type leaf.";

        case ipv4-unicast {
          when "derived-from-or-self(../afi-safi-type, 'bt:ipv4-unicast')";
          container ipv4-unicast {
            description
              "Routing tables for IPv4 unicast.";

            choice rib-type {
              mandatory true;
              description
                "The specific RIB table type from which the route originates.";

              case loc-rib {
                container loc-rib {
                  description
                    "Route from the main BGP routing table for the local
                     routing instance, containing best-path selections
                     for each prefix.";
                  uses ipv4-loc-rib-common;
                }
              }
              case adj-rib-in-pre {
                container adj-rib-in-pre {
                  description
                    "Route received from the neighbor before any local
                     input policy rules or filters have been applied.";
                  uses ipv4-adj-rib-common;
                }
              }
              case adj-rib-in-post {
                container adj-rib-in-post {
                  description
                    "Route received from the neighbor after local
                     input policy rules have been applied.";
                  uses ipv4-adj-rib-in-post;
                }
              }
              case adj-rib-out-pre {
                container adj-rib-out-pre {
                  description
                    "Route eligible to be sent to the neighbor
                     before output policy rules have been applied.";
                  uses ipv4-adj-rib-common;
                }
              }
              case adj-rib-out-post {
                container adj-rib-out-post {
                  description
                    "Route eligible to be sent to the neighbor
                     after output policy rules have been applied.";
                  uses ipv4-adj-rib-common;
                }
              }
            }
          }
        }

        case ipv6-unicast {
          when "derived-from-or-self(../afi-safi-type, 'bt:ipv6-unicast')";
          container ipv6-unicast {
            description
              "Routing tables for IPv6 unicast.";

            choice rib-type {
              mandatory true;
              description
                "Choice between Local RIB and Neighbor-specific Adj-RIBs.";

              case loc-rib {
                container loc-rib {
                  description
                    "Route from the main BGP routing table for the local
                     routing instance, containing best-path selections
                     for each prefix.";
                  uses ipv6-loc-rib-common;
                }
              }

              case adj-rib-in-pre {
                container adj-rib-in-pre {
                  description
                    "Route received from the neighbor before local
                     input policy rules have been applied.";
                  uses ipv6-adj-rib-common;
                }
              }
              case adj-rib-in-post {
                container adj-rib-in-post {
                  description
                    "Route received from the neighbor after local
                     input policy rules have been applied.";
                  uses ipv6-adj-rib-in-post;
                }
              }
              case adj-rib-out-pre {
                container adj-rib-out-pre {
                  description
                    "Route eligible to be sent to the neighbor
                     before output policy rules have been applied.";
                  uses ipv6-adj-rib-common;
                }
              }
              case adj-rib-out-post {
                container adj-rib-out-post {
                  description
                    "Route eligible to be sent to the neighbor
                     after output policy rules have been applied.";
                  uses ipv6-adj-rib-common;
                }
              }
            }
          }
        }
      }
    }
  }


<CODE ENDS>
Figure 4: BMP YANG 'ietf-bgp-rib-entry' module.

4.4. BMP TLV YANG Module

<CODE BEGINS> file "ietf-bmp-tlv@2026-06-30.yang"


module ietf-bmp-tlv {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-bmp-tlv";
  prefix btlv;

  import ietf-yang-types {
    prefix yang;
    reference
      "RFC 9911: Common YANG Data Types";
  }

  organization
    "IETF Draft";
  contact
    "Author:    Thomas Graf
                <mailto:thomas.graf@swisscom.com>
                Paolo Lucente
                <mailto:paolo@ntt.net>
                Leonardo Rodoni
                <mailto:leonardo.rodoni@swisscom.com>";

  description
    "Defines TLV groupings for BMP (BGP Monitoring Protocol) messages.
     The groupings in this module correspond to TLV types defined
     across the core BMP specifications and extensions:

       - RFC 7854  (BMP base): Information TLVs, Termination TLVs,
                               Route Mirroring TLVs.
       - RFC 9069  (Loc-RIB):  VRF/Table Name TLV (type 3), Peer Down
                               reason code 6.
       - draft-ietf-grow-bmp-tlv (BMP v4): Cross-cutting TLVs
                               applicable to all message types:
                               Sequence Number (type 1), Extended Flags
                               (type 2), Timestamp (type 3). Also
                               Route Monitoring-specific TLVs: Group
                               (4), VRF/Table Name (5), Stateless
                               Parsing (6), BGP Message (7).
       - draft-ietf-grow-bmp-path-marking-tlv: Path Status TLV for
                               Route Monitoring messages.

     This module models the decoded content of TLVs (i.e., what is
     carried in each TLV's Value field), not the wire-format TLV
     headers.

     The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL',
     'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED',
     'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document
     are to be interpreted as described in BCP 14 (RFC 2119)
     (RFC 8174) when, and only when, they appear in all
     capitals, as shown here.

     Copyright (c) 2026 IETF Trust and the persons identified as
       authors of the code. All rights reserved.

     Redistribution and use in source and binary forms, with or without
     modification, is permitted pursuant to, and subject to the license
     terms contained in, the Revised BSD License set forth in Section
     4.c of the IETF Trust's Legal Provisions Relating to IETF Documents
     (https://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC XXXX; see the RFC
     itself for full legal notices.";

  revision 2026-06-30 {
    description
      "Initial revision.";
    reference
      "RFC XXXX";
  }

  // ---------------------------------------------------------------
  // Typedefs
  // ---------------------------------------------------------------
  typedef timestamp-type {
    type enumeration {
      enum trigger-time {
        value 0;
        description
          "Timestamp of the event which triggered BMP to report, e.g.,
           a received message or a BGP/BMP session state transition.";
        reference
          "draft-ietf-grow-bmp-tlv: Section 5.6.1.1.1.";
      }
      enum message-export-time {
        value 1;
        description
          "Time at which the BMP message was generated for export.";
        reference
          "draft-ietf-grow-bmp-tlv: Section 5.6.1.1.2.";
      }
      enum adj-rib-in-time {
        value 2;
        description
          "Time at which the route was installed in the Adj-RIB-In,
           as per RFC 7854.";
        reference
          "draft-ietf-grow-bmp-tlv: Section 5.6.1.1.3.";
      }
      enum local-rib-time {
        value 3;
        description
          "Time at which the route was installed in the Loc-RIB,
           as per RFC 9069.";
        reference
          "draft-ietf-grow-bmp-tlv: Section 5.6.1.1.4.";
      }
      enum adj-rib-out-time {
        value 4;
        description
          "Time at which the route was installed in the Adj-RIB-Out,
           as per RFC 8671.";
        reference
          "draft-ietf-grow-bmp-tlv: Section 5.6.1.1.5.";
      }
    }
    description
      "BMP Timestamp types for the Timestamp TLV (type 3). Indicates
       which event the accompanying timestamp value refers to.";
    reference
      "draft-ietf-grow-bmp-tlv: Section 5.6.1.";
  }

  grouping path-status-flags {
    description
      "Boolean flags encoding path roles and states for a BGP route.
       Multiple flags may be true when multiple statuses apply.
       All flags absent or false indicates a path with no marking.";
    reference
      "draft-ietf-grow-bmp-path-marking-tlv: Section 3.1.";
    leaf invalid {
      type boolean;
      default false;
      description
        "Route does not enter the BGP decision process as indicated
         in Section 9.1.2 of RFC 4271.";
    }
    leaf best {
      type boolean;
      default false;
      description
        "Best route as defined in Section 9.1 of RFC 4271.";
    }
    leaf nonselected {
      type boolean;
      default false;
      description
        "Route not selected in the BGP decision process. Backup
         routes are considered nonselected, while best and primary
         routes are not.";
    }
    leaf primary {
      type boolean;
      default false;
      description
        "Path used for traffic forwarding. A prefix can have more
         than one primary path when multipath is configured. The
         best path is also a primary path.";
    }
    leaf backup {
      type boolean;
      default false;
      description
        "Path installed in the RIB but not used until some or all
         primary paths become unreachable. Used for fast
         convergence.";
    }
    leaf non-installed {
      type boolean;
      default false;
      description
        "Route not installed into the IP routing table.";
    }
    leaf best-external {
      type boolean;
      default false;
      description
        "Best external path.";
    }
    leaf add-path {
      type boolean;
      default false;
      description
        "Advertisement includes multiple paths for the same address
         prefix without the new paths implicitly replacing any
         previous ones, as per RFC 7911.";
    }
    leaf filtered-inbound-policy {
      type boolean;
      default false;
      description
        "Route filtered in the Adj-RIB-In policy.";
    }
    leaf filtered-outbound-policy {
      type boolean;
      default false;
      description
        "Route filtered in the Adj-RIB-Out policy.";
    }
    leaf stale {
      type boolean;
      default false;
      description
        "Path declared stale by the BGP Graceful Restart mechanism
         as described in Section 4.1 of RFC 4724.";
    }
    leaf suppressed {
      type boolean;
      default false;
      description
        "Path declared suppressed by the BGP Route Flap Damping
         mechanism as described in Section 2.2 of RFC 2439.";
    }
  }

  typedef path-status-reason-code {
    type enumeration {
      enum invalid-as-loop {
        value 1;
        description
          "Invalid due to AS loop as defined in Section 9.1.2 of
           RFC 4271.";
      }
      enum invalid-unresolvable-nexthop {
        value 2;
        description
          "Invalid due to unresolvable nexthop as defined in
           Section 9.1.2 of RFC 4271.";
      }
      enum not-preferred-local-preference {
        value 3;
        description
          "Not preferred because of local preference as described in
           Section 9.1.2.2 of RFC 4271.";
      }
      enum not-preferred-as-path-length {
        value 4;
        description
          "Not preferred because of AS Path Length as described in
           Section 9.1.2.2 of RFC 4271.";
      }
      enum not-preferred-origin {
        value 5;
        description
          "Not preferred because of origin as described in
           Section 9.1.2.2 of RFC 4271.";
      }
      enum not-preferred-med {
        value 6;
        description
          "Not preferred because of MED as described in
           Section 9.1.2.2 of RFC 4271.";
      }
      enum not-preferred-peer-type {
        value 7;
        description
          "Not preferred because of peer type (eBGP vs iBGP) as
           described in Section 9.1.2.2 of RFC 4271.";
      }
      enum not-preferred-igp-cost {
        value 8;
        description
          "Not preferred because of IGP cost as described in
           Section 9.1.2.2 of RFC 4271.";
      }
      enum not-preferred-router-id {
        value 9;
        description
          "Not preferred because of router ID as described in
           Section 9.1.2.2 of RFC 4271.";
      }
      enum not-preferred-peer-address {
        value 10;
        description
          "Not preferred because of peer address as described in
           Section 9.1.2.2 of RFC 4271.";
      }
      enum not-preferred-aigp {
        value 11;
        description
          "Not preferred because of AIGP as described in RFC 7311.";
      }
    }
    description
      "Reason codes for the BMP Path Status TLV. Indicates the
       reason a path has the indicated path status.";
    reference
      "draft-ietf-grow-bmp-path-marking-tlv: Section 3.2.";
  }

  // TODO: move to a separate module?
  // ---------------------------------------------------------------
  // Per-Peer Header Flags (shared by per-peer header and
  // Extended Flags TLV)
  // RFC 7854 Section 4.2 / draft-ietf-grow-bmp-tlv Section 5.6.3
  // ---------------------------------------------------------------
  grouping peer-header-flags {
    description
      "Flags from the BMP Per-Peer Header (RFC 7854 Section 4.2).";
    reference
      "RFC 7854: Section 4.2";
    leaf ipv6-peer {
      type boolean;
      default false;
      description
        "V flag: Peer address is an IPv6 address.";
      reference
        "RFC 7854: Section 4.2.";
    }
    leaf post-policy {
      type boolean;
      default false;
      description
        "L flag: true indicates post-policy Adj-RIB-In;
         false indicates pre-policy Adj-RIB-In.";
      reference
        "RFC 7854: Section 4.2.";
    }
    leaf legacy-as-path {
      type boolean;
      default false;
      description
        "A flag: Message is formatted using the legacy 2-byte
         AS_PATH format.";
      reference
        "RFC 7854: Section 4.2.";
    }
    leaf adj-rib-out {
      type boolean;
      default false;
      description
        "O flag: Message reflects Adj-RIB-Out.";
      reference
        "RFC 8671: Support for Adj-RIB-Out in BMP, Section 4.";
    }
    leaf filtered {
      type boolean;
      default false;
      description
        "F flag: Loc-RIB is filtered. Set when a filter is
         applied to Loc-RIB routes sent to the BMP collector.";
      reference
        "RFC 9069: Section 4.2.";
    }
  }

  // ---------------------------------------------------------------
  // Cross-cutting TLVs (applicable to all BMP message types)
  // draft-ietf-grow-bmp-tlv Section 5.6
  // ---------------------------------------------------------------
  grouping common {
    description
      "TLVs applicable to all BMP message types as defined in
       draft-ietf-grow-bmp-tlv Section 5.6. These TLVs carry
       per-message metadata and are allocated the same code point
       value in every TLV code point registry.";
    reference
      "draft-ietf-grow-bmp-tlv: Section 5.6.";
    leaf sequence-number {
      type uint64;
      description
        "Sequence Number TLV (type 1). Carries the per-BMP-session
         sequence number of this message starting at 0. If the
         sequence number would overflow, the BMP session MUST be
         reset.";
      reference
        "draft-ietf-grow-bmp-tlv: Section 5.6.2.";
    }
    list timestamps {
      key "timestamp-type";
      description
        "Timestamp TLV (type 3). Carries a typed timestamp for
         this BMP message. Multiple instances MAY be present,
         one per timestamp type. A timestamp MUST NOT be included
         if it is not available.";
      reference
        "draft-ietf-grow-bmp-tlv: Section 5.6.1.";
      leaf timestamp-type {
        type timestamp-type;
        description
          "Type of the timestamp, indicating which event the
           timestamp value refers to.";
      }
      leaf timestamp {
        type yang:date-and-time;
        mandatory true;
        description
          "Timestamp value expressed as a date and time.";
      }
    }
    container extended-flags {
      presence
        "Extended Flags TLV (type 2) is present in this message.
         When this container is present, the X Flag in the
         Per-Peer Header Flags is set to 1.";
      description
        "Extended Flags TLV (type 2). Carries an extended set of
         per-peer flags, extending the Flags field of the Per-Peer
         Header to a variable-length sequence of bytes. The first
         byte carries the flags defined prior to this document
         (V, L, A, O, F); subsequent bytes carry newly allocated
         flags. When this TLV is present, the X Flag in the
         Per-Peer Header Flags MUST be set to 1 to signal that
         the authoritative flags are carried here. Collectors
         that do not understand the X Flag continue to use the
         Per-Peer Header flags directly.";
      reference
        "draft-ietf-grow-bmp-tlv: Section 5.6.3.";
      // TODO: discuss extensibility of this extended-flags container...
      // Extension point for future flag bits (RFC 8791 sx:augment-structure).
      // The augment path starts from the sx:structure root of the module
      // that instantiates btlv:common, e.g. for ietf-bmp-telemetry-message:
      //
      // sx:augment-structure
      // "/bmptm:message/bmptm:route-monitoring/btlv:extended-flags" {
      // leaf <new-flag> { type boolean; default false; ... }
      // }
      //
      uses peer-header-flags;
    }
  }

  // ---------------------------------------------------------------
  // Initiation and Peer Up Information TLVs
  // RFC 7854 Section 4.4 + RFC 9069 Section 5.2.1
  // ---------------------------------------------------------------
  grouping information {
    description
      "BMP Information TLVs used in Initiation messages and Peer Up
       notifications. RFC 9069 renamed the registry to 'BMP
       Initiation and Peer Up Information TLVs', confirming both
       message types share these TLV type codes.

       For Initiation messages, sysDescr (type 1) and sysName
       (type 2) MUST be present; string (type 0) MAY appear multiple
       times; vrf-table-name is not applicable.

       For Peer Up notifications, only string (type 0) is defined in
       RFC 7854 (and may be repeated); RFC 9069 adds vrf-table-name
       (type 3) for Loc-RIB Instance Peers. If vrf-table-name is
       included in Peer Up it MUST also be included in the
       corresponding Peer Down notification.";
    reference
      "RFC 7854: Section 4.4;
       RFC 9069: Section 5.2.1.";
    leaf-list string {
      type string {
        length "1..65535";
      }
      ordered-by user;
      description
        "String TLV (type 0). Free-form UTF-8 string. Multiple
         instances are permitted; their ordering MUST be preserved
         when reported.";
      reference
        "RFC 7854: Section 4.4.";
    }
    leaf sys-descr {
      type string {
        length "1..65535";
      }
      description
        "sysDescr TLV (type 1). ASCII string whose value MUST be
         equal to the value of the sysDescr MIB-II (RFC 1213)
         object. MUST be present in Initiation messages.";
      reference
        "RFC 7854: Section 4.4.";
    }
    leaf sys-name {
      type string {
        length "1..65535";
      }
      description
        "sysName TLV (type 2). ASCII string whose value MUST be
         equal to the value of the sysName MIB-II (RFC 1213)
         object. MUST be present in Initiation messages.";
      reference
        "RFC 7854: Section 4.4.";
    }
    leaf vrf-table-name {
      type string {
        length "1..255";
      }
      description
        "VRF/Table Name TLV (type 3). UTF-8 string equal to the
         value of the VRF or table name (e.g., RD instance name)
         being conveyed. The default value 'global' MUST be used
         for the default Loc-RIB instance with a zero-filled
         distinguisher. If included in a Peer Up notification, it
         MUST also be included in the corresponding Peer Down
         notification.";
      reference
        "RFC 9069: Section 5.2.1.";
    }
  }

  // ---------------------------------------------------------------
  // Termination Message TLVs
  // RFC 7854 Section 4.5
  // ---------------------------------------------------------------
  grouping termination {
    description
      "BMP Termination Message TLVs.";
    reference
      "RFC 7854: Section 4.5.";
    leaf-list string {
      type string {
        length "1..65535";
      }
      ordered-by user;
      description
        "String TLV (type 0). Free-form UTF-8 string. Inclusion
         is optional. Multiple instances are permitted.";
      reference
        "RFC 7854: Section 4.5.";
    }
    leaf reason {
      type enumeration {
        enum administratively-closed {
          value 0;
          description
            "Session administratively closed. The session might
             be re-initiated.";
        }
        enum unspecified {
          value 1;
          description
            "Unspecified reason.";
        }
        enum out-of-resources {
          value 2;
          description
            "Out of resources. The router has exhausted resources
             available for the BMP session.";
        }
        enum redundant-connection {
          value 3;
          description
            "Redundant connection. The router has determined that
             this connection is redundant with another one.";
        }
        enum permanently-administratively-closed {
          value 4;
          description
            "Session permanently administratively closed and will
             not be re-initiated. Monitoring station should
             reduce (potentially to 0) the rate at which it
             attempts reconnection.";
        }
      }
      mandatory true;
      description
        "Reason TLV (type 1). Indicates why the session was
         terminated. Inclusion is REQUIRED.";
      reference
        "RFC 7854: Section 4.5.";
    }
  }

  // ---------------------------------------------------------------
  // Peer Down TLVs
  // RFC 9069 Section 5.3 (reason code 6 / TLV data follows)
  // ---------------------------------------------------------------
  grouping peer-down {
    description
      "BMP Peer Down TLVs. Present when the Peer Down reason code
       is 6 ('local-system-closed-tlv-data-follows'), as defined
       in RFC 9069 for Loc-RIB Instance Peers.";
    reference
      "RFC 9069: Section 5.3.";
    leaf vrf-table-name {
      type string {
        length "1..255";
      }
      description
        "VRF/Table Name TLV (type 3). UTF-8 string equal to the
         VRF or table name. MUST be included if it was present in
         the corresponding Peer Up notification.";
      reference
        "RFC 9069: Section 5.3.";
    }
  }

  // ---------------------------------------------------------------
  // Route Monitoring TLVs
  // draft-ietf-grow-bmp-tlv Section 5.2
  // draft-ietf-grow-bmp-path-marking-tlv
  // ---------------------------------------------------------------
  grouping path-status-info {
    description
      "BMP Path Status TLV for Route Monitoring messages. Conveys
       the status of a BGP path after processing by the BGP decision
       process. Carried as an indexed TLV in Route Monitoring
       messages; the index identifies the specific NLRI within the
       BGP Update PDU to which the status applies (index 0 applies
       to all NLRIs).";
    reference
      "draft-ietf-grow-bmp-path-marking-tlv: Section 2.";
    uses path-status-flags;
    leaf reason-code {
      type path-status-reason-code;
      description
        "Optional reason code indicating why the path has the
         indicated status. Absent when no reason code is carried.";
    }
  }

  grouping route-monitoring {
    description
      "TLVs specific to BMP Route Monitoring messages. These appear
       in addition to the common metadata that applies to all BMP message
       types.";
    reference
      "draft-ietf-grow-bmp-tlv: Section 5.2;
       draft-ietf-grow-bmp-path-marking-tlv.";
    container path-status {
      presence
        "Path Status TLV is present for this route";
      description
        "Path Status TLV. Conveys the BGP decision-process status
         of the route. As a per-NLRI indexed TLV this container
         represents the status applicable to the route entry in
         rib-entry.";
      uses path-status-info;
    }
    leaf vrf-table-name {
      type string {
        length "1..255";
      }
      description
        "VRF/Table Name TLV (type 5 in Route Monitoring TLVs).
         UTF-8 string equal to the VRF or table name (i.e., RD
         instance name) being conveyed, consistent with
         RFC 9069 Section 5.2.1.";
      reference
        "draft-ietf-grow-bmp-tlv: Section 5.2.2.";
    }
  }
}


<CODE ENDS>
Figure 5: BMP YANG 'ietf-bmp-tlv' module.

5. YANG Message Broker BMP Indexing and Topic Naming

To identify which network node produced which BMP data into which Message Broker Topic, Partition and Subject, BMP Message Keys, Partition Key, and Indexes are being introduced (Section 5.1). These keys enable a deterministic distribution of BMP messages across Topics and Partitions enabling applications to consume only the needed data from specific topics and partitions.

5.1. BMP Message Keys and Indexes

A Message Broker uses a Message Key for indexing and enabling Topic Compaction. While a Message Key can also drive deterministic partition assignment, this document introduces a dedicated Partition Key for that purpose, as described in Section 5.2.

Similar to Section 3.1 of [I-D.netana-nmop-yang-message-broker-message-key] for YANG-Push telemetry messages, the network node hostname and a set of 'ietf-bmp-telemetry-message' YANG nodes from the instance data are used to construct the BMP Message Key. The following subsections describe and illustrate the YANG nodes used for each BMP message type.

For all BMP message types that carry a BMP Per-Peer Header (Peer Up, Peer Down, Statistics Report, Route Monitoring, and Route Mirroring), the Message Key consists of the node hostname and a YANG instance-identifier path encoding the message-type and the following per-peer header nodes to uniquely identify the BGP peering session:

peer-type
Scopes the session to its routing instance: Global Instance Peer, RD Instance Peer, Local Instance Peer, or Loc-RIB Instance Peer.
peer-distinguisher
The Route Distinguisher of the routing instance. Zero-filled for Global Instance Peers; non-zero for RD Instance and possibly Loc-RIB Instance Peers to distinguish sessions within the same VRF or routing instance.
peer-address
The remote IP address associated with the BGP session.
peer-as
The AS number of the remote BGP speaker.
peer-bgp-id
The BGP Identifier of the remote BGP speaker.

Route Monitoring and Route Mirroring messages extend the per-peer session key with two additional YANG nodes that identify the individual route within the RIB:

prefix
The IP prefix (IPv4 or IPv6) of the route entry.
path-id
The BGP ADD-PATH path identifier (RFC 7911). Zero when ADD-PATH is not in use.

Initiation and Termination messages do not carry a Per-Peer Header; their Message Keys consist of only the node hostname and the message-type path. The per-peer session key is consistent across all lifecycle events for the same session (Peer Up, Statistics Report, Route Monitoring, and Peer Down), enabling deterministic topic compaction over the full session lifecycle.

The Message Key is encoded as a two-line byte string. The first line is the network node hostname; the second line is the YANG instance-identifier path. The separator between them is a single line feed character (LF, U+000A).

Each example below illustrates the Message Key, the Message Broker headers carrying the Schema ID, content type, and Partition Key, and the corresponding Message Value.

5.1.1. BMP Initiation

The Message Key consists of only the node hostname and the message-type path, as described above.

NOTE: The Key is a two-line byte string; the line break between the
      node hostname and the YANG path is a literal LF (U+000A).

Key:
  router-nyc-01
  /ietf-bmp-telemetry-message:message/initiation-message

Headers:
  schema-id:     1
  content-type:  application/yang-data+json
  partition-key: router-nyc-01
Figure 6: BMP Initiation Message Key and Headers
{
  "ietf-bmp-telemetry-message:message": {
    "version": 3,
    "initiation-message": {
      "sys-descr": "25.4.2.02I",
      "sys-name": "ipf-zbl1327-r-daisy-91"
    }
  }
}
Figure 7: BMP Initiation Message Value

5.1.2. BMP Peer Up

The Message Key uses the per-peer session key described above.

NOTE: The Key is a two-line byte string; the line break between the
      node hostname and the YANG path is a literal LF (U+000A).
      RFC 8792 '\' line folding applies within the YANG path.

Key:
  router-nyc-01
  /ietf-bmp-telemetry-message:message/\
peer-up-notification[peer-type='global-instance-peer']\
[peer-distinguisher='0:0:0']\
[peer-address='203.0.113.45']\
[peer-as='65002']\
[peer-bgp-id='203.0.113.1']

Headers:
  schema-id:     2
  content-type:  application/yang-data+json
  partition-key: router-nyc-01
Figure 8: BMP Peer Up Message Key and Headers
{
  "ietf-bmp-telemetry-message:message": {
    "version": 3,
    "peer-up-notification": {
      "peer-type": "global-instance-peer",
      "peer-distinguisher": "0:0:0",
      "peer-address": "203.0.113.45",
      "peer-as": 65002,
      "peer-bgp-id": "203.0.113.1",
      "timestamp": "2026-02-15T14:35:22Z",
      "local-address": "198.51.100.10",
      "local-port": 179,
      "remote-port": 54321,
      "sent-open": {
        "version": 4,
        "my-as": 65001,
        "hold-time": 180,
        "bgp-identifier": "198.51.100.1",
        "capabilities": [
          {
            "code": 65,
            "index": 1,
            "name": "iana-bgp-types:asn32",
            "value": { "asn32": { "as": 65001 } }
          },
          {
            "code": 1,
            "index": 1,
            "name": "iana-bgp-types:mp-bgp",
            "value": {
              "mpbgp": {
                "afi": "ipv4",
                "safi": "unicast-safi",
                "name": "iana-bgp-types:ipv4-unicast"
              }
            }
          }
        ]
      },
      "received-open": {
        "version": 4,
        "my-as": 65002,
        "hold-time": 180,
        "bgp-identifier": "203.0.113.1",
        "capabilities": [
          {
            "code": 65,
            "index": 1,
            "name": "iana-bgp-types:asn32",
            "value": { "asn32": { "as": 65002 } }
          },
          {
            "code": 1,
            "index": 1,
            "name": "iana-bgp-types:mp-bgp",
            "value": {
              "mpbgp": {
                "afi": "ipv4",
                "safi": "unicast-safi",
                "name": "iana-bgp-types:ipv4-unicast"
              }
            }
          }
        ]
      },
      "sequence-number": "42",
      "timestamps": [
        {
          "timestamp-type": "message-export-time",
          "timestamp": "2026-02-15T14:35:22.125000Z"
        }
      ]
    }
  }
}
Figure 9: BMP Peer Up Message Value

5.1.3. BMP Peer Down

The Message Key uses the per-peer session key described above.

NOTE: The Key is a two-line byte string; the line break between the
      node hostname and the YANG path is a literal LF (U+000A).
      RFC 8792 '\' line folding applies within the YANG path.

Key:
  router-nyc-01
  /ietf-bmp-telemetry-message:message/peer-down-notification\
[peer-type='loc-rib-instance-peer']\
[peer-distinguisher='0:65001:100']\
[peer-address='::']\
[peer-as='65001']\
[peer-bgp-id='192.0.2.1']

Headers:
  schema-id:     3
  content-type:  application/yang-data+json
  partition-key: router-nyc-01
Figure 10: BMP Peer Down Message Key and Headers
{
  "ietf-bmp-telemetry-message:message": {
    "version": 3,
    "session-metadata": {
      "sys-descr": "25.4.2.02I",
      "sys-name": "router-nyc-01"
    },
    "peer-down-notification": {
      "peer-type": "loc-rib-instance-peer",
      "peer-distinguisher": "0:65001:100",
      "peer-address": "::",
      "peer-as": 65001,
      "peer-bgp-id": "192.0.2.1",
      "timestamp": "2026-02-15T15:10:00Z",
      "reason": "local-system-closed-tlv-data-follows",
      "peer-down": {
        "vrf-table-name": "customer-a"
      },
      "sequence-number": "8901",
      "timestamps": [
        {
          "timestamp-type": "trigger-time",
          "timestamp": "2026-02-15T15:09:58.200000Z"
        },
        {
          "timestamp-type": "message-export-time",
          "timestamp": "2026-02-15T15:09:58.450000Z"
        }
      ]
    }
  }
}
Figure 11: BMP Peer Down Message Value

5.1.4. BMP Statistic Reports

The Message Key uses the per-peer session key described above.

NOTE: The Key is a two-line byte string; the line break between the
      node hostname and the YANG path is a literal LF (U+000A).
      RFC 8792 '\' line folding applies within the YANG path.

Key:
  router-nyc-01
  /ietf-bmp-telemetry-message:message/statistics-report\
[peer-type='global-instance-peer']\
[peer-distinguisher='0:0:0']\
[peer-address='203.0.113.45']\
[peer-as='65002']\
[peer-bgp-id='203.0.113.1']

Headers:
  schema-id:     4
  content-type:  application/yang-data+json
  partition-key: router-nyc-01
Figure 12: BMP Statistics Report Message Key and Headers

5.1.5. BMP Route Monitoring

The Message Key extends the per-peer session key with the additional prefix and path-id nodes described above.

NOTE: The Key is a two-line byte string; the line break between the
      node hostname and the YANG path is a literal LF (U+000A).
      RFC 8792 '\' line folding applies within the YANG path.

Key:
  router-nyc-01
  /ietf-bmp-telemetry-message:message/route-monitoring\
[peer-type='global-instance-peer']\
[peer-distinguisher='0:0:0']\
[peer-address='203.0.113.45']\
[peer-as='65002']\
[peer-bgp-id='203.0.113.1']\
/rib-entry/ipv4-unicast/adj-rib-in-post/route\
[prefix='192.0.2.0/24']\
[path-id='0']

Headers:
  schema-id:     5
  content-type:  application/yang-data+json
  partition-key: router-nyc-01
Figure 14: BMP Route Monitoring Message Key and Headers
{
  "ietf-bmp-telemetry-message:message": {
    "version": 3,
    "route-monitoring": {
      "peer-type": "global-instance-peer",
      "peer-distinguisher": "0:0:0",
      "peer-address": "203.0.113.45",
      "peer-as": 65002,
      "peer-bgp-id": "203.0.113.1",
      "timestamp": "2026-02-15T14:40:00Z",
      "afi-safi-type": "iana-bgp-types:ipv4-unicast",
      "rib-entry": {
        "ipv4-unicast": {
          "adj-rib-in-post": {
            "route": {
              "prefix": "192.0.2.0/24",
              "path-id": 0,
              "attributes": {
                "origin": "igp",
                "as-path": {
                  "segment": [
                    {
                      "type": "as-sequence",
                      "member": [ 65002, 65003, 65004 ]
                    }
                  ]
                },
                "next-hop": "203.0.113.45",
                "med": 100,
                "local-pref": 150
              },
              "community": [ "65001:1000", "65001:2000" ]
            }
          }
        }
      },
      "vrf-table-name": "customer-a",
      "sequence-number": "5432",
      "path-status": {
        "invalid": true,
        "nonselected": true,
        "reason-code": "invalid-as-loop"
      },
      "timestamps": [
        {
          "timestamp-type": "trigger-time",
          "timestamp": "2026-02-15T14:39:58.500000Z"
        },
        {
          "timestamp-type": "adj-rib-in-time",
          "timestamp": "2026-02-15T14:39:58.750000Z"
        }
      ],
      "extended-flags": {
        "ipv6-peer": true,
        "post-policy": true,
        "adj-rib-out": true
      }
    }
  }
}
Figure 15: BMP Route Monitoring Message Value

5.1.6. BMP Termination

The Message Key consists of only the node hostname and the message-type path, as described above.

NOTE: The Key is a two-line byte string; the line break between the
      node hostname and the YANG path is a literal LF (U+000A).

Key:
  router-nyc-01
  /ietf-bmp-telemetry-message:message/termination-message

Headers:
  schema-id:     6
  content-type:  application/yang-data+json
  partition-key: router-nyc-01
Figure 16: BMP Termination Message Key and Headers
{
  "ietf-bmp-telemetry-message:message": {
    "version": 3,
    "termination-message": {
      "string": [
        "Scheduled maintenance window"
      ],
      "reason": "administratively-closed",
      "sequence-number": "18567",
      "timestamps": [
        {
          "timestamp-type": "message-export-time",
          "timestamp": "2026-02-15T15:45:00.500000Z"
        }
      ]
    }
  }
}
Figure 17: BMP Termination Message Value

5.2. BMP Partition Keys and Routing

Since BMP requires Message ordering for a monitored BGP RIB, and Message Brokers ensure Message ordering on partitions, a Partition Key and a custom partitioner logic is being introduced so that all BMP messages for a particular BGP RIB are hashed to on one partition. The Partition Key consists of the hostname of the network node.

In the partitioner implementation of the YANG Message Broker Producer, instead of the Message Key, the Partition Key MUST be used to deterministically hash BMP Messages to partitions.

5.3. Message Broker BMP Topic Naming

There are two Message Broker topics.

  • bmp-state-changes-and-statistics: Containing all BMP messages in real-time
  • bmp-current-state: Containing all BMP message types, except statistics, topic compacted.

Optionally, an organization prefix can be prepended with a "-" separator. A Message Broker Consumer MAY consume either "bmp-state-changes-and-statistics", "bmp-current-state" or a subset depending on use case.

If a subset is consumed, the consumer hashes the Message Key, applies modulo with the number of partitions, and determines the partition from which it should consume messages bearing that Message Key.

To parse the Message Key, the consumer splits the byte string on newline (LF) characters. The first line is the node-name and the second the YANG path.

Figure 18 shows an example where "bmp-state-changes-and-statistics" is being used.

netops-bmp-state-changes-and-statistics
Figure 18: BMP Topic Name Example

6. Message Broker Implementations

Topic, Partitioning and Message Keys are generic concepts of Message Brokers. There are two known Message Broker implementations supporting all features described in this document.

6.1. Apache Kafka

Apache Kafka supports Message Keys, Partitioning and Log Compaction. Per default, the partitioner logic uses Message Keyes for deterministic partition Message distribution.

This document introduces "partioning-key" in the Apache Kafka header to be used by the partitioner instead of the "key" (Message Key) when distributing Messages to the partitions.

6.2. Apache Pulsar

Apache Pulsar supports Message Keys, Partitioning and Topic Compaction. Per default, the partitioner logic uses Message Keyes for deterministic partition Message distribution. Optionally, a dedicated ordering key can be used.

This document introduces "partioning-key" which is to be used as ordering key.

7. IANA Considerations

This document registers the following two namespace URIs in the IETF XML Registry [RFC3688]:

This document registers the following two YANG modules in the YANG Module Names registry [RFC3688]:

8. Security Considerations

This section is modeled after the template described in Section 3.7 of [I-D.ietf-netmod-rfc8407bis].

The "ietf-bmp-telemetry-message", "ietf-bgp-rib-entry", "ietf-bgp-open" and "ietf-bmp-tlv" YANG modules defines one combined data model that are designed to be accessed via YANG-based management protocols, such as NETCONF [RFC6141] and RESTCONF [RFC8040]. These protocols have to use a secure transport layer (e.g., SSH [RFC4252], TLS [RFC8446], and QUIC [RFC9000]) and have to use mutual authentication.

The Network Configuration Access Control Model (NACM) [RFC8341] provides the means to restrict access for particular NETCONF or RESTCONF users to a preconfigured subset of all available NETCONF or RESTCONF protocol operations and content.

There are a number of data nodes defined in this YANG module that are writable/creatable/deletable (i.e., "config true", which is the default). All writable data nodes are likely to be reasonably sensitive or vulnerable in some network environments. Write operations (e.g., edit-config) and delete operations to these data nodes without proper protection or authentication can have a negative effect on network operations. The following subtrees and data nodes have particular sensitivities/vulnerabilities:

"There are no particularly sensitive writable data nodes."

Some of the readable data nodes in this YANG module may be considered sensitive or vulnerable in some network environments. It is thus important to control read access (e.g., via get, get-config, or notification) to these data nodes. Specifically, the following subtrees and data nodes have particular sensitivities/ vulnerabilities:

"There are no particularly sensitive readable data nodes."

9. References

9.1. Normative References

[RFC2119]
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.
[RFC3688]
Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, DOI 10.17487/RFC3688, , <https://www.rfc-editor.org/info/rfc3688>.
[RFC4252]
Ylonen, T. and C. Lonvick, Ed., "The Secure Shell (SSH) Authentication Protocol", RFC 4252, DOI 10.17487/RFC4252, , <https://www.rfc-editor.org/info/rfc4252>.
[RFC6141]
Camarillo, G., Ed., Holmberg, C., and Y. Gao, "Re-INVITE and Target-Refresh Request Handling in the Session Initiation Protocol (SIP)", RFC 6141, DOI 10.17487/RFC6141, , <https://www.rfc-editor.org/info/rfc6141>.
[RFC7854]
Scudder, J., Ed., Fernando, R., and S. Stuart, "BGP Monitoring Protocol (BMP)", RFC 7854, DOI 10.17487/RFC7854, , <https://www.rfc-editor.org/info/rfc7854>.
[RFC7950]
Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", RFC 7950, DOI 10.17487/RFC7950, , <https://www.rfc-editor.org/info/rfc7950>.
[RFC8040]
Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF Protocol", RFC 8040, DOI 10.17487/RFC8040, , <https://www.rfc-editor.org/info/rfc8040>.
[RFC8174]
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, , <https://www.rfc-editor.org/info/rfc8174>.
[RFC8341]
Bierman, A. and M. Bjorklund, "Network Configuration Access Control Model", STD 91, RFC 8341, DOI 10.17487/RFC8341, , <https://www.rfc-editor.org/info/rfc8341>.
[RFC8446]
Rescorla, E., "The Transport Layer Security (TLS) Protocol Version 1.3", RFC 8446, DOI 10.17487/RFC8446, , <https://www.rfc-editor.org/info/rfc8446>.
[RFC8671]
Evens, T., Bayraktar, S., Lucente, P., Mi, P., and S. Zhuang, "Support for Adj-RIB-Out in the BGP Monitoring Protocol (BMP)", RFC 8671, DOI 10.17487/RFC8671, , <https://www.rfc-editor.org/info/rfc8671>.
[RFC9000]
Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based Multiplexed and Secure Transport", RFC 9000, DOI 10.17487/RFC9000, , <https://www.rfc-editor.org/info/rfc9000>.
[RFC9069]
Evens, T., Bayraktar, S., Bhardwaj, M., and P. Lucente, "Support for Local RIB in the BGP Monitoring Protocol (BMP)", RFC 9069, DOI 10.17487/RFC9069, , <https://www.rfc-editor.org/info/rfc9069>.
[I-D.ietf-nmop-terminology]
Davis, N., Farrel, A., Graf, T., Wu, Q., and C. Yu, "Some Key Terms for Network Fault and Problem Management", Work in Progress, Internet-Draft, draft-ietf-nmop-terminology-23, , <https://datatracker.ietf.org/doc/html/draft-ietf-nmop-terminology-23>.
[I-D.ietf-nmop-yang-message-broker-integration]
Graf, T. and A. Elhassany, "An Architecture for YANG-Push to Message Broker Integration", Work in Progress, Internet-Draft, draft-ietf-nmop-yang-message-broker-integration-12, , <https://datatracker.ietf.org/doc/html/draft-ietf-nmop-yang-message-broker-integration-12>.
[I-D.ietf-nmop-message-broker-telemetry-message]
Elhassany, A., Graf, T., and P. Lucente, "Extensible YANG Model for Network Telemetry Messages", Work in Progress, Internet-Draft, draft-ietf-nmop-message-broker-telemetry-message-04, , <https://datatracker.ietf.org/doc/html/draft-ietf-nmop-message-broker-telemetry-message-04>.
[I-D.netana-nmop-yang-message-broker-message-key]
Graf, T., Elhassany, A., Feng, A. H., Claise, B., and P. Lucente, "YANG Message Keys for Message Broker Integration", Work in Progress, Internet-Draft, draft-netana-nmop-yang-message-broker-message-key-03, , <https://datatracker.ietf.org/doc/html/draft-netana-nmop-yang-message-broker-message-key-03>.

9.2. Informative References

[I-D.ietf-idr-bgp-model]
Jethanandani, M., Patel, K., Hares, S., and J. Haas, "YANG Model for Border Gateway Protocol (BGP-4)", Work in Progress, Internet-Draft, draft-ietf-idr-bgp-model-20, , <https://datatracker.ietf.org/doc/html/draft-ietf-idr-bgp-model-20>.
[I-D.ietf-grow-bmp-yang]
Cardona, C., Lucente, P., Graf, T., Claise, B., Patki, D., and N. Prasad, "A YANG Data Model for BMP", Work in Progress, Internet-Draft, draft-ietf-grow-bmp-yang-09, , <https://datatracker.ietf.org/doc/html/draft-ietf-grow-bmp-yang-09>.
[I-D.ietf-netmod-rfc8407bis]
Bierman, A., Boucadair, M., and Q. Wu, "Guidelines for Authors and Reviewers of Documents Containing YANG Data Models", Work in Progress, Internet-Draft, draft-ietf-netmod-rfc8407bis-28, , <https://datatracker.ietf.org/doc/html/draft-ietf-netmod-rfc8407bis-28>.
[Deh22]
Dehghani, Z., "Data Mesh", O'Reilly Media, ISBN 9781492092391, , <https://www.oreilly.com/library/view/data-mesh/9781492092384/>.
[Kaf11]
Narkhede, N., "Apache Kafka", Apache Software Foundation, , <https://kafka.apache.org/>.
[Pul16]
Guo, S. and M. Merli, "Apache Pulsar", Apache Software Foundation, , <https://pulsar.apache.org/>.

Acknowledgements

Thanks to xxx for their comments and reviews.

Contributors

Many thanks goes to the authors of [I-D.ietf-idr-bgp-model] from which the BGP RIB submodules defined in Section 7.6 of [I-D.ietf-idr-bgp-model] have been obtained and adjusted for BMP integration.

Mahesh Jethanandani
Arrcus
CA
United States of America
Keyur Patel
Arrcus
CA
United States of America
Susan Hares
Huawei
7453 Hickory Hill
Saline, MI 48176
United States of America
Jeffrey Haas
Juniper Networks

Authors' Addresses

Thomas Graf
Swisscom
Binzring 17
CH-8045 Zurich
Switzerland
Paolo Lucente
NTT
Veemweg 23
3771 Barneveld
Netherlands
Leonardo Rodoni
Swisscom
Binzring 17
CH-8045 Zurich
Switzerland
Maxence Younsi
INSA-Lyon
Lyon
France