Skip to content

Commit

Permalink
add case for equal minpoll and maxpoll
Browse files Browse the repository at this point in the history
  • Loading branch information
bsun-sudo committed Nov 26, 2023
1 parent 7cfa9c9 commit edafc91
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,9 @@
},
"NTP_SERVER": {
"0.debian.pool.ntp.org": {},
"23.92.29.245": {},
"23.92.29.245": {
"minpoll": "8",
"maxpoll": "8"},
"2001:aa:aa::aa": {},
"122.22.22.22": {
"minpoll": "7",
Expand Down
3 changes: 3 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/ntp.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
"NTP_SERVER_WITH_MINPOLL_MAX_MAXPOLL": {
"desc": "CONFIGURE NTP SERVER WITH MAX VALUE FOR MAXPOLL."
},
"NTP_SERVER_WITH_EQUAL_MINPOLL_MAXPOLL": {
"desc: "CONFIGURE NTP SERVER WITH EQUAL MINPOLL AND MAXPOLL."
},
"NTP_SERVER_NEG_WITHOUT_MINPOLL": {
"desc": "CONFIGURE NTP SERVER WITH MAXPOLL BUT WITHOUT MINPOLL."
},
Expand Down
13 changes: 13 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests_config/ntp.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,19 @@
}
}
},
"NTP_SERVER_WITH_EQUAL_MINPOLL_MAXPOLL": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP_SERVER": {
"NTP_SERVER_LIST": [
{
"server_address": "10.11.12.13",
"minpoll": "8",
"maxpoll": "8"
}
]
}
}
},
"NTP_SERVER_NEG_WITHOUT_MINPOLL": {
"sonic-ntp:sonic-ntp": {
"sonic-ntp:NTP_SERVER": {
Expand Down
8 changes: 4 additions & 4 deletions src/sonic-yang-models/yang-models/sonic-ntp.yang
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ module sonic-ntp {
}

leaf minpoll {
must "(current()/../maxpoll > current())" {
error-message "maxpoll has to be larger than minpoll.";
must "(current()/../maxpoll >= current())" {
error-message "maxpoll has to be larger than or equal to minpoll.";
}
default 6;
type uint8 {
Expand All @@ -128,8 +128,8 @@ module sonic-ntp {
}

leaf maxpoll {
must "(current()/../minpoll < current())" {
error-message "maxpoll has to be larger than minpoll.";
must "(current()/../minpoll <= current())" {
error-message "maxpoll has to be larger than or equal to minpoll.";
}
default 10;
type uint8 {
Expand Down

0 comments on commit edafc91

Please sign in to comment.