From e17b4b5b35936c5032cbeb3ccf8efbbc4c59c686 Mon Sep 17 00:00:00 2001 From: ahothan Date: Wed, 16 May 2018 10:56:01 -0700 Subject: NFVBENCH-94 End to end traffic test triggers too early on chatty network Change-Id: I995cf3209ec4ac8c324e2bc4bee202e0639bf0b3 Signed-off-by: ahothan --- nfvbench/traffic_gen/trex.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'nfvbench/traffic_gen/trex.py') 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: -- cgit 1.2.3-korg