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

show interface summary #539

Merged
merged 4 commits into from
Nov 17, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions templates/cisco_wlc_ssh_show_interface_summary.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Value Filldown INT_COUNT (\d+)
Value Required NAME (\S+)
Value PORT (\S+)
Value VLAN (\S+)
Value IP_ADDR (([\d1-9]+\.?){4})
Value TYPE (\S+)
Value AP_MGR (\S+)
Value GUEST (\S+)

Copy link
Contributor

Choose a reason for hiding this comment

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

Here is the changes to the template that I would make:

Value Filldown INT_COUNT (\d+)
Value Required NAME (\S+)
Value PORT (\S+)
Value VLAN (\S+)
Value IP_ADDR (([\d1-9]+\.?){4})
Value TYPE (\S+)
Value AP_MGR (\S+)
Value GUEST (\S+)

Start
  ^\s+Number\sof\sInterfaces\.*\s${INT_COUNT}s*$$
  ^Interface\s+Name\s+Port\s+Vlan\s+Id\s+IP\s+Address\s+Type\s+Ap\s+Mgr\s+Guest -> Type_One

Type_One
  ^-+\s
  ^${NAME}\s+${PORT}\s+${VLAN}\s+${IP_ADDR}\s+${TYPE}\s+${AP_MGR}\s+${GUEST}$$ -> Record
  ^\s*$$
  ^. -> Error

Changed most of the value's regex to \S+ as it should suffice here and catch any non-whitespace on and not depend on if it's a word or not.

I also changed it to track the whole header and then transition state to Type_One if the header matches. This allows us to make sure we're capturing the the correct and expected output. If the headers or output changes, we would add another line to match it and transition to a different state to capture the changed output.

I also added Required to Value NAME to prevent us from having the non-filled in information within the .parsed file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Whoops. Could you add the following to the Start state:

  ^\s*$$
  ^. -> Error

Start
^\s+Number\sof\sInterfaces\.*\s${INT_COUNT}s*$$
^Interface\s+Name\s+Port\s+Vlan\s+Id\s+IP\s+Address\s+Type\s+Ap\s+Mgr\s+Guest -> Type_One
^\s*$$
^. -> Error

Type_One
^-+\s
^${NAME}\s\s+${PORT}\s+${VLAN}\s+${IP_ADDR}\s+${TYPE}\s+${AP_MGR}\s+${GUEST} -> Record
^\s*$$
^. -> Error
1 change: 1 addition & 0 deletions templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ cisco_wlc_ssh_show_802.11a_cleanair_config.template, .*, cisco_wlc_ssh, sh[[ow]]
cisco_wlc_ssh_show_cdp_neighbors_detail.template, .*, cisco_wlc_ssh, sh[[ow]] c[[dp]] neig[[hbors]] det[[ail]]
cisco_wlc_ssh_show_rf-profile_summary.template, .*, cisco_wlc_ssh, sh[[ow]] rf-[[profile]] s[[ummary]]
cisco_wlc_ssh_show_ap_config_general.template, .*, cisco_wlc_ssh, sh[[ow]] ap con[[fig]] ge[[neral]]
cisco_wlc_ssh_show_interface_summary.template, .*, cisco_wlc_ssh, sh[[ow]] int[[erface]] s[[ummary]]
cisco_wlc_ssh_show_client_detail.template, .*, cisco_wlc_ssh, sh[[ow]] cl[[ient]] det[[ail]]
cisco_wlc_ssh_show_exclusionlist.template, .*, cisco_wlc_ssh, sh[[ow]] ex[[clusionlist]]
cisco_wlc_ssh_show_ap_summary.template, .*, cisco_wlc_ssh, sh[[ow]] ap sum[[mary]]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
parsed_sample:
- ap_mgr: 'Yes'
guest: N/A
int_count: '3'
ip_addr: 192.168.1.11
name: management
port: '1'
type: Static
vlan: untagged
- ap_mgr: 'No'
guest: N/A
int_count: '3'
ip_addr: 11.1.1.1
name: service-port
port: N/A
type: Static
vlan: N/A
- ap_mgr: 'No'
guest: N/A
int_count: '3'
ip_addr: 1.1.1.1
name: virtual
port: N/A
type: Static
vlan: N/A
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@


Number of Interfaces.......................... 3

Interface Name Port Vlan Id IP Address Type Ap Mgr Guest
-------------------------------- ---- -------- --------------- ------- ------ -----
management 1 untagged 192.168.1.11 Static Yes N/A
service-port N/A N/A 11.1.1.1 Static No N/A
virtual N/A N/A 1.1.1.1 Static No N/A