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

New Template: cisco_nxos_show_interface_description #758

Merged
merged 2 commits into from Jun 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions templates/cisco_nxos_show_interface_description.textfsm
@@ -0,0 +1,16 @@
Value PORT (\S+)
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 PORT (\S+)
Value PORT (\S+)
Value TYPE (\S+)
Value SPEED (\w+)
Value DESCRIPTION (.+)
Start
^-+
^Interface\s+Description -> Type1
^Port\s+Type\s+Speed\s+Description -> Type2
^\s*$$
^. -> Error
Type1
^-+
^Port\s+Type\s+Speed\s+Description -> Type2
^${PORT}\s+${DESCRIPTION}$$ -> Record
^\s*$$
^. -> Error
Type2
^-+
^Interface\s+Description -> Type1
^${PORT}\s+${TYPE}\s+${SPEED}\s+${DESCRIPTION} -> Record
^\s*$$
^. -> Error

Here is a template that should work and uses the state changes to capture the necessary output for each header in the output.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't work at 100% because it catches "Interface Description" while already in the Type1 state. The new version would be substantially more complicated for the same result. I will commit a very slightly updated version.

Open to discuss this though.

Value TYPE (\S+)
Value SPEED (\d+G?)
Value DESCRIPTION (\S.*?)

Start
^Interface\s+Description\s*$$ -> Begin

Begin
^-+
^Port\s+Type\s+Speed\s+Description\s*$$
^Interface\s+Description\s*$$
^${PORT}\s+${TYPE}\s+${SPEED}(?:\s+${DESCRIPTION})?\s*$$ -> Record
^${PORT}\s+(?:\s+${DESCRIPTION})?\s*$$ -> Record
^\s*$$
^. -> Error
1 change: 1 addition & 0 deletions templates/index
Expand Up @@ -237,6 +237,7 @@ cisco_nxos_show_configuration_session_summary.textfsm, .*, cisco_nxos, sh[[ow]]
cisco_nxos_show_interface_transceiver_details.textfsm, .*, cisco_nxos, sh[[ow]] int[[erface]] tra[[nsceiver]] de[[tails]]
cisco_nxos_show_environment_temperature.textfsm, .*, cisco_nxos, sh[[ow]] env[[ironment]] t[[emperature]]
cisco_nxos_show_forwarding_ipv4_route.textfsm, .*, cisco_nxos, sh[[ow]] fo[[rwarding]] ipv4 ro[[ute]]
cisco_nxos_show_interface_description.textfsm, .*, cisco_nxos, sh[[ow]] int[[erface]] desc[[ription]]
cisco_nxos_show_interface_transceiver.textfsm, .*, cisco_nxos, sh[[ow]] int[[erface]] tra[[nsceiver]]
cisco_nxos_show_interfaces_switchport.textfsm, .*, cisco_nxos, sh[[ow]] int[[erfaces]] sw[[itchport]]
cisco_nxos_show_ip_dhcp_relay_address.textfsm, .*, cisco_nxos, sh[[ow]] ip dh[[cp]] r[[elay]] a[[ddress]]
Expand Down
@@ -0,0 +1,131 @@

-------------------------------------------------------------------------------
Interface Description
-------------------------------------------------------------------------------
mgmt0 --

-------------------------------------------------------------------------------
Port Type Speed Description
-------------------------------------------------------------------------------
Eth4/1 eth 10G --
Eth4/2 eth 1000 --
Eth4/3 eth 10G This is a test description
Eth4/4 eth 10G This is a test description
Eth4/5 eth 10G This is a test description
Eth4/6 eth 1000 This is a test description
Eth4/7 eth 10G This is a test description
Eth4/8 eth 1000 This is a test description
Eth4/9 eth 10G This is a test description
Eth4/10 eth 10G This is a test description
Eth4/11 eth 10G This is a test description
Eth4/12 eth 10G This is a test description
Eth4/13 eth 1000 This is a test description
Eth4/14 eth 10G --
Eth4/15 eth 10G This is a test description
Eth4/16 eth 10G This is a test description
Eth4/17 eth 1000 This is a test description
Eth4/18 eth 10G This is a test description
Eth4/19 eth 1000 This is a test description
Eth4/20 eth 10G This is a test description
Eth4/21 eth 10G This is a test description
Eth4/22 eth 10G This is a test description
Eth4/23 eth 10G This is a test description
Eth4/24 eth 10G This is a test description
Eth6/1 eth 10G This is a description on line card 6
Eth6/2 eth 10G This is a description on line card 6
Eth6/3 eth 1000 This is a description on line card 6
Eth6/4 eth 1000 This is a description on line card 6
Eth6/5 eth 10G This is a description on line card 6
Eth6/6 eth 1000 This is a description on line card 6
Eth6/7 eth 10G This is a description on line card 6
Eth6/8 eth 10G This is a description on line card 6
Eth6/9 eth 10G This is a description on line card 6
Eth6/10 eth 10G This is a description on line card 6
Eth6/11 eth 10G This is a description on line card 6
Eth6/12 eth 10G This is a description on line card 6
Eth6/13 eth 10G This is a description on line card 6
Eth6/14 eth 10G This is a description on line card 6
Eth6/15 eth 10G This is a description on line card 6
Eth6/16 eth 1000 This is a description on line card 6
Eth6/17 eth 10G This is a description on line card 6
Eth6/18 eth 1000 This is a description on line card 6
Eth6/19 eth 10G This is a description on line card 6
Eth6/20 eth 10G This is a description on line card 6
Eth6/21 eth 10G This is a description on line card 6
Eth6/22 eth 10G This is a description on line card 6
Eth6/23 eth 10G This is a description on line card 6
Eth6/24 eth 10G This is a description on line card 6
Eth6/25 eth 1000 This is a description on line card 6
Eth6/26 eth 1000 This is a description on line card 6
Eth6/27 eth 10G This is a description on line card 6
Eth6/28 eth 1000 This is a description on line card 6
Eth6/29 eth 10G This is a description on line card 6
Eth6/30 eth 10G This is a description on line card 6
Eth6/31 eth 10G This is a description on line card 6
Eth6/32 eth 10G This is a description on line card 6
Eth6/33 eth 10G This is a description on line card 6
Eth6/34 eth 1000 This is a description on line card 6
Eth6/35 eth 10G This is a description on line card 6
Eth6/36 eth 1000 This is a description on line card 6
Eth6/37 eth 10G This is a description on line card 6
Eth6/38 eth 10G This is a description on line card 6
Eth6/39 eth 1000 This is a description on line card 6
Eth6/40 eth 10G This is a description on line card 6
Eth6/41 eth 10G This is a description on line card 6
Eth6/42 eth 10G This is a description on line card 6
Eth6/43 eth 10G This is a description on line card 6
Eth6/44 eth 10G This is a description on line card 6
Eth6/45 eth 10G This is a description on line card 6
Eth6/46 eth 10G This is a description on line card 6
Eth6/47 eth 10G This is a description on line card 6
Eth6/48 eth 10G This is a description on line card 6

-------------------------------------------------------------------------------
Interface Description
-------------------------------------------------------------------------------
Po10 This is a portchannel
Po20 This is a portchannel
Po25 This is a portchannel
Po300 This is a portchannel

-------------------------------------------------------------------------------
Interface Description
-------------------------------------------------------------------------------
Lo0 This is a loopback
Lo1 This is a loopback
Lo2 This is a loopback
Lo20 --
Lo30 --
Vlan1 --
Vlan9 Nice little VLAN interface here
Vlan10 Nice little VLAN interface here
Vlan20 Nice little VLAN interface here
Vlan30 Nice little VLAN interface here

-------------------------------------------------------------------------------
Port Type Speed Description
-------------------------------------------------------------------------------
Eth100/1/1 eth 1000 This is another description
Eth100/1/2 eth 1000 This is another description
Eth100/1/3 eth 1000 This is another description
Eth100/1/4 eth 1000 This is another description
Eth100/1/5 eth 1000 This is another description
Eth100/1/6 eth 1000 This is another description
Eth100/1/7 eth 1000 This is another description
Eth100/1/8 eth 1000 This is another description
Eth100/1/9 eth 1000 This is another description
Eth100/1/10 eth 1000 This is another description
Eth100/1/11 eth 1000 This is another description
Eth100/1/12 eth 1000 This is another description
Eth100/1/13 eth 1000 This is another description
Eth100/1/14 eth 1000 This is another description
Eth100/1/15 eth 1000 This is another description
Eth100/1/16 eth 1000 This is another description
Eth100/1/17 eth 1000 This is another description
Eth100/1/18 eth 1000 This is another description
Eth100/1/19 eth 1000 This is another description
Eth100/1/20 eth 1000 This is another description
Eth100/1/21 eth 1000 This is another description
Eth100/1/22 eth 1000 This is another description
Eth100/1/23 eth 1000 This is another description
Eth100/1/24 eth 1000 This is another description