Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_lldp_neighbors errors with multiline show lldp info #23

Open
johanek opened this issue Nov 28, 2021 · 0 comments · May be fixed by #24
Open

get_lldp_neighbors errors with multiline show lldp info #23

johanek opened this issue Nov 28, 2021 · 0 comments · May be fixed by #24

Comments

@johanek
Copy link

johanek commented Nov 28, 2021

Some devices can return a multiline sysname, i.e.:

# show lldp info remote-device

 LLDP Remote Devices Information

  LocalPort | ChassisId          PortId             PortDescr SysName
  --------- + ------------------ ------------------ --------- ------------------
  7         | 00 5f 67 d0 7e 5a  gigabitEthernet... gigabi...
54 4c  2d 53   47 32  32 31    30 4d  50 00   00 00  00 00
00 00  00 00   00 00  00 00    00 00  00 00   00 00  00 00
00 00  00 00   00 00  00 00    00 00  00 00   00 00  00 00
00 00  00 00   00 00  00 00    00 00  00 00   00 00  00 00
00 00  00 00   00
  26        | cc 4e 24 83 08 a6  cc 4e 24 83 08 bd  10Giga... ROUTER-...

This results in the following errors:

Traceback (most recent call last):
  File "/Users/johan/.local/share/virtualenvs/sohonet-netbox-importer-Gj3g_iu9/lib/python3.9/site-packages/napalm_procurve/procurve.py", line 308, in get_lldp_neighbors
    (
ValueError: too many values to unpack (expected 11)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/johan/.local/share/virtualenvs/sohonet-netbox-importer-Gj3g_iu9/lib/python3.9/site-packages/nornir/core/task.py", line 98, in start
    r = self.task(self, **self.params)
  File "/Users/johan/git/vdl/sohonet-netbox-importer/bin/../nornirrunner/tasks/inventory.py", line 31, in get_device_info
    return _get_device_data(task, getters)
  File "/Users/johan/git/vdl/sohonet-netbox-importer/bin/../nornirrunner/tasks/inventory.py", line 50, in _get_device_data
    return napalm_get(task, getters=getters)
  File "/Users/johan/.local/share/virtualenvs/sohonet-netbox-importer-Gj3g_iu9/lib/python3.9/site-packages/nornir_napalm/plugins/tasks/napalm_get.py", line 44, in napalm_get
    result[g] = method(**options)
  File "/Users/johan/.local/share/virtualenvs/sohonet-netbox-importer-Gj3g_iu9/lib/python3.9/site-packages/napalm_procurve/procurve.py", line 325, in get_lldp_neighbors
    remote_port, device_id = self._get_lldp_neighbors_detail(local_port)
  File "/Users/johan/.local/share/virtualenvs/sohonet-netbox-importer-Gj3g_iu9/lib/python3.9/site-packages/napalm_procurve/procurve.py", line 376, in _get_lldp_neighbors_detail
    return (tmp_lldp_details["PortId"], tmp_lldp_details["SysName"])
KeyError: 'PortId'

Because get_lldp_neighbors is using line-by-line parsing of the output, each line of the hex values is being processed as if it were a separate entry in the table

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 a pull request may close this issue.

1 participant