[chassis][LLDP] Fix the show lldp table issue on the supervisor
What I did
Chassis with multiple linecards, if the mgmt port eth0 on the supervisor is a bridge interface which are connected the linecard internal mgmt port eth0. CLI command "show lldp table" will shows only one entry although the show lldp neighbor shows multiple entries.
Fixes #https://github.com/sonic-net/sonic-buildimage/issues/16746
How I did it
The root cause is the function parse_info() in lldpshow script use a key which is not unique to parse the neighbors info on the Supervisor. Instead of use "<localPort>#<remotePort>" as key to parse and store neighbor info, we should use "<localPort>#<remoteHostName>#<remotePort>" as key which is unique to avoid the entry info be overwrited.
Which release branch to backport (provide reason below if selected)
- [ ] 201811
- [ ] 201911
- [ ] 202006
- [ ] 202012
- [ ] 202106
- [ ] 202111
- [x] 202205
- [x] 202211
- [x] 202305
How to verify it
execute both CLI commands "show lldp table" and "show lldp neighbor" on supervisor on the chassis. the output entries should be the same. Example
admin@ixre-cpm-chassis7:~$ show lldp table
Capability codes: (R) Router, (B) Bridge, (O) Other
LocalPort RemoteDevice RemotePortID Capability RemotePortDescr
----------- ---------------- ----------------- ------------ -----------------
eth0 ixre-egl-board25 eth0 BR eth0
eth0 sonic 40:7c:7d:bb:25:e5 BR eth0
eth0 ixre-egl-board26 eth0 BR eth0
--------------------------------------------------
Total entries displayed: 3
admin@ixre-cpm-chassis7:~$ show lldp neighbors
-------------------------------------------------------------------------------
LLDP neighbors:
-------------------------------------------------------------------------------
Interface: eth0, via: LLDP, RID: 1, Time: 0 day, 02:34:30
Chassis:
ChassisID: mac 40:7c:7d:bb:26:13
SysName: ixre-egl-board25
SysDescr: SONiC Software Version: SONiC.HEAD.543461-msft-2205-ndk-968500c6 - HwSku: Nokia-IXR7250E-36x100G - Distribution: Debian 11.7 - Kernel: 5.10.0-18-2-amd64
MgmtIP: 152.148.151.114
Capability: Bridge, on
Capability: Router, on
Capability: Wlan, off
Capability: Station, off
Port:
PortID: local eth0
PortDescr: eth0
TTL: 120
-------------------------------------------------------------------------------
Interface: eth0, via: LLDP, RID: 2, Time: 0 day, 02:34:21
Chassis:
ChassisID: mac 40:7c:7d:bb:25:e5
SysName: sonic
SysDescr: SONiC Software Version: SONiC.HEAD.256061-dirty-20220426.133059 - HwSku: Nokia-IXR7250E-60x100G - Distribution: Debian 11.3 - Kernel: 5.10.0-8-2-amd64
MgmtIP: 240.127.1.1
MgmtIP: fd00::1
Capability: Bridge, on
Capability: Router, on
Capability: Wlan, off
Capability: Station, off
Port:
PortID: mac 40:7c:7d:bb:25:e5
PortDescr: eth0
TTL: 120
-------------------------------------------------------------------------------
Interface: eth0, via: LLDP, RID: 3, Time: 0 day, 02:34:17
Chassis:
ChassisID: mac 40:7c:7d:bb:27:6b
SysName: ixre-egl-board26
SysDescr: SONiC Software Version: SONiC.HEAD.543461-msft-2205-ndk-968500c6 - HwSku: Nokia-IXR7250E-36x100G - Distribution: Debian 11.7 - Kernel: 5.10.0-18-2-amd64
MgmtIP: 152.148.151.116
Capability: Bridge, on
Capability: Router, on
Capability: Wlan, off
Capability: Station, off
Port:
PortID: local eth0
PortDescr: eth0
TTL: 120
-------------------------------------------------------------------------------
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)
@judyjoseph After I fix the eth0 on the supervisor card and during unit testing, I found the issue https://github.com/sonic-net/sonic-buildimage/issues/16746. And create this PR to fix it. Please review it. Thanks
@abdosi to review as well
@abdosi Please help to review this change. Thanks
@abdosi Please help to review this PR
@abdosi to check
@abdosi Please help to review this PR
we don't need this PR. on supervisor we should only have one entry for eth0.