Skip to content

Commit e48f2c1

Browse files
dmarxIOLPatrickRobbIOL
authored andcommitted
dts: add set portlist command to testpmd shell
Add a command to the testpmd shell for setting the portlist (list of forwarding ports) within a testpmd session. This allows for changing the forwarding order between ports. Signed-off-by: Dean Marx <[email protected]> Reviewed-by: Patrick Robb <[email protected]>
1 parent f9c2c14 commit e48f2c1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

dts/api/testpmd/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,23 @@ def set_queue_mbuf_fast_free(
15231523
f"Failed to get offload config on port {port_id}, queue {queue_id}:\n{output}"
15241524
)
15251525

1526+
def set_portlist(self, order: list[int], verify: bool = True) -> None:
1527+
"""Sets the order of forwarding ports.
1528+
1529+
Args:
1530+
order: List of integers representing the desired port ordering.
1531+
verify: If :data:`True` the output of the command will be scanned in an attempt to
1532+
verify that the portlist was successfully set.
1533+
1534+
Raises:
1535+
InteractiveCommandExecutionError: If the portlist could not be set.
1536+
"""
1537+
order_list = ",".join(map(str, order))
1538+
portlist_output = self.send_command(f"set portlist {order_list}")
1539+
if verify:
1540+
if "Invalid port" in portlist_output:
1541+
raise InteractiveCommandExecutionError(f"Invalid port in order {order_list}")
1542+
15261543
@_requires_started_ports
15271544
def get_offload_config(
15281545
self,

0 commit comments

Comments
 (0)