This implementation conflicts with other bug fixes implemented in earlier patches. The decorator was devised as a mean to make suite writing a bit simpler, semantically, but the addition of this adds too many complications for it to be worth implementing.
Signed-off-by: Nicholas Pratte <npra...@iol.unh.edu> --- dts/framework/remote_session/testpmd_shell.py | 26 +------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index 9f07696aa2..e15fc0ee8f 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -1433,28 +1433,6 @@ def _wrapper(self: "TestPmdShell", *args: P.args, **kwargs: P.kwargs): return _wrapper -def requires_forwarding_restart(func: TestPmdShellMethod) -> TestPmdShellMethod: - """Decorator for :class:`TestPmdShell` commands methods that requires forwarding restart. - - If the decorated method is called while a :class:`TestPmdShell` is actively forwarding, then - forwarding is ceased, the wrapped function is executed, and forwarding is started again. - - Args: - func: The :class:`TestPmdShell` method to decorate. - """ - - @functools.wraps(func) - def _wrapper(self: "TestPmdShell", *args: P.args, **kwargs: P.kwargs): - if self.currently_forwarding: - self._logger.debug("Forwarding needs to be restarted to continue.") - self.stop() - retval = func(self, *args, **kwargs) - self.start() - return retval - - return _wrapper - - def add_remove_mtu(mtu: int = 1500) -> Callable[[TestPmdShellMethod], TestPmdShellMethod]: """Configure MTU to `mtu` on all ports, run the decorated function, then revert. @@ -1503,7 +1481,6 @@ class TestPmdShell(DPDKShell): _command_extra_chars: ClassVar[str] = "\n" ports_started: bool - currently_forwarding: bool def __init__( self, @@ -1528,7 +1505,6 @@ def __init__( name, ) self.ports_started = not self._app_params.disable_device_start - self.currently_forwarding = not self._app_params.auto_start self._ports = None @property @@ -1926,7 +1902,7 @@ def csum_set_hw( {port_id}:\n{csum_output}""" ) - @requires_forwarding_restart + @requires_started_ports @requires_stopped_ports def set_port_mtu(self, port_id: int, mtu: int, verify: bool = True) -> None: """Change the MTU of a port using testpmd. -- 2.47.1