sonic-net / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
737 stars 1.43k forks source link

'show lldp table' fails when have LLDP neighbors on frontpanel ports and internal ports (multi-asic/T2) #7060

Closed sanmalho-git closed 3 years ago

sanmalho-git commented 3 years ago

Description

'show lldp table' fails when have LLDP neighbors on frontpanel ports and also have internal ports running LLDP as well. Examples of internal ports include the Inband port 'Ethernet-IB' on a T2 chassis, or 'Ethernet-BP' on a multi-asic pizza box.

This fails iface_namingmode::TestShowLldp::test_show_lldp_tables test case in sonic-mgmt tests.

Steps to reproduce the issue:

  1. On a multi-asic pizza box or linecard of a T2 chassis which has inband port that runs LLDP, as well as have LLDP neighbors on its frontpanel ports, run the command 'show lldp table'.

Describe the results you received:

admin@board7:/usr/local/bin$   show lldp table
'<' not supported between instances of 'str' and 'int'
Capability codes: (R) Router, (B) Bridge, (O) Other
admin@board7:/usr/local/bin$ 

Looking further into the issue in /usr/local/bin/lldpshow, the issue is that in internal function 'alphanum_key' in function sort_sum. For frontpanel port, this return a list of 2 ['Ethernet', '5'], but for inband port it returns a list of 3 ['Ethernet', 'IB', '0']. This the comparison fails.

If we include a '-' in the regexp ([-A-Za-z]+), then things work fine.

Describe the results you expected:

admin@board4:~$ show lldp table
Capability codes: (R) Router, (B) Bridge, (O) Other
LocalPort     RemoteDevice    RemotePortID       Capability    RemotePortDescr
------------  --------------  -----------------  ------------  -----------------
Ethernet0     ARISTA01T1      Ethernet1          BR
Ethernet1     ARISTA01T1      Ethernet2          BR
Ethernet2     ARISTA03T1      Ethernet1          BR
Ethernet3     ARISTA03T1      Ethernet2          BR
Ethernet4     ARISTA05T1      Ethernet1          BR
Ethernet5     ARISTA05T1      Ethernet2          BR
Ethernet6     ARISTA07T1      Ethernet1          BR
Ethernet7     ARISTA07T1      Ethernet2          BR
Ethernet8     ARISTA09T1      Ethernet1          BR
Ethernet9     ARISTA09T1      Ethernet2          BR
Ethernet10    ARISTA11T1      Ethernet1          BR
Ethernet11    ARISTA11T1      Ethernet2          BR
Ethernet12    ARISTA13T1      Ethernet1          BR
Ethernet13    ARISTA13T1      Ethernet2          BR
Ethernet14    ARISTA15T1      Ethernet1          BR
Ethernet15    ARISTA15T1      Ethernet2          BR
Ethernet16    ARISTA17T1      Ethernet1          BR
Ethernet17    ARISTA18T1      Ethernet1          BR
Ethernet18    ARISTA19T1      Ethernet1          BR
Ethernet19    ARISTA20T1      Ethernet1          BR
Ethernet20    ARISTA21T1      Ethernet1          BR
Ethernet21    ARISTA22T1      Ethernet1          BR
Ethernet22    ARISTA23T1      Ethernet1          BR
Ethernet23    ARISTA24T1      Ethernet1          BR
Ethernet24    ARISTA25T1      Ethernet1          BR
Ethernet25    ARISTA26T1      Ethernet1          BR
Ethernet26    ARISTA27T1      Ethernet1          BR
Ethernet27    ARISTA28T1      Ethernet1          BR
Ethernet28    ARISTA29T1      Ethernet1          BR
Ethernet29    ARISTA30T1      Ethernet1          BR
Ethernet30    ARISTA31T1      Ethernet1          BR
Ethernet31    ARISTA32T1      Ethernet1          BR
Ethernet-IB0 board4  14:7b:ac:3a:c9:7f  BR            Ethernet-IB0
--------------------------------------------------
Total entries displayed:  33
admin@board4:~$ 

Output of show version:

Additional information you deem important (e.g. issue happens only occasionally):

sanmalho-git commented 3 years ago

With multi-asic, they ignore interfaces that start with "Ethernet-BP", and thus the issue will not show in a multi-asic pizza box. We will add similar exclusion for Inband port for T2 VOQ chassis.