Skip to content

[202012][show_bfd] add local discriminator in show bfd command#2616

Merged
siqbal1986 merged 3 commits intosonic-net:202012from
baorliu:cisco-baorliu-bfd-cli
Jan 25, 2023
Merged

[202012][show_bfd] add local discriminator in show bfd command#2616
siqbal1986 merged 3 commits intosonic-net:202012from
baorliu:cisco-baorliu-bfd-cli

Conversation

@baorliu
Copy link
Contributor

@baorliu baorliu commented Jan 20, 2023

What I did

the pull request sonic-net/sonic-swss#2587 added local_discriminator to state_db

In this pull request, local discriminator is added in the output of the following show commands :

show bfd summary
show bfd peer

the upcoming BFD debug CLI needs the local discriminator to specify BFD session.

How I did it

in show/main.py show bfd cli, read state db and show the value if there is local_discriminator field, and show "NA" if the field does not exist (backward compatible).

How to verify it

updated the test/show_bfd_test.py to test the local_discriminator field and show bfd cli output.
and also did manual test in a testbed (with modified bfdorch wich sonic-net/sonic-swss/pull/2587 diff ):

cisco@sonic:/var/tmp$ show bfd sum
Total number of BFD sessions: 1
Peer Addr    Interface    Vrf      State    Type          Local Addr      TX Interval    RX Interval    Multiplier  Multihop    Local Discriminator
-----------  -----------  -------  -------  ------------  ------------  -------------  -------------  ------------  ----------  ---------------------
192.85.2.24  default      default  Down     async_active  192.85.2.29            1000           1000             3  true        NA
cisco@sonic:/var/tmp$ show bfd peer 192.85.2.24
Total number of BFD sessions for peer IP 192.85.2.24: 1
Peer Addr    Interface    Vrf      State    Type          Local Addr      TX Interval    RX Interval    Multiplier  Multihop    Local Discriminator
-----------  -----------  -------  -------  ------------  ------------  -------------  -------------  ------------  ----------  ---------------------
192.85.2.24  default      default  Down     async_active  192.85.2.29            1000           1000             3  true        NA
cisco@sonic:/var/tmp$ docker exec -i swss swssconfig /dev/stdin < bfd.cfg
cisco@sonic:/var/tmp$ show bfd peer 192.85.2.24
Total number of BFD sessions for peer IP 192.85.2.24: 1
Peer Addr    Interface    Vrf      State    Type          Local Addr      TX Interval    RX Interval    Multiplier  Multihop      Local Discriminator
-----------  -----------  -------  -------  ------------  ------------  -------------  -------------  ------------  ----------  ---------------------
192.85.2.24  default      default  Down     async_active  192.85.2.29            1000           1000             3  true                            1
cisco@sonic:/var/tmp$ show bfd sum
Total number of BFD sessions: 1
Peer Addr    Interface    Vrf      State    Type          Local Addr      TX Interval    RX Interval    Multiplier  Multihop      Local Discriminator
-----------  -----------  -------  -------  ------------  ------------  -------------  -------------  ------------  ----------  ---------------------
192.85.2.24  default      default  Down     async_active  192.85.2.29            1000           1000             3  true                            1

Previous command output (if the output of a command-line utility has changed)

Peer Addr              Interface    Vrf      State    Type          Local Addr               TX Interval    RX Interval    Multiplier  Multihop
---------------------  -----------  -------  -------  ------------  ---------------------  -------------  -------------  ------------  ----------
100.251.7.1            default      default  Up       async_active  10.0.0.1                         300            500             3  true
fddd:a101:a251::a10:1  default      default  Down     async_active  fddd:c101:a251::a10:2            300            500             3  true
10.0.1.1               default      default  DOWN     async_active  10.0.0.1                         300            500             3  true
10.0.2.1               Ethernet12   default  UP       async_active  10.0.0.1                         200            600             3  false
2000::10:1             default      default  UP       async_active  2000::1                          100            700             3  false
10.0.1.1               default      VrfRed   UP       async_active  10.0.0.1                         400            500             5  false

New command output (if the output of a command-line utility has changed)

Peer Addr              Interface    Vrf      State    Type          Local Addr               TX Interval    RX Interval    Multiplier  Multihop    Local Discriminator
---------------------  -----------  -------  -------  ------------  ---------------------  -------------  -------------  ------------  ----------  ---------------------
100.251.7.1            default      default  Up       async_active  10.0.0.1                         300            500             3  true        NA
fddd:a101:a251::a10:1  default      default  Down     async_active  fddd:c101:a251::a10:2            300            500             3  true        NA
10.0.1.1               default      default  DOWN     async_active  10.0.0.1                         300            500             3  true        NA
10.0.2.1               Ethernet12   default  UP       async_active  10.0.0.1                         200            600             3  false       88
2000::10:1             default      default  UP       async_active  2000::1                          100            700             3  false       NA
10.0.1.1               default      VrfRed   UP       async_active  10.0.0.1                         400            500             5  false       NA

@prsunny prsunny requested a review from siqbal1986 January 20, 2023 22:19
Copy link
Contributor

@siqbal1986 siqbal1986 left a comment

Choose a reason for hiding this comment

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

LGTM

@siqbal1986 siqbal1986 merged commit c60f771 into sonic-net:202012 Jan 25, 2023
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.

2 participants