Skip to content

Bug: show ip bgp ... commands assume that there's only one container that contains the name bgp #22476

@saiarcot895

Description

@saiarcot895

Is it platform specific

generic

Importance or Severity

Medium

Description of the bug

The functionality of the show ip bgp ... commands (and the equivalent for IPv6) depend on detecting the routing stack that is being used, whether it's FRR or Quagga. It does this by getting the running containers and grepping for any container that has a name bgp (https://github.com/sonic-net/sonic-utilities/blob/8ab3773b159328af71303a160e66e927ee330f90/show/main.py#L85-L98). However, this can include other containers that happen to have bgp as a substring of their name, and thus break the detection logic. Additionally, current versions of SONiC only support FRR, so this check is unnecessary.

Steps to Reproduce

On SONiC, start a new container that has the word bgp within it (maybe test_bgp). The image can be anything.

Depending on the ordering of the output of docker ps, this new container may then cause show ip bgp ... to break.

Actual Behavior and Expected Behavior

Actual behavior:

admin@vlab-01:~$ docker run --rm --detach --name=macsec_but_bgp docker-macsec
84cdf2abfaa9d96a4e3df6d876455ff9abdbfa26e1ae5dfbc91a1540a5002f49
admin@vlab-01:~$ docker ps
CONTAINER ID   IMAGE                     COMMAND                  CREATED         STATUS        PORTS     NAMES
84cdf2abfaa9   docker-macsec             "/usr/local/bin/supe…"   2 seconds ago   Up 1 second             macsec_but_bgp
0578609ebf1e   docker-lldp:latest        "/usr/bin/docker-lld…"   6 days ago      Up 5 days               lldp
17f66f97d233   docker-fpm-frr:latest     "/usr/bin/docker_ini…"   6 days ago      Up 5 days               bgp
44bbd265a4d9   docker-syncd-vs:latest    "/usr/local/bin/supe…"   6 days ago      Up 5 days               syncd
a9f264bf909a   docker-teamd:latest       "/usr/local/bin/supe…"   6 days ago      Up 5 days               teamd
5ba71949a65a   docker-framework:latest   "/usr/local/bin/supe…"   6 days ago      Up 5 days               framework
9762a824b4a2   docker-orchagent:latest   "/usr/bin/docker-ini…"   6 days ago      Up 5 days               swss
c96f6e2311e4   docker-database:latest    "/usr/local/bin/dock…"   6 days ago      Up 6 days               database
admin@vlab-01:~$ show ip bgp summary
Usage: show ip [OPTIONS] COMMAND [ARGS]...
Try "show ip -h" for help.

Error: No such command "bgp".
admin@vlab-01:~$ docker stop macsec_but_bgp
macsec_but_bgp
admin@vlab-01:~$ show ip bgp summary

IPv4 Unicast Summary:
BGP router identifier 10.1.0.32, local AS number 65100 vrf-id 0
BGP table version 19207
RIB entries 12807, using 1639296 bytes of memory
Peers 4, using 82368 KiB of memory
Peer groups 4, using 256 bytes of memory


Neighbhor      V     AS    MsgRcvd    MsgSent    TblVer    InQ    OutQ  Up/Down      State/PfxRcd  NeighborName
-----------  ---  -----  ---------  ---------  --------  -----  ------  ---------  --------------  --------------
10.0.0.57      4  64600     167738     167730     19207      0       0  5d17h06m             6400  ARISTA01T1
10.0.0.59      4  64600     167738     167729     19207      0       0  5d17h06m             6400  ARISTA02T1
10.0.0.61      4  64600     167735     167728     19207      0       0  5d17h06m             6400  ARISTA03T1
10.0.0.63      4  64600     167735     167728     19207      0       0  5d17h06m             6400  ARISTA04T1

Total number of neighbors 4

Relevant log output

Output of show version, show techsupport

Attach files (if any)

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions