<div dir="ltr">Reviewed-by: Patrick Robb <<a href="mailto:probb@iol.unh.edu">probb@iol.unh.edu</a>><div>Tested-by: Patrick Robb <<a href="mailto:probb@iol.unh.edu">probb@iol.unh.edu</a>></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 8, 2024 at 12:01 PM Luca Vizzarro <<a href="mailto:luca.vizzarro@arm.com">luca.vizzarro@arm.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Add a basic L2 forwarding test suite which tests the correct<br>
functionality of the forwarding facility built-in in the DPDK.<br>
<br>
The tests are performed with different queues numbers per port.<br>
<br>
Signed-off-by: Luca Vizzarro <<a href="mailto:luca.vizzarro@arm.com" target="_blank">luca.vizzarro@arm.com</a>><br>
Signed-off-by: Thomas Wilks <<a href="mailto:thomas.wilks@arm.com" target="_blank">thomas.wilks@arm.com</a>><br>
Reviewed-by: Paul Szczepanek <<a href="mailto:paul.szczepanek@arm.com" target="_blank">paul.szczepanek@arm.com</a>><br>
Reviewed-by: Dean Marx <<a href="mailto:dmarx@iol.unh.edu" target="_blank">dmarx@iol.unh.edu</a>><br>
Reviewed-by: Patrick Robb <<a href="mailto:probb@iol.unh.edu" target="_blank">probb@iol.unh.edu</a>><br>
Tested-by: Patrick Robb <<a href="mailto:probb@iol.unh.edu" target="_blank">probb@iol.unh.edu</a>><br>
---<br>
 dts/tests/TestSuite_l2fwd.py | 63 ++++++++++++++++++++++++++++++++++++<br>
 1 file changed, 63 insertions(+)<br>
 create mode 100644 dts/tests/TestSuite_l2fwd.py<br>
<br>
diff --git a/dts/tests/TestSuite_l2fwd.py b/dts/tests/TestSuite_l2fwd.py<br>
new file mode 100644<br>
index 0000000000..0f6ff18907<br>
--- /dev/null<br>
+++ b/dts/tests/TestSuite_l2fwd.py<br>
@@ -0,0 +1,63 @@<br>
+# SPDX-License-Identifier: BSD-3-Clause<br>
+# Copyright(c) 2024 Arm Limited<br>
+<br>
+"""Basic L2 forwarding test suite.<br>
+<br>
+This testing suites runs basic L2 forwarding on testpmd across multiple different queue sizes.<br>
+The forwarding test is performed with several packets being sent at once.<br>
+"""<br>
+<br>
+from framework.params.testpmd import EthPeer, SimpleForwardingModes<br>
+from framework.remote_session.testpmd_shell import TestPmdShell<br>
+from framework.test_suite import TestSuite, func_test<br>
+from framework.testbed_model.capability import requires<br>
+from framework.testbed_model.cpu import LogicalCoreCount<br>
+from framework.testbed_model.topology import TopologyType<br>
+from framework.utils import generate_random_packets<br>
+<br>
+<br>
+@requires(topology_type=TopologyType.two_links)<br>
+class TestL2fwd(TestSuite):<br>
+    """L2 forwarding test suite."""<br>
+<br>
+    #: The total number of packets to generate and send for forwarding.<br>
+    NUMBER_OF_PACKETS_TO_SEND = 50<br>
+    #: The payload size to use for the generated packets in bytes.<br>
+    PAYLOAD_SIZE = 100<br>
+<br>
+    def set_up_suite(self) -> None:<br>
+        """Set up the test suite.<br>
+<br>
+        Setup:<br>
+            Generate the random packets that will be sent.<br>
+        """<br>
+        self.packets = generate_random_packets(self.NUMBER_OF_PACKETS_TO_SEND, self.PAYLOAD_SIZE)<br>
+<br>
+    @func_test<br>
+    def l2fwd_integrity(self) -> None:<br>
+        """Test the L2 forwarding integrity.<br>
+<br>
+        Test:<br>
+            Configure a testpmd shell with a different numbers of queues (1, 2, 4 and 8) per run.<br>
+            Start up L2 forwarding, send random packets from the TG and verify they were all<br>
+            received back.<br>
+        """<br>
+        queues = [1, 2, 4, 8]<br>
+<br>
+        with TestPmdShell(<br>
+            self.sut_node,<br>
+            lcore_filter_specifier=LogicalCoreCount(cores_per_socket=4),<br>
+            forward_mode=SimpleForwardingModes.mac,<br>
+            eth_peer=[EthPeer(1, self.tg_node.ports[1].mac_address)],<br>
+            disable_device_start=True,<br>
+        ) as shell:<br>
+            for queues_num in queues:<br>
+                self._<a href="http://logger.info" rel="noreferrer" target="_blank">logger.info</a>(f"Testing L2 forwarding with {queues_num} queue(s)")<br>
+                shell.set_ports_queues(queues_num)<br>
+                shell.start()<br>
+<br>
+                received_packets = self.send_packets_and_capture(self.packets)<br>
+                expected_packets = self.get_expected_packets(self.packets)<br>
+                self.match_all_packets(expected_packets, received_packets)<br>
+<br>
+                shell.stop()<br>
-- <br>
2.43.0<br>
<br>
</blockquote></div>