Config physical network when creating tempest net
authorLinda Wang <wangwulin@huawei.com>
Wed, 27 Dec 2017 01:35:01 +0000 (01:35 +0000)
committerLinda Wang <wangwulin@huawei.com>
Wed, 27 Dec 2017 02:24:25 +0000 (02:24 +0000)
When the network_type is vlan, physical_network and
segmentation_id could be configured.
This also supports to config physical network when creating
rally net.

Change-Id: I9770968537c1509c5712eada66925a4bf8f6678c
Signed-off-by: Linda Wang <wangwulin@huawei.com>
functest/ci/config_functest.yaml
functest/opnfv_tests/openstack/rally/rally.py
functest/opnfv_tests/openstack/tempest/tempest.py

index a40d80f..608d547 100644 (file)
@@ -122,6 +122,9 @@ tempest:
         ssh_timeout: 130
     object_storage:
         operator_role: SwiftOperator
+    # network_type: vlan
+    # physical_network: physnet2
+    # segmentation_id: 2366
     private_net_name: tempest-net
     private_subnet_name: tempest-subnet
     private_subnet_cidr: 192.168.150.0/24
@@ -132,6 +135,9 @@ tempest:
 rally:
     deployment_name: opnfv-rally
     network_name: rally-net
+    # network_type: vlan
+    # physical_network: physnet2
+    # segmentation_id: 2366
     subnet_name: rally-subnet
     subnet_cidr: 192.168.140.0/24
     router_name: rally-router
index c16e6d1..eefd3eb 100644 (file)
@@ -492,10 +492,28 @@ class RallyBase(testcase.TestCase):
         self.creators.append(image_creator)
 
         LOGGER.debug("Creating network '%s'...", network_name)
+
+        rally_network_type = None
+        rally_physical_network = None
+        rally_segmentation_id = None
+
+        if hasattr(CONST, 'rally_network_type'):
+            rally_network_type = CONST.__getattribute__(
+                'rally_network_type')
+        if hasattr(CONST, 'rally_physical_network'):
+            rally_physical_network = CONST.__getattribute__(
+                'rally_physical_network')
+        if hasattr(CONST, 'rally_segmentation_id'):
+            rally_segmentation_id = CONST.__getattribute__(
+                'rally_segmentation_id')
+
         network_creator = deploy_utils.create_network(
             self.os_creds, NetworkConfig(
                 name=network_name,
                 shared=True,
+                network_type=rally_network_type,
+                physical_network=rally_physical_network,
+                segmentation_id=rally_segmentation_id,
                 subnet_settings=[SubnetConfig(
                     name=subnet_name,
                     cidr=self.RALLY_PRIVATE_SUBNET_CIDR)
index 58882b9..5481b13 100644 (file)
@@ -363,11 +363,29 @@ class TempestResourcesManager(object):
             user_id = None
 
         logger.debug("Creating private network for Tempest suite")
+
+        tempest_network_type = None
+        tempest_physical_network = None
+        tempest_segmentation_id = None
+
+        if hasattr(CONST, 'tempest_network_type'):
+            tempest_network_type = CONST.__getattribute__(
+                'tempest_network_type')
+        if hasattr(CONST, 'tempest_physical_network'):
+            tempest_physical_network = CONST.__getattribute__(
+                'tempest_physical_network')
+        if hasattr(CONST, 'tempest_segmentation_id'):
+            tempest_segmentation_id = CONST.__getattribute__(
+                'tempest_segmentation_id')
+
         network_creator = deploy_utils.create_network(
             self.os_creds, NetworkConfig(
                 name=CONST.__getattribute__(
                     'tempest_private_net_name') + self.guid,
                 project_name=project_name,
+                network_type=tempest_network_type,
+                physical_network=tempest_physical_network,
+                segmentation_id=tempest_segmentation_id,
                 subnet_settings=[SubnetConfig(
                     name=CONST.__getattribute__(
                         'tempest_private_subnet_name') + self.guid,