* [dts] [PATCH V2 1/5] tests/bonding: modify script to adapt changes in dpdk
2023-02-17 12:20 [dts] [PATCH V2 0/5] modify script to adapt changes in dpdk Song Jiale
@ 2023-02-17 12:20 ` Song Jiale
2023-02-17 12:20 ` [dts] [PATCH V2 2/5] test_plans/pmd_bonded_8023ad: " Song Jiale
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Song Jiale @ 2023-02-17 12:20 UTC (permalink / raw)
To: dts; +Cc: Song Jiale
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dts] [PATCH V2 5/5] tests/pmd_bonded: modify script to adapt changes in dpdk
2023-02-17 12:20 [dts] [PATCH V2 0/5] modify script to adapt changes in dpdk Song Jiale
` (3 preceding siblings ...)
2023-02-17 12:20 ` [dts] [PATCH V2 4/5] test_plans/pmd_bonded: " Song Jiale
@ 2023-02-17 12:20 ` Song Jiale
2023-03-03 5:50 ` lijuan.tu
4 siblings, 1 reply; 7+ messages in thread
From: Song Jiale @ 2023-02-17 12:20 UTC (permalink / raw)
To: dts; +Cc: Song Jiale
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/TestSuite_pmd_bonded.py | 53 ++++++++++++++++++-----------------
1 file changed, 28 insertions(+), 25 deletions(-)
diff --git a/tests/TestSuite_pmd_bonded.py b/tests/TestSuite_pmd_bonded.py
index 97f76e93..a27a991a 100644
--- a/tests/TestSuite_pmd_bonded.py
+++ b/tests/TestSuite_pmd_bonded.py
@@ -25,13 +25,13 @@ from framework.test_case import TestCase
SOCKET_0 = 0
SOCKET_1 = 1
-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)"
FRAME_SIZE_64 = 64
FRAME_SIZE_65 = 65
@@ -413,7 +413,7 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)'
"""
Get the mode of the bonding device which you choose.
"""
- return self.get_info_from_bond_config("Bonding mode: ", "\d*", bond_port)
+ return self.get_info_from_bond_config("Bonding mode: ", "\S*", bond_port)
def get_bond_balance_policy(self, bond_port):
"""
@@ -449,7 +449,7 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)'
"""
Get the primary slave of the bonding device which you choose.
"""
- return self.get_info_from_bond_config("Primary: \[", "\d*", bond_port)
+ return self.get_info_from_bond_config("Current Primary: \[", "\d*", bond_port)
def launch_app(self, pmd_param=" "):
"""
@@ -457,16 +457,18 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)'
"""
self.pmdout.start_testpmd("all", param=pmd_param)
- 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.
"""
+ p = r"\w+\((\d+)\)"
+ mode_id = int(re.match(p, mode).group(1))
out = self.dut.send_expect(
- "create bonded device %d %d" % (mode, socket), "testpmd> "
+ "create bonded device %d %d" % (mode_id, socket), "testpmd> "
)
self.verify(
"Created new bonded device" in out,
- "Create bonded device on mode [%d] socket [%d] failed" % (mode, socket),
+ "Create bonded device on mode [%s] socket [%d] failed" % (mode, socket),
)
bond_port = self.get_value_from_str(
"Created new bonded device net_bonding_testpmd_[\d] on \(port ", "\d+", out
@@ -478,7 +480,7 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)'
"show bonding config %d" % bond_port, "testpmd> "
)
self.verify(
- "Bonding mode: %d" % mode in out,
+ "Bonding mode: %s" % mode in out,
"Bonding mode display error when create bonded device",
)
self.verify(
@@ -911,19 +913,20 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)'
Do some basic operations to bonded devices and slaves,
such as adding, removing, setting primary or setting mode.
"""
+ p = r"\w+\((\d+)\)"
+ mode_id = int(re.match(p, mode_set).group(1))
bond_port_0 = self.create_bonded_device(mode_set, SOCKET_0, True)
self.add_slave_to_bonding_device(bond_port_0, False, self.dut_ports[1])
-
mode_value = self.get_bond_mode(bond_port_0)
- self.verify("%d" % mode_set in mode_value, "Setting bonding mode error")
+ self.verify("%s" % mode_set in mode_value, "Setting bonding mode error")
bond_port_1 = self.create_bonded_device(mode_set, SOCKET_0)
self.add_slave_to_bonding_device(bond_port_0, False, self.dut_ports[0])
self.add_slave_to_bonding_device(bond_port_1, True, self.dut_ports[0])
- OTHER_MODE = mode_set + 1 if not mode_set else mode_set - 1
+ OTHER_MODE = mode_id + 1 if not mode_id else mode_id - 1
self.set_mode_for_bonding_device(bond_port_0, OTHER_MODE)
- self.set_mode_for_bonding_device(bond_port_0, mode_set)
+ self.set_mode_for_bonding_device(bond_port_0, mode_id)
self.add_slave_to_bonding_device(bond_port_0, False, self.dut_ports[2])
time.sleep(5)
@@ -968,14 +971,14 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)'
self.verify(
mac_address_1_orig == mac_address_bond_now
and mac_address_bond_now == mac_address_2_now,
- "NOT all slaves MAC address same with bonding device in mode %d"
+ "NOT all slaves MAC address same with bonding device in mode %s"
% mode_set,
)
else:
self.verify(
mac_address_1_orig == mac_address_bond_now
and mac_address_bond_now != mac_address_2_now,
- "All slaves should not be the same in mode %d" % mode_set,
+ "All slaves should not be the same in mode %s" % mode_set,
)
new_mac = "00:11:22:00:33:44"
@@ -990,7 +993,7 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)'
== mac_address_2_now
== mac_address_bond_now
== new_mac,
- "Set mac failed for bonding device in mode %d" % mode_set,
+ "Set mac failed for bonding device in mode %s" % mode_set,
)
elif mode_set == MODE_LACP:
self.verify(
@@ -998,14 +1001,14 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)'
and mac_address_1_now != new_mac
and mac_address_2_now != new_mac
and mac_address_1_now != mac_address_2_now,
- "Set mac failed for bonding device in mode %d" % mode_set,
+ "Set mac failed for bonding device in mode %s" % mode_set,
)
elif mode_set in [MODE_ACTIVE_BACKUP, MODE_TLB_BALANCE]:
self.verify(
mac_address_bond_now == new_mac
and mac_address_1_now == new_mac
and mac_address_bond_now != mac_address_2_now,
- "Set mac failed for bonding device in mode %d" % mode_set,
+ "Set mac failed for bonding device in mode %s" % mode_set,
)
self.set_primary_for_bonding_device(bond_port, self.dut_ports[2], False)
@@ -1117,18 +1120,18 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)'
if mode_set in [MODE_ROUND_ROBIN, MODE_XOR_BALANCE, MODE_BROADCAST]:
self.verify(
port_disabled_num == 4,
- "Not all slaves of bonded device turn promiscuous mode off in mode %d."
+ "Not all slaves of bonded device turn promiscuous mode off in mode %s."
% mode_set,
)
elif mode_set == MODE_LACP:
self.verify(
port_disabled_num == 1,
- "Not only turn bound device promiscuous mode off in mode %d" % mode_set,
+ "Not only turn bound device promiscuous mode off in mode %s" % mode_set,
)
else:
self.verify(
port_disabled_num == 2,
- "Not only the primary slave turn promiscous mode off in mode %d, "
+ "Not only the primary slave turn promiscous mode off in mode %s, "
% mode_set
+ " when bonded device promiscous disabled.",
)
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread