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

[Clock] Implement clock CLI #2793

Merged
merged 3 commits into from
Jun 2, 2023
Merged

Conversation

fastiuk
Copy link
Contributor

@fastiuk fastiuk commented Apr 13, 2023

hld #1219
closes #1171

What I did

  • Add command to configure date and time
  • Add command to configure timezone
  • Add command to show timezones

How to verify it

Show clock and timezones:

show clock
show clock timezones

Set date and time and verify:

sudo config clock date-time <date> <time>
show clock

Set timezone and verify:

sudo config clock timezone <timezone>
show clock

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

admin@sonic:~$ show clock
Sat 10 Oct 2020 01:02:20 AM HDT

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

admin@sonic:~$ show clock
Sat 10 Oct 2020 01:02:20 AM HDT
admin@sonic:~$ show clock timezones
Africa/Abidjan
Africa/Accra
### More data here ##
Pacific/Wallis
UTC
Etc/UTC
admin@sonic:~$ sudo config clock timezone Europe/Ki # <TAB><TAB>
Europe/Kiev   Europe/Kirov
admin@sonic:~$ sudo config clock timezone Europe/Kiev
admin@sonic:~$ sudo config clock timezone Europe/Kie
Timezone Europe/Kie does not conform format
admin@sonic:~$ sudo config clock date 2020-10-11 1:2:4
admin@sonic:~$ sudo config clock date 20-40-50 60:70:80
Date 20-40-50 does not conform format YYYY-MM-DD
Time 60:70:80 does not conform format HH:MM:SS

dgsudharsan
dgsudharsan previously approved these changes Apr 13, 2023
dgsudharsan
dgsudharsan previously approved these changes Apr 14, 2023
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Apr 19, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

config/main.py Outdated Show resolved Hide resolved
config/main.py Outdated Show resolved Hide resolved
@fastiuk
Copy link
Contributor Author

fastiuk commented May 7, 2023

Ping here

dgsudharsan
dgsudharsan previously approved these changes May 8, 2023
dgsudharsan
dgsudharsan previously approved these changes May 17, 2023
config/main.py Outdated Show resolved Hide resolved
dgsudharsan
dgsudharsan previously approved these changes May 31, 2023
dgsudharsan
dgsudharsan previously approved these changes May 31, 2023
fastiuk and others added 3 commits June 1, 2023 00:53
Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
Updated relevant new CLI commands for clock mgmt
config clock timezone <timezone>
config clock date <YYYY-MM-DD> <HH:MM:SS>
show clock timezones
@yxieca yxieca merged commit 359dfc0 into sonic-net:master Jun 2, 2023
dprital added a commit to dprital/sonic-buildimage that referenced this pull request Jun 5, 2023
Update sonic-utilities submodule pointer to include the following:
* 5c9b2177 Fix issue: out of range sflow polling interval is accepted and stored in config_db ([sonic-net#2847](sonic-net/sonic-utilities#2847))
* 72ca4848 Add CLI configuration options for teamd retry count feature ([sonic-net#2642](sonic-net/sonic-utilities#2642))
* 359dfc0c [Clock] Implement clock CLI ([sonic-net#2793](sonic-net/sonic-utilities#2793))
* b316fc27 Add transceiver status CLI to show output from TRANSCEIVER_STATUS table ([sonic-net#2772](sonic-net/sonic-utilities#2772))
* dc59dbd2 Replace pickle by json ([sonic-net#2849](sonic-net/sonic-utilities#2849))
* a66f41c4 [show] replace shell=True, replace xml by lxml, replace exit by sys.exit ([sonic-net#2666](sonic-net/sonic-utilities#2666))
* 57500572 [utilities_common] replace shell=True ([sonic-net#2718](sonic-net/sonic-utilities#2718))
* 6e0ee3e7 [CRM][DASH] Extend CRM utility to support DASH resources. ([sonic-net#2800](sonic-net/sonic-utilities#2800))
* b2c29b0b [config] Generate sysinfo in single asic ([sonic-net#2856](sonic-net/sonic-utilities#2856))

Signed-off-by: dprital <drorp@nvidia.com>
StormLiangMS pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Jun 5, 2023
…nic-utilities submodule on master (#15193)

Dependency:
sonic-net/sonic-utilities#2718

Why I did it
This PR sonic-net/sonic-utilities#2718 reduce shell=True usage in utilities_common.cli.run_command() function.

Work item tracking
Microsoft ADO (number only): 15022050
How I did it
Replace strings commands using utilities_common.cli.run_command() function to list of strings

due to circular dependency, advance sonic-utilities submodule
72ca4848 (HEAD -> master, upstream/master, upstream/HEAD) Add CLI configuration options for teamd retry count feature (sonic-net/sonic-utilities#2642)
359dfc0c [Clock] Implement clock CLI (sonic-net/sonic-utilities#2793)
b316fc27 Add transceiver status CLI to show output from TRANSCEIVER_STATUS table (sonic-net/sonic-utilities#2772)
dc59dbd2 Replace pickle by json (sonic-net/sonic-utilities#2849)
a66f41c4 [show] replace shell=True, replace xml by lxml, replace exit by sys.exit (sonic-net/sonic-utilities#2666)
57500572 [utilities_common] replace shell=True (sonic-net/sonic-utilities#2718)
6e0ee3e7 [CRM][DASH] Extend CRM utility to support DASH resources. (sonic-net/sonic-utilities#2800)
b2c29b0b [config] Generate sysinfo in single asic (sonic-net/sonic-utilities#2856)
pdhruv-marvell pushed a commit to pdhruv-marvell/sonic-utilities that referenced this pull request Aug 23, 2023
* Implement clock CLI
* Add tests for clock CLI
* Update Command-Reference.md

Updated relevant new CLI commands for clock mgmt
config clock timezone <timezone>
config clock date <YYYY-MM-DD> <HH:MM:SS>
show clock timezones

---------

Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
Co-authored-by: Meir Renford <meirre@nvidia.com>
sonic-otn pushed a commit to sonic-otn/sonic-buildimage that referenced this pull request Sep 20, 2023
…nic-utilities submodule on master (sonic-net#15193)

Dependency:
sonic-net/sonic-utilities#2718

Why I did it
This PR sonic-net/sonic-utilities#2718 reduce shell=True usage in utilities_common.cli.run_command() function.

Work item tracking
Microsoft ADO (number only): 15022050
How I did it
Replace strings commands using utilities_common.cli.run_command() function to list of strings

due to circular dependency, advance sonic-utilities submodule
72ca4848 (HEAD -> master, upstream/master, upstream/HEAD) Add CLI configuration options for teamd retry count feature (sonic-net/sonic-utilities#2642)
359dfc0c [Clock] Implement clock CLI (sonic-net/sonic-utilities#2793)
b316fc27 Add transceiver status CLI to show output from TRANSCEIVER_STATUS table (sonic-net/sonic-utilities#2772)
dc59dbd2 Replace pickle by json (sonic-net/sonic-utilities#2849)
a66f41c4 [show] replace shell=True, replace xml by lxml, replace exit by sys.exit (sonic-net/sonic-utilities#2666)
57500572 [utilities_common] replace shell=True (sonic-net/sonic-utilities#2718)
6e0ee3e7 [CRM][DASH] Extend CRM utility to support DASH resources. (sonic-net/sonic-utilities#2800)
b2c29b0b [config] Generate sysinfo in single asic (sonic-net/sonic-utilities#2856)
@fastiuk fastiuk deleted the dev-clock-commands branch December 14, 2023 00:07
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.

Standalone local clock setting
4 participants