summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/base_interfaces_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'smoketest/scripts/cli/base_interfaces_test.py')
-rw-r--r--smoketest/scripts/cli/base_interfaces_test.py44
1 files changed, 19 insertions, 25 deletions
diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py
index b83091ea6..9a592f8c4 100644
--- a/smoketest/scripts/cli/base_interfaces_test.py
+++ b/smoketest/scripts/cli/base_interfaces_test.py
@@ -230,8 +230,8 @@ class BasicInterfaceTest:
# verify changed MTU
for intf in self._interfaces:
- tmp = read_file(f'/sys/class/net/{intf}/mtu')
- self.assertEqual(tmp, self._mtu)
+ tmp = get_interface_config(intf)
+ self.assertEqual(tmp['mtu'], int(self._mtu))
def test_mtu_1200_no_ipv6_interface(self):
# Testcase if MTU can be changed to 1200 on non IPv6
@@ -255,8 +255,8 @@ class BasicInterfaceTest:
# verify changed MTU
for intf in self._interfaces:
- tmp = read_file(f'/sys/class/net/{intf}/mtu')
- self.assertEqual(tmp, self._mtu)
+ tmp = get_interface_config(intf)
+ self.assertEqual(tmp['mtu'], int(self._mtu))
self._mtu = old_mtu
@@ -275,7 +275,6 @@ class BasicInterfaceTest:
for vlan in self._vlan_range:
base = self._base_path + [interface, 'vif', vlan]
- self.cli_set(base + ['mtu', self._mtu])
for address in self._test_addr:
self.cli_set(base + ['address', address])
self.cli_set(base + ['ingress-qos', '0:1'])
@@ -287,26 +286,24 @@ class BasicInterfaceTest:
for vlan in self._vlan_range:
vif = f'{intf}.{vlan}'
tmp = get_interface_config(f'{vif}')
-
+
tmp2 = dict_search('linkinfo.info_data.ingress_qos', tmp)
for item in tmp2 if tmp2 else []:
from_key = item['from']
to_key = item['to']
self.assertEqual(from_key, 0)
self.assertEqual(to_key, 1)
-
+
tmp2 = dict_search('linkinfo.info_data.egress_qos', tmp)
for item in tmp2 if tmp2 else []:
from_key = item['from']
to_key = item['to']
self.assertEqual(from_key, 1)
self.assertEqual(to_key, 6)
-
+
for address in self._test_addr:
self.assertTrue(is_intf_addr_assigned(vif, address))
- tmp = read_file(f'/sys/class/net/{vif}/mtu')
- self.assertEqual(tmp, self._mtu)
self.assertEqual(Interface(vif).get_admin_state(), 'up')
def test_vif_qos_change(self):
@@ -316,7 +313,7 @@ class BasicInterfaceTest:
# tearDown() test in the end that no interface is allowed to survive!
if not self._test_vlan:
self.skipTest('not supported')
-
+
for interface in self._interfaces:
base = self._base_path + [interface]
for option in self._options.get(interface, []):
@@ -324,40 +321,37 @@ class BasicInterfaceTest:
for vlan in self._vlan_range:
base = self._base_path + [interface, 'vif', vlan]
- self.cli_set(base + ['mtu', self._mtu])
for address in self._test_addr:
self.cli_set(base + ['address', address])
self.cli_set(base + ['ingress-qos', '0:1'])
self.cli_set(base + ['egress-qos', '1:6'])
self.cli_commit()
-
+
for intf in self._interfaces:
for vlan in self._vlan_range:
vif = f'{intf}.{vlan}'
tmp = get_interface_config(f'{vif}')
-
+
tmp2 = dict_search('linkinfo.info_data.ingress_qos', tmp)
for item in tmp2 if tmp2 else []:
from_key = item['from']
to_key = item['to']
self.assertEqual(from_key, 0)
self.assertEqual(to_key, 1)
-
+
tmp2 = dict_search('linkinfo.info_data.egress_qos', tmp)
for item in tmp2 if tmp2 else []:
from_key = item['from']
to_key = item['to']
self.assertEqual(from_key, 1)
self.assertEqual(to_key, 6)
-
+
for address in self._test_addr:
self.assertTrue(is_intf_addr_assigned(vif, address))
- tmp = read_file(f'/sys/class/net/{vif}/mtu')
- self.assertEqual(tmp, self._mtu)
self.assertEqual(Interface(vif).get_admin_state(), 'up')
-
+
new_ingress_qos_from = 1
new_ingress_qos_to = 6
new_egress_qos_from = 2
@@ -370,21 +364,21 @@ class BasicInterfaceTest:
self.cli_delete(base + ['egress-qos', '1:6'])
self.cli_set(base + ['ingress-qos', f'{new_ingress_qos_from}:{new_ingress_qos_to}'])
self.cli_set(base + ['egress-qos', f'{new_egress_qos_from}:{new_egress_qos_to}'])
-
+
self.cli_commit()
-
+
for intf in self._interfaces:
for vlan in self._vlan_range:
vif = f'{intf}.{vlan}'
tmp = get_interface_config(f'{vif}')
-
+
tmp2 = dict_search('linkinfo.info_data.ingress_qos', tmp)
if tmp2:
from_key = tmp2[0]['from']
to_key = tmp2[0]['to']
self.assertEqual(from_key, new_ingress_qos_from)
self.assertEqual(to_key, new_ingress_qos_to)
-
+
tmp2 = dict_search('linkinfo.info_data.egress_qos', tmp)
if tmp2:
from_key = tmp2[0]['from']
@@ -465,8 +459,8 @@ class BasicInterfaceTest:
# for address in self._test_addr:
# self.assertTrue(is_intf_addr_assigned(vif, address))
- tmp = read_file(f'/sys/class/net/{vif}/mtu')
- self.assertEqual(tmp, self._mtu)
+ tmp = get_interface_config(vif)
+ self.assertEqual(tmp['mtu'], int(self._mtu))
def test_vif_s_protocol_change(self):
# XXX: This testcase is not allowed to run as first testcase, reason