NFVBENCH-155 Add options to disable extra stats, latency stats and latency streams
[nfvbench.git] / test / test_chains.py
index f4b792a..741bee7 100644 (file)
@@ -70,6 +70,9 @@ def _get_chain_config(sc=ChainType.PVP, scc=1, shared_net=True, rate='1Mpps'):
     config.duration_sec = 2
     config.interval_sec = 1
     config.openrc_file = "dummy.rc"
+    config.no_flow_stats = False
+    config.no_latency_stats = False
+    config.no_latency_streams = False
     return config
 
 def test_chain_runner_ext_no_openstack():
@@ -103,7 +106,7 @@ def test_chain_runner_ext_no_openstack():
 
 
 def _mock_find_image(self, image_name):
-    return True
+    return MagicMock()
 
 @patch.object(Compute, 'find_image', _mock_find_image)
 @patch('nfvbench.chaining.Client')
@@ -232,6 +235,9 @@ def test_ext_chain_runner():
             for scc in [1, 2]:
                 config = _get_chain_config(ChainType.EXT, scc, shared_net)
                 config.no_arp = no_arp
+                # this time use a tuple of network names
+                config['external_networks']['left'] = ('ext-lnet00', 'ext-lnet01')
+                config['external_networks']['right'] = ('ext-rnet00', 'ext-rnet01')
                 if no_arp:
                     # If EXT and no arp, the config must provide mac addresses (1 pair per chain)
                     config['traffic_generator']['mac_addrs_left'] = ['00:00:00:00:00:00'] * scc
@@ -244,6 +250,9 @@ def _check_nfvbench_openstack(sc=ChainType.PVP, l2_loopback=False):
         if l2_loopback:
             config.l2_loopback = True
             config.vlans = [[100], [200]]
+        if sc == ChainType.EXT:
+            config['external_networks']['left'] = 'ext-lnet'
+            config['external_networks']['right'] = 'ext-rnet'
         factory = BasicFactory()
         config_plugin = factory.get_config_plugin_class()(config)
         config = config_plugin.get_config()
@@ -265,6 +274,7 @@ def _mock_get_mac(dummy):
 @patch.object(Compute, 'find_image', _mock_find_image)
 @patch.object(TrafficClient, 'skip_sleep', lambda x: True)
 @patch.object(ChainVnfPort, 'get_mac', _mock_get_mac)
+@patch.object(TrafficClient, 'is_udp', lambda x, y: True)
 @patch('nfvbench.chaining.Client')
 @patch('nfvbench.chaining.neutronclient')
 @patch('nfvbench.chaining.glanceclient')
@@ -281,6 +291,7 @@ def test_nfvbench_run(mock_cred, mock_glance, mock_neutron, mock_client):
 
 @patch.object(Compute, 'find_image', _mock_find_image)
 @patch.object(TrafficClient, 'skip_sleep', lambda x: True)
+@patch.object(TrafficClient, 'is_udp', lambda x, y: True)
 @patch('nfvbench.chaining.Client')
 @patch('nfvbench.chaining.neutronclient')
 @patch('nfvbench.chaining.glanceclient')
@@ -296,6 +307,7 @@ def test_nfvbench_ext_arp(mock_cred, mock_glance, mock_neutron, mock_client):
 
 @patch.object(Compute, 'find_image', _mock_find_image)
 @patch.object(TrafficClient, 'skip_sleep', lambda x: True)
+@patch.object(TrafficClient, 'is_udp', lambda x, y: True)
 @patch('nfvbench.chaining.Client')
 @patch('nfvbench.chaining.neutronclient')
 @patch('nfvbench.chaining.glanceclient')
@@ -460,6 +472,7 @@ def test_summarizer():
         assert stats == exp_stats
 
 @patch.object(TrafficClient, 'skip_sleep', lambda x: True)
+@patch.object(TrafficClient, 'is_udp', lambda x, y: True)
 def test_fixed_rate_no_openstack():
     """Test FIxed Rate run - no openstack."""
     config = _get_chain_config(ChainType.EXT, 1, True, rate='100%')