Add the capabilities advertised by the testpmd command "show port info"
so that test cases may be marked as requiring those capabilities:
RUNTIME_RX_QUEUE_SETUP
RUNTIME_TX_QUEUE_SETUP
RXQ_SHARE
FLOW_RULE_KEEP
FLOW_SHARED_OBJECT_KEEP

These names are copy pasted from the existing DeviceCapabilitiesFlag
class. Dynamic addition of Enum members runs into problems with typing
(mypy doesn't know about the members) and documentation generation
(Sphinx doesn't know about the members).

Signed-off-by: Juraj Linkeš <juraj.lin...@pantheon.tech>
---
 dts/framework/remote_session/testpmd_shell.py | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/dts/framework/remote_session/testpmd_shell.py 
b/dts/framework/remote_session/testpmd_shell.py
index f83569669e..166ffc827e 100644
--- a/dts/framework/remote_session/testpmd_shell.py
+++ b/dts/framework/remote_session/testpmd_shell.py
@@ -1200,6 +1200,24 @@ def get_capabilities_rxq_info(
         else:
             unsupported_capabilities.add(NicCapability.SCATTERED_RX_ENABLED)
 
+    def get_capabilities_show_port_info(
+        self,
+        supported_capabilities: MutableSet["NicCapability"],
+        unsupported_capabilities: MutableSet["NicCapability"],
+    ) -> None:
+        """Get all capabilities from show port info and divide them into 
supported and unsupported.
+
+        Args:
+            supported_capabilities: Supported capabilities will be added to 
this set.
+            unsupported_capabilities: Unsupported capabilities will be added 
to this set.
+        """
+        self._update_capabilities_from_flag(
+            supported_capabilities,
+            unsupported_capabilities,
+            DeviceCapabilitiesFlag,
+            self.ports[0].device_capabilities,
+        )
+
     """
     ====== Decorator methods ======
     """
@@ -1332,6 +1350,24 @@ class NicCapability(NoAliasEnum):
     RX_OFFLOAD_VLAN: TestPmdShellCapabilityMethod = partial(
         TestPmdShell.get_capabilities_rx_offload
     )
+    #: Device supports Rx queue setup after device started.
+    RUNTIME_RX_QUEUE_SETUP: TestPmdShellCapabilityMethod = partial(
+        TestPmdShell.get_capabilities_show_port_info
+    )
+    #: Device supports Tx queue setup after device started.
+    RUNTIME_TX_QUEUE_SETUP: TestPmdShellCapabilityMethod = partial(
+        TestPmdShell.get_capabilities_show_port_info
+    )
+    #: Device supports shared Rx queue among ports within Rx domain and switch 
domain.
+    RXQ_SHARE: TestPmdShellCapabilityMethod = 
partial(TestPmdShell.get_capabilities_show_port_info)
+    #: Device supports keeping flow rules across restart.
+    FLOW_RULE_KEEP: TestPmdShellCapabilityMethod = partial(
+        TestPmdShell.get_capabilities_show_port_info
+    )
+    #: Device supports keeping shared flow objects across restart.
+    FLOW_SHARED_OBJECT_KEEP: TestPmdShellCapabilityMethod = partial(
+        TestPmdShell.get_capabilities_show_port_info
+    )
 
     def __call__(
         self,
-- 
2.34.1

Reply via email to