Skip to content

Commit

Permalink
Enhancement: cisco_nxos_show_vlan: Added interfaces (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
FragmentedPacket authored Mar 2, 2020
1 parent c6c219e commit 319489e
Show file tree
Hide file tree
Showing 4 changed files with 241 additions and 15 deletions.
142 changes: 139 additions & 3 deletions templates/cisco_nxos_show_vlan.textfsm
Original file line number Diff line number Diff line change
@@ -1,7 +1,143 @@
Value VLAN_ID (\d+)
Value Required VLAN_ID (\d+)
Value NAME (\S+)
Value STATUS (\S+)
Value List INTERFACES ([\w\./]+)

Start
^\d+\s+enet\s+CE
^${VLAN_ID}\s+${NAME}\s+${STATUS} -> Record
^VLAN\s+Name\s+Status\s+Ports -> VLANS
^VLAN\s+Type\s+Vlan-mode
^Remote\s+SPAN\s+VLANs
^Primary\s+Secondary\s+Type\s+Ports

VLANS
^\d+ -> Continue.Record
^${VLAN_ID}\s+${NAME}\s+${STATUS}\s*$$
^${VLAN_ID}\s+${NAME}\s+${STATUS}\s+${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){3}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){4}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){5}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){6}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){7}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){8}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){9}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){10}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){11}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){12}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){13}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){14}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){15}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){16}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){17}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){18}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){19}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){20}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){21}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){22}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){23}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){24}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){25}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){26}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){27}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){28}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){29}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){30}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){31}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){32}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){33}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){34}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){35}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){36}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){37}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){38}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){39}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){40}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){41}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){42}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){43}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){44}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){45}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){46}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){47}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){48}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){49}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){50}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){51}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){52}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){53}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){54}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){55}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){56}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){57}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){58}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){59}${INTERFACES},* -> Continue
^\d+\s+(?:\S+\s+){60}${INTERFACES},* -> Continue
^\s+${INTERFACES},* -> Continue
^\s+\S+\s+${INTERFACES},* -> Continue
^\s+(?:\S+\s+){2}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){3}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){4}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){5}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){6}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){7}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){8}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){9}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){10}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){11}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){12}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){13}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){14}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){15}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){16}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){17}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){18}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){19}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){20}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){21}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){22}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){23}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){24}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){25}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){26}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){27}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){28}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){29}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){30}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){31}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){32}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){33}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){34}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){35}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){36}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){37}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){38}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){39}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){40}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){41}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){42}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){43}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){44}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){45}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){46}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){47}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){48}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){49}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){50}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){51}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){52}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){53}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){54}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){55}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){56}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){57}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){58}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){59}${INTERFACES},* -> Continue
^\s+(?:\S+\s+){60}${INTERFACES},* -> Continue
^\d+
^\s+
^-+
^\S+\s+[TtYyPpEe]{4} -> Done
^\s*$$
^. -> Error

Done
^.*
88 changes: 76 additions & 12 deletions tests/cisco_nxos/show_vlan/cisco_nxos_show_vlan.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,84 @@
---
parsed_sample:
- name: "default"
- vlan_id: "1"
name: "default"
status: "active"
vlan_id: "1"
- name: "WEB"
interfaces:
- "Eth1/2"
- "Eth1/3"
- "Eth1/4"
- "Eth1/5"
- "Eth1/6"
- "Eth1/7"
- "Eth1/8"
- "Eth1/9"
- "Eth1/10"
- "Eth1/11"
- "Eth1/12"
- "Eth1/13"
- "Eth1/14"
- "Eth1/15"
- "Eth1/16"
- "Eth1/17"
- "Eth1/18"
- "Eth1/19"
- "Eth1/20"
- "Eth1/21"
- "Eth1/22"
- "Eth1/23"
- "Eth1/24"
- "Eth1/25"
- "Eth1/26"
- "Eth1/27"
- "Eth1/28"
- "Eth1/29"
- "Eth1/30"
- "Eth1/31"
- "Eth1/32"
- "Eth1/34"
- "Eth1/35"
- "Eth1/36"
- "Eth1/37"
- "Eth1/38"
- "Eth1/39"
- "Eth1/40"
- "Eth1/41"
- "Eth1/42"
- "Eth1/43"
- "Eth1/44"
- "Eth1/45"
- "Eth1/46"
- "Eth1/47"
- "Eth1/48"
- "Eth2/1"
- "Eth2/2"
- "Eth2/3"
- "Eth2/4"
- "Eth2/5"
- "Eth2/6"
- "Eth2/7"
- "Eth2/8"
- "Eth2/9"
- "Eth2/10"
- "Eth2/11"
- vlan_id: "10"
name: "WEB"
status: "active"
vlan_id: "10"
- name: "VLAN0020"
interfaces: []
- vlan_id: "20"
name: "VLAN0020"
status: "active"
vlan_id: "20"
- name: "VLAN0030"
interfaces:
- "Eth2/12"
- vlan_id: "30"
name: "VLAN0030"
status: "active"
vlan_id: "30"
- name: "VLAN0040"
interfaces: []
- vlan_id: "40"
name: "VLAN0040"
status: "active"
vlan_id: "40"
- name: "VLAN0050"
interfaces: []
- vlan_id: "50"
name: "VLAN0050"
status: "active"
vlan_id: "50"
interfaces: []
17 changes: 17 additions & 0 deletions tests/cisco_nxos/show_vlan/cisco_nxos_show_vlan2.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Po1, Eth1/53, Eth1/54

VLAN Type Vlan-mode
---- ----- ----------
1 enet CE

Remote SPAN VLANs
-------------------------------------------------------------------------------

Primary Secondary Type Ports
------- --------- --------------- -------------------------------------------



9 changes: 9 additions & 0 deletions tests/cisco_nxos/show_vlan/cisco_nxos_show_vlan2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
parsed_sample:
- vlan_id: "1"
name: "default"
status: "active"
interfaces:
- "Po1"
- "Eth1/53"
- "Eth1/54"

0 comments on commit 319489e

Please sign in to comment.