summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/helper-scripts/rapid
diff options
context:
space:
mode:
authorLuc Provoost <luc.provoost@gmail.com>2024-11-10 12:02:46 +0100
committerLuc Provoost <luc.provoost@gmail.com>2024-11-10 12:02:46 +0100
commitdd2399bf6189c351e11dfe3844ab84c630e25b94 (patch)
tree2fe02d138375a2ed368250525d026a71084099d4 /VNFs/DPPD-PROX/helper-scripts/rapid
parentbdb77aef893a9b7a420e2ce08676d7a4e657046f (diff)
simplify core parameter parsing
Simplified some of the code to deal with the differrent core options Signed-off-by: Luc Provoost <luc.provoost@gmail.com> Change-Id: I4f33563b51370efe807e8ace807acc3fdcd2bfc4
Diffstat (limited to 'VNFs/DPPD-PROX/helper-scripts/rapid')
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py7
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py35
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py3
3 files changed, 13 insertions, 32 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py
index e52b17db..fc2d86d9 100644
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py
@@ -103,12 +103,7 @@ class RapidGeneratorMachine(RapidMachine):
self.machine_params['latcores'] = cpus_remapped
def generate_lua(self):
- appendix = 'gencores="%s"\n'% ','.join(map(str,
- self.machine_params['gencores']))
- appendix = appendix + 'latcores="%s"\n'% ','.join(map(str,
- self.machine_params['latcores']))
- appendix = (appendix +
- 'bucket_size_exp="{}"\n'.format(self.bucket_size_exp))
+ appendix = 'bucket_size_exp="{}"\n'.format(self.bucket_size_exp)
if 'heartbeat' in self.machine_params.keys():
appendix = (appendix +
'heartbeat="%s"\n'% self.machine_params['heartbeat'])
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
index b95f4ff8..048895c1 100644
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
@@ -121,21 +121,12 @@ class RapidMachine(object):
if self.cpu_mapping is None:
RapidLog.debug('{} ({}): cpu mapping is not defined! Please check the configuration!'.format(self.name, self.ip))
return
-
- 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))
- 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))
- self.machine_params['cores'] = cpus_remapped
-
- if 'altcores' in self.machine_params.keys():
- cpus_remapped = self.remap_cpus(self.machine_params['altcores'])
- RapidLog.debug('{} ({}): altcores {} remapped to {}'.format(self.name, self.ip, self.machine_params['altcores'], cpus_remapped))
- self.machine_params['altcores'] = cpus_remapped
+ for key in self.machine_params.keys():
+ if 'core' in key:
+ cpus_remapped = self.remap_cpus(self.machine_params[key])
+ RapidLog.debug('{} ({}): {} {} remapped to {}'.format(self.name, self.ip, key, self.machine_params[key], cpus_remapped))
+ self.machine_params[key] = cpus_remapped
+ return
def devbind(self):
# Script to bind the right network interface to the poll mode driver
@@ -180,15 +171,11 @@ class RapidMachine(object):
LuaFile.write(eal_line)
else:
LuaFile.write("eal=\"\"\n")
- if 'mcore' in self.machine_params.keys():
- LuaFile.write('mcore="%s"\n'% ','.join(map(str,
- self.machine_params['mcore'])))
- if 'cores' in self.machine_params.keys():
- LuaFile.write('cores="%s"\n'% ','.join(map(str,
- self.machine_params['cores'])))
- if 'altcores' in self.machine_params.keys():
- LuaFile.write('altcores="%s"\n'% ','.join(map(str,
- self.machine_params['altcores'])))
+ for key in self.machine_params.keys():
+ if 'core' in key:
+ cores = ','.join(map(str,self.machine_params[key]))
+ cores = (f'"{cores}"')
+ LuaFile.write('{}={}\n'.format(key,cores))
if 'ports' in self.machine_params.keys():
LuaFile.write('ports="%s"\n'% ','.join(map(str,
self.machine_params['ports'])))
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py
index 85834796..74c2c9f4 100644
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py
@@ -137,8 +137,7 @@ class RapidConfigParser(object):
for option in options:
if option in ['prox_socket','prox_launch_exit','monitor']:
machine[option] = testconfig.getboolean(section, option)
- elif option in ['mcore', 'cores', 'gencores', 'latcores',
- 'altcores']:
+ elif 'core' in option:
machine[option] = ast.literal_eval(testconfig.get(
section, option))
elif option in ['bucket_size_exp']: