From acbd8e87024db50220ebbb9622f929f53ac980db Mon Sep 17 00:00:00 2001 From: Anton Alekseev Date: Wed, 15 Sep 2021 21:55:58 +0300 Subject: [PATCH] Bugfix: change date format in hp_comware_display_clock.textfsm (#977) As per https://techhub.hpe.com/eginfolib/networking/docs/switches/5940/5200-1008b_fund_cr/content/491962772.htm output of the `display clock` commands output contains date in `MM/DD/YYYY` format. Can confirm this on different types of HPE switches I have at my disposal. Added test cases that cover the scenarios when time zone and daylight time saving configurations are set. --- ntc_templates/templates/hp_comware_display_clock.textfsm | 2 +- .../hp_comware/display_clock/hp_comware_display_clock.yml | 8 ++++---- .../display_clock/hp_comware_display_clock_1.raw | 1 + .../display_clock/hp_comware_display_clock_1.yml | 8 ++++++++ .../display_clock/hp_comware_display_clock_2.raw | 2 ++ .../display_clock/hp_comware_display_clock_2.yml | 8 ++++++++ .../display_clock/hp_comware_display_clock_3.raw | 3 +++ .../display_clock/hp_comware_display_clock_3.yml | 8 ++++++++ 8 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 tests/hp_comware/display_clock/hp_comware_display_clock_1.raw create mode 100644 tests/hp_comware/display_clock/hp_comware_display_clock_1.yml create mode 100644 tests/hp_comware/display_clock/hp_comware_display_clock_2.raw create mode 100644 tests/hp_comware/display_clock/hp_comware_display_clock_2.yml create mode 100644 tests/hp_comware/display_clock/hp_comware_display_clock_3.raw create mode 100644 tests/hp_comware/display_clock/hp_comware_display_clock_3.yml diff --git a/ntc_templates/templates/hp_comware_display_clock.textfsm b/ntc_templates/templates/hp_comware_display_clock.textfsm index 612c0d6bba..ae56893686 100644 --- a/ntc_templates/templates/hp_comware_display_clock.textfsm +++ b/ntc_templates/templates/hp_comware_display_clock.textfsm @@ -6,6 +6,6 @@ Value DAY (\d+) Value YEAR (\d+) Start - ^${TIME}\s+${TIMEZONE}\s+${DAYWEEK}\s+${DAY}/${MONTH}/${YEAR} -> Record + ^${TIME}\s+${TIMEZONE}\s+${DAYWEEK}\s+${MONTH}/${DAY}/${YEAR} -> Record diff --git a/tests/hp_comware/display_clock/hp_comware_display_clock.yml b/tests/hp_comware/display_clock/hp_comware_display_clock.yml index 84bfccbd97..d189e3b31c 100644 --- a/tests/hp_comware/display_clock/hp_comware_display_clock.yml +++ b/tests/hp_comware/display_clock/hp_comware_display_clock.yml @@ -1,8 +1,8 @@ --- parsed_sample: - - day: "01" - dayweek: "Sat" - month: "08" - time: "19:35:31" + - time: "19:35:31" timezone: "UTC" + dayweek: "Sat" + month: "01" + day: "08" year: "2011" diff --git a/tests/hp_comware/display_clock/hp_comware_display_clock_1.raw b/tests/hp_comware/display_clock/hp_comware_display_clock_1.raw new file mode 100644 index 0000000000..7146ad417a --- /dev/null +++ b/tests/hp_comware/display_clock/hp_comware_display_clock_1.raw @@ -0,0 +1 @@ +10:09:00 UTC Fri 03/16/2015 \ No newline at end of file diff --git a/tests/hp_comware/display_clock/hp_comware_display_clock_1.yml b/tests/hp_comware/display_clock/hp_comware_display_clock_1.yml new file mode 100644 index 0000000000..2b219c2025 --- /dev/null +++ b/tests/hp_comware/display_clock/hp_comware_display_clock_1.yml @@ -0,0 +1,8 @@ +--- +parsed_sample: + - time: "10:09:00" + timezone: "UTC" + dayweek: "Fri" + month: "03" + day: "16" + year: "2015" diff --git a/tests/hp_comware/display_clock/hp_comware_display_clock_2.raw b/tests/hp_comware/display_clock/hp_comware_display_clock_2.raw new file mode 100644 index 0000000000..7bc116bccc --- /dev/null +++ b/tests/hp_comware/display_clock/hp_comware_display_clock_2.raw @@ -0,0 +1,2 @@ +15:10:00 Z5 Fri 03/16/2015 +Time Zone : Z5 add 05:00:00 \ No newline at end of file diff --git a/tests/hp_comware/display_clock/hp_comware_display_clock_2.yml b/tests/hp_comware/display_clock/hp_comware_display_clock_2.yml new file mode 100644 index 0000000000..a63a153ea4 --- /dev/null +++ b/tests/hp_comware/display_clock/hp_comware_display_clock_2.yml @@ -0,0 +1,8 @@ +--- +parsed_sample: + - time: "15:10:00" + timezone: "Z5" + dayweek: "Fri" + month: "03" + day: "16" + year: "2015" diff --git a/tests/hp_comware/display_clock/hp_comware_display_clock_3.raw b/tests/hp_comware/display_clock/hp_comware_display_clock_3.raw new file mode 100644 index 0000000000..561e7fcf15 --- /dev/null +++ b/tests/hp_comware/display_clock/hp_comware_display_clock_3.raw @@ -0,0 +1,3 @@ +15:11:00 Z5 Fri 03/16/2015 +Time Zone : Z5 add 05:00:00 +Summer Time : PDT 06:00:00 08/01 06:00:00 09/01 01:00:00 diff --git a/tests/hp_comware/display_clock/hp_comware_display_clock_3.yml b/tests/hp_comware/display_clock/hp_comware_display_clock_3.yml new file mode 100644 index 0000000000..15a71d648d --- /dev/null +++ b/tests/hp_comware/display_clock/hp_comware_display_clock_3.yml @@ -0,0 +1,8 @@ +--- +parsed_sample: + - time: "15:11:00" + timezone: "Z5" + dayweek: "Fri" + month: "03" + day: "16" + year: "2015"