summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cli/base_interfaces_test.py23
-rwxr-xr-xscripts/cli/test_interfaces_bonding.py5
-rwxr-xr-xscripts/cli/test_interfaces_bridge.py3
-rwxr-xr-xscripts/cli/test_interfaces_ethernet.py2
4 files changed, 31 insertions, 2 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)
diff --git a/scripts/cli/test_interfaces_bonding.py b/scripts/cli/test_interfaces_bonding.py
index 7e6523778..e1abd7ff1 100755
--- a/scripts/cli/test_interfaces_bonding.py
+++ b/scripts/cli/test_interfaces_bonding.py
@@ -15,11 +15,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from base_interfaces_test import *
+from vyos.interfaces import list_interfaces_of_type
-class BondInterfaceTest(BasicInterfaceTest.BaseTest):
+class BondingInterfaceTest(BasicInterfaceTest.BaseTest):
def setUp(self):
super().setUp()
+
self._base_path = ['interfaces', 'bonding']
+ self._test_mtu = True
self._interfaces = ['bond0']
def test_add_remove_member(self):
diff --git a/scripts/cli/test_interfaces_bridge.py b/scripts/cli/test_interfaces_bridge.py
index 72e5da65f..1d462645e 100755
--- a/scripts/cli/test_interfaces_bridge.py
+++ b/scripts/cli/test_interfaces_bridge.py
@@ -15,11 +15,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from base_interfaces_test import *
+from vyos.interfaces import list_interfaces_of_type
class BridgeInterfaceTest(BasicInterfaceTest.BaseTest):
def setUp(self):
super().setUp()
+
self._base_path = ['interfaces', 'bridge']
+ self._test_mtu = True
self._interfaces = ['br0']
def test_add_remove_member(self):
diff --git a/scripts/cli/test_interfaces_ethernet.py b/scripts/cli/test_interfaces_ethernet.py
index e070ab98a..330db08e0 100755
--- a/scripts/cli/test_interfaces_ethernet.py
+++ b/scripts/cli/test_interfaces_ethernet.py
@@ -20,7 +20,9 @@ from vyos.interfaces import list_interfaces_of_type
class EthernetInterfaceTest(BasicInterfaceTest.BaseTest):
def setUp(self):
super().setUp()
+
self._base_path = ['interfaces', 'ethernet']
+ self._test_mtu = True
self._interfaces = []
# auto detect all ethernet interfaces