Skip to content

Add support to Cisco IOS for 'show vlan group' #2093

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

forrejam
Copy link
Contributor

@forrejam forrejam commented Apr 1, 2025

Add support for "show vlan group" on cisco IOS

@forrejam
Copy link
Contributor Author

forrejam commented Apr 1, 2025

Please let me know if there is a better way to handle vlan output like this in textfsm

vlan group MULTI_VLAN_TEST_2 : 761-763, 197, 116, 118

- vlan_group_name: "MULTI_VLAN_TEST_2"
  vlan_ids: "761-763, 197, 116, 118"

@mjbear
Copy link
Collaborator

mjbear commented Apr 1, 2025

Please let me know if there is a better way to handle vlan output like this in textfsm

vlan group MULTI_VLAN_TEST_2 : 761-763, 997, 1160, 1180

- vlan_group_name: "MULTI_VLAN_TEST_2"
  vlan_ids: "761-763, 197, 200, 208"

Since those VLAN IDs are all on one line, the string capture as you have it is probably the simplest route.

If they were on different lines we could have had the chance to use List, but that's not the case here.

Comment on lines 1 to 5
Value Required VLAN_GROUP_NAME (\S+)
Value VLAN_IDS (\d+.*)

Start
^vlan\s+group\s+${VLAN_GROUP_NAME}\s+:\s+${VLAN_IDS}$$ -> Record
Copy link
Collaborator

@mjbear mjbear Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this for a bit ... we've normalized/standardized on VLAN_ID in other templates. For the raw output here there can be one or more VLAN IDs, but that holds true for other templates where VLAN_ID is used (cisco_ios example).

If you agree, please click the "commit suggestions" button to pull my suggestion into your pull request. Thank you!

Suggested change
Value Required VLAN_GROUP_NAME (\S+)
Value VLAN_IDS (\d+.*)
Start
^vlan\s+group\s+${VLAN_GROUP_NAME}\s+:\s+${VLAN_IDS}$$ -> Record
Value Required VLAN_GROUP_NAME (\S+)
Value VLAN_ID (\d+.*)
Start
^vlan\s+group\s+${VLAN_GROUP_NAME}\s+:\s+${VLAN_ID}$$ -> Record

Copy link
Contributor Author

@forrejam forrejam Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that's fine. The only thing I would say about the use of VLAN_ID in other templates is usually you can rely on it being a single vlan (\d+) so I thought using a different identifier would prompt the user that it will need more post processing (which is what I'm doing in production) in the event of a vlan range. But I can see in the example you linked its not always the case.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I thought using a different identifier would prompt the user that it will need more post processing (which is what I'm doing in production) in the event of a vlan range.

You have a good point there to differentiate and call out the need for post processing.
We can certainly get some input from others.

@mjbear mjbear added the question label Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants