diff options
author | Lucas Christian <lucas@lucasec.com> | 2024-08-08 23:39:00 -0700 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2024-09-21 08:51:28 +0200 |
commit | a5a6e57b3f7ba7d76bffcfb8dcb086d79f51202a (patch) | |
tree | a5c399d95be3f3846aff2b541e0a96f552cbb60f /smoketest/scripts | |
parent | bf5805c52b7133ec76edeebac33f3c30b56b169f (diff) | |
download | vyos-1x-a5a6e57b3f7ba7d76bffcfb8dcb086d79f51202a.tar.gz vyos-1x-a5a6e57b3f7ba7d76bffcfb8dcb086d79f51202a.zip |
T6630: ntp: add chrony "ntp over ptp" transport
Diffstat (limited to 'smoketest/scripts')
-rwxr-xr-x | smoketest/scripts/cli/test_service_ntp.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_service_ntp.py b/smoketest/scripts/cli/test_service_ntp.py index 644894914..a39431c1b 100755 --- a/smoketest/scripts/cli/test_service_ntp.py +++ b/smoketest/scripts/cli/test_service_ntp.py @@ -224,5 +224,39 @@ class TestSystemNTP(VyOSUnitTestSHIM.TestCase): self.assertIn('hwtimestamp *', config) + def test_ptp_transport(self): + # Test offloading of NIC timestamp + servers = ['192.0.2.1', '192.0.2.2'] + options = ['prefer'] + + for server in servers: + for option in options: + self.cli_set(base_path + ['server', server, option]) + self.cli_set(base_path + ['server', server, 'ptp-transport']) + + # commit changes (expected to fail) + with self.assertRaises(ConfigSessionError): + self.cli_commit() + + # add the required top-level option and commit + self.cli_set(base_path + ['ptp-transport']) + self.cli_commit() + + # Check generated configuration + # this file must be read with higher permissions + config = cmd(f'sudo cat {NTP_CONF}') + self.assertIn('driftfile /run/chrony/drift', config) + self.assertIn('dumpdir /run/chrony', config) + self.assertIn('ntsdumpdir /run/chrony', config) + self.assertIn('clientloglimit 1048576', config) + self.assertIn('rtcsync', config) + self.assertIn('makestep 1.0 3', config) + self.assertIn('leapsectz right/UTC', config) + + for server in servers: + self.assertIn(f'server {server} iburst ' + ' '.join(options) + ' port 319', config) + + self.assertIn('ptpport 319', config) + if __name__ == '__main__': unittest.main(verbosity=2) |