NFVBENCH-117 Streamline VxLAN vni config and use auto-indexing 09/65609/1
authorahothan <ahothan@cisco.com>
Thu, 6 Dec 2018 00:12:29 +0000 (16:12 -0800)
committerahothan <ahothan@cisco.com>
Thu, 6 Dec 2018 00:12:29 +0000 (16:12 -0800)
Change-Id: Ie57d4c38ee22a4032991c282af526e0b28ce7a83
Signed-off-by: ahothan <ahothan@cisco.com>
nfvbench/cfg.default.yaml
nfvbench/chaining.py
nfvbench/compute.py
test/test_chains.py

index c90709f..fa3d807 100755 (executable)
@@ -157,13 +157,6 @@ traffic_generator:
     # Leave empty if there is no VLAN tagging required, or specify the VLAN id to use
     # for all VxLAN tunneled traffic
     vtep_vlan:
-    # VxLAN only: VNI range for VXLAN encapsulation [start_vni, end_vni]   [5000, 6000]
-    # VNI can have a value from range 5000-16777216
-    # For PVP, VNIs are allocated consecutively - 2 per each chain
-    # Chain 1: 5000, 5001; Chain 2: 5002, 5003; Chain X: 5000+x, 5000+x+1
-    # For PVVP scenario VNIs allocated consecutively - 3 per each chain
-    # Chain 1: 5000, 5001, 5002; Chain 2: 5003, 5004, 5005; Chain X: 5000+x, 5000+x+1, 5000+x+1
-    vnis:
     # VxLAN only: local/source vteps IP addresses for port 0 and 1 ['10.1.1.230', '10.1.1.231']
     src_vteps:
     # VxLAN only: remote IP address of the remote VTEPs that terminate all tunnels originating from local VTEPs
@@ -262,7 +255,7 @@ generic_poll_sec: 2
 # name of the loop VM
 loop_vm_name: 'nfvbench-loop-vm'
 
-# Default names, subnets and CIDRs for PVP/PVVP networks
+# Default names, subnets and CIDRs for PVP/PVVP networks (openstack only)
 #
 # If a network with given name already exists it will be reused.
 # - PVP only uses left and right
index fe79d88..ce1b5ce 100644 (file)
@@ -287,10 +287,10 @@ class ChainNetwork(object):
             }
             if network_config.network_type:
                 body['network']['provider:network_type'] = network_config.network_type
-                if self.segmentation_id:
-                    body['network']['provider:segmentation_id'] = self.segmentation_id
-                if self.physical_network:
-                    body['network']['provider:physical_network'] = self.physical_network
+            if self.segmentation_id:
+                body['network']['provider:segmentation_id'] = self.segmentation_id
+            if self.physical_network:
+                body['network']['provider:physical_network'] = self.physical_network
 
             self.network = self.manager.neutron_client.create_network(body)['network']
             body = {
@@ -304,7 +304,7 @@ class ChainNetwork(object):
             subnet = self.manager.neutron_client.create_subnet(body)['subnet']
             # add subnet id to the network dict since it has just been added
             self.network['subnets'] = [subnet['id']]
-            LOG.info('Created network: %s.', self.name)
+            LOG.info('Created network: %s', self.name)
 
     def get_uuid(self):
         """
@@ -895,11 +895,7 @@ class ChainManager(object):
                 self.vlans = [self._check_list('vlans[0]', config.vlans[0], re_vlan),
                               self._check_list('vlans[1]', config.vlans[1], re_vlan)]
             if config.vxlan:
-                # make sure there are 2 entries
-                if len(config.vnis) != 2:
-                    raise ChainException('The config vnis property must be a list with 2 VNIs')
-                self.vnis = [self._check_list('vnis[0]', config.vnis[0], re_vlan),
-                             self._check_list('vnis[1]', config.vnis[1], re_vlan)]
+                raise ChainException('VxLAN is only supported with OpenStack')
 
     def _get_dest_macs_from_config(self):
         re_mac = "[0-9a-fA-F]{2}([-:])[0-9a-fA-F]{2}(\\1[0-9a-fA-F]{2}){4}$"
@@ -996,39 +992,6 @@ class ChainManager(object):
         if initial_instance_count:
             LOG.info('All instances are active')
 
-    def _get_vxlan_net_cfg(self, chain_id):
-        int_nets = self.config.internal_networks
-        net_left = int_nets.left
-        net_right = int_nets.right
-        vnis = self.generator_config.vnis
-        chain_id += 1
-        seg_id_left = vnis[0]
-        if self.config.service_chain == ChainType.PVP:
-            if chain_id > 1:
-                seg_id_left = ((chain_id - 1) * 2) + seg_id_left
-            seg_id_right = seg_id_left + 1
-            if (seg_id_left and seg_id_right) > vnis[1]:
-                raise Exception('Segmentation ID is more than allowed '
-                                'value: {}'.format(vnis[1]))
-            net_left['segmentation_id'] = seg_id_left
-            net_right['segmentation_id'] = seg_id_right
-            net_cfg = [net_left, net_right]
-        else:
-            # PVVP
-            net_middle = int_nets.middle
-            if chain_id > 1:
-                seg_id_left = ((chain_id - 1) * 3) + seg_id_left
-            seg_id_middle = seg_id_left + 1
-            seg_id_right = seg_id_left + 2
-            if (seg_id_left and seg_id_right and seg_id_middle) > vnis[1]:
-                raise Exception('Segmentation ID is more than allowed '
-                                'value: {}'.format(vnis[1]))
-            net_left['segmentation_id'] = seg_id_left
-            net_middle['segmentation_id'] = seg_id_middle
-            net_right['segmentation_id'] = seg_id_right
-            net_cfg = [net_left, net_middle, net_right]
-        return net_cfg
-
     def get_networks(self, chain_id=None):
         """Get the networks for given EXT, PVP or PVVP chain.
 
@@ -1052,15 +1015,11 @@ class ChainManager(object):
         else:
             lookup_only = False
             int_nets = self.config.internal_networks
-            network_type = set([int_nets[net].get('network_type') for net in int_nets])
-            if self.config.vxlan and 'vxlan' in network_type:
-                net_cfg = self._get_vxlan_net_cfg(chain_id)
+            # VLAN and VxLAN
+            if self.config.service_chain == ChainType.PVP:
+                net_cfg = [int_nets.left, int_nets.right]
             else:
-                # VLAN
-                if self.config.service_chain == ChainType.PVP:
-                    net_cfg = [int_nets.left, int_nets.right]
-                else:
-                    net_cfg = [int_nets.left, int_nets.middle, int_nets.right]
+                net_cfg = [int_nets.left, int_nets.middle, int_nets.right]
         networks = []
         try:
             for cfg in net_cfg:
@@ -1163,7 +1122,7 @@ class ChainManager(object):
             return [self.chains[chain_index].get_vxlan(port_index)
                     for chain_index in range(self.chain_count)]
         # no openstack
-        return self.vnis[port_index]
+        raise ChainException('VxLAN is only supported with OpenStack')
 
     def get_dest_macs(self, port_index):
         """Get the list of per chain dest MACs on a given port.
index 97fd166..556ade4 100644 (file)
@@ -107,7 +107,7 @@ class Compute(object):
             security_groups = None
 
         # Also attach the created security group for the test
-        LOG.info('Creating instance %s with AZ %s', vmname, avail_zone)
+        LOG.info('Creating instance %s with AZ: "%s"', vmname, avail_zone)
         instance = self.novaclient.servers.create(name=vmname,
                                                   image=image,
                                                   flavor=flavor,
index de18e92..17c5b94 100644 (file)
@@ -76,7 +76,6 @@ def test_chain_runner_ext_no_openstack():
     config = _get_chain_config(sc=ChainType.EXT)
     specs = Specs()
     config.vlans = [100, 200]
-    config.vnis = [5000, 6000]
     config['traffic_generator']['mac_addrs_left'] = ['00:00:00:00:00:00']
     config['traffic_generator']['mac_addrs_right'] = ['00:00:00:00:01:00']
 
@@ -173,7 +172,6 @@ def _check_nfvbench_openstack(sc=ChainType.PVP, l2_loopback=False):
         if l2_loopback:
             config.l2_loopback = True
             config.vlans = [[100], [200]]
-            config.vnis = [[5000], [6000]]
         factory = BasicFactory()
         config_plugin = factory.get_config_plugin_class()(config)
         config = config_plugin.get_config()
@@ -388,7 +386,6 @@ def test_fixed_rate_no_openstack():
     config = _get_chain_config(ChainType.EXT, 1, True, rate='100%')
     specs = Specs()
     config.vlans = [100, 200]
-    config.vnis = [5000, 6000]
     config['traffic_generator']['mac_addrs_left'] = ['00:00:00:00:00:00']
     config['traffic_generator']['mac_addrs_right'] = ['00:00:00:00:01:00']
     config.no_arp = True