aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils
diff options
context:
space:
mode:
authorJuha Kosonen <juha.kosonen@nokia.com>2017-08-17 07:57:31 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-08-17 07:57:31 +0000
commit94d1bddfdd97379e50e4c12f26116441e836d0f6 (patch)
treedd92cfa7218da2c21355be924b073c65e38bcb63 /functest/utils
parentde754b305ad82defae6e2c7bc5a358184aede6b4 (diff)
parent3ed570c27587e69f384a6e9ab2711d553b7dcde6 (diff)
Merge "Fix domain in tenant creation"
Diffstat (limited to 'functest/utils')
-rw-r--r--functest/utils/openstack_utils.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index 1bdfa253..335f14cd 100644
--- a/functest/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
@@ -22,6 +22,7 @@ from heatclient import client as heatclient
from novaclient import client as novaclient
from keystoneclient import client as keystoneclient
from neutronclient.neutron import client as neutronclient
+from functest.utils.constants import CONST
import functest.utils.functest_utils as ft_utils
@@ -1376,13 +1377,25 @@ def get_role_id(keystone_client, role_name):
return id
+def get_domain_id(keystone_client, domain_name):
+ domains = keystone_client.domains.list()
+ id = ''
+ for d in domains:
+ if d.name == domain_name:
+ id = d.id
+ break
+ return id
+
+
def create_tenant(keystone_client, tenant_name, tenant_description):
try:
if is_keystone_v3():
+ domain_name = CONST.__getattribute__('OS_PROJECT_DOMAIN_NAME')
+ domain_id = get_domain_id(keystone_client, domain_name)
tenant = keystone_client.projects.create(
name=tenant_name,
description=tenant_description,
- domain="default",
+ domain=domain_id,
enabled=True)
else:
tenant = keystone_client.tenants.create(tenant_name,