diff options
author | Linda Wang <wangwulin@huawei.com> | 2017-08-17 08:01:55 +0000 |
---|---|---|
committer | Linda Wang <wangwulin@huawei.com> | 2017-08-22 06:08:03 +0000 |
commit | dbf8c0d9348514c711a9a0e4e794277f90c817d5 (patch) | |
tree | 7a75bb021c59006796018150a9699e2a1b3f4544 | |
parent | 9515e36a056ad7f16f39564ae2eeca955054997d (diff) |
Specify physical_network when creating network
When the network_type is vlan, it is necessary to specify
physical_network and segmentation_id.
JIRA: FUNCTEST-863
Change-Id: Ia1acb0181e4f78654ecf5500c4c0366b143a91f5
Signed-off-by: Linda Wang <wangwulin@huawei.com>
-rw-r--r-- | functest/ci/config_functest.yaml | 3 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/vping/vping_base.py | 27 |
2 files changed, 26 insertions, 4 deletions
diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml index 49ba7a9e5..ba01bf6ce 100644 --- a/functest/ci/config_functest.yaml +++ b/functest/ci/config_functest.yaml @@ -69,6 +69,9 @@ vping: vm_name_2: opnfv-vping-2 image_name: functest-vping private_net_name: vping-net + # network_type: vlan + # physical_network: physnet2 + # segmentation_id: 2366 private_subnet_name: vping-subnet private_subnet_cidr: 192.168.130.0/24 router_name: vping-router diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py index 74fbce1b0..f3e0cfe32 100644 --- a/functest/opnfv_tests/openstack/vping/vping_base.py +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -102,14 +102,33 @@ class VPingBase(testcase.TestCase): 'vping_private_subnet_name') + self.guid private_subnet_cidr = CONST.__getattribute__( 'vping_private_subnet_cidr') + + vping_network_type = None + vping_physical_network = None + vping_segmentation_id = None + + if (hasattr(CONST, 'network_type')): + vping_network_type = CONST.__getattribute__( + 'vping_network_type') + if (hasattr(CONST, 'physical_network')): + vping_physical_network = CONST.__getattribute__( + 'vping_physical_network') + if (hasattr(CONST, 'segmentation_id')): + vping_segmentation_id = CONST.__getattribute__( + 'vping_segmentation_id') + self.logger.info( "Creating network with name: '%s'" % private_net_name) self.network_creator = deploy_utils.create_network( self.os_creds, - NetworkSettings(name=private_net_name, - subnet_settings=[SubnetSettings( - name=private_subnet_name, - cidr=private_subnet_cidr)])) + NetworkSettings( + name=private_net_name, + network_type=vping_network_type, + physical_network=vping_physical_network, + segmentation_id=vping_segmentation_id, + subnet_settings=[SubnetSettings( + name=private_subnet_name, + cidr=private_subnet_cidr)])) self.creators.append(self.network_creator) self.logger.info( |