networktocode / ntc-templates

TextFSM templates for parsing show commands of network devices
https://ntc-templates.readthedocs.io/
Other
1.12k stars 730 forks source link

idea: consolidate to cisco_xr_admin_show_inventory #1788

Closed mjbear closed 4 months ago

mjbear commented 4 months ago

Important Note

Feature request for new templates will be closed. Feature request for adding data captured to existing templates will be closed.

Environment

Proposed Functionality

Modify the index file so that cisco_xr admin show inventory and show inventory utilize the same TextFSM template. (I have successfully tested changes in a branch, but want to make sure there is agreement before sending in a PR.)

:dart: This reduces a duplicate template and will also remove one line from the index file. :bulb: Since the capture group names are the same between the two, this is a seamless change.

Note: Raw output and parsed output for tests still needs placed in their respective directories.

tests/cisco_xr/admin_show_inventory/
tests/cisco_xr/show_inventory/

:balance_scale: The template for admin show inventory is older along with regexes/$$ line termination ([0] vs [1]) so I used that to choose which template to consolidate.

Use Case

Developers benefit from this being DRY (don't repeat yourself). This is similar to xr show platform PR #1783 where two commands were covered by a single template.

mjbear commented 4 months ago

Anyone have any feedback? Thank you!

@jvanderaa @jmcgill298 @lamiskin @diepes @dainok

dainok commented 4 months ago

@mjbear to me it's fine. I don't have enough test equipment with XR, so I trust that show inventory and admin show inventory always have the same result. I guess that exceptions can still be managed inside one template.

mjbear commented 4 months ago

@mjbear to me it's fine. I don't have enough test equipment with XR, so I trust that show inventory and admin show inventory always have the same result. I guess that exceptions can still be managed inside one template.

That's a fair point @dainok. Based on the test output we have the raw output structure is almost identical (minor: one has a blank line at a different spot :grinning:). cisco_xr_show_inventory tests cisco_xr_admin_show_inventory tests

jmcgill298 commented 4 months ago

yes, this can just be handled by the index file

mjbear commented 4 months ago

yes, this can just be handled by the index file

:100: I submitted PR #1797