summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorahothan <ahothan@cisco.com>2019-07-13 21:26:20 -0700
committerahothan <ahothan@cisco.com>2019-07-13 21:27:00 -0700
commit547b10033d41b2b9f8445816fceab87ebc4a03cb (patch)
treefdf6f06d23abc660cb7ed04f5a7e747d90f51d7f
parentc1079b7ef2495f1907a5010d59dcec98744275d0 (diff)
NFVBENCH-143 Trex cannot start due to invalid config (platform None)
Change-Id: I8ada6076c62b449b8964f00cd52facea3736fa28 Signed-off-by: ahothan <ahothan@cisco.com>
-rw-r--r--nfvbench/traffic_server.py47
1 files changed, 24 insertions, 23 deletions
diff --git a/nfvbench/traffic_server.py b/nfvbench/traffic_server.py
index 8a8ddba..ac23265 100644
--- a/nfvbench/traffic_server.py
+++ b/nfvbench/traffic_server.py
@@ -52,13 +52,14 @@ class TRexTrafficServer(TrafficServer):
# --unbind-unused-ports: for NIC that have more than 2 ports such as Intel X710
# this will instruct trex to unbind all ports that are unused instead of
# erroring out with an exception (i40e only)
- subprocess.Popen(['nohup', '/bin/bash', '-c',
- './t-rex-64 -i -c {} --iom 0 --no-scapy-server '
- '--unbind-unused-ports --close-at-end {} '
- '{} {} --cfg {} &> /tmp/trex.log & disown'.format(cores, sw_mode,
- vlan_opt,
- mbuf_opt, cfg)],
- cwd=self.trex_dir)
+ cmd = ['nohup', '/bin/bash', '-c',
+ './t-rex-64 -i -c {} --iom 0 --no-scapy-server '
+ '--unbind-unused-ports --close-at-end {} '
+ '{} {} --cfg {} &> /tmp/trex.log & disown'.format(cores, sw_mode,
+ vlan_opt,
+ mbuf_opt, cfg)]
+ LOG.info(' '.join(cmd))
+ subprocess.Popen(cmd, cwd=self.trex_dir)
LOG.info('TRex server is running...')
def __load_config(self, filename):
@@ -94,29 +95,29 @@ class TRexTrafficServer(TrafficServer):
prefix=generator_config.name,
limit_memory=generator_config.limit_memory,
ifs=ifs)
- try:
- platform = """
- platform :
+ if generator_config.platform.master_thread_id and \
+ generator_config.platform.latency_thread_id:
+ 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
- except (KeyError, AttributeError):
- 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):
+ pass
return result
def check_config_updated(self, generator_config):