summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/automation/regression/trex.py1
-rwxr-xr-xscripts/automation/regression/trex_unit_test.py12
-rwxr-xr-xscripts/automation/trex_control_plane/server/trex_server.py9
-rwxr-xr-xscripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py7
-rw-r--r--src/main_dpdk.cpp4
-rw-r--r--src/rpc-server/trex_rpc_req_resp_server.cpp13
6 files changed, 29 insertions, 17 deletions
diff --git a/scripts/automation/regression/trex.py b/scripts/automation/regression/trex.py
index 9541ad76..44f2faba 100644
--- a/scripts/automation/regression/trex.py
+++ b/scripts/automation/regression/trex.py
@@ -39,6 +39,7 @@ class CTRexScenario:
GAManager = None
no_daemon = False
router_image = None
+ debug_image = False
class CTRexRunner:
"""This is an instance for generating a CTRexRunner"""
diff --git a/scripts/automation/regression/trex_unit_test.py b/scripts/automation/regression/trex_unit_test.py
index 5eb9e222..11902a1a 100755
--- a/scripts/automation/regression/trex_unit_test.py
+++ b/scripts/automation/regression/trex_unit_test.py
@@ -143,6 +143,9 @@ class CTRexTestConfiguringPlugin(Plugin):
parser.add_option('--no-daemon', action="store_true", default = False,
dest="no_daemon",
help="Flag that specifies to use running stl server, no need daemons.")
+ parser.add_option('--debug-image', action="store_true", default = False,
+ dest="debug_image",
+ help="Flag that specifies to use t-rex-64-debug as TRex executable.")
def configure(self, options, conf):
@@ -179,9 +182,11 @@ class CTRexTestConfiguringPlugin(Plugin):
CTRexScenario.benchmark = self.benchmark
CTRexScenario.modes = set(self.modes)
CTRexScenario.server_logs = self.server_logs
+ CTRexScenario.debug_image = options.debug_image
if not self.no_daemon:
- CTRexScenario.trex = CTRexClient(trex_host = self.configuration.trex['trex_name'],
- verbose = self.json_verbose)
+ CTRexScenario.trex = CTRexClient(trex_host = self.configuration.trex['trex_name'],
+ verbose = self.json_verbose,
+ debug_image = options.debug_image)
if not CTRexScenario.trex.check_master_connectivity():
print('Could not connect to master daemon')
sys.exit(-1)
@@ -267,6 +272,9 @@ def save_setup_info():
setup_info += 'Server: %s, Modes: %s' % (cfg.trex.get('trex_name'), cfg.trex.get('modes'))
if cfg.router:
setup_info += '\nRouter: Model: %s, Image: %s' % (cfg.router.get('model'), CTRexScenario.router_image)
+ if CTRexScenario.debug_image:
+ setup_info += '\nDebug image: %s' % CTRexScenario.debug_image
+
with open('%s/report_%s.info' % (CTRexScenario.report_dir, CTRexScenario.setup_name), 'w') as f:
f.write(setup_info)
except Exception as err:
diff --git a/scripts/automation/trex_control_plane/server/trex_server.py b/scripts/automation/trex_control_plane/server/trex_server.py
index 3da629ec..091b729b 100755
--- a/scripts/automation/trex_control_plane/server/trex_server.py
+++ b/scripts/automation/trex_control_plane/server/trex_server.py
@@ -310,7 +310,7 @@ class CTRexServer(object):
return False
- def start_trex(self, trex_cmd_options, user, block_to_success = True, timeout = 40, stateless = False):
+ def start_trex(self, trex_cmd_options, user, block_to_success = True, timeout = 40, stateless = False, debug_image = False):
with self.start_lock:
logger.info("Processing start_trex() command.")
if self.is_reserved():
@@ -323,7 +323,7 @@ class CTRexServer(object):
return Fault(-13, '') # raise at client TRexInUseError
try:
- server_cmd_data = self.generate_run_cmd(stateless = stateless, **trex_cmd_options)
+ server_cmd_data = self.generate_run_cmd(stateless = stateless, debug_image = debug_image, **trex_cmd_options)
self.zmq_monitor.first_dump = True
self.trex.start_trex(self.TREX_PATH, server_cmd_data)
logger.info("TRex session has been successfully initiated.")
@@ -413,7 +413,7 @@ class CTRexServer(object):
return self.trex.get_running_info()
- def generate_run_cmd (self, iom = 0, export_path="/tmp/trex.txt", stateless = False, **kwargs):
+ def generate_run_cmd (self, iom = 0, export_path="/tmp/trex.txt", stateless = False, debug_image = False, **kwargs):
""" generate_run_cmd(self, iom, export_path, kwargs) -> str
Generates a custom running command for the kick-off of the TRex traffic generator.
@@ -457,9 +457,10 @@ class CTRexServer(object):
if 'd' not in kwargs:
raise Exception('Argument -d should be specified in stateful command')
- cmd = "{nice}{run_command} --iom {io} {cmd_options} --no-key".format( # -- iom 0 disables the periodic log to the screen (not needed)
+ cmd = "{nice}{run_command}{debug_image} --iom {io} {cmd_options} --no-key".format( # -- iom 0 disables the periodic log to the screen (not needed)
nice = '' if self.trex_nice == 0 else 'nice -n %s ' % self.trex_nice,
run_command = self.TREX_START_CMD,
+ debug_image = '-debug' if debug_image else '',
cmd_options = trex_cmd_options,
io = iom)
diff --git a/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py b/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py
index e1b298db..91fe2075 100755
--- a/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py
+++ b/scripts/automation/trex_control_plane/stf/trex_stf_lib/trex_client.py
@@ -40,7 +40,7 @@ class CTRexClient(object):
This class defines the client side of the RESTfull interaction with TRex
"""
- def __init__(self, trex_host, max_history_size = 100, filtered_latency_amount = 0.001, trex_daemon_port = 8090, master_daemon_port = 8091, trex_zmq_port = 4500, verbose = False):
+ def __init__(self, trex_host, max_history_size = 100, filtered_latency_amount = 0.001, trex_daemon_port = 8090, master_daemon_port = 8091, trex_zmq_port = 4500, verbose = False, debug_image = False):
"""
Instantiate a TRex client object, and connecting it to listening daemon-server
@@ -96,6 +96,7 @@ class CTRexClient(object):
self.master_daemon = jsonrpclib.Server(self.master_daemon_path, history = self.history)
self.trex_server_path = "http://{hostname}:{port}/".format( hostname = self.trex_host, port = trex_daemon_port )
self.server = jsonrpclib.Server(self.trex_server_path, history = self.history)
+ self.debug_image = debug_image
def add (self, x, y):
@@ -159,7 +160,7 @@ class CTRexClient(object):
self.result_obj.clear_results()
try:
issue_time = time.time()
- retval = self.server.start_trex(trex_cmd_options, user, block_to_success, timeout)
+ retval = self.server.start_trex(trex_cmd_options, user, block_to_success, timeout, self.debug_image)
except AppError as err:
self._handle_AppError_exception(err.args[0])
except ProtocolError:
@@ -205,7 +206,7 @@ class CTRexClient(object):
"""
try:
user = user or self.__default_user
- retval = self.server.start_trex(trex_cmd_options, user, block_to_success, timeout, True)
+ retval = self.server.start_trex(trex_cmd_options, user, block_to_success, timeout, True, self.debug_image)
except AppError as err:
self._handle_AppError_exception(err.args[0])
except ProtocolError:
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index 8ae44b02..dcef2f38 100644
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -4777,8 +4777,8 @@ int main_test(int argc , char * argv[]){
}
/* disable WD if needed */
- //CGlobalInfo::m_options.preview.getWDDisable()?false:true
- TrexWatchDog::getInstance().init(true); /* always disable - due to trex-211 */
+ bool wd_enable = (CGlobalInfo::m_options.preview.getWDDisable() ? false : true);
+ TrexWatchDog::getInstance().init(wd_enable);
g_trex.m_sl_rx_running = false;
if ( get_is_stateless() ) {
diff --git a/src/rpc-server/trex_rpc_req_resp_server.cpp b/src/rpc-server/trex_rpc_req_resp_server.cpp
index 75eec856..e0e7635c 100644
--- a/src/rpc-server/trex_rpc_req_resp_server.cpp
+++ b/src/rpc-server/trex_rpc_req_resp_server.cpp
@@ -201,23 +201,24 @@ void TrexRpcServerReqRes::process_request_raw(const std::string &request, std::s
int index = 0;
- /* expcetion safe */
- std::unique_lock<std::mutex> lock(*m_lock);
-
/* for every command parsed - launch it */
for (auto command : commands) {
Json::Value single_response;
+ /* the command itself should be protected */
+ std::unique_lock<std::mutex> lock(*m_lock);
command->execute(single_response);
+ lock.unlock();
+
delete command;
response_json[index++] = single_response;
+ /* batch is like getting all the messages one by one - it should not be considered as stuck thread */
+ /* need to think if this is a good thing */
+ //m_monitor.tickle();
}
- /* done with the lock */
- lock.unlock();
-
/* write the JSON to string and sever on ZMQ */
if (response.size() == 1) {