From 917c658e37b619b1b2cd261ae43dd02f11eef720 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Fri, 20 Sep 2024 22:28:13 +0200 Subject: T6630: ntp: move interface timestamping configuration under ptp node --- data/templates/chrony/chrony.conf.j2 | 13 +++++------ interface-definitions/service_ntp.xml.in | 37 +++++++++++++------------------ smoketest/scripts/cli/test_service_ntp.py | 11 +++++---- 3 files changed, 26 insertions(+), 35 deletions(-) diff --git a/data/templates/chrony/chrony.conf.j2 b/data/templates/chrony/chrony.conf.j2 index 79fa5e3a0..2838f5524 100644 --- a/data/templates/chrony/chrony.conf.j2 +++ b/data/templates/chrony/chrony.conf.j2 @@ -67,16 +67,15 @@ binddevice {{ interface }} {% endif %} {% endif %} -{% if offload.timestamp.interface is vyos_defined %} +{% if ptp.timestamp.interface is vyos_defined %} # Enable hardware timestamping on the specified interfaces -{% for interface, config in offload.timestamp.interface.items() %} -hwtimestamp {{ interface }} {{- ' rxfilter ' ~ config.receive_filter if config.receive_filter is vyos_defined }} +{% for iface, iface_config in ptp.timestamp.interface.items() %} +{% if iface == "all" %} +{% set iface = "*" %} +{% endif %} +hwtimestamp {{ iface }} {{- ' rxfilter ' ~ iface_config.receive_filter if iface_config.receive_filter is vyos_defined }} {% endfor %} {% endif %} -{% if offload.timestamp.default_enable is vyos_defined %} -# Enable hardware timestamping on all supported interfaces not otherwise configured -hwtimestamp * -{% endif %} {% if ptp.port is vyos_defined %} # Enable sending and receiving NTP over PTP packets (PTP transport) diff --git a/interface-definitions/service_ntp.xml.in b/interface-definitions/service_ntp.xml.in index d6d3e0818..5dc0cd295 100644 --- a/interface-definitions/service_ntp.xml.in +++ b/interface-definitions/service_ntp.xml.in @@ -13,34 +13,38 @@ #include #include #include - + - Configurable offload options + Enable Precision Time Protocol (PTP) transport + #include + + 319 + Enable timestamping of packets in the NIC hardware - - - Enable timestamping on all supported interfaces - - - Interface to enable timestamping on + all + + all + Select all interfaces + txt Interface name #include + all @@ -52,7 +56,7 @@ all - All received packets are timestamped + All packets are timestamped ntp @@ -60,11 +64,11 @@ ptp - Only PTP packets, or NTP packets using the PTP transport, are timestamped + Only PTP or NTP packets using the PTP transport are timestamped none - No received packets are timestamped + No packet is timestamped (all|ntp|ptp|none) @@ -77,17 +81,6 @@ - - - Enable Precision Time Protocol (PTP) transport - - - #include - - 319 - - - Leap second behavior diff --git a/smoketest/scripts/cli/test_service_ntp.py b/smoketest/scripts/cli/test_service_ntp.py index 02435bbfb..07af4f5eb 100755 --- a/smoketest/scripts/cli/test_service_ntp.py +++ b/smoketest/scripts/cli/test_service_ntp.py @@ -171,7 +171,6 @@ class TestSystemNTP(VyOSUnitTestSHIM.TestCase): # name is not a 1:1 mapping from VyOS config servers = ['192.0.2.1', '192.0.2.2'] options = ['prefer'] - offload_interface = 'eth0' for server in servers: for option in options: @@ -198,13 +197,13 @@ class TestSystemNTP(VyOSUnitTestSHIM.TestCase): def test_offload_timestamp_default(self): # Test offloading of NIC timestamp servers = ['192.0.2.1', '192.0.2.2'] - options = ['prefer'] + ptp_port = '8319' for server in servers: - for option in options: - self.cli_set(base_path + ['server', server, option]) + self.cli_set(base_path + ['server', server, 'ptp']) - self.cli_set(base_path + ['offload', 'timestamp', 'default-enable']) + self.cli_set(base_path + ['ptp', 'port', ptp_port]) + self.cli_set(base_path + ['ptp', 'timestamp', 'interface', 'all']) # commit changes self.cli_commit() @@ -221,7 +220,7 @@ class TestSystemNTP(VyOSUnitTestSHIM.TestCase): self.assertIn('leapsectz right/UTC', config) for server in servers: - self.assertIn(f'server {server} iburst ' + ' '.join(options), config) + self.assertIn(f'server {server} iburst port {ptp_port}', config) self.assertIn('hwtimestamp *', config) -- cgit v1.2.3