Skip to content

Commit

Permalink
Enhancement: IOS show int switchport - Add ADMIN_MODE Group (#563)
Browse files Browse the repository at this point in the history
* Captured Administrative Mode, added support for unassigned Access VLAN

* Avoid trailing spaces and updated tests

Co-authored-by: jmorello12 <jmorello12@users.noreply.github.com>
  • Loading branch information
jmcgill298 and jmorello12 authored Dec 20, 2019
1 parent f5a3558 commit c02a4ca
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 67 deletions.
25 changes: 13 additions & 12 deletions templates/cisco_ios_show_interfaces_switchport.textfsm
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
Value Required INTERFACE (\S+)
Value SWITCHPORT (.+)
Value SWITCHPORT_MONITOR (.+)
Value SWITCHPORT_NEGOTIATION (.+)
Value MODE (.+)
Value ACCESS_VLAN (\d+)
Value SWITCHPORT (.+?)
Value SWITCHPORT_MONITOR (.+?)
Value SWITCHPORT_NEGOTIATION (.+?)
Value MODE (.+?)
Value ADMIN_MODE (.+?)
Value ACCESS_VLAN (\d+|unassigned)
Value NATIVE_VLAN (\d+)
Value VOICE_VLAN (\S+)
Value TRUNKING_VLANS (.+)
Value TRUNKING_VLANS (.+?)

Start
^Name: -> Continue.Record
^Name:\s+${INTERFACE}
^\s*Switchport:\s+${SWITCHPORT}
^\s*Switchport\s+Monitor:\s+${SWITCHPORT_MONITOR}
^\s*Operational\s+Mode:\s+${MODE}
^\s*Negotiation\s+of\s+Trunking:\s+${SWITCHPORT_NEGOTIATION}
^\s*Switchport:\s+${SWITCHPORT}$$
^\s*Switchport\s+Monitor:\s+${SWITCHPORT_MONITOR}$$
^\s*Operational\s+Mode:\s+${MODE}$$
^\s*Negotiation\s+of\s+Trunking:\s+${SWITCHPORT_NEGOTIATION}$$
^\s*Access\s+Mode\s+VLAN:\s+${ACCESS_VLAN}
^\s*Trunking\s+Native\s+Mode\s+VLAN:\s+${NATIVE_VLAN}
^\s*Voice\s+VLAN:\s+${VOICE_VLAN}
^\s*Trunking\s+VLANs\s+Enabled:\s+${TRUNKING_VLANS}
^\s*Administrative\s+Mode
^\s*Trunking\s+VLANs\s+Enabled:\s+${TRUNKING_VLANS}$$
^\s*Administrative\s+Mode:\s+${ADMIN_MODE}$$
^\s*(?:Operational|Administrative)\s+(?:Trunking|Native\s+VLAN|private-vlan)
^\s*Voice\s+VLAN:
^\s*Pruning\s+VLANs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,56 +1,62 @@
---
parsed_sample:
- access_vlan: "1"
interface: "Gi0/1"
mode: "trunk"
native_vlan: "1"
- interface: "Gi0/1"
switchport: "Enabled"
switchport_negotiation: "Off"
switchport_monitor: ""
switchport_negotiation: "Off"
mode: "trunk"
admin_mode: "trunk"
access_vlan: "1"
native_vlan: "1"
voice_vlan: "none"
trunking_vlans: "ALL"
- access_vlan: "100"
interface: "Gi0/2"
mode: "static access"
native_vlan: "1"
- interface: "Gi0/2"
switchport: "Enabled"
switchport_negotiation: "On"
switchport_monitor: ""
voice_vlan: "none"
trunking_vlans: "ALL"
- access_vlan: "101"
interface: "Gi0/3"
switchport_negotiation: "On"
mode: "static access"
admin_mode: "dynamic auto"
access_vlan: "100"
native_vlan: "1"
switchport: "Enabled"
switchport_negotiation: "On"
switchport_monitor: ""
voice_vlan: "none"
trunking_vlans: "ALL"
- access_vlan: "110"
interface: "Gi1/0"
mode: "static access"
native_vlan: "1"
- interface: "Gi0/3"
switchport: "Enabled"
switchport_negotiation: "On"
switchport_monitor: ""
voice_vlan: "none"
trunking_vlans: "ALL"
- access_vlan: "111"
interface: "Gi1/1"
switchport_negotiation: "On"
mode: "static access"
admin_mode: "dynamic auto"
access_vlan: "101"
native_vlan: "1"
voice_vlan: "none"
trunking_vlans: "ALL"
- interface: "Gi1/0"
switchport: "Enabled"
switchport_negotiation: "On"
switchport_monitor: ""
switchport_negotiation: "On"
mode: "static access"
admin_mode: "dynamic auto"
access_vlan: "110"
native_vlan: "1"
voice_vlan: "none"
trunking_vlans: "ALL"
- access_vlan: "1"
interface: "Fa0/1"
- interface: "Gi1/1"
switchport: "Enabled"
switchport_monitor: ""
switchport_negotiation: "On"
mode: "static access"
admin_mode: "dynamic auto"
access_vlan: "111"
native_vlan: "1"
voice_vlan: "none"
trunking_vlans: "ALL"
- interface: "Fa0/1"
switchport: "Enabled"
switchport_negotiation: "On"
switchport_monitor: ""
switchport_negotiation: "On"
mode: "static access"
admin_mode: "dynamic auto"
access_vlan: "1"
native_vlan: "1"
voice_vlan: "none"
trunking_vlans: "ALL"
Original file line number Diff line number Diff line change
@@ -1,47 +1,52 @@
---
parsed_sample:
- access_vlan: "1"
interface: "Gi0/1"
mode: "trunk"
native_vlan: "1"
- interface: "Gi0/1"
switchport: "Enabled"
switchport_negotiation: "Off"
switchport_monitor: ""
switchport_negotiation: "Off"
mode: "trunk"
admin_mode: "trunk"
access_vlan: "1"
native_vlan: "1"
voice_vlan: "none"
trunking_vlans: "ALL"
- access_vlan: "100"
interface: "Gi0/2"
mode: "static access"
native_vlan: "1"
- interface: "Gi0/2"
switchport: "Enabled"
switchport_negotiation: "On"
switchport_monitor: ""
voice_vlan: "none"
trunking_vlans: "ALL"
- access_vlan: "101"
interface: "Gi0/3"
switchport_negotiation: "On"
mode: "static access"
admin_mode: "dynamic auto"
access_vlan: "100"
native_vlan: "1"
switchport: "Enabled"
switchport_negotiation: "On"
switchport_monitor: ""
voice_vlan: "none"
trunking_vlans: "ALL"
- access_vlan: "110"
interface: "Gi1/0"
mode: "static access"
native_vlan: "1"
- interface: "Gi0/3"
switchport: "Enabled"
switchport_negotiation: "On"
switchport_monitor: ""
switchport_negotiation: "On"
mode: "static access"
admin_mode: "dynamic auto"
access_vlan: "101"
native_vlan: "1"
voice_vlan: "none"
trunking_vlans: "ALL"
- access_vlan: "111"
interface: "Gi1/1"
- interface: "Gi1/0"
switchport: "Enabled"
switchport_monitor: ""
switchport_negotiation: "On"
mode: "static access"
admin_mode: "dynamic auto"
access_vlan: "110"
native_vlan: "1"
voice_vlan: "none"
trunking_vlans: "ALL"
- interface: "Gi1/1"
switchport: "Enabled"
switchport_negotiation: "On"
switchport_monitor: ""
switchport_negotiation: "On"
mode: "static access"
admin_mode: "dynamic auto"
access_vlan: "111"
native_vlan: "1"
voice_vlan: "none"
trunking_vlans: "ALL"

0 comments on commit c02a4ca

Please sign in to comment.