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

Update cisco_nxos_show_interface_status.template #370

Merged
merged 5 commits into from
Feb 24, 2019
Merged

Update cisco_nxos_show_interface_status.template #370

merged 5 commits into from
Feb 24, 2019

Conversation

Pluppo
Copy link
Contributor

@Pluppo Pluppo commented Feb 4, 2019

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT

cisco_nxos_show_interface_status.template

SUMMARY

In NXOS 7.0.3.I7.5a there is a separate section with column names for the mgmt0 interface. This caused a "textfsm.TextFSMError" when the column name section appeared for the second time. This update fixes the issue.


In NXOS 7.0.3.I7.5a there is a separate section with column names for the mgmt0 interface. This caused a "textfsm.TextFSMError" when the column name section appeared for the second time. This update fixes the issue.
Copy link
Contributor

@jmcgill298 jmcgill298 left a comment

Choose a reason for hiding this comment

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

@Pluppo can you please provide new, or update the existing test files to include this data? We would like to ensure this data is accounted for in any future modifications to the template. Thanks!

@Pluppo
Copy link
Contributor Author

Pluppo commented Feb 23, 2019

Hi, I just added two new test files:
cisco_nxos_show_interface_status2.raw
cisco_nxos_show_interface_status2.parsed

Let me know if you need me to do anything else.

@jmcgill298
Copy link
Contributor

@Pluppo looking at this now with the raw data, I think it would be better just to remove the state change, and put all of the matching under Start. Does that work when you do it?

@Pluppo
Copy link
Contributor Author

Pluppo commented Feb 23, 2019

@jmcgill298 I'm sorry, but I'm not sure what you mean. My apologies, I'm quite new in dealing with Github and code collaboration.

I tried moving the ^[Pp]ort\s+[Nn]ame\s+[Ss]tatus\s+[Vv]lan\s+[Dd]uplex\s+[Ss]peed\s+[Tt]ype\s*$$ line from the "INTFS" section to the "Start" section, but that did not work.

The reason for this change is that in newer versions of nxos, there is a separate title section for the "mgmt0" interface, and a second title section for the remaining interfaces. Without telling the template to ignore the second occurrence of the title section, the following error appears:
TextFSMError: State Error raised. Rule Line: 20. Input Line: Port Name Status Vlan Duplex Speed Type

If you don't mind giving me an example of the code you think would be better to use, I'd by happy to test it.

@jmcgill298
Copy link
Contributor

@Pluppo I created https://github.com/Pluppo/ntc-templates/pull/1 which removes the state change. In TextFSM, -> $SectionName, is a state change. This can be used to segment up long output, or to distinguish between different expected output depending on Platform, OS, etc. The state change wasn't really doing anything in this template, and your updates made the Start state and the INTFS state exactly the same, so it just makes sense to only use Start.

NXOS SHOW INTF: Remove state change
@jmcgill298 jmcgill298 merged commit 8f99579 into networktocode:master Feb 24, 2019
@Pluppo Pluppo deleted the patch-1 branch February 24, 2019 23:11
jvanderaa pushed a commit that referenced this pull request Nov 10, 2021
Newer OS versions have a separate header section for the MGMT interface than from the Ethernet interfaces. In order to account for this, the state change was removed and all matching is done under `Start`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants