diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-09-03 08:10:03 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-09-03 13:54:02 +0200 |
commit | 92ba2d7f3bbbecebcd4214bc9b8682d2b6ce87e9 (patch) | |
tree | 8abd262cad188802a37b887f84cf393b724574e0 | |
parent | d08554da5fd0e3c1119513ef2af6675df2488fe5 (diff) |
Create network via admin user
It creates the network via admin user as segmentation id may be set.
Change-Id: I853f40e09aee9a658fc2373cd7e8bf00e3c0c3ad
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r-- | functest/core/singlevm.py | 1 | ||||
-rw-r--r-- | functest/core/tenantnetwork.py | 15 |
2 files changed, 11 insertions, 5 deletions
diff --git a/functest/core/singlevm.py b/functest/core/singlevm.py index 78f8ab9d0..71ed0690d 100644 --- a/functest/core/singlevm.py +++ b/functest/core/singlevm.py @@ -58,7 +58,6 @@ class VmReady1(tenantnetwork.TenantNetwork1): if "case_name" not in kwargs: kwargs["case_name"] = 'vmready1' super(VmReady1, self).__init__(**kwargs) - self.orig_cloud = self.cloud self.image = None self.flavor = None diff --git a/functest/core/tenantnetwork.py b/functest/core/tenantnetwork.py index a96484f28..9f5913c70 100644 --- a/functest/core/tenantnetwork.py +++ b/functest/core/tenantnetwork.py @@ -134,9 +134,10 @@ class TenantNetwork1(testcase.TestCase): getattr(config.CONF, 'dir_results'), self.case_name) try: cloud_config = os_client_config.get_config() - self.cloud = shade.OpenStackCloud(cloud_config=cloud_config) + self.cloud = self.orig_cloud = shade.OpenStackCloud( + cloud_config=cloud_config) except Exception: # pylint: disable=broad-except - self.cloud = None + self.cloud = self.orig_cloud = None self.ext_net = None self.__logger.exception("Cannot connect to Cloud") try: @@ -205,9 +206,15 @@ class TenantNetwork1(testcase.TestCase): if hasattr(config.CONF, '{}_segmentation_id'.format(self.case_name)): provider["segmentation_id"] = getattr( config.CONF, '{}_segmentation_id'.format(self.case_name)) - self.network = self.cloud.create_network( + domain = self.orig_cloud.get_domain( + name_or_id=self.orig_cloud.auth.get( + "project_domain_name", "Default")) + project = self.orig_cloud.get_project( + self.cloud.auth['project_name'], + domain_id=domain.id) + self.network = self.orig_cloud.create_network( '{}-net_{}'.format(self.case_name, self.guid), - provider=provider, + provider=provider, project_id=project.id, shared=self.shared_network) self.__logger.debug("network: %s", self.network) |