summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/chrony/chrony.conf.j213
-rw-r--r--interface-definitions/service_ntp.xml.in37
-rwxr-xr-xsmoketest/scripts/cli/test_service_ntp.py11
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/generic-interface.xml.i>
#include <include/listen-address.xml.i>
#include <include/interface/vrf.xml.i>
- <node name="offload">
+ <node name="ptp">
<properties>
- <help>Configurable offload options</help>
+ <help>Enable Precision Time Protocol (PTP) transport</help>
</properties>
<children>
+ #include <include/port-number.xml.i>
+ <leafNode name="port">
+ <defaultValue>319</defaultValue>
+ </leafNode>
<node name="timestamp">
<properties>
<help>Enable timestamping of packets in the NIC hardware</help>
</properties>
<children>
- <leafNode name="default-enable">
- <properties>
- <help>Enable timestamping on all supported interfaces</help>
- <valueless/>
- </properties>
- </leafNode>
<tagNode name="interface">
<properties>
<help>Interface to enable timestamping on</help>
<completionHelp>
<script>${vyos_completion_dir}/list_interfaces</script>
+ <list>all</list>
</completionHelp>
<valueHelp>
+ <format>all</format>
+ <description>Select all interfaces</description>
+ </valueHelp>
+ <valueHelp>
<format>txt</format>
<description>Interface name</description>
</valueHelp>
<constraint>
#include <include/constraint/interface-name.xml.i>
+ <regex>all</regex>
</constraint>
</properties>
<children>
@@ -52,7 +56,7 @@
</completionHelp>
<valueHelp>
<format>all</format>
- <description>All received packets are timestamped</description>
+ <description>All packets are timestamped</description>
</valueHelp>
<valueHelp>
<format>ntp</format>
@@ -60,11 +64,11 @@
</valueHelp>
<valueHelp>
<format>ptp</format>
- <description>Only PTP packets, or NTP packets using the PTP transport, are timestamped</description>
+ <description>Only PTP or NTP packets using the PTP transport are timestamped</description>
</valueHelp>
<valueHelp>
<format>none</format>
- <description>No received packets are timestamped</description>
+ <description>No packet is timestamped</description>
</valueHelp>
<constraint>
<regex>(all|ntp|ptp|none)</regex>
@@ -77,17 +81,6 @@
</node>
</children>
</node>
- <node name="ptp">
- <properties>
- <help>Enable Precision Time Protocol (PTP) transport</help>
- </properties>
- <children>
- #include <include/port-number.xml.i>
- <leafNode name="port">
- <defaultValue>319</defaultValue>
- </leafNode>
- </children>
- </node>
<leafNode name="leap-second">
<properties>
<help>Leap second behavior</help>
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)