napalm-automation / napalm-ios

Apache License 2.0
31 stars 40 forks source link

Unexpected output when trying to get_mac_address_table #104

Closed kaage closed 7 years ago

kaage commented 7 years ago

Description of Issue/Question

Got following error when trying to collect MAC-address table from IOSvL2 switch.

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

Setup

This is sample output of MAC-address table in my device:

SW10>show mac address-table
          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----
   1    0000.0c07.ac01    DYNAMIC     Gi0/1
   1    00ed.a02d.0500    DYNAMIC     Gi2/0
   1    00ed.a053.2900    DYNAMIC     Gi0/1
   1    00ed.a0af.5f00    DYNAMIC     Gi0/0
  10    0000.0c07.ac0a    DYNAMIC     Gi0/1
  10    00ed.a0af.5f00    DYNAMIC     Gi0/0
Total Mac Addresses for this criterion: 

napalm-ios version

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

vagrant@nms:/vagrant/NetAutomation_materials/Week2-assignments$ pip freeze | grep napalm-ios
napalm-ios==0.5.1
napalm-iosxr==0.4.6

IOS version

(Paste verbatim output from show version between quotes below)

SW10>show version
Cisco IOS Software, vios_l2 Software (vios_l2-ADVENTERPRISEK9-M), Version 15.2(4.0.55)E, TEST ENGINEERING ESTG_WEEKLY BUILD, synced to  END_OF_FLO_ISP
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2015 by Cisco Systems, Inc.
Compiled Tue 28-Jul-15 18:52 by sasyamal

ROM: Bootstrap program is IOSv

SW10 uptime is 1 hour, 16 minutes
System returned to ROM by reload
System image file is "flash0:/vios_l2-adventerprisek9-m"
Last reload reason: Unknown reason

This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

Cisco IOSv () processor (revision 1.0) with 574721K/209920K bytes of memory.
Processor board ID 9KILRPRXXGI
1 Virtual Ethernet interface
16 Gigabit Ethernet interfaces
DRAM configuration is 72 bits wide with parity disabled.
256K bytes of non-volatile configuration memory.
2097144K bytes of ATA System CompactFlash 0 (Read/Write)
0K bytes of ATA CompactFlash 1 (Read/Write)
0K bytes of ATA CompactFlash 2 (Read/Write)
0K bytes of ATA CompactFlash 3 (Read/Write)

Configuration register is 0x0

Steps to Reproduce the Issue

vagrant@nms:/vagrant/NetAutomation_materials/Week2-assignments$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from netmiko import ConnectHandler
>>> from napalm import get_network_driver
>>> get_network_driver('ios')
<class 'napalm_ios.ios.IOSDriver'>
>>> driver = get_network_driver('ios')
>>> device = driver('10.255.100.10', 'cisco', 'cisco')
>>> device.open()

>>> device.get_mac_address_table()

Error Traceback

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

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/napalm_ios/ios.py", line 1429, in get_mac_address_table
    raise ValueError("Unexpected output from: {}".format(repr(line)))
ValueError: Unexpected output from: u'Total Mac Addresses for this criterion: 6'
ktbyers commented 7 years ago

@kaage Test against the napalm-ios develop branch. This issue should be fixed.

Thanks.

kaage commented 7 years ago

I can confirm it works in development version!