aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/Constants.py11
-rw-r--r--resources/libraries/python/ContainerUtils.py3
-rw-r--r--resources/libraries/python/DUTSetup.py8
-rw-r--r--resources/libraries/python/IPsecUtil.py8
-rw-r--r--resources/libraries/python/PapiExecutor.py8
-rw-r--r--resources/libraries/python/TRexConfigGenerator.py13
-rw-r--r--resources/libraries/python/TrafficGenerator.py20
-rw-r--r--resources/libraries/python/VppConfigGenerator.py2
8 files changed, 42 insertions, 31 deletions
diff --git a/resources/libraries/python/Constants.py b/resources/libraries/python/Constants.py
index 70452e6ff4..3fabe0141b 100644
--- a/resources/libraries/python/Constants.py
+++ b/resources/libraries/python/Constants.py
@@ -206,6 +206,8 @@ class Constants:
# TRex number of cores in case multiple dual interface configurations.
TREX_CORE_COUNT_MULTI = get_int_from_env("TREX_CORE_COUNT_MULTI", 8)
+ TREX_PORT_MTU = get_int_from_env("TREX_PORT_MTU", 0)
+
# TRex set number of RX/TX descriptors.
# Set to 0 to use default values.
TREX_TX_DESCRIPTORS_COUNT = get_int_from_env(
@@ -316,7 +318,6 @@ class Constants:
# Mapping from NIC name to its bps limit.
NIC_NAME_TO_BPS_LIMIT = {
- "Intel-X520-DA2": 10000000000,
"Intel-X710": 10000000000,
"Intel-XL710": 24500000000,
"Intel-XXV710": 24500000000,
@@ -335,7 +336,6 @@ class Constants:
# Mapping from NIC name to its pps limit.
NIC_NAME_TO_PPS_LIMIT = {
- "Intel-X520-DA2": 14880952,
"Intel-X710": 14880952,
"Intel-XL710": 18750000,
"Intel-XXV710": 18750000,
@@ -354,7 +354,6 @@ class Constants:
# Suite file names use codes for NICs.
NIC_NAME_TO_CODE = {
- "Intel-X520-DA2": "10ge2p1x520",
"Intel-X710": "10ge2p1x710",
"Intel-XL710": "40ge2p1xl710",
"Intel-XXV710": "25ge2p1xxv710",
@@ -372,7 +371,6 @@ class Constants:
"virtual": "1ge1p82540em",
}
NIC_CODE_TO_NAME = {
- "10ge2p1x520": "Intel-X520-DA2",
"10ge2p1x710": "Intel-X710",
"40ge2p1xl710": "Intel-XL710",
"25ge2p1xxv710": "Intel-XXV710",
@@ -392,7 +390,6 @@ class Constants:
# Shortened lowercase NIC model name, useful for presentation.
NIC_CODE_TO_SHORT_NAME = {
- "10ge2p1x520": "x520",
"10ge2p1x710": "x710",
"40ge2p1xl710": "xl710",
"25ge2p1xxv710": "xxv710",
@@ -412,7 +409,6 @@ class Constants:
# Not each driver is supported by each NIC.
NIC_NAME_TO_DRIVER = {
- "Intel-X520-DA2": ["vfio-pci", "af_xdp"],
"Intel-X710": ["vfio-pci", "avf", "af_xdp"],
"Intel-XL710": ["vfio-pci", "avf", "af_xdp"],
"Intel-XXV710": ["vfio-pci", "avf", "af_xdp"],
@@ -467,7 +463,6 @@ class Constants:
# Number of physical interfaces of physical nic.
NIC_CODE_TO_PFS = {
- "10ge2p1x520": "nic_pfs}= | 2",
"10ge2p1x710": "nic_pfs}= | 2",
"40ge2p1xl710": "nic_pfs}= | 2",
"25ge2p1xxv710": "nic_pfs}= | 2",
@@ -486,7 +481,6 @@ class Constants:
}
NIC_CODE_TO_CORESCALE = {
- "10ge2p1x520": 1,
"10ge2p1x710": 1,
"40ge2p1xl710": 1,
"25ge2p1xxv710": 1,
@@ -506,7 +500,6 @@ class Constants:
# Not each driver is supported by each NIC.
DPDK_NIC_NAME_TO_DRIVER = {
- "Intel-X520-DA2": ["vfio-pci"],
"Intel-X710": ["vfio-pci"],
"Intel-XL710": ["vfio-pci"],
"Intel-XXV710": ["vfio-pci"],
diff --git a/resources/libraries/python/ContainerUtils.py b/resources/libraries/python/ContainerUtils.py
index ef08317420..7d6d4d8673 100644
--- a/resources/libraries/python/ContainerUtils.py
+++ b/resources/libraries/python/ContainerUtils.py
@@ -939,8 +939,7 @@ class LXC(ContainerEngine):
image = self.container.image if self.container.image \
else f"-d ubuntu -r jammy -a {target_arch}"
- cmd = f"lxc-create -t download --name {self.container.name} " \
- f"-- {image} --no-validate"
+ cmd = f"lxc-create -t download --name {self.container.name} -- {image}"
ret, _, _ = self.container.ssh.exec_command_sudo(cmd, timeout=1800)
if int(ret) != 0:
diff --git a/resources/libraries/python/DUTSetup.py b/resources/libraries/python/DUTSetup.py
index f9758c5f9f..64f3b4317c 100644
--- a/resources/libraries/python/DUTSetup.py
+++ b/resources/libraries/python/DUTSetup.py
@@ -298,7 +298,8 @@ class DUTSetup:
return sriov_numvfs
@staticmethod
- def set_sriov_numvfs(node, pf_pci_addr, path="devices", numvfs=0):
+ def set_sriov_numvfs(
+ node, pf_pci_addr, path="devices", numvfs=0, skip_check=True):
"""Init or reset SR-IOV virtual functions by setting its number on PCI
device on DUT. Setting to zero removes all VFs.
@@ -306,10 +307,12 @@ class DUTSetup:
:param pf_pci_addr: Physical Function PCI device address.
:param path: Either device or driver.
:param numvfs: Number of VFs to initialize, 0 - removes the VFs.
+ :param skip_check: Return anyway.
:type node: dict
:type pf_pci_addr: str
:type path: str
:type numvfs: int
+ :type skip_check: bool
:raises RuntimeError: Failed to create VFs on PCI.
"""
cmd = f"test -f /sys/bus/pci/{path}/{pf_pci_addr}/sriov_numvfs"
@@ -320,6 +323,9 @@ class DUTSetup:
# sriov is not supported and we want 0 VFs
# no need to do anything
return
+ if numvfs > 0 and skip_check:
+ # we may be in VM
+ return
raise RuntimeError(
f"Can't configure {numvfs} VFs on {pf_pci_addr} device "
diff --git a/resources/libraries/python/IPsecUtil.py b/resources/libraries/python/IPsecUtil.py
index 1abfee2cec..e93ae28142 100644
--- a/resources/libraries/python/IPsecUtil.py
+++ b/resources/libraries/python/IPsecUtil.py
@@ -348,13 +348,7 @@ class IPsecUtil:
cmd = "crypto_set_async_dispatch_v2"
err_msg = "Failed to set dispatch mode."
args = dict(mode=0, adaptive=False)
- try:
- papi_exec.add(cmd, **args).get_reply(err_msg)
- except (AttributeError, RuntimeError):
- # Expected when VPP build does not have the _v2 yet
- # (after and before the first CRC check).
- # TODO: Fail here when testing of pre-23.10 builds is over.
- pass
+ papi_exec.add(cmd, **args).get_reply(err_msg)
@staticmethod
def vpp_ipsec_crypto_sw_scheduler_set_worker(
diff --git a/resources/libraries/python/PapiExecutor.py b/resources/libraries/python/PapiExecutor.py
index a55638ab7c..e685f87a10 100644
--- a/resources/libraries/python/PapiExecutor.py
+++ b/resources/libraries/python/PapiExecutor.py
@@ -1051,6 +1051,10 @@ class PapiSocketExecutor:
PapiSocketExecutor._drain(vpp_instance, err_msg)
# Process replies for this command.
for reply in replies:
+ if reply is None:
+ raise RuntimeError(
+ f"{err_msg}\nNo reply to sync call. VPP crashed?"
+ )
self.crc_checker.check_api_name(reply.__class__.__name__)
dictized_reply = dictize_and_check_retval(reply, err_msg)
ret_list.append(dictized_reply)
@@ -1061,6 +1065,8 @@ class PapiSocketExecutor:
The messages were already sent by .add() in this mode,
local_list is used just so we know how many replies to read.
+ Similarly to async .add, we do not check connection status here,
+ thus we avoid needless logging.
Beware: It is not clear what to do when socket read fails
in the middle of async processing.
@@ -1084,7 +1090,7 @@ class PapiSocketExecutor:
:rtype: List[UserDict]
:raises RuntimeError: If the replies are not all correct.
"""
- vpp_instance = self.get_connected_client()
+ vpp_instance = self.get_connected_client(check_connected=False)
ret_list = list()
try:
for index, _ in enumerate(local_list):
diff --git a/resources/libraries/python/TRexConfigGenerator.py b/resources/libraries/python/TRexConfigGenerator.py
index c50b42610c..4b9719b99e 100644
--- a/resources/libraries/python/TRexConfigGenerator.py
+++ b/resources/libraries/python/TRexConfigGenerator.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2024 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -182,6 +182,15 @@ class TrexConfigGenerator:
path = ["port_info"]
self.add_config_item(self._node_config, value, path)
+ def add_port_mtu(self, value):
+ """Add port MTU configuration.
+
+ :param value: Port MTU configuration.
+ :type value: int
+ """
+ path = ["port_mtu"]
+ self.add_config_item(self._node_config, value, path)
+
def add_platform_master_thread_id(self, value):
"""Add platform master thread ID.
@@ -291,6 +300,8 @@ class TrexConfig:
trex_config.add_c(cores)
trex_config.add_limit_memory(limit_memory)
trex_config.add_port_info(port_info)
+ if Constants.TREX_PORT_MTU != 0:
+ trex_config.add_port_mtu(Constants.TREX_PORT_MTU)
if Constants.TREX_RX_DESCRIPTORS_COUNT != 0:
trex_config.add_rx_desc(Constants.TREX_RX_DESCRIPTORS_COUNT)
if Constants.TREX_TX_DESCRIPTORS_COUNT != 0:
diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py
index 936cb3a06d..ae01f8d3a6 100644
--- a/resources/libraries/python/TrafficGenerator.py
+++ b/resources/libraries/python/TrafficGenerator.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2024 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -284,13 +284,13 @@ class TrafficGenerator(AbstractMeasurer):
def initialize_traffic_generator(self, osi_layer, pfs=2):
"""TG initialization.
- :param osi_layer: 'L2', 'L3' or 'L7' - OSI Layer testing type.
+ :param osi_layer: OSI Layer testing type.
:param pfs: Number of physical interfaces to configure.
:type osi_layer: str
:type pfs: int
:raises ValueError: If OSI layer is unknown.
"""
- if osi_layer not in ("L2", "L3", "L7"):
+ if osi_layer not in ("L2", "L3", "L3_1", "L7"):
raise ValueError("Unknown OSI layer!")
topology = BuiltIn().get_variable_value("&{topology_info}")
@@ -304,7 +304,9 @@ class TrafficGenerator(AbstractMeasurer):
for link in range(1, pfs, 2):
tg_if1_adj_addr = topology[f"TG_pf{link+1}_mac"][0]
tg_if2_adj_addr = topology[f"TG_pf{link}_mac"][0]
- if osi_layer in ("L3", "L7") and "DUT1" in topology.keys():
+ skip = 0 if osi_layer in ("L3_1",) else 1
+ if osi_layer in ("L3", "L3_1", "L7") and "DUT1" \
+ in topology.keys():
ifl = BuiltIn().get_variable_value("${int}")
last = topology["duts_count"]
tg_if1_adj_addr = Topology().get_interface_mac(
@@ -316,7 +318,7 @@ class TrafficGenerator(AbstractMeasurer):
tg_if2_adj_addr = Topology().get_interface_mac(
topology[f"DUT{last}"],
BuiltIn().get_variable_value(
- f"${{DUT{last}_{ifl}{link+1}}}[0]"
+ f"${{DUT{last}_{ifl}{link+skip}}}[0]"
)
)
@@ -365,7 +367,7 @@ class TrafficGenerator(AbstractMeasurer):
"""Startup sequence for the TRex traffic generator.
:param tg_node: Traffic generator node.
- :param osi_layer: 'L2', 'L3' or 'L7' - OSI Layer testing type.
+ :param osi_layer: OSI Layer testing type.
:param subtype: Traffic generator sub-type.
:type tg_node: dict
:type osi_layer: str
@@ -429,7 +431,7 @@ class TrafficGenerator(AbstractMeasurer):
# Test T-Rex API responsiveness.
cmd = f"python3 {Constants.REMOTE_FW_DIR}/GPL/tools/trex/"
- if osi_layer in ("L2", "L3"):
+ if osi_layer in ("L2", "L3", "L3_1"):
cmd += "trex_stl_assert.py"
elif osi_layer == "L7":
cmd += "trex_astf_assert.py"
@@ -524,7 +526,7 @@ class TrafficGenerator(AbstractMeasurer):
command_line.add(f"'{value}'")
stdout, _ = exec_cmd_no_error(
node, command_line,
- message="T-Rex STL runtime error!"
+ message="T-Rex STL runtime error!", include_reason=True
)
self._parse_traffic_results(stdout)
@@ -763,7 +765,7 @@ class TrafficGenerator(AbstractMeasurer):
self._rate = float(rate[:-3]) if "pps" in rate else float(rate)
stdout, _ = exec_cmd_no_error(
self._node, command_line, timeout=int(duration) + 60,
- message="T-Rex STL runtime error"
+ message="T-Rex STL runtime error", include_reason=True
)
if async_call:
diff --git a/resources/libraries/python/VppConfigGenerator.py b/resources/libraries/python/VppConfigGenerator.py
index fb3df2fc16..971b82606f 100644
--- a/resources/libraries/python/VppConfigGenerator.py
+++ b/resources/libraries/python/VppConfigGenerator.py
@@ -197,7 +197,7 @@ class VppConfigGenerator:
path = ["node", "default", "variant"]
self.add_config_item(self._nodeconfig, variant, path)
- def add_api_segment_gid(self, value="vpp"):
+ def add_api_segment_gid(self, value="testuser"):
"""Add api-segment gid configuration.
:param value: Gid.