summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functest/core/tenantnetwork.py12
-rw-r--r--functest/opnfv_tests/openstack/cinder/cinder_test.py2
2 files changed, 12 insertions, 2 deletions
diff --git a/functest/core/tenantnetwork.py b/functest/core/tenantnetwork.py
index 3a212d871..6efb7abd7 100644
--- a/functest/core/tenantnetwork.py
+++ b/functest/core/tenantnetwork.py
@@ -35,6 +35,7 @@ class NewProject(object):
# pylint: disable=too-many-instance-attributes
__logger = logging.getLogger(__name__)
+ default_member = "Member"
def __init__(self, cloud, case_name, guid):
self.cloud = None
@@ -45,6 +46,7 @@ class NewProject(object):
self.user = None
self.password = None
self.domain = None
+ self.role = None
def create(self):
"""Create projects/users"""
@@ -65,8 +67,14 @@ class NewProject(object):
password=self.password,
domain_id=self.domain.id)
self.__logger.debug("user: %s", self.user)
+ try:
+ assert self.orig_cloud.get_role(self.default_member)
+ except Exception: # pylint: disable=broad-except
+ self.__logger.info("Creating default role %s", self.default_member)
+ self.role = self.orig_cloud.create_role(self.default_member)
+ self.__logger.debug("role: %s", self.role)
self.orig_cloud.grant_role(
- "Member", user=self.user.id, project=self.project.id,
+ self.default_member, user=self.user.id, project=self.project.id,
domain=self.domain.id)
osconfig = os_client_config.config.OpenStackConfig()
osconfig.cloud_config[
@@ -86,6 +94,8 @@ class NewProject(object):
assert self.project.id
self.orig_cloud.delete_user(self.user.id)
self.orig_cloud.delete_project(self.project.id)
+ if self.role:
+ self.orig_cloud.delete_role(self.role.id)
except Exception: # pylint: disable=broad-except
self.__logger.exception("Cannot clean all ressources")
diff --git a/functest/opnfv_tests/openstack/cinder/cinder_test.py b/functest/opnfv_tests/openstack/cinder/cinder_test.py
index 7f9401c93..cc14752ea 100644
--- a/functest/opnfv_tests/openstack/cinder/cinder_test.py
+++ b/functest/opnfv_tests/openstack/cinder/cinder_test.py
@@ -109,6 +109,6 @@ class CinderCheck(singlevm.SingleVm2):
self.cloud.delete_server(
self.vm2, wait=True,
timeout=getattr(config.CONF, 'vping_vm_delete_timeout'))
- self.cloud.delete_floating_ip(self.fip.id)
+ self.cloud.delete_floating_ip(self.fip2.id)
self.cloud.delete_volume(self.volume.id)
super(CinderCheck, self).clean()