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

Message ID 20230529154112.84789-1-weiyuanx.li@intel.com (mailing list archive)
State Accepted
Headers
Series [V1] tests/vf_pmd_stacked_bonded: optimize script to check link status |

Checks

Context Check Description
ci/Intel-dts-format-test success Testing OK
ci/Intel-dts-pylama-test success Testing OK
ci/Intel-dts-suite-test success Testing OK

Commit Message

Weiyuan Li May 29, 2023, 3:41 p.m. UTC
  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@intel.com>
---
 tests/TestSuite_vf_pmd_stacked_bonded.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Comments

Tu, Lijuan June 7, 2023, 5:58 a.m. UTC | #1
On Mon, 29 May 2023 15:41:11 +0000, Weiyuan Li <weiyuanx.li@intel.com> wrote:
> 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@intel.com>


Applied, thanks
  

Patch

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