diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index ca24b28070..c1462ba2d3 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -888,6 +888,51 @@ def show_port_stats(self, port_id: int) -> TestPmdPortStats:
+ def set_port_mtu_all(self, mtu: int, verify: bool = True) -> None: + """Change the MTU of all ports using testpmd. + + Runs :meth:`set_port_mtu` for every port that testpmd is aware of. + + Args: + mtu: Desired value for the MTU to be set to. + verify: Whether to verify that setting the MTU on each port was successful or not. + Defaults to :data:`True`. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and the MTU was not + properly updated on at least one port. + """ + if self._app_params.ports is not None:
We should utilize the port info caching patch here: https://patches.dpdk.org/project/dpdk/patch/20240823074137.13989-1-juraj.lin...@pantheon.tech/ Other than that, the patch looks good.
+ for port_id in range(len(self._app_params.ports)): + self.set_port_mtu(port_id, mtu, verify) + def _close(self) -> None: """Overrides :meth:`~.interactive_shell.close`.""" self.stop()