[V1] tests/pmd_bonded_8023ad: wait link status up

Message ID 1653463577-12719-1-git-send-email-yux.jiang@intel.com (mailing list archive)
State Accepted
Headers
Series [V1] tests/pmd_bonded_8023ad: wait link status up |

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

Yu Jiang May 25, 2022, 7:26 a.m. UTC
  From: Yu Jiang <yux.jiang@intel.com>

Optimize script by using method wait_link_status_up to make script more stable

Signed-off-by: Yu Jiang <yux.jiang@intel.com>
---
 tests/TestSuite_pmd_bonded_8023ad.py | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
  

Comments

Tu, Lijuan May 25, 2022, 11:11 a.m. UTC | #1
On Wed, 25 May 2022 15:26:17 +0800, Yu <yux.jiang@intel.com> wrote:
> From: Yu Jiang <yux.jiang@intel.com>
> 
> Optimize script by using method wait_link_status_up to make script more stable
> 
> Signed-off-by: Yu Jiang <yux.jiang@intel.com>


Applied, thanks
  

Patch

diff --git a/tests/TestSuite_pmd_bonded_8023ad.py b/tests/TestSuite_pmd_bonded_8023ad.py
index 88d07bfd..8dd12d2b 100644
--- a/tests/TestSuite_pmd_bonded_8023ad.py
+++ b/tests/TestSuite_pmd_bonded_8023ad.py
@@ -162,7 +162,10 @@  class TestBonding8023AD(TestCase):
         self.bond_inst.d_console([start_fmt(self.bond_port), "", 15])
         time.sleep(5)
         self.bond_inst.d_console(["start", "", 10])
-        self.logger.info("set bond port ready done !!!")
+        self.verify(
+            self.bond_inst.testpmd.wait_link_status_up("all"),
+            "Failed to set bond port ready!!!",
+        )
 
     def run_8023ad_pre(self, slaves, bond_mode):
         bond_port = self.set_8023ad_bonded(slaves, bond_mode)
@@ -173,7 +176,10 @@  class TestBonding8023AD(TestCase):
         time.sleep(2)
         cmds = ["port start all", "", 10]
         self.bond_inst.d_console(cmds)
-        time.sleep(2)
+        self.verify(
+            self.bond_inst.testpmd.wait_link_status_up("all"),
+            "run_8023ad_pre: Failed to start all port",
+        )
         return bond_port
 
     def bonding_8023ad_check_macs_without_slaves(self, bond_port):
@@ -249,14 +255,10 @@  class TestBonding8023AD(TestCase):
         # start bonded device
         cmds = ["port start {0}".format(bond_port), "", 10]
         self.bond_inst.d_console(cmds)
-        status = self.bond_inst.get_port_info(bond_port, "link_status")
-        if status != "up":
-            msg = "bond port {0} fail to set up".format(bond_port)
-            self.logger.error(msg)
-            raise VerifyFailure(msg)
-        else:
-            msg = "bond port {0} set up successful !".format(bond_port)
-            self.logger.info(msg)
+        self.verify(
+            self.bond_inst.testpmd.wait_link_status_up("all", timeout=30),
+            "bond port {0} fail to set up".format(bond_port),
+        )
 
     def check_bonded_device_promisc_mode(self, slaves, bond_port):
         # disable bonded device promiscuous mode