-
Notifications
You must be signed in to change notification settings - Fork 730
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_ios_show_platform, only for switches #1892
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @Uncle-Dee , we will also need test cases to be added to ensure ongoing compatibility. https://ntc-templates.readthedocs.io/en/latest/dev/dev_parser/#tests
ntc_templates/templates/index
Outdated
@@ -294,6 +294,7 @@ cisco_ios_show_cdp_neighbors.textfsm, .*, cisco_ios, sh[[ow]] c[[dp]] neig[[hbor | |||
cisco_ios_show_controller_t1.textfsm, .*, cisco_ios, sh[[ow]] cont[[rollers]] t1 | |||
cisco_ios_show_hosts_summary.textfsm, .*, cisco_ios, sh[[ow]] ho[[sts]] summary | |||
cisco_ios_show_ip_cef_detail.textfsm, .*, cisco_ios, sh[[ow]] ip ce[[f]].+?d[[etail]] | |||
cisco_ios_show_platform.textfsm, .*, cisco_ios, sh[[ow]] plat[[form]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need to follow the proper ordering: https://ntc-templates.readthedocs.io/en/latest/dev/dev_parser/#index-file
Co-authored-by: Jacob McGill <9847006+jmcgill298@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor changes for standardization, should be able to commit this suggestions and be good to go.
Start | ||
^Switch.* | ||
^--.* | ||
^\s${INDEX}\s+${PORTS}\s+${MODEL}\s+${SERIAL}\s+${MAC}\s+${HW_VER}\s+${SW_VER} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^\s${INDEX}\s+${PORTS}\s+${MODEL}\s+${SERIAL}\s+${MAC}\s+${HW_VER}\s+${SW_VER} | |
^\s*${INDEX}\s+${PORTS}\s+${MODEL}\s+${SERIAL}\s+${MAC}\s+${HARDWARE_VERSION}\s+${SOFTWARE_VERSION}\s* | |
^\s*$$ | |
^. -> Error |
We require all new templates to Error on unidentified lines to help ensure we are capturing what we expect to capture.
Value SW_VER (\d+\.\d+\.\d+) | ||
|
||
Start | ||
^Switch.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^Switch.* | |
^Switch\s+Ports\s+Model\s+Serial\s+No\.\s+MAC\s+address\s+Hw\s+Ver\.\s+Sw\s+Ver\.\s*$$ |
We want to capture the full table header to make sure the columns are what we expect and are in the order we expect them to be in. This helps identify changes between models and versions.
Switch Ports Model Serial No. MAC address Hw Ver. Sw Ver. | ||
------ ----- --------- ----------- -------------- ------- -------- | ||
1 65 C9300-48P J111111111a f000.f000.f000 V03 16.12.4 | ||
2 65 C9300-48P J222222222b f000.f000.f001 V03 16.12.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 65 C9300-48P J222222222b f000.f000.f001 V03 16.12.4 | |
2 65 C9300-48P J222222222b f000.f000.f001 V03 16.12.4 | |
mac: 'f000.f000.f001' | ||
hw_ver: 'V03' | ||
sw_ver: '16.12.4' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Value HW_VER (\S+) | ||
Value SW_VER (\d+\.\d+\.\d+) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Value HW_VER (\S+) | |
Value SW_VER (\d+\.\d+\.\d+) | |
Value HARDWARE_VERSION (\S+) | |
Value SOFTWARE_VERSION (\d+\.\d+\.\d+) |
We are trying to keep key names consistent across templates now
hw_ver: 'V03' | ||
sw_ver: '16.12.4' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hw_ver: 'V03' | |
sw_ver: '16.12.4' | |
hardware_version: 'V03' | |
software_version: '16.12.4' |
hw_ver: 'V03' | ||
sw_ver: '16.12.4' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hw_ver: 'V03' | |
sw_ver: '16.12.4' | |
hardware_version: 'V03' | |
software_version: '16.12.4' |
|
||
Start | ||
^Switch.* | ||
^--.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^--.* | |
^(-+\s*)+$$ |
Reduce dashes and match white space to make the regex slightly more specific.
Intentionally set for zero or more white space \s*
just in case the hyphens ever end up being on a line without spaces.
Edit:
- Create a group so we match one or more groups of dashes and spaces
- Anchor on end of line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Uncle-Dee
If you approve these suggestions, please click the button(s) to accept the Commit Suggestions.
Any questions?
Thank you.
Only for switches.