summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/server
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-04-03 21:53:51 +0300
committerYaroslav Brustinov <ybrustin@cisco.com>2016-04-03 21:53:51 +0300
commit0eb15b2e851b5f50669633678143c5a1d3a7d95b (patch)
tree3921c0d4e916a14cc6a189ecfeca0c74035ac4f9 /scripts/automation/trex_control_plane/server
parent684f8b18191ec86df845e4e7cc7ad32222019815 (diff)
remove timeouts from trex_client pkg tests, filter out 0.1% of highest latencies, increase priority of TRex process
Diffstat (limited to 'scripts/automation/trex_control_plane/server')
-rwxr-xr-xscripts/automation/trex_control_plane/server/trex_server.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/automation/trex_control_plane/server/trex_server.py b/scripts/automation/trex_control_plane/server/trex_server.py
index bf788d35..3f8bc374 100755
--- a/scripts/automation/trex_control_plane/server/trex_server.py
+++ b/scripts/automation/trex_control_plane/server/trex_server.py
@@ -39,7 +39,7 @@ class CTRexServer(object):
TREX_START_CMD = './t-rex-64'
DEFAULT_FILE_PATH = '/tmp/trex_files/'
- def __init__(self, trex_path, trex_files_path, trex_host='0.0.0.0', trex_daemon_port=8090, trex_zmq_port=4500):
+ def __init__(self, trex_path, trex_files_path, trex_host='0.0.0.0', trex_daemon_port=8090, trex_zmq_port=4500, trex_nice=-19):
"""
Parameters
----------
@@ -68,6 +68,12 @@ class CTRexServer(object):
self.start_lock = threading.Lock()
self.__reservation = None
self.zmq_monitor = ZmqMonitorSession(self.trex, self.trex_zmq_port) # intiate single ZMQ monitor thread for server usage
+ self.trex_nice = int(trex_nice)
+ if self.trex_nice < -20 or self.trex_nice > 19:
+ err = "Parameter 'nice' should be integer in range [-20, 19]"
+ print(err)
+ logger.error(err)
+ raise Exception(err)
def add(self, x, y):
print "server function add ",x,y
@@ -366,7 +372,8 @@ class CTRexServer(object):
else:
trex_cmd_options += (dash + '{k} {val}'.format( k = tmp_key, val = value ))
- cmd = "{run_command} -f {gen_file} -d {duration} --iom {io} {cmd_options} --no-key > {export}".format( # -- iom 0 disables the periodic log to the screen (not needed)
+ cmd = "{nice}{run_command} -f {gen_file} -d {duration} --iom {io} {cmd_options} --no-key > {export}".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,
gen_file = f,
duration = d,
@@ -508,6 +515,8 @@ trex_daemon_server [options]
action="store", help="Specify a hostname to be registered as the TRex server.\n"
"Default is to bind all IPs using '0.0.0.0'.",
metavar="HOST", default = '0.0.0.0')
+ parser.add_argument('-n', '--nice', dest='nice', action="store", default = -19, type = int,
+ help="Determine the priority TRex process [-20, 19] (lower = higher priority)\nDefault is -19.")
return parser
trex_parser = generate_trex_parser()
@@ -517,7 +526,7 @@ def do_main_program ():
args = trex_parser.parse_args()
server = CTRexServer(trex_path = args.trex_path, trex_files_path = args.files_path,
trex_host = args.trex_host, trex_daemon_port = args.daemon_port,
- trex_zmq_port = args.zmq_port)
+ trex_zmq_port = args.zmq_port, trex_nice = args.nice)
server.start()