aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/TrafficGenerator.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2017-12-04 16:41:57 +0100
committerTibor Frank <tifrank@cisco.com>2018-01-10 15:35:01 +0100
commita95c54b7821596402e0aa7136cd7d1de71a5b187 (patch)
treef1c941b06bb05069af1b3f587b5bcfc8bc22ef3a /resources/libraries/python/TrafficGenerator.py
parentec120d957cfec192d30e84a0d337198153214a70 (diff)
CSIT-866: wrk onboarding in CSIT
- CSIT-867: Low Level Description - CSIT-868: wrk traffic profile - parsing - CSIT-869: wrk implementation into CSIT Change-Id: I65e1037f5ae05b3a5b2020e4a6c54462766ae1b4 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/libraries/python/TrafficGenerator.py')
-rw-r--r--resources/libraries/python/TrafficGenerator.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py
index 698b67ead2..f363fe3f55 100644
--- a/resources/libraries/python/TrafficGenerator.py
+++ b/resources/libraries/python/TrafficGenerator.py
@@ -308,6 +308,24 @@ class TrafficGenerator(object):
raise RuntimeError('t-rex-64 startup failed')
@staticmethod
+ def is_trex_running(node):
+ """Check if TRex is running using pidof.
+
+ :param node: Traffic generator node.
+ :type node: dict
+ :returns: True if TRex is running otherwise False.
+ :rtype: bool
+ :raises: RuntimeError if node type is not a TG.
+ """
+ if node['type'] != NodeType.TG:
+ raise RuntimeError('Node type is not a TG')
+
+ ssh = SSH()
+ ssh.connect(node)
+ ret, _, _ = ssh.exec_command_sudo("pidof t-rex")
+ return bool(int(ret) == 0)
+
+ @staticmethod
def teardown_traffic_generator(node):
"""TG teardown.