summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfmenguy <francoisregis.menguy@orange.com>2019-06-28 14:29:38 +0200
committerfmenguy <francoisregis.menguy@orange.com>2019-07-01 09:53:01 +0200
commit09252752f7dc65af155146981c65bc1a5d23195f (patch)
tree699b2fc31ff4be5956f0e536bae0950c06a5bcb0
parent108a9f65ed0792ccb427e081ef3068002443983e (diff)
NFVBENCH-139 Fix master_thread_id and latency_thread_id property checking
Change-Id: Ifdfa1d3fbdd3c5f0206870dd91860254a114967a Signed-off-by: fmenguy <francoisregis.menguy@orange.com>
-rw-r--r--nfvbench/traffic_server.py31
1 files changed, 15 insertions, 16 deletions
diff --git a/nfvbench/traffic_server.py b/nfvbench/traffic_server.py
index dd36074..8a8ddba 100644
--- a/nfvbench/traffic_server.py
+++ b/nfvbench/traffic_server.py
@@ -94,30 +94,29 @@ class TRexTrafficServer(TrafficServer):
prefix=generator_config.name,
limit_memory=generator_config.limit_memory,
ifs=ifs)
- if hasattr(generator_config, 'platform'):
- if generator_config.platform.master_thread_id \
- and generator_config.platform.latency_thread_id:
- platform = """
+ try:
+ platform = """
platform :
master_thread_id : {master_thread_id}
latency_thread_id : {latency_thread_id}
dual_if:""".format(master_thread_id=generator_config.platform.master_thread_id,
latency_thread_id=generator_config.platform.latency_thread_id)
- result += platform
+ result += platform
- for core in generator_config.platform.dual_if:
- threads = ""
- try:
- threads = ",".join([repr(thread) for thread in core.threads])
- except TypeError:
- LOG.warn("No threads defined for socket %s", core.socket)
- core_result = """
+ for core in generator_config.platform.dual_if:
+ threads = ""
+ try:
+ threads = ",".join([repr(thread) for thread in core.threads])
+ except TypeError:
+ LOG.warn("No threads defined for socket %s", core.socket)
+ core_result = """
- socket : {socket}
threads : [{threads}]""".format(socket=core.socket, threads=threads)
- result += core_result
- else:
- LOG.info("Generator profile 'platform' sub-properties are set but not filled in \
- config file. TRex will use default values.")
+ result += core_result
+ except (KeyError, AttributeError):
+ LOG.info(
+ "Generator profile 'platform' sub-properties are set but not filled in config file.\
+ TRex will use default values.")
return result
def check_config_updated(self, generator_config):