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

IOS get_network_instances fails 'KeyError' when deleting item from interfaces #1387

Closed
1 task done
cromulon-actual opened this issue Mar 3, 2021 · 2 comments
Closed
1 task done

Comments

@cromulon-actual
Copy link

Description of Issue/Question

Issue with ios driver for getting VRFs. On Cat3850 running Fuji 16.9.x code, when performing the get_network_instances line 3431 (deleting items from interfaces from network instances nested dict) returns an error: line 3431, in get_network_instances del instances["default"]["interfaces"]["interface"][item] KeyError: 'LI18/2'

Suggestion is to set conditional statement:

 if item in instances["default"]["interfaces"]["interface"]:
     del instances["default"]["interfaces"]["interface"][item]

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)

  • [] Yes
  • No

Setup

napalm version

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

napalm==3.2.0
nornir-napalm==0.1.1

Network operating system version

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

Switch Ports Model              SW Version        SW Image              Mode   
------ ----- -----              ----------        ----------            ----   
*    1 62    WS-C3850-12X48U    16.9.4            CAT3K_CAA-UNIVERSALK9 INSTALL
     2 62    WS-C3850-12X48U    16.9.4            CAT3K_CAA-UNIVERSALK9 INSTALL
     3 62    WS-C3850-12X48U    16.9.4            CAT3K_CAA-UNIVERSALK9 INSTALL

Steps to Reproduce the Issue

Error Traceback

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

2021-03-03 09:36:49,204 - nornir.core.task -    ERROR -      start() - Host 'SANITIZED': task 'napalm_get' failed with traceback:
Traceback (most recent call last):
  File "/Users/SANITIZED/Documents/Private/python_projects/Network_Automation/lib/python3.9/site-packages/nornir/core/task.py", line 98, in start
    r = self.task(self, **self.params)
  File "/Users/SANITIZED/Documents/Private/python_projects/Network_Automation/lib/python3.9/site-packages/nornir_napalm/plugins/tasks/napalm_get.py", line 44, in napalm_get
    result[g] = method(**options)
  File "/Users/SANITIZED/Documents/Private/python_projects/Network_Automation/lib/python3.9/site-packages/napalm/ios/ios.py", line 3431, in get_network_instances
    del instances["default"]["interfaces"]["interface"][item]
KeyError: 'LI18/2'

@DavidVentura
Copy link
Contributor

what is this issue waiting for? I can make the PR if that's what's missing

@mirceaulinic
Copy link
Member

Yep, a PR would do it @DavidVentura, cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants