dual_vlan Test Suite

Dual VLAN functionality testing suite.

The main objective of this test suite is to ensure that standard VLAN functions such as stripping and filtering both still carry out their expected behavior in the presence of a packet which contains two VLAN headers. These functions should carry out said behavior not just in isolation, but also when other VLAN functions are configured on the same port. In addition to this, the priority attributes of VLAN headers should be unchanged in the case of multiple VLAN headers existing on a single packet, and a packet with only a single VLAN header should be able to have one additional VLAN inserted into it.

class TestDualVlan

Bases: TestSuite

DPDK Dual VLAN test suite.

This suite tests the behavior of VLAN functions and properties in the presence of two VLAN headers. All VLAN functions which are tested in this suite are specified using the inner class TestCaseOptions and should have cases for configuring them in configure_testpmd() as well as cases for testing their behavior in verify_vlan_functions(). Every combination of VLAN functions being enabled should be tested. Additionally, attributes of VLAN headers, such as priority, are tested to ensure they are not modified in the case of two VLAN headers.

class TestCaseOptions

Bases: Flag

Flag for specifying which VLAN functions to configure.

These flags are specific to configuring this testcase and are used to create a matrix of all configuration combinations.

VLAN_STRIP = 1
VLAN_FILTER_INNER = 2
VLAN_FILTER_OUTER = 4
inner_vlan_tag: ClassVar[int] = 2

ID to set on inner VLAN tags.

outer_vlan_tag: ClassVar[int] = 1

ID to set on outer VLAN tags.

vlan_insert_tag: ClassVar[int] = 3

ID to use when inserting VLAN tags.

rx_port: ClassVar[int] = 0
tx_port: ClassVar[int] = 1
insert_second_vlan() None

Test that a packet with a single VLAN can have an additional one inserted into it.

Steps:
  • Set VLAN tag on the tx port.

  • Create a packet with a VLAN tag.

  • Send and receive the packet.

Verify:
  • Packets are received.

  • Packet contains two VLAN tags.

all_vlan_functions() None

Test that all combinations of TestCaseOptions behave as expected.

Steps:
  • Send packets with VLAN functions disabled.

  • Send packets with a set of combinations of VLAN functions enabled.

  • Disable VLAN function to allow for a clean environment for the next test.

Verify:
  • Packet with two VLANs is unchanged without the VLAN modification functions enabled.

  • VLAN functions work as expected.

maintains_priority() None

Test that priorities of multiple VLAN tags are preserved by the PMD.

Steps:
  • Create packets with VLAN tags with priorities.

  • Send and receive packets.

Verify:
  • Packets are received.

  • Priorities are unchanged.