Skip to content

Commit

Permalink
Bugfix: cisco_ios_show_interfaces_status - Capture FC lines (#839)
Browse files Browse the repository at this point in the history
  • Loading branch information
diepes authored Dec 6, 2020
1 parent e886209 commit 22c37cb
Show file tree
Hide file tree
Showing 4 changed files with 183 additions and 4 deletions.
18 changes: 14 additions & 4 deletions templates/cisco_ios_show_interfaces_status.textfsm
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
Value PORT (\S+)
Value NAME (.+?)
Value STATUS (err-disabled|disabled|connected|notconnect|inactive)
Value STATUS (err-disabled|disabled|connected|notconnect|inactive|up|down)
Value VLAN (\S+)
Value DUPLEX (\S+)
Value SPEED (\S+)
Value TYPE (.*)
Value FC_MODE (\S+)

Start
^Port -> Begin
# Capture time-stamp if vty line has command time-stamping turned on
^Load\s+for\s+
# Capture time-stamp if vty line has command time-stamping turned on
^Time\s+source\s+is
^-+\s*$$
^Port\s+Name\s+Status\s+Vlan\s+Duplex\s+Speed\s+Type -> Interfaces
^\s*$$
^. -> Error

Begin
Interfaces
#Match fc...
^\s*${PORT}\s+is\s+${STATUS}\s+Port\s+mode\s+is\s+${FC_MODE}\s*$$ -> Record
^\s*${PORT}\s+is\s+${STATUS}\s+\(${TYPE}\)\s*$$ -> Record
^\s*${PORT}\s+${STATUS}\s+${VLAN}\s+${DUPLEX}\s+${SPEED}\s*${TYPE}$$ -> Record
^\s*${PORT}\s+${NAME}\s+${STATUS}\s+${VLAN}\s+${DUPLEX}\s+${SPEED}\s*${TYPE}$$ -> Record
^-+
^\s*$$
^. -> Error
Original file line number Diff line number Diff line change
Expand Up @@ -7,129 +7,148 @@ parsed_sample:
duplex: "auto"
speed: "auto"
type: "10/100/1000BaseTX"
fc_mode: ""
- port: "Gi1/0/2"
name: "AccessPoint"
status: "connected"
vlan: "8"
duplex: "a-full"
speed: "a-1000"
type: "10/100/1000BaseTX"
fc_mode: ""
- port: "Gi1/0/3"
name: "John's Office"
status: "notconnect"
vlan: "1"
duplex: "auto"
speed: "auto"
type: "10/100/1000BaseTX"
fc_mode: ""
- port: "Gi1/0/4"
name: "SingleName"
status: "connected"
vlan: "1"
duplex: "a-full"
speed: "a-100"
type: "10/100/1000BaseTX"
fc_mode: ""
- port: "Gi1/0/5"
name: "Dashed-Name"
status: "connected"
vlan: "1000"
duplex: "a-full"
speed: "a-1000"
type: "10/100/1000BaseTX"
fc_mode: ""
- port: "Gi1/0/6"
name: "Spaced Example"
status: "connected"
vlan: "8"
duplex: "a-full"
speed: "a-100"
type: "10/100/1000BaseTX"
fc_mode: ""
- port: "Gi1/0/7"
name: "Trunk Example"
status: "connected"
vlan: "trunk"
duplex: "a-full"
speed: "a-1000"
type: "1000BaseSX SFP"
fc_mode: ""
- port: "Gi1/0/8"
name: "SFP Not Present"
status: "notconnect"
vlan: "1"
duplex: "auto"
speed: "auto"
type: "Not Present"
fc_mode: ""
- port: "Gi1/0/9"
name: "SFP Not Present"
status: "notconnect"
vlan: "1"
duplex: "auto"
speed: "auto"
type: "Not Present"
fc_mode: ""
- port: "Gi1/0/10"
name: "Management"
status: "notconnect"
vlan: "routed"
duplex: "auto"
speed: "auto"
type: "10/100BaseTX"
fc_mode: ""
- port: "Gi1/0/11"
name: "2960S Port"
status: "notconnect"
vlan: "16"
duplex: "a-half"
speed: "auto"
type: "10/100BaseTX"
fc_mode: ""
- port: "Gi1/0/12"
name: "Half Duplex 2950"
status: "notconnect"
vlan: "16"
duplex: "a-half"
speed: "auto"
type: "10/100BaseTX"
fc_mode: ""
- port: "Gi1/0/13"
name: "Half Duplex 2950-S"
status: "notconnect"
vlan: "16"
duplex: "a-half"
speed: "auto"
type: "10/100BaseTX"
fc_mode: ""
- port: "Gi1/0/14"
name: "Half Duplex 2950-S"
status: "notconnect"
vlan: "16"
duplex: "a-half"
speed: "auto"
type: "Not Present"
fc_mode: ""
- port: "Gi1/0/15"
name: "Multi Space to the"
status: "notconnect"
vlan: "16"
duplex: "a-half"
speed: "auto"
type: "10/100BaseTX"
fc_mode: ""
- port: "Gi1/0/16"
name: "Multi Space to the"
status: "err-disabled"
vlan: "16"
duplex: "a-half"
speed: "auto"
type: "10/100BaseTX"
fc_mode: ""
- port: "Gi1/0/17"
name: "Multi Space"
status: "disabled"
vlan: "16"
duplex: "a-half"
speed: "auto"
type: "10/100BaseTX"
fc_mode: ""
- port: "Fa1/6"
name: "test"
status: "notconnect"
vlan: "1"
duplex: "auto"
speed: "auto"
type: "10/100BaseTX"
fc_mode: ""
- port: "Po1"
name: "ethchl"
status: "connected"
vlan: "trunk"
duplex: "a-full"
speed: "a-1000"
type: ""
fc_mode: ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

--------------------------------------------------------------------------------
Port Name Status Vlan Duplex Speed Type
--------------------------------------------------------------------------------
fc2/1 is up Port mode is NP
fc2/2 is up Port mode is NP
fc2/3 is up Port mode is NP
fc2/4 is up Port mode is NP
fc2/5 is down (SFP not present)
fc2/6 is down (SFP not present)
Eth1/1 XXXXXXX1_bond1_Act connected 111 full 1000 SFP-1000BAS
Eth1/2 XXXXXXX3_bond1_Act connected 112 full 1000 SFP-1000BAS
Eth1/3 YYYYYYYY1_ha1 connected 115 full 1000 SFP-1000BAS
Eth1/4 ZZZZZZZZZZZZZ1_tru connected trunk full 10G 10Gbase-SR
Eth1/5 ZZZZZZZZZZZZZ1_tru connected trunk full 10G 10Gbase-SR
Eth1/6 AAAAAAAAA1_po2 connected trunk full 1000 SFP-1000BAS
Eth1/7 BBBBBBBB10-1 connected 4093 full 10G Fabric Exte
Eth1/8 BBBBBBBB10-1 connected 4093 full 10G Fabric Exte
Eth1/9 BBBBBBBB11-1 connected 4093 full 10G Fabric Exte
Eth1/10 BBBBBBBB11-1 connected 4093 full 10G Fabric Exte
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
parsed_sample:
- port: "fc2/1"
name: ""
status: "up"
vlan: ""
duplex: ""
speed: ""
type: ""
fc_mode: "NP"
- port: "fc2/2"
name: ""
status: "up"
vlan: ""
duplex: ""
speed: ""
type: ""
fc_mode: "NP"
- port: "fc2/3"
name: ""
status: "up"
vlan: ""
duplex: ""
speed: ""
type: ""
fc_mode: "NP"
- port: "fc2/4"
name: ""
status: "up"
vlan: ""
duplex: ""
speed: ""
type: ""
fc_mode: "NP"
- port: "fc2/5"
name: ""
status: "down"
vlan: ""
duplex: ""
speed: ""
type: "SFP not present"
fc_mode: ""
- port: "fc2/6"
name: ""
status: "down"
vlan: ""
duplex: ""
speed: ""
type: "SFP not present"
fc_mode: ""
- port: "Eth1/1"
name: "XXXXXXX1_bond1_Act"
status: "connected"
vlan: "111"
duplex: "full"
speed: "1000"
type: "SFP-1000BAS"
fc_mode: ""
- port: "Eth1/2"
name: "XXXXXXX3_bond1_Act"
status: "connected"
vlan: "112"
duplex: "full"
speed: "1000"
type: "SFP-1000BAS"
fc_mode: ""
- port: "Eth1/3"
name: "YYYYYYYY1_ha1"
status: "connected"
vlan: "115"
duplex: "full"
speed: "1000"
type: "SFP-1000BAS"
fc_mode: ""
- port: "Eth1/4"
name: "ZZZZZZZZZZZZZ1_tru"
status: "connected"
vlan: "trunk"
duplex: "full"
speed: "10G"
type: "10Gbase-SR"
fc_mode: ""
- port: "Eth1/5"
name: "ZZZZZZZZZZZZZ1_tru"
status: "connected"
vlan: "trunk"
duplex: "full"
speed: "10G"
type: "10Gbase-SR"
fc_mode: ""
- port: "Eth1/6"
name: "AAAAAAAAA1_po2"
status: "connected"
vlan: "trunk"
duplex: "full"
speed: "1000"
type: "SFP-1000BAS"
fc_mode: ""
- port: "Eth1/7"
name: "BBBBBBBB10-1"
status: "connected"
vlan: "4093"
duplex: "full"
speed: "10G"
type: "Fabric Exte"
fc_mode: ""
- port: "Eth1/8"
name: "BBBBBBBB10-1"
status: "connected"
vlan: "4093"
duplex: "full"
speed: "10G"
type: "Fabric Exte"
fc_mode: ""
- port: "Eth1/9"
name: "BBBBBBBB11-1"
status: "connected"
vlan: "4093"
duplex: "full"
speed: "10G"
type: "Fabric Exte"
fc_mode: ""
- port: "Eth1/10"
name: "BBBBBBBB11-1"
status: "connected"
vlan: "4093"
duplex: "full"
speed: "10G"
type: "Fabric Exte"
fc_mode: ""

0 comments on commit 22c37cb

Please sign in to comment.