Skip to content
New issue

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

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

Already on GitHub? # to your account

cisco_nxos_show_interface_status: Fixes issue #331 #332

Merged

Conversation

JCapretta
Copy link
Contributor

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT

cisco_nxos_show_interface_status

SUMMARY

Template was giving an error for interfaces with speeds of '10G' and '40G'. Modified regular expression to match an optional 'G' at the end of the speed value.

BEFORE

$ textfsm.py templates/cisco_nxos_show_interface_status.template tests/cisco_nxos/show_interface_status/cisco_nxos_show_interface_status1.raw

FSM Template:
Value PORT (\S+)
Value NAME (.*?)
Value STATUS (\S+)
Value VLAN (\d+|routed|trunk)
Value DUPLEX (\S+)
Value SPEED (\d+|auto)
Value TYPE (.+?)

Start
  ^[Pp]ort\s+[Nn]ame\s+[Ss]tatus\s+[Vv]lan\s+[Dd]uplex\s+[Ss]peed\s+[Tt]ype\s*$$ -> INTFS
  ^-+\s*$$
  ^$$
  ^.*$$ -> Error

INTFS
  ^${PORT}\s+${NAME}\s+${STATUS}\s+${VLAN}\s+${DUPLEX}\s+${SPEED}\s+${TYPE}\s*$$ -> Record
  ^-+\s*$$
  ^$$
  ^.*$$ -> Error


State Error raised. Rule Line: 19. Input Line: Eth1/1        interface1  connected trunk     full 

AFTER:

$  textfsm.py templates/cisco_nxos_show_interface_status.template tests/cisco_nxos/show_interface_status/cisco_nxos_show_interface_status1.raw

FSM Template:
Value PORT (\S+)
Value NAME (.*?)
Value STATUS (\S+)
Value VLAN (\d+|routed|trunk)
Value DUPLEX (\S+)
Value SPEED (\d+G?|auto)
Value TYPE (.+?)

Start
  ^[Pp]ort\s+[Nn]ame\s+[Ss]tatus\s+[Vv]lan\s+[Dd]uplex\s+[Ss]peed\s+[Tt]ype\s*$$ -> INTFS
  ^-+\s*$$
  ^$$
  ^.*$$ -> Error

INTFS
  ^${PORT}\s+${NAME}\s+${STATUS}\s+${VLAN}\s+${DUPLEX}\s+${SPEED}\s+${TYPE}\s*$$ -> Record
  ^-+\s*$$
  ^$$
  ^.*$$ -> Error


FSM Table:
['PORT', 'NAME', 'STATUS', 'VLAN', 'DUPLEX', 'SPEED', 'TYPE']
['mgmt0', '--', 'connected', 'routed', 'full', '1000', '--']
['Eth1/1', 'interface1', 'connected', 'trunk', 'full', '10G', '10Gbase-SR-S']
['Eth1/2', 'interface2', 'connected', 'trunk', 'full', '10G', '10Gbase-SR-S']
['Eth1/3', 'interface3', 'connected', 'trunk', 'full', '10G', '10Gbase-SR']
['Eth1/4', 'interface4', 'connected', 'trunk', 'full', '10G', '10Gbase-SR']
['Eth1/5', 'interface5', 'connected', 'trunk', 'full', '10G', '10Gbase-SR-S']
['Eth1/6', 'interface6', 'connected', 'trunk', 'full', '10G', '10Gbase-SR-S']
['Eth1/7', 'interface7', 'connected', 'trunk', 'full', '10G', '10Gbase-SR-S']
['Eth1/8', 'interface8', 'connected', 'trunk', 'full', '10G', '10Gbase-SR-S']

 * added new test files
 * modified template
jmcgill298 and others added 2 commits January 15, 2019 10:13
Co-Authored-By: JCapretta <46580735+JCapretta@users.noreply.github.com>
@jmcgill298 jmcgill298 merged commit 8f4bb8d into networktocode:master Jan 18, 2019
jvanderaa pushed a commit that referenced this pull request Nov 10, 2021
BUG FIXES:
  * `SPEED`: change capture group to use `\S+` to account for new data
  * `TYPE`: change capture group to use `\S+` to account for new data

TEST FILES:
 * Added new files to provide sample data representing what was not working with previous capture groups
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants