From d6ddcf68e4f7935f1dacdd834d400d2a48fdf9e9 Mon Sep 17 00:00:00 2001 From: rlt28368 Date: Thu, 7 Nov 2019 17:34:23 -0500 Subject: [PATCH 1/3] created new template cisco ios show environment temperature plus raw and parsed tested --- ..._ios_show_environment_temperature.template | 41 +++++++++++++++++++ templates/index | 1 + ...co_ios_show_environment_temperature.parsed | 13 ++++++ ...cisco_ios_show_environment_temperature.raw | 11 +++++ tox.ini | 2 +- 5 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 templates/cisco_ios_show_environment_temperature.template create mode 100644 tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.parsed create mode 100644 tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.raw diff --git a/templates/cisco_ios_show_environment_temperature.template b/templates/cisco_ios_show_environment_temperature.template new file mode 100644 index 0000000000..93bdaa475b --- /dev/null +++ b/templates/cisco_ios_show_environment_temperature.template @@ -0,0 +1,41 @@ +Value SWITCH (\d+) +Value SWITCH_TEMPERATURE (\w+) +Value INLET_TEMPERATURE_VALUE (\d+) +Value INLET_TEMPERATURE_STATE (\w+) +Value INLET_YELLOW_THRESHOLD (\d+) +Value INLET_RED_THRESHOLD (\d+) +Value HOTSPOT_TEMPERATURE_VALUE (\d+) +Value HOTSPOT_TEMPERATURE_STATE (\w+) +Value HOTSPOT_YELLOW_THRESHOLD (\d+) +Value HOTSPOT_RED_THRESHOLD (\d+) + +Start + ^Switch\s+${SWITCH}:\s+SYSTEM\s+TEMPERATURE\s+is\s+${SWITCH_TEMPERATURE}\s*$$ + ^Inlet\s+Temperature\s+Value:\s+${INLET_TEMPERATURE_VALUE}\s+Degree\s+Celsius\s*$$ -> Inlet + +Inlet + ^Temperature\s+State:\s+${INLET_TEMPERATURE_STATE}\s*$$ + ^Yellow\s+Threshold\s+:\s+${INLET_YELLOW_THRESHOLD}\s+Degree\s+Celsius\s*$$ + ^Red\s+Threshold\s+:\s+${INLET_RED_THRESHOLD}\s+Degree\s+Celsius\s*$$ -> Hotspot + +Hotspot + ^Hotspot\s+Temperature\s+Value:\s+${HOTSPOT_TEMPERATURE_VALUE}\s+Degree\s+Celsius\s*$$ + ^Temperature\s+State:\s+${HOTSPOT_TEMPERATURE_STATE}\s*$$ + ^Yellow\s+Threshold\s+:\s+${HOTSPOT_YELLOW_THRESHOLD}\s+Degree\s+Celsius\s*$$ + ^Red\s+Threshold\s+:\s+${HOTSPOT_RED_THRESHOLD}\s+Degree\s+Celsius\s*$$ -> Record Start + + + + + + + + + + + + + + + + diff --git a/templates/index b/templates/index index fe7be26c5e..9727225cfe 100644 --- a/templates/index +++ b/templates/index @@ -134,6 +134,7 @@ cisco_ios_show_running-config_partition_access-list.template, .*, cisco_ios, sh[ cisco_ios_show_running-config_partition_route-map.template, .*, cisco_ios, sh[[ow]] ru[[nning-config]] p[[artition]] route-[[map]] cisco_ios_show_capability_feature_routing.template, .*, cisco_ios, sh[[ow]] cap[[ability]] f[[eature]] r[[outing]] cisco_ios_show_authentication_sessions.template, .*, cisco_ios, show authen[[tication]] ses[[sions]] +cisco_ios_show_environment_temperature.template, .*, cisco_ios, sh[[ow]] envi[[ronment]] t[[emperature]] cisco_ios_show_ip_ospf_interface_brief.template, .*, cisco_ios, sh[[ow]] ip ospf int[[erface]] cisco_ios_show_processes_memory_sorted.template, .*, cisco_ios, sh[[ow]] pro[[cesses]] mem[[ory]] so[[rted]] cisco_ios_show_interfaces_description.template, .*, cisco_ios, sh[[ow]] int[[erfaces]] des[[cription]] diff --git a/tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.parsed b/tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.parsed new file mode 100644 index 0000000000..3890ca1311 --- /dev/null +++ b/tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.parsed @@ -0,0 +1,13 @@ +--- +parsed_sample: + +- switch: '1' + switch_temperature: OK + inlet_temperature_value: '28' + inlet_temperature_state: GREEN + inlet_yellow_threshold: '46' + inlet_red_threshold: '56' + hotspot_temperature_value: '68' + hotspot_temperature_state: GREEN + hotspot_yellow_threshold: '105' + hotspot_red_threshold: '125' diff --git a/tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.raw b/tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.raw new file mode 100644 index 0000000000..4d17855a2d --- /dev/null +++ b/tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.raw @@ -0,0 +1,11 @@ +Switch 1: SYSTEM TEMPERATURE is OK +Inlet Temperature Value: 28 Degree Celsius +Temperature State: GREEN +Yellow Threshold : 46 Degree Celsius +Red Threshold : 56 Degree Celsius + +Hotspot Temperature Value: 68 Degree Celsius +Temperature State: GREEN +Yellow Threshold : 105 Degree Celsius +Red Threshold : 125 Degree Celsius + diff --git a/tox.ini b/tox.ini index d3e8c1f0a4..733a7e5b3a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py36 +envlist = py37 [testenv] deps = From 56c405b8ff8084a8838edf85b8c8d72fd62085de Mon Sep 17 00:00:00 2001 From: rlt28368 Date: Mon, 11 Nov 2019 15:57:07 -0500 Subject: [PATCH 2/3] Fixed several items based on feedback. Fixes: 1. Changed tox back to 36, 2. Added error checking but in order for it to work I moved inlet temp to Inlet, 3. Changed \w to \S, etc. --- ..._ios_show_environment_temperature.template | 31 +++++++------------ ...co_ios_show_environment_temperature.parsed | 31 ++++++++++++------- ...cisco_ios_show_environment_temperature.raw | 13 ++++++-- tox.ini | 2 +- 4 files changed, 43 insertions(+), 34 deletions(-) diff --git a/templates/cisco_ios_show_environment_temperature.template b/templates/cisco_ios_show_environment_temperature.template index 93bdaa475b..0d0b390281 100644 --- a/templates/cisco_ios_show_environment_temperature.template +++ b/templates/cisco_ios_show_environment_temperature.template @@ -1,41 +1,32 @@ Value SWITCH (\d+) Value SWITCH_TEMPERATURE (\w+) Value INLET_TEMPERATURE_VALUE (\d+) -Value INLET_TEMPERATURE_STATE (\w+) +Value INLET_TEMPERATURE_STATE (\S+) Value INLET_YELLOW_THRESHOLD (\d+) Value INLET_RED_THRESHOLD (\d+) Value HOTSPOT_TEMPERATURE_VALUE (\d+) -Value HOTSPOT_TEMPERATURE_STATE (\w+) +Value HOTSPOT_TEMPERATURE_STATE (\S+) Value HOTSPOT_YELLOW_THRESHOLD (\d+) Value HOTSPOT_RED_THRESHOLD (\d+) Start - ^Switch\s+${SWITCH}:\s+SYSTEM\s+TEMPERATURE\s+is\s+${SWITCH_TEMPERATURE}\s*$$ - ^Inlet\s+Temperature\s+Value:\s+${INLET_TEMPERATURE_VALUE}\s+Degree\s+Celsius\s*$$ -> Inlet + ^Switch\s+\d -> Continue.Record + ^Switch\s+${SWITCH}:\s+SYSTEM\s+TEMPERATURE\s+is\s+${SWITCH_TEMPERATURE}\s*$$ -> Inlet + ^\s*$$ + ^. -> Error Inlet + ^Inlet\s+Temperature\s+Value:\s+${INLET_TEMPERATURE_VALUE}\s+Degree\s+Celsius\s*$$ ^Temperature\s+State:\s+${INLET_TEMPERATURE_STATE}\s*$$ ^Yellow\s+Threshold\s+:\s+${INLET_YELLOW_THRESHOLD}\s+Degree\s+Celsius\s*$$ ^Red\s+Threshold\s+:\s+${INLET_RED_THRESHOLD}\s+Degree\s+Celsius\s*$$ -> Hotspot + ^\s*$$ + ^. -> Error Hotspot ^Hotspot\s+Temperature\s+Value:\s+${HOTSPOT_TEMPERATURE_VALUE}\s+Degree\s+Celsius\s*$$ ^Temperature\s+State:\s+${HOTSPOT_TEMPERATURE_STATE}\s*$$ ^Yellow\s+Threshold\s+:\s+${HOTSPOT_YELLOW_THRESHOLD}\s+Degree\s+Celsius\s*$$ ^Red\s+Threshold\s+:\s+${HOTSPOT_RED_THRESHOLD}\s+Degree\s+Celsius\s*$$ -> Record Start - - - - - - - - - - - - - - - - + ^\s*$$ + ^. -> Error diff --git a/tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.parsed b/tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.parsed index 3890ca1311..4e3185bae3 100644 --- a/tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.parsed +++ b/tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.parsed @@ -1,13 +1,22 @@ --- parsed_sample: - -- switch: '1' - switch_temperature: OK - inlet_temperature_value: '28' - inlet_temperature_state: GREEN - inlet_yellow_threshold: '46' - inlet_red_threshold: '56' - hotspot_temperature_value: '68' - hotspot_temperature_state: GREEN - hotspot_yellow_threshold: '105' - hotspot_red_threshold: '125' +- hotspot_red_threshold: '125' + hotspot_temperature_state: GREEN + hotspot_temperature_value: '67' + hotspot_yellow_threshold: '105' + inlet_red_threshold: '56' + inlet_temperature_state: GREEN + inlet_temperature_value: '29' + inlet_yellow_threshold: '46' + switch: '1' + switch_temperature: OK +- hotspot_red_threshold: '125' + hotspot_temperature_state: GREEN + hotspot_temperature_value: '69' + hotspot_yellow_threshold: '105' + inlet_red_threshold: '56' + inlet_temperature_state: GREEN + inlet_temperature_value: '28' + inlet_yellow_threshold: '46' + switch: '2' + switch_temperature: OK diff --git a/tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.raw b/tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.raw index 4d17855a2d..1457dab252 100644 --- a/tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.raw +++ b/tests/cisco_ios/show_environment_temperature/cisco_ios_show_environment_temperature.raw @@ -1,11 +1,20 @@ Switch 1: SYSTEM TEMPERATURE is OK -Inlet Temperature Value: 28 Degree Celsius +Inlet Temperature Value: 29 Degree Celsius Temperature State: GREEN Yellow Threshold : 46 Degree Celsius Red Threshold : 56 Degree Celsius -Hotspot Temperature Value: 68 Degree Celsius +Hotspot Temperature Value: 67 Degree Celsius Temperature State: GREEN Yellow Threshold : 105 Degree Celsius Red Threshold : 125 Degree Celsius +Switch 2: SYSTEM TEMPERATURE is OK +Inlet Temperature Value: 28 Degree Celsius +Temperature State: GREEN +Yellow Threshold : 46 Degree Celsius +Red Threshold : 56 Degree Celsius +Hotspot Temperature Value: 69 Degree Celsius +Temperature State: GREEN +Yellow Threshold : 105 Degree Celsius +Red Threshold : 125 Degree Celsius \ No newline at end of file diff --git a/tox.ini b/tox.ini index 733a7e5b3a..d3e8c1f0a4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py37 +envlist = py36 [testenv] deps = From 7760e2134573602f6b307dca7391a92b047bf907 Mon Sep 17 00:00:00 2001 From: rlt28368 Date: Tue, 12 Nov 2019 10:05:38 -0500 Subject: [PATCH 3/3] Removed Record from the end of L30 and just left Start --- templates/cisco_ios_show_environment_temperature.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cisco_ios_show_environment_temperature.template b/templates/cisco_ios_show_environment_temperature.template index 0d0b390281..75ecfd7f91 100644 --- a/templates/cisco_ios_show_environment_temperature.template +++ b/templates/cisco_ios_show_environment_temperature.template @@ -27,6 +27,6 @@ Hotspot ^Hotspot\s+Temperature\s+Value:\s+${HOTSPOT_TEMPERATURE_VALUE}\s+Degree\s+Celsius\s*$$ ^Temperature\s+State:\s+${HOTSPOT_TEMPERATURE_STATE}\s*$$ ^Yellow\s+Threshold\s+:\s+${HOTSPOT_YELLOW_THRESHOLD}\s+Degree\s+Celsius\s*$$ - ^Red\s+Threshold\s+:\s+${HOTSPOT_RED_THRESHOLD}\s+Degree\s+Celsius\s*$$ -> Record Start + ^Red\s+Threshold\s+:\s+${HOTSPOT_RED_THRESHOLD}\s+Degree\s+Celsius\s*$$ -> Start ^\s*$$ ^. -> Error