aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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))