summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-10-29 17:26:17 +0100
committerChristian Poessinger <christian@poessinger.com>2020-10-29 17:27:24 +0100
commitf8c99aebd0e210cd70058cf07bf9fb8e2691c709 (patch)
tree9852f2889949d6da56840dd4788593438afa66b7
parent736ca991e86df00be27132051187d8d0ddf17cbc (diff)
downloadvyos-1x-f8c99aebd0e210cd70058cf07bf9fb8e2691c709.tar.gz
vyos-1x-f8c99aebd0e210cd70058cf07bf9fb8e2691c709.zip
verify: T2587: allow MTU < 1280 when IPv6 is disabled on an interface
-rw-r--r--python/vyos/configverify.py12
-rw-r--r--smoketest/scripts/cli/base_interfaces_test.py29
2 files changed, 35 insertions, 6 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py
index 833ef3772..d3ca56d11 100644
--- a/python/vyos/configverify.py
+++ b/python/vyos/configverify.py
@@ -60,19 +60,19 @@ def verify_mtu_ipv6(config):
error_msg = f'IPv6 address will be configured on interface "{interface}" ' \
f'thus the minimum MTU requirement is {min_mtu}!'
- if not dict_search('ipv6.address.no_default_link_local', config):
- raise ConfigError('link-local ' + error_msg)
-
for address in (dict_search('address', config) or []):
if address in ['dhcpv6'] or is_ipv6(address):
raise ConfigError(error_msg)
- if dict_search('ipv6.address.autoconf', config):
- raise ConfigError(error_msg)
+ tmp = dict_search('ipv6.address', config)
+ if tmp and 'no_default_link_local' not in tmp:
+ raise ConfigError('link-local ' + error_msg)
- if dict_search('ipv6.address.eui64', config):
+ if tmp and 'autoconf' in tmp:
raise ConfigError(error_msg)
+ if tmp and 'eui64' in tmp:
+ raise ConfigError(error_msg)
def verify_vrf(config):
"""
diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py
index 7dc92feb5..653cc91f9 100644
--- a/smoketest/scripts/cli/base_interfaces_test.py
+++ b/smoketest/scripts/cli/base_interfaces_test.py
@@ -162,16 +162,45 @@ class BasicInterfaceTest:
""" Testcase if MTU can be changed on interface """
if not self._test_mtu:
return None
+
+ for intf in self._interfaces:
+ base = self._base_path + [intf]
+ self.session.set(base + ['mtu', self._mtu])
+ for option in self._options.get(intf, []):
+ self.session.set(base + option.split())
+
+ # commit interface changes
+ self.session.commit()
+
+ # verify changed MTU
+ for intf in self._interfaces:
+ self._mtu_test(intf)
+
+ def test_change_mtu_1200(self):
+ """ Testcase if MTU can be changed to 1200 on non IPv6 enabled interfaces """
+ if not self._test_mtu:
+ return None
+
+ old_mtu = self._mtu
+ self._mtu = '1200'
+
for intf in self._interfaces:
base = self._base_path + [intf]
self.session.set(base + ['mtu', self._mtu])
+ self.session.set(base + ['ipv6', 'address', 'no-default-link-local'])
+
for option in self._options.get(intf, []):
self.session.set(base + option.split())
+ # commit interface changes
self.session.commit()
+
+ # verify changed MTU
for intf in self._interfaces:
self._mtu_test(intf)
+ self._mtu = old_mtu
+
def test_8021q_vlan(self):
""" Testcase for 802.1q VLAN interfaces """
if not self._test_vlan: