Skip to content
Open
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
10 changes: 6 additions & 4 deletions ntc_templates/templates/hp_procurve_show_system.textfsm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Value Filldown NAME (\S+)
Value Filldown CONTACT (.+)
Value Filldown LOCATION (.+)
Value Filldown CONTACT (.*)
Value Filldown LOCATION (.*)
Value Filldown MAC_AGE (\d+)
Value Filldown TIMEZONE (\S+)
Value Filldown DAYLIGHT_RULE (\S+)
Expand All @@ -24,8 +24,8 @@ Value BUFFERS_MISSED (\d+)
Start
^.*Status\s+and\s+Counters
^\s*System\s+Name\s+:\s+${NAME}
^\s*System\s+Contact\s+:\s+${CONTACT}
^\s*System\s+Location\s+:\s+${LOCATION}
^\s*System\s+Contact\s+:\s*${CONTACT}
^\s*System\s+Location\s+:\s*${LOCATION}
^\s*MAC\s+Age\s+Time[^:]*:\s+${MAC_AGE}
^\s*Time\s+Zone\s+:\s+${TIMEZONE}
^\s*Daylight\s+Time\s+Rule\s+:\s+${DAYLIGHT_RULE}
Expand All @@ -42,6 +42,8 @@ Start
^\s*Missed\s+:\s+${BUFFERS_MISSED} -> Record
^\s*VSF-Member\s*: -> Continue.Record
^\s*VSF-Member\s*:\s*${MEMBER_ID} -> VSF
# swallow wrap-continuation lines (long contact/location wrap at col 78)
^\s+\S.*$$
Comment on lines +45 to +46
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hmm, putting the location in the contact field (which is in the location field) is redundant. In my eyes these are self-induced problems.

From the test data, I see why you have this regex. The trade-off and risk is that this will match most lines. ⚠️

@julmanglano Is there a legitimate reason why the location is also in the System Contact?

I'll ping other maintainers for some feedback.

One item that comes to my mind is to state transition for System Contact and cover it and System Location with this loose regex. Once those two are handled in that new state, then state transition back to Start state. This way we should reduce the risk of over-matching lines because of this Contact/Location stuff.

^. -> Error

VSF
Expand Down
47 changes: 47 additions & 0 deletions tests/hp_procurve/show_system/hp_procurve_show_system3.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Status and Counters - General System Information

System Name : SWITCH-2
System Contact : Network Operations Center (network-operations@example.c
om) location Building-3 Datacenter-Aisle-12 Rack-04 ABC
-ACCS1
System Location : Building-3 Datacenter-Aisle-12
MAC Age Time (sec) : 300
Time Zone : 0
Daylight Time Rule : None

Software revision : WC.16.10.0014
Base MAC Addr : 548028-aabbd0

VSF-Member :1

ROM Version : WC.16.01.0008
Up Time : 458 days
CPU Util (%) : 5
MAC Addr : 548028-aabbd1
Serial Number : SN0000003A
Memory - Total : 338,285,056
Free : 216,978,364



VSF-Member :2

ROM Version : WC.16.01.0008
Up Time : 458 days
CPU Util (%) : 25
MAC Addr : 548028-aabbd2
Serial Number : SN0000004A
Memory - Total : 338,285,056
Free : 233,762,648



VSF-Member :3

ROM Version : WC.16.01.0008
Up Time : 458 days
CPU Util (%) : 0
MAC Addr : 548028-aabbd3
Serial Number : SN0000005A
Memory - Total : 338,285,056
Free : 247,712,468
68 changes: 68 additions & 0 deletions tests/hp_procurve/show_system/hp_procurve_show_system3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
parsed_sample:
- allow_mods: ""
buffers_free: ""
buffers_lowest: ""
buffers_missed: ""
contact: "Network Operations Center (network-operations@example.c"
cpu_util: "5"
daylight_rule: "None"
location: "Building-3 Datacenter-Aisle-12"
mac_address: "548028-aabbd1"
mac_age: "300"
mem_free: "216,978,364"
mem_tot: "338,285,056"
member_id: "1"
name: "SWITCH-2"
packets_rx: ""
packets_tot: ""
packets_tx: ""
rom_version: "WC.16.01.0008"
serial: "SN0000003A"
software_version: "WC.16.10.0014"
timezone: "0"
uptime: "458 days"
- allow_mods: ""
buffers_free: ""
buffers_lowest: ""
buffers_missed: ""
contact: "Network Operations Center (network-operations@example.c"
cpu_util: "25"
daylight_rule: "None"
location: "Building-3 Datacenter-Aisle-12"
mac_address: "548028-aabbd2"
mac_age: "300"
mem_free: "233,762,648"
mem_tot: "338,285,056"
member_id: "2"
name: "SWITCH-2"
packets_rx: ""
packets_tot: ""
packets_tx: ""
rom_version: "WC.16.01.0008"
serial: "SN0000004A"
software_version: "WC.16.10.0014"
timezone: "0"
uptime: "458 days"
- allow_mods: ""
buffers_free: ""
buffers_lowest: ""
buffers_missed: ""
contact: "Network Operations Center (network-operations@example.c"
cpu_util: "0"
daylight_rule: "None"
location: "Building-3 Datacenter-Aisle-12"
mac_address: "548028-aabbd3"
mac_age: "300"
mem_free: "247,712,468"
mem_tot: "338,285,056"
member_id: "3"
name: "SWITCH-2"
packets_rx: ""
packets_tot: ""
packets_tx: ""
rom_version: "WC.16.01.0008"
serial: "SN0000005A"
software_version: "WC.16.10.0014"
timezone: "0"
uptime: "458 days"
Loading