Skip to content

Modify click ntp add command to include minpoll & maxpoll for a ntp server configuration#2964

Closed
bsun-sudo wants to merge 5 commits intosonic-net:masterfrom
bsun-sudo:master
Closed

Modify click ntp add command to include minpoll & maxpoll for a ntp server configuration#2964
bsun-sudo wants to merge 5 commits intosonic-net:masterfrom
bsun-sudo:master

Conversation

@bsun-sudo
Copy link
Contributor

What I did

Modify click ntp add command to include minpoll & maxpoll for NTP server configuration.

How I did it

In configi/main.py ntp add command, add the optional "minpoll maxpoll " arguments. When not provided, the default values for minpoll(6) and maxpoll(10) will be used.
In show/main.py "show runningconfig ntp" output, add the "minpoll" and "maxpoll" info.

How to verify it

Issue "config ntp add" command with and without the optional minpoll&maxpoll arguments.
Issue "show runningconfig ntp" command.

Previous command output (if the output of a command-line utility has changed)

root@sonic:/usr/local/lib/python3.9/dist-packages/show# config ntp add 10.10.10.10
NTP server 10.10.10.10 added to configuration
Restarting ntp-config service...
root@sonic:/usr/local/lib/python3.9/dist-packages/show#
root@sonic:/usr/local/lib/python3.9/dist-packages/show#
root@sonic:/usr/local/lib/python3.9/dist-packages/show# show runningconfiguration ntp
NTP Servers
-------------
10.10.10.10

New command output (if the output of a command-line utility has changed)

  • configure ntp server without optional minpoll/maxpoll params
root@sonic:/usr/local/lib/python3.9/dist-packages/config# config ntp add 10.10.10.10
NTP server 10.10.10.10 minpoll 6 maxpoll 10 added to configuration
Restarting ntp-config service...

root@sonic:/usr/local/lib/python3.9/dist-packages/show# show runningconfiguration ntp
NTP Servers
--------------------------------
10.10.10.10 minpoll 6 maxpoll 10

  • configure ntp server with minpoll and maxpoll
root@sonic:/usr/local/lib/python3.9/dist-packages/config# config ntp add 11.11.11.11 minpoll 4 maxpoll 5
NTP server 11.11.11.11 minpoll 4 maxpoll 5 added to configuration
Restarting ntp-config service...
root@sonic:/usr/local/lib/python3.9/dist-packages/config# show runningconfiguration ntp
NTP Servers
--------------------------------
10.10.10.10 minpoll 6 maxpoll 10
11.11.11.11 minpoll 4 maxpoll 5

-modify ntp server with valid minpoll and maxpoll

root@sonic:/usr/local/lib/python3.9/dist-packages/config# config ntp add 11.11.11.11 minpoll 10 maxpoll 12
NTP server 11.11.11.11 minpoll 10 maxpoll 12 added to configuration
Restarting ntp-config service...
root@sonic:/usr/local/lib/python3.9/dist-packages/config# show runningconfiguration ntp
NTP Servers
---------------------------------
10.10.10.10 minpoll 6 maxpoll 10
11.11.11.11 minpoll 10 maxpoll 12
  • add ntp server with invalid minpoll / maxpoll
root@sonic:/usr/local/lib/python3.9/dist-packages/config# config ntp add 12.12.12.12 minpoll 2 maxpoll 12
Usage: config ntp add [OPTIONS] <ntp_ip_address> [minpoll <minpoll> maxpoll
                      <maxpoll>]
Try "config ntp add -h" for help.

Error: minpoll and maxpoll must be in the range 3-17
root@sonic:/usr/local/lib/python3.9/dist-packages/config#
root@sonic:/usr/local/lib/python3.9/dist-packages/config# config ntp add 12.12.12.12 minpoll 3 maxpoll 18
Usage: config ntp add [OPTIONS] <ntp_ip_address> [minpoll <minpoll> maxpoll
                      <maxpoll>]
Try "config ntp add -h" for help.

Error: minpoll and maxpoll must be in the range 3-17
root@sonic:/usr/local/lib/python3.9/dist-packages/config#
root@sonic:/usr/local/lib/python3.9/dist-packages/config#
root@sonic:/usr/local/lib/python3.9/dist-packages/config# config ntp add 12.12.12.12 minpoll 6 maxpoll 6
Usage: config ntp add [OPTIONS] <ntp_ip_address> [minpoll <minpoll> maxpoll
                      <maxpoll>]
Try "config ntp add -h" for help.

Error: Invalid minpoll:6 and maxpoll:10
root@sonic:/usr/local/lib/python3.9/dist-packages/config# config ntp add 12.12.12.12 minpoll 6
Usage: config ntp add [OPTIONS] <ntp_ip_address> [minpoll <minpoll> maxpoll
                      <maxpoll>]
Try "config ntp add -h" for help.

Error: Invalid input for minpoll and maxpoll
root@sonic:/usr/local/lib/python3.9/dist-packages/config#
root@sonic:/usr/local/lib/python3.9/dist-packages/config# config ntp add 12.12.12.12 maxpoll 14
Usage: config ntp add [OPTIONS] <ntp_ip_address> [minpoll <minpoll> maxpoll
                      <maxpoll>]
Try "config ntp add -h" for help.

Error: Invalid input for minpoll and maxpoll
root@sonic:/usr/local/lib/python3.9/dist-packages/config#

root@sonic:/usr/local/lib/python3.9/dist-packages/config# config ntp add 12.12.12.12 maxpoll 5 minpoll 23
Usage: config ntp add [OPTIONS] <ntp_ip_address> [minpoll <minpoll> maxpoll
                      <maxpoll>]
Try "config ntp add -h" for help.

Error: Invalid parameters
root@sonic:/usr/local/lib/python3.9/dist-packages/config# config ntp add 12.12.12.12 minmin 12 max 15
Usage: config ntp add [OPTIONS] <ntp_ip_address> [minpoll <minpoll> maxpoll
                      <maxpoll>]
Try "config ntp add -h" for help.

Error: Invalid parameters
root@sonic:/usr/local/lib/python3.9/dist-packages/config#
  • configure ntp server with same ip, minpoll&maxpoll
root@sonic:/usr/local/lib/python3.9/dist-packages/config# config ntp add 10.10.10.10 minpoll 6 maxpoll 10
NTP server 10.10.10.10 is already configured
  • delete ntp servers
root@sonic:/usr/local/lib/python3.9/dist-packages/config# show runningconfiguration ntp
NTP Servers
---------------------------------
10.10.10.10 minpoll 6 maxpoll 10
11.11.11.11 minpoll 10 maxpoll 12
root@sonic:/usr/local/lib/python3.9/dist-packages/config# config ntp del 10.10.10.10
NTP server 10.10.10.10 removed from configuration
Restarting ntp-config service...
root@sonic:/usr/local/lib/python3.9/dist-packages/config# config ntp del 11.11.11.11
NTP server 11.11.11.11 removed from configuration
Restarting ntp-config service...
root@sonic:/usr/local/lib/python3.9/dist-packages/config# show runningconfiguration ntp
NTP Servers
-------------
root@sonic:/usr/local/lib/python3.9/dist-packages/config#

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 1, 2023

CLA Missing ID CLA Not Signed

@DerrickLFX
Copy link

/easycla

Bing Sun and others added 2 commits September 1, 2023 22:22
@bsun-sudo
Copy link
Contributor Author

new PR created without "COMMITTER ID error",
#2981
so close this one.

@bsun-sudo bsun-sudo closed this Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants