The multicast address filter component of the mac filter test suite
is definitively supported across all vendors. Thus, a simple capability
check is added to ensure that this functionality is supported.

Bugzilla ID: 1454
Signed-off-by: Nicholas Pratte <npra...@iol.unh.edu>
---
 dts/framework/remote_session/testpmd_shell.py | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/dts/framework/remote_session/testpmd_shell.py 
b/dts/framework/remote_session/testpmd_shell.py
index 6beec66e43..f350568b70 100644
--- a/dts/framework/remote_session/testpmd_shell.py
+++ b/dts/framework/remote_session/testpmd_shell.py
@@ -2086,6 +2086,27 @@ def get_capabilities_show_port_info(
             self.ports[0].device_capabilities,
         )
 
+    def get_capabilities_mcast_filtering(
+        self,
+        supported_capabilities: MutableSet["NicCapability"],
+        unsupported_capabilities: MutableSet["NicCapability"],
+    ) -> None:
+        """Get multicast filtering capability from mcast_addr add and check 
for testpmd error code.
+
+        Args:
+            supported_capabilities: Supported capabilities will be added to 
this set.
+            unsupported_capabilities: Unsupported capabilities will be added 
to this set.
+        """
+        self._logger.debug("Getting mcast filter capabilities.")
+        command = f"mcast_addr add {self.ports[0].id} 01:00:5E:00:00:00"
+        output = self.send_command(command)
+        if "diag=-95" in output:
+            unsupported_capabilities.add(NicCapability.MCAST_FILTERING)
+        else:
+            supported_capabilities.add(NicCapability.MCAST_FILTERING)
+            command = str.replace(command, "add", "remove", 1)
+            self.send_command(command)
+
 
 class NicCapability(NoAliasEnum):
     """A mapping between capability names and the associated 
:class:`TestPmdShell` methods.
@@ -2217,6 +2238,10 @@ class NicCapability(NoAliasEnum):
     FLOW_SHARED_OBJECT_KEEP: TestPmdShellCapabilityMethod = functools.partial(
         TestPmdShell.get_capabilities_show_port_info
     )
+    #: Device supports multicast address filtering.
+    MCAST_FILTERING: TestPmdShellCapabilityMethod = functools.partial(
+        TestPmdShell.get_capabilities_mcast_filtering
+    )
 
     def __call__(
         self,
-- 
2.44.0

Reply via email to