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] Add NTP extended configuration #15058

Merged
merged 31 commits into from
Dec 11, 2023

Conversation

fastiuk
Copy link
Contributor

@fastiuk fastiuk commented May 13, 2023

hld #1296
closes #1254
depends-on #60, #781, #2835, #10749

Why I did it

To cover the next AIs:

  • Configure NTP global parameters
  • Add/remove new NTP servers
  • Change the configuration for NTP servers
  • Show NTP status
  • Show NTP configuration
Work item tracking
  • Microsoft ADO (number only):

How I did it

  • Add YANG model for a new configuration
  • Extend configuration templates to support new knobs

How to verify it

Which release branch to backport (provide reason below if selected)

  • 202205
  • 202211
  • 202305
  • 202311

Tested branch (Please provide the tested image version)

Description for the changelog

  • Add ability to configure NTP global parameters such as authentication, dhcp, admin state
  • Change the configuration for NTP servers
  • Add an ability to show NTP configuration

Link to config_db schema for YANG module changes

NTP configuration

A picture of a cute animal (it is my cat Finn)

PXL_20230413_140941610 PORTRAIT

@fastiuk fastiuk self-assigned this May 13, 2023
@fastiuk fastiuk force-pushed the dev-ntp-configuration branch 3 times, most recently from ac7c66f to 235778b Compare June 3, 2023 19:15
@fastiuk
Copy link
Contributor Author

fastiuk commented Jun 19, 2023

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link

Pull request contains merge conflicts.

@fastiuk fastiuk closed this Jun 21, 2023
@fastiuk fastiuk reopened this Jun 21, 2023
@fastiuk
Copy link
Contributor Author

fastiuk commented Jun 23, 2023

The test failed because the code sonic-net/sonic-host-services#60 should be merged.
Tested locally with an image - test case works fine.

@@ -27,21 +28,29 @@ fi

(
flock -w 180 9
ntpEnabled=$(/usr/local/bin/sonic-cfggen -d -v 'NTP["global"]["admin_state"]' 2> /dev/null)
if [ "$ntpEnabled" = "disabled" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can ExecCondition= in the systemd service file be used to check this condition instead? That way the service status will accurately reflect that a condition check failed.

There also shoudn't be another ntp daemon running at this point of time, so there shouldn't be anything that needs to be stopped.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm. nice idea, I guess it will work. I will try it and let you know the result here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any update here on whether this worked?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey. I tried it with another daemon and it actually works fine. I tried to rework it here, but it won't work here in a couple of reasons:

  1. It is not a one-line solution and will basically make this implementation more complex.
  2. We are using lock here, which will be much harder to use in the service file.
  3. We need to use ExecStopPost condition to stop the daemon.

Other reasons I don't like this option:

  1. We need to modify ntp service file which is controlled by open source community and not modified by us.
  2. That ntp-systemd-wrapper script was created exactly to customize the control of ntp daemon.

So I would like to avoid of such changes

fastiuk added 10 commits July 5, 2023 01:15
Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
…access for other.

Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
@qiluo-msft
Copy link
Collaborator

+@ganglyu to review SONiC Yang model

@@ -68,6 +105,9 @@ module sonic-ntp {
type leafref {
path /mprt:sonic-mgmt_port/mprt:MGMT_PORT/mprt:MGMT_PORT_LIST/mprt:name;
}
type string {
pattern 'eth0';
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need this type?
I think eth0 is the management port

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, eth0 will be covered by MGMT_PORT, but if it is undefined in MGMT_PORT (which is possible, at first boot, for example) it will fail during build, because it checks for init_cfg conforms YANG model. So my logic here: src_intf is either port from MGMT_PORT, or eth0, or port from other leafref.

@ganglyu
Copy link
Contributor

ganglyu commented Dec 2, 2023

would you please update src/sonic-yang-models/tests/files/sample_config_db.json?

Signed-off-by: Yevhen Fastiuk <yfastiuk@nvidia.com>
@fastiuk
Copy link
Contributor Author

fastiuk commented Dec 2, 2023

would you please update src/sonic-yang-models/tests/files/sample_config_db.json?

updated

@fastiuk
Copy link
Contributor Author

fastiuk commented Dec 6, 2023

@qiluo-msft all comments resolved. Can we proceed with that?

@qiluo-msft qiluo-msft merged commit 5efb123 into sonic-net:master Dec 11, 2023
19 checks passed
saiarcot895 added a commit to saiarcot895/sonic-buildimage that referenced this pull request Jun 28, 2024
In sonic-net#15058, the NTP server configuration was modified to add additional
options, such as conditionally enabling iburst, specifying the
association type, and specifying the NTP version. One side effect of
this was that the iburst option which was previously always enabled now
requires it to be explicitly enabled in the config_db.

To restore the old behavior, when loading from minigraph, add
`"iburst": "true"` for each NTP server loaded from minigraph.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
yxieca pushed a commit that referenced this pull request Jul 11, 2024
Why I did it
In #15058, the NTP server configuration was modified to add additional options, such as conditionally enabling iburst, specifying the association type, and specifying the NTP version. One side effect of this was that the iburst option which was previously always enabled now requires it to be explicitly enabled in the config_db.

Fixes #19425.

How I did it
To restore the old behavior, when loading from minigraph, add "iburst": "true" for each NTP server loaded from minigraph.

How to verify it
Tested on a KVM setup, verified that the generated ntp.conf file had the iburst option.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
arun1355492 pushed a commit to arun1355492/sonic-buildimage that referenced this pull request Jul 26, 2024
…#19424)

Why I did it
In sonic-net#15058, the NTP server configuration was modified to add additional options, such as conditionally enabling iburst, specifying the association type, and specifying the NTP version. One side effect of this was that the iburst option which was previously always enabled now requires it to be explicitly enabled in the config_db.

Fixes sonic-net#19425.

How I did it
To restore the old behavior, when loading from minigraph, add "iburst": "true" for each NTP server loaded from minigraph.

How to verify it
Tested on a KVM setup, verified that the generated ntp.conf file had the iburst option.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
saiarcot895 added a commit to saiarcot895/sonic-buildimage that referenced this pull request Jul 31, 2024
…#19424)

Why I did it
In sonic-net#15058, the NTP server configuration was modified to add additional options, such as conditionally enabling iburst, specifying the association type, and specifying the NTP version. One side effect of this was that the iburst option which was previously always enabled now requires it to be explicitly enabled in the config_db.

Fixes sonic-net#19425.

How I did it
To restore the old behavior, when loading from minigraph, add "iburst": "true" for each NTP server loaded from minigraph.

How to verify it
Tested on a KVM setup, verified that the generated ntp.conf file had the iburst option.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
yxieca pushed a commit that referenced this pull request Jul 31, 2024
…19741)

Why I did it
In #15058, the NTP server configuration was modified to add additional options, such as conditionally enabling iburst, specifying the association type, and specifying the NTP version. One side effect of this was that the iburst option which was previously always enabled now requires it to be explicitly enabled in the config_db.

Fixes #19425.

How I did it
To restore the old behavior, when loading from minigraph, add "iburst": "true" for each NTP server loaded from minigraph.

How to verify it
Tested on a KVM setup, verified that the generated ntp.conf file had the iburst option.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Jul 31, 2024
…#19424)

Why I did it
In sonic-net#15058, the NTP server configuration was modified to add additional options, such as conditionally enabling iburst, specifying the association type, and specifying the NTP version. One side effect of this was that the iburst option which was previously always enabled now requires it to be explicitly enabled in the config_db.

Fixes sonic-net#19425.

How I did it
To restore the old behavior, when loading from minigraph, add "iburst": "true" for each NTP server loaded from minigraph.

How to verify it
Tested on a KVM setup, verified that the generated ntp.conf file had the iburst option.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
mssonicbld pushed a commit that referenced this pull request Jul 31, 2024
Why I did it
In #15058, the NTP server configuration was modified to add additional options, such as conditionally enabling iburst, specifying the association type, and specifying the NTP version. One side effect of this was that the iburst option which was previously always enabled now requires it to be explicitly enabled in the config_db.

Fixes #19425.

How I did it
To restore the old behavior, when loading from minigraph, add "iburst": "true" for each NTP server loaded from minigraph.

How to verify it
Tested on a KVM setup, verified that the generated ntp.conf file had the iburst option.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
liushilongbuaa pushed a commit to liushilongbuaa/sonic-buildimage that referenced this pull request Aug 1, 2024
…#19424)

Why I did it
In sonic-net#15058, the NTP server configuration was modified to add additional options, such as conditionally enabling iburst, specifying the association type, and specifying the NTP version. One side effect of this was that the iburst option which was previously always enabled now requires it to be explicitly enabled in the config_db.

Fixes sonic-net#19425.

How I did it
To restore the old behavior, when loading from minigraph, add "iburst": "true" for each NTP server loaded from minigraph.

How to verify it
Tested on a KVM setup, verified that the generated ntp.conf file had the iburst option.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Included in 202311 Branch YANG YANG model related changes
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

NTP: Additional NTP configuration knobs + NTP server provisioning
7 participants