Skip to content

Conversation

apratimmukherjee
Copy link
Contributor

@apratimmukherjee apratimmukherjee commented Jul 7, 2025

WIP

Redocli view of proposed model

Features of the proposed model for configuring test port as a BMP Server and testing DUT configured as a BMP Client :
set_config/device/bmp

  • Allows configuration of BMP Servers on the test port on IPv4 and IPv6 interfaces.
  • Requires and allows separate configuration for each BMP Server to BMP client session.
  • Allows configuring a single DUT to connect and send monitoring information to two or more BGP Servers configured on the test port on different emulated interfaces on same or different test ports .
  • Allows configurable port and both passive ( default ) and active connections for the BMP Server.

For telemetry to check DUT behaviour , exposes the following :

  1. get_metrics/bmp_server and bmp_server_metrics in the 200(success) result :
    Per BMP Server to BMP Client session :  
              Provides state , flap_count and received metrics for each of the different BMP Messages such as 
              Initiation, Termination , Peer Up/Down and Monitoring messages.
    
    
2) get_states/bmp_servers and bmp_servers in the 200(success) result :  
    ```
Per BMP Server to BMP client session: 
       - Per BGP Peer for which BMP client sends information via BMP Messages: 
          - BMP RFC defined stats such as rejected_prefixes ,  duplicate_prefixes,  duplicate_withdraws , 
             as_path_invalidated_updates, adj_rib_routes , ... etc. 
          - Pre-policy In-adj RIB 
                  - IPv4 prefixes with current state ( advertised/withdrawn ) with attributes for each.
                  - IPv6 prefixes with current state ( advertised/withdrawn ) with attributes for each.
          - Post-policy In-adj RIB ( after policy is applied ) 
                  - IPv4 prefixes with current state ( advertised/withdrawn ) with attributes for each.
                  - IPv6 prefixes with current state ( advertised/withdrawn ) with attributes for each.
Note: 
Presence of withdrawn state allows faster verification whether specific route has been withdrawn instead of having to confirm 
absence of the route in the entire RIB. 
As a corollary though ,this does mean that presence of an expected route might not be enough to confirm route 
has been installed ; in addition the state should be checked that it is still in advertised state. 
The latest snapshot of the stats and routes is provided in get_state results. 

The gnmi yang model for BMP for access of counters/state telemetry for BMP using GNMI is expected to be near identical in approach and attribute list.

Notes:

  1. Does not support BMP Client mode i.e. test ports advertising BGP session information ( probably on a co-located emulated device ) via BMP to one or BMP Server. This model PR only attempts to support BMP Server emulation.
  2. Target is to make it extendible to support additional related RFCs and sections related to BMP as needed e.g. support for Out-RIB databases ( separate newer RFC) in get_state or Route Mirroring messages in get_state as well maybe more controls if needed during session initiation etc.

Some known test use-cases which are currently Work In Progress but useful to consider during review phase:
BMP-1.1: BMP Session Establishment and Telemetry Test
BMP-1.2: BMP Route Monitoring with Routing Changes Test

gosnappi example BMP configuration

....
       p1 := config.Ports().Add().SetName("p1").SetLocation("...")
       device := config.Devices().Add().SetName("p1.dev1")
       eth := device.Ethernets().Add().
                SetName(device.Name() + ".eth").
                SetMac("00:00:01:01:01:01")
       eth.Connection().
                SetPortName(p1.Name())

       eth.Ipv4Addresses().Add().
                SetName(eth.Name() + ".ipv4").
                SetAddress("1.1.1.2").
                SetGateway("1.1.1.1").
                SetPrefix(4)

       bmpIntf := device.Bmp().Ipv4Interfaces().Add()
       bmpIntf.SetIpv4Name(eth.Name() + ".ipv4")

       bmpServer := bmpIntf.Servers().Add()
       bmpServer.SetName(device.Name()+".bmp")
       bmpServer.SetClientIp("1.1.1.1")
        
       //To get BMP Metrics: 
       reqMetrics := gosnappi.NewMetricsRequest()
       reqMetrics.BmpServer()
       bmpMetrics, err := client.Api().GetMetrics(reqMetrics)
       ...

       // To get BMP State info ( the per peer stats/prefixes information sent by BMP Client) 
       reqStates := gosnappi.NewStatesRequest()
       reqStates.BmpServers()
       bmpState, err := client.Api().GetStates(reqStates)
       ....
        

Json structure for BMP configuration:

{
  "ports":  [
    {
      "location":  "eth1",
      "name":  "p1"
    }
  ],
  "devices":  [
    {
      "ethernets":  [
        {
          "connection":  {
            "choice":  "port_name",
            "port_name":  "p1"
          },
          "ipv4_addresses":  [
            {
              "gateway":  "1.1.1.1",
              "address":  "1.1.1.2",
              "prefix":  4,
              "name":  "p1.dev1.eth.ipv4"
            }
          ],
          "mac":  "00:00:01:01:01:01",
          "mtu":  1500,
          "name":  "p1.dev1.eth"
        }
      ],
      "name":  "p1.dev1",
      "bmp":  {
        "ipv4_interfaces":  [
          {
            "ipv4_name":  "p1.dev1.eth.ipv4",
            "servers":  [
              {
                "client_ip":  "1.1.1.1",
                "discard_adj_rib":  false,
                "name":  "p1.dev1.bmp"
              }
            ]
          }
        ]
      }
    }
  ]
}

Snappi python example for BMP configuration:

#Creating Ports
import otg
api = otg.api(location="https://localhost/")
config = api.config()
p1 = config.ports.port(name='p1', location='172.17.0.2:50071')[-1]

#Create BMP monitoring station running on connected interface port 1.
p1_d1 = config.devices.device(name='p1_d1')[-1]

p1_eth1 = p1_d1.ethernets.ethernet()[-1]
p1_eth1.connection.port_name = p1.name
p1_eth1.name = 'p1_eth1'
p1_eth1.mac = '64:00:00:00:00:01'

p1_ip1 = p1_eth1.ipv4_addresses.ipv4(name = 'p1_ip1', address = '10.10.10.2', gateway = '10.10.10.1')[-1]
#Creating a BMP monitoring station on the connected interface port1.
p1_bmp1 = p1_d1.bmp.ipv4_interfaces.v4interface(ipv4_name=p1_ip1.name)[-1]
p1_bmp1_1 = p1_bmp1.servers.serverv4(client_ip = '10.10.10.1')[-1]
p1_bmp1_1.name = 'p1_bmp1'
print(config.serialize())

Copy link
Contributor Author

@apratimmukherjee apratimmukherjee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial structure based review comments.

@apratimmukherjee apratimmukherjee changed the title BGP Monitoring Protocol : Client support. ( Approach1) BGP Monitoring Protocol Monitor support. Aug 14, 2025
@apratimmukherjee apratimmukherjee changed the title BGP Monitoring Protocol Monitor support. BGP Monitoring Protocol ( emulation of BMP Monitor ) support. Aug 14, 2025
@apratimmukherjee apratimmukherjee added the enhancement New feature or request label Aug 15, 2025
apratimmukherjee and others added 2 commits August 15, 2025 17:49
…e RFC term and more commonly used in vendor CLI as well. Monitor is sometimes uses interchange-ably in documentation and but switching to use Server throughout the model instead for better technical accuracy.
Copy link
Contributor

@SuryyaKrJana SuryyaKrJana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fine

type: boolean
default: false
x-field-uid: 3
name:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may need to add other properties in this object in future. As the mandatory field it's better to start with the 'name' of the object that's remains at first where other properties are added in future at the end.

type: boolean
default: false
x-field-uid: 3
name:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above.

type: object
required: [name,client_ip]
properties:
client_ip:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't one BMP sever not able to get routing information from multiple BGP Routers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for BGP Monitoring Protocol for test port to be used as an emulated BMP Monitor
5 participants