summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface-definitions/include/interface/default-route-distance.xml.i2
-rw-r--r--interface-definitions/interfaces_pppoe.xml.in3
-rwxr-xr-xsmoketest/scripts/cli/test_container.py12
-rwxr-xr-xsrc/conf_mode/container.py3
4 files changed, 18 insertions, 2 deletions
diff --git a/interface-definitions/include/interface/default-route-distance.xml.i b/interface-definitions/include/interface/default-route-distance.xml.i
index 6eda52c91..7a226a538 100644
--- a/interface-definitions/include/interface/default-route-distance.xml.i
+++ b/interface-definitions/include/interface/default-route-distance.xml.i
@@ -4,7 +4,7 @@
<help>Distance for installed default route</help>
<valueHelp>
<format>u32:1-255</format>
- <description>Distance for the default route from DHCP server</description>
+ <description>Distance for the default route received from the server</description>
</valueHelp>
<constraint>
<validator name="numeric" argument="--range 1-255"/>
diff --git a/interface-definitions/interfaces_pppoe.xml.in b/interface-definitions/interfaces_pppoe.xml.in
index 56660bc15..f24bc41d8 100644
--- a/interface-definitions/interfaces_pppoe.xml.in
+++ b/interface-definitions/interfaces_pppoe.xml.in
@@ -21,6 +21,9 @@
#include <include/interface/dial-on-demand.xml.i>
#include <include/interface/no-default-route.xml.i>
#include <include/interface/default-route-distance.xml.i>
+ <leafNode name="default-route-distance">
+ <defaultValue>1</defaultValue>
+ </leafNode>
#include <include/interface/dhcpv6-options.xml.i>
#include <include/generic-description.xml.i>
#include <include/interface/disable.xml.i>
diff --git a/smoketest/scripts/cli/test_container.py b/smoketest/scripts/cli/test_container.py
index 5d574ab7d..51559a7c6 100755
--- a/smoketest/scripts/cli/test_container.py
+++ b/smoketest/scripts/cli/test_container.py
@@ -98,11 +98,21 @@ class TestContainer(VyOSUnitTestSHIM.TestCase):
def test_name_server(self):
cont_name = 'dns-test'
+ net_name = 'net-test'
name_server = '192.168.0.1'
- self.cli_set(base_path + ['name', cont_name, 'allow-host-networks'])
+ prefix = '192.0.2.0/24'
+
+ self.cli_set(base_path + ['network', net_name, 'prefix', prefix])
+
self.cli_set(base_path + ['name', cont_name, 'image', cont_image])
self.cli_set(base_path + ['name', cont_name, 'name-server', name_server])
+ self.cli_set(base_path + ['name', cont_name, 'network', net_name, 'address', str(ip_interface(prefix).ip + 2)])
+ # verify() - name server has no effect when container network has dns enabled
+ with self.assertRaises(ConfigSessionError):
+ self.cli_commit()
+
+ self.cli_set(base_path + ['network', net_name, 'no-name-server'])
self.cli_commit()
n = cmd_to_json(f'sudo podman inspect {cont_name}')
diff --git a/src/conf_mode/container.py b/src/conf_mode/container.py
index 4d3962029..594de3eb0 100755
--- a/src/conf_mode/container.py
+++ b/src/conf_mode/container.py
@@ -148,6 +148,9 @@ def verify(container):
if network_name not in container.get('network', {}):
raise ConfigError(f'Container network "{network_name}" does not exist!')
+ if 'name_server' in container_config and 'no_name_server' not in container['network'][network_name]:
+ raise ConfigError(f'Setting name server has no effect when attached container network has DNS enabled!')
+
if 'address' in container_config['network'][network_name]:
cnt_ipv4 = 0
cnt_ipv6 = 0