test suite reviews and discussions
 help / color / mirror / Atom feed
From: Song Jiale <songx.jiale@intel.com>
To: dts@dpdk.org
Cc: Song Jiale <songx.jiale@intel.com>
Subject: [dts] [PATCH V2 1/5] tests/bonding: modify script to adapt changes in dpdk
Date: Fri, 17 Feb 2023 12:20:19 +0000	[thread overview]
Message-ID: <20230217122023.2345221-2-songx.jiale@intel.com> (raw)
In-Reply-To: <20230217122023.2345221-1-songx.jiale@intel.com>

the display information of the binding port in dpdk-testpmd has changed.
modify the script to adapt to this change.

According to dpdk commit f3b5f3d35c59e1("app/testpmd: use dump API to show bonding info").

Signed-off-by: Song Jiale <songx.jiale@intel.com>
---
 tests/bonding.py | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/tests/bonding.py b/tests/bonding.py
index 30f55c7f..c2c13b2a 100644
--- a/tests/bonding.py
+++ b/tests/bonding.py
@@ -19,13 +19,13 @@ from framework.pmd_output import PmdOutput
 from framework.settings import HEADER_SIZE
 
 # define bonding mode
-MODE_ROUND_ROBIN = 0
-MODE_ACTIVE_BACKUP = 1
-MODE_XOR_BALANCE = 2
-MODE_BROADCAST = 3
-MODE_LACP = 4
-MODE_TLB_BALANCE = 5
-MODE_ALB_BALANCE = 6
+MODE_ROUND_ROBIN = "ROUND_ROBIN(0)"
+MODE_ACTIVE_BACKUP = "ACTIVE_BACKUP(1)"
+MODE_XOR_BALANCE = "BALANCE(2)"
+MODE_BROADCAST = "BROADCAST(3)"
+MODE_LACP = "8023AD(4)"
+MODE_TLB_BALANCE = "TLB(5)"
+MODE_ALB_BALANCE = "ALB(6)"
 
 # define packet size
 FRAME_SIZE_64 = 64
@@ -643,7 +643,7 @@ class PmdBonding(object):
     def get_bonding_info(self, bond_port, info_types):
         """Get the specified port information by its output message format"""
         info_set = {
-            "mode": ["Bonding mode: ", "\d*"],
+            "mode": ["Bonding mode: ", "\S*"],
             "agg_mode": ["IEEE802.3AD Aggregator Mode: ", "\S*"],
             "balance_policy": ["Balance Xmit Policy: ", "\S+"],
             "slaves": [
@@ -654,7 +654,7 @@ class PmdBonding(object):
                 ["Active Slaves \(\d\): \[", "\d*( \d*)*"],
                 ["Acitve Slaves: \[", "\d*( \d*)*"],
             ],
-            "primary": ["Primary: \[", "\d*"],
+            "current_primary": ["Current Primary: \[", "\d*"],
         }
         # get all config information
         config_content = self.d_console("show bonding config %d" % bond_port)
@@ -684,18 +684,20 @@ class PmdBonding(object):
                 return None
 
     def get_active_slaves(self, bond_port):
-        primary_port = int(self.get_bonding_info(bond_port, "primary"))
+        primary_port = int(self.get_bonding_info(bond_port, "current_primary"))
         active_slaves = self.get_bonding_info(bond_port, "active_slaves")
 
         return int(primary_port), [int(slave) for slave in active_slaves]
 
-    def create_bonded_device(self, mode=0, socket=0, verify_detail=False):
+    def create_bonded_device(self, mode="", socket=0, verify_detail=False):
         """
         Create a bonding device with the parameters you specified.
         """
-        cmd = "create bonded device %d %d" % (mode, socket)
+        p = r"\w+\((\d+)\)"
+        mode_id = int(re.match(p, mode).group(1))
+        cmd = "create bonded device %d %d" % (mode_id, socket)
         out = self.d_console(cmd)
-        err_fmt = "Create bonded device on mode [%d] socket [%d] failed"
+        err_fmt = "Create bonded device on mode [%s] socket [%d] failed"
         self.verify("Created new bonded device" in out, err_fmt % (mode, socket))
         fmts = [
             "Created new bonded device net_bond_testpmd_[\d] on \(port ",
@@ -708,7 +710,7 @@ class PmdBonding(object):
         if verify_detail:
             out = self.d_console("show bonding config %d" % bond_port)
             self.verify(
-                "Bonding mode: %d" % mode in out,
+                "Bonding mode: %s" % mode in out,
                 "Bonding mode display error when create bonded device",
             )
             self.verify(
@@ -719,8 +721,8 @@ class PmdBonding(object):
                 "Active Slaves display error when create bonded device",
             )
             self.verify(
-                "Primary: []" not in out,
-                "Primary display error when create bonded device",
+                "Current Primary: []" not in out,
+                "Current Primary display error when create bonded device",
             )
             out = self.d_console("show port info %d" % bond_port)
             self.verify(
@@ -796,7 +798,7 @@ class PmdBonding(object):
         """
         cmd = "set bonding primary %d %d" % (slave_port, bond_port)
         self.d_console(cmd)
-        out = self.get_bonding_info(bond_port, "primary")
+        out = self.get_bonding_info(bond_port, "current_primary")
         if not invert_verify:
             self.verify(str(slave_port) in out, "Set bonding primary port failed")
         else:
-- 
2.25.1


  reply	other threads:[~2023-02-17  4:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17 12:20 [dts] [PATCH V2 0/5] " Song Jiale
2023-02-17 12:20 ` Song Jiale [this message]
2023-02-17 12:20 ` [dts] [PATCH V2 2/5] test_plans/pmd_bonded_8023ad: " Song Jiale
2023-02-17 12:20 ` [dts] [PATCH V2 3/5] tests/pmd_bonded_8023ad: " Song Jiale
2023-02-17 12:20 ` [dts] [PATCH V2 4/5] test_plans/pmd_bonded: " Song Jiale
2023-02-17 12:20 ` [dts] [PATCH V2 5/5] tests/pmd_bonded: " Song Jiale
2023-03-03  5:50   ` lijuan.tu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230217122023.2345221-2-songx.jiale@intel.com \
    --to=songx.jiale@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).