Troubleshoot BFD

Due to the limited internal counter resources for BFD session scale, the BFD session counters are disabled as default. If you have to troubleshoot BFD, you must enable the counters of the required BFD session during run time. The router references the BFD sessions with a local discriminator.

This section describes the commands to enable and disable the BFD serviceability commands.

Obtain the Local Discriminator

Obtain the local discriminator of the BFD session from the output of show bfd summary.

show bfd summary

cisco@sonic:~$ show bfd summary 
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 Up      async_active 192.85.2.29   1000          1000          3            true       1

cisco@sonic:~$

Enable/Disable BFD session counter

The next step is to enable the BFD session counter of the required BFD session.

config platform cisco bfd counter <enable | disable> -d <local_discriminator> [-n asic[0,1..]]

cisco@sonic:~$ sudo config platform cisco bfd counter enable -d 1

Enabling bfd counter of bfd 1
23-01-2023 22:02:32.534 [WARNING] SAI_API_BFD: bfd counters have already been enabled
Successfully set counter enable to True

View BFD session counter stats

Then display the BFD session stats that were captured by the router. If you don't enable the BFD session counter before this step, you will not see any stats in the output of this command.

show platform npu bfd counter -d <local_discriminator> [-n asic[0,1...]]

cisco@sonic:~$ sudo show platform npu bfd counter -d 1

BFD session OID 0x4500000000000000 local_discriminator 1 stats
SAI_BFD_SESSION_STAT_IN_PACKETS : 339627
SAI_BFD_SESSION_STAT_OUT_PACKETS : 339798

When debug session is complete, disable bfd counters associated with the local discriminator. This helps to free up bfd counter resources. Once the bfd counters are disabled, the show platform npu bfd counters will not display any stats.