rte_flow Test Suite

RTE Flow testing suite.

This suite verifies a range of flow rules built using patterns and actions from the RTE Flow API. It would be impossible to cover every valid flow rule, but this suite aims to test the most important and common functionalities across PMDs.

class TestRteFlow

Bases: TestSuite

RTE Flow test suite.

This suite consists of 12 test cases: 1. Queue Action Ethernet: Verifies queue actions with ethernet patterns 2. Queue Action IP: Verifies queue actions with IPv4 and IPv6 patterns 3. Queue Action L4: Verifies queue actions with TCP and UDP patterns 4. Queue Action VLAN: Verifies queue actions with VLAN patterns 5. Drop Action Eth: Verifies drop action with ethernet patterns 6. Drop Action IP: Verifies drop actions with IPV4 and IPv6 patterns 7. Drop Action L4: Verifies drop actions with TCP and UDP patterns 8. Drop Action VLAN: Verifies drop actions with VLAN patterns 9. Modify Field Action: Verifies packet modification patterns 10. Egress Rules: Verifies previously covered rules are still valid as egress 11. Jump Action: Verifies packet behavior given grouped flows 12. Priority Attribute: Verifies packet behavior given flows with different priorities

runner(verification_method: Callable[[...], Any], flows: list[framework.remote_session.testpmd_shell.FlowRule], packets: list[scapy.packet.Packet], port_id: int, expected_packets: list[scapy.packet.Packet] | None = None, *args: Any, **kwargs: Any) None

Runner method that validates each flow using the corresponding verification method.

Parameters:
  • verification_method (Callable[[...], Any]) – Callable that performs verification logic.

  • flows (list[framework.remote_session.testpmd_shell.FlowRule]) – List of flow rules to create and test.

  • packets (list[scapy.packet.Packet]) – List of packets corresponding to each flow.

  • port_id (int) – Number representing the port to create flows on.

  • expected_packets (list[scapy.packet.Packet] | None) – List of packets to check sent packets against in modification cases.

  • *args (Any) – Additional positional arguments to pass to the verification method.

  • **kwargs (Any) – Additional keyword arguments to pass to the verification method.

send_packet_and_verify(packet: scapy.packet.Packet, should_receive: bool = True) None

Generate a packet, send to the DUT, and verify it is forwarded back.

Parameters:
  • packet (scapy.packet.Packet) – Scapy packet to send and verify.

  • should_receive (bool) – Indicate whether the packet should be received.

send_packet_and_verify_queue(packet: scapy.packet.Packet, test_queue: int, testpmd: TestPmdShell) None

Send packet and verify queue stats show packet was received.

Parameters:
  • packet (scapy.packet.Packet) – Scapy packet to send to the SUT.

  • test_queue (int) – Represents the queue the test packet is being sent to.

  • testpmd (TestPmdShell) – TestPmdShell instance being used to send test packet.

send_packet_and_verify_modification(packet: scapy.packet.Packet, expected_packet: scapy.packet.Packet) None

Send packet and verify the expected modifications are present upon reception.

Parameters:
  • packet (scapy.packet.Packet) – Scapy packet to send to the SUT.

  • expected_packet (scapy.packet.Packet) – Scapy packet that should match the received packet.

send_packet_and_verify_jump(packets: list[scapy.packet.Packet], flow_rules: list[framework.remote_session.testpmd_shell.FlowRule], test_queues: list[int], testpmd: TestPmdShell) None

Create a testpmd session with every rule in the given list, verify jump behavior.

Parameters:
  • packets (list[scapy.packet.Packet]) – List of packets to send.

  • flow_rules (list[framework.remote_session.testpmd_shell.FlowRule]) – List of flow rules to create in the same session.

  • test_queues (list[int]) – List of Rx queue IDs each packet should be received on.

  • testpmd (TestPmdShell) – TestPmdShell instance to create flows on.

test_queue_action_ETH() 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_queue_action_IP() None

Validate flow rules with queue actions and IPv4/IPv6 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_queue_action_L4() None

Validate flow rules with queue actions and TCP/UDP 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_queue_action_VLAN() None

Validate flow rules with queue actions and VLAN 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_drop_action_ETH() None

Validate flow rules with drop 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 dropped.

One packet will be sent as a confidence check, to ensure packets are being received under normal circumstances.

test_drop_action_IP() None

Validate flow rules with drop 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 dropped.

One packet will be sent as a confidence check, to ensure packets are being received under normal circumstances.

test_drop_action_L4() None

Validate flow rules with drop 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 dropped.

One packet will be sent as a confidence check, to ensure packets are being received under normal circumstances.

test_drop_action_VLAN() None

Validate flow rules with drop 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 dropped.

One packet will be sent as a confidence check, to ensure packets are being received under normal circumstances.

test_modify_actions() None

Validate flow rules with actions that modify that packet during transmission.

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:

Verify packet is received with the new attributes.

test_egress_rules() None

Validate flow rules with egress directions.

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 dropped.

One packet will be sent as a confidence check, to ensure packets are being received under normal circumstances.

test_jump_action() 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.

test_priority_attribute() 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.

required_capabilities: ClassVar[set[Capability]] = {NicCapability.FLOW_CTRL}

The capabilities the test case or suite requires in order to be executed.