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

add click cmd for minpoll/maxpoll configuration on a ntp server #2981

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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#

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.

1 participant