Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cisco IOS Show Interface Switchport does not parse multi-line VLAN Trunks #642

Closed
michaeljbailey opened this issue Apr 6, 2020 · 3 comments · Fixed by #671
Closed

Cisco IOS Show Interface Switchport does not parse multi-line VLAN Trunks #642

michaeljbailey opened this issue Apr 6, 2020 · 3 comments · Fixed by #671

Comments

@michaeljbailey
Copy link

ISSUE TYPE
  • Bug Report
TEMPLATE USING
cisco_ios_show_interfaces_switchport
SAMPLE COMMAND OUTPUT
Name: Te5/0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: Off
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Administrative Native VLAN tagging: disabled
Voice VLAN: none
Administrative private-vlan host-association: none 
Administrative private-vlan mapping: none 
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk Native VLAN tagging: enabled
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk associations: none
Administrative private-vlan trunk mappings: none
Operational private-vlan: none
Trunking VLANs Enabled: 1,12,15,31-36,40-42,80,85,101,201,240,410,420,602,604,
     900,910,920,930,940
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL

Protected: false
Unknown unicast blocked: disabled
Unknown multicast blocked: disabled
Vepa Enabled: false
Appliance trust: none
SUMMARY

The current NTC template does not handle VLAN trunks which spill over onto multiple lines.

STEPS TO REPRODUCE

The template was executed using Netmiko send_command with use_textfsm=True against a switch with the following switchport configuration:

interface TenGigabitEthernet5/0/1
 switchport trunk allowed vlan 1,12,15,31-36,40-32,80,85,101,201,240,410,420
 switchport trunk allowed vlan add 602,604,900,910,920,930,940
 switchport mode trunk
 switchport nonegotiate
 logging event link-status
 logging event trunk-status
 auto qos trust dscp
 spanning-tree guard root
EXPECTED RESULTS

The template should parse to the following array:

['1','12','15','31-36','40-42','80','85','101','201','240','410','420','602','604','900','910','920','930','940']
ACTUAL RESULTS

The template parsed to the following array:

['1','12','15','31-36','40-42','80','85','101','201','240','410','420','602','604']
@FragmentedPacket
Copy link
Contributor

@michaeljbailey I have a PR in to fix this by converting TRUNKING_VLANS to a list, but it won't give you your expected results, that would happen in later parsing of the data.

@michaeljbailey
Copy link
Author

@FragmentedPacket thanks, let me see if I can pull up how I tackled this. I may be able to provide a regex that can somewhat solve this as I had to put in a local fix.

It also doesn't make a huge difference to me to need a postprocessing step. I am already structuring my code in such a way to normalize data before I ship it off to other consumers.

@FragmentedPacket
Copy link
Contributor

@michaeljbailey Just checking in. Can you provide what you did?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants