aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-07-20 10:45:20 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-07-20 11:20:58 +0200
commit51f3e7a3cc4409fb9dda03bffa1252a8660f38b0 (patch)
treeec03a206710003bc15bf9f665eaf4e5d8cb07211
parent5bd8c86c423e59c7a24b15b9855f9e04ba8500c5 (diff)
Allow overriding the default role
It allows testing controllers which implements other RBAC policies. Defining NEW_USER_ROLE=admin will easily raise side effects for orchestrators such as Juju and Cloudify. Change-Id: Ia78a25381aeb8aa81fd1872661629e1c08432b8f Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r--functest/core/tenantnetwork.py2
-rw-r--r--functest/opnfv_tests/vnf/epc/juju_epc.py7
-rw-r--r--functest/opnfv_tests/vnf/ims/cloudify_ims.py8
-rw-r--r--functest/utils/env.py3
4 files changed, 18 insertions, 2 deletions
diff --git a/functest/core/tenantnetwork.py b/functest/core/tenantnetwork.py
index 678b9b590..fdf0ab132 100644
--- a/functest/core/tenantnetwork.py
+++ b/functest/core/tenantnetwork.py
@@ -35,7 +35,6 @@ 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
@@ -48,6 +47,7 @@ class NewProject(object):
self.domain = None
self.role = None
self.role_name = None
+ self.default_member = env.get('NEW_USER_ROLE')
def create(self):
"""Create projects/users"""
diff --git a/functest/opnfv_tests/vnf/epc/juju_epc.py b/functest/opnfv_tests/vnf/epc/juju_epc.py
index 3f2a9ff93..6fcae680a 100644
--- a/functest/opnfv_tests/vnf/epc/juju_epc.py
+++ b/functest/opnfv_tests/vnf/epc/juju_epc.py
@@ -131,6 +131,13 @@ class JujuEpc(vnf.VnfOnBoarding):
self.res_dir = os.path.join(
getattr(config.CONF, 'dir_results'), self.case_name)
+ def check_requirements(self):
+ if env.get('NEW_USER_ROLE').lower() == "admin":
+ self.__logger.warn(
+ "Defining NEW_USER_ROLE=admin will easily break the testcase "
+ "because Juju doesn't manage tenancy (e.g. subnet "
+ "overlapping)")
+
def _bypass_juju_netdiscovery_bug(self, name):
user_creator = OpenStackUser(
self.snaps_creds,
diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
index 9786ff271..36862bd43 100644
--- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py
+++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
@@ -24,6 +24,7 @@ import six
from functest.core import cloudify
from functest.opnfv_tests.vnf.ims import clearwater_ims_base
from functest.utils import config
+from functest.utils import env
__author__ = "Valentin Boucher <valentin.boucher@orange.com>"
@@ -90,6 +91,13 @@ class CloudifyIms(cloudify.Cloudify):
self.image_alt = None
self.flavor_alt = None
+ def check_requirements(self):
+ if env.get('NEW_USER_ROLE').lower() == "admin":
+ self.__logger.warn(
+ "Defining NEW_USER_ROLE=admin will easily break the testcase "
+ "because Cloudify doesn't manage tenancy (e.g. subnet "
+ "overlapping)")
+
def execute(self):
assert super(CloudifyIms, self).execute() == 0
# pylint: disable=too-many-locals,too-many-statements
diff --git a/functest/utils/env.py b/functest/utils/env.py
index cba935ab8..5f414f1f4 100644
--- a/functest/utils/env.py
+++ b/functest/utils/env.py
@@ -32,7 +32,8 @@ INPUTS = {
'ENERGY_RECORDER_API_USER': env.INPUTS['ENERGY_RECORDER_API_USER'],
'ENERGY_RECORDER_API_PASSWORD': env.INPUTS['ENERGY_RECORDER_API_PASSWORD'],
'VOLUME_DEVICE_NAME': 'vdb',
- 'NAMESERVER': '8.8.8.8'
+ 'NAMESERVER': '8.8.8.8',
+ 'NEW_USER_ROLE': 'Member'
}