Skip to content

Conversation

@apratimmukherjee
Copy link
Contributor

@apratimmukherjee apratimmukherjee commented Sep 5, 2025

Current model does not provide the control to be able specify that BGP IPv4 routes sent by BGPv4 peer should be sent using Traditional NLRI so implementations are currently expected to normally always send IPv4 routes in MP_REACH and withdraw routes using MP_UNREACH.
This PR allows user to optionally allow IPv4 routes only for IPv4 BGP peers to be configured to be advertised or withdrawn using Traditional REACH/UN_REACH methods .

Redocli view of proposed model
devices[i].bgp.ipv4_interfaces[j].peers[k].traditional_nlri_for_ipv4_routes

Note: This is applicable only for BGPv4 peers and not for BGPv6 peers ( which can send IPv4 routes only using MP_REACH NLRI )

Design note:
Another way to do this could have been to expose this control per route per peer instead of per BGPv4 peer.
Did not choose to go down this path since

  1. Does not seem to add much extra value. Normally one specific BGPv4 peer will either send all IPv4 routes as Traditional or as MP_REACH,
  2. Since current model is created using shared class/object for BGP v4 routes , adding a new attribute there would mean it would also show up for BGPv6 peer , which is not desired. Adding a new class ( with duplication of remaining attributes ) would result in class name change and possible auto generated enum names within that object ( for snappi/gosnappi) to also change resulting in backward compatibility breakage so this option is not chosen. [ Also makes it difficult for maintenance in terms of any modifications of attributes/documentation ]

Example usage:

//Config creation 
{
	...
	config := gosnappi.NewConfig()

    // add ports / devices/ interfaces as usual 
    ....
    
    // Only showing snippet of BGPv4 peer configuration relevant to this PR . 
     d1Bgp := d1.Bgp().
                SetRouterId("1.1.1.2")

    d1BgpIpv4Interface1 := d1Bgp.
                Ipv4Interfaces().Add().
                SetIpv4Name("p1d1ipv4")

    d1BgpIpv4Interface1Peer1 := d1BgpIpv4Interface1.
                Peers().
                Add().
                SetAsNumber(2222).
                SetAsType(gosnappi.BgpV4PeerAsType.IBGP).
                SetPeerAddress("1.1.1.1").
                SetName("p1d1bgpv4").
                SetTraditionalNlriForIpv4Routes(true)  // This is the newly introduced attribute per BGPv4 Peer.
                 
   // This route will now be transmitted or withdrawn using Traditional NLRI 
    d1BgpIpv4Interface1Peer1V4Route1 := d1BgpIpv4Interface1Peer1.
                V4Routes().
                Add().
                SetName("p1d1peer1rrv4")

    d1BgpIpv4Interface1Peer1V4Route1.Addresses().Add().
                SetAddress("10.10.10.1").
                SetPrefix(32).
                SetCount(4).
                SetStep(1)
      ....

apratimmukherjee and others added 2 commits September 5, 2025 12:49
…raditional REACH NLRI instead of MP_REACH NLRI and similarly withdraw routes using traditional UNREACH NLRI instead of MP_UNREACH NLRI.
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.

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 sending IPv4 routes using Traditional NLRI for BGPv4 peers.

4 participants