summaryrefslogtreecommitdiffstats
path: root/nfvbench/traffic_gen/trex.py
diff options
context:
space:
mode:
authorahothan <ahothan@cisco.com>2018-05-16 10:56:01 -0700
committerahothan <ahothan@cisco.com>2018-05-16 11:19:06 -0700
commite17b4b5b35936c5032cbeb3ccf8efbbc4c59c686 (patch)
tree7ada4888e61eb2611134bb2d84852d9f368c42ae /nfvbench/traffic_gen/trex.py
parente633f286772e7667dfd7491a0a7227f9317bc0c8 (diff)
NFVBENCH-94 End to end traffic test triggers too early on chatty network
Change-Id: I995cf3209ec4ac8c324e2bc4bee202e0639bf0b3 Signed-off-by: ahothan <ahothan@cisco.com>
Diffstat (limited to 'nfvbench/traffic_gen/trex.py')
-rw-r--r--nfvbench/traffic_gen/trex.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/nfvbench/traffic_gen/trex.py b/nfvbench/traffic_gen/trex.py
index 22ca4d9..cabf1cb 100644
--- a/nfvbench/traffic_gen/trex.py
+++ b/nfvbench/traffic_gen/trex.py
@@ -455,10 +455,17 @@ class TRex(AbstractTrafficGenerator):
self.client.stop(ports=self.port_handle)
def start_capture(self):
+ """Capture all packets on both ports that are unicast to us."""
if self.capture_id:
self.stop_capture()
+ # Need to filter out unwanted packets so we do not end up counting
+ # src MACs of frames that are not unicast to us
+ src_mac_list = self.get_macs()
+ bpf_filter = "ether dst %s or ether dst %s" % (src_mac_list[0], src_mac_list[1])
+ # ports must be set in service in order to enable capture
self.client.set_service_mode(ports=self.port_handle)
- self.capture_id = self.client.start_capture(rx_ports=self.port_handle)
+ self.capture_id = self.client.start_capture(rx_ports=self.port_handle,
+ bpf_filter=bpf_filter)
def fetch_capture_packets(self):
if self.capture_id: