]> git.feebdaed.xyz Git - 0xmirror/dpdk.git/commitdiff
dts: add port list command to testpmd shell
authorDean Marx <dmarx@iol.unh.edu>
Fri, 7 Nov 2025 21:50:17 +0000 (16:50 -0500)
committerPatrick Robb <probb@iol.unh.edu>
Thu, 13 Nov 2025 02:04:39 +0000 (03:04 +0100)
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 <dmarx@iol.unh.edu>
Reviewed-by: Patrick Robb <probb@iol.unh.edu>
dts/api/testpmd/__init__.py

index 2a3ec49a765e787aa8e6cb98b18f327972747a5f..0891b9edbc2877adad79da39c29f2c0d7cd6be77 100644 (file)
@@ -1523,6 +1523,23 @@ class TestPmd(DPDKShell):
                 f"Failed to get offload config on port {port_id}, queue {queue_id}:\n{output}"
             )
 
+    def set_portlist(self, order: list[int], verify: bool = True) -> None:
+        """Sets the order of forwarding ports.
+
+        Args:
+            order: List of integers representing the desired port ordering.
+            verify: If :data:`True` the output of the command will be scanned in an attempt to
+                verify that the portlist was successfully set.
+
+        Raises:
+            InteractiveCommandExecutionError: If the portlist could not be set.
+        """
+        order_list = ",".join(map(str, order))
+        portlist_output = self.send_command(f"set portlist {order_list}")
+        if verify:
+            if "Invalid port" in portlist_output:
+                raise InteractiveCommandExecutionError(f"Invalid port in order {order_list}")
+
     @_requires_started_ports
     def get_offload_config(
         self,