From f5718605d7aae67eb9b63e3d5fa3f2217ec9bdf2 Mon Sep 17 00:00:00 2001 From: Dileep Ranganathan Date: Thu, 26 Jul 2018 16:35:13 -0700 Subject: Remove EPA attribute Remove EPA property from multicloud as it is repaced by HPA attributes. Change-Id: I96e2ebcc60ac55cb0f0559607de919da410f66b1 Issue-ID: AAI-1150 Signed-off-by: Dileep Ranganathan --- share/newton_base/extensions/epacaps.py | 62 ----------------------- share/newton_base/extensions/extensions.py | 12 +---- share/newton_base/registration/registration.py | 70 -------------------------- share/newton_base/tests/mock_info.py | 11 ---- 4 files changed, 1 insertion(+), 154 deletions(-) delete mode 100644 share/newton_base/extensions/epacaps.py (limited to 'share/newton_base') diff --git a/share/newton_base/extensions/epacaps.py b/share/newton_base/extensions/epacaps.py deleted file mode 100644 index cc5420e5..00000000 --- a/share/newton_base/extensions/epacaps.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (c) 2017-2018 Wind River Systems, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import logging -import json -import traceback - -from keystoneauth1.exceptions import HttpError -from rest_framework import status -from rest_framework.response import Response -from rest_framework.views import APIView - -from common.exceptions import VimDriverNewtonException -from newton_base.util import VimDriverUtils -from common.msapi import extsys - -logger = logging.getLogger(__name__) - - -class EpaCaps(APIView): - - def __init__(self): - self.proxy_prefix = "multicloud" - self._logger = logger - - def get(self, request, vimid=""): - logger.debug("EpaCaps--get::data> %s" % request.data) - logger.debug("EpaCaps--get::vimid> %s" - % vimid) - try: - - vim = VimDriverUtils.get_vim_info(vimid) - caps_json = json.loads(vim['cloud_epa_caps']) - - cloud_owner, cloud_region_id = extsys.decode_vim_id(vimid) - content = { - "cloud-owner":cloud_owner, - "cloud-region-id":cloud_region_id, - "vimid":vimid, - "cloud-epa-caps": caps_json, - } - return Response(data=content, status=status.HTTP_200_OK) - except VimDriverNewtonException as e: - return Response(data={'error': e.content}, status=e.status_code) - except HttpError as e: - logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) - return Response(data=e.response.json(), status=e.http_status) - except Exception as e: - logger.error(traceback.format_exc()) - return Response(data={'error': str(e)}, - status=status.HTTP_500_INTERNAL_SERVER_ERROR) diff --git a/share/newton_base/extensions/extensions.py b/share/newton_base/extensions/extensions.py index a08da3e3..dd6ee55e 100644 --- a/share/newton_base/extensions/extensions.py +++ b/share/newton_base/extensions/extensions.py @@ -45,17 +45,7 @@ class Extensions(APIView): % vimid) try: cloud_owner, cloud_region_id = extsys.decode_vim_id(vimid) - registered_extensions = \ - [ - { - "alias": "epa-caps", - "description": "Multiple network support", - "name": "EPACapsQuery", - "url": self.proxy_prefix + "/%s/extensions/epa-caps" \ - % (vimid), - "spec": "" - } - ] + registered_extensions = [] content = { "cloud-owner":cloud_owner, diff --git a/share/newton_base/registration/registration.py b/share/newton_base/registration/registration.py index 4e536b8b..c3aaec24 100644 --- a/share/newton_base/registration/registration.py +++ b/share/newton_base/registration/registration.py @@ -537,72 +537,6 @@ class Registry(APIView): self._logger.error(traceback.format_exc()) return - 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: - resource_url = "/cloud-infrastructure/cloud-regions/cloud-region/%s/%s" \ - % (cloud_owner, cloud_region_id) - - # get cloud-region - retcode, content, status_code = \ - restcall.req_to_aai(resource_url, "GET") - - #add resource-version to url - if retcode == 0 and content: - content = json.JSONDecoder().decode(content) - #cloud_epa_caps["resource-version"] = content["resource-version"] - content.update(cloud_epa_caps) - cloud_epa_caps = content - - #update cloud-region - retcode, content, status_code = \ - restcall.req_to_aai(resource_url, "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, vimid="", viminfo=None): - try: - cloud_epa_caps_info = {} - cloud_extra_info_str = viminfo.get('cloud_extra_info') - if cloud_extra_info_str: - cloud_extra_info = json.loads(cloud_extra_info_str) - cloud_epa_caps_info.update(cloud_extra_info.get("epa-caps")) - - 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)) - - except VimDriverNewtonException as e: - self._logger.error("VimDriverNewtonException: status:%s, response:%s" % (e.http_status, e.content)) - return - except HttpError as e: - self._logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) - return - except Exception as e: - self._logger.error(traceback.format_exc()) - return - def _update_proxy_identity_endpoint(self, vimid): ''' update cloud_region's identity url @@ -624,7 +558,6 @@ class Registry(APIView): # add resource-version to url if retcode == 0 and content: viminfo = json.JSONDecoder().decode(content) - # cloud_epa_caps["resource-version"] = content["resource-version"] viminfo['identity-url'] = self.proxy_prefix + "/%s/identity/v2.0" % vimid retcode, content, status_code = \ @@ -690,9 +623,6 @@ class Registry(APIView): # discover all pservers self._discover_pservers(vimid, sess, viminfo) - # discover all epa resources, e.g. sriov pf and vf, etc. - self._discover_epa_resources(vimid, viminfo) - return Response(status=status.HTTP_202_ACCEPTED) except VimDriverNewtonException as e: diff --git a/share/newton_base/tests/mock_info.py b/share/newton_base/tests/mock_info.py index 0c7556ee..715708fa 100644 --- a/share/newton_base/tests/mock_info.py +++ b/share/newton_base/tests/mock_info.py @@ -29,17 +29,6 @@ MOCK_VIM_INFO = { 'cloud_owner': 'windriver-hudson-dc', 'cloud_region_id': 'RegionOne', 'cloud_extra_info': '', - 'cloud_epa_caps': - '{' - '"huge_page":"true",' - '"cpu_pinning":"true",' - '"cpu_thread_policy":"true",' - '"numa_aware":"true",' - '"sriov":"true",' - '"dpdk_vswitch":"true",' - '"rdt":"false",' - '"numa_locality_pci":"true"' - '}', 'insecure': 'True', } -- cgit 1.2.3-korg