[v1,2/3] dts: parameterize ports used in pf_smoke suite

Message ID 20240906173709.17487-3-jspewock@iol.unh.edu (mailing list archive)
State Superseded
Delegated to: Juraj Linkeš
Headers
Series dts: port vf_smoke to new DTS |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jeremy Spewock Sept. 6, 2024, 5:37 p.m. UTC
From: Jeremy Spewock <jspewock@iol.unh.edu>

Currently the pf_smoke testing suite only uses the default ports for
sending and receiving packets. When looking at that suite in isolation,
this is fine since its primary goal is to test the physical functions
in the test run (which the defaults should represent). However, since
this suite represents the same coverage that should be tested on VFs, it
makes sense to parameterize the ports that are in use in the suite so
that the same test cases can be used for testing VFs.

Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
 dts/tests/TestSuite_pf_smoke_tests.py | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
  

Patch

diff --git a/dts/tests/TestSuite_pf_smoke_tests.py b/dts/tests/TestSuite_pf_smoke_tests.py
index 287132e9dd..984a193e8b 100644
--- a/dts/tests/TestSuite_pf_smoke_tests.py
+++ b/dts/tests/TestSuite_pf_smoke_tests.py
@@ -18,6 +18,7 @@ 
 from framework.params.testpmd import SimpleForwardingModes
 from framework.remote_session.testpmd_shell import TestPmdShell
 from framework.test_suite import TestSuite
+from framework.testbed_model.port import Port
 
 
 class TestPfSmokeTests(TestSuite):
@@ -35,6 +36,8 @@  class TestPfSmokeTests(TestSuite):
     is_blocking: ClassVar[bool] = True
     jumbo_frame_len: ClassVar[int] = 9000
     num_queues: int = 4
+    sut_egress_port: Port | None = None
+    sut_ingress_port: Port | None = None
 
     def set_up_suite(self) -> None:
         """Increase the MTU of the traffic generator to support jumboframes."""
@@ -48,12 +51,17 @@  def test_jumbo_frame_support(self) -> None:
             max_pkt_len=self.jumbo_frame_len,
             mbuf_size=[self.jumbo_frame_len + 128],
             forward_mode=SimpleForwardingModes.mac,
+            ports=[self.sut_egress_port, self.sut_ingress_port]
+            if self.sut_egress_port is not None and self.sut_ingress_port is not None
+            else None,
         ) as testpmd:
             testpmd.start()
             # Take 26 bytes off the MTU size to account for Ethernet headers
             payload_len = self.jumbo_frame_len - 26
             packet = Ether() / Raw("X" * payload_len)
-            recv = self.send_packet_and_capture(packet)
+            recv = self.send_packet_and_capture(
+                packet, sut_ingress=self.sut_ingress_port, sut_egress=self.sut_egress_port
+            )
             self.verify(
                 any(hasattr(p, "load") and "X" * 20 in str(p.load) for p in recv),
                 f"Jumboframe was not received even when MTU was set to {self.jumbo_frame_len}.",
@@ -73,6 +81,9 @@  def test_rss_functionality(self) -> None:
             forward_mode=SimpleForwardingModes.rxonly,
             rx_queues=self.num_queues,
             tx_queues=self.num_queues,
+            ports=[self.sut_egress_port, self.sut_ingress_port]
+            if self.sut_egress_port is not None and self.sut_ingress_port is not None
+            else None,
         ) as testpmd:
             testpmd.set_verbose(1)
             src_max = "00:00:00:00:00:01"
@@ -80,7 +91,7 @@  def test_rss_functionality(self) -> None:
                 Ether(src=src_max) / IP(dst=f"192.168.0.{i+1}") for i in range(self.num_queues * 4)
             ]
             testpmd.start()
-            self.send_packets(send_pkts)
+            self.send_packets(send_pkts, sut_ingress=self.sut_ingress_port)
             verbose_stats = TestPmdShell.extract_verbose_output(testpmd.stop())
             # Filter down the packets to only the ones with the correct source MAC
             verbose_stats = list(filter(lambda x: x.src_mac == src_max, verbose_stats))
@@ -105,7 +116,12 @@  def test_rss_functionality(self) -> None:
     def test_runtime_modify_num_queues(self) -> None:
         """Ensure that the number of queues on a port can be changed at runtime."""
         with TestPmdShell(
-            self.sut_node, rx_queues=self.num_queues, tx_queues=self.num_queues
+            self.sut_node,
+            rx_queues=self.num_queues,
+            tx_queues=self.num_queues,
+            ports=[self.sut_egress_port, self.sut_ingress_port]
+            if self.sut_egress_port is not None and self.sut_ingress_port is not None
+            else None,
         ) as testpmd:
             try:
                 testpmd.set_num_queues_all(2, True, verify=True)