# contact: helena.mcgough@intel.com or adrian.hoban@intel.com
##
"""Common methods for the OpenStack plugins."""
-
+import json
import logging
import requests
+import yaml
from keystoneclient.v3 import client
from osm_mon.core.auth import AuthManager
username=creds.user,
password=creds.password,
tenant_name=creds.tenant_name)
+ endpoint_type = 'publicURL'
+ region_name = 'RegionOne'
+ if creds.config is not None:
+ try:
+ config = json.loads(creds.config)
+ except ValueError:
+ config = yaml.safe_load(creds.config)
+ if 'endpoint_type' in config:
+ endpoint_type = config['endpoint_type']
+ if 'region_name' in config:
+ region_name = config['region_name']
+
return ks.service_catalog.url_for(
service_type=service_type,
- endpoint_type='publicURL',
- region_name='RegionOne')
+ endpoint_type=endpoint_type,
+ region_name=region_name)
@staticmethod
def perform_request(url, auth_token,