port_stats Test Suite
Port Statistics testing suite.
This test suite tests the functionality of querying the statistics of a port and verifies that the values provided in the statistics accurately reflect the traffic that has been handled on the port. This is shown by sending a packet of a fixed size to the SUT and verifying that the number of Rx packets has increased by 1, the number of Rx bytes has increased by the specified size, the number of Tx packets has also increased by 1 (since we expect the packet to be forwarded), and the number of Tx bytes has also increased by the same fixed amount.
- class TestPortStats
Bases:
TestSuiteDPDK Port statistics testing suite.
Support for port statistics is tested by sending a packet of a fixed size denoted by total_packet_len and verifying the that Tx/Rx packets of the Tx/Rx ports updated by exactly 1 and the Tx/Rx bytes of the Tx/Rx ports updated by exactly total_packet_len. This is done by finding the total amount of packets that were sent/received which did not originate from this test suite and taking the sum of the lengths of each of these “noise” packets and subtracting it from the total values in the port statistics so that all that is left are relevant values.
- recv_port: ClassVar[int] = 0
Port where traffic will be received on the SUT.
- send_port: ClassVar[int] = 1
Port where traffic will be sent from on the SUT.
- ip_header_len: ClassVar[int] = 20
- ether_header_len: ClassVar[int] = 14
- total_packet_len: ClassVar[int] = 100
Length of the packet being sent including the IP and frame headers.
- stats_updates() None
Send a packet with a fixed length and verify port stats updated properly.
Send a packet with a total length of self.total_packet_len and verify that the rx port only received one packet and the number of rx_bytes increased by exactly self.total_packet_len. Also verify that the tx port only sent one packet and that the tx_bytes of the port increase by exactly self.total_packet_len.
Noise on the wire is ignored by extracting the total number of noise packets and the sum of the lengths of those packets and subtracting them from the totals that are provided by the testpmd command show port info all.
- Steps:
Start testpmd in MAC forwarding mode and set verbose mode to 3 (Rx and Tx).
Start packet forwarding and then clear all port statistics.
Send a packet, then stop packet forwarding and collect the port stats.
- Verify:
Port stats showing number of packets received match what we sent.
- required_capabilities: ClassVar[set[Capability]] = {28}
The capabilities the test case or suite requires in order to be executed.