diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-02-17 20:47:54 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-02-17 21:04:08 +0100 |
commit | f95c1471f241f2c0a4d0dca5832a1636755ee391 (patch) | |
tree | cab657cf0b1d45117c481c9b33815a0d41f30add /scripts/cli/base_interfaces_test.py | |
parent | 175447bfec4cb60068fcea9899b09fcbdd2103ba (diff) | |
download | vyos-1x-f95c1471f241f2c0a4d0dca5832a1636755ee391.tar.gz vyos-1x-f95c1471f241f2c0a4d0dca5832a1636755ee391.zip |
interfaces: add generic MTU test which can be enabled per interface
Diffstat (limited to 'scripts/cli/base_interfaces_test.py')
-rw-r--r-- | scripts/cli/base_interfaces_test.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/scripts/cli/base_interfaces_test.py b/scripts/cli/base_interfaces_test.py index e6667f993..885995fb8 100644 --- a/scripts/cli/base_interfaces_test.py +++ b/scripts/cli/base_interfaces_test.py @@ -55,7 +55,7 @@ class BasicInterfaceTest: def test_add_address(self): """ - Check if address can be added to interface + Check if IPv4/IPv6 addresses can be added to interface. """ # Add address @@ -74,3 +74,24 @@ class BasicInterfaceTest: self.assertTrue(is_intf_addr_assigned(intf, addr['addr'])) + + def test_change_mtu(self): + """ + Check if MTU can be changed on interface. + Test MTU size will be 1400 bytes. + """ + if self._test_mtu is False: + return None + + # choose a MTU which works on every interface + mtu = '1400' + for intf in self._interfaces: + self.session.set(self._base_path + [intf, 'mtu', mtu]) + + self.session.commit() + + # Validate interface description + for intf in self._interfaces: + with open('/sys/class/net/{}/mtu'.format(intf), 'r') as f: + tmp = f.read().rstrip() + self.assertTrue(tmp == mtu) |