aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2023-10-26 12:34:10 +0000
committerPeter Mikus <peter.mikus@protonmail.ch>2023-11-03 13:26:43 +0000
commit89cff3cb43f10355022115396a65f491bf3f8404 (patch)
tree2340cf6ea44670c9fadbc7389c2b248952bd937a /resources/libraries/python
parent30ac3eb3d8e508f80445936a218deaa3c9dc0e84 (diff)
feat(tests): 6p3nic ip4 testsoper-231106
Signed-off-by: Peter Mikus <peter.mikus@protonmail.ch> Change-Id: I69ee305b25b9e05d2305cb82aba71ef6418780ab
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/Constants.py73
-rw-r--r--resources/libraries/python/IPTopology.py8
-rw-r--r--resources/libraries/python/TrafficGenerator.py8
-rw-r--r--resources/libraries/python/autogen/Regenerator.py28
4 files changed, 83 insertions, 34 deletions
diff --git a/resources/libraries/python/Constants.py b/resources/libraries/python/Constants.py
index 3240a0a33e..c7a4a1f5b4 100644
--- a/resources/libraries/python/Constants.py
+++ b/resources/libraries/python/Constants.py
@@ -352,37 +352,39 @@ class Constants:
# Suite file names use codes for NICs.
NIC_NAME_TO_CODE = {
- u"Intel-X520-DA2": u"10ge2p1x520",
- u"Intel-X710": u"10ge2p1x710",
- u"Intel-XL710": u"40ge2p1xl710",
- u"Intel-XXV710": u"25ge2p1xxv710",
- u"Intel-E810XXV": u"25ge2p1e810xxv",
- u"Intel-E822CQ": u"25ge2p1e822cq",
- u"Intel-E810CQ": u"100ge2p1e810cq",
- u"Amazon-Nitro-50G": u"50ge1p1ena",
- u"Amazon-Nitro-100G": u"100ge1p1ena",
- u"Amazon-Nitro-200G": u"200ge1p1ena",
- u"Mellanox-CX556A": u"100ge2p1cx556a",
- u"Mellanox-CX6DX": u"100ge2p1cx6dx",
- u"Mellanox-CX7VEAT": u"200ge2p1cx7veat",
+ "Intel-X520-DA2": "10ge2p1x520",
+ "Intel-X710": "10ge2p1x710",
+ "Intel-XL710": "40ge2p1xl710",
+ "Intel-XXV710": "25ge2p1xxv710",
+ "Intel-E810XXV": "25ge2p1e810xxv",
+ "Intel-E822CQ": "25ge2p1e822cq",
+ "Intel-E810CQ": "100ge2p1e810cq",
+ "Amazon-Nitro-50G": "50ge1p1ena",
+ "Amazon-Nitro-100G": "100ge1p1ena",
+ "Amazon-Nitro-200G": "200ge1p1ena",
+ "Mellanox-CX556A": "100ge2p1cx556a",
+ "Mellanox-CX6DX": "100ge2p1cx6dx",
+ "Mellanox-CX7VEAT": "200ge2p1cx7veat",
+ "Mellanox-CX7VEAT": "200ge6p3cx7veat",
"virtual": "1ge1p82540em",
}
# Shortened lowercase NIC model name, useful for presentation.
NIC_CODE_TO_SHORT_NAME = {
- u"10ge2p1x520": u"x520",
- u"10ge2p1x710": u"x710",
- u"40ge2p1xl710": u"xl710",
- u"25ge2p1xxv710": u"xxv710",
- u"25ge2p1e810xxv": u"e810xxv",
- u"25ge2p1e822cq": u"e822cq",
- u"100ge2p1e810cq": u"e810cq",
- u"50ge1p1ena": u"ena",
- u"100ge1p1ena": u"ena100",
- u"200ge1p1ena": u"ena200",
- u"100ge2p1cx556a": u"cx556a",
- u"100ge2p1cx6dx": u"cx6dx",
- u"200ge2p1cx7veat": u"cx7veat",
+ "10ge2p1x520": "x520",
+ "10ge2p1x710": "x710",
+ "40ge2p1xl710": "xl710",
+ "25ge2p1xxv710": "xxv710",
+ "25ge2p1e810xxv": "e810xxv",
+ "25ge2p1e822cq": "e822cq",
+ "100ge2p1e810cq": "e810cq",
+ "50ge1p1ena": "ena",
+ "100ge1p1ena": "ena100",
+ "200ge1p1ena": "ena200",
+ "100ge2p1cx556a": "cx556a",
+ "100ge2p1cx6dx": "cx6dx",
+ "200ge2p1cx7veat": "cx7veat",
+ "200ge6p3cx7veat": "cx7veat",
"1ge1p82540em": "8250em",
}
@@ -441,6 +443,25 @@ class Constants:
u"af_xdp": u"nic_vfs}= | 0",
}
+ # 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",
+ "25ge2p1e810xxv": "nic_pfs}= | 2",
+ "25ge2p1e822cq": "nic_pfs}= | 2",
+ "100ge2p1e810cq": "nic_pfs}= | 2",
+ "50ge1p1ena": "nic_pfs}= | 2",
+ "100ge1p1ena": "nic_pfs}= | 2",
+ "200ge1p1ena": "nic_pfs}= | 2",
+ "100ge2p1cx556a": "nic_pfs}= | 2",
+ "100ge2p1cx6dx": "nic_pfs}= | 2",
+ "200ge2p1cx7veat": "nic_pfs}= | 2",
+ "200ge6p3cx7veat": "nic_pfs}= | 6",
+ "1ge1p82540em": "nic_pfs}= | 2",
+ }
+
# Not each driver is supported by each NIC.
DPDK_NIC_NAME_TO_DRIVER = {
u"Intel-X520-DA2": [u"vfio-pci"],
diff --git a/resources/libraries/python/IPTopology.py b/resources/libraries/python/IPTopology.py
index bc2f5f13a7..6255583110 100644
--- a/resources/libraries/python/IPTopology.py
+++ b/resources/libraries/python/IPTopology.py
@@ -22,21 +22,21 @@ class IPTopology:
"""IP Topology Library."""
@staticmethod
- def initialize_ipv4_forwarding(count=1, parallel_links=1):
+ def initialize_ipv4_forwarding(count=1, pfs=2):
"""
Custom setup of IPv4 forwarding with scalability of IP routes on all
DUT nodes in 2-node / 3-node circular topology.
:param count: Number of routes to configure.
- :param parallel_links: Number of parallel links to configure.
+ :param pfs: Number of physical interfaces to configure.
:type count: int
- :type parallel_links: int
+ :type pfs: int
"""
topology = BuiltIn().get_variable_value("&{topology_info}")
dut = topology["duts"][-1]
ifl = BuiltIn().get_variable_value("${int}")
- for l, i in zip(range(parallel_links), range(1, parallel_links*2, 2)):
+ for l, i in zip(range(pfs // 2), range(1, pfs, 2)):
dut1_int1 = BuiltIn().get_variable_value(f"${{DUT1_{ifl}{i}}}[0]")
dut1_int2 = BuiltIn().get_variable_value(f"${{DUT1_{ifl}{i+1}}}[0]")
dut_int1 = BuiltIn().get_variable_value(f"${{{dut}_{ifl}{i}}}[0]")
diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py
index 7c6c859448..936cb3a06d 100644
--- a/resources/libraries/python/TrafficGenerator.py
+++ b/resources/libraries/python/TrafficGenerator.py
@@ -281,13 +281,13 @@ class TrafficGenerator(AbstractMeasurer):
return stdout.strip()
return "none"
- def initialize_traffic_generator(self, osi_layer, parallel_links=1):
+ def initialize_traffic_generator(self, osi_layer, pfs=2):
"""TG initialization.
:param osi_layer: 'L2', 'L3' or 'L7' - OSI Layer testing type.
- :param parallel_links: Number of parallel links to configure.
+ :param pfs: Number of physical interfaces to configure.
:type osi_layer: str
- :type parallel_links: int
+ :type pfs: int
:raises ValueError: If OSI layer is unknown.
"""
if osi_layer not in ("L2", "L3", "L7"):
@@ -301,7 +301,7 @@ class TrafficGenerator(AbstractMeasurer):
trex_topology = list()
self._mode = TrexMode.ASTF if osi_layer == "L7" else TrexMode.STL
- for link in range(1, parallel_links*2, 2):
+ 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():
diff --git a/resources/libraries/python/autogen/Regenerator.py b/resources/libraries/python/autogen/Regenerator.py
index 47e5b9fe86..2e81587c96 100644
--- a/resources/libraries/python/autogen/Regenerator.py
+++ b/resources/libraries/python/autogen/Regenerator.py
@@ -351,6 +351,7 @@ def write_default_files(in_filename, in_prolog, kwargs_list):
)
continue
for driver in Constants.NIC_NAME_TO_DRIVER[nic_name]:
+ nic_code = Constants.NIC_NAME_TO_CODE[nic_name]
out_filename = replace_defensively(
tmp2_filename, old_suite_id,
Constants.NIC_DRIVER_TO_SUITE_PREFIX[driver] + old_suite_id,
@@ -375,6 +376,12 @@ def write_default_files(in_filename, in_prolog, kwargs_list):
Constants.NIC_DRIVER_TO_VFS[driver], 1,
u"NIC VFs argument should appear once.", in_filename
)
+ out_prolog = replace_defensively(
+ out_prolog, Constants.NIC_CODE_TO_PFS["10ge2p1x710"],
+ Constants.NIC_CODE_TO_PFS[nic_code], 1,
+ "NIC PFs argument should appear once.", in_filename
+ )
+
iface, suite_id, suite_tag = get_iface_and_suite_ids(
out_filename
)
@@ -435,6 +442,7 @@ def write_reconf_files(in_filename, in_prolog, kwargs_list):
tmp_filename
)
for driver in Constants.NIC_NAME_TO_DRIVER[nic_name]:
+ nic_code = Constants.NIC_NAME_TO_CODE[nic_name]
out_filename = replace_defensively(
tmp_filename, old_suite_id,
Constants.NIC_DRIVER_TO_SUITE_PREFIX[driver] + old_suite_id,
@@ -459,6 +467,12 @@ def write_reconf_files(in_filename, in_prolog, kwargs_list):
Constants.NIC_DRIVER_TO_VFS[driver], 1,
u"NIC VFs argument should appear once.", in_filename
)
+ out_prolog = replace_defensively(
+ out_prolog, Constants.NIC_CODE_TO_PFS["10ge2p1x710"],
+ Constants.NIC_CODE_TO_PFS[nic_code], 1,
+ "NIC PFs argument should appear once.", in_filename
+ )
+
iface, suite_id, suite_tag = get_iface_and_suite_ids(out_filename)
out_prolog = replace_defensively(
out_prolog, old_suite_tag, suite_tag, 1,
@@ -502,6 +516,7 @@ def write_tcp_files(in_filename, in_prolog, kwargs_list):
tmp_filename
)
for driver in Constants.NIC_NAME_TO_DRIVER[nic_name]:
+ nic_code = Constants.NIC_NAME_TO_CODE[nic_name]
out_filename = replace_defensively(
tmp_filename, old_suite_id,
Constants.NIC_DRIVER_TO_SUITE_PREFIX[driver] + old_suite_id,
@@ -526,6 +541,12 @@ def write_tcp_files(in_filename, in_prolog, kwargs_list):
Constants.NIC_DRIVER_TO_VFS[driver], 1,
u"NIC VFs argument should appear once.", in_filename
)
+ out_prolog = replace_defensively(
+ out_prolog, Constants.NIC_CODE_TO_PFS["10ge2p1x710"],
+ Constants.NIC_CODE_TO_PFS[nic_code], 1,
+ "NIC PFs argument should appear once.", in_filename
+ )
+
iface, suite_id, suite_tag = get_iface_and_suite_ids(out_filename)
out_prolog = replace_defensively(
out_prolog, old_suite_tag, suite_tag, 1,
@@ -657,6 +678,7 @@ def write_device_files(in_filename, in_prolog, kwargs_list):
tmp2_filename
)
for driver in Constants.NIC_NAME_TO_DRIVER[nic_name]:
+ nic_code = Constants.NIC_NAME_TO_CODE[nic_name]
out_filename = replace_defensively(
tmp2_filename, old_suite_id,
Constants.NIC_DRIVER_TO_SUITE_PREFIX[driver] + old_suite_id,
@@ -681,6 +703,12 @@ def write_device_files(in_filename, in_prolog, kwargs_list):
Constants.NIC_DRIVER_TO_VFS[driver], 1,
u"NIC VFs argument should appear once.", in_filename
)
+ out_prolog = replace_defensively(
+ out_prolog, Constants.NIC_CODE_TO_PFS["10ge2p1x710"],
+ Constants.NIC_CODE_TO_PFS[nic_code], 1,
+ "NIC PFs argument should appear once.", in_filename
+ )
+
iface, suite_id, suite_tag = get_iface_and_suite_ids(
out_filename
)