mac_filter Test Suite
Mac address filtering test suite.
This test suite ensures proper and expected behavior of Allowlist filtering via mac addresses on devices bound to the Poll Mode Driver. If a packet received on a device contains a mac address not contained within its mac address pool, the packet should be dropped. Alternatively, if a packet is received that contains a destination mac within the devices address pool, the packet should be accepted and forwarded. This behavior should remain consistent across all packets, namely those containing dot1q tags or otherwise.
The following test suite assesses behaviors based on the aforementioned logic. Additionally, testing is done within the PMD itself to ensure that the mac address allow list is behaving as expected.
- class TestMacFilter
Bases:
TestSuiteMac address allowlist filtering test suite.
Configure mac address filtering on a given port, and test the port’s filtering behavior using both a given port’s hardware address as well as dummy addresses. If a port accepts a packet that is not contained within its mac address allowlist, then a given test case fails. Alternatively, if a port drops a packet that is designated within its mac address allowlist, a given test case will fail.
Moreover, a given port should demonstrate proper behavior when bound to the Poll Mode Driver. A port should not have a mac address allowlist that exceeds its designated size. A port’s default hardware address should not be removed from its address pool, and invalid addresses should not be included in the allowlist. If a port abides by the above rules, the test case passes.
- add_remove_mac_addresses() None
Assess basic mac addressing filtering functionalities.
This test case validates for proper behavior of mac address filtering with both a port’s default, burned-in mac address, as well as additional mac addresses added to the PMD. Packets should either be received or not received depending on the properties applied to the PMD at any given time.
- Steps:
Start testpmd without promiscuous mode.
Send a packet with the port’s default mac address. (Should receive)
Send a packet with fake mac address. (Should not receive)
Add fake mac address to the PMD’s address pool.
Send a packet with the fake mac address to the PMD. (Should receive)
Remove the fake mac address from the PMD’s address pool.
Send a packet with the fake mac address to the PMD. (Should not receive)
- Verify:
Packet with the port’s default mac address is received.
Packet with a fake mac address is not received.
Packet with a fake mac address is received when being sent to the PMD.
Packet with a fake mac address is not received when being sent to the PMD.
- invalid_address() None
Assess the behavior of a NIC mac address pool while bound to the PMD.
An assessment of a NIC’s behavior when mounted to a PMD as it relates to mac addresses and address pooling. Devices should not be able to use invalid mac addresses, remove their built-in hardware address, or exceed their address pools.
- Steps:
Start testpmd.
Attempt to add an invalid mac address. (Should fail)
Attempt to remove the device’s hardware address with no additional addresses in the address pool. (Should fail)
Add a fake mac address to the pool twice in succession. (Should not create any errors)
Attempt to remove the device’s hardware address with other addresses in the address pool. (Should fail)
Determine the device’s mac address pool size, and fill the pool with fake addresses.
Attempt to add another fake mac address, overloading the address pool. (Should fail)
- Verify:
It is not possible to add a invalid mac address.
It is not possible to remove the default mac address when there are no other addresses in the pool.
It is not possible to remove the default mac address when there are other addresses in the pool.
It is not possible to add another mac address.
- multicast_filter() None
Assess basic multicast address filtering functionalities.
Ensure that multicast filtering performs as intended when a given device is bound to the PMD.
- Steps:
Start testpmd without promiscuous mode.
Add a fake multicast address to the PMD’s multicast address pool.
Send a packet with the fake multicast address to the PMD.
Remove the fake multicast address from the PMDs multicast address filter.
Send a packet with the fake multicast address to the PMD.
- Verify:
Packet sent with a fake multicast address is received.
Packet sent with a fake multicast address is not received.
- required_capabilities: ClassVar[set[Capability]] = {28}
The capabilities the test case or suite requires in order to be executed.