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
Class to define the test defaults
"""
test_params = {
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
'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
while True:
ip_key = 'dp_ip{}'.format(index)
mac_key = 'dp_mac{}'.format(index)
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
self.dp_ports.append(dict(dp_port))
self.dpdk_port_index.append(index - 1)
index += 1
PROXConfigfile = open (self.machine_params['config_file'], 'r')
PROXConfig = PROXConfigfile.read()
PROXConfigfile.close()
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'])
def get_cores(self):
return (self.machine_params['cores'])
def read_cpuset(self):
"""Read list of cpus on which we allowed to execute
"""
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()
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)
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]
# 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
def remap_cpus(self, cpus):
"""Convert relative cpu ids provided as function parameter to match
if 'mcore' in self.machine_params.keys():
cpus_remapped = self.remap_cpus(self.machine_params['mcore'])
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'])
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):
self.machine_params['cores'] = cpus_remapped
def devbind(self):
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('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():
else:
LuaFile.write("eal=\"\"\n")
if 'mcore' in self.machine_params.keys():
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))
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):
if 'gw_vm' in self.machine_params.keys():
for index, gw_ip in enumerate(self.machine_params['gw_ips'],
start = 1):
while True:
dp_ip_key = 'dp_ip{}'.format(index)
dp_mac_key = 'dp_mac{}'.format(index)
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:
dp_ports.append(dict(dp_port))
index += 1
else: