[backport] Fix BGP CLI bug for dynamic neighbors (#4409)#312
Merged
prabhataravind merged 1 commit intoApr 23, 2026
Conversation
What I did Certain bgp CLI commands like show ip bgp sum,show ip bgp neighbors <neighbor-ip> and show ip bgp neighbors <neighbor-ip> routes do not work for dynamic neighbors. Fixed the CLI by parsing dynamic BGP neighbors correctly. These fixes also result in the neighborName being displayed correctly for dynamic neighbors in the bgp summary. In addition, fixed a bug for static neighbors where the vrf name was not being checked (when specified). A neighbor IP match would return true even if the neighbor was configured in a different vrf. Fixed vrf all show commands, eg show ip bgp vrf all sum. Earlier it would combine the summaries for different vrfs into one table. Separated them out for clarity and to match VTYSH output. How I did it Removed dependency on src_address from dynamic neighbor parsing for bgp summary, which is an optional field. Added dynamic neighbor parsing for show ip bgp neighbors <neighbor-ip>. Earlier dynamic neighbors were not being checked at all. enhanced existing static neighbor parsing to also compare the vrf name instead of partial check on IP How to verify it Run show ip bgp sum,show ip bgp neighbors <neighbor-ip>,show ip bgp neighbors <neighbor-ip> routes on a DUT with dynamic neighbors, verify CLI output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport request for PR: sonic-net/sonic-utilities#4409
What I did
show ip bgp sum,show ip bgp neighbors <neighbor-ip>andshow ip bgp neighbors <neighbor-ip> routesdo not work for dynamic neighbors. Fixed the CLI by parsing dynamic BGP neighbors correctly.vrf allshow commands, egshow ip bgp vrf all sum. Earlier it would combine the summaries for different vrfs into one table. Separated them out for clarity and to match VTYSH output.How I did it
src_addressfrom dynamic neighbor parsing forbgp summary, which is an optional field.show ip bgp neighbors <neighbor-ip>. Earlier dynamic neighbors were not being checked at all.How to verify it
Run
show ip bgp sum,show ip bgp neighbors <neighbor-ip>,show ip bgp neighbors <neighbor-ip> routeson a DUT with dynamic neighbors, verify CLI outputPrevious command output (if the output of a command-line utility has changed)
show ip bgp neighbors <neighbor-ip>for dynamic neighborsshow ip bgp sumfor dynamic neighborsshow ip bgp vrf all sumNew command output (if the output of a command-line utility has changed)
show ip bgp neighbors <neighbor-ip>for dynamic neighborsshow ip bgp sumfor dynamic neighborsshow ip bgp vrf all sum