summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2025-11-24 16:06:35 +0100
committerGitHub <noreply@github.com>2025-11-24 16:06:35 +0100
commit1aec97d70ceaba9f89db8c592478e10ed1c0aefc (patch)
tree4df77ba2f641151cd60b343d6744c7a9adbbe940 /smoketest/scripts/cli
parent844d517fa43f2b31dee9320e4e2cb19e2b351684 (diff)
parent6285a2fd7fec1239bdd1ccc8b4e40e10a9086c48 (diff)
downloadvyos-1x-1aec97d70ceaba9f89db8c592478e10ed1c0aefc.tar.gz
vyos-1x-1aec97d70ceaba9f89db8c592478e10ed1c0aefc.zip
Merge pull request #4861 from c-po/bond-member-mtu
bond: T8023: validate member interface min/max MTU
Diffstat (limited to 'smoketest/scripts/cli')
-rw-r--r--smoketest/scripts/cli/base_interfaces_test.py19
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_bonding.py24
2 files changed, 35 insertions, 8 deletions
diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py
index 7dba60313..7e9c5b6a4 100644
--- a/smoketest/scripts/cli/base_interfaces_test.py
+++ b/smoketest/scripts/cli/base_interfaces_test.py
@@ -700,22 +700,25 @@ class BasicInterfaceTest:
if not self._test_vlan or not self._test_mtu:
self.skipTest(MSG_TESTCASE_UNSUPPORTED)
- mtu_1500 = '1500'
- mtu_9000 = '9000'
+ # Some drivers are limited to an MTU of 1500 byte - e.g. when VyOS
+ # runs on PROXMOX with default bridge settings. We use lower values
+ # for this test which will fit for almost every NIC
+ mtu_1300 = '1300'
+ mtu_1420 = '1420'
for interface in self._interfaces:
base = self._base_path + [interface]
- self.cli_set(base + ['mtu', mtu_1500])
+ self.cli_set(base + ['mtu', mtu_1300])
for option in self._options.get(interface, []):
self.cli_set(base + option.split())
if 'source-interface' in option:
iface = option.split()[-1]
iface_type = Section.section(iface)
- self.cli_set(['interfaces', iface_type, iface, 'mtu', mtu_9000])
+ self.cli_set(['interfaces', iface_type, iface, 'mtu', mtu_1420])
for vlan in self._vlan_range:
base = self._base_path + [interface, 'vif', vlan]
- self.cli_set(base + ['mtu', mtu_9000])
+ self.cli_set(base + ['mtu', mtu_1420])
# check validate() - Interface MTU "9000" too high, parent interface MTU is "1500"!
with self.assertRaises(ConfigSessionError):
@@ -724,18 +727,18 @@ class BasicInterfaceTest:
# 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.cli_set(base + ['mtu', mtu_9000])
+ self.cli_set(base + ['mtu', mtu_1420])
self.cli_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))
+ self.assertEqual(tmp['mtu'], int(mtu_1420))
for vlan in self._vlan_range:
tmp = get_interface_config(f'{interface}.{vlan}')
- self.assertEqual(tmp['mtu'], int(mtu_9000))
+ self.assertEqual(tmp['mtu'], int(mtu_1420))
def test_vif_8021q_qos_change(self):
diff --git a/smoketest/scripts/cli/test_interfaces_bonding.py b/smoketest/scripts/cli/test_interfaces_bonding.py
index 21918282d..b6eb5328d 100755
--- a/smoketest/scripts/cli/test_interfaces_bonding.py
+++ b/smoketest/scripts/cli/test_interfaces_bonding.py
@@ -334,5 +334,29 @@ class BondingInterfaceTest(BasicInterfaceTest.TestCase):
id = int(id) + 1
+ def test_bonding_member_mtu(self):
+ # This Smoketest only works on our CI platform where we force the NIC
+ # to virtio and an MTU of only 1500 bytes max
+ if not os.path.exists('/tmp/vyos.smoketests.hint'):
+ self.skipTest('Not running under VyOS CI/CD QEMU environment!')
+
+ for interface in self._interfaces:
+ for option in self._options.get(interface, []):
+ self.cli_set(self._base_path + [interface] + option.split())
+
+ self.cli_set(self._base_path + [interface, 'mtu', '10000'])
+
+ # check validate() - MTU of bond higher then virtio max MTU
+ with self.assertRaises(ConfigSessionError):
+ self.cli_commit()
+
+ for interface in self._interfaces:
+ for option in self._options.get(interface, []):
+ self.cli_set(self._base_path + [interface] + option.split())
+
+ self.cli_delete(self._base_path + [interface, 'mtu'])
+
+ self.cli_commit()
+
if __name__ == '__main__':
unittest.main(verbosity=2, failfast=VyOSUnitTestSHIM.TestCase.debug_on())