summaryrefslogtreecommitdiffstats
path: root/newton
diff options
context:
space:
mode:
Diffstat (limited to 'newton')
-rw-r--r--newton/newton/extensions/views/epacaps.py2
-rw-r--r--newton/newton/pub/msapi/extsys.py5
-rw-r--r--newton/newton/registration/views/registration.py39
3 files changed, 42 insertions, 4 deletions
diff --git a/newton/newton/extensions/views/epacaps.py b/newton/newton/extensions/views/epacaps.py
index 7d3dd0af..ef8aabed 100644
--- a/newton/newton/extensions/views/epacaps.py
+++ b/newton/newton/extensions/views/epacaps.py
@@ -17,8 +17,6 @@ import traceback
from django.core.cache import cache
-from keystoneauth1 import access
-from keystoneauth1.access import service_catalog
from keystoneauth1.exceptions import HttpError
from rest_framework import status
from rest_framework.response import Response
diff --git a/newton/newton/pub/msapi/extsys.py b/newton/newton/pub/msapi/extsys.py
index 57beb0e9..76066991 100644
--- a/newton/newton/pub/msapi/extsys.py
+++ b/newton/newton/pub/msapi/extsys.py
@@ -37,7 +37,8 @@ def get_vim_by_id(vim_id):
#assume esr-system-info-id is composed by {cloud-owner} _ {cloud-region-id}
retcode2,content2,status_code2 = \
- req_to_aai("/cloud-infrastructure/esr-system-info/%s/%s/%s_%s" \
+ req_to_aai("/cloud-infrastructure/cloud-regions/cloud-region/%s/%s"
+ + "/esr-system-info-list/esr-system-info/%s_%s" \
% (cloud_owner,cloud_region_id,cloud_owner,cloud_region_id),
"GET")
if retcode2 != 0:
@@ -64,7 +65,7 @@ def get_vim_by_id(vim_id):
viminfo['userName'] = tmp_authinfo['user-name']
viminfo['password'] = tmp_authinfo['password']
viminfo['domain'] = tmp_authinfo['cloud-domain']
- viminfo['url'] = tmp_authinfo['url']
+ viminfo['url'] = tmp_authinfo['service-url']
viminfo['tenant'] = tmp_authinfo['default-tenant']
viminfo['cacert'] = tmp_authinfo['ssl-cacert']
viminfo['insecure'] = tmp_authinfo['ssl-insecure']
diff --git a/newton/newton/registration/views/registration.py b/newton/newton/registration/views/registration.py
index 96d1864e..fa388b73 100644
--- a/newton/newton/registration/views/registration.py
+++ b/newton/newton/registration/views/registration.py
@@ -602,7 +602,46 @@ class Registry(APIView):
pass
+ def update_epa_caps(self, cloud_owner, cloud_region_id, epa_caps_info):
+ '''
+ populate cloud EPA Capabilities information into AAI
+ :param cloud_owner:
+ :param cloud_region_id:
+ :param epa_caps_info: dict of meta data about cloud-region's epa caps
+
+ :return:
+ '''
+
+ cloud_epa_caps = {
+ 'cloud-epa-caps': json.dumps(epa_caps_info),
+ }
+
+ if cloud_owner and cloud_region_id:
+ retcode, content, status_code = \
+ req_to_aai("/cloud-infrastructure/cloud-regions/cloud-region/%s/%s/"
+ % (cloud_owner, cloud_region_id, ), "PUT", content=cloud_epa_caps)
+
+ self._logger.debug(
+ "update_epa_caps,vimid:%s_%s req_to_aai: update cloud-epa-caps, return %s, %s, %s"
+ % (cloud_owner,cloud_region_id, retcode, content, status_code))
+
+ return retcode
+ return 1 # unknown cloud owner,region_id
+
def discover_epa_resources(self, request, vimid="", session=None, viminfo=None):
+ cloud_epa_caps_info = {}
+ cloud_extra_info = viminfo.get('cloud_extra_info')
+ if cloud_extra_info:
+ cloud_epa_caps_info.update(json.loads(cloud_extra_info))
+ pass
+
+ cloud_owner, cloud_region_id = extsys.decode_vim_id(vimid)
+ ret = self.update_epa_caps(cloud_owner, cloud_region_id, cloud_epa_caps_info)
+ if ret != 0:
+ # failed to update image
+ self._logger.debug("failed to populate EPA CAPs info into AAI: %s, ret:%s"
+ % (vimid, ret))
+
pass
def update_proxy_identity_endpoint(self, cloud_owner, cloud_region_id, url):