From c3bca52168627ffe915f39b1e03e5505a8a68176 Mon Sep 17 00:00:00 2001 From: Ah Date: Fri, 28 Sep 2018 12:37:17 +0530 Subject: Support for Keystone V3 Issue-ID: TEST-39 Change-Id: I912e6d8b57d5be78cf6831daa5b6081388c03c6e Signed-off-by: Ah --- heatbridge/heatbridge/HeatBridge.py | 7 ++++--- heatbridge/heatbridge/OpenstackContext.py | 8 ++++++-- heatbridge/heatbridge/OpenstackManager.py | 24 +++++++++++++++++------- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/heatbridge/heatbridge/HeatBridge.py b/heatbridge/heatbridge/HeatBridge.py index f9b9580..de10793 100644 --- a/heatbridge/heatbridge/HeatBridge.py +++ b/heatbridge/heatbridge/HeatBridge.py @@ -7,9 +7,10 @@ class HeatBridge: def __init__(self): pass; - def init_bridge(self, openstack_identity_url, username, password, tenant, region, owner): - self.om = OpenstackManager(openstack_identity_url, OpenstackContext(username, password, tenant, region, owner)); - self.am = AAIManager(OpenstackContext(username, password, tenant, region, owner)); + def init_bridge(self, openstack_identity_url, username, password, tenant, region, owner, domain_id=None, project_name=None): + self.om = OpenstackManager(openstack_identity_url, OpenstackContext(username, password, tenant, region, owner, domain_id, project_name)); + self.am = AAIManager(OpenstackContext(username, password, tenant, region, owner, domain_id, project_name)); + def filterbyvalue(self, seq, key, value): for el in seq: diff --git a/heatbridge/heatbridge/OpenstackContext.py b/heatbridge/heatbridge/OpenstackContext.py index 5e852a2..55661d3 100644 --- a/heatbridge/heatbridge/OpenstackContext.py +++ b/heatbridge/heatbridge/OpenstackContext.py @@ -7,10 +7,14 @@ class OpenstackContext: tenant = None; region = None; owner = None; + domain_id = None; + project_name = None; - def __init__(self, username, password, tenant, region, owner): + def __init__(self, username, password, tenant, region, owner, domain_id, project_name): self.username = username; self.password = password; self.tenant = tenant; self.region = region; - self.owner = owner; \ No newline at end of file + self.owner = owner; + self.domain_id = domain_id; + self.project_name = project_name; diff --git a/heatbridge/heatbridge/OpenstackManager.py b/heatbridge/heatbridge/OpenstackManager.py index 0bb637a..327978a 100644 --- a/heatbridge/heatbridge/OpenstackManager.py +++ b/heatbridge/heatbridge/OpenstackManager.py @@ -25,10 +25,10 @@ class OpenstackManager: """ self.openstack_context = context; self.identity_url = identity_url; - self.authenticate(context.username, context.password, context.tenant, context.region) + self.authenticate(context.username, context.password, context.tenant, context.region, context.domain_id, context.project_name) logging.basicConfig(level=logging.DEBUG) - def authenticate(self, username, password, tenant, region): + def authenticate(self, username, password, tenant, region, domain_id,project_name): """ Authenticate to openstack env `username` username to authenticate to openstack @@ -44,31 +44,41 @@ class OpenstackManager: username=username, password=password, project_id=tenant, - region_name=region); + region_name=region, + domain_id=domain_id, + project_name=project_name); self.__nova_client = os_client_config.make_client('compute', auth_url=self.identity_url, username=username, password=password, project_id=tenant, - region_name=region); + region_name=region, + domain_id=domain_id, + project_name=project_name); self.__cinder_client = os_client_config.make_client('volume', auth_url=self.identity_url, username=username, password=password, project_id=tenant, - region_name=region); + region_name=region, + domain_id=domain_id, + project_name=project_name); self.__glance_client = os_client_config.make_client('image', auth_url=self.identity_url, username=username, password=password, project_id=tenant, - region_name=region); + region_name=region, + domain_id=domain_id, + project_name=project_name); self.__neutron_client = os_client_config.make_client('network', auth_url=self.identity_url, username=username, password=password, project_id=tenant, - region_name=region); + region_name=region, + domain_id=domain_id, + project_name=project_name); #this next line is needed because for v2 apis that are after a certain release stopped providing version info in keytone url but rackspace did not self.__neutron_client.action_prefix = ""; self.__auth_resp = True; -- cgit 1.2.3-korg