summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-03-03 00:17:54 +0100
committerChristian Poessinger <christian@poessinger.com>2021-03-03 00:17:54 +0100
commita56ecbd9566a193fd64681716232d813fc0f0e85 (patch)
treed0db259a0a7ea4b17fad75c36f13513f1050e229
parentaf609001364404e0b53ac3ee31ac75de54325ecb (diff)
parent117533482d29ce0bd1bc7f3a3f2536921c16565c (diff)
downloadvyos-1x-a56ecbd9566a193fd64681716232d813fc0f0e85.tar.gz
vyos-1x-a56ecbd9566a193fd64681716232d813fc0f0e85.zip
Merge branch 'T3379' of https://github.com/sever-sever/vyos-1x into current
* 'T3379' of https://github.com/sever-sever/vyos-1x: dhcpv6-server: T3379: Add option global-parameters name-server
-rw-r--r--data/templates/dhcp-server/dhcpdv6.conf.tmpl6
-rw-r--r--interface-definitions/dhcpv6-server.xml.in20
-rwxr-xr-xsmoketest/scripts/cli/test_service_dhcpv6-server.py21
3 files changed, 47 insertions, 0 deletions
diff --git a/data/templates/dhcp-server/dhcpdv6.conf.tmpl b/data/templates/dhcp-server/dhcpdv6.conf.tmpl
index de7c9b29c..25e5fa592 100644
--- a/data/templates/dhcp-server/dhcpdv6.conf.tmpl
+++ b/data/templates/dhcp-server/dhcpdv6.conf.tmpl
@@ -8,6 +8,12 @@ log-facility local7;
option dhcp6.preference {{ preference }};
{% endif %}
+{% if global_parameters is defined and global_parameters.name_server is defined and global_parameters.name_server is not none %}
+{% for nameserver in global_parameters.name_server %}
+option dhcp6.name-servers {{ nameserver }};
+{% endfor %}
+{% endif %}
+
# Shared network configration(s)
{% if shared_network_name is defined and shared_network_name is not none %}
{% for network, network_config in shared_network_name.items() if network_config.disable is not defined %}
diff --git a/interface-definitions/dhcpv6-server.xml.in b/interface-definitions/dhcpv6-server.xml.in
index fb0e79c47..a3cca06da 100644
--- a/interface-definitions/dhcpv6-server.xml.in
+++ b/interface-definitions/dhcpv6-server.xml.in
@@ -10,6 +10,26 @@
</properties>
<children>
#include <include/generic-disable-node.xml.i>
+ <node name="global-parameters">
+ <properties>
+ <help>Additional global parameters for DHCPv6 server</help>
+ </properties>
+ <children>
+ <leafNode name="name-server">
+ <properties>
+ <help>IPv6 address of a Recursive DNS Server</help>
+ <valueHelp>
+ <format>ipv6</format>
+ <description>IPv6 address of DNS name server</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv6-address"/>
+ </constraint>
+ <multi/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
<leafNode name="preference">
<properties>
<help>Preference of this DHCPv6 server compared with others</help>
diff --git a/smoketest/scripts/cli/test_service_dhcpv6-server.py b/smoketest/scripts/cli/test_service_dhcpv6-server.py
index 319891a94..a364eee11 100755
--- a/smoketest/scripts/cli/test_service_dhcpv6-server.py
+++ b/smoketest/scripts/cli/test_service_dhcpv6-server.py
@@ -151,5 +151,26 @@ class TestServiceDHCPServer(unittest.TestCase):
# Check for running process
self.assertTrue(process_named_running(PROCESS_NAME))
+ def test_global_nameserver(self):
+ shared_net_name = 'SMOKE-3'
+ ns_global_1 = '2001:db8::1111'
+ ns_global_2 = '2001:db8::2222'
+
+ self.session.set(base_path + ['global-parameters', 'name-server', ns_global_1])
+ self.session.set(base_path + ['global-parameters', 'name-server', ns_global_2])
+ self.session.set(base_path + ['shared-network-name', shared_net_name, 'subnet', subnet])
+
+ # commit changes
+ self.session.commit()
+
+ config = read_file(DHCPD_CONF)
+ self.assertIn(f'option dhcp6.name-servers {ns_global_1};', config)
+ self.assertIn(f'option dhcp6.name-servers {ns_global_2};', config)
+ self.assertIn(f'subnet6 {subnet}' + r' {', config)
+ self.assertIn(f'set shared-networkname = "{shared_net_name}";', config)
+
+ # Check for running process
+ self.assertTrue(process_named_running(PROCESS_NAME))
+
if __name__ == '__main__':
unittest.main(verbosity=2)