Skip to contentSkip to conversation

dts: add blocklist test suite

PATCH In review Luca Vizzarro 4 participants 15 messages Jun 25, 2024 – Nov 14, 2024

lore
Share & tools
lore
#0 lore raw

cover dts: add blocklist test suite

Hello,

sending in an re-implementation of the blocklist test suite. This new version slightly differs in the way it verifies if a NIC was blocked or not, but should be equivalent to the original from old DTS.

Best,

Luca

Luca Vizzarro (2):
dts: add blocked ports to EalParams
dts: add blocklist test suite

 dts/framework/config/conf_yaml_schema.json    |  3 +-
 dts/framework/params/eal.py                   |  6 +-
 dts/framework/params/types.py                 |  3 +-
 dts/framework/remote_session/dpdk_shell.py    |  4 +-
 dts/framework/remote_session/testpmd_shell.py |  2 +-
 dts/tests/TestSuite_blocklist.py              | 68 +++++++++++++++++++
 6 files changed, 80 insertions(+), 6 deletions(-)
 create mode 100644 dts/tests/TestSuite_blocklist.py
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 dts: add blocked ports to EalParams

Make the "ports" attribute of EalParams as it actually is to "allowed_ports", and add "blocked_ports".

---
 dts/framework/params/eal.py                   | 6 +++++-
 dts/framework/params/types.py                 | 3 ++-
 dts/framework/remote_session/dpdk_shell.py    | 4 ++--
 dts/framework/remote_session/testpmd_shell.py | 2 +-
 4 files changed, 10 insertions(+), 5 deletions(-)
dts/framework/params/eal.py +5 -1
index 8d7766fefc..b893d874a7 100644
@@ -42,9 +42,13 @@ class EalParams(Params):
     vdevs: list[VirtualDevice] | None = field(
         default=None, metadata=Params.multiple() | Params.long("vdev")
     )
-    ports: list[Port] | None = field(
+    allowed_ports: list[Port] | None = field(
         default=None,
         metadata=Params.convert_value(_port_to_pci) | Params.multiple() | Params.short("a"),
     )
+    blocked_ports: list[Port] | None = field(
+        default=None,
+        metadata=Params.convert_value(_port_to_pci) | Params.multiple() | Params.short("b"),
+    )
     other_eal_param: Params | None = None
     _separator: Literal[True] = field(default=True, init=False, metadata=Params.short("-"))
dts/framework/params/types.py +2 -1
index e668f658d8..0a4179fdd0 100644
@@ -49,7 +49,8 @@ class EalParamsDict(TypedDict, total=False):
     prefix: str
     no_pci: Switch
     vdevs: list[VirtualDevice] | None
-    ports: list[Port] | None
+    allowed_ports: list[Port] | None
+    blocked_ports: list[Port] | None
     other_eal_param: Params | None
 
 
dts/framework/remote_session/dpdk_shell.py +2 -2
index 296639f37d..6b4cec2466 100644
@@ -54,8 +54,8 @@ def compute_eal_params(
         sut_node.dpdk_prefix_list.append(prefix)
     params.prefix = prefix
 
-    if params.ports is None:
-        params.ports = sut_node.ports
+    if params.allowed_ports is None:
+        params.allowed_ports = sut_node.ports
 
     return params
 
dts/framework/remote_session/testpmd_shell.py +1 -1
index ec22f72221..baa773ed70 100644
@@ -638,7 +638,7 @@ def start(self, verify: bool = True) -> None:
                 self._logger.debug(f"Failed to start packet forwarding: \n{start_cmd_output}")
                 raise InteractiveCommandExecutionError("Testpmd failed to start packet forwarding.")
 
-            number_of_ports = len(self._app_params.ports or [])
+            number_of_ports = len(self._app_params.allowed_ports or [])
             for port_id in range(number_of_ports):
                 if not self.wait_link_status_up(port_id):
                     raise InteractiveCommandExecutionError(
Signature · 1 line
2.34.1
#4 lore raw

PATCH 2/2 dts: add blocklist test suite

In reply to Luca Vizzarro

This test suite tests the port blocklisting functionality built in testpmd.

---
 dts/framework/config/conf_yaml_schema.json |  3 +-
 dts/tests/TestSuite_blocklist.py           | 68 ++++++++++++++++++++++
 2 files changed, 70 insertions(+), 1 deletion(-)
 create mode 100644 dts/tests/TestSuite_blocklist.py
dts/framework/config/conf_yaml_schema.json +2 -1
index f02a310bb5..e9414ebff1 100644
@@ -187,7 +187,8 @@
       "enum": [
         "hello_world",
         "os_udp",
-        "pmd_buffer_scatter"
+        "pmd_buffer_scatter",
+        "blocklist"
       ]
     },
     "test_target": {
dts/tests/TestSuite_blocklist.py new file +68 -0

68 lines not on this page · raw message

Signature · 1 line
2.34.1
Reviewed-by Tested-by on v1 2/2
#6 lore raw
In reply to Luca Vizzarro

Barring a couple updates needed due to framework changes, this looks good and runs on a Broadcom 975908 25G NIC I used for testing.

It runs fine after switching to invoking the testpmd shell via the context manager, and removing the use of "testpmd.close()." Once a new version is submitted with these changes, in my opinion it makes sense to move this series to next-dts. Thanks!

#7 lore raw

v2 cover dts: add blocklist test suite

In reply to Luca Vizzarro

Hi there,

sending v2.

v2:
- rebased

Best,
Luca

Luca Vizzarro (2):
dts: add blocked ports to EalParams
dts: add blocklist test suite

 dts/framework/config/conf_yaml_schema.json    |  3 +-
 dts/framework/params/eal.py                   |  6 +-
 dts/framework/params/types.py                 |  3 +-
 dts/framework/remote_session/dpdk_shell.py    |  4 +-
 dts/framework/remote_session/testpmd_shell.py |  2 +-
 dts/tests/TestSuite_blocklist.py              | 63 +++++++++++++++++++
 6 files changed, 75 insertions(+), 6 deletions(-)
 create mode 100644 dts/tests/TestSuite_blocklist.py
Signature · 1 line
2.43.0
#8 lore raw

PATCH v2 1/2 dts: add blocked ports to EalParams

Make the "ports" attribute of EalParams as it actually is to "allowed_ports", and add "blocked_ports".

---
 dts/framework/params/eal.py                   | 6 +++++-
 dts/framework/params/types.py                 | 3 ++-
 dts/framework/remote_session/dpdk_shell.py    | 4 ++--
 dts/framework/remote_session/testpmd_shell.py | 2 +-
 4 files changed, 10 insertions(+), 5 deletions(-)
dts/framework/params/eal.py +5 -1
index cf1594353a..71bc781eab 100644
@@ -45,9 +45,13 @@ class EalParams(Params):
     vdevs: list[VirtualDevice] | None = field(
         default=None, metadata=Params.multiple() | Params.long("vdev")
     )
-    ports: list[Port] | None = field(
+    allowed_ports: list[Port] | None = field(
         default=None,
         metadata=Params.convert_value(_port_to_pci) | Params.multiple() | Params.short("a"),
     )
+    blocked_ports: list[Port] | None = field(
+        default=None,
+        metadata=Params.convert_value(_port_to_pci) | Params.multiple() | Params.short("b"),
+    )
     other_eal_param: Params | None = None
     _separator: Literal[True] = field(default=True, init=False, metadata=Params.short("-"))
dts/framework/params/types.py +2 -1
index d77c4625fb..87d11502e8 100644
@@ -50,7 +50,8 @@ class EalParamsDict(TypedDict, total=False):
     prefix: str
     no_pci: Switch
     vdevs: list[VirtualDevice] | None
-    ports: list[Port] | None
+    allowed_ports: list[Port] | None
+    blocked_ports: list[Port] | None
     other_eal_param: Params | None
 
 
dts/framework/remote_session/dpdk_shell.py +2 -2
index b39132cc42..82fa4755f0 100644
@@ -56,8 +56,8 @@ def compute_eal_params(
         sut_node.dpdk_prefix_list.append(prefix)
     params.prefix = prefix
 
-    if params.ports is None:
-        params.ports = sut_node.ports
+    if params.allowed_ports is None:
+        params.allowed_ports = sut_node.ports
 
     return params
 
dts/framework/remote_session/testpmd_shell.py +1 -1
index 8a45a5231b..221465f6fb 100644
@@ -1465,7 +1465,7 @@ def start(self, verify: bool = True) -> None:
                 self._logger.debug(f"Failed to start packet forwarding: \n{start_cmd_output}")
                 raise InteractiveCommandExecutionError("Testpmd failed to start packet forwarding.")
 
-            number_of_ports = len(self._app_params.ports or [])
+            number_of_ports = len(self._app_params.allowed_ports or [])
             for port_id in range(number_of_ports):
                 if not self.wait_link_status_up(port_id):
                     raise InteractiveCommandExecutionError(
Signature · 1 line
2.43.0
Reviewed-by on v2 1/2
#9 lore raw

Re: [PATCH v2 1/2] dts: add blocked ports to EalParams

Hi Luca, this looks good to me! The only thing that needs to be fixed is the attributes component of the docstring for EalParams in eal.py. Aside from that:

Quoted 77 lines · Luca Vizzarro

Make the "ports" attribute of EalParams as it actually is to "allowed_ports", and add "blocked_ports".

---
 dts/framework/params/eal.py                   | 6 +++++-
 dts/framework/params/types.py                 | 3 ++-
 dts/framework/remote_session/dpdk_shell.py    | 4 ++--
 dts/framework/remote_session/testpmd_shell.py | 2 +-
 4 files changed, 10 insertions(+), 5 deletions(-)
dts/framework/params/eal.py +5 -1
index cf1594353a..71bc781eab 100644
@@ -45,9 +45,13 @@ class EalParams(Params):
     vdevs: list[VirtualDevice] | None = field(
         default=None, metadata=Params.multiple() | Params.long("vdev")
     )
-    ports: list[Port] | None = field(
+    allowed_ports: list[Port] | None = field(
         default=None,
         metadata=Params.convert_value(_port_to_pci) | Params.multiple() | Params.short("a"),
     )
+    blocked_ports: list[Port] | None = field(
+        default=None,
+        metadata=Params.convert_value(_port_to_pci) | Params.multiple() | Params.short("b"),
+    )
     other_eal_param: Params | None = None
     _separator: Literal[True] = field(default=True, init=False, metadata=Params.short("-"))
dts/framework/params/types.py +2 -1
index d77c4625fb..87d11502e8 100644
@@ -50,7 +50,8 @@ class EalParamsDict(TypedDict, total=False):
     prefix: str
     no_pci: Switch
     vdevs: list[VirtualDevice] | None
-    ports: list[Port] | None
+    allowed_ports: list[Port] | None
+    blocked_ports: list[Port] | None
     other_eal_param: Params | None
 
 
dts/framework/remote_session/dpdk_shell.py +2 -2
index b39132cc42..82fa4755f0 100644
@@ -56,8 +56,8 @@ def compute_eal_params(
         sut_node.dpdk_prefix_list.append(prefix)
     params.prefix = prefix
 
-    if params.ports is None:
-        params.ports = sut_node.ports
+    if params.allowed_ports is None:
+        params.allowed_ports = sut_node.ports
 
     return params
 
dts/framework/remote_session/testpmd_shell.py +1 -2
index 8a45a5231b..221465f6fb 100644
@@ -1465,7 +1465,7 @@ def start(self, verify: bool = True) -> None:
                 self._logger.debug(f"Failed to start packet forwarding: \n{start_cmd_output}")
                 raise InteractiveCommandExecutionError("Testpmd failed to start packet forwarding.")
 
-            number_of_ports = len(self._app_params.ports or [])
+            number_of_ports = len(self._app_params.allowed_ports or [])
             for port_id in range(number_of_ports):
                 if not self.wait_link_status_up(port_id):
                     raise InteractiveCommandExecutionError(
--

2.43.0

#10 lore raw

Re: [PATCH v2 1/2] dts: add blocked ports to EalParams

Quoted 5 lines · Nicholas Pratte

Hi Luca, this looks good to me! The only thing that needs to be fixed is the attributes component of the docstring for EalParams in eal.py. Aside from that:

Great, catch! Thanks!

#11 lore raw

PATCH v2 2/2 dts: add blocklist test suite

In reply to Luca Vizzarro

This test suite tests the port blocklisting functionality built in testpmd.

---
 dts/framework/config/conf_yaml_schema.json |  3 +-
 dts/tests/TestSuite_blocklist.py           | 63 ++++++++++++++++++++++
 2 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 dts/tests/TestSuite_blocklist.py
dts/framework/config/conf_yaml_schema.json +2 -1
index cc3e78cef5..65d0991686 100644
@@ -244,7 +244,8 @@
         "hello_world",
         "os_udp",
         "pmd_buffer_scatter",
-        "vlan"
+        "vlan",
+        "blocklist"
       ]
     },
     "test_target": {
dts/tests/TestSuite_blocklist.py new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
2.43.0
#12 lore raw

Hi Luca, nice work!

See my small comment below/ I ran some local tests and everything seems to be working fine, so other than that minor fix I pointed out, the rest should be all set!

<snip>

Review

Quoted 3 lines

+"""The DPDK device blocklisting test suite.

(quoted diff) +2 -0
+
+This testing suite ensures tests the port blocklisting functionality of testpmd.

I would remove the 'tests' and just write 'testing suite ensures the port...'

Quoted 2 lines

+"""
+

<snip>

#13 lore raw
Quoted 5 lines · Nicholas Pratte

Hi Luca, nice work!

See my small comment below/ I ran some local tests and everything seems to be working fine, so other than that minor fix I pointed out, the rest should be all set!

Good suggestion, I've changed it a little bit now. Thanks!