Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NTP] Update tests for new NTP configuration #10749

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions tests/generic_config_updater/test_ntp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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(
Expand Down Expand Up @@ -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)
Expand All @@ -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(
Expand Down