networktocode/ntc-templates

cisco ios show mac address-table TYPE 3 - TextFSMError

Closed this issue · 1 comments

ISSUE TYPE
  • Bug Report

TEMPLATE USING

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 List 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*(\d+|-+|[Nn]/[Aa]) -> Continue.Record

using 20 spaces should ensure that lines only match destination port flowing to next line

^\s{20}\s+${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
^\s{20}\s+${DESTINATION_PORT},\s$$
^\s{20}\s+[^,\s]+(\s+|,\s*)${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
^\s{20}\s+[^,\s]+(\s+|,\s*)${DESTINATION_PORT},\s$$
^\s{20}\s+([^,\s]+(\s+|,\s*)){2}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
^\s{20}\s+([^,\s]+(\s+|,\s*)){2}${DESTINATION_PORT},\s$$
^\s{20}\s+([^,\s]+(\s+|,\s*)){3}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
^\s{20}\s+([^,\s]+(\s+|,\s*)){3}${DESTINATION_PORT},\s$$
^\s{20}\s+([^,\s]+(\s+|,\s*)){4}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
^\s{20}\s+([^,\s]+(\s+|,\s*)){4}${DESTINATION_PORT},\s$$
^\s{20}\s+([^,\s]+(\s+|,\s*)){5}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
^\s{20}\s+([^,\s]+(\s+|,\s*)){5}${DESTINATION_PORT},\s$$
^\s*(*\s+R|*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s*$$
^\s*(*\s+R|*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
^\s*(*\s+R|*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+${DESTINATION_PORT},\s$$
^\s*(*\s+R|*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+[^,\s]+(\s+|,\s*)${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
^\s*(*\s+R|*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+[^,\s]+?(\s+|,\s*)${DESTINATION_PORT},\s$$
^\s*(*\s+R|*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){2}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
^\s*(*\s+R|*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){2}${DESTINATION_PORT},\s$$
^\s*(*\s+R|*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){3}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
^\s*(*\s+R|*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){3}${DESTINATION_PORT},\s$$
^\s*(*\s+R|*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){4}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
^\s*(*\s+R|*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){4}${DESTINATION_PORT},\s$$
^\s*(*\s+R|*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){5}${DESTINATION_PORT}(\s+|,\s*)\S -> Continue
^\s*(*\s+R|*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+([^,\s]+(\s+|,\s*)){5}${DESTINATION_PORT},\s$$
^-++-+
^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}(?:\s|$$) -> 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}(?:\s|$$) -> 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

lgvl_0101-4948-acc3#show mac address-table vlan 10
Unicast Entries
vlan mac address type protocols port
-------+---------------+--------+---------------------+--------------------
10 0000.0c07.ac01 dynamic ip Port-channel25
10 0000.0c07.ac02 dynamic ip Port-channel25
10 0002.a54d.1e5a dynamic ip Port-channel25
10 0002.a54d.2120 dynamic ip,other Port-channel25
10 0002.a54d.9bca dynamic ip,other Port-channel25
10 0003.ba8c.0a0c dynamic ip Port-channel25
10 000f.203c.6451 dynamic ip Port-channel25
10 000f.203c.646a dynamic ip Port-channel25
10 0010.e046.55b4 dynamic ip Port-channel25
10 0014.4ff8.1977 dynamic ip Port-channel25
10 0014.4ff8.6781 dynamic ip Port-channel25
10 0014.4ff8.7c6b dynamic ip Port-channel25
10 0014.4ff8.8928 dynamic ip Port-channel25
10 0014.4ff8.d68e dynamic ip Port-channel25
10 0014.4ff8.dab9 dynamic ip Port-channel25
10 0014.4ff8.faa7 dynamic ip Port-channel25
10 0014.4ff9.1587 dynamic ip Port-channel25
10 0014.4ff9.15f4 dynamic ip Port-channel25
10 0014.4ff9.2044 dynamic ip Port-channel25
10 0014.4ff9.45ad dynamic ip Port-channel25
10 0014.4ff9.49a4 dynamic ip Port-channel25
10 0014.4ff9.73cf dynamic ip Port-channel25
10 0014.4ff9.7c63 dynamic ip Port-channel25
10 0014.4ff9.7da8 dynamic ip Port-channel25
10 0014.4ff9.a9f2 dynamic ip Port-channel25
10 0014.4ff9.ad31 dynamic ip Port-channel25
10 0014.4ffa.0763 dynamic ip Port-channel25
10 0014.4ffa.0b65 dynamic ip Port-channel25
10 0014.4ffa.a047 dynamic ip Port-channel25
10 0014.4ffa.a249 dynamic ip Port-channel25
10 0014.4ffa.bd15 dynamic ip Port-channel25
10 0014.4ffb.12d6 dynamic ip Port-channel25
10 0014.4ffb.7322 dynamic ip Port-channel25
10 0014.4ffb.9686 dynamic ip Port-channel25
10 0014.4ffb.9852 dynamic ip Port-channel25
10 0014.4ffb.b4fe dynamic ip Port-channel25
10 0014.4ffb.c117 dynamic ip Port-channel25
10 0014.4ffb.c673 dynamic ip Port-channel25
10 0014.4ffb.d874 dynamic ip Port-channel25
10 0014.4ffb.f7f5 dynamic ip Port-channel25
10 0014.4ffc.7319 dynamic ip Port-channel25
10 0014.4ffc.85fd dynamic ip Port-channel25
10 0014.4ffc.8b4a dynamic ip Port-channel25
10 0014.4ffc.c599 dynamic ip Port-channel25
10 0014.4ffc.cea9 dynamic ip Port-channel25
10 0014.4ffc.d7dd dynamic ip Port-channel25
10 0014.4ffc.f4e9 dynamic ip Port-channel25
10 0015.2bad.9048 dynamic ip,assigned Port-channel25
10 001a.644f.684a dynamic ip Port-channel25
10 001a.644f.6940 dynamic ip Port-channel25
10 001a.64bb.886c dynamic ip Port-channel25
10 001a.64bb.895c dynamic ip Port-channel25
10 001e.c9bb.abda dynamic ip Port-channel25
10 001f.2913.3680 dynamic ip Port-channel25
10 001f.2913.36a4 dynamic ip Port-channel25
10 0021.5ade.2ca9 dynamic ip Port-channel25
10 0026.981e.4041 dynamic ip Port-channel25
10 0026.981e.6141 dynamic ip Port-channel25
10 0026.981e.f8c1 dynamic ip Port-channel25
10 0026.9822.eac1 dynamic ip Port-channel25
10 0050.5693.17ca dynamic ip Port-channel25
10 0050.569d.efc9 dynamic ip Port-channel25
10 0050.56a0.03f5 dynamic ip Port-channel25
10 0050.56a0.088f dynamic ip Port-channel25
10 0050.56a0.0de2 dynamic ip Port-channel25
10 0050.56a0.0fc0 dynamic ip Port-channel25
10 0050.56a0.2e66 dynamic ip Port-channel25
10 0050.56a0.3078 dynamic ip Port-channel25
10 0050.56a0.3417 dynamic ip Port-channel25
10 0050.56a0.4d1a dynamic ip Port-channel25
10 0050.56a0.6173 dynamic ip Port-channel25
10 0050.56a0.62d9 dynamic ip Port-channel25
10 0050.56a0.7421 dynamic ip Port-channel25
10 0050.56a0.7488 dynamic ip Port-channel25
10 0050.56a0.7d74 dynamic ip Port-channel25
10 0050.56a0.7e91 dynamic ip Port-channel25
10 0050.56a0.a3ee dynamic ip Port-channel25
10 0050.56a0.a9ea dynamic ip Port-channel25
10 0050.56a0.aea1 dynamic ip Port-channel25
10 0050.56a0.c570 dynamic ip Port-channel25
10 0050.56a0.cc8b dynamic ip Port-channel25
10 0050.56a0.dabe dynamic ip Port-channel25
10 0050.56a0.fea0 dynamic ip Port-channel25
10 0050.56a4.0317 dynamic ip Port-channel25
10 0050.56a4.060c dynamic ip Port-channel25
10 0050.56a4.0a24 dynamic ip Port-channel25
10 0050.56a4.173a dynamic ip Port-channel25
10 0050.56a4.1b28 dynamic ip Port-channel25
10 0050.56a4.3fec dynamic ip Port-channel25
10 0050.56a4.60b6 dynamic ip Port-channel25
10 0050.56a4.631f dynamic ip Port-channel25
10 0050.56a4.6678 dynamic ip Port-channel25
10 0050.56a4.6be8 dynamic ip Port-channel25
10 0050.56a4.711b dynamic ip Port-channel25
10 0050.56a4.791f dynamic ip Port-channel25
10 0050.56a4.7e1e dynamic ip Port-channel25
10 0050.56a4.8a6b dynamic ip Port-channel25
10 0050.56a4.b0c8 dynamic ip Port-channel25
10 0050.56a4.c1bf dynamic ip Port-channel25
10 0050.56a4.da44 dynamic ip Port-channel25
10 0050.56a4.f26d dynamic ip Port-channel25
10 00d0.cf0d.92f7 dynamic ip Port-channel25
10 0800.209c.3c3c dynamic ip Port-channel25
10 0800.20d2.464d dynamic ip Port-channel25
10 0800.20fe.eb13 dynamic ip Port-channel25
10 0800.2b38.7d31 dynamic assigned,other Port-channel25
10 0894.efa2.b3a6 dynamic ip Port-channel25
10 1637.941c.c602 dynamic ip Port-channel25
10 1637.9ff2.3e06 dynamic ip Port-channel25
10 1e9b.1af3.edd8 dynamic ip,other Port-channel25
10 2c54.2df0.9a60 dynamic ip,assigned Port-channel25
10 2c76.8a5d.f5b8 dynamic ip Port-channel25
10 2ec9.7c37.7302 dynamic ip Port-channel25
10 3c13.cce9.6739 dynamic other Port-channel25
10 3c13.cce9.6d39 dynamic other Port-channel25
10 4261.2e3d.a002 dynamic ip Port-channel25
10 46b9.4e6d.104a dynamic ip Port-channel25
10 5065.f3e6.3f43 dynamic ip,ipx Port-channel25
10 56fc.a393.a602 dynamic ip Port-channel25
10 56fc.aa0d.8802 dynamic ip Port-channel25
10 5adb.d0df.d933 dynamic ip Port-channel25
10 5eca.7028.1e02 dynamic ip Port-channel25
10 5eca.737e.ee02 dynamic ip Port-channel25
10 5eca.7475.cf02 dynamic ip Port-channel25
10 5eca.74b6.0202 dynamic ip Port-channel25
10 5eca.7581.2702 dynamic ip Port-channel25
10 5eca.7599.ba02 dynamic ip Port-channel25
10 5eca.76f8.1f02 dynamic ip Port-channel25
10 5eca.77ea.7102 dynamic ip Port-channel25
10 5eca.789f.f902 dynamic ip Port-channel25
10 5eca.797f.b102 dynamic ip Port-channel25
10 5eca.7a79.9c02 dynamic ip Port-channel25
10 5eca.7afd.fa02 dynamic ip Port-channel25
10 5eca.7b38.8502 dynamic ip Port-channel25
10 5eca.7bdf.2b02 dynamic ip Port-channel25
10 5eca.7d0f.8402 dynamic ip Port-channel25
10 5edd.9168.6bbe dynamic ip Port-channel25
10 6252.8106.a802 dynamic ip Port-channel25
10 6252.8b39.2302 dynamic ip Port-channel25
10 6252.8cb6.d402 dynamic ip Port-channel25
10 62f0.3643.fe75 dynamic ip,other Port-channel25
10 6805.ca0c.909a dynamic ip Port-channel25
10 6a06.d8c8.03f6 dynamic ip,other Port-channel25
10 6cae.8b4d.4583 dynamic ip Port-channel25
10 72a2.895d.829f dynamic ip,other Port-channel25
10 84b8.02c3.b932 dynamic assigned Port-channel25
10 88f0.3151.16af dynamic ip Port-channel25
10 8e36.5e20.9e49 dynamic ip,other Port-channel25
10 906c.aca4.1d0a dynamic other Port-channel25
10 90b1.1c17.0580 dynamic ip Port-channel25
10 92fc.35bf.3a02 dynamic ip Port-channel25
10 92fc.38ad.9702 dynamic ip Port-channel25
10 92fc.3a09.c102 dynamic ip Port-channel25
10 984b.e17e.6f44 dynamic ip Port-channel25
10 9a13.8130.6cfa dynamic ip Port-channel25
10 a02b.b829.53ee dynamic ip Port-channel25
10 b026.28ef.d76d dynamic ip Port-channel25
10 b24d.e09e.5502 dynamic ip Port-channel25
10 b24d.e434.8b02 dynamic ip Port-channel25
10 b24d.e46c.3002 dynamic ip Port-channel25
10 b24d.e59e.b702 dynamic ip Port-channel25
10 b24d.e645.1702 dynamic ip Port-channel25
10 b24d.ea4e.8f02 dynamic ip Port-channel25
10 b24d.eade.8102 dynamic ip Port-channel25
10 b24d.ecf2.a802 dynamic ip Port-channel25
10 b40c.25e4.c010 dynamic ip Port-channel25
10 b40c.25e4.c044 dynamic ip Port-channel25
10 b40c.25e4.c04c dynamic ip Port-channel25
10 b40c.25e4.c050 dynamic ip Port-channel25
10 b608.6ac9.ac54 dynamic ip Port-channel25
10 be45.703c.9f02 dynamic ip Port-channel25
10 be45.706c.a202 dynamic ip Port-channel25
10 c626.1be3.9c50 dynamic ip Port-channel25
10 c8cb.b843.ab4a dynamic ip Port-channel25
10 d8d3.85f8.03ce dynamic ip,other Port-channel25
10 d8d3.85f8.03d9 dynamic ip,other Port-channel25
10 d8d3.85f8.046d dynamic ip,other Port-channel25
10 d8d3.85f8.0520 dynamic ip,other Port-channel25
10 dac6.6d57.0202 dynamic ip Port-channel25
10 e6c7.d9ea.00d1 dynamic ip Port-channel25
10 ecb1.d783.6a54 dynamic ip Port-channel25
10 f262.1850.4d02 dynamic ip Port-channel25
10 f295.54ca.7502 dynamic ip Port-channel25
10 f295.54f3.6803 dynamic ip Port-channel25
10 f295.562d.b602 dynamic ip Port-channel25
10 f295.562d.b603 dynamic ip Port-channel25
10 f295.5680.d502 dynamic ip Port-channel25
10 f295.56b9.3802 dynamic ip Port-channel25
10 f295.56cd.e302 dynamic ip Port-channel25
10 f295.59d0.df02 dynamic ip Port-channel25
10 f295.5aa1.5502 dynamic ip Port-channel25
10 f295.5b0f.4d02 dynamic ip Port-channel25
10 f295.5be1.7202 dynamic ip Port-channel25
10 f295.5f87.d102 dynamic ip Port-channel25
10 f2ac.962b.a7fd dynamic ip Port-channel25
10 f2b0.8bc6.ea23 dynamic ip Port-channel25
10 f2de.8e51.d10c dynamic ip,other Port-channel25
10 f698.e0ad.b070 dynamic ip,other Port-channel25
10 f6c1.e0d2.1c02 dynamic ip Port-channel25
10 f6c1.e0e3.dd02 dynamic ip Port-channel25

Multicast Entries
vlan mac address type ports
-------+---------------+-------+--------------------------------------------
10 ffff.ffff.ffff system Po25

SUMMARY

Run the show mac address-table command in a WS-C4948-10GE (MPC8540) IOS: 15.0(2)SG11, use the template to try to parse the output.

EXPECTED RESULTS

Parsed output.

ACTUAL RESULTS

TextFSMError raised on line 67.

This issue was fixed by downloading the lastest version of the corresponding textfsm file.