napalm-automation / napalm-ios

Apache License 2.0
31 stars 40 forks source link

Multivalue port entries in 4500 mac address table cause get mac address to fail #127

Closed piter50 closed 7 years ago

piter50 commented 7 years ago

Description of Issue/Question

on Cisco IOS 4500 routers, when running net.mac, the output when containing multi-value port fields (comma separated values), causes the process to fail.

Unicast Entries
 vlan   mac address     type        protocols               port
-------+---------------+--------+---------------------+--------------------
   1    0000.0c07.ac01   dynamic ip                    Port-channel21
   1    0011.21e4.8710   dynamic ip,assigned,other     Port-channel21
   1    0012.daf7.0cff    static ip,ipx,assigned,other Switch
   1    0017.9415.eec0   dynamic ip,assigned           Port-channel21
   1    001b.1700.0111   dynamic ip                    Port-channel21
   1    001c.b1e8.e104   dynamic other                 Port-channel21
   1    001c.b1e8.e105   dynamic other                 Port-channel21
   1    001c.b1e8.e106   dynamic other                 Port-channel21
   1    001c.b1e8.e140   dynamic ip                    Port-channel21
   1    001c.f955.cec0   dynamic ip                    Port-channel21
  11    0000.0c07.ac0b   dynamic ip                    Port-channel21
  11    0004.f2fe.7f95    static ip,ipx,assigned,other GigabitEthernet3/15
  11    0004.f2fe.82da    static ip,ipx,assigned,other GigabitEthernet2/47

Multicast Entries
 vlan    mac address     type    ports
-------+---------------+-------+--------------------------------------------
   1    0100.0ccc.ccce   system Po21
   1    ffff.ffff.ffff   system Switch,Po21
  11    ffff.ffff.ffff   system Gi2/4,Gi2/5,Gi2/8,Gi2/11,Gi2/12,Gi2/13,Gi2/19
                                Gi2/23,Gi2/25,Gi2/31,Gi2/33,Gi2/36,Gi2/39
                                Gi2/41,Gi2/42,Gi2/43,Gi2/47,Gi3/10,Gi3/15
  24    ffff.ffff.ffff   system Po21
  27    ffff.ffff.ffff   system Gi3/30,Po21

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

Setup

napalm-ios version

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

napalm-ios==0.6.1
napalm-iosxr==0.4.8

IOS version

(Paste verbatim output from show version between quotes below)

Load for five secs: 36%/0%; one minute: 36%; five minutes: 36%
Time source is NTP, 09:26:44.432 EDT Fri Mar 17 2017
Cisco IOS Software, Catalyst 4500 L3 Switch Software (cat4500-ENTSERVICESK9-M), Version 12.2(52)SG, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2009 by Cisco Systems, Inc.
Compiled Tue 12-May-09 14:57 by prod_rel_team
Image text-base: 0x10000000, data-base: 0x1209A248

ROM: 12.2(31r)SGA1
Dagobah Revision 226, Swamp Revision 32

switch uptime is 5 years, 42 weeks, 1 day, 21 hours, 41 minutes
System returned to ROM by power-on
System restarted at 13:14:56 EDT Fri May 27 2011
System image file is "bootflash:cat4500-entservicesk9-mz.122-52.SG.bin"

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 WS-C4506 (MPC8245) processor (revision 14) with 524288K bytes of memory.
Processor board ID FOX0902088B
MPC8245 CPU at 333Mhz, Supervisor IV
Last reset from PowerUp
3 Virtual Ethernet interfaces
242 Gigabit Ethernet interfaces
403K bytes of non-volatile configuration memory.

Configuration register is 0x2101

Steps to Reproduce the Issue

Run net.mac on 4500 device

Error Traceback

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

switch:
    ----------
    comment:
        Cannot execute "get_mac_address_table" on switch as user. Reason: Unexpected output from: u'Gi2/23,Gi2/25,Gi2/31,Gi2/33,Gi2/36,Gi2/39'!
    out:
        ----------
    result:
        False
    traceback:
        Traceback (most recent call last):
          File "/var/cache/salt/minion/extmods/proxy/napalm.py", line 284, in call
            out = getattr(NETWORK_DEVICE.get('DRIVER'), method)(**params)  # calls the method with the specified parameters
          File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/napalm_ios/ios.py", line 1594, in get_mac_address_table
            raise ValueError("Unexpected output from: {}".format(repr(line)))
        ValueError: Unexpected output from: u'Gi2/23,Gi2/25,Gi2/31,Gi2/33,Gi2/36,Gi2/39'