From ec50b8036797a53b9740aeb6f86a341c2d0dcaed Mon Sep 17 00:00:00 2001 From: pskliarenko <“pskliarenko@bsh.ru”> Date: Mon, 11 Sep 2023 12:31:14 +0400 Subject: [PATCH 1/3] Template + test --- .../templates/cisco_s300_show_system.textfsm | 21 +++++++++++++++++++ ntc_templates/templates/index | 1 + .../show_system/cisco_s300_show_system.raw | 10 +++++++++ .../show_system/cisco_s300_show_system.yml | 12 +++++++++++ 4 files changed, 44 insertions(+) create mode 100644 ntc_templates/templates/cisco_s300_show_system.textfsm create mode 100644 tests/cisco_s300/show_system/cisco_s300_show_system.raw create mode 100644 tests/cisco_s300/show_system/cisco_s300_show_system.yml diff --git a/ntc_templates/templates/cisco_s300_show_system.textfsm b/ntc_templates/templates/cisco_s300_show_system.textfsm new file mode 100644 index 0000000000..6b2f992423 --- /dev/null +++ b/ntc_templates/templates/cisco_s300_show_system.textfsm @@ -0,0 +1,21 @@ +Value DESCRIPTION (.*) +Value UP_TIME (.*) +Value CONTACT (.*) +Value HOSTNAME (.*) +Value List LOCATION (.*) +Value ADDRESS (.*) +Value OID (.*) +Value FANS_STATUS (.*) + +Start + ^\s*System\s+Description:\s*${DESCRIPTION}\s*$$ + ^\s*System\s+Up\s+Time\s+\(days,hour:min:sec\):\s*${UP_TIME}\s*$$ + ^\s*System\s+Contact:\s*${CONTACT}\s*$$ + ^\s*System\s+Name:\s*${HOSTNAME}\s*$$ + ^\s*System\s+MAC\s+Address:\s*${ADDRESS}\s*$$ + ^\s*System\s+Object\s+ID:\s*${OID}\s*$$ + ^\s*Fans\s+Status:\s*${FANS_STATUS}\s*$$ + ^\s*System\s+Location:\s*${LOCATION}\s*$$ + ^\s*$$ + ^\s*${LOCATION}\s*$$ + ^. -> Error diff --git a/ntc_templates/templates/index b/ntc_templates/templates/index index 3a5b516184..4a46ac4148 100644 --- a/ntc_templates/templates/index +++ b/ntc_templates/templates/index @@ -380,6 +380,7 @@ cisco_s300_show_interfaces_status.textfsm, .*, cisco_s300, sh[[ow]] int[[erfaces cisco_s300_show_mac_address-table.textfsm, .*, cisco_s300, sh[[ow]] mac address-[[table]] cisco_s300_show_lldp_neighbors.textfsm, .*, cisco_s300, sh[[ow]] lld[[p]] neig[[hbors]] cisco_s300_show_version.textfsm, .*, cisco_s300, sh[[ow]] ver[[sion]] +cisco_s300_show_system.textfsm, .*, cisco_s300, sh[[ow]] system cisco_wlc_ssh_show_flexconnect_group_summary.textfsm, .*, cisco_wlc_ssh, sh[[ow]] fl[[exconnect]] gr[[oup]] s[[ummary]] cisco_wlc_ssh_show_advanced_802.11a_channel.textfsm, .*, cisco_wlc_ssh, sh[[ow]] ad[[vanced]] 802\.11[ab] ch[[annel]] diff --git a/tests/cisco_s300/show_system/cisco_s300_show_system.raw b/tests/cisco_s300/show_system/cisco_s300_show_system.raw new file mode 100644 index 0000000000..946cb8cf92 --- /dev/null +++ b/tests/cisco_s300/show_system/cisco_s300_show_system.raw @@ -0,0 +1,10 @@ +System Description: 24-Port 10/100 PoE Managed Switch +System Up Time (days,hour:min:sec): 70,03:16:47 +System Contact: +7(495)363-06-75 +System Name: ZOO-SF300-POE-2 +System Location: Moscow, Zoologicheskaya street, room + 11 +System MAC Address: 34:bd:c8:36:2a:41 +System Object ID: 1.3.6.1.4.1.9.6.1.82.24.2 + +Fans Status: OK diff --git a/tests/cisco_s300/show_system/cisco_s300_show_system.yml b/tests/cisco_s300/show_system/cisco_s300_show_system.yml new file mode 100644 index 0000000000..a26a4441f3 --- /dev/null +++ b/tests/cisco_s300/show_system/cisco_s300_show_system.yml @@ -0,0 +1,12 @@ +--- +parsed_sample: + - address: "34:bd:c8:36:2a:41" + contact: "+7(495)363-06-75" + description: "24-Port 10/100 PoE Managed Switch" + fans_status: "OK" + hostname: "ZOO-SF300-POE-2" + location: + - "Moscow, Zoologicheskaya street, room" + - "11" + oid: "1.3.6.1.4.1.9.6.1.82.24.2" + up_time: "70,03:16:47" From bed38b054eb8d65c03405430dfb6857458f80e99 Mon Sep 17 00:00:00 2001 From: PavloSkliarenko <78343937+PavloSkliarenko@users.noreply.github.com> Date: Mon, 6 Nov 2023 19:18:27 +0400 Subject: [PATCH 2/3] Update ntc_templates/templates/cisco_s300_show_system.textfsm Co-authored-by: Josh VanDeraa --- ntc_templates/templates/cisco_s300_show_system.textfsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntc_templates/templates/cisco_s300_show_system.textfsm b/ntc_templates/templates/cisco_s300_show_system.textfsm index 6b2f992423..905847651d 100644 --- a/ntc_templates/templates/cisco_s300_show_system.textfsm +++ b/ntc_templates/templates/cisco_s300_show_system.textfsm @@ -3,7 +3,7 @@ Value UP_TIME (.*) Value CONTACT (.*) Value HOSTNAME (.*) Value List LOCATION (.*) -Value ADDRESS (.*) +Value MAC_ADDRESS (.*) Value OID (.*) Value FANS_STATUS (.*) From c8f833cbaa175faf067a1d4d8c3d93de603fc93f Mon Sep 17 00:00:00 2001 From: pskliarenko <“pskliarenko@bsh.ru”> Date: Mon, 6 Nov 2023 19:20:18 +0400 Subject: [PATCH 3/3] Fix value names --- ntc_templates/templates/cisco_s300_show_system.textfsm | 2 +- tests/cisco_s300/show_system/cisco_s300_show_system.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ntc_templates/templates/cisco_s300_show_system.textfsm b/ntc_templates/templates/cisco_s300_show_system.textfsm index 905847651d..ac5c03b884 100644 --- a/ntc_templates/templates/cisco_s300_show_system.textfsm +++ b/ntc_templates/templates/cisco_s300_show_system.textfsm @@ -12,7 +12,7 @@ Start ^\s*System\s+Up\s+Time\s+\(days,hour:min:sec\):\s*${UP_TIME}\s*$$ ^\s*System\s+Contact:\s*${CONTACT}\s*$$ ^\s*System\s+Name:\s*${HOSTNAME}\s*$$ - ^\s*System\s+MAC\s+Address:\s*${ADDRESS}\s*$$ + ^\s*System\s+MAC\s+Address:\s*${MAC_ADDRESS}\s*$$ ^\s*System\s+Object\s+ID:\s*${OID}\s*$$ ^\s*Fans\s+Status:\s*${FANS_STATUS}\s*$$ ^\s*System\s+Location:\s*${LOCATION}\s*$$ diff --git a/tests/cisco_s300/show_system/cisco_s300_show_system.yml b/tests/cisco_s300/show_system/cisco_s300_show_system.yml index a26a4441f3..5160caf4ee 100644 --- a/tests/cisco_s300/show_system/cisco_s300_show_system.yml +++ b/tests/cisco_s300/show_system/cisco_s300_show_system.yml @@ -1,6 +1,6 @@ --- parsed_sample: - - address: "34:bd:c8:36:2a:41" + - mac_address: "34:bd:c8:36:2a:41" contact: "+7(495)363-06-75" description: "24-Port 10/100 PoE Managed Switch" fans_status: "OK"