napalm-automation / napalm-ios

Apache License 2.0
31 stars 40 forks source link

Issue with get_mac_address_table() on some devices #77

Closed ogenstad closed 7 years ago

ogenstad commented 7 years ago

Description of Issue/Question

The function uses show mac-address-table to get mac addresses. For some IOS devices the show mac address-table command is used.

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

Setup

napalm-ios version

napalm-ios==0.4.0

IOS version

(Paste verbatim output from show version between quotes below)

Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 15.0(2)SE4, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2013 by Cisco Systems, Inc.
Compiled Wed 26-Jun-13 02:49 by prod_rel_team

Steps to Reproduce the Issue

Error Traceback

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

>>> device.open()
>>> a = device.get_mac_address_table()
>>> a
[]
>>>

A solution could be to issue show mac-address-table and look for an error and then execute the other command instead.

NS2903-ASW-01#show mac-address-table
                      ^
% Invalid input detected at '^' marker.

NS2903-ASW-01#show mac address-table
          Mac Address Table
-------------------------------------------

Vlan    Mac Address       Type        Ports
----    -----------       --------    -----
 All    0100.0ccc.cccc    STATIC      CPU
 All    0100.0ccc.cccd    STATIC      CPU
 All    0180.c200.0000    STATIC      CPU
 All    0180.c200.0001    STATIC      CPU
 All    0180.c200.0002    STATIC      CPU
 All    0180.c200.0003    STATIC      CPU
<etc>
tyler-8 commented 7 years ago

I don't have a IOS 15.X switch to test on, but I can say for certain that my IOS 12.X switch uses show mac address-table and my IOS 15.X router uses show mac-address-table

ktbyers commented 7 years ago

I will try to fix this next week (Dec 5 - Dec 9)

ogenstad commented 7 years ago

From my point of view this was just something I noticed while creating #75, I don't have any urgent need for this.

However due to the issues we talked about in the chat it would probably be better to wait to fix this until #75 has been merged. That way it will be easier to spot potential issues.