[dts][PATCH V1] tests/vf_pmd_stacked_bonded: optimize script to check link status

Weiyuan Li weiyuanx.li at intel.com
Mon May 29 17:41:11 CEST 2023


Optimize the testing script to check the status of the link. If the status is down, execute the up command.

Signed-off-by: Weiyuan Li <weiyuanx.li at intel.com>
---
 tests/TestSuite_vf_pmd_stacked_bonded.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/TestSuite_vf_pmd_stacked_bonded.py b/tests/TestSuite_vf_pmd_stacked_bonded.py
index 615e9517..0a5bc2be 100644
--- a/tests/TestSuite_vf_pmd_stacked_bonded.py
+++ b/tests/TestSuite_vf_pmd_stacked_bonded.py
@@ -403,7 +403,8 @@ class TestVFPmdStackedBonded(TestCase):
         self.verify("bsdapp" not in self.target, "Bonding not support freebsd")
         self.dut_ports = self.dut.get_ports()
         self.dport_info0 = self.dut.ports_info[self.dut_ports[0]]
-        self.dport_ifaces = self.dport_info0["intf"]
+        self.dport_ifaces_port0 = self.dport_info0["intf"]
+        self.dport_ifaces_port1 = self.dut.ports_info[self.dut_ports[1]]["intf"]
         num_ports = len(self.dut_ports)
         self.verify(num_ports == 2 or num_ports == 4, "Insufficient ports")
         tester_port0 = self.tester.get_local_port(self.dut_ports[0])
@@ -444,6 +445,11 @@ class TestVFPmdStackedBonded(TestCase):
         Run before each test case.
         """
         self.create_vfs(pf_list=self.dut_ports, vf_num=1)
+        port0_stats = self.dut.is_interface_up(self.dport_ifaces_port0)
+        port1_stats = self.dut.is_interface_up(self.dport_ifaces_port1)
+        if not all([port0_stats, port1_stats]):
+            self.dut.send_expect(f"ip link set {self.dport_ifaces_port0} up", "# ")
+            self.dut.send_expect(f"ip link set {self.dport_ifaces_port1} up", "# ")
         self.eal_param = ""
         for pci in self.vfs_pci:
             self.eal_param += " -a %s" % pci
-- 
2.34.1



More information about the dts mailing list