Skip to content

Commit

Permalink
Bugfix: DESTINATION to list and account for Eth1/1 format - arista_eo…
Browse files Browse the repository at this point in the history
…s_show_mac_address-table.textfsm (networktocode#756)
  • Loading branch information
JoeyG1973 authored and thomasblass committed Oct 25, 2020
1 parent 107e1e2 commit b09c16c
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 29 deletions.
44 changes: 37 additions & 7 deletions templates/arista_eos_show_mac_address-table.textfsm
Original file line number Diff line number Diff line change
@@ -1,10 +1,40 @@
Value MAC_ADDRESS (\w+?\.\w+?\.\w+?|\w+?\:\w+?\:\w+?\:\w+?\:\w+?\:\w+?)
Value TYPE (\w+?)
Value VLAN (\d+?)
Value DESTINATION_PORT (\w+\s\w+\s\w+\s\w+|\w+\s\w+\s\w+|\w+\s\w+|\w+?)
Value MOVES (\d+?)
Value MAC_ADDRESS (\w+\.\w+\.\w+|\w+\:\w+\:\w+\:\w+\:\w+\:\w+)
Value TYPE (\w+)
Value VLAN (\d+)
Value List DESTINATION_PORT ((\w+\/\w+)|\w+)
Value MOVES (\d+)
Value LAST_MOVE (.+)

Start
^\s*${VLAN}\s+?${MAC_ADDRESS}\s+?${TYPE}\s+?${DESTINATION_PORT}\s+?${MOVES}\s+${LAST_MOVE}\sago$$ -> Record
^\s*${VLAN}\s+?${MAC_ADDRESS}\s+?${TYPE}\s+?${DESTINATION_PORT}$$ -> Record
^\s*Vlan\s+(M|m)ac\sAddress\s+Type\s+Ports\s+Moves\s+Last\sMove\s*$$ -> MAT
^\s*Vlan\s+(M|m)ac\sAddress\s+Type\s+Ports\s*$$ -> MMAT
^\s*$$
^\s*(M|m)ac\sAddress\sTable\s*$$
^\s*Multicast\s(M|m)ac\sAddress\sTable\s*$$
^-*$$
# ^(-*\s*)*$$
^. -> Error

MAT
# capture the mac address table
^\s*${VLAN}\s+${MAC_ADDRESS}\s+${TYPE}\s+${DESTINATION_PORT}\s*$$ -> Record
^\s*${VLAN}\s+${MAC_ADDRESS}\s+${TYPE}\s+${DESTINATION_PORT}\s+${MOVES}\s+${LAST_MOVE}\sago$$ -> Record
^\s*Total\s+mac -> Start
^\s*-+\s+.*-*$$
^\s*$$
^. -> Error

MMAT
# capture the multicast mac address table
# key on the record
^\s*\d+\s+(\w+\.\w+\.\w+|\w+\:\w+\:\w+\:\w+\:\w+\:\w+)\s+\w+\s*.*$$ -> Continue.Record
# match the record with one to five destination ports more.
^\s*${VLAN}\s+${MAC_ADDRESS}\s+${TYPE}\s+${DESTINATION_PORT}$$ -> Record
^\s*${VLAN}\s+${MAC_ADDRESS}\s+${TYPE}\s+${DESTINATION_PORT}\s -> Continue
^\s*\d+\s+(\w+\.\w+\.\w+|\w+\:\w+\:\w+\:\w+\:\w+\:\w+)\s+\w+\s+((\w+\/\w+|\w+)\s){1}${DESTINATION_PORT}\s* -> Continue
^\s*\d+\s+(\w+\.\w+\.\w+|\w+\:\w+\:\w+\:\w+\:\w+\:\w+)\s+\w+\s+((\w+\/\w+|\w+)\s){2}${DESTINATION_PORT}\s* -> Continue
^\s*\d+\s+(\w+\.\w+\.\w+|\w+\:\w+\:\w+\:\w+\:\w+\:\w+)\s+\w+\s+((\w+\/\w+|\w+)\s){3}${DESTINATION_PORT}\s* -> Continue
^\s*\d+\s+(\w+\.\w+\.\w+|\w+\:\w+\:\w+\:\w+\:\w+\:\w+)\s+\w+\s+((\w+\/\w+|\w+)\s){4}${DESTINATION_PORT}$$ -> Continue
^\s*Total\s+mac -> Start
^\s*-+\s+.*-*$$
^\s*$$
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ Total mac Addresses for this criterion: 24

Vlan mac Address Type Ports
---- ----------- ---- -----
4 0112.3057.8423 STATIC Po10 Po12
4 c867.3057.8423 STATIC Po10 Po123
42 5309.3057.8423 STATIC Po135 Po12 po5
200 jenn.3057.8423 STATIC Po66
47 4242.3057.8423 STATIC Po135 Po12 po5 eth1/1
Total mac Addresses for this criterion: 1
Original file line number Diff line number Diff line change
Expand Up @@ -3,120 +3,167 @@ parsed_sample:
- mac_address: "0012.3694.03ec"
type: "STATIC"
vlan: "3"
destination_port: "Et7"
destination_port:
- "Et7"
moves: ""
last_move: ""
- mac_address: "001c.7313.a3de"
type: "DYNAMIC"
vlan: "55"
destination_port: "Et32"
destination_port:
- "Et32"
moves: "1"
last_move: "0:08:16"
- mac_address: "001c.8224.36d7"
type: "DYNAMIC"
vlan: "101"
destination_port: "Po2"
destination_port:
- "Po2"
moves: "1"
last_move: "9 days, 15:57:28"
- mac_address: "001c.8220.1319"
type: "STATIC"
vlan: "102"
destination_port: "Po1"
destination_port:
- "Po1"
moves: ""
last_move: ""
- mac_address: "001c.8229.a0f3"
type: "DYNAMIC"
vlan: "102"
destination_port: "Po1"
destination_port:
- "Po1"
moves: "1"
last_move: "0:05:05"
- mac_address: "001c.8220.1319"
type: "STATIC"
vlan: "661"
destination_port: "Po1"
destination_port:
- "Po1"
moves: ""
last_move: ""
- mac_address: "001c.822f.6b22"
type: "DYNAMIC"
vlan: "661"
destination_port: "Po7"
destination_port:
- "Po7"
moves: "1"
last_move: "0:20:10"
- mac_address: "001c.8220.1319"
type: "STATIC"
vlan: "3000"
destination_port: "Po1"
destination_port:
- "Po1"
moves: ""
last_move: ""
- mac_address: "0050.56a8.0016"
type: "DYNAMIC"
vlan: "3000"
destination_port: "Po1"
destination_port:
- "Po1"
moves: "1"
last_move: "0:07:38"
- mac_address: "001c.8220.1319"
type: "STATIC"
vlan: "3909"
destination_port: "Po1"
destination_port:
- "Po1"
moves: ""
last_move: ""
- mac_address: "001c.822f.6a80"
type: "DYNAMIC"
vlan: "3909"
destination_port: "Po1"
destination_port:
- "Po1"
moves: "1"
last_move: "0:07:08"
- mac_address: "001c.8220.1319"
type: "STATIC"
vlan: "3911"
destination_port: "Po1"
destination_port:
- "Po1"
moves: ""
last_move: ""
- mac_address: "001c.8220.40fa"
type: "DYNAMIC"
vlan: "3911"
destination_port: "Po8"
destination_port:
- "Po8"
moves: "1"
last_move: "1:19:58"
- mac_address: "001c.822b.033e"
type: "DYNAMIC"
vlan: "3912"
destination_port: "Et11"
destination_port:
- "Et11"
moves: "1"
last_move: "9 days, 15:57:23"
- mac_address: "001c.8220.1319"
type: "STATIC"
vlan: "3913"
destination_port: "Po1"
destination_port:
- "Po1"
moves: ""
last_move: ""
- mac_address: "001c.822b.033e"
type: "DYNAMIC"
vlan: "3913"
destination_port: "Po1"
destination_port:
- "Po1"
moves: "1"
last_move: "0:04:35"
- mac_address: "001c.8220.178f"
type: "DYNAMIC"
vlan: "3984"
destination_port: "Et8"
destination_port:
- "Et8"
moves: "1"
last_move: "4 days, 15:07:29"
- mac_address: "001c.8220.1319"
type: "STATIC"
vlan: "3992"
destination_port: "Po1"
destination_port:
- "Po1"
moves: ""
last_move: ""
- mac_address: "001c.8221.07b9"
type: "DYNAMIC"
vlan: "3992"
destination_port: "Po6"
destination_port:
- "Po6"
moves: "1"
last_move: "4 days, 15:13:15"
- mac_address: "0112.3057.8423"
- mac_address: "c867.3057.8423"
type: "STATIC"
vlan: "4"
destination_port: "Po10 Po12"
destination_port:
- "Po10"
- "Po123"
moves: ""
last_move: ""
- mac_address: "5309.3057.8423"
type: "STATIC"
vlan: "42"
destination_port:
- "Po135"
- "Po12"
- "po5"
moves: ""
last_move: ""
- mac_address: "jenn.3057.8423"
type: "STATIC"
vlan: "200"
destination_port:
- "Po66"
moves: ""
last_move: ""
- mac_address: "4242.3057.8423"
type: "STATIC"
vlan: "47"
destination_port:
- "Po135"
- "Po12"
- "po5"
- "eth1/1"
moves: ""
last_move: ""

0 comments on commit b09c16c

Please sign in to comment.