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 PatternField

Bases: object

Specification for a single matchable field within a protocol layer.

__init__(scapy_field: str, pattern_field: str, test_parameters: list[Any]) None
class Protocol

Bases: object

Complete specification for a protocol layer.

build_scapy_layer(field_values: dict[str, Any]) scapy.packet.Packet

Construct a Scapy layer with the given field values.

__init__(name: str, scapy_class: type[scapy.packet.Packet], pattern_name: str, fields: list[tests.TestSuite_rte_flow.PatternField]) None
class Action

Bases: object

Specification for a flow action.

build_action_string(value: Any = None) str

Generate the action string for a flow rule.

build_verification_params(value: Any = None) dict[str, Any]

Generate verification parameters for this action.

__init__(name: str, action_format: str, verification_type: str, param_builder: Callable[[Any], dict[str, Any]]) None
class FlowTest

Bases: object

A complete flow test ready for execution.

__init__(flow_rule: FlowRule, packet: scapy.packet.Packet, verification_type: str, verification_params: dict[str, Any], description: str = '') None
class FlowTestResult

Bases: object

Result of a single test case execution.

__init__(description: str, passed: bool, failure_reason: str = '', flow_rule_pattern: str = '', skipped: bool = False, sent_packet: Optional[scapy.packet.Packet] = None) None
class ModifyTest

Bases: object

A single hardcoded modify action test case.

__init__(description: str, pattern: str, action: str, packet: scapy.packet.Packet, expected_ipv4_dst: str | None = None, expected_mac_dst: str | None = None) None
class JumpTest

Bases: object

A single hardcoded jump action test case.

__init__(description: str, group0_pattern: str, group1_pattern: str, group1_action: str, matching_packet: scapy.packet.Packet, non_matching_packet: scapy.packet.Packet, target_queue: int) None
class FlowTestGenerator

Bases: object

Generates test cases by combining patterns and actions.

__init__(protocols: dict[str, tests.TestSuite_rte_flow.Protocol], actions: dict[str, tests.TestSuite_rte_flow.Action])

Initialize the generator with protocol and action specifications.

generate(protocol_stack: list[tuple[str, bool]], action_name: str, action_value: Any = None, group_id: int = 0) list[tests.TestSuite_rte_flow.FlowTest]

Generate test cases for patterns matching fields across multiple protocols.

Parameters:
  • protocol_stack (list[tuple[str, bool]]) – List of (protocol_name, test_fields) tuples. If test_fields is True, iterate through field combinations. If False, include protocol in pattern as wildcard match only.

  • action_name (str) – Name of the action to apply.

  • action_value (Any) – Optional value for parameterized actions.

  • group_id (int) – Flow group ID.

Returns:

List of FlowTest objects ready for execution.

Return type:

list[tests.TestSuite_rte_flow.FlowTest]

class TestRteFlow

Bases: TestSuite

RTE Flow test suite.

This suite consists of 4 test cases: 1. Queue Action: Verifies queue actions with multi-protocol patterns 2. Drop Action: Verifies drop actions with multi-protocol patterns 3. Modify Field Action: Verifies modify_field actions with hardcoded patterns 4. Jump Action: Verifies jump action between flow groups

set_up_suite() None

Initialize the test generator and result tracking.

queue_action() None

Validate flow rules with queue actions and multi-protocol patterns.

Steps:
  • Run basic transmission check to verify baseline packet reception.

  • 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:
  • Each packet is received on the appropriate queue.

drop_action() None

Validate flow rules with drop actions and multi-protocol patterns.

Steps:
  • Run basic transmission check to verify packets are received without drop rules.

  • 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:
  • Packet is dropped.

modify_field_action() None

Validate flow rules with modify_field actions and hardcoded patterns.

Steps:
  • Run basic transmission check to verify packets arrive unmodified.

  • For each test case in MODIFY_TEST_CASES, create the flow rule.

  • Send the corresponding packet and capture the received packet.

  • Verify the expected field was modified correctly.

  • Delete the flow rule and repeat for all test cases.

Verify:
  • Each packet is modified correctly according to its action.

jump_action() None

Validate flow rules with jump action between groups.

The jump action redirects matched packets from one flow group to another. Only flow rules in group 0 are guaranteed to be matched against initially; subsequent groups can only be reached via jump actions.

For each test case in JUMP_TEST_CASES, this creates a two-stage pipeline: - Group 0: Match on a pattern, jump to group 1 - Group 1: Match on a second pattern, forward to a specific queue

Steps:
  • Launch testpmd with multiple queues.

  • For each test case, create group 0 rule (match + jump) and group 1 rule (match + queue).

  • Send matching packet and verify it arrives on the target queue.

  • Send non-matching packet and verify it does not reach the target queue.

  • Delete both flow rules and repeat for all test cases.

Verify:
  • Packet matching both rules is received on the target queue.

  • Packet not matching group 0 rule does not reach the target queue.

tear_down_suite() None

Log test summary at the end of the suite.

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

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