<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Wed, May 21, 2025 at 3:26 PM Dean Marx <<a href="mailto:dmarx@iol.unh.edu">dmarx@iol.unh.edu</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 jump action verification method and test case to Flow API test suite,<br>
as well as a case for validating flows with different priority levels.<br>
<br>
Signed-off-by: Dean Marx <<a href="mailto:dmarx@iol.unh.edu" target="_blank">dmarx@iol.unh.edu</a>><br>
---<br>
dts/tests/TestSuite_flow.py | 187 +++++++++++++++++++++++++++++++-----<br>
1 file changed, 165 insertions(+), 22 deletions(-)<br>
<br>
diff --git a/dts/tests/TestSuite_flow.py b/dts/tests/TestSuite_flow.py<br>
index 15566205c9..06bd3bedc5 100644<br>
--- a/dts/tests/TestSuite_flow.py<br>
+++ b/dts/tests/TestSuite_flow.py<br>
@@ -29,7 +29,7 @@<br>
class TestFlow(TestSuite):<br>
"""RTE Flow test suite.<br>
<br><br>
+<br>
+ @func_test<br>
+ def test_jump_action(self) -> None:<br>
+ """Validate flow rules with different group levels and jump actions.<br>
+<br>
+ Steps:<br>
+ Create a list of packets to test, with a corresponding flow list.<br>
+ Launch testpmd with the necessary configuration.<br>
+ Create each flow rule in testpmd.<br>
+ Send each packet in the list, check Rx queue ID.<br>
+<br>
+ Verify:<br>
+ Check that each packet is received on the appropriate Rx queue.<br>
+ """<br>
+ packet_list = [Ether() / IP(), Ether() / IP() / TCP(), Ether() / IP() / UDP()]<br>
+ flow_list = [<br>
+ FlowRule(direction="ingress", group_id=0, pattern=["eth"], actions=["jump group 1"]),<br>
+ FlowRule(direction="ingress", group_id=0, pattern=["ipv4"], actions=["jump group 2"]),<br>
+ FlowRule(<br>
+ direction="ingress", group_id=0, pattern=["eth / ipv4"], actions=["queue index 1"]<br>
+ ),<br>
+ FlowRule(<br>
+ direction="ingress",<br>
+ group_id=0,<br>
+ pattern=["eth / ipv4 / tcp"],<br>
+ actions=["queue index 2"],<br>
+ ),<br>
+ FlowRule(<br>
+ direction="ingress",<br>
+ group_id=0,<br>
+ pattern=["eth / ipv4 / udp"],<br>
+ actions=["queue index 3"],<br>
+ ),<br>
+ ]<br>
+ expected_queue_list = [1, 2, 3]<br>
+ with TestPmdShell(rx_queues=4, tx_queues=4) as testpmd:<br>
+ self.send_packet_and_verify_jump(<br>
+ packets=packet_list,<br>
+ flow_rules=flow_list,<br>
+ test_queues=expected_queue_list,<br>
+ testpmd=testpmd,<br>
+ )<br></blockquote><div><br></div><div>It looks like the 2nd and 3rd flow rule need to be added to group_id 1 and 2 respectively, instead of 0 and 0, in order for the jumps to groups 1 and 2 to have the desired effect you are validating on.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+ @func_test<br>
+ def test_priority_attribute(self) -> None:<br>
+ """Validate flow rules with queue actions and ethernet patterns.<br>
+<br>
+ Steps:<br>
+ Create a list of packets to test, with a corresponding flow list.<br>
+ Launch testpmd.<br>
+ Create first flow rule in flow list.<br>
+ Send first packet in packet list, capture verbose output.<br>
+ Delete flow rule, repeat for all flows/packets.<br>
+<br>
+ Verify:<br>
+ Check that each packet is received on the appropriate queue.<br>
+ """<br>
+ test_packet = Ether() / IP() / Raw()<br>
+ flow_list = [<br>
+ FlowRule(<br>
+ direction="ingress",<br>
+ priority_level=3,<br>
+ pattern=["eth / ipv4"],<br>
+ actions=["queue index 1"],<br>
+ ),<br>
+ FlowRule(<br>
+ direction="ingress",<br>
+ priority_level=2,<br>
+ pattern=["eth / ipv4"],<br>
+ actions=["queue index 2"],<br>
+ ),<br>
+ FlowRule(<br>
+ direction="ingress",<br>
+ priority_level=1,<br>
+ pattern=["eth / ipv4"],<br>
+ actions=["queue index 3"],<br>
+ ),<br>
+ ]<br>
+ expected_queue_list = [1, 2, 3]<br>
+ with TestPmdShell(rx_queues=4, tx_queues=4) as testpmd:<br>
+ testpmd.set_verbose(level=1)<br>
+ for flow, expected_queue in zip(flow_list, expected_queue_list):<br>
+ testpmd.flow_create(flow_rule=flow, port_id=0)<br>
+ testpmd.start()<br>
+ self.send_packet_and_capture(test_packet)<br>
+ verbose_output = testpmd.extract_verbose_output(testpmd.stop())<br>
+ received = False<br>
+ for testpmd_packet in verbose_output:<br>
+ if testpmd_packet.queue_id == expected_queue:<br>
+ received = True<br>
+ self.verify(received, f"Packet was not received on queue {expected_queue}")<br>
-- <br>
2.49.0<br></blockquote><div><br></div><div><br></div><div>Reviewed-by: Patrick Robb <<a href="mailto:probb@iol.unh.edu">probb@iol.unh.edu</a>> </div></div></div>