summaryrefslogtreecommitdiff
path: root/scripts/cli
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-07-17 20:38:22 +0200
committerChristian Poessinger <christian@poessinger.com>2020-07-17 20:38:28 +0200
commita76433c1fde7e7a2c2ee7d5e4078815fb7211184 (patch)
treef423c812b02a10a1946e3587a505027d1319e71f /scripts/cli
parent8822783cabeae4b38f881c752a4f2fc3e72d2d70 (diff)
downloadvyos-1x-a76433c1fde7e7a2c2ee7d5e4078815fb7211184.tar.gz
vyos-1x-a76433c1fde7e7a2c2ee7d5e4078815fb7211184.zip
interfaces: VLAN tests can not be "functionized" any further
Diffstat (limited to 'scripts/cli')
-rw-r--r--scripts/cli/base_interfaces_test.py31
1 files changed, 13 insertions, 18 deletions
diff --git a/scripts/cli/base_interfaces_test.py b/scripts/cli/base_interfaces_test.py
index e73bc6138..20899b9b1 100644
--- a/scripts/cli/base_interfaces_test.py
+++ b/scripts/cli/base_interfaces_test.py
@@ -134,29 +134,24 @@ class BasicInterfaceTest:
for intf in self._interfaces:
self._mtu_test(intf)
- def _vlan_config(self, intf):
- for vlan in self._vlan_range:
- base = self._base_path + [intf, 'vif', vlan]
- self.session.set(base + ['mtu', self._mtu])
- for address in self._test_addr:
- self.session.set(base + ['address', address])
-
- def _vlan_test(self, intf):
- for vlan in self._vlan_range:
- vif = f'{intf}.{vlan}'
- for address in self._test_addr:
- self.assertTrue(is_intf_addr_assigned(vif, address))
- with open(f'/sys/class/net/{vif}/mtu', 'r') as f:
- tmp = f.read().rstrip()
- self.assertEqual(tmp, self._mtu)
-
def test_8021q_vlan(self):
+ """ Testcase for 802.1q VLAN interfaces """
if not self._test_vlan:
return None
for intf in self._interfaces:
- self._vlan_config(intf)
+ for vlan in self._vlan_range:
+ base = self._base_path + [intf, 'vif', vlan]
+ self.session.set(base + ['mtu', self._mtu])
+ for address in self._test_addr:
+ self.session.set(base + ['address', address])
+
self.session.commit()
for intf in self._interfaces:
- self._vlan_test(intf)
+ for vlan in self._vlan_range:
+ vif = f'{intf}.{vlan}'
+ for address in self._test_addr:
+ self.assertTrue(is_intf_addr_assigned(vif, address))
+ self._mtu_test(vif)
+