On Wed, May 21, 2025 at 3:26 PM Dean Marx wrote: > Add jump action verification method and test case to Flow API test suite, > as well as a case for validating flows with different priority levels. > > Signed-off-by: Dean Marx > --- > dts/tests/TestSuite_flow.py | 187 +++++++++++++++++++++++++++++++----- > 1 file changed, 165 insertions(+), 22 deletions(-) > > diff --git a/dts/tests/TestSuite_flow.py b/dts/tests/TestSuite_flow.py > index 15566205c9..06bd3bedc5 100644 > --- a/dts/tests/TestSuite_flow.py > +++ b/dts/tests/TestSuite_flow.py > @@ -29,7 +29,7 @@ > class TestFlow(TestSuite): > """RTE Flow test suite. > > > + > + @func_test > + def test_jump_action(self) -> None: > + """Validate flow rules with different group levels and jump > actions. > + > + Steps: > + Create a list of packets to test, with a corresponding flow > list. > + Launch testpmd with the necessary configuration. > + Create each flow rule in testpmd. > + Send each packet in the list, check Rx queue ID. > + > + Verify: > + Check that each packet is received on the appropriate Rx > queue. > + """ > + packet_list = [Ether() / IP(), Ether() / IP() / TCP(), Ether() / > IP() / UDP()] > + flow_list = [ > + FlowRule(direction="ingress", group_id=0, pattern=["eth"], > actions=["jump group 1"]), > + FlowRule(direction="ingress", group_id=0, pattern=["ipv4"], > actions=["jump group 2"]), > + FlowRule( > + direction="ingress", group_id=0, pattern=["eth / ipv4"], > actions=["queue index 1"] > + ), > + FlowRule( > + direction="ingress", > + group_id=0, > + pattern=["eth / ipv4 / tcp"], > + actions=["queue index 2"], > + ), > + FlowRule( > + direction="ingress", > + group_id=0, > + pattern=["eth / ipv4 / udp"], > + actions=["queue index 3"], > + ), > + ] > + expected_queue_list = [1, 2, 3] > + with TestPmdShell(rx_queues=4, tx_queues=4) as testpmd: > + self.send_packet_and_verify_jump( > + packets=packet_list, > + flow_rules=flow_list, > + test_queues=expected_queue_list, > + testpmd=testpmd, > + ) > 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. > + > + @func_test > + def test_priority_attribute(self) -> None: > + """Validate flow rules with queue actions and ethernet patterns. > + > + Steps: > + Create a list of packets to test, with a corresponding flow > list. > + Launch testpmd. > + Create first flow rule in flow list. > + Send first packet in packet list, capture verbose output. > + Delete flow rule, repeat for all flows/packets. > + > + Verify: > + Check that each packet is received on the appropriate queue. > + """ > + test_packet = Ether() / IP() / Raw() > + flow_list = [ > + FlowRule( > + direction="ingress", > + priority_level=3, > + pattern=["eth / ipv4"], > + actions=["queue index 1"], > + ), > + FlowRule( > + direction="ingress", > + priority_level=2, > + pattern=["eth / ipv4"], > + actions=["queue index 2"], > + ), > + FlowRule( > + direction="ingress", > + priority_level=1, > + pattern=["eth / ipv4"], > + actions=["queue index 3"], > + ), > + ] > + expected_queue_list = [1, 2, 3] > + with TestPmdShell(rx_queues=4, tx_queues=4) as testpmd: > + testpmd.set_verbose(level=1) > + for flow, expected_queue in zip(flow_list, > expected_queue_list): > + testpmd.flow_create(flow_rule=flow, port_id=0) > + testpmd.start() > + self.send_packet_and_capture(test_packet) > + verbose_output = > testpmd.extract_verbose_output(testpmd.stop()) > + received = False > + for testpmd_packet in verbose_output: > + if testpmd_packet.queue_id == expected_queue: > + received = True > + self.verify(received, f"Packet was not received on queue > {expected_queue}") > -- > 2.49.0 > Reviewed-by: Patrick Robb