From 355f5571f61f0fc85cb5c8ea3961fce89049f68c Mon Sep 17 00:00:00 2001 From: Yevhen Fastiuk Date: Thu, 16 Nov 2023 00:28:11 +0200 Subject: [PATCH] Update tests for new NTP configuration --- tests/generic_config_updater/test_ntp.py | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/generic_config_updater/test_ntp.py b/tests/generic_config_updater/test_ntp.py index 137f0d154e..310c6dae18 100644 --- a/tests/generic_config_updater/test_ntp.py +++ b/tests/generic_config_updater/test_ntp.py @@ -103,6 +103,20 @@ def ntp_server_tc1_add_config(duthost): """ Test to add NTP_SERVER config """ json_patch = [ + { + "op": "add", + "path": "/NTP_SERVER", + "value": { + NTP_SERVER_INIT: { + "resolve_as": NTP_SERVER_INIT, + "association_type": "server", + "iburst": "on" + } + } + } + ] + + json_patch_bc = [ { "op": "add", "path": "/NTP_SERVER", @@ -118,6 +132,8 @@ def ntp_server_tc1_add_config(duthost): try: start_time = datetime.datetime.now() output = apply_patch(duthost, json_data=json_patch, dest_file=tmpfile) + if output['rc'] != 0: + output = apply_patch(duthost, json_data=json_patch_bc, dest_file=tmpfile) expect_op_success(duthost, output) pytest_assert( @@ -169,6 +185,22 @@ def ntp_server_tc1_replace(duthost): """ Test to replace ntp server """ json_patch = [ + { + "op": "remove", + "path": "/NTP_SERVER/{}".format(NTP_SERVER_INIT) + }, + { + "op": "add", + "path": "/NTP_SERVER/{}".format(NTP_SERVER_DUMMY), + "value": { + "resolve_as": NTP_SERVER_DUMMY, + "association_type": "server", + "iburst": "on" + } + } + ] + + json_patch_bc = [ { "op": "remove", "path": "/NTP_SERVER/{}".format(NTP_SERVER_INIT) @@ -186,6 +218,8 @@ def ntp_server_tc1_replace(duthost): try: start_time = datetime.datetime.now() output = apply_patch(duthost, json_data=json_patch, dest_file=tmpfile) + if output['rc'] != 0: + output = apply_patch(duthost, json_data=json_patch_bc, dest_file=tmpfile) expect_op_success(duthost, output) pytest_assert(