summaryrefslogtreecommitdiffstats
path: root/nfvbench/traffic_gen/trex_gen.py
diff options
context:
space:
mode:
authorLouin Pierrick <pierrick.louin@orange.com>2019-10-15 15:42:14 +0200
committerfmenguy <francoisregis.menguy@orange.com>2019-10-23 17:46:46 +0200
commit96ad348806948805928bf60885ca8f45379736ef (patch)
tree2c0f8757d54bab3f693b2ef94e14a8dc554ae346 /nfvbench/traffic_gen/trex_gen.py
parent6d7174208a032de47495e3e687ba25aed8bedb6e (diff)
NFVBENCH-152 Add service_mode method for debugging purpose
Change-Id: I17b70a26ea0df1b5b616db6039813c83a1efe799 Signed-off-by: fmenguy <francoisregis.menguy@orange.com>
Diffstat (limited to 'nfvbench/traffic_gen/trex_gen.py')
-rw-r--r--nfvbench/traffic_gen/trex_gen.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/nfvbench/traffic_gen/trex_gen.py b/nfvbench/traffic_gen/trex_gen.py
index 0f51188..b8e32e3 100644
--- a/nfvbench/traffic_gen/trex_gen.py
+++ b/nfvbench/traffic_gen/trex_gen.py
@@ -693,7 +693,10 @@ class TRex(AbstractTrafficGenerator):
chain_count)
break
- self.client.set_service_mode(ports=self.port_handle, enabled=False)
+ # if the capture from the TRex console was started before the arp request step,
+ # it keeps 'service_mode' enabled, otherwise, it disables the 'service_mode'
+ if not self.config.service_mode:
+ self.client.set_service_mode(ports=self.port_handle, enabled=False)
if len(arp_dest_macs) == len(self.port_handle):
return arp_dest_macs
return None
@@ -835,7 +838,10 @@ class TRex(AbstractTrafficGenerator):
if self.capture_id:
self.client.stop_capture(capture_id=self.capture_id['id'])
self.capture_id = None
- self.client.set_service_mode(ports=self.port_handle, enabled=False)
+ # if the capture from TRex console was started before the connectivity step,
+ # it keeps 'service_mode' enabled, otherwise, it disables the 'service_mode'
+ if not self.config.service_mode:
+ self.client.set_service_mode(ports=self.port_handle, enabled=False)
def cleanup(self):
"""Cleanup Trex driver."""
@@ -846,3 +852,7 @@ class TRex(AbstractTrafficGenerator):
except STLError:
# TRex does not like a reset while in disconnected state
pass
+
+ def set_service_mode(self, enabled=True):
+ """Enable/disable the 'service_mode'."""
+ self.client.set_service_mode(ports=self.port_handle, enabled=enabled)