testpmd_shell - Testpmd Interactive Remote Shell
Testpmd interactive shell.
Typical usage example in a TestSuite:
testpmd_shell = TestPmdShell(self.sut_node)
devices = testpmd_shell.get_devices()
for device in devices:
print(device)
testpmd_shell.close()
- class TestPmdDevice
Bases:
object
The data of a device that testpmd can recognize.
- pci_address
The PCI address of the device.
- Type:
str
- __init__(pci_address_line: str)
Initialize the device from the testpmd output line string.
- Parameters:
pci_address_line (str) – A line of testpmd output that contains a device.
- class VLANOffloadFlag
Bases:
Flag
Flag representing the VLAN offload settings of a NIC port.
- STRIP = 1
- FILTER = 2
- EXTEND = 4
- QINQ_STRIP = 8
- classmethod from_str_dict(d)
Makes an instance from a dict containing the flag member names with an “on” value.
- Parameters:
d – A dictionary containing the flag members as keys and any string value.
- Returns:
A new instance of the flag.
- class ChecksumOffloadOptions
Bases:
Flag
Flag representing checksum hardware offload layer options.
- ip = 1
- udp = 2
- tcp = 4
- sctp = 8
- outer_ip = 16
- outer_udp = 32
- class RSSOffloadTypesFlag
Bases:
Flag
Flag representing the RSS offload flow types supported by the NIC port.
- ipv4 = 1
- ipv4_frag = 2
- ipv4_tcp = 4
- ipv4_udp = 8
- ipv4_sctp = 16
- ipv4_other = 32
- ipv6 = 64
- ipv6_frag = 128
- ipv6_tcp = 256
- ipv6_udp = 512
- ipv6_sctp = 1024
- ipv6_other = 2048
- l2_payload = 4096
- ipv6_ex = 8192
- ipv6_tcp_ex = 16384
- ipv6_udp_ex = 32768
- port = 65536
- vxlan = 131072
- geneve = 262144
- nvgre = 524288
- user_defined_22 = 1048576
- gtpu = 2097152
- eth = 4194304
- s_vlan = 8388608
- c_vlan = 16777216
- esp = 33554432
- ah = 67108864
- l2tpv3 = 134217728
- pfcp = 268435456
- pppoe = 536870912
- ecpri = 1073741824
- mpls = 2147483648
- ipv4_chksum = 4294967296
- l4_chksum = 8589934592
- l2tpv2 = 17179869184
- ipv6_flow_label = 34359738368
- user_defined_38 = 68719476736
- user_defined_39 = 137438953472
- user_defined_40 = 274877906944
- user_defined_41 = 549755813888
- user_defined_42 = 1099511627776
- user_defined_43 = 2199023255552
- user_defined_44 = 4398046511104
- user_defined_45 = 8796093022208
- user_defined_46 = 17592186044416
- user_defined_47 = 35184372088832
- user_defined_48 = 70368744177664
- user_defined_49 = 140737488355328
- user_defined_50 = 281474976710656
- user_defined_51 = 562949953421312
- l3_pre96 = 1125899906842624
- l3_pre64 = 2251799813685248
- l3_pre56 = 4503599627370496
- l3_pre48 = 9007199254740992
- l3_pre40 = 18014398509481984
- l3_pre32 = 36028797018963968
- l2_dst_only = 72057594037927936
- l2_src_only = 144115188075855872
- l4_dst_only = 288230376151711744
- l4_src_only = 576460752303423488
- l3_dst_only = 1152921504606846976
- l3_src_only = 2305843009213693952
- ip = 10467
- udp = 33288
- tcp = 16644
- sctp = 1040
- tunnel = 917504
- vlan = 25165824
- all = 20935933951
- classmethod from_list_string(names: str) typing_extensions.Self
Makes a flag from a whitespace-separated list of names.
- Parameters:
names (str) – a whitespace-separated list containing the members of this flag.
- Returns:
An instance of this flag.
- Return type:
typing_extensions.Self
- classmethod from_str(name: str) typing_extensions.Self
Makes a flag matching the supplied name.
- Parameters:
name (str) – a valid member of this flag in text
- Returns:
An instance of this flag.
- Return type:
typing_extensions.Self
- class DeviceCapabilitiesFlag
Bases:
Flag
Flag representing the device capabilities.
- RUNTIME_RX_QUEUE_SETUP = 1
Device supports Rx queue setup after device started.
- RUNTIME_TX_QUEUE_SETUP = 2
Device supports Tx queue setup after device started.
- RXQ_SHARE = 4
Device supports shared Rx queue among ports within Rx domain and switch domain.
- FLOW_RULE_KEEP = 8
Device supports keeping flow rules across restart.
- FLOW_SHARED_OBJECT_KEEP = 16
Device supports keeping shared flow objects across restart.
- class DeviceErrorHandlingMode
Bases:
StrEnum
Enum representing the device error handling mode.
- none = 'none'
- passive = 'passive'
- proactive = 'proactive'
- unknown = 'unknown'
- make_device_private_info_parser() ParserFn
Device private information parser.
Ensures that we are not parsing invalid device private info output.
- Returns:
- A dictionary for the dataclasses.field metadata argument containing a parser
function that parses the device private info from the TestPmd port info output.
- Return type:
- class RxQueueState
Bases:
StrEnum
RX queue states.
References
DPDK lib:
lib/ethdev/rte_ethdev.h
testpmd display function:app/test-pmd/config.c:get_queue_state_name()
- stopped = 'stopped'
- started = 'started'
- hairpin = 'hairpin'
- unknown = 'unknown'
- class TestPmdQueueInfo
Bases:
TextParser
Dataclass representation of the common parts of the testpmd show rxq/txq info commands.
- prefetch_threshold: int
- host_threshold: int
- writeback_threshold: int
- free_threshold: int
- deferred_start: bool
- ring_size: int
The number of RXD/TXDs is just the ring size of the queue.
- is_queue_started: bool
- burst_mode: str | None = None
- __init__(prefetch_threshold: int, host_threshold: int, writeback_threshold: int, free_threshold: int, deferred_start: bool, ring_size: int, is_queue_started: bool, burst_mode: str | None = None) None
- class TestPmdTxqInfo
Bases:
TestPmdQueueInfo
Representation of testpmd’s
show txq info <port_id> <queue_id>
command.References
testpmd command function:
app/test-pmd/cmdline.c:cmd_showqueue()
testpmd display function:app/test-pmd/config.c:rx_queue_infos_display()
- rs_threshold: int | None = None
Ring size threshold
- __init__(prefetch_threshold: int, host_threshold: int, writeback_threshold: int, free_threshold: int, deferred_start: bool, ring_size: int, is_queue_started: bool, burst_mode: str | None = None, rs_threshold: int | None = None) None
- class TestPmdRxqInfo
Bases:
TestPmdQueueInfo
Representation of testpmd’s
show rxq info <port_id> <queue_id>
command.References
testpmd command function:
app/test-pmd/cmdline.c:cmd_showqueue()
testpmd display function:app/test-pmd/config.c:rx_queue_infos_display()
- mempool: str | None = None
Mempool used by that queue
- drop_packets: bool | None = None
Drop packets if no descriptors are available
- scattered_packets: bool | None = None
Scattered packets Rx enabled
- queue_state: str | None = None
The state of the queue
- __init__(prefetch_threshold: int, host_threshold: int, writeback_threshold: int, free_threshold: int, deferred_start: bool, ring_size: int, is_queue_started: bool, burst_mode: str | None = None, mempool: str | None = None, drop_packets: bool | None = None, scattered_packets: bool | None = None, queue_state: str | None = None) None
- class TestPmdPort
Bases:
TextParser
Dataclass representing the result of testpmd’s
show port info
command.- id: int
- device_name: str
- driver_name: str
- socket_id: int
- is_link_up: bool
- link_speed: str
- is_link_full_duplex: bool
- is_link_autonegotiated: bool
- is_promiscuous_mode_enabled: bool
- is_allmulticast_mode_enabled: bool
- max_mac_addresses_num: int
Maximum number of MAC addresses
- max_hash_mac_addresses_num: int
Maximum configurable length of RX packet
- min_rx_bufsize: int
Minimum size of RX buffer
- max_rx_packet_length: int
Maximum configurable length of RX packet
- max_lro_packet_size: int
Maximum configurable size of LRO aggregated packet
- rx_queues_num: int
Current number of RX queues
- max_rx_queues_num: int
Max possible RX queues
- max_queue_rxd_num: int
Max possible number of RXDs per queue
- min_queue_rxd_num: int
Min possible number of RXDs per queue
- rxd_alignment_num: int
RXDs number alignment
- tx_queues_num: int
Current number of TX queues
- max_tx_queues_num: int
Max possible TX queues
- max_queue_txd_num: int
Max possible number of TXDs per queue
- min_queue_txd_num: int
Min possible number of TXDs per queue
- txd_alignment_num: int
TXDs number alignment
- max_packet_segment_num: int
Max segment number per packet
- max_mtu_segment_num: int
Max segment number per MTU/TSO
- device_capabilities: DeviceCapabilitiesFlag
- device_error_handling_mode: framework.remote_session.testpmd_shell.DeviceErrorHandlingMode | None = None
- device_private_info: str | None = None
- hash_key_size: int | None = None
- redirection_table_size: int | None = None
- supported_rss_offload_flow_types: RSSOffloadTypesFlag = 0
- mac_address: str | None = None
- fw_version: str | None = None
- dev_args: str | None = None
- mem_alloc_socket_id: int | None = None
Socket id of the memory allocation
- mtu: int | None = None
- vlan_offload: framework.remote_session.testpmd_shell.VLANOffloadFlag | None = None
- max_rx_bufsize: int | None = None
Maximum size of RX buffer
- max_vfs_num: int | None = None
Maximum number of VFs
- max_vmdq_pools_num: int | None = None
Maximum number of VMDq pools
- switch_name: str | None = None
- switch_domain_id: int | None = None
- switch_port_id: int | None = None
- switch_rx_domain: int | None = None
- __init__(id: int, device_name: str, driver_name: str, socket_id: int, is_link_up: bool, link_speed: str, is_link_full_duplex: bool, is_link_autonegotiated: bool, is_promiscuous_mode_enabled: bool, is_allmulticast_mode_enabled: bool, max_mac_addresses_num: int, max_hash_mac_addresses_num: int, min_rx_bufsize: int, max_rx_packet_length: int, max_lro_packet_size: int, rx_queues_num: int, max_rx_queues_num: int, max_queue_rxd_num: int, min_queue_rxd_num: int, rxd_alignment_num: int, tx_queues_num: int, max_tx_queues_num: int, max_queue_txd_num: int, min_queue_txd_num: int, txd_alignment_num: int, max_packet_segment_num: int, max_mtu_segment_num: int, device_capabilities: ~framework.remote_session.testpmd_shell.DeviceCapabilitiesFlag, device_error_handling_mode: framework.remote_session.testpmd_shell.DeviceErrorHandlingMode | None = None, device_private_info: str | None = None, hash_key_size: int | None = None, redirection_table_size: int | None = None, supported_rss_offload_flow_types: ~framework.remote_session.testpmd_shell.RSSOffloadTypesFlag = RSSOffloadTypesFlag.None, mac_address: str | None = None, fw_version: str | None = None, dev_args: str | None = None, mem_alloc_socket_id: int | None = None, mtu: int | None = None, vlan_offload: framework.remote_session.testpmd_shell.VLANOffloadFlag | None = None, max_rx_bufsize: int | None = None, max_vfs_num: int | None = None, max_vmdq_pools_num: int | None = None, switch_name: str | None = None, switch_domain_id: int | None = None, switch_port_id: int | None = None, switch_rx_domain: int | None = None) None
- class TestPmdPortStats
Bases:
TextParser
Port statistics.
- port_id: int
- rx_packets: int
- rx_missed: int
- rx_bytes: int
- rx_errors: int
- rx_nombuf: int
- tx_packets: int
- tx_errors: int
- tx_bytes: int
- rx_pps: int
- rx_bps: int
- tx_pps: int
- tx_bps: int
- __init__(port_id: int, rx_packets: int, rx_missed: int, rx_bytes: int, rx_errors: int, rx_nombuf: int, tx_packets: int, tx_errors: int, tx_bytes: int, rx_pps: int, rx_bps: int, tx_pps: int, tx_bps: int) None
- class PacketOffloadFlag
Bases:
Flag
Flag representing the Packet Offload Features Flags in DPDK.
Values in this class are taken from the definitions in the RTE MBUF core library in DPDK located in
lib/mbuf/rte_mbuf_core.h
. It is expected that flag values in this class will match the values they are set to in said DPDK library with one exception; all values must be unique. For example, the definitions for unknown checksum flags inrte_mbuf_core.h
are all set to0
, but it is valuable to distinguish between them in this framework. For this reason flags that are not unique in the DPDK library are set either to values within the RTE_MBUF_F_FIRST_FREE-RTE_MBUF_F_LAST_FREE range for Rx or shifted 61+ bits for Tx.References
DPDK lib:
lib/mbuf/rte_mbuf_core.h
- RTE_MBUF_F_RX_VLAN = 1
The RX packet is a 802.1q VLAN packet, and the tci has been saved in mbuf->vlan_tci. If the flag RTE_MBUF_F_RX_VLAN_STRIPPED is also present, the VLAN header has been stripped from mbuf data, else it is still present.
- RTE_MBUF_F_RX_RSS_HASH = 2
RX packet with RSS hash result.
- RTE_MBUF_F_RX_FDIR = 4
RX packet with FDIR match indicate.
- RTE_MBUF_F_RX_OUTER_IP_CKSUM_BAD = 32
This flag is set when the outermost IP header checksum is detected as wrong by the hardware.
- RTE_MBUF_F_RX_VLAN_STRIPPED = 64
A vlan has been stripped by the hardware and its tci is saved in mbuf->vlan_tci. This can only happen if vlan stripping is enabled in the RX configuration of the PMD. When RTE_MBUF_F_RX_VLAN_STRIPPED is set, RTE_MBUF_F_RX_VLAN must also be set.
- RTE_MBUF_F_RX_IP_CKSUM_UNKNOWN = 8388608
No information about the RX IP checksum. Value is 0 in the DPDK library.
- RTE_MBUF_F_RX_IP_CKSUM_BAD = 16
The IP checksum in the packet is wrong.
- RTE_MBUF_F_RX_IP_CKSUM_GOOD = 128
The IP checksum in the packet is valid.
- RTE_MBUF_F_RX_IP_CKSUM_NONE = 16777216
The IP checksum is not correct in the packet data, but the integrity of the IP header is verified. Value is RTE_MBUF_F_RX_IP_CKSUM_BAD | RTE_MBUF_F_RX_IP_CKSUM_GOOD in the DPDK library.
- RTE_MBUF_F_RX_L4_CKSUM_UNKNOWN = 33554432
No information about the RX L4 checksum. Value is 0 in the DPDK library.
- RTE_MBUF_F_RX_L4_CKSUM_BAD = 8
The L4 checksum in the packet is wrong.
- RTE_MBUF_F_RX_L4_CKSUM_GOOD = 256
The L4 checksum in the packet is valid.
- RTE_MBUF_F_RX_L4_CKSUM_NONE = 67108864
The L4 checksum is not correct in the packet data, but the integrity of the L4 data is verified. Value is RTE_MBUF_F_RX_L4_CKSUM_BAD | RTE_MBUF_F_RX_L4_CKSUM_GOOD in the DPDK library.
- RTE_MBUF_F_RX_IEEE1588_PTP = 512
RX IEEE1588 L2 Ethernet PT Packet.
- RTE_MBUF_F_RX_IEEE1588_TMST = 1024
RX IEEE1588 L2/L4 timestamped packet.
- RTE_MBUF_F_RX_FDIR_ID = 8192
FD id reported if FDIR match.
- RTE_MBUF_F_RX_FDIR_FLX = 16384
Flexible bytes reported if FDIR match.
- RTE_MBUF_F_RX_QINQ_STRIPPED = 134217728
If both RTE_MBUF_F_RX_QINQ_STRIPPED and RTE_MBUF_F_RX_VLAN_STRIPPED are set, the 2 VLANs have been stripped by the hardware. If RTE_MBUF_F_RX_QINQ_STRIPPED is set and RTE_MBUF_F_RX_VLAN_STRIPPED is unset, only the outer VLAN is removed from packet data.
- RTE_MBUF_F_RX_LRO = 268435456
When packets are coalesced by a hardware or virtual driver, this flag can be set in the RX mbuf, meaning that the m->tso_segsz field is valid and is set to the segment size of original packets.
- RTE_MBUF_F_RX_SEC_OFFLOAD = 262144
Indicate that security offload processing was applied on the RX packet.
- RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED = 536870912
Indicate that security offload processing failed on the RX packet.
- RTE_MBUF_F_RX_QINQ = 1073741824
The RX packet is a double VLAN. If this flag is set, RTE_MBUF_F_RX_VLAN must also be set. If the flag RTE_MBUF_F_RX_QINQ_STRIPPED is also present, both VLANs headers have been stripped from mbuf data, else they are still present.
- RTE_MBUF_F_RX_OUTER_L4_CKSUM_UNKNOWN = 134217728
No info about the outer RX L4 checksum. Value is 0 in the DPDK library.
- RTE_MBUF_F_RX_OUTER_L4_CKSUM_BAD = 2097152
The outer L4 checksum in the packet is wrong
- RTE_MBUF_F_RX_OUTER_L4_CKSUM_GOOD = 4194304
The outer L4 checksum in the packet is valid
- RTE_MBUF_F_RX_OUTER_L4_CKSUM_INVALID = 268435456
Invalid outer L4 checksum state. Value is RTE_MBUF_F_RX_OUTER_L4_CKSUM_BAD | RTE_MBUF_F_RX_OUTER_L4_CKSUM_GOOD in the DPDK library.
- RTE_MBUF_F_TX_OUTER_UDP_CKSUM = 2199023255552
Outer UDP checksum offload flag. This flag is used for enabling outer UDP checksum in PMD. To use outer UDP checksum, the user either needs to enable the following in mbuf:
Fill outer_l2_len and outer_l3_len in mbuf.
Set the RTE_MBUF_F_TX_OUTER_UDP_CKSUM flag.
Set the RTE_MBUF_F_TX_OUTER_IPV4 or RTE_MBUF_F_TX_OUTER_IPV6 flag.
Or configure RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM offload flag.
- RTE_MBUF_F_TX_UDP_SEG = 4398046511104
UDP Fragmentation Offload flag. This flag is used for enabling UDP fragmentation in SW or in HW.
- RTE_MBUF_F_TX_SEC_OFFLOAD = 8796093022208
Request security offload processing on the TX packet. To use Tx security offload, the user needs to fill l2_len in mbuf indicating L2 header size and where L3 header starts. Similarly, l3_len should also be filled along with ol_flags reflecting current L3 type.
- RTE_MBUF_F_TX_MACSEC = 17592186044416
Offload the MACsec. This flag must be set by the application to enable this offload feature for a packet to be transmitted.
- RTE_MBUF_F_TX_TUNNEL_VXLAN = 35184372088832
- RTE_MBUF_F_TX_TUNNEL_GRE = 70368744177664
- RTE_MBUF_F_TX_TUNNEL_IPIP = 2305843009213693952
Value is 3 << 45 in the DPDK library.
- RTE_MBUF_F_TX_TUNNEL_GENEVE = 140737488355328
- RTE_MBUF_F_TX_TUNNEL_MPLSINUDP = 4611686018427387904
TX packet with MPLS-in-UDP RFC 7510 header. Value is 5 << 45 in the DPDK library.
- RTE_MBUF_F_TX_TUNNEL_VXLAN_GPE = 9223372036854775808
Value is 6 << 45 in the DPDK library.
- RTE_MBUF_F_TX_TUNNEL_GTP = 18446744073709551616
Value is 7 << 45 in the DPDK library.
- RTE_MBUF_F_TX_TUNNEL_ESP = 281474976710656
- RTE_MBUF_F_TX_TUNNEL_IP = 36893488147419103232
Generic IP encapsulated tunnel type, used for TSO and checksum offload. This can be used for tunnels which are not standards or listed above. It is preferred to use specific tunnel flags like RTE_MBUF_F_TX_TUNNEL_GRE or RTE_MBUF_F_TX_TUNNEL_IPIP if possible. The ethdev must be configured with RTE_ETH_TX_OFFLOAD_IP_TNL_TSO. Outer and inner checksums are done according to the existing flags like RTE_MBUF_F_TX_xxx_CKSUM. Specific tunnel headers that contain payload length, sequence id or checksum are not expected to be updated. Value is 0xD << 45 in the DPDK library.
- RTE_MBUF_F_TX_TUNNEL_UDP = 73786976294838206464
Generic UDP encapsulated tunnel type, used for TSO and checksum offload. UDP tunnel type implies outer IP layer. It can be used for tunnels which are not standards or listed above. It is preferred to use specific tunnel flags like RTE_MBUF_F_TX_TUNNEL_VXLAN if possible. The ethdev must be configured with RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO. Outer and inner checksums are done according to the existing flags like RTE_MBUF_F_TX_xxx_CKSUM. Specific tunnel headers that contain payload length, sequence id or checksum are not expected to be updated. value is 0xE << 45 in the DPDK library.
- RTE_MBUF_F_TX_QINQ = 562949953421312
Double VLAN insertion (QinQ) request to driver, driver may offload the insertion based on device capability. Mbuf ‘vlan_tci’ & ‘vlan_tci_outer’ must be valid when this flag is set.
- RTE_MBUF_F_TX_TCP_SEG = 147573952589676412928
TCP segmentation offload. To enable this offload feature for a packet to be transmitted on hardware supporting TSO:
- set the RTE_MBUF_F_TX_TCP_SEG flag in mbuf->ol_flags (this flag implies
RTE_MBUF_F_TX_TCP_CKSUM)
- set the flag RTE_MBUF_F_TX_IPV4 or RTE_MBUF_F_TX_IPV6
if it’s IPv4, set the RTE_MBUF_F_TX_IP_CKSUM flag
fill the mbuf offload information: l2_len, l3_len, l4_len, tso_segsz
- RTE_MBUF_F_TX_IEEE1588_TMST = 295147905179352825856
TX IEEE1588 packet to timestamp.
- RTE_MBUF_F_TX_L4_NO_CKSUM = 147573952589676412928
Disable L4 cksum of TX pkt. Value is 0 in the DPDK library.
- RTE_MBUF_F_TX_TCP_CKSUM = 4503599627370496
TCP cksum of TX pkt. Computed by NIC.
- RTE_MBUF_F_TX_SCTP_CKSUM = 9007199254740992
SCTP cksum of TX pkt. Computed by NIC.
- RTE_MBUF_F_TX_UDP_CKSUM = 295147905179352825856
UDP cksum of TX pkt. Computed by NIC. Value is 3 << 52 in the DPDK library.
- RTE_MBUF_F_TX_IP_CKSUM = 18014398509481984
Offload the IP checksum in the hardware. The flag RTE_MBUF_F_TX_IPV4 should also be set by the application, although a PMD will only check RTE_MBUF_F_TX_IP_CKSUM.
- RTE_MBUF_F_TX_IPV4 = 590295810358705651712
Packet is IPv4. This flag must be set when using any offload feature (TSO, L3 or L4 checksum) to tell the NIC that the packet is an IPv4 packet. If the packet is a tunneled packet, this flag is related to the inner headers.
- RTE_MBUF_F_TX_IPV6 = 1180591620717411303424
Packet is IPv6. This flag must be set when using an offload feature (TSO or L4 checksum) to tell the NIC that the packet is an IPv6 packet. If the packet is a tunneled packet, this flag is related to the inner headers.
- RTE_MBUF_F_TX_VLAN = 2361183241434822606848
VLAN tag insertion request to driver, driver may offload the insertion based on the device capability. mbuf ‘vlan_tci’ field must be valid when this flag is set.
- RTE_MBUF_F_TX_OUTER_IP_CKSUM = 4722366482869645213696
Offload the IP checksum of an external header in the hardware. The flag RTE_MBUF_F_TX_OUTER_IPV4 should also be set by the application, although a PMD will only check RTE_MBUF_F_TX_OUTER_IP_CKSUM.
- RTE_MBUF_F_TX_OUTER_IPV4 = 9444732965739290427392
Packet outer header is IPv4. This flag must be set when using any outer offload feature (L3 or L4 checksum) to tell the NIC that the outer header of the tunneled packet is an IPv4 packet.
- RTE_MBUF_F_TX_OUTER_IPV6 = 18889465931478580854784
Packet outer header is IPv6. This flag must be set when using any outer offload feature (L4 checksum) to tell the NIC that the outer header of the tunneled packet is an IPv6 packet.
- classmethod from_list_string(names: str) typing_extensions.Self
Makes a flag from a whitespace-separated list of names.
- Parameters:
names (str) – a whitespace-separated list containing the members of this flag.
- Returns:
An instance of this flag.
- Return type:
typing_extensions.Self
- classmethod from_str(name: str) typing_extensions.Self
Makes a flag matching the supplied name.
- Parameters:
name (str) – a valid member of this flag in text
- Returns:
An instance of this flag.
- Return type:
typing_extensions.Self
- class RtePTypes
Bases:
Flag
Flag representing possible packet types in DPDK verbose output.
Values in this class are derived from definitions in the RTE MBUF ptype library in DPDK located in
lib/mbuf/rte_mbuf_ptype.h
. Specifically, the names of values in this class should match the possible return options from the functionsrte_get_ptype_*_name
inrte_mbuf_ptype.c
.References
DPDK lib:
lib/mbuf/rte_mbuf_ptype.h
DPDK ptype name formatting functions:lib/mbuf/rte_mbuf_ptype.c:rte_get_ptype_*_name()
- L2_ETHER = 1
Ethernet packet type. This is used for outer packet for tunneling cases.
- L2_ETHER_TIMESYNC = 2
Ethernet packet type for time sync.
- L2_ETHER_ARP = 4
ARP (Address Resolution Protocol) packet type.
- L2_ETHER_LLDP = 8
LLDP (Link Layer Discovery Protocol) packet type.
- L2_ETHER_NSH = 16
NSH (Network Service Header) packet type.
- L2_ETHER_VLAN = 32
VLAN packet type.
- L2_ETHER_QINQ = 64
QinQ packet type.
- L2_ETHER_PPPOE = 128
PPPOE packet type.
- L2_ETHER_FCOE = 256
FCoE packet type..
- L2_ETHER_MPLS = 512
MPLS packet type.
- L2_UNKNOWN = 1024
No L2 packet information.
- L3_IPV4 = 2048
IP (Internet Protocol) version 4 packet type. This is used for outer packet for tunneling cases, and does not contain any header option.
- L3_IPV4_EXT = 4096
IP (Internet Protocol) version 4 packet type. This is used for outer packet for tunneling cases, and contains header options.
- L3_IPV6 = 8192
IP (Internet Protocol) version 6 packet type. This is used for outer packet for tunneling cases, and does not contain any extension header.
- L3_IPV4_EXT_UNKNOWN = 16384
IP (Internet Protocol) version 4 packet type. This is used for outer packet for tunneling cases, and may or maynot contain header options.
- L3_IPV6_EXT = 32768
IP (Internet Protocol) version 6 packet type. This is used for outer packet for tunneling cases, and contains extension headers.
- L3_IPV6_EXT_UNKNOWN = 65536
IP (Internet Protocol) version 6 packet type. This is used for outer packet for tunneling cases, and may or maynot contain extension headers.
- L3_UNKNOWN = 131072
No L3 packet information.
- L4_TCP = 262144
TCP (Transmission Control Protocol) packet type. This is used for outer packet for tunneling cases.
- L4_UDP = 524288
UDP (User Datagram Protocol) packet type. This is used for outer packet for tunneling cases.
- L4_FRAG = 1048576
Fragmented IP (Internet Protocol) packet type. This is used for outer packet for tunneling cases and refers to those packets of any IP types which can be recognized as fragmented. A fragmented packet cannot be recognized as any other L4 types (RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_UDP, RTE_PTYPE_L4_SCTP, RTE_PTYPE_L4_ICMP, RTE_PTYPE_L4_NONFRAG).
- L4_SCTP = 2097152
SCTP (Stream Control Transmission Protocol) packet type. This is used for outer packet for tunneling cases.
- L4_ICMP = 4194304
ICMP (Internet Control Message Protocol) packet type. This is used for outer packet for tunneling cases.
- L4_NONFRAG = 8388608
Non-fragmented IP (Internet Protocol) packet type. This is used for outer packet for tunneling cases and refers to those packets of any IP types, that cannot be recognized as any of the above L4 types (RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_UDP, RTE_PTYPE_L4_FRAG, RTE_PTYPE_L4_SCTP, RTE_PTYPE_L4_ICMP).
- L4_IGMP = 16777216
IGMP (Internet Group Management Protocol) packet type.
- L4_UNKNOWN = 33554432
No L4 packet information.
- TUNNEL_IP = 67108864
IP (Internet Protocol) in IP (Internet Protocol) tunneling packet type.
- TUNNEL_GRE = 134217728
GRE (Generic Routing Encapsulation) tunneling packet type.
- TUNNEL_VXLAN = 268435456
VXLAN (Virtual eXtensible Local Area Network) tunneling packet type.
- TUNNEL_NVGRE = 536870912
NVGRE (Network Virtualization using Generic Routing Encapsulation) tunneling packet type.
- TUNNEL_GENEVE = 1073741824
GENEVE (Generic Network Virtualization Encapsulation) tunneling packet type.
- TUNNEL_GRENAT = 2147483648
Tunneling packet type of Teredo, VXLAN (Virtual eXtensible Local Area Network) or GRE (Generic Routing Encapsulation) could be recognized as this packet type, if they can not be recognized independently as of hardware capability.
- TUNNEL_GTPC = 4294967296
GTP-C (GPRS Tunnelling Protocol) control tunneling packet type.
- TUNNEL_GTPU = 8589934592
GTP-U (GPRS Tunnelling Protocol) user data tunneling packet type.
- TUNNEL_ESP = 17179869184
ESP (IP Encapsulating Security Payload) tunneling packet type.
- TUNNEL_L2TP = 34359738368
L2TP (Layer 2 Tunneling Protocol) tunneling packet type.
- TUNNEL_VXLAN_GPE = 68719476736
VXLAN-GPE (VXLAN Generic Protocol Extension) tunneling packet type.
- TUNNEL_MPLS_IN_UDP = 137438953472
MPLS-in-UDP tunneling packet type (RFC 7510).
- TUNNEL_MPLS_IN_GRE = 274877906944
MPLS-in-GRE tunneling packet type (RFC 4023).
- TUNNEL_UNKNOWN = 549755813888
No tunnel information found on the packet.
- INNER_L2_ETHER = 1099511627776
Ethernet packet type. This is used for inner packet type only.
- INNER_L2_ETHER_VLAN = 2199023255552
Ethernet packet type with VLAN (Virtual Local Area Network) tag.
- INNER_L2_ETHER_QINQ = 4398046511104
QinQ packet type.
- INNER_L2_UNKNOWN = 8796093022208
No inner L2 information found on the packet.
- INNER_L3_IPV4 = 17592186044416
IP (Internet Protocol) version 4 packet type. This is used for inner packet only, and does not contain any header option.
- INNER_L3_IPV4_EXT = 35184372088832
IP (Internet Protocol) version 4 packet type. This is used for inner packet only, and contains header options.
- INNER_L3_IPV6 = 70368744177664
IP (Internet Protocol) version 6 packet type. This is used for inner packet only, and does not contain any extension header.
- INNER_L3_IPV4_EXT_UNKNOWN = 140737488355328
IP (Internet Protocol) version 4 packet type. This is used for inner packet only, and may or may not contain header options.
- INNER_L3_IPV6_EXT = 281474976710656
IP (Internet Protocol) version 6 packet type. This is used for inner packet only, and contains extension headers.
- INNER_L3_IPV6_EXT_UNKNOWN = 562949953421312
IP (Internet Protocol) version 6 packet type. This is used for inner packet only, and may or may not contain extension headers.
- INNER_L3_UNKNOWN = 1125899906842624
No inner L3 information found on the packet.
- INNER_L4_TCP = 2251799813685248
TCP (Transmission Control Protocol) packet type. This is used for inner packet only.
- INNER_L4_UDP = 4503599627370496
UDP (User Datagram Protocol) packet type. This is used for inner packet only.
- INNER_L4_FRAG = 9007199254740992
Fragmented IP (Internet Protocol) packet type. This is used for inner packet only, and may or maynot have a layer 4 packet.
- INNER_L4_SCTP = 18014398509481984
SCTP (Stream Control Transmission Protocol) packet type. This is used for inner packet only.
- INNER_L4_ICMP = 36028797018963968
ICMP (Internet Control Message Protocol) packet type. This is used for inner packet only.
- INNER_L4_NONFRAG = 72057594037927936
Non-fragmented IP (Internet Protocol) packet type. It is used for inner packet only, and may or may not have other unknown layer 4 packet types.
- INNER_L4_UNKNOWN = 144115188075855872
No inner L4 information found on the packet.
- classmethod from_list_string(names: str) typing_extensions.Self
Makes a flag from a whitespace-separated list of names.
- Parameters:
names (str) – a whitespace-separated list containing the members of this flag.
- Returns:
An instance of this flag.
- Return type:
typing_extensions.Self
- classmethod from_str(name: str) typing_extensions.Self
Makes a flag matching the supplied name.
- Parameters:
name (str) – a valid member of this flag in text
- Returns:
An instance of this flag.
- Return type:
typing_extensions.Self
- classmethod make_parser(hw: bool) ParserFn
Makes a parser function.
- Parameters:
hw (bool) – Whether to make a parser for hardware ptypes or software ptypes. If
True
, hardware ptypes will be collected, otherwise software pytpes will.- Returns:
- A dictionary for the dataclasses.field metadata argument containing a
parser function that makes an instance of this flag from text.
- Return type:
- class TestPmdVerbosePacket
Bases:
TextParser
Packet information provided by verbose output in Testpmd.
This dataclass expects that packet information be prepended with the starting line of packet bursts. Specifically, the line that reads “port X/queue Y: sent/received Z packets”.
- port_id: int
ID of the port that handled the packet.
- queue_id: int
ID of the queue that handled the packet.
- was_received: bool
Whether the packet was received or sent by the queue/port.
- src_mac: str
- dst_mac: str
- pool: str
Memory pool the packet was handled on.
- p_type: int
Packet type in hex.
- length: int
- nb_segs: int
Number of segments in the packet.
- hw_ptype: RtePTypes
Hardware packet type.
- sw_ptype: RtePTypes
Software packet type.
- l2_len: int
- ol_flags: PacketOffloadFlag
- rss_hash: int | None = None
RSS hash of the packet in hex.
- rss_queue: int | None = None
RSS queue that handled the packet in hex.
- l3_len: int | None = None
- l4_len: int | None = None
- __init__(port_id: int, queue_id: int, was_received: bool, src_mac: str, dst_mac: str, pool: str, p_type: int, length: int, nb_segs: int, hw_ptype: RtePTypes, sw_ptype: RtePTypes, l2_len: int, ol_flags: PacketOffloadFlag, rss_hash: int | None = None, rss_queue: int | None = None, l3_len: int | None = None, l4_len: int | None = None) None
- class RxOffloadCapability
Bases:
Flag
Rx offload capabilities of a device.
The flags are taken from
lib/ethdev/rte_ethdev.h
. They’re prefixed withRTE_ETH_RX_OFFLOAD
inlib/ethdev/rte_ethdev.h
instead ofRX_OFFLOAD
, which is what testpmd changes the prefix to. The values are not contiguous, so the correspondence is preserved by specifying concrete values interspersed between auto() values.The
RX_OFFLOAD
prefix has been preserved so that the same flag names can be used inNicCapability
. The prefix is needed inNicCapability
since there’s no other qualifier which would sufficiently distinguish it from other capabilities.References
DPDK lib:
lib/ethdev/rte_ethdev.h
testpmd display function:app/test-pmd/cmdline.c:print_rx_offloads()
- RX_OFFLOAD_VLAN_STRIP = 1
- RX_OFFLOAD_IPV4_CKSUM = 2
Device supports L3 checksum offload.
- RX_OFFLOAD_UDP_CKSUM = 4
Device supports L4 checksum offload.
- RX_OFFLOAD_TCP_CKSUM = 8
Device supports L4 checksum offload.
- RX_OFFLOAD_TCP_LRO = 16
Device supports Large Receive Offload.
- RX_OFFLOAD_QINQ_STRIP = 32
Device supports QinQ (queue in queue) offload.
- RX_OFFLOAD_OUTER_IPV4_CKSUM = 64
Device supports inner packet L3 checksum.
- RX_OFFLOAD_MACSEC_STRIP = 128
Device supports MACsec.
- RX_OFFLOAD_VLAN_FILTER = 512
Device supports filtering of a VLAN Tag identifier.
- RX_OFFLOAD_VLAN_EXTEND = 1024
Device supports VLAN offload.
- RX_OFFLOAD_SCATTER = 8192
Device supports receiving segmented mbufs.
- RX_OFFLOAD_TIMESTAMP = 16384
Device supports Timestamp.
- RX_OFFLOAD_SECURITY = 32768
Device supports crypto processing while packet is received in NIC.
- RX_OFFLOAD_KEEP_CRC = 65536
Device supports CRC stripping.
- RX_OFFLOAD_SCTP_CKSUM = 131072
Device supports L4 checksum offload.
- RX_OFFLOAD_OUTER_UDP_CKSUM = 262144
Device supports inner packet L4 checksum.
- RX_OFFLOAD_RSS_HASH = 524288
Device supports RSS hashing.
- RX_OFFLOAD_BUFFER_SPLIT = 1048576
Device supports
- RX_OFFLOAD_CHECKSUM = 14
Device supports all checksum capabilities.
- RX_OFFLOAD_VLAN = 1569
Device supports all VLAN capabilities.
- classmethod from_string(line: str) typing_extensions.Self
Make an instance from a string containing the flag names separated with a space.
- Parameters:
line (str) – The line to parse.
- Returns:
A new instance containing all found flags.
- Return type:
typing_extensions.Self
- classmethod make_parser(per_port: bool) ParserFn
Make a parser function.
- Parameters:
per_port (bool) – If
True
, will return capabilities per port. IfFalse
, will return capabilities per queue.- Returns:
- A dictionary for the dataclasses.field metadata argument containing a
parser function that makes an instance of this flag from text.
- Return type:
- class RxOffloadCapabilities
Bases:
TextParser
The result of testpmd’s
show port <port_id> rx_offload capabilities
command.References
testpmd command function:
app/test-pmd/cmdline.c:cmd_rx_offload_get_capa()
testpmd display function:app/test-pmd/cmdline.c:cmd_rx_offload_get_capa_parsed()
- port_id: int
- per_queue: RxOffloadCapability
Per-queue Rx offload capabilities.
- per_port: RxOffloadCapability
Capabilities other than per-queue Rx offload capabilities.
- __init__(port_id: int, per_queue: RxOffloadCapability, per_port: RxOffloadCapability) None
- requires_stopped_ports(func: Callable[[Concatenate[TestPmdShell, P]], Any]) Callable[[Concatenate[TestPmdShell, P]], Any]
Decorator for
TestPmdShell
commands methods that require stopped ports.If the decorated method is called while the ports are started, then these are stopped before continuing.
- Parameters:
func (Callable[[Concatenate[TestPmdShell, ~P]], Any]) – The
TestPmdShell
method to decorate.
- requires_started_ports(func: Callable[[Concatenate[TestPmdShell, P]], Any]) Callable[[Concatenate[TestPmdShell, P]], Any]
Decorator for
TestPmdShell
commands methods that require started ports.If the decorated method is called while the ports are stopped, then these are started before continuing.
- Parameters:
func (Callable[[Concatenate[TestPmdShell, ~P]], Any]) – The
TestPmdShell
method to decorate.
- add_remove_mtu(mtu: int = 1500) Callable[[Callable[[Concatenate[TestPmdShell, P]], Any]], Callable[[Concatenate[TestPmdShell, P]], Any]]
Configure MTU to mtu on all ports, run the decorated function, then revert.
- Parameters:
mtu (int) – The MTU to configure all ports on.
- Returns:
The method decorated with setting and reverting MTU.
- Return type:
Callable[[Callable[[Concatenate[TestPmdShell, ~P]], Any]], Callable[[Concatenate[TestPmdShell, ~P]], Any]]
- class TestPmdShell
Bases:
DPDKShell
Testpmd interactive shell.
The testpmd shell users should never use the
send_command()
method directly, but rather call specialized methods. If there isn’t one that satisfies a need, it should be added.- ports_started
Indicates whether the ports are started.
- Type:
bool
- path: ClassVar[PurePath] = PurePosixPath('app/dpdk-testpmd')
The path to the testpmd executable.
- __init__(node: ~framework.testbed_model.sut_node.SutNode, privileged: bool = True, timeout: float = 15, lcore_filter_specifier: framework.testbed_model.cpu.LogicalCoreCount | framework.testbed_model.cpu.LogicalCoreList = LogicalCoreCount(lcores_per_core=1, cores_per_socket=2, socket_count=1, sockets=None), ascending_cores: bool = True, append_prefix_timestamp: bool = True, name: str | None = None, **app_params: typing_extensions.Unpack.<class 'framework.params.types.TestPmdParamsDict'>) None
Overrides
__init__()
. Changes app_params to kwargs.
- property ports: list[framework.remote_session.testpmd_shell.TestPmdPort]
The ports of the instance.
This caches the ports returned by
show_port_info_all()
. To force an update of port information, executeshow_port_info_all()
orshow_port_info()
.Returns: The list of known testpmd ports.
- start(verify: bool = True) None
Start packet forwarding with the current configuration.
- Parameters:
verify (bool) – If
True
, a second start command will be sent in an attempt to verify packet forwarding started as expected.- Raises:
InteractiveCommandExecutionError – If verify is
True
and forwarding fails to start or ports fail to come up.
- stop(verify: bool = True) str
Stop packet forwarding.
- Parameters:
verify (bool) – If
True
, the output of the stop command is scanned to verify that forwarding was stopped successfully or not started. If neither is found, it is considered an error.- Raises:
InteractiveCommandExecutionError – If verify is
True
and the command to stop forwarding results in an error.- Returns:
Output gathered from the stop command and all other preceding logs in the buffer. This output is most often used to view forwarding statistics that are displayed when this command is sent as well as any verbose packet information that hasn’t been consumed prior to calling this method.
- Return type:
str
- get_devices() list[framework.remote_session.testpmd_shell.TestPmdDevice]
Get a list of device names that are known to testpmd.
Uses the device info listed in testpmd and then parses the output.
- Returns:
A list of devices.
- Return type:
- wait_link_status_up(port_id: int, timeout=15) bool
Wait until the link status on the given port is “up”.
- Parameters:
port_id (int) – Port to check the link status on.
timeout – Time to wait for the link to come up. The default value for this argument may be modified using the
--timeout
command-line argument or theDTS_TIMEOUT
environment variable.
- Returns:
Whether the link came up in time or not.
- Return type:
bool
- set_forward_mode(mode: SimpleForwardingModes, verify: bool = True)
Set packet forwarding mode.
- Parameters:
mode (SimpleForwardingModes) – The forwarding mode to use.
verify (bool) – If
True
the output of the command will be scanned in an attempt to verify that the forwarding mode was set to mode properly.
- Raises:
InteractiveCommandExecutionError – If verify is
True
and the forwarding mode fails to update.
- stop_all_ports(verify: bool = True) None
Stops all the ports.
- Parameters:
verify (bool) – If
True
, the output of the command will be checked for a successful execution.- Raises:
InteractiveCommandExecutionError – If verify is
True
and the ports were not stopped successfully.
- start_all_ports(verify: bool = True) None
Starts all the ports.
- Parameters:
verify (bool) – If
True
, the output of the command will be checked for a successful execution.- Raises:
InteractiveCommandExecutionError – If verify is
True
and the ports were not started successfully.
- set_ports_queues(number_of: int) None
Sets the number of queues per port.
- Parameters:
number_of (int) – The number of RX/TX queues to create per port.
- Raises:
InternalError – If number_of is invalid.
- show_port_info_all() list[framework.remote_session.testpmd_shell.TestPmdPort]
Returns the information of all the ports.
- Returns:
A list containing all the ports information as TestPmdPort.
- Return type:
list[TestPmdPort]
- show_port_info(port_id: int) TestPmdPort
Returns the given port information.
- Parameters:
port_id (int) – The port ID to gather information for.
- Raises:
InteractiveCommandExecutionError – If port_id is invalid.
- Returns:
An instance of TestPmdPort containing the given port’s information.
- Return type:
- set_mac_addr(port_id: int, mac_address: str, add: bool, verify: bool = True) None
Add or remove a mac address on a given port’s Allowlist.
- Parameters:
port_id (int) – The port ID the mac address is set on.
mac_address (str) – The mac address to be added to or removed from the specified port.
add (bool) – If
True
, add the specified mac address. IfFalse
, remove specified mac address.verify (bool) – If :data:’True’, assert that the ‘mac_addr’ operation was successful. If :data:’False’, run the command and skip this assertion.
- Raises:
InteractiveCommandExecutionError – If the set mac address operation fails.
- set_multicast_mac_addr(port_id: int, multi_addr: str, add: bool, verify: bool = True) None
Add or remove multicast mac address to a specified port’s allow list.
- Parameters:
port_id (int) – The port ID the multicast address is set on.
multi_addr (str) – The multicast address to be added or removed from the filter.
add (bool) – If :data:’True’, add the specified multicast address to the port filter. If :data:’False’, remove the specified multicast address from the port filter.
verify (bool) – If :data:’True’, assert that the ‘mcast_addr’ operations was successful. If :data:’False’, execute the ‘mcast_addr’ operation and skip the assertion.
- Raises:
InteractiveCommandExecutionError – If either the ‘add’ or ‘remove’ operations fails.
- show_port_stats_all() list[framework.remote_session.testpmd_shell.TestPmdPortStats]
Returns the statistics of all the ports.
- Returns:
A list containing all the ports stats as TestPmdPortStats.
- Return type:
list[TestPmdPortStats]
- show_port_stats(port_id: int) TestPmdPortStats
Returns the given port statistics.
- Parameters:
port_id (int) – The port ID to gather information for.
- Raises:
InteractiveCommandExecutionError – If port_id is invalid.
- Returns:
An instance of TestPmdPortStats containing the given port’s stats.
- Return type:
- csum_set_hw(layers: ChecksumOffloadOptions, port_id: int, verify: bool = True) None
Enables hardware checksum offloading on the specified layer.
- Parameters:
layers (ChecksumOffloadOptions) – The layer/layers that checksum offloading should be enabled on.
port_id (int) – The port number to enable checksum offloading on, should be within 0-32.
verify (bool) – If
True
the output of the command will be scanned in an attempt to verify that checksum offloading was enabled on the port.
- Raises:
InteractiveCommandExecutionError – If checksum offload is not enabled successfully.
- set_port_mtu(port_id: int, mtu: int, verify: bool = True) None
Change the MTU of a port using testpmd.
Some PMDs require that the port be stopped before changing the MTU, and it does no harm to stop the port before configuring in cases where it isn’t required, so ports are stopped prior to changing their MTU.
- Parameters:
port_id (int) – ID of the port to adjust the MTU on.
mtu (int) – Desired value for the MTU to be set to.
verify (bool) – If verify is
True
then the output will be scanned in an attempt to verify that the mtu was properly set on the port. Defaults toTrue
.
- Raises:
InteractiveCommandExecutionError – If verify is
True
and the MTU was not properly updated on the port matching port_id.
- set_port_mtu_all(mtu: int, verify: bool = True) None
Change the MTU of all ports using testpmd.
Runs
set_port_mtu()
for every port that testpmd is aware of.- Parameters:
mtu (int) – Desired value for the MTU to be set to.
verify (bool) – Whether to verify that setting the MTU on each port was successful or not. Defaults to
True
.
- Raises:
InteractiveCommandExecutionError – If verify is
True
and the MTU was not properly updated on at least one port.
- static extract_verbose_output(output: str) list[framework.remote_session.testpmd_shell.TestPmdVerbosePacket]
Extract the verbose information present in given testpmd output.
This method extracts sections of verbose output that begin with the line “port X/queue Y: sent/received Z packets” and end with the ol_flags of a packet.
- Parameters:
output (str) – Testpmd output that contains verbose information
- Returns:
List of parsed packet information gathered from verbose information in output.
- Return type:
list[framework.remote_session.testpmd_shell.TestPmdVerbosePacket]
- set_vlan_filter(port: int, enable: bool, verify: bool = True) None
Set vlan filter on.
- Parameters:
port (int) – The port number to enable VLAN filter on.
enable (bool) – Enable the filter on port if
True
, otherwise disable it.verify (bool) – If
True
, the output of the command and show port info is scanned to verify that vlan filtering was set successfully.
- Raises:
InteractiveCommandExecutionError – If verify is
True
and the filter fails to update.
- rx_vlan(vlan: int, port: int, add: bool, verify: bool = True) None
Add specified vlan tag to the filter list on a port. Requires vlan filter to be on.
- Parameters:
vlan (int) – The vlan tag to add, should be within 1-1005.
port (int) – The port number to add the tag on.
add (bool) – Adds the tag if
True
, otherwise removes the tag.verify (bool) – If
True
, the output of the command is scanned to verify that the vlan tag was added to the filter list on the specified port.
- Raises:
InteractiveCommandExecutionError – If verify is
True
and the tag is not added.
- set_vlan_strip(port: int, enable: bool, verify: bool = True) None
Enable or disable vlan stripping on the specified port.
- Parameters:
port (int) – The port number to use.
enable (bool) – If
True
, will turn vlan stripping on, otherwise will turn off.verify (bool) – If
True
, the output of the command and show port info is scanned to verify that vlan stripping was enabled on the specified port.
- Raises:
InteractiveCommandExecutionError – If verify is
True
and stripping fails to update.
- tx_vlan_set(port: int, enable: bool, vlan: int | None = None, verify: bool = True) None
Set hardware insertion of vlan tags in packets sent on a port.
- Parameters:
port (int) – The port number to use.
enable (bool) – Sets vlan tag insertion if
True
, and resets ifFalse
.vlan (int | None) – The vlan tag to insert if enable is
True
.verify (bool) – If
True
, the output of the command is scanned to verify that vlan insertion was enabled on the specified port.
- Raises:
InteractiveCommandExecutionError – If verify is
True
and the insertion tag is not set.
- set_promisc(port: int, enable: bool, verify: bool = True) None
Enable or disable promiscuous mode for the specified port.
- Parameters:
port (int) – Port number to use.
enable (bool) – If
True
, turn promiscuous mode on, otherwise turn off.verify (bool) – If
True
an additional command will be sent to verify that promiscuous mode is properly set. Defaults toTrue
.
- Raises:
InteractiveCommandExecutionError – If verify is
True
and promiscuous mode is not correctly set.
- set_verbose(level: int, verify: bool = True) None
Set debug verbosity level.
- Parameters:
level (int) – 0 - silent except for error 1 - fully verbose except for Tx packets 2 - fully verbose except for Rx packets >2 - fully verbose
verify (bool) – If
True
the command output will be scanned to verify that verbose level is properly set. Defaults toTrue
.
- Raises:
InteractiveCommandExecutionError – If verify is
True
and verbose levelis not correctly set. –
- get_capabilities_rx_offload(supported_capabilities: MutableSet[NicCapability], unsupported_capabilities: MutableSet[NicCapability]) None
Get all rx offload capabilities and divide them into supported and unsupported.
- Parameters:
supported_capabilities (MutableSet[NicCapability]) – Supported capabilities will be added to this set.
unsupported_capabilities (MutableSet[NicCapability]) – Unsupported capabilities will be added to this set.
- get_port_queue_info(port_id: int, queue_id: int, is_rx_queue: bool) TestPmdQueueInfo
Returns the current state of the specified queue.
- setup_port_queue(port_id: int, queue_id: int, is_rx_queue: bool) None
Setup a given queue on a port.
This functionality cannot be verified because the setup action only takes effect when the queue is started.
- Parameters:
port_id (int) – ID of the port where the queue resides.
queue_id (int) – ID of the queue to setup.
is_rx_queue (bool) – Type of queue to setup. If
True
an RX queue will be setup, otherwise a TX queue will be setup.
- stop_port_queue(port_id: int, queue_id: int, is_rx_queue: bool, verify: bool = True) None
Stops a given queue on a port.
- Parameters:
port_id (int) – ID of the port that the queue belongs to.
queue_id (int) – ID of the queue to stop.
is_rx_queue (bool) – Type of queue to stop. If
True
an RX queue will be stopped, otherwise a TX queue will be stopped.verify (bool) – If
True
an additional command will be sent to verify the queue stopped. Defaults toTrue
.
- Raises:
InteractiveCommandExecutionError – If verify is
True
and the queue fails to stop.
- start_port_queue(port_id: int, queue_id: int, is_rx_queue: bool, verify: bool = True) None
Starts a given queue on a port.
First sets up the port queue, then starts it.
- Parameters:
port_id (int) – ID of the port that the queue belongs to.
queue_id (int) – ID of the queue to start.
is_rx_queue (bool) – Type of queue to start. If
True
an RX queue will be started, otherwise a TX queue will be started.verify (bool) – if
True
an additional command will be sent to verify that the queue was started. Defaults toTrue
.
- Raises:
InteractiveCommandExecutionError – If verify is
True
and the queue fails to start.
- get_queue_ring_size(port_id: int, queue_id: int, is_rx_queue: bool) int
Returns the current size of the ring on the specified queue.
- set_queue_ring_size(port_id: int, queue_id: int, size: int, is_rx_queue: bool, verify: bool = True) None
Update the ring size of an Rx/Tx queue on a given port.
Queue is setup after setting the ring size so that the queue info reflects this change and it can be verified.
- Parameters:
port_id (int) – The port that the queue resides on.
queue_id (int) – The ID of the queue on the port.
size (int) – The size to update the ring size to.
is_rx_queue (bool) – Whether to modify an RX or TX queue. If
True
an RX queue will be updated, otherwise a TX queue will be updated.verify (bool) – If
True
an additional command will be sent to check the ring size of the queue in an attempt to validate that the size was changes properly.
- Raises:
InteractiveCommandExecutionError – If verify is
True
and there is a failure when updating ring size.
- get_capabilities_rxq_info(supported_capabilities: MutableSet[NicCapability], unsupported_capabilities: MutableSet[NicCapability]) None
Get all rxq capabilities and divide them into supported and unsupported.
- Parameters:
supported_capabilities (MutableSet[NicCapability]) – Supported capabilities will be added to this set.
unsupported_capabilities (MutableSet[NicCapability]) – Unsupported capabilities will be added to this set.
- get_capabilities_show_port_info(supported_capabilities: MutableSet[NicCapability], unsupported_capabilities: MutableSet[NicCapability]) None
Get all capabilities from show port info and divide them into supported and unsupported.
- Parameters:
supported_capabilities (MutableSet[NicCapability]) – Supported capabilities will be added to this set.
unsupported_capabilities (MutableSet[NicCapability]) – Unsupported capabilities will be added to this set.
- get_capabilities_mcast_filtering(supported_capabilities: MutableSet[NicCapability], unsupported_capabilities: MutableSet[NicCapability]) None
Get multicast filtering capability from mcast_addr add and check for testpmd error code.
- Parameters:
supported_capabilities (MutableSet[NicCapability]) – Supported capabilities will be added to this set.
unsupported_capabilities (MutableSet[NicCapability]) – Unsupported capabilities will be added to this set.
- class NicCapability
Bases:
Enum
A mapping between capability names and the associated
TestPmdShell
methods.The
TestPmdShell
capability checking method executes the command that checks whether the capability is supported. A decorator may optionally be added to the method that will add and remove configuration that’s necessary to retrieve the capability support status. The Enum members may be assigned the method itself or a tuple of (capability_checking_method, decorator_function).The signature of each
TestPmdShell
capability checking method must be:fn(self, supported_capabilities: MutableSet, unsupported_capabilities: MutableSet) -> None
The capability checking method must get whether a capability is supported or not from a testpmd command. If multiple capabilities can be obtained from a testpmd command, each should be obtained in the method. These capabilities should then be added to supported_capabilities or unsupported_capabilities based on their support.
The two dictionaries are shared across all capability discovery function calls in a given test run so that we don’t call the same function multiple times. For example, when we find
SCATTERED_RX_ENABLED
inTestPmdShell.get_capabilities_rxq_info()
, we don’t go looking for it again if a different test case also needs it.- SCATTERED_RX_ENABLED: collections.abc.Callable[[framework.remote_session.testpmd_shell.TestPmdShell, collections.abc.MutableSet[framework.remote_session.testpmd_shell.NicCapability], collections.abc.MutableSet[framework.remote_session.testpmd_shell.NicCapability]], None] | tuple[collections.abc.Callable[framework.remote_session.testpmd_shell.TestPmdShell, collections.abc.MutableSet[framework.remote_session.testpmd_shell.NicCapability], collections.abc.MutableSet[framework.remote_session.testpmd_shell.NicCapability], None], collections.abc.Callable[collections.abc.Callable[Concatenate[framework.remote_session.testpmd_shell.TestPmdShell, P], Any], collections.abc.Callable[Concatenate[framework.remote_session.testpmd_shell.TestPmdShell, P], Any]]] = (<function TestPmdShell.get_capabilities_rxq_info>, <function add_remove_mtu.<locals>.decorator>)
Scattered packets Rx enabled
- RX_OFFLOAD_VLAN_STRIP: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
- RX_OFFLOAD_IPV4_CKSUM: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports L3 checksum offload.
- RX_OFFLOAD_UDP_CKSUM: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports L4 checksum offload.
- RX_OFFLOAD_TCP_CKSUM: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports L4 checksum offload.
- RX_OFFLOAD_TCP_LRO: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports Large Receive Offload.
- RX_OFFLOAD_QINQ_STRIP: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports QinQ (queue in queue) offload.
- RX_OFFLOAD_OUTER_IPV4_CKSUM: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports inner packet L3 checksum.
- RX_OFFLOAD_MACSEC_STRIP: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports MACsec.
- RX_OFFLOAD_VLAN_FILTER: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports filtering of a VLAN Tag identifier.
- RX_OFFLOAD_VLAN_EXTEND: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports VLAN offload.
- RX_OFFLOAD_SCATTER: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports receiving segmented mbufs.
- RX_OFFLOAD_TIMESTAMP: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports Timestamp.
- RX_OFFLOAD_SECURITY: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports crypto processing while packet is received in NIC.
- RX_OFFLOAD_KEEP_CRC: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports CRC stripping.
- RX_OFFLOAD_SCTP_CKSUM: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports L4 checksum offload.
- RX_OFFLOAD_OUTER_UDP_CKSUM: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports inner packet L4 checksum.
- RX_OFFLOAD_RSS_HASH: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports RSS hashing.
- RX_OFFLOAD_BUFFER_SPLIT: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports scatter Rx packets to segmented mbufs.
- RX_OFFLOAD_CHECKSUM: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports all checksum capabilities.
- RX_OFFLOAD_VLAN: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_rx_offload>)
Device supports all VLAN capabilities.
- RUNTIME_RX_QUEUE_SETUP: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_show_port_info>)
Device supports Rx queue setup after device started.
- RUNTIME_TX_QUEUE_SETUP: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_show_port_info>)
Device supports Tx queue setup after device started.
- RXQ_SHARE: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_show_port_info>)
Device supports shared Rx queue among ports within Rx domain and switch domain.
- FLOW_RULE_KEEP: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_show_port_info>)
Device supports keeping flow rules across restart.
- FLOW_SHARED_OBJECT_KEEP: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_show_port_info>)
Device supports keeping shared flow objects across restart.
- MCAST_FILTERING: Callable[[TestPmdShell, MutableSet[NicCapability], MutableSet[NicCapability]], None] = functools.partial(<function TestPmdShell.get_capabilities_mcast_filtering>)
Device supports multicast address filtering.