aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2024-03-13 14:24:47 +0000
committerPeter Mikus <peter.mikus@protonmail.ch>2024-03-14 10:52:53 +0000
commitb7005e6c4d5180effefc2045638bdf87cee98d75 (patch)
treee3dcc4dbd6d92456a7bab3a649bd6c056b26e583 /resources/libraries/python
parent5afe1ff9542ba03daffb8c857c9977f2fad3e7d4 (diff)
feat(tests): Fix scaling of 6p3nicoper-240318
Signed-off-by: Peter Mikus <peter.mikus@protonmail.ch> Change-Id: I84d9cf2892423e62b116b07982d3e87120b66271
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/Constants.py19
-rw-r--r--resources/libraries/python/autogen/Regenerator.py32
-rw-r--r--resources/libraries/python/model/ExportJson.py23
3 files changed, 37 insertions, 37 deletions
diff --git a/resources/libraries/python/Constants.py b/resources/libraries/python/Constants.py
index 12f555ca84..70452e6ff4 100644
--- a/resources/libraries/python/Constants.py
+++ b/resources/libraries/python/Constants.py
@@ -485,6 +485,25 @@ class Constants:
"1ge1p82540em": "nic_pfs}= | 2",
}
+ NIC_CODE_TO_CORESCALE = {
+ "10ge2p1x520": 1,
+ "10ge2p1x710": 1,
+ "40ge2p1xl710": 1,
+ "25ge2p1xxv710": 1,
+ "25ge2p1e810xxv": 1,
+ "25ge2p1e822cq": 1,
+ "25ge2p1e823c": 1,
+ "100ge2p1e810cq": 1,
+ "50ge1p1ena": 1,
+ "100ge1p1ena": 1,
+ "200ge1p1ena": 1,
+ "100ge2p1cx556a": 1,
+ "100ge2p1cx6dx": 1,
+ "200ge2p1cx7veat": 1,
+ "200ge6p3cx7veat": 3,
+ "1ge1p82540em": 1,
+ }
+
# Not each driver is supported by each NIC.
DPDK_NIC_NAME_TO_DRIVER = {
"Intel-X520-DA2": ["vfio-pci"],
diff --git a/resources/libraries/python/autogen/Regenerator.py b/resources/libraries/python/autogen/Regenerator.py
index 706c250ec2..8d593fecca 100644
--- a/resources/libraries/python/autogen/Regenerator.py
+++ b/resources/libraries/python/autogen/Regenerator.py
@@ -150,16 +150,17 @@ def filter_and_edit_kwargs_for_astf(suite_id, kwargs):
return kwargs
-def add_default_testcases(testcase, iface, suite_id, file_out, tc_kwargs_list):
+def add_default_testcases(
+ testcase, nic_code, suite_id, file_out, tc_kwargs_list):
"""Add default testcases to file.
:param testcase: Testcase class.
- :param iface: Interface.
+ :param nic_code: NIC code.
:param suite_id: Suite ID.
:param file_out: File to write testcases to.
:param tc_kwargs_list: Key-value pairs used to construct testcases.
:type testcase: Testcase
- :type iface: str
+ :type nic_code: str
:type suite_id: str
:type file_out: file
:type tc_kwargs_list: dict
@@ -169,23 +170,7 @@ def add_default_testcases(testcase, iface, suite_id, file_out, tc_kwargs_list):
kwargs = copy.deepcopy(kwas)
# TODO: Is there a better way to disable some combinations?
emit = True
- if kwargs[u"frame_size"] == 9000:
- if u"vic1227" in iface:
- # Not supported in HW.
- emit = False
- if u"vic1385" in iface:
- # Not supported in HW.
- emit = False
- if u"-16vm2t-" in suite_id or u"-16dcr2t-" in suite_id:
- if kwargs[u"phy_cores"] > 3:
- # CSIT lab only has 28 (physical) core processors,
- # so these test would fail when attempting to assign cores.
- emit = False
- if u"-24vm1t-" in suite_id or u"-24dcr1t-" in suite_id:
- if kwargs[u"phy_cores"] > 3:
- # CSIT lab only has 28 (physical) core processors,
- # so these test would fail when attempting to assign cores.
- emit = False
+ core_scale = Constants.NIC_CODE_TO_CORESCALE[nic_code]
if u"soak" in suite_id:
# Soak test take too long, do not risk other than tc01.
if kwargs[u"phy_cores"] != 1:
@@ -196,6 +181,9 @@ def add_default_testcases(testcase, iface, suite_id, file_out, tc_kwargs_list):
else:
if kwargs[u"frame_size"] not in MIN_FRAME_SIZE_VALUES:
emit = False
+
+ kwargs.update({'phy_cores': kwas['phy_cores']*core_scale})
+
kwargs = filter_and_edit_kwargs_for_astf(suite_id, kwargs)
if emit and kwargs is not None:
file_out.write(testcase.generate(**kwargs))
@@ -347,7 +335,7 @@ def write_default_files(in_filename, in_prolog, kwargs_list):
with open(out_filename, "wt") as file_out:
file_out.write(out_prolog)
add_default_testcases(
- testcase, iface, suite_id, file_out, kwargs_list
+ testcase, nic_code, suite_id, file_out, kwargs_list
)
continue
for driver in Constants.NIC_NAME_TO_DRIVER[nic_name]:
@@ -396,7 +384,7 @@ def write_default_files(in_filename, in_prolog, kwargs_list):
with open(out_filename, "wt") as file_out:
file_out.write(out_prolog)
add_default_testcases(
- testcase, iface, suite_id, file_out, kwargs_list
+ testcase, nic_code, suite_id, file_out, kwargs_list
)
diff --git a/resources/libraries/python/model/ExportJson.py b/resources/libraries/python/model/ExportJson.py
index 843949eb9f..3f923d6d0e 100644
--- a/resources/libraries/python/model/ExportJson.py
+++ b/resources/libraries/python/model/ExportJson.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:
@@ -301,25 +301,18 @@ class ExportJson():
self.data["test_id"] = f"{suite_part}.{test_part}"
tags = self.data["tags"]
# Test name does not contain thread count.
- subparts = test_part.split("c-", 1)
- if len(subparts) < 2 or subparts[0][-2:-1] != "-":
+ subparts = test_part.split("-")
+ if any("tg" in s for s in subparts) and subparts[1] == "":
# Physical core count not detected, assume it is a TRex test.
if "--" not in test_part:
- raise RuntimeError(f"Cores not found for {subparts}")
+ raise RuntimeError(f"Invalid TG test name for: {subparts}")
short_name = test_part.split("--", 1)[1]
else:
- short_name = subparts[1]
+ short_name = "-".join(subparts[2:])
# Add threads to test_part.
- core_part = subparts[0][-1] + "c"
- for tag in tags:
- tag = tag.lower()
- if len(tag) == 4 and core_part == tag[2:] and tag[1] == "t":
- test_part = test_part.replace(f"-{core_part}-", f"-{tag}-")
- break
- else:
- raise RuntimeError(
- f"Threads not found for {test_part} tags {tags}"
- )
+ core_part = subparts[1]
+ tag = list(filter(lambda t: subparts[1].upper() in t, tags))[0]
+ test_part = test_part.replace(f"-{core_part}-", f"-{tag.lower()}-")
# For long name we need NIC model, which is only in suite name.
last_suite_part = suite_part.split(".")[-1]
# Short name happens to be the suffix we want to ignore.