diff options
author | Dileep Ranganathan <dileep.ranganathan@intel.com> | 2018-07-26 16:35:13 -0700 |
---|---|---|
committer | Dileep Ranganathan <dileep.ranganathan@intel.com> | 2018-07-30 06:31:55 -0700 |
commit | f5718605d7aae67eb9b63e3d5fa3f2217ec9bdf2 (patch) | |
tree | eb95244d9fee7beb6e928b626cc94722fc6fafe0 | |
parent | 0d3e9ace323660381350a884b08ed92aa2290dbd (diff) |
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 <dileep.ranganathan@intel.com>
35 files changed, 1 insertions, 623 deletions
diff --git a/newton/newton/extensions/tests/test_epacaps.py b/newton/newton/extensions/tests/test_epacaps.py deleted file mode 100644 index 0588f773..00000000 --- a/newton/newton/extensions/tests/test_epacaps.py +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (c) 2017 Intel Corporation. -# -# 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 json - -import mock -from django.test import Client -from rest_framework import status -import unittest - -from newton_base.tests import test_base -from newton_base.tests import mock_info -from newton_base.util import VimDriverUtils - - -class TestEpaCaps(unittest.TestCase): - def setUp(self): - self.client = Client() - - @mock.patch.object(VimDriverUtils, 'get_vim_info') - def test_get_epa_caps_info(self, mock_get_vim_info): - mock_get_vim_info.return_value = mock_info.MOCK_VIM_INFO - cloud_owner = "windriver-hudson-dc" - cloud_region_id = "RegionOne" - vimid = cloud_owner + "_" + cloud_region_id - - response = self.client.get( - "/api/%s/v0/%s/extensions/epa-caps" % ( - test_base.MULTIVIM_VERSION, - vimid)) - json_content = response.json() - - self.assertEquals(status.HTTP_200_OK, response.status_code) - self.assertEquals(4, len(json_content.keys())) - self.assertEquals(cloud_owner, json_content["cloud-owner"]) - self.assertEquals(cloud_region_id, - json_content["cloud-region-id"]) - self.assertEquals(vimid, json_content["vimid"]) - self.assertEquals( - json.loads(mock_info.MOCK_VIM_INFO['cloud_epa_caps']), - json_content["cloud-epa-caps"]) diff --git a/newton/newton/extensions/tests/test_extensions.py b/newton/newton/extensions/tests/test_extensions.py index ebdb2168..0a89c8b7 100644 --- a/newton/newton/extensions/tests/test_extensions.py +++ b/newton/newton/extensions/tests/test_extensions.py @@ -40,16 +40,3 @@ class TestExtensions(unittest.TestCase): self.assertEquals(cloud_region_id, json_content["cloud-region-id"]) self.assertEquals(vimid, json_content["vimid"]) - - self.assertEquals("epa-caps", - json_content["extensions"][0]["alias"]) - self.assertEquals("Multiple network support", - json_content["extensions"][0][ - "description"]) - self.assertEquals("EPACapsQuery", - json_content["extensions"][0]["name"]) - self.assertEquals( - "http://127.0.0.1:80/api/%s/v0/%s/extensions/epa-caps" % ( - test_base.MULTIVIM_VERSION, vimid), - json_content["extensions"][0]["url"]) - self.assertEquals("", json_content["extensions"][0]["spec"]) diff --git a/newton/newton/extensions/urls.py b/newton/newton/extensions/urls.py index ad61e1d9..41bac1b6 100644 --- a/newton/newton/extensions/urls.py +++ b/newton/newton/extensions/urls.py @@ -16,11 +16,9 @@ from django.conf.urls import url from rest_framework.urlpatterns import format_suffix_patterns from newton.extensions.views import extensions -from newton.extensions.views import epacaps urlpatterns = [ url(r'^sions/?$', extensions.Extensions.as_view()), - url(r'^sions/epa-caps/?$', epacaps.EpaCaps.as_view()), ] urlpatterns = format_suffix_patterns(urlpatterns) diff --git a/newton/newton/extensions/views/epacaps.py b/newton/newton/extensions/views/epacaps.py deleted file mode 100644 index 025d55df..00000000 --- a/newton/newton/extensions/views/epacaps.py +++ /dev/null @@ -1,33 +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 django.conf import settings - - -from newton_base.extensions import epacaps as newton_epacaps - -logger = logging.getLogger(__name__) - -# DEBUG=True - - -class EpaCaps(newton_epacaps.EpaCaps): - - def __init__(self): - self.proxy_prefix = settings.MULTICLOUD_PREFIX - self._logger = logger diff --git a/ocata/ocata/extensions/tests/test_epacaps.py b/ocata/ocata/extensions/tests/test_epacaps.py deleted file mode 100644 index 8120ba28..00000000 --- a/ocata/ocata/extensions/tests/test_epacaps.py +++ /dev/null @@ -1,67 +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 json - -import mock -from django.test import Client -from rest_framework import status -import unittest - -from newton_base.util import VimDriverUtils - -MOCK_VIM_INFO = { - "createTime": "2017-04-01 02:22:27", - "domain": "Default", - "name": "TiS_R4", - "password": "admin", - "tenant": "admin", - "type": "openstack", - "url": "http://128.224.180.14:5000/v3", - "userName": "admin", - "vendor": "WindRiver", - "version": "ocata", - "vimId": "windriver-hudson-dc_RegionOne", - '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', -} - - -class TestEpaCaps(unittest.TestCase): - def setUp(self): - self.client = Client() - - @mock.patch.object(VimDriverUtils, 'get_vim_info') - def test_get_epa_caps_info(self, mock_get_vim_info): - mock_get_vim_info.return_value = MOCK_VIM_INFO - cloud_owner = "windriver-hudson-dc" - cloud_region_id = "RegionOne" - vimid = cloud_owner + "_" + cloud_region_id - - response = self.client.get( - "/api/multicloud-ocata/v0/" + vimid + "/extensions/epa-caps") - json_content = response.json() - - self.assertEquals(status.HTTP_200_OK, response.status_code) - self.assertEquals(4, len(json_content.keys())) - self.assertEquals(cloud_owner, json_content["cloud-owner"]) - self.assertEquals(cloud_region_id, json_content["cloud-region-id"]) - self.assertEquals(vimid, json_content["vimid"]) - self.assertEquals(json.loads(MOCK_VIM_INFO['cloud_epa_caps']), - json_content["cloud-epa-caps"]) diff --git a/ocata/ocata/extensions/tests/test_extensions.py b/ocata/ocata/extensions/tests/test_extensions.py index 762f0015..2f584de5 100644 --- a/ocata/ocata/extensions/tests/test_extensions.py +++ b/ocata/ocata/extensions/tests/test_extensions.py @@ -36,10 +36,3 @@ class TestExtensions(unittest.TestCase): self.assertEquals(cloud_owner, json_content["cloud-owner"]) self.assertEquals(cloud_region_id, json_content["cloud-region-id"]) self.assertEquals(vimid, json_content["vimid"]) - - self.assertEquals("epa-caps", json_content["extensions"][0]["alias"]) - self.assertEquals("Multiple network support", json_content["extensions"][0]["description"]) - self.assertEquals("EPACapsQuery", json_content["extensions"][0]["name"]) - self.assertEquals("http://127.0.0.1:80/api/multicloud-ocata/v0/%s/extensions/epa-caps" % vimid, - json_content["extensions"][0]["url"]) - self.assertEquals("", json_content["extensions"][0]["spec"]) diff --git a/ocata/ocata/extensions/urls.py b/ocata/ocata/extensions/urls.py index 0e364e02..9cb3b697 100644 --- a/ocata/ocata/extensions/urls.py +++ b/ocata/ocata/extensions/urls.py @@ -16,11 +16,9 @@ from django.conf.urls import url from rest_framework.urlpatterns import format_suffix_patterns from ocata.extensions.views import extensions -from ocata.extensions.views import epacaps urlpatterns = [ url(r'^sions/?$', extensions.Extensions.as_view()), - url(r'^sions/epa-caps/?$', epacaps.EpaCaps.as_view()), ] urlpatterns = format_suffix_patterns(urlpatterns) diff --git a/ocata/ocata/extensions/views/epacaps.py b/ocata/ocata/extensions/views/epacaps.py deleted file mode 100644 index 025d55df..00000000 --- a/ocata/ocata/extensions/views/epacaps.py +++ /dev/null @@ -1,33 +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 django.conf import settings - - -from newton_base.extensions import epacaps as newton_epacaps - -logger = logging.getLogger(__name__) - -# DEBUG=True - - -class EpaCaps(newton_epacaps.EpaCaps): - - def __init__(self): - self.proxy_prefix = settings.MULTICLOUD_PREFIX - self._logger = logger diff --git a/ocata/ocata/proxy/tests/test_identity_proxy.py b/ocata/ocata/proxy/tests/test_identity_proxy.py index 185fe17f..0c844c7b 100644 --- a/ocata/ocata/proxy/tests/test_identity_proxy.py +++ b/ocata/ocata/proxy/tests/test_identity_proxy.py @@ -42,9 +42,6 @@ mock_viminfo = { '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', } diff --git a/ocata/ocata/proxy/tests/test_service_proxy.py b/ocata/ocata/proxy/tests/test_service_proxy.py index 3b784be3..83fe5241 100644 --- a/ocata/ocata/proxy/tests/test_service_proxy.py +++ b/ocata/ocata/proxy/tests/test_service_proxy.py @@ -38,9 +38,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', } diff --git a/ocata/ocata/vesagent/tests.py b/ocata/ocata/vesagent/tests.py index b170e025..9f34b3f5 100644 --- a/ocata/ocata/vesagent/tests.py +++ b/ocata/ocata/vesagent/tests.py @@ -39,7 +39,6 @@ MOCK_VIM_INFO = { 'cloud_owner': 'windriver-hudson-dc', 'cloud_region_id': 'RegionOne', 'cloud_extra_info': '{"vesagent_config":{"backlogs":[{"source":"onap-aaf","domain":"fault","type":"vm","tenant":"VIM"}],"poll_interval_default":10,"ves_subscription":{"username":"user","password":"password","endpoint":"http://127.0.0.1:9005/sample"}}}', - 'cloud_epa_caps': '', 'insecure': 'True', } diff --git a/ocata/ocata/vesagent/tests_tasks.py b/ocata/ocata/vesagent/tests_tasks.py index bd47133f..45fbea1b 100644 --- a/ocata/ocata/vesagent/tests_tasks.py +++ b/ocata/ocata/vesagent/tests_tasks.py @@ -42,7 +42,6 @@ MOCK_VIM_INFO = { 'cloud_owner': 'windriver-hudson-dc', 'cloud_region_id': 'RegionOne', 'cloud_extra_info': '{"vesagent_config":{"backlogs":[{"source":"onap-aaf","domain":"fault","type":"vm","tenant":"VIM"}],"poll_interval_default":10,"ves_subscription":{"username":"user","password":"password","endpoint":"http://127.0.0.1:9005/sample"}}}', - 'cloud_epa_caps': '', 'insecure': 'True', } diff --git a/ocata/vagrant/test/extsys.py b/ocata/vagrant/test/extsys.py index 5de88155..db6088ed 100644 --- a/ocata/vagrant/test/extsys.py +++ b/ocata/vagrant/test/extsys.py @@ -38,9 +38,6 @@ tisr4 = { 'cloud_owner':'openstack-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', } @@ -104,7 +101,6 @@ def get_vim_by_id(vim_id): viminfo['name'] = tmp_viminfo['complex-name'] viminfo['version'] = tmp_viminfo['cloud-region-version'] viminfo['cloud_extra_info'] = tmp_viminfo['cloud-extra-info'] - viminfo['cloud_epa_caps'] = tmp_viminfo['cloud-epa-caps'] if tmp_authinfo: viminfo['userName'] = tmp_authinfo['user-name'] diff --git a/ocata/vagrant/test/test-extensions.sh b/ocata/vagrant/test/test-extensions.sh index 65fc0d1f..305a5a39 100644 --- a/ocata/vagrant/test/test-extensions.sh +++ b/ocata/vagrant/test/test-extensions.sh @@ -3,4 +3,3 @@ set -ex MULTICLOUD_PLUGIN_ENDPOINT=http://172.16.77.40:9006/api/multicloud-ocata/v0/openstack-hudson-dc_RegionOne curl -v -s -H "Content-Type: application/json" -X GET $MULTICLOUD_PLUGIN_ENDPOINT/extensions -curl -v -s -H "Content-Type: application/json" -X GET $MULTICLOUD_PLUGIN_ENDPOINT/extensions/epa-caps diff --git a/pike/pike/extensions/tests/test_epacaps.py b/pike/pike/extensions/tests/test_epacaps.py deleted file mode 100644 index 40f8d3a7..00000000 --- a/pike/pike/extensions/tests/test_epacaps.py +++ /dev/null @@ -1,67 +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 json - -import mock -from django.test import Client -from rest_framework import status -import unittest - -from newton_base.util import VimDriverUtils - -MOCK_VIM_INFO = { - "createTime": "2017-04-01 02:22:27", - "domain": "Default", - "name": "TiS_R4", - "password": "admin", - "tenant": "admin", - "type": "openstack", - "url": "http://128.224.180.14:5000/v3", - "userName": "admin", - "vendor": "WindRiver", - "version": "pike", - "vimId": "windriver-hudson-dc_RegionOne", - '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', -} - - -class TestEpaCaps(unittest.TestCase): - def setUp(self): - self.client = Client() - - @mock.patch.object(VimDriverUtils, 'get_vim_info') - def test_get_epa_caps_info(self, mock_get_vim_info): - mock_get_vim_info.return_value = MOCK_VIM_INFO - cloud_owner = "windriver-hudson-dc" - cloud_region_id = "RegionOne" - vimid = cloud_owner + "_" + cloud_region_id - - response = self.client.get( - "/api/multicloud-pike/v0/" + vimid + "/extensions/epa-caps") - json_content = response.json() - - self.assertEquals(status.HTTP_200_OK, response.status_code) - self.assertEquals(4, len(json_content.keys())) - self.assertEquals(cloud_owner, json_content["cloud-owner"]) - self.assertEquals(cloud_region_id, json_content["cloud-region-id"]) - self.assertEquals(vimid, json_content["vimid"]) - self.assertEquals(json.loads(MOCK_VIM_INFO['cloud_epa_caps']), - json_content["cloud-epa-caps"]) diff --git a/pike/pike/extensions/tests/test_extensions.py b/pike/pike/extensions/tests/test_extensions.py index 3842d4b7..0dd45959 100644 --- a/pike/pike/extensions/tests/test_extensions.py +++ b/pike/pike/extensions/tests/test_extensions.py @@ -36,10 +36,3 @@ class TestExtensions(unittest.TestCase): self.assertEquals(cloud_owner, json_content["cloud-owner"]) self.assertEquals(cloud_region_id, json_content["cloud-region-id"]) self.assertEquals(vimid, json_content["vimid"]) - - self.assertEquals("epa-caps", json_content["extensions"][0]["alias"]) - self.assertEquals("Multiple network support", json_content["extensions"][0]["description"]) - self.assertEquals("EPACapsQuery", json_content["extensions"][0]["name"]) - self.assertEquals("http://127.0.0.1:80/api/multicloud-pike/v0/%s/extensions/epa-caps" % vimid, - json_content["extensions"][0]["url"]) - self.assertEquals("", json_content["extensions"][0]["spec"]) diff --git a/pike/pike/extensions/urls.py b/pike/pike/extensions/urls.py index 545dec98..b8e977c1 100644 --- a/pike/pike/extensions/urls.py +++ b/pike/pike/extensions/urls.py @@ -16,11 +16,9 @@ from django.conf.urls import url from rest_framework.urlpatterns import format_suffix_patterns from pike.extensions.views import extensions -from pike.extensions.views import epacaps urlpatterns = [ url(r'^sions/?$', extensions.Extensions.as_view()), - url(r'^sions/epa-caps/?$', epacaps.EpaCaps.as_view()), ] urlpatterns = format_suffix_patterns(urlpatterns) diff --git a/pike/pike/extensions/views/epacaps.py b/pike/pike/extensions/views/epacaps.py deleted file mode 100644 index 025d55df..00000000 --- a/pike/pike/extensions/views/epacaps.py +++ /dev/null @@ -1,33 +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 django.conf import settings - - -from newton_base.extensions import epacaps as newton_epacaps - -logger = logging.getLogger(__name__) - -# DEBUG=True - - -class EpaCaps(newton_epacaps.EpaCaps): - - def __init__(self): - self.proxy_prefix = settings.MULTICLOUD_PREFIX - self._logger = logger diff --git a/pike/vagrant/test/extsys.py b/pike/vagrant/test/extsys.py index 78b41387..1d930b84 100644 --- a/pike/vagrant/test/extsys.py +++ b/pike/vagrant/test/extsys.py @@ -38,9 +38,6 @@ tisr4 = { 'cloud_owner':'openstack-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', } @@ -104,7 +101,6 @@ def get_vim_by_id(vim_id): viminfo['name'] = tmp_viminfo['complex-name'] viminfo['version'] = tmp_viminfo['cloud-region-version'] viminfo['cloud_extra_info'] = tmp_viminfo['cloud-extra-info'] - viminfo['cloud_epa_caps'] = tmp_viminfo['cloud-epa-caps'] if tmp_authinfo: viminfo['userName'] = tmp_authinfo['user-name'] diff --git a/pike/vagrant/test/test-extensions.sh b/pike/vagrant/test/test-extensions.sh index 82c254a8..215c3fc3 100644 --- a/pike/vagrant/test/test-extensions.sh +++ b/pike/vagrant/test/test-extensions.sh @@ -3,4 +3,3 @@ set -ex MULTICLOUD_PLUGIN_ENDPOINT=http://172.16.77.40:9007/api/multicloud-pike/v0/openstack-hudson-dc_RegionOne curl -v -s -H "Content-Type: application/json" -X GET $MULTICLOUD_PLUGIN_ENDPOINT/extensions -curl -v -s -H "Content-Type: application/json" -X GET $MULTICLOUD_PLUGIN_ENDPOINT/extensions/epa-caps diff --git a/share/common/msapi/extsys.py b/share/common/msapi/extsys.py index 626a38fc..772a526e 100644 --- a/share/common/msapi/extsys.py +++ b/share/common/msapi/extsys.py @@ -61,7 +61,6 @@ def get_vim_by_id(vim_id): viminfo['name'] = tmp_viminfo.get('complex-name') viminfo['version'] = tmp_viminfo.get('cloud-region-version') viminfo['cloud_extra_info'] = tmp_viminfo.get('cloud-extra-info') - viminfo['cloud_epa_caps'] = tmp_viminfo.get('cloud-epa-caps') viminfo['userName'] = tmp_authinfo['user-name'] viminfo['password'] = tmp_authinfo['password'] 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', } diff --git a/windriver/titanium_cloud/extensions/tests/test_epacaps.py b/windriver/titanium_cloud/extensions/tests/test_epacaps.py deleted file mode 100644 index 6b938da1..00000000 --- a/windriver/titanium_cloud/extensions/tests/test_epacaps.py +++ /dev/null @@ -1,67 +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 json - -import mock -from django.test import Client -from rest_framework import status -import unittest - -from newton_base.util import VimDriverUtils - -MOCK_VIM_INFO = { - "createTime": "2017-04-01 02:22:27", - "domain": "Default", - "name": "TiS_R4", - "password": "admin", - "tenant": "admin", - "type": "openstack", - "url": "http://128.224.180.14:5000/v3", - "userName": "admin", - "vendor": "WindRiver", - "version": "titanium_cloud", - "vimId": "windriver-hudson-dc_RegionOne", - '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', -} - - -class TestEpaCaps(unittest.TestCase): - def setUp(self): - self.client = Client() - - @mock.patch.object(VimDriverUtils, 'get_vim_info') - def test_get_epa_caps_info(self, mock_get_vim_info): - mock_get_vim_info.return_value = MOCK_VIM_INFO - cloud_owner = "windriver-hudson-dc" - cloud_region_id = "RegionOne" - vimid = cloud_owner + "_" + cloud_region_id - - response = self.client.get( - "/api/multicloud-titanium_cloud/v0/" + vimid + "/extensions/epa-caps") - json_content = response.json() - - self.assertEquals(status.HTTP_200_OK, response.status_code) - self.assertEquals(4, len(json_content.keys())) - self.assertEquals(cloud_owner, json_content["cloud-owner"]) - self.assertEquals(cloud_region_id, json_content["cloud-region-id"]) - self.assertEquals(vimid, json_content["vimid"]) - self.assertEquals(json.loads(MOCK_VIM_INFO['cloud_epa_caps']), - json_content["cloud-epa-caps"]) diff --git a/windriver/titanium_cloud/extensions/tests/test_extensions.py b/windriver/titanium_cloud/extensions/tests/test_extensions.py index f0dae164..1ab792b9 100644 --- a/windriver/titanium_cloud/extensions/tests/test_extensions.py +++ b/windriver/titanium_cloud/extensions/tests/test_extensions.py @@ -37,9 +37,5 @@ class TestExtensions(unittest.TestCase): self.assertEquals(cloud_region_id, json_content["cloud-region-id"]) self.assertEquals(vimid, json_content["vimid"]) - self.assertEquals("epa-caps", json_content["extensions"][0]["alias"]) self.assertEquals("Multiple network support", json_content["extensions"][0]["description"]) - self.assertEquals("EPACapsQuery", json_content["extensions"][0]["name"]) - self.assertEquals("http://127.0.0.1:80/api/multicloud-titanium_cloud/v0/%s/extensions/epa-caps" % vimid, - json_content["extensions"][0]["url"]) self.assertEquals("", json_content["extensions"][0]["spec"]) diff --git a/windriver/titanium_cloud/extensions/urls.py b/windriver/titanium_cloud/extensions/urls.py index 891faeb4..3bcf9a4c 100644 --- a/windriver/titanium_cloud/extensions/urls.py +++ b/windriver/titanium_cloud/extensions/urls.py @@ -16,11 +16,9 @@ from django.conf.urls import url from rest_framework.urlpatterns import format_suffix_patterns from titanium_cloud.extensions.views import extensions -from titanium_cloud.extensions.views import epacaps urlpatterns = [ url(r'^sions/?$', extensions.Extensions.as_view()), - url(r'^sions/epa-caps/?$', epacaps.EpaCaps.as_view()), ] urlpatterns = format_suffix_patterns(urlpatterns) diff --git a/windriver/titanium_cloud/extensions/views/epacaps.py b/windriver/titanium_cloud/extensions/views/epacaps.py deleted file mode 100644 index 025d55df..00000000 --- a/windriver/titanium_cloud/extensions/views/epacaps.py +++ /dev/null @@ -1,33 +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 django.conf import settings - - -from newton_base.extensions import epacaps as newton_epacaps - -logger = logging.getLogger(__name__) - -# DEBUG=True - - -class EpaCaps(newton_epacaps.EpaCaps): - - def __init__(self): - self.proxy_prefix = settings.MULTICLOUD_PREFIX - self._logger = logger diff --git a/windriver/titanium_cloud/extensions/views/extensions.py b/windriver/titanium_cloud/extensions/views/extensions.py index 2cd91bf5..cfdc2517 100644 --- a/windriver/titanium_cloud/extensions/views/extensions.py +++ b/windriver/titanium_cloud/extensions/views/extensions.py @@ -45,13 +45,6 @@ class Extensions(newton_extensions.Extensions): registered_extensions = \ [ { - "alias": "epa-caps", - "description": "Multiple network support", - "name": "EPACapsQuery", - "url": self.proxy_prefix + "/%s/extensions/epa-caps" % (vimid), - "spec": "" - }, - { "alias": "guest-monitor", "description": "Multiple network support", "name": "Guest Monitor", diff --git a/windriver/titanium_cloud/proxy/tests/test_identity_proxy.py b/windriver/titanium_cloud/proxy/tests/test_identity_proxy.py index 81231220..a3b84f9a 100644 --- a/windriver/titanium_cloud/proxy/tests/test_identity_proxy.py +++ b/windriver/titanium_cloud/proxy/tests/test_identity_proxy.py @@ -42,9 +42,6 @@ mock_viminfo = { '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', } diff --git a/windriver/titanium_cloud/proxy/tests/test_service_proxy.py b/windriver/titanium_cloud/proxy/tests/test_service_proxy.py index f9a9af40..7a838bce 100644 --- a/windriver/titanium_cloud/proxy/tests/test_service_proxy.py +++ b/windriver/titanium_cloud/proxy/tests/test_service_proxy.py @@ -38,9 +38,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', } diff --git a/windriver/titanium_cloud/registration/tests/test_registration2.py b/windriver/titanium_cloud/registration/tests/test_registration2.py index b15beb21..a9c034a8 100644 --- a/windriver/titanium_cloud/registration/tests/test_registration2.py +++ b/windriver/titanium_cloud/registration/tests/test_registration2.py @@ -46,17 +46,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', } diff --git a/windriver/titanium_cloud/vesagent/tests.py b/windriver/titanium_cloud/vesagent/tests.py index a98177b2..42d76950 100644 --- a/windriver/titanium_cloud/vesagent/tests.py +++ b/windriver/titanium_cloud/vesagent/tests.py @@ -41,7 +41,6 @@ MOCK_VIM_INFO = { 'cloud_owner': 'windriver-hudson-dc', 'cloud_region_id': 'RegionOne', 'cloud_extra_info': '{"vesagent_config":{"backlogs":[{"source":"onap-aaf","domain":"fault","type":"vm","tenant":"VIM"}],"poll_interval_default":10,"ves_subscription":{"username":"user","password":"password","endpoint":"http://127.0.0.1:9005/sample"}}}', - 'cloud_epa_caps': '', 'insecure': 'True', } diff --git a/windriver/titanium_cloud/vesagent/tests_tasks.py b/windriver/titanium_cloud/vesagent/tests_tasks.py index 541a5651..fef8e8ee 100644 --- a/windriver/titanium_cloud/vesagent/tests_tasks.py +++ b/windriver/titanium_cloud/vesagent/tests_tasks.py @@ -42,7 +42,6 @@ MOCK_VIM_INFO = { 'cloud_owner': 'windriver-hudson-dc', 'cloud_region_id': 'RegionOne', 'cloud_extra_info': '{"vesagent_config":{"backlogs":[{"source":"onap-aaf","domain":"fault","type":"vm","tenant":"VIM"}],"poll_interval_default":10,"ves_subscription":{"username":"user","password":"password","endpoint":"http://127.0.0.1:9005/sample"}}}', - 'cloud_epa_caps': '', 'insecure': 'True', } |