Skip to content

Handling modification of ip range for dynamic BGP peers#22261

Merged
StormLiangMS merged 3 commits intosonic-net:masterfrom
sudarshankumar4893:modifyiprange
May 7, 2025
Merged

Handling modification of ip range for dynamic BGP peers#22261
StormLiangMS merged 3 commits intosonic-net:masterfrom
sudarshankumar4893:modifyiprange

Conversation

@sudarshankumar4893
Copy link
Contributor

@sudarshankumar4893 sudarshankumar4893 commented Apr 8, 2025

Why I did it

There is a requirement to be able to modify the listen range of dynamic peers in a peer group and persist the changes through bgpcfgd during run time. This PR adds support for being able to modify the ip_range for a dynamic BGP peer through bgpcfgd.

Here is the High level design document explaining this feature:
Dynamic BGP peer update and delete support by anish-n · Pull Request #1963 · sonic-net/SONiC

Work item tracking
  • Microsoft ADO (number only):

How I did it

The ranges from the set handler will be applied. Any older ranges which are not in the new ranges or any older ranges which overlap with the new ranges will be removed and then the new ranges will be applied. There will be no impact to existing ranges which are present in new range as well. If an older range gets deleted, the peers from that range will flap.

How to verify it

Create a dynamic peer range like so in config_db.json:
"BGP_PEER_RANGE": {
"BGPSLBPassive": {
"ip_range": [
"10.0.0.60/30"
],
"peer_asn": "64600",
"src_address": "10.0.0.60",
"name": "BGPSLBPassive"
}
}
Once the peer is up, add/delete/modify the range to see that the corresponding FRR commands are generated and peers from new range come up. To parse the new changes, run sonic-cfggen like so:
sonic-cfggen -j /etc/sonic/config_db.json --write-to-db
Sample updates:

  1. Updating the existing range.
    "BGP_PEER_RANGE": {
    "BGPSLBPassive": {
    "ip_range": [
    "10.0.0.60/29"
    ],
    "peer_asn": "64600",
    "src_address": "10.0.0.60",
    "name": "BGPSLBPassive"
    }
    }
  2. Adding a new range:
    "BGP_PEER_RANGE": {
    "BGPSLBPassive": {
    "ip_range": [
    "10.0.0.60/30","10.0.0.56/30"
    ],
    "peer_asn": "64600",
    "src_address": "10.0.0.60",
    "name": "BGPSLBPassive"
    }
    }

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@sudarshankumar4893 sudarshankumar4893 marked this pull request as ready for review April 8, 2025 00:24
Copy link
Contributor

@StormLiangMS StormLiangMS left a comment

Choose a reason for hiding this comment

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

hi @sudarshankumar4893 since this is for phase 2, could we have test cases ready for review and in place at same time?

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…pdate

Signed-off-by: Sudarshan Kumar (from Dev Box) <sudakumar@microsoft.com>
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@StormLiangMS StormLiangMS left a comment

Choose a reason for hiding this comment

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

LGTM

@StormLiangMS StormLiangMS merged commit 0405fdf into sonic-net:master May 7, 2025
19 checks passed
StormLiangMS added a commit that referenced this pull request May 7, 2025
StormLiangMS added a commit that referenced this pull request May 7, 2025
sudarshankumar4893 added a commit to sudarshankumar4893/per-vnet-bgp that referenced this pull request May 7, 2025
StormLiangMS pushed a commit that referenced this pull request May 9, 2025
Why I did it
This PR adds the changes back from this PR: #22261
Along with 1 more change to fix the UT such that it only asserts if the template for dynamic neighbors exist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants