networktocode/ntc-templates

Inconsistent use of `\s*` vs. `\s+` for cisco_wlc_ssh_show_redundancy_summary

Closed this issue · 0 comments

ISSUE TYPE
  • Template Issue with error and raw data
TEMPLATE USING
Value REDUNDANCY_MODE (\S+\s+\S+)
Value LOCAL_STATE (\S+)
Value PEER_STATE (\S+\s+\S+)
Value UNIT (\S+)
Value UNIT_ID (([\da-fA-F]{2}\:?){6})
Value REDUNDANCY_STATE (\S+)
Value MOBILITY_MAC (([\da-fA-F]{2}\:?){6})
Value REDUNDANCY_PORT (\S+)
Value BULKSYNC_STATUS (\S+)
Value AVG_REDUNDANCY_PEER_LATENCY (\d+)
Value AVG_MGMT_GW_LATENCY (\d+)

Start
  ^\s+Redundancy Mode\s+=\s+${REDUNDANCY_MODE}\s*$$
  ^\s+Local State\s+=\s+${LOCAL_STATE}\s*$$
  ^\s+Peer State\s+=\s+${PEER_STATE}\s*$$
  ^\s+Unit\s+=\s+${UNIT}\s*$$
  ^\s+Unit ID\s+=\s+${UNIT_ID}\s*$$
  ^\s+Redundancy State\s+=\s+${REDUNDANCY_STATE}\s*$$
  ^\s+Mobility MAC\s+=\s+${MOBILITY_MAC}\s*$$
  ^\s+Redundancy Port\s+=\s+${REDUNDANCY_PORT}\s*$$
  ^\s+BulkSync Status\s+=\s+${BULKSYNC_STATUS}\s*$$
  ^\s*Average Redundancy Peer Reachability Latency\s+=\s+${AVG_REDUNDANCY_PEER_LATENCY}\s+\S+\s+Seconds\s*$$
  ^\s*Average Management Gateway Reachability Latency\s+=\s+${AVG_MGMT_GW_LATENCY}\s+\S+\s+Seconds\s*$$
SAMPLE COMMAND OUTPUT
Redundancy Mode = SSO ENABLED 
Local State = ACTIVE 
Peer State = STANDBY HOT 
Unit = Primary
Unit ID = 00:00:00:00:12:34
Redundancy State = SSO
Mobility MAC = 00:00:00:00:12:34
Redundancy Port  = UP
BulkSync Status = Complete
Average Redundancy Peer Reachability Latency = 199 Micro Seconds
Average Management Gateway Reachability Latency = 570 Micro Seconds
SUMMARY

Some versions of WLC and terminal length/width configurations change if the output is indented or not. Template should be migrated from ^\s+ to ^\s* to account for 0 to N whitespace at the beginning of a new line from 1 to N whitespace.

STEPS TO REPRODUCE

Use Template to attempt to parse above output that is not indented.

EXPECTED RESULTS

Output parsed and a payload returned

ACTUAL RESULTS

Empty list returned

[]