genieparser icon indicating copy to clipboard operation
genieparser copied to clipboard

issue with 'show vlan id {vlan_id}'

Open viktklass opened this issue 4 years ago • 4 comments

issue with 'show vlan id {vlan_id}' issue with parsing vlan_name containing '-' or '_'

Suggesting changing the regex for vlan_name to include dash, underscores and whitespaces (which are possible by using quotes). This regex worked for me: (?P<vlan_id>\d+)\s+(?P<vlan_name>\S+|\S+.*\S+)\s+(?P<status>active|suspended|act/lshut|sus/lshut)\s+(?P<ports>\S+|)$

It allows vlan-names containing anything, have the 4 possible statuses of a vlan and port or empty if no port.

https://github.com/CiscoTestAutomation/genieparser/blob/09f8735554c078dc4d37479f1d9a68c8cd2bc68e/src/genie/libs/parser/iosxe/show_vlan.py#L608-L611

Example raw_text

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
9    M-access-switch                  active    Gi1/0/48

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
9    enet  100009     1500  -      -      -        -    -        0      0

Remote SPAN VLAN
----------------
Disabled

viktklass avatar Dec 02 '21 08:12 viktklass

Hi viktklass,

Thank you for bringing this to our attention. Since you have already found a solution you're welcome to open a PR with your fix, but we can also add it in ourselves if you prefer.

GerriorL avatar Dec 03 '21 15:12 GerriorL

I'm still new to Github, but will read upon the process and do a PR next week.

viktklass avatar Dec 03 '21 16:12 viktklass

https://pubhub.devnetcloud.com/media/pyats-development-guide/docs/writeparser/writeparser.html#regex-parser If you haven't read it already you might find this document helpful. Otherwise we look forward to your PR!

GerriorL avatar Dec 03 '21 17:12 GerriorL

@viktklass please link the PR to this issue once created

danielgraziano avatar Dec 06 '21 15:12 danielgraziano