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_nxos_show_interface_status.textfsm fails to match type with N2K-C2248TP-E-1GE #932

Closed
M2theICK opened this issue May 17, 2021 · 2 comments · Fixed by #1720
Closed

Comments

@M2theICK
Copy link

ISSUE TYPE
  • Bug Report
TEMPLATE USING

cisco_nxos_show_interface_status.textfsm

Value PORT (\S+)
Value NAME (.*?)
Value STATUS (\S+)
Value VLAN (\d+|routed|trunk|--)
Value DUPLEX (\S+)
Value SPEED (\S+)
Value TYPE (\S+(\s\S+)*)

Start
  ^${PORT}\s+${NAME}\s+${STATUS}\s+${VLAN}\s+${DUPLEX}\s+${SPEED}\s+${TYPE}\s*$$ -> Record
  ^[Pp]ort\s+[Nn]ame\s+[Ss]tatus\s+[Vv]lan\s+[Dd]uplex\s+[Ss]peed\s+[Tt]ype\s*$$
  ^-+
  ^\s*$$
  ^. -> Error
SAMPLE COMMAND OUTPUT
--------------------------------------------------------------------------------
Port          Name               Status    Vlan      Duplex  Speed   Type
--------------------------------------------------------------------------------
Eth1/1        --                 connected trunk     full    10G     10Gbase-SR
Eth1/3        --                 connected trunk     full    10G     10Gbase-LR
Eth1/5        --                 connected trunk     full    10G     SFP-H10GB-C
Eth1/7        --                 connected 1         full    10G     Fabric Exte
Eth1/35       --                 sfpAbsent 1         full    10G     --
Eth101/1/1    --                 connected 101       full    1000    10/100/1000
Eth105/1/1    --                 notconnec 101       full    1000
SUMMARY

If there is no Type value the script aborts.

STEPS TO REPRODUCE

Use ssh_con.send_command('show interface status', use_textfsm=True) with a Cisco N2K-C2248TP-E-1GE connected.

EXPECTED RESULTS

That an empty string is returned for interfaces without type.

ACTUAL RESULTS

The scripts aborts.

textfsm.parser.TextFSMError: State Error raised. Rule Line: 14. Input Line: Eth105/1/1    --           notconnec 201       full    1000
@ryanmerolle
Copy link
Contributor

Value PORT (\S+)
Value NAME (.*?)
Value STATUS (\S+)
Value VLAN (\d+|routed|trunk|--)
Value DUPLEX (\S+)
Value SPEED (\S+)
Value TYPE (\S+(\s\S+)*)

Start
  ^${PORT}\s+${NAME}\s+${STATUS}\s+${VLAN}\s+${DUPLEX}\s+${SPEED}(?:\s+${TYPE})?\s*$$ -> Record
  ^[Pp]ort\s+[Nn]ame\s+[Ss]tatus\s+[Vv]lan\s+[Dd]uplex\s+[Ss]peed\s+[Tt]ype\s*$$
  ^-+
  ^\s*$$
  ^. -> Error

This fixes it if you want to set Et105/1/1 as having a type of "".

Thoughts?

@jvanderaa
Copy link
Contributor

Good to submit a PR on it.

ryanmerolle added a commit to ryanmerolle/ntc-templates that referenced this issue Jun 22, 2024
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.

4 participants