summaryrefslogtreecommitdiffstats
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
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>
-rwxr-xr-xnfvbench/cfg.default.yaml5
-rw-r--r--nfvbench/nfvbench.py2
-rwxr-xr-xnfvbench/traffic_client.py9
-rw-r--r--nfvbench/traffic_gen/trex.py9
-rw-r--r--test/test_nfvbench.py1
5 files changed, 22 insertions, 4 deletions
diff --git a/nfvbench/cfg.default.yaml b/nfvbench/cfg.default.yaml
index d7e85c8..da68571 100755
--- a/nfvbench/cfg.default.yaml
+++ b/nfvbench/cfg.default.yaml
@@ -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
diff --git a/nfvbench/nfvbench.py b/nfvbench/nfvbench.py
index c5c1244..1f80390 100644
--- a/nfvbench/nfvbench.py
+++ b/nfvbench/nfvbench.py
@@ -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
diff --git a/nfvbench/traffic_client.py b/nfvbench/traffic_client.py
index 5305da9..188e076 100755
--- a/nfvbench/traffic_client.py
+++ b/nfvbench/traffic_client.py
@@ -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
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:
diff --git a/test/test_nfvbench.py b/test/test_nfvbench.py
index 16784d8..c45ccb3 100644
--- a/test/test_nfvbench.py
+++ b/test/test_nfvbench.py
@@ -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():