diff options
author | Kerim Gokarslan <kgokarsl@cisco.com> | 2018-03-22 17:21:11 -0700 |
---|---|---|
committer | Kerim Gokarslan <kgokarsl@cisco.com> | 2018-03-23 14:49:12 -0700 |
commit | ad043dbc66865d79d78e5d0954c4b2eea32edecd (patch) | |
tree | a66f43b1d5a4189de4a9b3a133e28f2b1f377a48 /nfvbench/traffic_gen/trex.py | |
parent | 6bb39c2893b1fb163766e5cab562150cc4335b67 (diff) |
NFVBENCH-56 Multi-chaining traffic starts may be too early for some runs
Change-Id: I332a53e3dd3e14e9cba4ad9f57bdfd094ffa4d3a
Signed-off-by: Kerim Gokarslan <kgokarsl@cisco.com>
Diffstat (limited to 'nfvbench/traffic_gen/trex.py')
-rw-r--r-- | nfvbench/traffic_gen/trex.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/nfvbench/traffic_gen/trex.py b/nfvbench/traffic_gen/trex.py index 207fd52..4c9f492 100644 --- a/nfvbench/traffic_gen/trex.py +++ b/nfvbench/traffic_gen/trex.py @@ -66,6 +66,8 @@ class TRex(AbstractTrafficGenerator): self.streamblock = defaultdict(list) self.rates = [] self.arps = {} + self.capture_id = None + self.packet_list = [] def get_version(self): return self.client.get_server_version() @@ -455,6 +457,24 @@ class TRex(AbstractTrafficGenerator): def stop_traffic(self): self.client.stop(ports=self.port_handle) + def start_capture(self): + if self.capture_id: + self.stop_capture() + self.client.set_service_mode(ports=self.port_handle) + self.capture_id = self.client.start_capture(rx_ports=self.port_handle) + + def fetch_capture_packets(self): + if self.capture_id: + self.packet_list = [] + self.client.fetch_capture_packets(capture_id=self.capture_id['id'], + output=self.packet_list) + + def stop_capture(self): + 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) + def cleanup(self): if self.client: try: |