summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/ntp/ntp.conf.tmpl14
-rw-r--r--interface-definitions/ntp.xml.in6
-rwxr-xr-xsmoketest/scripts/cli/test_system_ntp.py7
3 files changed, 20 insertions, 7 deletions
diff --git a/data/templates/ntp/ntp.conf.tmpl b/data/templates/ntp/ntp.conf.tmpl
index bb0067bfb..3f319c89b 100644
--- a/data/templates/ntp/ntp.conf.tmpl
+++ b/data/templates/ntp/ntp.conf.tmpl
@@ -13,13 +13,13 @@ restrict -6 ::1
#
# Configurable section
#
-{% if server %}
-{% for srv in server %}
-{% set options = '' %}
-{% set options = options + 'noselect ' if server[srv].noselect is defined else '' %}
-{% set options = options + 'preempt ' if server[srv].preempt is defined else '' %}
-{% set options = options + 'prefer ' if server[srv].prefer is defined else '' %}
-server {{ srv | replace('_', '-') }} iburst {{ options }}
+{% if server is defined and server is not none %}
+{% for server, config in server.items() %}
+{% set association = 'server' %}
+{% if config.pool is defined %}
+{% set association = 'pool' %}
+{% endif %}
+{{ association }} {{ server | replace('_', '-') }} iburst {{ 'noselect' if config.noselect is defined }} {{ 'preempt' if config.preempt is defined }} {{ 'prefer' if config.prefer is defined }}
{% endfor %}
{% endif %}
diff --git a/interface-definitions/ntp.xml.in b/interface-definitions/ntp.xml.in
index 6070cafe0..6a8eb0818 100644
--- a/interface-definitions/ntp.xml.in
+++ b/interface-definitions/ntp.xml.in
@@ -20,6 +20,12 @@
<valueless/>
</properties>
</leafNode>
+ <leafNode name="pool">
+ <properties>
+ <help>Associate with a number of remote servers</help>
+ <valueless/>
+ </properties>
+ </leafNode>
<leafNode name="preempt">
<properties>
<help>Specifies the association as preemptable rather than the default persistent</help>
diff --git a/smoketest/scripts/cli/test_system_ntp.py b/smoketest/scripts/cli/test_system_ntp.py
index 822a9aff2..e2744c936 100755
--- a/smoketest/scripts/cli/test_system_ntp.py
+++ b/smoketest/scripts/cli/test_system_ntp.py
@@ -51,11 +51,15 @@ class TestSystemNTP(unittest.TestCase):
""" Test basic NTP support with multiple servers and their options """
servers = ['192.0.2.1', '192.0.2.2']
options = ['noselect', 'preempt', 'prefer']
+ ntp_pool = 'pool.vyos.io'
for server in servers:
for option in options:
self.session.set(base_path + ['server', server, option])
+ # Test NTP pool
+ self.session.set(base_path + ['server', ntp_pool, 'pool'])
+
# commit changes
self.session.commit()
@@ -65,6 +69,9 @@ class TestSystemNTP(unittest.TestCase):
test = f'{server} iburst ' + ' '.join(options)
self.assertTrue(test in tmp)
+ tmp = get_config_value('pool')
+ self.assertTrue(f'{ntp_pool} iburst' in tmp)
+
# Check for running process
self.assertTrue(process_named_running(PROCESS_NAME))