vlan Test Suite
Test the support of VLAN Offload Features by Poll Mode Drivers.
This test suite verifies that VLAN filtering, stripping, and header insertion all function as expected. When a VLAN ID is in the filter list, all packets with that ID should be forwarded and all others should be dropped. While stripping is enabled, packets sent with a VLAN ID should have the ID removed and then be forwarded. Additionally, when header insertion is enabled packets without a VLAN ID should have a specified ID inserted and then be forwarded.
- class TestVlan
Bases:
TestSuite
DPDK VLAN test suite.
Ensures VLAN packet reception, stripping, and insertion on the Poll Mode Driver when the appropriate conditions are met. The suite contains four test cases:
1. VLAN reception no stripping - verifies that a VLAN packet with a tag within the filter list is received. 2. VLAN reception stripping - verifies that a VLAN packet with a tag within the filter list is received without the VLAN tag. 3. VLAN no reception - verifies that a VLAN packet with a tag not within the filter list is dropped. 4. VLAN insertion - verifies that a non VLAN packet is received with a VLAN tag when insertion is enabled.
- send_vlan_packet_and_verify(should_receive: bool, strip: bool, vlan_id: int) None
Generate a VLAN packet, send and verify packet with same payload is received on the dut.
- Parameters:
should_receive (bool) – Indicate whether the packet should be successfully received.
strip (bool) – If
False
, will verify received packets match the given VLAN ID, otherwise verifies that the received packet has no VLAN ID (as it has been stripped off.)vlan_id (int) – Expected VLAN ID.
- send_packet_and_verify_insertion(expected_id: int) None
Generate a packet with no VLAN tag, send and verify on the dut.
- Parameters:
expected_id (int) – The VLAN id that is being inserted through tx_offload configuration.
- vlan_setup(testpmd: TestPmdShell, port_id: int, filtered_id: int) None
Setup method for all test cases.
- Parameters:
testpmd (TestPmdShell) – Testpmd shell session to send commands to.
port_id (int) – Number of port to use for setup.
filtered_id (int) – ID to be added to the VLAN filter list.
- test_vlan_receipt_no_stripping() None
Verify packets are received with their VLAN IDs when stripping is disabled.
- Test:
Create an interactive testpmd shell and verify a VLAN packet.
- test_vlan_receipt_stripping() None
Ensure VLAN packet received with no tag when receipts and header stripping are enabled.
- Test:
Create an interactive testpmd shell and verify a VLAN packet.
- test_vlan_no_receipt() None
Ensure VLAN packet dropped when filter is on and sent tag not in the filter list.
- Test:
Create an interactive testpmd shell and verify a VLAN packet.
- test_vlan_header_insertion() None
Ensure that VLAN packet is received with the correct inserted VLAN tag.
- Test:
Create an interactive testpmd shell and verify a non-VLAN packet.
- required_capabilities: ClassVar[set[Capability]] = {NicCapability.RX_OFFLOAD_VLAN_STRIP}
The capabilities the test case or suite requires in order to be executed.