napalm-automation / napalm

Network Automation and Programmability Abstraction Layer with Multivendor support
Apache License 2.0
2.26k stars 555 forks source link

IOS-XR get_lldp_neighbor_details does not support 'N/A' capabilities #1297

Closed n-holmstedt closed 2 years ago

n-holmstedt commented 4 years ago

Description of Issue/Question

The constants LLDP_CAPAB_TRANFORM_TABLE does not include 'N/A' of system capabilities. No checks for this value either.

<SystemCapabilities>
     N/A
</SystemCapabilities>

Note: Please check https://guides.github.com/features/mastering-markdown/ to see how to properly format your request.

Did you follow the steps from https://github.com/napalm-automation/napalm#faq

(Place an x between the square brackets where applicable)

Setup

napalm version

(Paste verbatim output from pip freeze | grep napalm between quotes below)

root@salt-master1:/# python3 -m pip freeze | grep napalm
napalm==3.2.0

Network operating system version

(Paste verbatim output from show version - or equivalent - between quotes below)

RP/0/RP0/CPU0:hbr1.12345.999#show version
Wed Sep 23 18:41:02.500 CEST
Cisco IOS XR Software, Version 7.1.2 LNT
Copyright (c) 2013-2020 by Cisco Systems, Inc.

Build Information:
 Built By     : ahoang
 Built On     : Sat Aug 29 20:04:27 UTC 2020
 Build Host   : iox-lnx-069
 Workspace    : /auto/srcarchive13/prod/7.1.2/ncs540l/ws
 Version      : 7.1.2
 Label        : 7.1.2

cisco NCS540L (C3708 @ 1.70GHz)
System uptime is 1 week, 1 day, 10 hours, 2 minutes

Steps to Reproduce the Issue

Error Traceback

(Paste the complete traceback of the exception between quotes below)

================= Traceback =================

Traceback (most recent call last):
  File "/usr/local/bin/napalm", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/napalm/base/clitools/cl_napalm.py", line 308, in main
    run_tests(args)
  File "/usr/local/lib/python3.8/dist-packages/napalm/base/clitools/cl_napalm.py", line 291, in run_tests
    call_getter(device, args.method, **method_kwargs)
  File "/usr/local/lib/python3.8/dist-packages/napalm/base/clitools/cl_napalm.py", line 27, in wrapper
    r = func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/napalm/base/clitools/cl_napalm.py", line 255, in call_getter
    r = func(**kwargs)
  File "/usr/local/lib/python3.8/dist-packages/napalm/iosxr/iosxr.py", line 852, in get_lldp_neighbors_detail
    "remote_system_capab": napalm.base.helpers.transform_lldp_capab(
  File "/usr/local/lib/python3.8/dist-packages/napalm/base/helpers.py", line 463, in transform_lldp_capab
    [constants.LLDP_CAPAB_TRANFORM_TABLE[c.strip()] for c in capabilities]
  File "/usr/local/lib/python3.8/dist-packages/napalm/base/helpers.py", line 463, in <listcomp>
    [constants.LLDP_CAPAB_TRANFORM_TABLE[c.strip()] for c in capabilities]
KeyError: 'n/a'
olebowle commented 2 years ago

Hi, I faced the same issue on NCS-5500 and fixed it by adding n/a to the transform table (see PR).