@staticmethod
def get_session(creds: dict):
verify_ssl = True
- project_domain_name = 'Default'
- user_domain_name = 'Default'
+ project_domain_id = None
+ user_domain_id = None
+ project_domain_name = None
+ user_domain_name = None
if 'config' in creds:
vim_config = creds['config']
if 'insecure' in vim_config and vim_config['insecure']:
verify_ssl = vim_config['ca_cert']
if 'project_domain_name' in vim_config:
project_domain_name = vim_config['project_domain_name']
+ if 'project_domain_id' in vim_config:
+ project_domain_id = vim_config['project_domain_id']
if 'user_domain_name' in vim_config:
user_domain_name = vim_config['user_domain_name']
+ if 'user_domain_id' in vim_config:
+ user_domain_id = vim_config['user_domain_id']
+ if not project_domain_id and not project_domain_name:
+ project_domain_id = 'default'
+ if not user_domain_id and not user_domain_name:
+ user_domain_id = 'default'
auth = v3.Password(auth_url=creds['vim_url'],
username=creds['vim_user'],
password=creds['vim_password'],
project_name=creds['vim_tenant_name'],
project_domain_name=project_domain_name,
- user_domain_name=user_domain_name)
+ project_domain_id=project_domain_id,
+ user_domain_name=user_domain_name,
+ user_domain_id=user_domain_id)
return session.Session(auth=auth, verify=verify_ssl, timeout=10)