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_ios_show_platform, only for switches #1892

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Uncle-Dee
Copy link

Only for switches.

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.

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/cisco_ios_show_platform.textfsm Outdated Show resolved Hide resolved
@@ -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]]
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

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}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
^\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.*
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
^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
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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'

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

Comment on lines +6 to +7
Value HW_VER (\S+)
Value SW_VER (\d+\.\d+\.\d+)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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

Comment on lines +8 to +9
hw_ver: 'V03'
sw_ver: '16.12.4'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
hw_ver: 'V03'
sw_ver: '16.12.4'
hardware_version: 'V03'
software_version: '16.12.4'

Comment on lines +15 to +16
hw_ver: 'V03'
sw_ver: '16.12.4'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
hw_ver: 'V03'
sw_ver: '16.12.4'
hardware_version: 'V03'
software_version: '16.12.4'


Start
^Switch.*
^--.*
Copy link
Contributor

@mjbear mjbear Nov 17, 2024

Choose a reason for hiding this comment

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

Suggested change
^--.*
^(-+\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

Copy link
Contributor

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.

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.

3 participants