From 6508bc8d4a444cea4b52f5ccd50002a92658fb5c Mon Sep 17 00:00:00 2001 From: eperpinya Date: Thu, 19 Dec 2024 12:51:32 +0100 Subject: [PATCH 1/3] In some versions of Alcatel AOS the command output is slighly different --- .../alcatel_aos_show_interfaces_port.textfsm | 21 +++++++-- .../alcatel_aos_show_interfaces_port_R6.yml | 8 ++++ .../alcatel_aos_show_interfaces_port_R6_2.raw | 8 ++++ .../alcatel_aos_show_interfaces_port_R6_2.yml | 46 +++++++++++++++++++ 4 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6_2.raw create mode 100644 tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6_2.yml diff --git a/ntc_templates/templates/alcatel_aos_show_interfaces_port.textfsm b/ntc_templates/templates/alcatel_aos_show_interfaces_port.textfsm index 70e30f49f9..9c5a2022fe 100644 --- a/ntc_templates/templates/alcatel_aos_show_interfaces_port.textfsm +++ b/ntc_templates/templates/alcatel_aos_show_interfaces_port.textfsm @@ -7,19 +7,30 @@ Value RECOVERY_TIME (\d+) Value RECOVERY_MAX (\d+) Value WTR_RUNNING (\#?) Value WTR_TIME (\d+) +Value WAIT_TO_SHUTDOWN (\d+) Value ALIAS (.*) Start - ^\s*-+\+ -> Table ^Legends: WTR - Wait To Restore ^\s+# ^\s+\* - ^\s*Slot/\s+Admin\s+Link\s+Violations\s+Recovery\s+Recovery\s+WTR\s+Alias\s*$$ - ^\s*Port\s+Status\s+Status\s+Time\s+Max\s+\(sec\)\s*$$ + ^\s+Chas\/\s*$$ + ^\s*Slot\/\s+Admin\s+Link\s+Violations\s+Recovery\s+Recovery\s+WTR\s+Alias\s*$$ + ^\s*Port\s+Status\s+Status\s+Time\s+Max\s+\(sec\)\s*$$ -> Table_1 + ^\s*Slot\/\s+Admin\s+Link\s+WTR\s+WTS\s+Alias\s*$$ + ^\s*Port\s+Status\s+Status\s+\(sec\)\s+\(msec\)\s*$$ -> Table_2 ^\s*$$ ^.*$$ -> Error -Table - ^\s*${PERMANENT_SHUTDOWN}${PORT}\s+${ADMIN_STATUS}\s+${LINK_STATUS}\s+${VIOLATIONS}\s+${RECOVERY_TIME}\s+${RECOVERY_MAX}\s+(?:${WTR_RUNNING}\s+)?${WTR_TIME}\s+"${ALIAS}"\s*$$ -> Record +Table_1 + ^\s*-+\s* + ^\s*${PERMANENT_SHUTDOWN}${PORT}\s+${ADMIN_STATUS}\s+${LINK_STATUS}\s+${VIOLATIONS}\s+${RECOVERY_TIME}\s+${RECOVERY_MAX}\s+${WTR_RUNNING}\s+${WTR_TIME}\s+"${ALIAS}"\s*$$ -> Record ^\s*$$ ^.*$$ -> Error + +Table_2 + ^\s*-+\s* + ^\s*${PERMANENT_SHUTDOWN}${PORT}\s+${ADMIN_STATUS}\s+${LINK_STATUS}\s+${WTR_TIME}\s+${WAIT_TO_SHUTDOWN}\s+"${ALIAS}"\s*$$ -> Record + ^\s*$$ + ^.*$$ -> Error + \ No newline at end of file diff --git a/tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6.yml b/tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6.yml index ce2ae5bc42..df7b00f39a 100644 --- a/tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6.yml +++ b/tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6.yml @@ -8,6 +8,7 @@ parsed_sample: recovery_max: "10" recovery_time: "300" violations: "none" + wait_to_shutdown: "" wtr_running: "" wtr_time: "0" - admin_status: "enable" @@ -18,6 +19,7 @@ parsed_sample: recovery_max: "10" recovery_time: "300" violations: "none" + wait_to_shutdown: "" wtr_running: "" wtr_time: "0" - admin_status: "enable" @@ -28,6 +30,7 @@ parsed_sample: recovery_max: "10" recovery_time: "300" violations: "none" + wait_to_shutdown: "" wtr_running: "#" wtr_time: "10" - admin_status: "disable" @@ -38,6 +41,7 @@ parsed_sample: recovery_max: "10" recovery_time: "300" violations: "none" + wait_to_shutdown: "" wtr_running: "" wtr_time: "0" - admin_status: "disable" @@ -48,6 +52,7 @@ parsed_sample: recovery_max: "10" recovery_time: "300" violations: "none" + wait_to_shutdown: "" wtr_running: "" wtr_time: "0" - admin_status: "enable" @@ -58,6 +63,7 @@ parsed_sample: recovery_max: "10" recovery_time: "300" violations: "none" + wait_to_shutdown: "" wtr_running: "" wtr_time: "0" - admin_status: "enable" @@ -68,6 +74,7 @@ parsed_sample: recovery_max: "10" recovery_time: "300" violations: "none" + wait_to_shutdown: "" wtr_running: "" wtr_time: "0" - admin_status: "enable" @@ -78,5 +85,6 @@ parsed_sample: recovery_max: "0" recovery_time: "0" violations: "none" + wait_to_shutdown: "" wtr_running: "" wtr_time: "0" diff --git a/tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6_2.raw b/tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6_2.raw new file mode 100644 index 0000000000..126447b2a6 --- /dev/null +++ b/tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6_2.raw @@ -0,0 +1,8 @@ + Chas/ + Slot/ Admin Link WTR WTS Alias + Port Status Status (sec) (msec) +--------+----------+---------+----------+----------+----------------------- + 1/1/1 enable up 0 0 "This is a test" + 1/1/2 enable up 0 0 "This_is_a_test" + 1/1/3 enable up 0 0 "This" + 1/1/4 enable up 0 0 "" \ No newline at end of file diff --git a/tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6_2.yml b/tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6_2.yml new file mode 100644 index 0000000000..ed4c605767 --- /dev/null +++ b/tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6_2.yml @@ -0,0 +1,46 @@ +--- +parsed_sample: + - admin_status: "enable" + alias: "This is a test" + link_status: "up" + permanent_shutdown: "" + port: "1/1/1" + recovery_max: "" + recovery_time: "" + violations: "" + wait_to_shutdown: "0" + wtr_running: "" + wtr_time: "0" + - admin_status: "enable" + alias: "This_is_a_test" + link_status: "up" + permanent_shutdown: "" + port: "1/1/2" + recovery_max: "" + recovery_time: "" + violations: "" + wait_to_shutdown: "0" + wtr_running: "" + wtr_time: "0" + - admin_status: "enable" + alias: "This" + link_status: "up" + permanent_shutdown: "" + port: "1/1/3" + recovery_max: "" + recovery_time: "" + violations: "" + wait_to_shutdown: "0" + wtr_running: "" + wtr_time: "0" + - admin_status: "enable" + alias: "" + link_status: "up" + permanent_shutdown: "" + port: "1/1/4" + recovery_max: "" + recovery_time: "" + violations: "" + wait_to_shutdown: "0" + wtr_running: "" + wtr_time: "0" From be55ec954be8573353126d52cfb692d1175c5e58 Mon Sep 17 00:00:00 2001 From: Jacob McGill <9847006+jmcgill298@users.noreply.github.com> Date: Thu, 19 Dec 2024 08:42:22 -0500 Subject: [PATCH 2/3] Apply suggestions from code review --- .../templates/alcatel_aos_show_interfaces_port.textfsm | 3 +-- .../alcatel_aos_show_interfaces_port_R6_2.raw | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ntc_templates/templates/alcatel_aos_show_interfaces_port.textfsm b/ntc_templates/templates/alcatel_aos_show_interfaces_port.textfsm index 9c5a2022fe..4ff5c248f1 100644 --- a/ntc_templates/templates/alcatel_aos_show_interfaces_port.textfsm +++ b/ntc_templates/templates/alcatel_aos_show_interfaces_port.textfsm @@ -32,5 +32,4 @@ Table_2 ^\s*-+\s* ^\s*${PERMANENT_SHUTDOWN}${PORT}\s+${ADMIN_STATUS}\s+${LINK_STATUS}\s+${WTR_TIME}\s+${WAIT_TO_SHUTDOWN}\s+"${ALIAS}"\s*$$ -> Record ^\s*$$ - ^.*$$ -> Error - \ No newline at end of file + ^.*$$ -> Error \ No newline at end of file diff --git a/tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6_2.raw b/tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6_2.raw index 126447b2a6..5176790d76 100644 --- a/tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6_2.raw +++ b/tests/alcatel_aos/show_interfaces_port/alcatel_aos_show_interfaces_port_R6_2.raw @@ -5,4 +5,4 @@ 1/1/1 enable up 0 0 "This is a test" 1/1/2 enable up 0 0 "This_is_a_test" 1/1/3 enable up 0 0 "This" - 1/1/4 enable up 0 0 "" \ No newline at end of file + 1/1/4 enable up 0 0 "" From d9d41af5099e21bc2de0a7ddbd9a69d4edb65cf3 Mon Sep 17 00:00:00 2001 From: Jacob McGill <9847006+jmcgill298@users.noreply.github.com> Date: Thu, 19 Dec 2024 08:42:41 -0500 Subject: [PATCH 3/3] Update ntc_templates/templates/alcatel_aos_show_interfaces_port.textfsm --- .../templates/alcatel_aos_show_interfaces_port.textfsm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntc_templates/templates/alcatel_aos_show_interfaces_port.textfsm b/ntc_templates/templates/alcatel_aos_show_interfaces_port.textfsm index 4ff5c248f1..adf0deda05 100644 --- a/ntc_templates/templates/alcatel_aos_show_interfaces_port.textfsm +++ b/ntc_templates/templates/alcatel_aos_show_interfaces_port.textfsm @@ -32,4 +32,4 @@ Table_2 ^\s*-+\s* ^\s*${PERMANENT_SHUTDOWN}${PORT}\s+${ADMIN_STATUS}\s+${LINK_STATUS}\s+${WTR_TIME}\s+${WAIT_TO_SHUTDOWN}\s+"${ALIAS}"\s*$$ -> Record ^\s*$$ - ^.*$$ -> Error \ No newline at end of file + ^.*$$ -> Error