NFVBENCH-94 End to end traffic test triggers too early on chatty network 91/57491/3
authorahothan <ahothan@cisco.com>
Wed, 16 May 2018 17:56:01 +0000 (10:56 -0700)
committerahothan <ahothan@cisco.com>
Wed, 16 May 2018 18:19:06 +0000 (11:19 -0700)
Change-Id: I995cf3209ec4ac8c324e2bc4bee202e0639bf0b3
Signed-off-by: ahothan <ahothan@cisco.com>
nfvbench/cfg.default.yaml
nfvbench/nfvbench.py
nfvbench/traffic_client.py
nfvbench/traffic_gen/trex.py
test/test_nfvbench.py

index d7e85c8..da68571 100755 (executable)
@@ -131,6 +131,11 @@ sriov: false
 # Can be overriden by --no-int-config
 no_int_config: false
 
+# Perform port to port loopback (direct or through switch)
+# Should be used with EXT service chain and no ARP (no_arp: true)
+# Can be overriden by --l2-loopback
+l2_loopback: false
+
 # Resources created by NFVbench will not be removed
 # Can be overriden by --no-cleanup
 no_cleanup: false
index c5c1244..1f80390 100644 (file)
@@ -574,7 +574,9 @@ def main():
         if opts.no_int_config:
             config.no_int_config = opts.no_int_config
 
+        # port to port loopback (direct or through switch)
         if opts.l2_loopback:
+            config.l2_loopback = True
             if config.service_chain != ChainType.EXT:
                 LOG.info('Changing service chain type to EXT')
                 config.service_chain = ChainType.EXT
index 5305da9..188e076 100755 (executable)
@@ -486,6 +486,10 @@ class TrafficClient(object):
                        self.config.generic_poll_sec - 1) / self.config.generic_poll_sec
         mac_addresses = set()
         ln = 0
+        # in case of l2-loopback, we will only have 2 unique src MAC regardless of the
+        # number of chains configured because there are no VM involved
+        # otherwise, we expect to see packets coming from 2 unique MAC per chain
+        unique_src_mac_count = 2 if self.config.l2_loopback else self.config.service_chain_count * 2
         for it in xrange(retry_count):
             self.gen.clear_stats()
             self.gen.start_traffic()
@@ -501,9 +505,8 @@ class TrafficClient(object):
                 mac_addresses.add(packet['binary'][6:12])
                 if ln != len(mac_addresses):
                     ln = len(mac_addresses)
-                    LOG.info('Flows passing traffic %d / %d', ln,
-                             self.config.service_chain_count * 2)
-                if len(mac_addresses) == self.config.service_chain_count * 2:
+                    LOG.info('Received unique source MAC %d / %d', ln, unique_src_mac_count)
+                if len(mac_addresses) == unique_src_mac_count:
                     LOG.info('End-to-end connectivity ensured')
                     return
 
index 22ca4d9..cabf1cb 100644 (file)
@@ -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:
index 16784d8..c45ccb3 100644 (file)
@@ -627,6 +627,7 @@ def get_dummy_tg_config(chain_type, rate):
         'check_traffic_time_sec': 200,
         'generic_poll_sec': 2,
         'measurement': {'NDR': 0.001, 'PDR': 0.1, 'load_epsilon': 0.1},
+        'l2_loopback': False
     })
 
 def get_traffic_client():