Signed-off-by: pmikus <peter.mikus@protonmail.ch>
Change-Id: I0c261b08dc9b88b853922520598ddb29d222e86c
"""CPU utilities library."""
"""CPU utilities library."""
+from random import choice
+
from robot.libraries.BuiltIn import BuiltIn
from resources.libraries.python.Constants import Constants
from robot.libraries.BuiltIn import BuiltIn
from resources.libraries.python.Constants import Constants
continue
# Number of Data Plane physical cores.
dp_cores_count = BuiltIn().get_variable_value(
continue
# Number of Data Plane physical cores.
dp_cores_count = BuiltIn().get_variable_value(
- f"${{dp_cores_count}}", phy_cores
+ "${{dp_cores_count}}", phy_cores
)
# Number of Feature Plane physical cores.
fp_cores_count = BuiltIn().get_variable_value(
)
# Number of Feature Plane physical cores.
fp_cores_count = BuiltIn().get_variable_value(
- f"${{fp_cores_count}}", phy_cores - dp_cores_count
+ "${{fp_cores_count}}", phy_cores - dp_cores_count
)
# Ratio between RX queues and data plane threads.
rxq_ratio = BuiltIn().get_variable_value(
)
# Ratio between RX queues and data plane threads.
rxq_ratio = BuiltIn().get_variable_value(
)
dut_pf_keys = BuiltIn().get_variable_value(
)
dut_pf_keys = BuiltIn().get_variable_value(
)
# SMT override in case of non standard test cases.
smt_used = BuiltIn().get_variable_value(
)
# SMT override in case of non standard test cases.
smt_used = BuiltIn().get_variable_value(
- f"${{smt_used}}", CpuUtils.is_smt_enabled(node["cpuinfo"])
+ "${{smt_used}}", CpuUtils.is_smt_enabled(node["cpuinfo"])
)
cpu_node = Topology.get_interfaces_numa_node(node, *dut_pf_keys)
)
cpu_node = Topology.get_interfaces_numa_node(node, *dut_pf_keys)
cpu_main = CpuUtils.cpu_list_per_node_str(
node, cpu_node,
skip_cnt=skip_cnt,
cpu_main = CpuUtils.cpu_list_per_node_str(
node, cpu_node,
skip_cnt=skip_cnt,
- cpu_cnt=Constants.CPU_CNT_MAIN,
+ cpu_cnt=Constants.CPU_CNT_MAIN if phy_cores else 0,
+ cpu_main = cpu_main if phy_cores else choice(cpu_main.split(","))
skip_cnt += Constants.CPU_CNT_MAIN
cpu_dp = CpuUtils.cpu_list_per_node_str(
node, cpu_node,
skip_cnt += Constants.CPU_CNT_MAIN
cpu_dp = CpuUtils.cpu_list_per_node_str(
node, cpu_node,