Skip to content

some junos getters broken with junos-eznc 2.7.2 #2154

Open
@amylieb

Description

@amylieb

Description of Issue/Question

Did a fresh install of napalm into a venv and ran get_interfaces against a Juniper device. Got some weird output. Stripped down code for testing:

from napalm.junos import JunOSDriver
from pprint import pprint

test_host = JunOSDriver(<details redacted>)
test_host.open()
pprint(test_host.get_interfaces())
test_host.close()

Here is the resulting error:

Traceback (most recent call last):
  File "/home/amylieb/src/sph-audit/test.py", line 6, in <module>
    pprint(test_host.get_interfaces())
  File "/home/amylieb/src/sph-audit/venv/lib/python3.10/site-packages/napalm/junos/junos.py", line 481, in get_interfaces
    result = _convert_to_dict(interfaces)
  File "/home/amylieb/src/sph-audit/venv/lib/python3.10/site-packages/napalm/junos/junos.py", line 438, in _convert_to_dict
    "is_up": iface_data["is_up"],
TypeError: 'NoneType' object is not subscriptable

I went into the source code for the Junos driver and added print(dict(interfaces)) after line 472 to see what junos views gave me, here's what that looks like:

{'ge-0/0/0': None, 'pfe-0/0/0': None, 'pfh-0/0/0': None, 'ge-0/0/1': None, 'ge-0/0/2': None, 'ge-0/0/3': None, 'ge-0/0/4': None, 'ge-0/0/5': None, 'ge-0/0/6': None, 'ge-0/0/7': None, 'ge-0/0/8': None, 'ge-0/0/9': None, 'ge-0/0/10': None, 'ge-0/0/11': None, 'ge-0/0/12': None, 'ge-0/0/13': None, 'ge-0/0/14': None, 'ge-0/0/15': None, 'ge-0/0/16': None, 'ge-0/0/17': None, 'ge-0/0/18': None, 'ge-0/0/19': None, 'ge-0/0/20': None, 'ge-0/0/21': None, 'ge-0/0/22': None, 'ge-0/0/23': None, 'ge-0/0/24': None, 'ge-0/0/25': None, 'ge-0/0/26': None, 'ge-0/0/27': None, 'ge-0/0/28': None, 'ge-0/0/29': None, 'ge-0/0/30': None, 'ge-0/0/31': None, 'ge-0/0/32': None, 'ge-0/0/33': None, 'ge-0/0/34': None, 'ge-0/0/35': None, 'ge-0/0/36': None, 'ge-0/0/37': None, 'ge-0/0/38': None, 'ge-0/0/39': None, 'ge-0/0/40': None, 'ge-0/0/41': None, 'ge-0/0/42': None, 'ge-0/0/43': None, 'ge-0/0/44': None, 'ge-0/0/45': None, 'ge-0/0/46': None, 'ge-0/0/47': None, 'xe-0/2/0': None, 'xe-0/2/1': None, 'ae0': None, 'bme0': None, 'cbp0': None, 'dsc': None, 'esi': None, 'gre': None, 'ipip': None, 'irb': None, 'jsrv': None, 'lo0': None, 'lsi': None, 'me0': None, 'mtun': None, 'pimd': None, 'pime': None, 'pip0': None, 'tap': None, 'vme': None, 'vtep': None}

This getter has worked just fine for me in the past, so the first thing I tried was to downgrade junos-eznc from 2.7.2 to 2.7.1 and everything works fine.

Because I was curious, I ran all the getters against my test device (An EX3400-48P running 20.4R3-S1.3) with junos-eznc at 2.7.2 and 2.7.1. Below are the ones that failed (by that I mean threw an exception) at 2.7.2 that did not at 2.7.1:

  • get_interfaces
  • get_network_instances
  • get_route_to

I glanced through the open issues on the pyEZ repo and didn't see anything obvious. I don't really have the time/interest to dig deep enough to open a detailed issue with them, but I want to give you guys a heads up about it - at the very least you can potentially update your requirements file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions