napalm-automation / napalm-iosxr

Apache License 2.0
10 stars 23 forks source link

get_interfaces method returns traceback #50

Closed wasabi222 closed 7 years ago

wasabi222 commented 7 years ago

Description of Issue/Question

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

[ x ] Yes [ ] No

Setup

napalm-iosxr version

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

napalm-iosxr==0.2.2

IOS-XR version and platform details

(Paste the complete verbatim output from show version brief between quotes below)

RP/0/RSP0/CPU0:gw1#sh ver br
Thu Sep 29 10:14:19.003 EDT

Cisco IOS XR Software, Version 5.3.3[Default]
Copyright (c) 2016 by Cisco Systems, Inc.

ROM: System Bootstrap, Version 0.73(c) 1994-2012 by Cisco Systems,  Inc.

gw1 uptime is 20 weeks, 6 days, 22 hours, 32 minutes
System image file is "disk0:asr9k-os-mbi-5.3.3/0x100305/mbiasr9k-rsp3.vm"

cisco ASR9K Series (Intel 686 F6M14S4) processor with 6291456K bytes of memory.
Intel 686 F6M14S4 processor at 2135MHz, Revision 2.174
ASR 9006 4 Line Card Slot Chassis with V2 AC PEM

4 Management Ethernet
16 TenGigE
16 DWDM controller(s)
16 WANPHY controller(s)
503k bytes of non-volatile configuration memory.
6111M bytes of hard disk.
12510192k bytes of disk0: (Sector size 512 bytes).
12510192k bytes of disk1: (Sector size 512 bytes).

Steps to Reproduce the Issue

from napalm import get_network_driver driver = get_network_driver('iosxr') gw = driver('device', 'user', 'pass') gw.open() gw.get_interfaces()

Error Traceback

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

In [5]: gw.get_interfaces()
---------------------------------------------------------------------------
AddrFormatError                           Traceback (most recent call last)
<ipython-input-5-e02d8754175e> in <module>()
----> 1 gw.get_interfaces()

/usr/local/lib/python2.7/site-packages/napalm_iosxr/iosxr.pyc in get_interfaces(self)
    202             is_up = (find_txt(interface_tree, 'LineState') == 'IM_STATE_UP')
    203             is_enabled = (find_txt(interface_tree, 'LineState') == 'IM_STATE_UP')
--> 204             mac_address = mac(find_txt(interface_tree, 'MACAddress/Address'))
    205             speed = int(convert(int, find_txt(interface_tree, 'Bandwidth'), 0) * 1e-3)
    206             description = find_txt(interface_tree, 'Description')

/usr/local/lib/python2.7/site-packages/napalm_base/helpers.pyc in mac(raw)
    215             zeros_stuffed='0'*(12-len(flat_raw))
    216         )
--> 217     return unicode(EUI(raw, dialect=_MACFormat))
    218
    219

/usr/local/lib/python2.7/site-packages/netaddr/eui/__init__.pyc in __init__(self, addr, version, dialect)
    385                     self._module = _eui64
    386
--> 387         self.value = addr
    388
    389         #   Choose a dialect for MAC formatting.

/usr/local/lib/python2.7/site-packages/netaddr/eui/__init__.pyc in _set_value(self, value)
    435             if self._module is None:
    436                 raise AddrFormatError('failed to detect EUI version: %r'
--> 437                     % value)
    438         else:
    439             #   EUI version is explicit.

AddrFormatError: failed to detect EUI version: u''
mirceaulinic commented 7 years ago

Thanks @wasabi222 for detailed report. As per our slack conversation, will release today napalm-iosxr 0.3.0 that will contain the changes from https://github.com/napalm-automation/napalm-iosxr/pull/48 that hopefully will cover your issue. I will ask you to confirm when done.

mirceaulinic commented 7 years ago

0.3.0 has been released: https://pypi.python.org/pypi/napalm-iosxr/0.3.0 @wasabi222 please test

wasabi222 commented 7 years ago

Confirmed working. Thank you!