aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries')
-rw-r--r--resources/libraries/python/TrafficGenerator.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py
index 39f8287481..adc22b3de6 100644
--- a/resources/libraries/python/TrafficGenerator.py
+++ b/resources/libraries/python/TrafficGenerator.py
@@ -101,7 +101,8 @@ class TrafficGenerator(object):
:type test_type: str
:return: nothing
"""
- trex_path = "/opt/trex-core-1.91"
+
+ trex_path = "/opt/trex-core-2.00"
topo = Topology()
@@ -168,7 +169,7 @@ class TrafficGenerator(object):
(ret, _, _) = ssh.exec_command(
"sh -c 'cd {0}/scripts/ && "
- "sudo nohup ./t-rex-64 -i -c 4 --iom 0 > /dev/null 2>&1 &'"
+ "sudo nohup ./t-rex-64 -i -c 7 --iom 0 > /dev/null 2>&1 &'"
"> /dev/null"\
.format(trex_path))
if int(ret) != 0:
@@ -242,15 +243,18 @@ class TrafficGenerator(object):
logger.trace(stdout)
logger.trace(stderr)
- # last line from console output
- line = stdout.splitlines()[-1]
+ if int(ret) != 0:
+ raise RuntimeError('T-rex stateless runtime error')
+ else:
+ # last line from console output
+ line = stdout.splitlines()[-1]
- self._result = line
- logger.info('TrafficGen result: {0}'.format(self._result))
+ self._result = line
+ logger.info('TrafficGen result: {0}'.format(self._result))
- self._received = self._result.split(', ')[1].split('=')[1]
- self._sent = self._result.split(', ')[2].split('=')[1]
- self._loss = self._result.split(', ')[3].split('=')[1]
+ self._received = self._result.split(', ')[1].split('=')[1]
+ self._sent = self._result.split(', ')[2].split('=')[1]
+ self._loss = self._result.split(', ')[3].split('=')[1]
def send_traffic_on(self, node, duration, rate,
framesize, traffic_type):