Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cisco Mac address-table template issue #951

Closed
hmolles opened this issue Jul 7, 2021 · 3 comments
Closed

Cisco Mac address-table template issue #951

hmolles opened this issue Jul 7, 2021 · 3 comments

Comments

@hmolles
Copy link

hmolles commented Jul 7, 2021

ISSUE TYPE
  • Bug Report
TEMPLATE USING

cisco_ios show Mac address-table

Value DESTINATION_ADDRESS ([0-9a-fA-F]{4}\.[0-9a-fA-F]{4}\.[0-9a-fA-F]{4})
Value TYPE (\S+)
Value VLAN (\S+)
Value DESTINATION_PORT (\S+)

Start
  ^Destination\s+Address\s+Address\s+Type\s+VLAN\s+Destination\s+Port -> TYPE1
  ^\s+vlan\s+mac address\s+type\s+learn\s+age\s+ports -> TYPE2
  ^\s+vlan\s+mac address\s+type\s+protocols\s+port -> TYPE3
  ^Vlan\s+Mac Address\s+Type\s+Ports -> TYPE4
  # Capture time-stamp if vty line has command time-stamping turned on
  ^Load\s+for\s+
  ^Time\s+source\s+is

TYPE1
  ^${DESTINATION_ADDRESS}\s+${TYPE}\s+${VLAN}\s+${DESTINATION_PORT} -> Record
  ^-+\s+-+
  ^Displaying\s+entries
  ^Destination\s+Address\s+Address\s+Type\s+VLAN\s+Destination\s+Port
  ^\s*$$
  ^Multicast\s+Entries -> End
  ^. -> Error

TYPE2
  # Order of the group in brackets here matters
  ^\s*(?:\*\s+R|\*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+${DESTINATION_PORT} -> Record
  ^-+\+-+
  ^Displaying\s+entries
  ^\s+vlan\s+mac address\s+type\s+learn\s+age\s+ports
  ^\s*$$
  ^Multicast\s+Entries -> End
  ^. -> Error

TYPE3
  ^\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+${DESTINATION_PORT} -> Record
  ^-+\+-+
  ^Displaying\s+entries
  ^\s+vlan\s+mac address\s+type\s+protocols\s+port
  ^\s*$$
  ^Multicast\s+Entries -> End
  ^. -> Error

TYPE4
  ^\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+${DESTINATION_PORT} -> Record
  ^-+\s+-+
  ^Displaying\s+entries
  ^Vlan\s+Mac Address\s+Type\s+Ports
  ^\s*$$
  ^Total\s+Mac\s+Addresses
  ^MultiCast\s+Entries -> End
  ^. -> Error
SAMPLE COMMAND OUTPUT
Legend: * - primary entry
        age - seconds since last seen
        n/a - not available

  vlan   mac address     type    learn     age              ports
------+----------------+--------+-----+----------+--------------------------
   204  e089.9dfb.1bb7    static  Yes          -   Gi1/26
   204  0023.339c.6618    static  Yes          -   Gi2/12
*  160  accc.8e0e.e208   dynamic  Yes          0   Po1
*  228  7664.5406.8d07   dynamic  Yes         85   Po1
   204  0023.339b.b06f    static  Yes          -   Gi1/11
*  160  accc.8e0e.e209   dynamic  Yes          0   Po1
*  160  3333.0000.0016    static  Yes          -   Switch
*  170  3333.0000.0016    static  Yes          -   Switch
*  180  3333.0000.0016    static  Yes          -   Switch
*  181  3333.0000.0016    static  Yes          -   Switch
*  182  3333.0000.0016    static  Yes          -   Switch
*  183  3333.0000.0016    static  Yes          -   Switch
*  184  3333.0000.0016    static  Yes          -   Switch
*  185  3333.0000.0016    static  Yes          -   Switch
*  186  3333.0000.0016    static  Yes          -   Switch
*  189  3333.0000.0016    static  Yes          -   Switch
   182  f439.09d9.d10c    static  Yes          -   Gi1/3
*  228  aef1.9127.f678   dynamic  Yes        100   Po1
*  147  3333.0000.0016    static  Yes          -   Switch
*  150  3333.0000.0016    static  Yes          -   Switch
*  155  3333.0000.0016    static  Yes          -   Switch
*  181  6805.ca08.828b   dynamic  Yes          0   Gi3/26
*  184  c400.ad03.c0b6   dynamic  Yes          5   Gi7/16
*  200  1062.e54c.6412    static  Yes          -   Gi2/15
   185  f439.09d9.527b    static  Yes          -   Gi1/44
*  184  0015.5d02.0233   dynamic  Yes         15   Po1
*  238  9c7b.ef2d.6da5   dynamic  Yes          5   Gi3/45
*  150  80c1.6e6f.88f8   dynamic  Yes        110   Po1
*  189  0100.5e02.7ffe    static  Yes          -   
   182  f439.09d9.f255    static  Yes          -   Gi2/14
*  304  3333.0000.0016    static  Yes          -   Switch
*  150  0026.55ee.fa8d   dynamic  Yes        245   Po1
   204  0023.339b.a930    static  Yes          -   Gi1/23
*  284  3333.0000.0016    static  Yes          -   Switch
   182  f439.09d9.f254    static  Yes          -   Gi3/43
*  150  00a2.89b2.86fd   dynamic  Yes         70   Po1
*  228  c048.e61e.333e   dynamic  Yes          0   Po1
SUMMARY

The Cisco show Mac address-table template appears to fail when there is a line of the Mac address-table that does not have anything in the ports column.

I have verified this on multiple computers running the latest version of the template and it appears to fail every time.

STEPS TO REPRODUCE
import netmiko 

device = ConnectHandler(device_type='cisco_ios', ip=ip, username=username, password=password)
mac_table = device.send_command("show mac address-table", use_textfsm=True)

EXPECTED RESULTS

I hoped to be able to parse the output of show Mac address-table.

ACTUAL RESULTS
State Error raised. Rule Line: 32. Input Line: *  189  0100.5e02.7ffe    static  Yes          -   
@romanstech
Copy link

Yes, I have the same issue so I started using show mac address-table dynamic command and it works ok. We don't usr static MAC so it's ok for me.

@mjbear
Copy link
Contributor

mjbear commented Jul 22, 2024

This may have been fixed in PR #1006

@hmolles @romanstech
Would you be willing to test on live gear and report back?

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants