Hi Dean, thank you for your work.

On 08/07/2024 20:08, Dean Marx wrote:
+    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_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)
This assumes that we have port 0 and 1, but *technically* we shouldn't be making assumptions about the environment in the framework. I'd rather use show_port_info_all and sample from there what's available.
+            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_output}"
+                )
+                raise InteractiveCommandExecutionError(
+                    "Testpmd failed to set multicast mode on all ports."
+                )

Reply via email to