When running show lldp neighbors and when the response from lldpd a neighbor does not have a desc a TypeError is thrown
yzguy@border1:~$ show lldp neighbors Traceback (most recent call last): File "/usr/libexec/vyos/op_mode/lldp.py", line 144, in <module> res = vyos.opmode.run(sys.modules[__name__]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/vyos/opmode.py", line 263, in run res = func(**args) ^^^^^^^^^^^^ File "/usr/libexec/vyos/op_mode/lldp.py", line 44, in _wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/libexec/vyos/op_mode/lldp.py", line 140, in show_neighbors return _get_formatted_output(lldp_data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/libexec/vyos/op_mode/lldp.py", line 117, in _get_formatted_output tmp.append(platform[:37]) ~~~~~~~~^^^^^ TypeError: 'NoneType' object is not subscriptable
Looking at the lldpctl -f json output for the device erroring we see
{ "lldp": { "interface": { "eth1": { "via": "LLDP", "rid": "3", "age": "0 day, 00:01:21", "chassis": { "spine1": { "id": { "type": "mac", "value": "50:00:00:d7:ee:0b" }, "mgmt-ip": "172.99.0.1", "mgmt-iface": "5000000", "capability": [ { "type": "Bridge", "enabled": true }, { "type": "Router", "enabled": true } ] } }, "port": { "id": { "type": "ifname", "value": "Ethernet8" }, "ttl": "120", "mfs": "9236" }, "lldp-med": { "device-type": "Network Connectivity Device", "capability": { "type": "Capabilities", "available": true } } } } } }
Whereas on a working output we see the desc
{ "lldp": { "interface": { "eth4": { "via": "LLDP", "rid": "2", "age": "30 days, 16:56:09", "chassis": { "switch": { "id": { "type": "mac", "value": "b0:a8:6e:8e:29:c0" }, "descr": "Juniper Networks, Inc. ex3300-48p , version 12.3R12-S21 Build date: 2022-03-02 16:28:50 UTC ", ... }
Looking at Line 116/117 of vyos/op_mode/lldp.py, we see
# Remote software platform platform = jmespath.search('chassis.[*][0][0].descr', values) tmp.append(platform[:37])
Which has no logic to handle if platform is None, which could be as simple as
if platform: tmp.append(platform[:37]) else: tmp.append('')