aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfmenguy <francoisregis.menguy@orange.com>2019-07-15 14:15:53 +0200
committerfmenguy <francoisregis.menguy@orange.com>2019-07-15 17:44:49 +0200
commit4de46e2e5b3dcad95a6d9122e8b910b977eda85c (patch)
tree1401b0a98f7101c213ec7d3527121aab456488a4
parent4ddc4d367bb5484906eada4f21260efed4fdf1a7 (diff)
NFVBENCH-144 Trex cannot take account NFVBench config (platform thread id 0)
Change-Id: I9f9891dcc2dd446068ba577322680216f03cac35 Signed-off-by: fmenguy <francoisregis.menguy@orange.com>
-rw-r--r--nfvbench/traffic_server.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/nfvbench/traffic_server.py b/nfvbench/traffic_server.py
index 94e5694..4dc7dce 100644
--- a/nfvbench/traffic_server.py
+++ b/nfvbench/traffic_server.py
@@ -97,11 +97,10 @@ class TRexTrafficServer(TrafficServer):
prefix=generator_config.name,
limit_memory=generator_config.limit_memory,
ifs=ifs)
- if generator_config.platform.master_thread_id and \
- generator_config.platform.latency_thread_id:
+ if self.__check_platform_config(generator_config):
try:
platform = """
- 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,
@@ -122,6 +121,13 @@ class TRexTrafficServer(TrafficServer):
pass
return result
+ def __check_platform_config(self, generator_config):
+ return hasattr(generator_config, 'platform') \
+ and hasattr(generator_config.platform, "master_thread_id") \
+ and generator_config.platform.master_thread_id is not None \
+ and hasattr(generator_config.platform, "latency_thread_id") \
+ and generator_config.platform.latency_thread_id is not None
+
def check_config_updated(self, generator_config):
existing_config = self.__load_config(filename='/etc/trex_cfg.yaml')
new_config = yaml.safe_load(self.__prepare_config(generator_config))