summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-09-29 09:13:06 +0300
committerimarom <imarom@cisco.com>2016-09-29 09:13:06 +0300
commit13abd76b59cb1fd2094f5919b5e044d2f2338895 (patch)
tree0440c710a7b7d8b4ba7966d641a6bb92a2b0f0eb /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
parentbc02d31292c32469fe3d8fae6f529450512cf6f0 (diff)
https://trex-tgn.cisco.com/youtrack/issue/trex-247
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py')
-rwxr-xr-xscripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
index b5ae0f94..2d7cb269 100755
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
@@ -12,7 +12,7 @@ from .trex_stl_types import *
from .trex_stl_async_client import CTRexAsyncClient
from .utils import parsing_opts, text_tables, common
-from .utils.common import list_intersect, list_difference, is_sub_list
+from .utils.common import list_intersect, list_difference, is_sub_list, PassiveTimer
from .utils.text_opts import *
from functools import wraps
@@ -2521,7 +2521,7 @@ class STLClient(object):
@__api_check(True)
- def wait_on_traffic (self, ports = None, timeout = 60, rx_delay_ms = 10):
+ def wait_on_traffic (self, ports = None, timeout = None, rx_delay_ms = 10):
"""
.. _wait_on_traffic:
@@ -2533,6 +2533,7 @@ class STLClient(object):
timeout : int
timeout in seconds
+ default will be blocking
rx_delay_ms : int
Time to wait (in milliseconds) after last packet was sent, until RX filters used for
@@ -2551,7 +2552,7 @@ class STLClient(object):
ports = self._validate_port_list(ports)
- expr = time.time() + timeout
+ timer = PassiveTimer(timeout)
# wait while any of the required ports are active
while set(self.get_active_ports()).intersection(ports):
@@ -2561,7 +2562,7 @@ class STLClient(object):
raise STLError("subscriber thread is dead")
time.sleep(0.01)
- if time.time() > expr:
+ if timer.has_expired():
raise STLTimeoutError(timeout)
# remove any RX filters