Skip to content

Commit 1cb65d1

Browse files
committed
Enable iburst option for NTP servers loaded from minigraph (sonic-net#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 <[email protected]>
1 parent c265a48 commit 1cb65d1

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/sonic-config-engine/minigraph.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2077,7 +2077,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
20772077
results['SYSLOG_SERVER'] = dict((item, {}) for item in syslog_servers)
20782078
results['DHCP_SERVER'] = dict((item, {}) for item in dhcp_servers)
20792079
results['DHCP_RELAY'] = dhcp_relay_table
2080-
results['NTP_SERVER'] = dict((item, {}) for item in ntp_servers)
2080+
results['NTP_SERVER'] = dict((item, {'iburst': 'on'}) for item in ntp_servers)
20812081
# Set default DNS nameserver from dns.j2
20822082
results['DNS_NAMESERVER'] = {}
20832083
if os.environ.get("CFGGEN_UNIT_TESTING", "0") == "2":

src/sonic-config-engine/tests/test_cfggen.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ def test_metadata_tacacs(self):
696696
def test_metadata_ntp(self):
697697
argument = ['-m', self.sample_graph_metadata, '-p', self.port_config, '-v', "NTP_SERVER"]
698698
output = self.run_script(argument)
699-
self.assertEqual(utils.to_dict(output.strip()), utils.to_dict("{'10.0.10.1': {}, '10.0.10.2': {}}"))
699+
self.assertEqual(utils.to_dict(output.strip()), utils.to_dict("{'10.0.10.1': {'iburst': 'on'}, '10.0.10.2': {'iburst': 'on'}}"))
700700

701701
def test_dns_nameserver(self):
702702
argument = ['-m', self.sample_graph_metadata, '-p', self.port_config, '-v', "DNS_NAMESERVER"]

src/sonic-config-engine/tests/test_minigraph_case.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def test_minigraph_mgmt_port(self):
283283
def test_metadata_ntp(self):
284284
argument = ['-m', self.sample_graph, '-p', self.port_config, '-v', "NTP_SERVER"]
285285
output = self.run_script(argument)
286-
self.assertEqual(output.strip(), "{'10.0.10.1': {}, '10.0.10.2': {}}")
286+
self.assertEqual(output.strip(), "{'10.0.10.1': {'iburst': 'on'}, '10.0.10.2': {'iburst': 'on'}}")
287287

288288
def test_minigraph_vnet(self):
289289
argument = ['-m', self.sample_graph, '-p', self.port_config, '-v', "VNET"]

src/sonic-config-engine/tests/test_multinpu_cfggen.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def test_metadata_tacacs(self):
142142
def test_metadata_ntp(self):
143143
argument = ['-m', self.sample_graph, '-p', self.sample_port_config, '--var-json', "NTP_SERVER"]
144144
output = json.loads(self.run_script(argument))
145-
self.assertDictEqual(output, {'17.39.1.130': {}, '17.39.1.129': {}})
145+
self.assertDictEqual(output, {'17.39.1.130': {'iburst': 'on'}, '17.39.1.129': {'iburst': 'on'}})
146146
#NTP data is present only in the host config
147147
argument = ['-m', self.sample_graph, '--var-json', "NTP_SERVER"]
148148
for asic in range(NUM_ASIC):

0 commit comments

Comments
 (0)