aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/TrafficGenerator.py
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2016-04-25 15:58:04 +0200
committerMiroslav Miklus <mmiklus@cisco.com>2016-05-04 11:31:27 +0000
commit5eddf0d2dad050e9b03f6f41e1dfdcff0e3a21f6 (patch)
tree967e282dab8ba2076eb21c3a9bee15d83d1e3ed6 /resources/libraries/python/TrafficGenerator.py
parent9f09722c66162b0e01d1aa972f650bf1cd9b3a52 (diff)
Update T-rex version to v2.00
- JIRA: CSIT-14 - Update T-rex version to v2.00 with latest API - Compatibility fixes of affected libraries and robot files - T-rex performance tuning Change-Id: I3a90553032d6d82e6e03df7e0b52e205d3f6ba4e Signed-off-by: pmikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/python/TrafficGenerator.py')
-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):