summaryrefslogtreecommitdiffstats
path: root/VNFs
diff options
context:
space:
mode:
authorLuc Provoost <luc.provoost@gmail.com>2023-01-09 15:07:59 +0100
committerLuc Provoost <luc.provoost@gmail.com>2023-01-09 15:07:59 +0100
commit20150da55eed2634cda771d8e481b76590c90b75 (patch)
tree31f00ae49224d3e4942c2e6cadbf9527e3566945 /VNFs
parentaacbf08a9f7d286e65f70d7beba3ec1108c0ddef (diff)
Optional MAC address and other changes
The MAC address of the dataplane interfaces in the environment file is now optional. If not specified, the HW MAC address of that interface will be used. When using l2 tests, the parameter will be needed anyway and the test will fail if the MAC address is not specified. Starting from DPDK 20.11, the EAL --pci-whitelist parameter changed into --allow. We are now checking the DPDK version of the PROX instance to determine which parameter to use. For pods using cgroup v2, we are now using a different file to determine the cpuset available to the pod. Signed-off-by: Luc Provoost <luc.provoost@gmail.com> Change-Id: I7a88458406b9ae3c8cae9c583cc37121d40c5073
Diffstat (limited to 'VNFs')
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/rapid/rapid_defaults.py2
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py53
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py11
3 files changed, 50 insertions, 16 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_defaults.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_defaults.py
index b56fbe1d..6fe86848 100644
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_defaults.py
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_defaults.py
@@ -21,7 +21,7 @@ class RapidDefaults(object):
Class to define the test defaults
"""
test_params = {
- 'version' : '2021.03.15', # Please do NOT change, used for debugging
+ 'version' : '2023.01.09', # Please do NOT change, used for debugging
'environment_file' : 'rapid.env', #Default string for environment
'test_file' : 'tests/basicrapid.test', #Default string for test
'machine_map_file' : 'machine.map', #Default string for machine map file
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
index f7871dc1..352561d0 100644
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
@@ -41,8 +41,12 @@ class RapidMachine(object):
while True:
ip_key = 'dp_ip{}'.format(index)
mac_key = 'dp_mac{}'.format(index)
- if ip_key in machine_params.keys() and mac_key in machine_params.keys():
- dp_port = {'ip': machine_params[ip_key], 'mac' : machine_params[mac_key]}
+ if ip_key in machine_params.keys():
+ if mac_key in machine_params.keys():
+ dp_port = {'ip': machine_params[ip_key],
+ 'mac' : machine_params[mac_key]}
+ else:
+ dp_port = {'ip': machine_params[ip_key], 'mac' : None}
self.dp_ports.append(dict(dp_port))
self.dpdk_port_index.append(index - 1)
index += 1
@@ -55,7 +59,8 @@ class RapidMachine(object):
PROXConfigfile = open (self.machine_params['config_file'], 'r')
PROXConfig = PROXConfigfile.read()
PROXConfigfile.close()
- self.all_tasks_for_this_cfg = set(re.findall("task\s*=\s*(\d+)",PROXConfig))
+ self.all_tasks_for_this_cfg = set(re.findall("task\s*=\s*(\d+)",
+ PROXConfig))
def get_cores(self):
return (self.machine_params['cores'])
@@ -77,18 +82,31 @@ class RapidMachine(object):
def read_cpuset(self):
"""Read list of cpus on which we allowed to execute
"""
- cmd = 'cat /sys/fs/cgroup/cpuset/cpuset.cpus'
+ cpu_set_file = '/sys/fs/cgroup/cpuset.cpus'
+ cmd = 'test -e {0} && echo exists'.format(cpu_set_file)
+ if (self._client.run_cmd(cmd).decode().rstrip()):
+ cmd = 'cat {}'.format(cpu_set_file)
+ else:
+ cpu_set_file = '/sys/fs/cgroup/cpuset/cpuset.cpus'
+ cmd = 'test -e {0} && echo exists'.format(cpu_set_file)
+ if (self._client.run_cmd(cmd).decode().rstrip()):
+ cmd = 'cat {}'.format(cpu_set_file)
+ else:
+ RapidLog.critical('{Cannot determine cpuset')
cpuset_cpus = self._client.run_cmd(cmd).decode().rstrip()
- RapidLog.debug('{} ({}): Allocated cpuset: {}'.format(self.name, self.ip, cpuset_cpus))
+ RapidLog.debug('{} ({}): Allocated cpuset: {}'.format(self.name,
+ self.ip, cpuset_cpus))
self.cpu_mapping = self.expand_list_format(cpuset_cpus)
- RapidLog.debug('{} ({}): Expanded cpuset: {}'.format(self.name, self.ip, self.cpu_mapping))
+ RapidLog.debug('{} ({}): Expanded cpuset: {}'.format(self.name,
+ self.ip, self.cpu_mapping))
# Log CPU core mapping for user information
cpu_mapping_str = ''
for i in range(len(self.cpu_mapping)):
cpu_mapping_str = cpu_mapping_str + '[' + str(i) + '->' + str(self.cpu_mapping[i]) + '], '
cpu_mapping_str = cpu_mapping_str[:-2]
- RapidLog.debug('{} ({}): CPU mapping: {}'.format(self.name, self.ip, cpu_mapping_str))
+ RapidLog.debug('{} ({}): CPU mapping: {}'.format(self.name, self.ip,
+ cpu_mapping_str))
def remap_cpus(self, cpus):
"""Convert relative cpu ids provided as function parameter to match
@@ -108,12 +126,14 @@ class RapidMachine(object):
if 'mcore' in self.machine_params.keys():
cpus_remapped = self.remap_cpus(self.machine_params['mcore'])
- RapidLog.debug('{} ({}): mcore {} remapped to {}'.format(self.name, self.ip, self.machine_params['mcore'], cpus_remapped))
+ RapidLog.debug('{} ({}): mcore {} remapped to {}'.format(self.name,
+ self.ip, self.machine_params['mcore'], cpus_remapped))
self.machine_params['mcore'] = cpus_remapped
if 'cores' in self.machine_params.keys():
cpus_remapped = self.remap_cpus(self.machine_params['cores'])
- RapidLog.debug('{} ({}): cores {} remapped to {}'.format(self.name, self.ip, self.machine_params['cores'], cpus_remapped))
+ RapidLog.debug('{} ({}): cores {} remapped to {}'.format(self.name,
+ self.ip, self.machine_params['cores'], cpus_remapped))
self.machine_params['cores'] = cpus_remapped
def devbind(self):
@@ -137,7 +157,16 @@ class RapidMachine(object):
LuaFile.write('local_ip{}="{}"\n'.format(index, dp_port['ip']))
LuaFile.write('local_hex_ip{}=convertIPToHex(local_ip{})\n'.format(index, index))
if self.vim in ['kubernetes']:
- LuaFile.write("eal=\"--file-prefix %s --pci-whitelist %s\"\n" % (self.name, self.machine_params['dp_pci_dev']))
+ cmd = 'pkg-config --modversion libdpdk'
+ dpdk_version = self._client.run_cmd(cmd).decode().rstrip()
+ if (dpdk_version >= '20.11.0'):
+ allow_parameter = 'allow'
+ else:
+ allow_parameter = 'pci-whitelist'
+ eal_line = 'eal=\"--file-prefix {} --{} {}\"\n'.format(
+ self.name, allow_parameter,
+ self.machine_params['dp_pci_dev'])
+ LuaFile.write(eal_line)
else:
LuaFile.write("eal=\"\"\n")
if 'mcore' in self.machine_params.keys():
@@ -150,7 +179,9 @@ class RapidMachine(object):
for index, dest_port in enumerate(self.machine_params['dest_ports'], start = 1):
LuaFile.write('dest_ip{}="{}"\n'.format(index, dest_port['ip']))
LuaFile.write('dest_hex_ip{}=convertIPToHex(dest_ip{})\n'.format(index, index))
- LuaFile.write('dest_hex_mac{}="{}"\n'.format(index , dest_port['mac'].replace(':',' ')))
+ if dest_port['mac']:
+ LuaFile.write('dest_hex_mac{}="{}"\n'.format(index,
+ dest_port['mac'].replace(':',' ')))
if 'gw_vm' in self.machine_params.keys():
for index, gw_ip in enumerate(self.machine_params['gw_ips'],
start = 1):
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py
index ee8fa67f..1a82671a 100644
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py
@@ -170,10 +170,13 @@ class RapidConfigParser(object):
while True:
dp_ip_key = 'dp_ip{}'.format(index)
dp_mac_key = 'dp_mac{}'.format(index)
- if dp_ip_key in machines[int(machine['dest_vm'])-1].keys() and \
- dp_mac_key in machines[int(machine['dest_vm'])-1].keys():
- dp_port = {'ip': machines[int(machine['dest_vm'])-1][dp_ip_key],
- 'mac' : machines[int(machine['dest_vm'])-1][dp_mac_key]}
+ if dp_ip_key in machines[int(machine['dest_vm'])-1].keys():
+ if dp_mac_key in machines[int(machine['dest_vm'])-1].keys():
+ dp_port = {'ip': machines[int(machine['dest_vm'])-1][dp_ip_key],
+ 'mac' : machines[int(machine['dest_vm'])-1][dp_mac_key]}
+ else:
+ dp_port = {'ip': machines[int(machine['dest_vm'])-1][dp_ip_key],
+ 'mac' : None}
dp_ports.append(dict(dp_port))
index += 1
else: