Skip to content

Commit

Permalink
Merge pull request #994 from networktocode/cisco-ios-show-mac-fix-type2
Browse files Browse the repository at this point in the history
Fix ios_mac-addr type2
  • Loading branch information
armartirosyan authored Sep 22, 2021
2 parents 04200cd + 4440800 commit d66de9f
Show file tree
Hide file tree
Showing 12 changed files with 341 additions and 169 deletions.
31 changes: 25 additions & 6 deletions ntc_templates/templates/cisco_ios_show_mac-address-table.textfsm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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+)
Value List DESTINATION_PORT (\S+?)

Start
^Destination\s+Address\s+Address\s+Type\s+VLAN\s+Destination\s+Port -> TYPE1
Expand All @@ -13,7 +13,7 @@ Start
^Time\s+source\s+is

TYPE1
^${DESTINATION_ADDRESS}\s+${TYPE}\s+${VLAN}\s+${DESTINATION_PORT} -> Record
^${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
Expand All @@ -23,16 +23,35 @@ TYPE1

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
^\s*(?:\*\s+R|\*|R|\s)\s*(?:\d+|-+) -> Continue.Record
^\s*(?:\*\s+R|\*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s*$$ -> Continue
^\s*(?:\*\s+R|\*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+(?!\S+?,)${DESTINATION_PORT}\s*$$ -> Continue
^\s*(?:\*\s+R|\*|R|\s)\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+${DESTINATION_PORT}, -> Continue
^\s*(?:\*\s+R|\*|R|\s)\s*(?:\d+|-+)\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+\S+?,${DESTINATION_PORT}, -> Continue
^\s*(?:\*\s+R|\*|R|\s)\s*(?:\d+|-+)\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+(?:\S+?,){2}${DESTINATION_PORT}, -> Continue
^\s*(?:\*\s+R|\*|R|\s)\s*(?:\d+|-+)\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+(?:\S+?,){3}${DESTINATION_PORT}(?:,|$$) -> Continue
^\s*(?:\*\s+R|\*|R|\s)\s*(?:\d+|-+)\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+(?:\S+?,){4}${DESTINATION_PORT}(?:,|$$) -> Continue
^\s*(?:\*\s+R|\*|R|\s)\s*(?:\d+|-+)\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+(?:\S+?,){5}${DESTINATION_PORT}(?:,|$$) -> Continue
^\s*(?:\*\s+R|\*|R|\s)\s*(?:\d+|-+)\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+(?:\S+?,){6}${DESTINATION_PORT}(?:,|$$) -> Continue
^\s*(?:\*\s+R|\*|R|\s)\s*(?:\d+|-+)\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+\S+\s+(?:\S+?,){7}${DESTINATION_PORT}(?:,|$$) -> Continue
^\s{20}\s+${DESTINATION_PORT}, -> Continue
^\s{20}\s+(?:\S+?,)${DESTINATION_PORT}, -> Continue
^\s{20}\s+(?:\S+?,){2}${DESTINATION_PORT}, -> Continue
^\s{20}\s+(?:\S+?,){3}${DESTINATION_PORT}(?:,|$$) -> Continue
^\s{20}\s+(?:\S+?,){4}${DESTINATION_PORT}(?:,|$$) -> Continue
^\s{20}\s+(?:\S+?,){5}${DESTINATION_PORT}(?:,|$$) -> Continue
^\s{20}\s+(?:\S+?,){6}${DESTINATION_PORT}(?:,|$$) -> Continue
^\s{20}\s+(?:\S+?,){7}${DESTINATION_PORT}(?:,|$$) -> Continue
^-+\+-+
^Displaying\s+entries
^\s+vlan\s+mac address\s+type\s+learn\s+age\s+ports
^\s*$$
^\s*\S+
^Multicast\s+Entries -> End
^. -> Error

TYPE3
^\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+\S+\s+${DESTINATION_PORT} -> Record
^\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
Expand All @@ -41,11 +60,11 @@ TYPE3
^. -> Error

TYPE4
^\s*${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+${DESTINATION_PORT} -> Record
^\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
^. -> Error
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,45 @@ parsed_sample:
- destination_address: "0010.0de0.e289"
type: "Dynamic"
vlan: "1"
destination_port: "FastEthernet0/1"
destination_port:
- "FastEthernet0/1"
- destination_address: "0010.7b00.1540"
type: "Dynamic"
vlan: "2"
destination_port: "FastEthernet0/5"
destination_port:
- "FastEthernet0/5"
- destination_address: "0010.7b00.1545"
type: "Dynamic"
vlan: "2"
destination_port: "FastEthernet0/5"
destination_port:
- "FastEthernet0/5"
- destination_address: "0060.5cf4.0076"
type: "Dynamic"
vlan: "1"
destination_port: "FastEthernet0/1"
destination_port:
- "FastEthernet0/1"
- destination_address: "0060.5cf4.0077"
type: "Dynamic"
vlan: "1"
destination_port: "FastEthernet0/1"
destination_port:
- "FastEthernet0/1"
- destination_address: "0060.5cf4.1315"
type: "Dynamic"
vlan: "1"
destination_port: "FastEthernet0/1"
destination_port:
- "FastEthernet0/1"
- destination_address: "0060.70cb.f301"
type: "Dynamic"
vlan: "1"
destination_port: "FastEthernet0/1"
destination_port:
- "FastEthernet0/1"
- destination_address: "00e0.1e42.9978"
type: "Dynamic"
vlan: "1"
destination_port: "FastEthernet0/1"
destination_port:
- "FastEthernet0/1"
- destination_address: "00e0.1e9f.3900"
type: "Dynamic"
vlan: "1"
destination_port: "FastEthernet0/1"
destination_port:
- "FastEthernet0/1"
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,45 @@ parsed_sample:
- destination_address: "30a3.30a3.a1c3"
type: "dynamic"
vlan: "666"
destination_port: "Te1/30"
destination_port:
- "Te1/30"
- destination_address: "30a3.30a3.5ab8"
type: "dynamic"
vlan: "666"
destination_port: "Po3"
destination_port:
- "Po3"
- destination_address: "30a3.30a3.4d54"
type: "dynamic"
vlan: "60"
destination_port: "Te1/21"
destination_port:
- "Te1/21"
- destination_address: "0000.30a3.0167"
type: "static"
vlan: "777"
destination_port: "Router"
destination_port:
- "Router"
- destination_address: "30a3.30a3.58b5"
type: "dynamic"
vlan: "664"
destination_port: "Po6"
destination_port:
- "Po6"
- destination_address: "30a3.30a3.daf5"
type: "dynamic"
vlan: "667"
destination_port: "Te3/20"
destination_port:
- "Te3/20"
- destination_address: "30a3.30a3.e401"
type: "dynamic"
vlan: "668"
destination_port: "Po6"
destination_port:
- "Po6"
- destination_address: "30a3.30a3.5a22"
type: "dynamic"
vlan: "669"
destination_port: "Te3/20"
destination_port:
- "Te3/20"
- destination_address: "30a3.30a3.5a22"
type: "dynamic"
vlan: "2000"
destination_port: "Te3/20"
destination_port:
- "Te3/20"
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,45 @@ parsed_sample:
- destination_address: "30a3.30a3.a1c3"
type: "dynamic"
vlan: "1"
destination_port: "Port-channel1"
destination_port:
- "Port-channel1"
- destination_address: "30a3.30a3.a1c4"
type: "dynamic"
vlan: "99"
destination_port: "Port-channel1"
destination_port:
- "Port-channel1"
- destination_address: "30a3.30a3.a1c5"
type: "dynamic"
vlan: "99"
destination_port: "Port-channel1"
destination_port:
- "Port-channel1"
- destination_address: "30a3.30a3.a1c6"
type: "dynamic"
vlan: "99"
destination_port: "Port-channel1"
destination_port:
- "Port-channel1"
- destination_address: "30a3.30a3.a1c7"
type: "dynamic"
vlan: "99"
destination_port: "Port-channel1"
destination_port:
- "Port-channel1"
- destination_address: "30a3.30a3.a1c8"
type: "dynamic"
vlan: "99"
destination_port: "Port-channel1"
destination_port:
- "Port-channel1"
- destination_address: "30a3.30a3.a1c9"
type: "dynamic"
vlan: "99"
destination_port: "Port-channel1"
destination_port:
- "Port-channel1"
- destination_address: "30a3.30a3.a1ca"
type: "dynamic"
vlan: "99"
destination_port: "Port-channel1"
destination_port:
- "Port-channel1"
- destination_address: "30a3.30a3.a1ca"
type: "dynamic"
vlan: "2000"
destination_port: "Port-channel1"
destination_port:
- "Port-channel1"
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,85 @@ parsed_sample:
- destination_address: "0100.0ccc.cccc"
type: "STATIC"
vlan: "All"
destination_port: "CPU"
destination_port:
- "CPU"
- destination_address: "0100.0ccc.cccd"
type: "STATIC"
vlan: "All"
destination_port: "CPU"
destination_port:
- "CPU"
- destination_address: "0100.0ccc.ccce"
type: "STATIC"
vlan: "All"
destination_port: "CPU"
destination_port:
- "CPU"
- destination_address: "0180.c200.0000"
type: "STATIC"
vlan: "All"
destination_port: "CPU"
destination_port:
- "CPU"
- destination_address: "0180.c200.0001"
type: "STATIC"
vlan: "All"
destination_port: "CPU"
destination_port:
- "CPU"
- destination_address: "30a3.30a3.a1c3"
type: "DYNAMIC"
vlan: "1"
destination_port: "Po1"
destination_port:
- "Po1"
- destination_address: "30a3.30a3.a1c4"
type: "DYNAMIC"
vlan: "1"
destination_port: "Po1"
destination_port:
- "Po1"
- destination_address: "30a3.30a3.a1c5"
type: "DYNAMIC"
vlan: "1"
destination_port: "Po1"
destination_port:
- "Po1"
- destination_address: "30a3.30a3.a1c6"
type: "DYNAMIC"
vlan: "1"
destination_port: "Po1"
destination_port:
- "Po1"
- destination_address: "30a3.30a3.a1c7"
type: "DYNAMIC"
vlan: "1"
destination_port: "Te1/1/3"
destination_port:
- "Te1/1/3"
- destination_address: "30a3.30a3.a1c8"
type: "DYNAMIC"
vlan: "99"
destination_port: "Te1/1/3"
destination_port:
- "Te1/1/3"
- destination_address: "30a3.30a3.a1c9"
type: "DYNAMIC"
vlan: "99"
destination_port: "Te1/1/3"
destination_port:
- "Te1/1/3"
- destination_address: "30a3.30a3.a1ca"
type: "DYNAMIC"
vlan: "99"
destination_port: "Te1/1/3"
destination_port:
- "Te1/1/3"
- destination_address: "30a3.30a3.a1cb"
type: "DYNAMIC"
vlan: "99"
destination_port: "Te1/1/3"
destination_port:
- "Te1/1/3"
- destination_address: "30a3.30a3.a1cc"
type: "STATIC"
vlan: "99"
destination_port: "Vl99"
destination_port:
- "Vl99"
- destination_address: "30a3.30a3.a1cd"
type: "DYNAMIC"
vlan: "99"
destination_port: "Po6"
destination_port:
- "Po6"
- destination_address: "30a3.30a3.a1cd"
type: "DYNAMIC"
vlan: "2000"
destination_port: "Po6"
destination_port:
- "Po6"
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,50 @@ parsed_sample:
- destination_address: "009e.1ead.eadd"
type: "dynamic"
vlan: "420"
destination_port: "Po140"
destination_port:
- "Po140"
- destination_address: "009e.1ead.eadd"
type: "dynamic"
vlan: "420"
destination_port: "Po140"
destination_port:
- "Po140"
- destination_address: "009e.1ead.eadd"
type: "dynamic"
vlan: "420"
destination_port: "Po140"
destination_port:
- "Po140"
- destination_address: "009e.1ead.eadd"
type: "dynamic"
vlan: "420"
destination_port: "Po140"
destination_port:
- "Po140"
- destination_address: "009e.1ead.eadd"
type: "dynamic"
vlan: "420"
destination_port: "Po140"
destination_port:
- "Po140"
- destination_address: "009e.1ead.eadd"
type: "dynamic"
vlan: "420"
destination_port: "Po140"
destination_port:
- "Po140"
- destination_address: "009e.1ead.eadd"
type: "dynamic"
vlan: "420"
destination_port: "Po140"
destination_port:
- "Po140"
- destination_address: "009e.1ead.eadd"
type: "dynamic"
vlan: "420"
destination_port: "Po140"
destination_port:
- "Po140"
- destination_address: "009e.1ead.eadd"
type: "dynamic"
vlan: "420"
destination_port: "Po140"
destination_port:
- "Po140"
- destination_address: "009e.1ead.eadd"
type: "dynamic"
vlan: "420"
destination_port: "Po140"
destination_port:
- "Po140"
Loading

0 comments on commit d66de9f

Please sign in to comment.