aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functest/core/vnf.py20
-rw-r--r--functest/opnfv_tests/vnf/ims/cloudify_ims.py4
-rw-r--r--functest/tests/unit/core/test_vnf.py14
3 files changed, 33 insertions, 5 deletions
diff --git a/functest/core/vnf.py b/functest/core/vnf.py
index 05baf432a..15065f730 100644
--- a/functest/core/vnf.py
+++ b/functest/core/vnf.py
@@ -17,6 +17,7 @@ from snaps.config.user import UserConfig
from snaps.config.project import ProjectConfig
from snaps.openstack.create_user import OpenStackUser
from snaps.openstack.create_project import OpenStackProject
+from snaps.openstack.utils import keystone_utils
from snaps.openstack.tests import openstack_tests
from functest.core import testcase
@@ -116,16 +117,31 @@ class VnfOnBoarding(testcase.TestCase):
snaps_creds,
ProjectConfig(
name=self.tenant_name,
- description=self.tenant_description
+ description=self.tenant_description,
+ domain=snaps_creds.project_domain_name
))
self.os_project.create()
self.created_object.append(self.os_project)
+
+ snaps_creds.project_domain_id = \
+ self.os_project.get_project().domain_id
+ snaps_creds.user_domain_id = \
+ self.os_project.get_project().domain_id
+
+ for role in ['admin', 'Admin']:
+ if keystone_utils.get_role_by_name(
+ keystone_utils.keystone_client(snaps_creds), role):
+ admin_role = role
+ break
+
user_creator = OpenStackUser(
snaps_creds,
UserConfig(
name=self.user_name,
password=str(uuid.uuid4()),
- roles={'admin': self.tenant_name}))
+ project_name=self.tenant_name,
+ domain_name=snaps_creds.user_domain_name,
+ roles={admin_role: self.tenant_name}))
user_creator.create()
self.created_object.append(user_creator)
self.snaps_creds = user_creator.get_os_creds(self.tenant_name)
diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
index a6b87ea35..38a40ed83 100644
--- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py
+++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
@@ -234,7 +234,9 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
keystone_password=self.snaps_creds.password,
keystone_tenant_name=self.snaps_creds.project_name,
keystone_url=public_auth_url,
- region=self.snaps_creds.region_name)
+ region=self.snaps_creds.region_name,
+ user_domain_name=self.snaps_creds.user_domain_name,
+ project_domain_name=self.snaps_creds.project_domain_name)
self.__logger.info("Set creds for cloudify manager %s", cfy_creds)
cfy_client = CloudifyClient(
diff --git a/functest/tests/unit/core/test_vnf.py b/functest/tests/unit/core/test_vnf.py
index 16a609027..086ee6821 100644
--- a/functest/tests/unit/core/test_vnf.py
+++ b/functest/tests/unit/core/test_vnf.py
@@ -128,6 +128,9 @@ class VnfBaseTesting(unittest.TestCase):
args[2].assert_not_called()
@mock.patch('functest.core.vnf.OpenStackUser', side_effect=Exception)
+ @mock.patch('snaps.openstack.utils.keystone_utils.get_role_by_name',
+ return_value="admin")
+ @mock.patch('snaps.openstack.utils.keystone_utils.keystone_client')
@mock.patch('functest.core.vnf.OpenStackProject')
@mock.patch('snaps.openstack.tests.openstack_tests.get_credentials')
def test_prepare_exc3(self, *args):
@@ -135,16 +138,23 @@ class VnfBaseTesting(unittest.TestCase):
self.test.prepare()
args[0].assert_called_with(os_env_file=vnf.VnfOnBoarding.env_file)
args[1].assert_called_with(mock.ANY, mock.ANY)
- args[2].assert_called_with(mock.ANY, mock.ANY)
+ args[2].assert_called_with(mock.ANY)
+ args[3].assert_called_with(mock.ANY, mock.ANY)
+ args[4].assert_called_with(mock.ANY, mock.ANY)
@mock.patch('functest.core.vnf.OpenStackUser')
+ @mock.patch('snaps.openstack.utils.keystone_utils.get_role_by_name',
+ return_value="admin")
+ @mock.patch('snaps.openstack.utils.keystone_utils.keystone_client')
@mock.patch('functest.core.vnf.OpenStackProject')
@mock.patch('snaps.openstack.tests.openstack_tests.get_credentials')
def test_prepare_default(self, *args):
self.assertEqual(self.test.prepare(), testcase.TestCase.EX_OK)
args[0].assert_called_with(os_env_file=vnf.VnfOnBoarding.env_file)
args[1].assert_called_with(mock.ANY, mock.ANY)
- args[2].assert_called_with(mock.ANY, mock.ANY)
+ args[2].assert_called_with(mock.ANY)
+ args[3].assert_called_with(mock.ANY, mock.ANY)
+ args[4].assert_called_with(mock.ANY, mock.ANY)
def test_deploy_vnf_unimplemented(self):
with self.assertRaises(vnf.VnfDeploymentException):