[v8,1/2] dts: add multicast set function to shell

Message ID 20250115162959.12975-1-dmarx@iol.unh.edu (mailing list archive)
State Accepted
Delegated to: Paul Szczepanek
Headers
Series [v8,1/2] dts: add multicast set function to shell |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Dean Marx Jan. 15, 2025, 4:29 p.m. UTC
Add set multicast function for changing allmulticast mode
within testpmd shell.

Signed-off-by: Dean Marx <dmarx@iol.unh.edu>
---
 dts/framework/remote_session/testpmd_shell.py | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
  

Comments

Patrick Robb Jan. 16, 2025, 5:13 a.m. UTC | #1
Hi Dean. This looks good to me, though I agree Luca's point about
show_port_info_all() is compelling. We are enforcing the paired topology
today but may not always.

I don't view it as something which should block the testsuite, but this is
worth tracking. Can you make a Bugzilla ticket for this, and add to the
minutes for the DTS meeting (either tomorrow or 2 weeks)?

Reviewed-by: Patrick Robb <probb@iol.unh.edu>

On Wed, Jan 15, 2025 at 11:30 AM Dean Marx <dmarx@iol.unh.edu> wrote:

> Add set multicast function for changing allmulticast mode
> within testpmd shell.
>
> Signed-off-by: Dean Marx <dmarx@iol.unh.edu>
> ---
>  dts/framework/remote_session/testpmd_shell.py | 24 +++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/dts/framework/remote_session/testpmd_shell.py
> b/dts/framework/remote_session/testpmd_shell.py
> index aa55bd91d3..94ff14a0a6 100644
> --- a/dts/framework/remote_session/testpmd_shell.py
> +++ b/dts/framework/remote_session/testpmd_shell.py
> @@ -1795,6 +1795,30 @@ def show_port_stats(self, port_id: int) ->
> TestPmdPortStats:
>
>          return TestPmdPortStats.parse(output)
>
> +    def set_multicast_all(self, on: bool, verify: bool = True):
> +        """Turns multicast mode on/off for the specified port.
> +
> +        Args:
> +            on: If :data:`True`, turns multicast mode on, otherwise turns
> off.
> +            verify: If :data:`True` an additional command will be sent to
> verify
> +            that multicast mode is properly set. Defaults to :data:`True`.
> +
> +        Raises:
> +            InteractiveCommandExecutionError: If `verify` is :data:`True`
> and multicast
> +                mode is not properly set.
> +        """
> +        multicast_cmd_output = self.send_command(f"set allmulti all {'on'
> if on else 'off'}")
> +        if verify:
> +            stats0 = self.show_port_info(port_id=0)
> +            stats1 = self.show_port_info(port_id=1)
> +            if on ^ (stats0.is_allmulticast_mode_enabled and
> stats1.is_allmulticast_mode_enabled):
> +                self._logger.debug(
> +                    f"Failed to set multicast mode on all ports.:
> \n{multicast_cmd_output}"
> +                )
> +                raise InteractiveCommandExecutionError(
> +                    "Testpmd failed to set multicast mode on all ports."
> +                )
> +
>      @requires_stopped_ports
>      def csum_set_hw(
>          self, layers: ChecksumOffloadOptions, port_id: int, verify: bool
> = True
> --
> 2.44.0
>
>
  
Patrick Robb Jan. 16, 2025, 5:15 a.m. UTC | #2
Thanks, applied to next-dts.
  

Patch

diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py
index aa55bd91d3..94ff14a0a6 100644
--- a/dts/framework/remote_session/testpmd_shell.py
+++ b/dts/framework/remote_session/testpmd_shell.py
@@ -1795,6 +1795,30 @@  def show_port_stats(self, port_id: int) -> TestPmdPortStats:
 
         return TestPmdPortStats.parse(output)
 
+    def set_multicast_all(self, on: bool, verify: bool = True):
+        """Turns multicast mode on/off for the specified port.
+
+        Args:
+            on: If :data:`True`, turns multicast mode on, otherwise turns off.
+            verify: If :data:`True` an additional command will be sent to verify
+            that multicast mode is properly set. Defaults to :data:`True`.
+
+        Raises:
+            InteractiveCommandExecutionError: If `verify` is :data:`True` and multicast
+                mode is not properly set.
+        """
+        multicast_cmd_output = self.send_command(f"set allmulti all {'on' if on else 'off'}")
+        if verify:
+            stats0 = self.show_port_info(port_id=0)
+            stats1 = self.show_port_info(port_id=1)
+            if on ^ (stats0.is_allmulticast_mode_enabled and stats1.is_allmulticast_mode_enabled):
+                self._logger.debug(
+                    f"Failed to set multicast mode on all ports.: \n{multicast_cmd_output}"
+                )
+                raise InteractiveCommandExecutionError(
+                    "Testpmd failed to set multicast mode on all ports."
+                )
+
     @requires_stopped_ports
     def csum_set_hw(
         self, layers: ChecksumOffloadOptions, port_id: int, verify: bool = True