diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-05-23 12:07:07 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-05-23 12:20:19 +0200 |
commit | a43511a45896b82ca9a3fc189f7d737f17693fdb (patch) | |
tree | 5cdaf6607e211d8eb5f80292a940c84b0e10e1f5 /smoketest/scripts | |
parent | f1e05de0092e36926429b25a4fe98c55f41c790a (diff) | |
download | vyos-1x-a43511a45896b82ca9a3fc189f7d737f17693fdb.tar.gz vyos-1x-a43511a45896b82ca9a3fc189f7d737f17693fdb.zip |
smoketest: vif: T3570: vlan interface MTU must be less or equal to parent
(cherry picked from commit ed817477dd418f4b448910e990f38a9a3de5ee73)
Diffstat (limited to 'smoketest/scripts')
-rw-r--r-- | smoketest/scripts/cli/base_interfaces_test.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py index 87a572a56..27435f256 100644 --- a/smoketest/scripts/cli/base_interfaces_test.py +++ b/smoketest/scripts/cli/base_interfaces_test.py @@ -23,6 +23,7 @@ from netifaces import ifaddresses from netifaces import interfaces from vyos.configsession import ConfigSession +from vyos.configsession import ConfigSessionError from vyos.ifconfig import Interface from vyos.ifconfig import Section from vyos.util import read_file @@ -292,6 +293,49 @@ class BasicInterfaceTest: self.assertEqual(tmp, self._mtu) self.assertEqual(Interface(vif).get_admin_state(), 'up') + def test_vif_8021q_mtu_limits(self): + # XXX: This testcase is not allowed to run as first testcase, reason + # is the Wireless test will first load the wifi kernel hwsim module + # which creates a wlan0 and wlan1 interface which will fail the + # tearDown() test in the end that no interface is allowed to survive! + if not self._test_vlan: + self.skipTest('not supported') + + mtu_1500 = '1500' + mtu_9000 = '9000' + + for interface in self._interfaces: + base = self._base_path + [interface] + self.session.set(base + ['mtu', mtu_1500]) + for option in self._options.get(interface, []): + self.session.set(base + option.split()) + + for vlan in self._vlan_range: + base = self._base_path + [interface, 'vif', vlan] + self.session.set(base + ['mtu', mtu_9000]) + + # check validate() - VIF MTU must not be larger the parent interface + # MTU size. + with self.assertRaises(ConfigSessionError): + self.session.commit() + + # Change MTU on base interface to be the same as on the VIF interface + for interface in self._interfaces: + base = self._base_path + [interface] + self.session.set(base + ['mtu', mtu_9000]) + + self.session.commit() + + # Verify MTU on base and VIF interfaces + for interface in self._interfaces: + tmp = get_interface_config(interface) + self.assertEqual(tmp['mtu'], int(mtu_9000)) + + for vlan in self._vlan_range: + tmp = get_interface_config(f'{interface}.{vlan}') + self.assertEqual(tmp['mtu'], int(mtu_9000)) + + def test_vif_8021q_lower_up_down(self): # Testcase for https://phabricator.vyos.net/T3349 if not self._test_vlan: |