|
20 | 20 | from base_interfaces_test import BasicInterfaceTest |
21 | 21 | from base_vyostest_shim import VyOSUnitTestSHIM |
22 | 22 |
|
| 23 | +from vyos.ethtool import Ethtool |
23 | 24 | from vyos.ifconfig import Section |
24 | 25 | from vyos.ifconfig.interface import Interface |
25 | 26 | from vyos.configsession import ConfigSessionError |
@@ -334,5 +335,35 @@ def test_bonding_evpn_multihoming(self): |
334 | 335 |
|
335 | 336 | id = int(id) + 1 |
336 | 337 |
|
| 338 | + def test_bonding_member_mtu(self): |
| 339 | + # This Smoketest only works on systems running virtio drivers |
| 340 | + for interface in self._interfaces: |
| 341 | + for option in self._options.get(interface, []): |
| 342 | + self.cli_set(self._base_path + [interface] + option.split()) |
| 343 | + |
| 344 | + self.cli_set(self._base_path + [interface, 'mtu', '10000']) |
| 345 | + |
| 346 | + is_virtio = False |
| 347 | + for member in self._members: |
| 348 | + if Ethtool(member).get_driver_name() == 'virtio_net': |
| 349 | + is_virtio = True |
| 350 | + break |
| 351 | + |
| 352 | + if not is_virtio: |
| 353 | + self.cli_discard() |
| 354 | + self.skipTest('Test requires virtio NIC drivers') |
| 355 | + |
| 356 | + # check validate() - MTU of bond higher then virtio max MTU |
| 357 | + with self.assertRaises(ConfigSessionError): |
| 358 | + self.cli_commit() |
| 359 | + |
| 360 | + for interface in self._interfaces: |
| 361 | + for option in self._options.get(interface, []): |
| 362 | + self.cli_set(self._base_path + [interface] + option.split()) |
| 363 | + |
| 364 | + self.cli_delete(self._base_path + [interface, 'mtu']) |
| 365 | + |
| 366 | + self.cli_commit() |
| 367 | + |
337 | 368 | if __name__ == '__main__': |
338 | 369 | unittest.main(verbosity=2, failfast=VyOSUnitTestSHIM.TestCase.debug_on()) |
0 commit comments