diff options
author | Haibin Huang <haibin.huang@intel.com> | 2019-01-15 10:48:42 +0800 |
---|---|---|
committer | Haibin Huang <haibin.huang@intel.com> | 2019-01-15 10:54:08 +0800 |
commit | 349f57f1fe6b7096be88baaac9a1cb7491da9955 (patch) | |
tree | 8ab677a0046770851d29ce1bdaaf4dfd59066636 /ocata | |
parent | fada10352ff098d7e5b844b8c48aec08929d7820 (diff) |
Fix proxy pep8 error for ocata
This patch is only fixing the pep8 issues under the proxy
folder for ocata release, which is only triggered by tox mannually.
Change-Id: I0f6c78afc5eca9114c2c388e8d7001fe4daef9b2
Issue-ID: MULTICLOUD-434
Signed-off-by: Haibin Huang <haibin.huang@intel.com>
Diffstat (limited to 'ocata')
-rw-r--r-- | ocata/ocata/proxy/__init__.py | 1 | ||||
-rw-r--r-- | ocata/ocata/proxy/tests/__init__.py | 1 | ||||
-rw-r--r-- | ocata/ocata/proxy/tests/test_identity_proxy.py | 913 | ||||
-rw-r--r-- | ocata/ocata/proxy/tests/test_service_proxy.py | 1361 | ||||
-rw-r--r-- | ocata/ocata/proxy/views/__init__.py | 1 | ||||
-rw-r--r-- | ocata/ocata/proxy/views/identityV3.py | 35 | ||||
-rw-r--r-- | ocata/ocata/proxy/views/services.py | 35 |
7 files changed, 1169 insertions, 1178 deletions
diff --git a/ocata/ocata/proxy/__init__.py b/ocata/ocata/proxy/__init__.py index afa702d3..ae1ce9db 100644 --- a/ocata/ocata/proxy/__init__.py +++ b/ocata/ocata/proxy/__init__.py @@ -11,4 +11,3 @@ # 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. - diff --git a/ocata/ocata/proxy/tests/__init__.py b/ocata/ocata/proxy/tests/__init__.py index afa702d3..ae1ce9db 100644 --- a/ocata/ocata/proxy/tests/__init__.py +++ b/ocata/ocata/proxy/tests/__init__.py @@ -11,4 +11,3 @@ # 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. - diff --git a/ocata/ocata/proxy/tests/test_identity_proxy.py b/ocata/ocata/proxy/tests/test_identity_proxy.py index 0c844c7b..777f9fa2 100644 --- a/ocata/ocata/proxy/tests/test_identity_proxy.py +++ b/ocata/ocata/proxy/tests/test_identity_proxy.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2018 Wind River Systems, Inc. +# Copyright (c) 2018 Intel Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,11 +20,7 @@ import unittest from django.test import Client from rest_framework import status -from keystoneauth1 import session -from keystoneauth1.exceptions import HttpError - from newton_base.util import VimDriverUtils -from ocata.proxy.views.identityV3 import Tokens from newton_base.tests import mock_info mock_viminfo = { @@ -39,457 +35,457 @@ mock_viminfo = { "vendor": "WindRiver", "version": "ocata", "vimId": "windriver-hudson-dc_RegionOne", - 'cloud_owner':'windriver-hudson-dc', - 'cloud_region_id':'RegionOne', - 'cloud_extra_info':'', - 'insecure':'True', + 'cloud_owner': 'windriver-hudson-dc', + 'cloud_region_id': 'RegionOne', + 'cloud_extra_info': '', + 'insecure': 'True', } -mock_token_id="1a62b3971d774404a504c5d9a3e506e3" +mock_token_id = "1a62b3971d774404a504c5d9a3e506e3" mock_catalog_response = { - "catalog" : [ - { - "id" : "99aefcc82a9246f98f8c281e61ffc754", - "endpoints" : [ - { - "region" : "RegionOne", - "url" : "http://128.224.180.14:9696", - "id" : "39583c1508ad4b71b380570a745ee10a", - "interface" : "public", - "region_id" : "RegionOne" - }, - { - "url" : "http://192.168.204.2:9696", - "region" : "RegionOne", - "id" : "37e8d07ba24e4b8f93490c9daaba06e2", - "interface" : "internal", - "region_id" : "RegionOne" - }, - { - "interface" : "admin", - "id" : "7eee4ca98d444b1abb00a50d4b89373f", - "region_id" : "RegionOne", - "region" : "RegionOne", - "url" : "http://192.168.204.2:9696" - } - ], - "name" : "neutron", - "type" : "network" - }, - { - "endpoints" : [ - { - "interface" : "public", - "id" : "10496738fa374295a4a88a63b81a1589", - "region_id" : "RegionOne", - "url" : "http://128.224.180.14:8777", - "region" : "RegionOne" - }, - { - "id" : "02dcb8c0bd464c4489fa0a0c9f28571f", - "region_id" : "RegionOne", - "interface" : "internal", - "url" : "http://192.168.204.2:8777", - "region" : "RegionOne" - }, - { - "region_id" : "RegionOne", - "id" : "8a73b0d3743b4e78b87614690f6e97fe", - "interface" : "admin", - "url" : "http://192.168.204.2:8777", - "region" : "RegionOne" - } - ], - "id" : "d131054da83f4c93833799747a0f4709", - "name" : "ceilometer", - "type" : "metering" - }, - { - "type" : "volumev2", - "name" : "cinderv2", - "endpoints" : [ - { - "id" : "35a67ad36f0447d19c9662babf7cf609", - "interface" : "public", - "region_id" : "RegionOne", - "url" : "http://128.224.180.14:8776/v2/fcca3cc49d5e42caae15459e27103efc", - "region" : "RegionOne" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:8776/v2/fcca3cc49d5e42caae15459e27103efc", - "id" : "c6ea42052268420fa2c8d351ee68c922", - "interface" : "internal", - "region_id" : "RegionOne" - }, - { - "region_id" : "RegionOne", - "id" : "91cb24853dc3450d847b0c286a2e44ea", - "interface" : "admin", - "region" : "RegionOne", - "url" : "http://192.168.204.2:8776/v2/fcca3cc49d5e42caae15459e27103efc" - } - ], - "id" : "40440057102440739c30be10a66bc5d1" - }, - { - "name" : "heat", - "type" : "orchestration", - "id" : "35300cce88db4bd4bb5a72ffe3b88b00", - "endpoints" : [ - { - "id" : "58999d7b4a94439089ecfb2aca2d7f6c", - "region_id" : "RegionOne", - "interface" : "public", - "region" : "RegionOne", - "url" : "http://128.224.180.14:8004/v1/fcca3cc49d5e42caae15459e27103efc" - }, - { - "url" : "http://192.168.204.2:8004/v1/fcca3cc49d5e42caae15459e27103efc", - "region" : "RegionOne", - "interface" : "internal", - "id" : "1e0ee1a2aef84802b921d422372a567e", - "region_id" : "RegionOne" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:8004/v1/fcca3cc49d5e42caae15459e27103efc", - "id" : "17661bf4859741b8a43a461dedad1871", - "region_id" : "RegionOne", - "interface" : "admin" - } - ] - }, - { - "id" : "08dc6912aea64c01925012c8a6df250a", - "endpoints" : [ - { - "id" : "02792c4eed77486083f9b2e52d7b94b0", - "region_id" : "RegionOne", - "interface" : "public", - "region" : "RegionOne", - "url" : "http://128.224.180.14:5000/v3" - }, - { - "id" : "b6d5cad394b94309ae40d8de88059c5f", - "region_id" : "RegionOne", - "interface" : "internal", - "url" : "http://192.168.204.2:5000/v3", - "region" : "RegionOne" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:35357/v3", - "region_id" : "RegionOne", - "id" : "1f18e2b7c6a34493b86853b65917888e", - "interface" : "admin" - } - ], - "type" : "identity", - "name" : "keystone" - }, - { - "name" : "vim", - "type" : "nfv", - "endpoints" : [ - { - "url" : "http://128.224.180.14:4545", - "region" : "RegionOne", - "id" : "b33e317345e4480ab0786e4960995ec9", - "interface" : "public", - "region_id" : "RegionOne" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:4545", - "interface" : "internal", - "id" : "03c85828d5bf432ab04831aa65ac9c52", - "region_id" : "RegionOne" - }, - { - "id" : "067983abb061476cb53a9e23a740d98f", - "region_id" : "RegionOne", - "interface" : "admin", - "url" : "http://192.168.204.2:4545", - "region" : "RegionOne" - } - ], - "id" : "01636c856fc84988b38b9117eb4a8021" - }, - { - "name" : "aodh", - "type" : "alarming", - "id" : "eb269151d0e44744a5b5449657bdc61c", - "endpoints" : [ - { - "id" : "5bfc6c056e0244c493642eb82f6aaa11", - "region_id" : "RegionOne", - "interface" : "public", - "url" : "http://128.224.180.14:8042", - "region" : "RegionOne" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:8042", - "region_id" : "RegionOne", - "id" : "ad69c7f76dce4089a195b9221ddbfb44", - "interface" : "internal" - }, - { - "interface" : "admin", - "id" : "3e8fcdfa7bcb40b0ae33c282adfcc9ff", - "region_id" : "RegionOne", - "region" : "RegionOne", - "url" : "http://192.168.204.2:8042" - } - ] - }, - { - "name" : "sysinv", - "type" : "platform", - "endpoints" : [ - { - "region" : "RegionOne", - "url" : "http://128.224.180.14:6385/v1", - "interface" : "public", - "id" : "ba4ba8104590421b84672306c7e0e1f1", - "region_id" : "RegionOne" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:6385/v1", - "interface" : "internal", - "id" : "a1cba34b163f496ab1acd6e9b51e39a2", - "region_id" : "RegionOne" - }, - { - "url" : "http://192.168.204.2:6385/v1", - "region" : "RegionOne", - "id" : "7c171210a2c841a6a52a5713e316d6fc", - "interface" : "admin", - "region_id" : "RegionOne" - } - ], - "id" : "256bbad671f946fea543e6bd71f98875" - }, - { - "id" : "e84665dcce814c05b4c5084964547534", - "endpoints" : [ - { - "url" : "http://128.224.180.14:8000/v1/fcca3cc49d5e42caae15459e27103efc", - "region" : "RegionOne", - "region_id" : "RegionOne", - "id" : "b2ed1a23dc6944bea129c20861e0286a", - "interface" : "public" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:8000/v1/fcca3cc49d5e42caae15459e27103efc", - "interface" : "internal", - "id" : "c4df7c6bc15646848eff35caf6ffea8e", - "region_id" : "RegionOne" - }, - { - "region_id" : "RegionOne", - "id" : "61b3dabb761443a89ab549f437c05ab0", - "interface" : "admin", - "region" : "RegionOne", - "url" : "http://192.168.204.2:8000/v1/fcca3cc49d5e42caae15459e27103efc" - } - ], - "name" : "heat-cfn", - "type" : "cloudformation" - }, - { - "id" : "823024424a014981a3721229491c0b1a", - "endpoints" : [ - { - "region" : "RegionOne", - "url" : "http://128.224.180.14:8776/v1/fcca3cc49d5e42caae15459e27103efc", - "region_id" : "RegionOne", - "id" : "4a52e4e54ff440789f9a797919c4a0f2", - "interface" : "public" - }, - { - "url" : "http://192.168.204.2:8776/v1/fcca3cc49d5e42caae15459e27103efc", - "region" : "RegionOne", - "id" : "d4f9a84476524a39844f0fce63f1022e", - "region_id" : "RegionOne", - "interface" : "internal" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:8776/v1/fcca3cc49d5e42caae15459e27103efc", - "interface" : "admin", - "id" : "81bf3810a8cc4697b68c6e93b5b8fe1f", - "region_id" : "RegionOne" - } - ], - "type" : "volume", - "name" : "cinder" - }, - { - "name" : "glance", - "type" : "image", - "endpoints" : [ - { - "id" : "bd930aba961946cfb1401bada56d55e3", - "region_id" : "RegionOne", - "interface" : "public", - "region" : "RegionOne", - "url" : "http://128.224.180.14:9292" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:9292", - "id" : "c11da585f0b141b99d1e18bb9a607beb", - "region_id" : "RegionOne", - "interface" : "internal" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:9292", - "id" : "31b26c625a6a4fc7910dc5935155996e", - "interface" : "admin", - "region_id" : "RegionOne" - } - ], - "id" : "3b78cf039bc54d1bbb99ab3a4be15ef1" - }, - { - "id" : "b8701374bf254de1beee8a2c9ecc6b33", - "endpoints" : [ - { - "region_id" : "RegionOne", - "id" : "f7407f330c8b4577b1d377d3fab9c2f8", - "interface" : "public", - "region" : "RegionOne", - "url" : "http://128.224.180.14:15491" - }, - { - "url" : "http://192.168.204.2:5491", - "region" : "RegionOne", - "interface" : "internal", - "id" : "0b37ce31a32f4b6fa5e1aa0d6c20680f", - "region_id" : "RegionOne" - }, - { - "region_id" : "RegionOne", - "id" : "7b87ea72adf245e1991e9e0df29b7ea9", - "interface" : "admin", - "region" : "RegionOne", - "url" : "http://192.168.204.2:5491" - } - ], - "type" : "patching", - "name" : "patching" - }, - { - "id" : "0ec0923a58f04ffeb6fced3bbc5c0947", - "endpoints" : [ - { - "url" : "http://128.224.180.14:8774/v2.1/fcca3cc49d5e42caae15459e27103efc", - "region" : "RegionOne", - "id" : "13168b12da17451fb39630de67db168f", - "region_id" : "RegionOne", - "interface" : "public" - }, - { - "id" : "22dd6a44209f42d986b82e3aa6535f82", - "interface" : "internal", - "region_id" : "RegionOne", - "region" : "RegionOne", - "url" : "http://192.168.204.2:8774/v2.1/fcca3cc49d5e42caae15459e27103efc" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:8774/v2.1/fcca3cc49d5e42caae15459e27103efc", - "id" : "552a991ae501492f841c1b6e2ff38fc5", - "region_id" : "RegionOne", - "interface" : "admin" - } - ], - "type" : "compute", - "name" : "nova" - }, - { - "id" : "50b219650f1049b097b3f14e8c70cdf8", - "endpoints" : [ - { - "interface" : "public", - "id" : "5a4276cd6e4d43e883cf8640d4e13f7d", - "region_id" : "RegionOne", - "region" : "RegionOne", - "url" : "http://128.224.180.14:8776/v3/fcca3cc49d5e42caae15459e27103efc" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:8776/v3/fcca3cc49d5e42caae15459e27103efc", - "region_id" : "RegionOne", - "id" : "c796df3ca5a84fc18db5b43a55283953", - "interface" : "internal" - }, - { - "region_id" : "RegionOne", - "id" : "cf55c2b34d0049ba835a2e48b9ad0e2e", - "interface" : "admin", - "url" : "http://192.168.204.2:8776/v3/fcca3cc49d5e42caae15459e27103efc", - "region" : "RegionOne" - } - ], - "type" : "volumev3", - "name" : "cinderv3" - } - ], + "catalog": [ + { + "id": "99aefcc82a9246f98f8c281e61ffc754", + "endpoints": [ + { + "region": "RegionOne", + "url": "http://128.224.180.14:9696", + "id": "39583c1508ad4b71b380570a745ee10a", + "interface": "public", + "region_id": "RegionOne" + }, + { + "url": "http://192.168.204.2:9696", + "region": "RegionOne", + "id": "37e8d07ba24e4b8f93490c9daaba06e2", + "interface": "internal", + "region_id": "RegionOne" + }, + { + "interface": "admin", + "id": "7eee4ca98d444b1abb00a50d4b89373f", + "region_id": "RegionOne", + "region": "RegionOne", + "url": "http://192.168.204.2:9696" + } + ], + "name": "neutron", + "type": "network" + }, + { + "endpoints": [ + { + "interface": "public", + "id": "10496738fa374295a4a88a63b81a1589", + "region_id": "RegionOne", + "url": "http://128.224.180.14:8777", + "region": "RegionOne" + }, + { + "id": "02dcb8c0bd464c4489fa0a0c9f28571f", + "region_id": "RegionOne", + "interface": "internal", + "url": "http://192.168.204.2:8777", + "region": "RegionOne" + }, + { + "region_id": "RegionOne", + "id": "8a73b0d3743b4e78b87614690f6e97fe", + "interface": "admin", + "url": "http://192.168.204.2:8777", + "region": "RegionOne" + } + ], + "id": "d131054da83f4c93833799747a0f4709", + "name": "ceilometer", + "type": "metering" + }, + { + "type": "volumev2", + "name": "cinderv2", + "endpoints": [ + { + "id": "35a67ad36f0447d19c9662babf7cf609", + "interface": "public", + "region_id": "RegionOne", + "url": "http://128.224.180.14:8776/v2/fcca3cc49d5e42caae15459e27103efc", + "region": "RegionOne" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:8776/v2/fcca3cc49d5e42caae15459e27103efc", + "id": "c6ea42052268420fa2c8d351ee68c922", + "interface": "internal", + "region_id": "RegionOne" + }, + { + "region_id": "RegionOne", + "id": "91cb24853dc3450d847b0c286a2e44ea", + "interface": "admin", + "region": "RegionOne", + "url": "http://192.168.204.2:8776/v2/fcca3cc49d5e42caae15459e27103efc" + } + ], + "id": "40440057102440739c30be10a66bc5d1" + }, + { + "name": "heat", + "type": "orchestration", + "id": "35300cce88db4bd4bb5a72ffe3b88b00", + "endpoints": [ + { + "id": "58999d7b4a94439089ecfb2aca2d7f6c", + "region_id": "RegionOne", + "interface": "public", + "region": "RegionOne", + "url": "http://128.224.180.14:8004/v1/fcca3cc49d5e42caae15459e27103efc" + }, + { + "url": "http://192.168.204.2:8004/v1/fcca3cc49d5e42caae15459e27103efc", + "region": "RegionOne", + "interface": "internal", + "id": "1e0ee1a2aef84802b921d422372a567e", + "region_id": "RegionOne" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:8004/v1/fcca3cc49d5e42caae15459e27103efc", + "id": "17661bf4859741b8a43a461dedad1871", + "region_id": "RegionOne", + "interface": "admin" + } + ] + }, + { + "id": "08dc6912aea64c01925012c8a6df250a", + "endpoints": [ + { + "id": "02792c4eed77486083f9b2e52d7b94b0", + "region_id": "RegionOne", + "interface": "public", + "region": "RegionOne", + "url": "http://128.224.180.14:5000/v3" + }, + { + "id": "b6d5cad394b94309ae40d8de88059c5f", + "region_id": "RegionOne", + "interface": "internal", + "url": "http://192.168.204.2:5000/v3", + "region": "RegionOne" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:35357/v3", + "region_id": "RegionOne", + "id": "1f18e2b7c6a34493b86853b65917888e", + "interface": "admin" + } + ], + "type": "identity", + "name": "keystone" + }, + { + "name": "vim", + "type": "nfv", + "endpoints": [ + { + "url": "http://128.224.180.14:4545", + "region": "RegionOne", + "id": "b33e317345e4480ab0786e4960995ec9", + "interface": "public", + "region_id": "RegionOne" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:4545", + "interface": "internal", + "id": "03c85828d5bf432ab04831aa65ac9c52", + "region_id": "RegionOne" + }, + { + "id": "067983abb061476cb53a9e23a740d98f", + "region_id": "RegionOne", + "interface": "admin", + "url": "http://192.168.204.2:4545", + "region": "RegionOne" + } + ], + "id": "01636c856fc84988b38b9117eb4a8021" + }, + { + "name": "aodh", + "type": "alarming", + "id": "eb269151d0e44744a5b5449657bdc61c", + "endpoints": [ + { + "id": "5bfc6c056e0244c493642eb82f6aaa11", + "region_id": "RegionOne", + "interface": "public", + "url": "http://128.224.180.14:8042", + "region": "RegionOne" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:8042", + "region_id": "RegionOne", + "id": "ad69c7f76dce4089a195b9221ddbfb44", + "interface": "internal" + }, + { + "interface": "admin", + "id": "3e8fcdfa7bcb40b0ae33c282adfcc9ff", + "region_id": "RegionOne", + "region": "RegionOne", + "url": "http://192.168.204.2:8042" + } + ] + }, + { + "name": "sysinv", + "type": "platform", + "endpoints": [ + { + "region": "RegionOne", + "url": "http://128.224.180.14:6385/v1", + "interface": "public", + "id": "ba4ba8104590421b84672306c7e0e1f1", + "region_id": "RegionOne" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:6385/v1", + "interface": "internal", + "id": "a1cba34b163f496ab1acd6e9b51e39a2", + "region_id": "RegionOne" + }, + { + "url": "http://192.168.204.2:6385/v1", + "region": "RegionOne", + "id": "7c171210a2c841a6a52a5713e316d6fc", + "interface": "admin", + "region_id": "RegionOne" + } + ], + "id": "256bbad671f946fea543e6bd71f98875" + }, + { + "id": "e84665dcce814c05b4c5084964547534", + "endpoints": [ + { + "url": "http://128.224.180.14:8000/v1/fcca3cc49d5e42caae15459e27103efc", + "region": "RegionOne", + "region_id": "RegionOne", + "id": "b2ed1a23dc6944bea129c20861e0286a", + "interface": "public" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:8000/v1/fcca3cc49d5e42caae15459e27103efc", + "interface": "internal", + "id": "c4df7c6bc15646848eff35caf6ffea8e", + "region_id": "RegionOne" + }, + { + "region_id": "RegionOne", + "id": "61b3dabb761443a89ab549f437c05ab0", + "interface": "admin", + "region": "RegionOne", + "url": "http://192.168.204.2:8000/v1/fcca3cc49d5e42caae15459e27103efc" + } + ], + "name": "heat-cfn", + "type": "cloudformation" + }, + { + "id": "823024424a014981a3721229491c0b1a", + "endpoints": [ + { + "region": "RegionOne", + "url": "http://128.224.180.14:8776/v1/fcca3cc49d5e42caae15459e27103efc", + "region_id": "RegionOne", + "id": "4a52e4e54ff440789f9a797919c4a0f2", + "interface": "public" + }, + { + "url": "http://192.168.204.2:8776/v1/fcca3cc49d5e42caae15459e27103efc", + "region": "RegionOne", + "id": "d4f9a84476524a39844f0fce63f1022e", + "region_id": "RegionOne", + "interface": "internal" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:8776/v1/fcca3cc49d5e42caae15459e27103efc", + "interface": "admin", + "id": "81bf3810a8cc4697b68c6e93b5b8fe1f", + "region_id": "RegionOne" + } + ], + "type": "volume", + "name": "cinder" + }, + { + "name": "glance", + "type": "image", + "endpoints": [ + { + "id": "bd930aba961946cfb1401bada56d55e3", + "region_id": "RegionOne", + "interface": "public", + "region": "RegionOne", + "url": "http://128.224.180.14:9292" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:9292", + "id": "c11da585f0b141b99d1e18bb9a607beb", + "region_id": "RegionOne", + "interface": "internal" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:9292", + "id": "31b26c625a6a4fc7910dc5935155996e", + "interface": "admin", + "region_id": "RegionOne" + } + ], + "id": "3b78cf039bc54d1bbb99ab3a4be15ef1" + }, + { + "id": "b8701374bf254de1beee8a2c9ecc6b33", + "endpoints": [ + { + "region_id": "RegionOne", + "id": "f7407f330c8b4577b1d377d3fab9c2f8", + "interface": "public", + "region": "RegionOne", + "url": "http://128.224.180.14:15491" + }, + { + "url": "http://192.168.204.2:5491", + "region": "RegionOne", + "interface": "internal", + "id": "0b37ce31a32f4b6fa5e1aa0d6c20680f", + "region_id": "RegionOne" + }, + { + "region_id": "RegionOne", + "id": "7b87ea72adf245e1991e9e0df29b7ea9", + "interface": "admin", + "region": "RegionOne", + "url": "http://192.168.204.2:5491" + } + ], + "type": "patching", + "name": "patching" + }, + { + "id": "0ec0923a58f04ffeb6fced3bbc5c0947", + "endpoints": [ + { + "url": "http://128.224.180.14:8774/v2.1/fcca3cc49d5e42caae15459e27103efc", + "region": "RegionOne", + "id": "13168b12da17451fb39630de67db168f", + "region_id": "RegionOne", + "interface": "public" + }, + { + "id": "22dd6a44209f42d986b82e3aa6535f82", + "interface": "internal", + "region_id": "RegionOne", + "region": "RegionOne", + "url": "http://192.168.204.2:8774/v2.1/fcca3cc49d5e42caae15459e27103efc" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:8774/v2.1/fcca3cc49d5e42caae15459e27103efc", + "id": "552a991ae501492f841c1b6e2ff38fc5", + "region_id": "RegionOne", + "interface": "admin" + } + ], + "type": "compute", + "name": "nova" + }, + { + "id": "50b219650f1049b097b3f14e8c70cdf8", + "endpoints": [ + { + "interface": "public", + "id": "5a4276cd6e4d43e883cf8640d4e13f7d", + "region_id": "RegionOne", + "region": "RegionOne", + "url": "http://128.224.180.14:8776/v3/fcca3cc49d5e42caae15459e27103efc" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:8776/v3/fcca3cc49d5e42caae15459e27103efc", + "region_id": "RegionOne", + "id": "c796df3ca5a84fc18db5b43a55283953", + "interface": "internal" + }, + { + "region_id": "RegionOne", + "id": "cf55c2b34d0049ba835a2e48b9ad0e2e", + "interface": "admin", + "url": "http://192.168.204.2:8776/v3/fcca3cc49d5e42caae15459e27103efc", + "region": "RegionOne" + } + ], + "type": "volumev3", + "name": "cinderv3" + } + ], } mock_auth_state = { - "body" : { - "token" : { - "is_domain" : "false", - "expires_at" : "2017-08-27T14:19:15.000000Z", - "issued_at" : "2017-08-27T13:19:15.000000Z", - "roles" : [ - { - "id" : "9fe2ff9ee4384b1894a90878d3e92bab", - "name" : "_member_" + "body": { + "token": { + "is_domain": "false", + "expires_at": "2017-08-27T14:19:15.000000Z", + "issued_at": "2017-08-27T13:19:15.000000Z", + "roles": [ + { + "id": "9fe2ff9ee4384b1894a90878d3e92bab", + "name": "_member_" + }, + { + "id": "b86a7e02935844b899d3d326f83c1b1f", + "name": "admin" + }, + { + "name": "heat_stack_owner", + "id": "7de502236e954c8282de32e773fc052e" + } + ], + "methods": [ + "password" + ], + "catalog": mock_catalog_response['catalog'], + "project": { + "name": "admin", + "id": "fcca3cc49d5e42caae15459e27103efc", + "domain": { + "id": "default", + "name": "Default" + } }, - { - "id" : "b86a7e02935844b899d3d326f83c1b1f", - "name" : "admin" + "user": { + "name": "admin", + "id": "9efb043c7629497a8028d7325ca1afb0", + "domain": { + "id": "default", + "name": "Default" + } }, - { - "name" : "heat_stack_owner", - "id" : "7de502236e954c8282de32e773fc052e" - } - ], - "methods" : [ - "password" - ], - "catalog" : mock_catalog_response['catalog'], - "project" : { - "name" : "admin", - "id" : "fcca3cc49d5e42caae15459e27103efc", - "domain" : { - "id" : "default", - "name" : "Default" - } - }, - "user" : { - "name" : "admin", - "id" : "9efb043c7629497a8028d7325ca1afb0", - "domain" : { - "id" : "default", - "name" : "Default" - } - }, - "audit_ids" : [ - "_ZWT10DtSZKRXIvIcxun7w" - ] - } - }, - "auth_token" : mock_token_id + "audit_ids": [ + "_ZWT10DtSZKRXIvIcxun7w" + ] + } + }, + "auth_token": mock_token_id } @@ -511,9 +507,9 @@ class TestIdentityService(unittest.TestCase): :return: ''' - #mock VimDriverUtils APIs + # mock VimDriverUtils APIs mock_session_specs = ["get"] - mock_session_get_response = {'status':200} + mock_session_get_response = {'status': 200} mock_session = mock.Mock(name='mock_session', spec=mock_session_specs) mock_session.get.return_value = mock_session_get_response @@ -522,21 +518,21 @@ class TestIdentityService(unittest.TestCase): mock_get_auth_state.return_value = json.dumps(mock_auth_state) mock_update_token_cache.return_value = mock_token_id - #simulate client to make the request - data ={} + # simulate client to make the request + data = {} response = self.client.post("/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/identity/v3/auth/tokens", data=data, format='json') self.failUnlessEqual(status.HTTP_201_CREATED, response.status_code) context = response.json() self.assertTrue(response['X-Subject-Token'] == mock_token_id) - self.assertTrue(context['token']['catalog'] != None) + self.assertTrue(context['token']['catalog'] is not None) @mock.patch.object(VimDriverUtils, 'get_vim_info') @mock.patch.object(VimDriverUtils, 'get_session') @mock.patch.object(VimDriverUtils, 'get_auth_state') @mock.patch.object(VimDriverUtils, 'update_token_cache') def test_tokensV2(self, mock_update_token_cache, mock_get_auth_state, - mock_get_session, mock_get_vim_info): + mock_get_session, mock_get_vim_info): ''' test API: get token :param mock_update_token_cache: @@ -553,7 +549,7 @@ class TestIdentityService(unittest.TestCase): spec=mock_session_specs) mock_session.get.return_value = mock_session_get_response - mock_get_vim_info.return_value = mock_info.MOCK_VIM_INFO + mock_get_vim_info.return_value = mock_info.MOCK_VIM_INFO mock_get_session.return_value = mock_session mock_get_auth_state.return_value = json.dumps(mock_auth_state) mock_update_token_cache.return_value = mock_info.MOCK_TOKEN_ID @@ -577,7 +573,7 @@ class TestIdentityService(unittest.TestCase): @mock.patch.object(VimDriverUtils, 'get_auth_state') @mock.patch.object(VimDriverUtils, 'update_token_cache') def test_token_with_tenantname(self, mock_update_token_cache, mock_get_auth_state, - mock_get_session, mock_get_vim_info): + mock_get_session, mock_get_vim_info): ''' test API: get token :param mock_update_token_cache: @@ -614,7 +610,7 @@ class TestIdentityService(unittest.TestCase): }, "scope": { "project": { - "domain": {"name":"Default"}, + "domain": {"name": "Default"}, "name": "Integration" } } @@ -637,7 +633,7 @@ class TestIdentityService(unittest.TestCase): @mock.patch.object(VimDriverUtils, 'get_auth_state') @mock.patch.object(VimDriverUtils, 'update_token_cache') def test_tokensV2_with_tenantname(self, mock_update_token_cache, mock_get_auth_state, - mock_get_session, mock_get_vim_info): + mock_get_session, mock_get_vim_info): ''' test API: get token :param mock_update_token_cache: @@ -687,7 +683,7 @@ class TestIdentityService(unittest.TestCase): @mock.patch.object(VimDriverUtils, 'get_auth_state') @mock.patch.object(VimDriverUtils, 'update_token_cache') def test_token_with_projectid(self, mock_update_token_cache, mock_get_auth_state, - mock_get_session, mock_get_vim_info): + mock_get_session, mock_get_vim_info): ''' test API: get token :param mock_update_token_cache: @@ -737,4 +733,3 @@ class TestIdentityService(unittest.TestCase): self.assertEqual(mock_info.MOCK_TOKEN_ID, response['X-Subject-Token']) self.assertIsNotNone(context['token']['catalog']) - diff --git a/ocata/ocata/proxy/tests/test_service_proxy.py b/ocata/ocata/proxy/tests/test_service_proxy.py index 83fe5241..63a385aa 100644 --- a/ocata/ocata/proxy/tests/test_service_proxy.py +++ b/ocata/ocata/proxy/tests/test_service_proxy.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017-2018 Wind River Systems, Inc. +# Copyright (c) 2018 Intel Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -35,577 +35,577 @@ MOCK_VIM_INFO = { "vendor": "WindRiver", "version": "ocata", "vimId": "windriver-hudson-dc_RegionOne", - 'cloud_owner':'windriver-hudson-dc', - 'cloud_region_id':'RegionOne', - 'cloud_extra_info':'', - 'insecure':'True', + 'cloud_owner': 'windriver-hudson-dc', + 'cloud_region_id': 'RegionOne', + 'cloud_extra_info': '', + 'insecure': 'True', } -MOCK_TOKEN_ID="1a62b3971d774404a504c5d9a3e506e3" +MOCK_TOKEN_ID = "1a62b3971d774404a504c5d9a3e506e3" MOCK_CATALOG_RESPONSE = { - "catalog" : [ - { - "id" : "99aefcc82a9246f98f8c281e61ffc754", - "endpoints" : [ - { - "region" : "RegionOne", - "url" : "http://128.224.180.14:9696", - "id" : "39583c1508ad4b71b380570a745ee10a", - "interface" : "public", - "region_id" : "RegionOne" - }, - { - "url" : "http://192.168.204.2:9696", - "region" : "RegionOne", - "id" : "37e8d07ba24e4b8f93490c9daaba06e2", - "interface" : "internal", - "region_id" : "RegionOne" - }, - { - "interface" : "admin", - "id" : "7eee4ca98d444b1abb00a50d4b89373f", - "region_id" : "RegionOne", - "region" : "RegionOne", - "url" : "http://192.168.204.2:9696" - } - ], - "name" : "neutron", - "type" : "network" - }, - { - "endpoints" : [ - { - "interface" : "public", - "id" : "10496738fa374295a4a88a63b81a1589", - "region_id" : "RegionOne", - "url" : "http://128.224.180.14:8777", - "region" : "RegionOne" - }, - { - "id" : "02dcb8c0bd464c4489fa0a0c9f28571f", - "region_id" : "RegionOne", - "interface" : "internal", - "url" : "http://192.168.204.2:8777", - "region" : "RegionOne" - }, - { - "region_id" : "RegionOne", - "id" : "8a73b0d3743b4e78b87614690f6e97fe", - "interface" : "admin", - "url" : "http://192.168.204.2:8777", - "region" : "RegionOne" - } - ], - "id" : "d131054da83f4c93833799747a0f4709", - "name" : "ceilometer", - "type" : "metering" - }, - { - "type" : "volumev2", - "name" : "cinderv2", - "endpoints" : [ - { - "id" : "35a67ad36f0447d19c9662babf7cf609", - "interface" : "public", - "region_id" : "RegionOne", - "url" : "http://128.224.180.14:8776/v2/fcca3cc49d5e42caae15459e27103efc", - "region" : "RegionOne" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:8776/v2/fcca3cc49d5e42caae15459e27103efc", - "id" : "c6ea42052268420fa2c8d351ee68c922", - "interface" : "internal", - "region_id" : "RegionOne" - }, - { - "region_id" : "RegionOne", - "id" : "91cb24853dc3450d847b0c286a2e44ea", - "interface" : "admin", - "region" : "RegionOne", - "url" : "http://192.168.204.2:8776/v2/fcca3cc49d5e42caae15459e27103efc" - } - ], - "id" : "40440057102440739c30be10a66bc5d1" - }, - { - "name" : "heat", - "type" : "orchestration", - "id" : "35300cce88db4bd4bb5a72ffe3b88b00", - "endpoints" : [ - { - "id" : "58999d7b4a94439089ecfb2aca2d7f6c", - "region_id" : "RegionOne", - "interface" : "public", - "region" : "RegionOne", - "url" : "http://128.224.180.14:8004/v1/fcca3cc49d5e42caae15459e27103efc" - }, - { - "url" : "http://192.168.204.2:8004/v1/fcca3cc49d5e42caae15459e27103efc", - "region" : "RegionOne", - "interface" : "internal", - "id" : "1e0ee1a2aef84802b921d422372a567e", - "region_id" : "RegionOne" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:8004/v1/fcca3cc49d5e42caae15459e27103efc", - "id" : "17661bf4859741b8a43a461dedad1871", - "region_id" : "RegionOne", - "interface" : "admin" - } - ] - }, - { - "id" : "08dc6912aea64c01925012c8a6df250a", - "endpoints" : [ - { - "id" : "02792c4eed77486083f9b2e52d7b94b0", - "region_id" : "RegionOne", - "interface" : "public", - "region" : "RegionOne", - "url" : "http://128.224.180.14:5000/v3" - }, - { - "id" : "b6d5cad394b94309ae40d8de88059c5f", - "region_id" : "RegionOne", - "interface" : "internal", - "url" : "http://192.168.204.2:5000/v3", - "region" : "RegionOne" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:35357/v3", - "region_id" : "RegionOne", - "id" : "1f18e2b7c6a34493b86853b65917888e", - "interface" : "admin" - } - ], - "type" : "identity", - "name" : "keystone" - }, - { - "name" : "vim", - "type" : "nfv", - "endpoints" : [ - { - "url" : "http://128.224.180.14:4545", - "region" : "RegionOne", - "id" : "b33e317345e4480ab0786e4960995ec9", - "interface" : "public", - "region_id" : "RegionOne" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:4545", - "interface" : "internal", - "id" : "03c85828d5bf432ab04831aa65ac9c52", - "region_id" : "RegionOne" - }, - { - "id" : "067983abb061476cb53a9e23a740d98f", - "region_id" : "RegionOne", - "interface" : "admin", - "url" : "http://192.168.204.2:4545", - "region" : "RegionOne" - } - ], - "id" : "01636c856fc84988b38b9117eb4a8021" - }, - { - "name" : "aodh", - "type" : "alarming", - "id" : "eb269151d0e44744a5b5449657bdc61c", - "endpoints" : [ - { - "id" : "5bfc6c056e0244c493642eb82f6aaa11", - "region_id" : "RegionOne", - "interface" : "public", - "url" : "http://128.224.180.14:8042", - "region" : "RegionOne" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:8042", - "region_id" : "RegionOne", - "id" : "ad69c7f76dce4089a195b9221ddbfb44", - "interface" : "internal" - }, - { - "interface" : "admin", - "id" : "3e8fcdfa7bcb40b0ae33c282adfcc9ff", - "region_id" : "RegionOne", - "region" : "RegionOne", - "url" : "http://192.168.204.2:8042" - } - ] - }, - { - "name" : "sysinv", - "type" : "platform", - "endpoints" : [ - { - "region" : "RegionOne", - "url" : "http://128.224.180.14:6385/v1", - "interface" : "public", - "id" : "ba4ba8104590421b84672306c7e0e1f1", - "region_id" : "RegionOne" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:6385/v1", - "interface" : "internal", - "id" : "a1cba34b163f496ab1acd6e9b51e39a2", - "region_id" : "RegionOne" - }, - { - "url" : "http://192.168.204.2:6385/v1", - "region" : "RegionOne", - "id" : "7c171210a2c841a6a52a5713e316d6fc", - "interface" : "admin", - "region_id" : "RegionOne" - } - ], - "id" : "256bbad671f946fea543e6bd71f98875" - }, - { - "id" : "e84665dcce814c05b4c5084964547534", - "endpoints" : [ - { - "url" : "http://128.224.180.14:8000/v1/fcca3cc49d5e42caae15459e27103efc", - "region" : "RegionOne", - "region_id" : "RegionOne", - "id" : "b2ed1a23dc6944bea129c20861e0286a", - "interface" : "public" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:8000/v1/fcca3cc49d5e42caae15459e27103efc", - "interface" : "internal", - "id" : "c4df7c6bc15646848eff35caf6ffea8e", - "region_id" : "RegionOne" - }, - { - "region_id" : "RegionOne", - "id" : "61b3dabb761443a89ab549f437c05ab0", - "interface" : "admin", - "region" : "RegionOne", - "url" : "http://192.168.204.2:8000/v1/fcca3cc49d5e42caae15459e27103efc" - } - ], - "name" : "heat-cfn", - "type" : "cloudformation" - }, - { - "id" : "823024424a014981a3721229491c0b1a", - "endpoints" : [ - { - "region" : "RegionOne", - "url" : "http://128.224.180.14:8776/v1/fcca3cc49d5e42caae15459e27103efc", - "region_id" : "RegionOne", - "id" : "4a52e4e54ff440789f9a797919c4a0f2", - "interface" : "public" - }, - { - "url" : "http://192.168.204.2:8776/v1/fcca3cc49d5e42caae15459e27103efc", - "region" : "RegionOne", - "id" : "d4f9a84476524a39844f0fce63f1022e", - "region_id" : "RegionOne", - "interface" : "internal" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:8776/v1/fcca3cc49d5e42caae15459e27103efc", - "interface" : "admin", - "id" : "81bf3810a8cc4697b68c6e93b5b8fe1f", - "region_id" : "RegionOne" - } - ], - "type" : "volume", - "name" : "cinder" - }, - { - "name" : "glance", - "type" : "image", - "endpoints" : [ - { - "id" : "bd930aba961946cfb1401bada56d55e3", - "region_id" : "RegionOne", - "interface" : "public", - "region" : "RegionOne", - "url" : "http://128.224.180.14:9292" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:9292", - "id" : "c11da585f0b141b99d1e18bb9a607beb", - "region_id" : "RegionOne", - "interface" : "internal" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:9292", - "id" : "31b26c625a6a4fc7910dc5935155996e", - "interface" : "admin", - "region_id" : "RegionOne" - } - ], - "id" : "3b78cf039bc54d1bbb99ab3a4be15ef1" - }, - { - "id" : "b8701374bf254de1beee8a2c9ecc6b33", - "endpoints" : [ - { - "region_id" : "RegionOne", - "id" : "f7407f330c8b4577b1d377d3fab9c2f8", - "interface" : "public", - "region" : "RegionOne", - "url" : "http://128.224.180.14:15491" - }, - { - "url" : "http://192.168.204.2:5491", - "region" : "RegionOne", - "interface" : "internal", - "id" : "0b37ce31a32f4b6fa5e1aa0d6c20680f", - "region_id" : "RegionOne" - }, - { - "region_id" : "RegionOne", - "id" : "7b87ea72adf245e1991e9e0df29b7ea9", - "interface" : "admin", - "region" : "RegionOne", - "url" : "http://192.168.204.2:5491" - } - ], - "type" : "patching", - "name" : "patching" - }, - { - "id" : "0ec0923a58f04ffeb6fced3bbc5c0947", - "endpoints" : [ - { - "url" : "http://128.224.180.14:8774/v2.1/fcca3cc49d5e42caae15459e27103efc", - "region" : "RegionOne", - "id" : "13168b12da17451fb39630de67db168f", - "region_id" : "RegionOne", - "interface" : "public" - }, - { - "id" : "22dd6a44209f42d986b82e3aa6535f82", - "interface" : "internal", - "region_id" : "RegionOne", - "region" : "RegionOne", - "url" : "http://192.168.204.2:8774/v2.1/fcca3cc49d5e42caae15459e27103efc" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:8774/v2.1/fcca3cc49d5e42caae15459e27103efc", - "id" : "552a991ae501492f841c1b6e2ff38fc5", - "region_id" : "RegionOne", - "interface" : "admin" - } - ], - "type" : "compute", - "name" : "nova" - }, - { - "id" : "50b219650f1049b097b3f14e8c70cdf8", - "endpoints" : [ - { - "interface" : "public", - "id" : "5a4276cd6e4d43e883cf8640d4e13f7d", - "region_id" : "RegionOne", - "region" : "RegionOne", - "url" : "http://128.224.180.14:8776/v3/fcca3cc49d5e42caae15459e27103efc" - }, - { - "region" : "RegionOne", - "url" : "http://192.168.204.2:8776/v3/fcca3cc49d5e42caae15459e27103efc", - "region_id" : "RegionOne", - "id" : "c796df3ca5a84fc18db5b43a55283953", - "interface" : "internal" - }, - { - "region_id" : "RegionOne", - "id" : "cf55c2b34d0049ba835a2e48b9ad0e2e", - "interface" : "admin", - "url" : "http://192.168.204.2:8776/v3/fcca3cc49d5e42caae15459e27103efc", - "region" : "RegionOne" - } - ], - "type" : "volumev3", - "name" : "cinderv3" - } - ] + "catalog": [ + { + "id": "99aefcc82a9246f98f8c281e61ffc754", + "endpoints": [ + { + "region": "RegionOne", + "url": "http://128.224.180.14:9696", + "id": "39583c1508ad4b71b380570a745ee10a", + "interface": "public", + "region_id": "RegionOne" + }, + { + "url": "http://192.168.204.2:9696", + "region": "RegionOne", + "id": "37e8d07ba24e4b8f93490c9daaba06e2", + "interface": "internal", + "region_id": "RegionOne" + }, + { + "interface": "admin", + "id": "7eee4ca98d444b1abb00a50d4b89373f", + "region_id": "RegionOne", + "region": "RegionOne", + "url": "http://192.168.204.2:9696" + } + ], + "name": "neutron", + "type": "network" + }, + { + "endpoints": [ + { + "interface": "public", + "id": "10496738fa374295a4a88a63b81a1589", + "region_id": "RegionOne", + "url": "http://128.224.180.14:8777", + "region": "RegionOne" + }, + { + "id": "02dcb8c0bd464c4489fa0a0c9f28571f", + "region_id": "RegionOne", + "interface": "internal", + "url": "http://192.168.204.2:8777", + "region": "RegionOne" + }, + { + "region_id": "RegionOne", + "id": "8a73b0d3743b4e78b87614690f6e97fe", + "interface": "admin", + "url": "http://192.168.204.2:8777", + "region": "RegionOne" + } + ], + "id": "d131054da83f4c93833799747a0f4709", + "name": "ceilometer", + "type": "metering" + }, + { + "type": "volumev2", + "name": "cinderv2", + "endpoints": [ + { + "id": "35a67ad36f0447d19c9662babf7cf609", + "interface": "public", + "region_id": "RegionOne", + "url": "http://128.224.180.14:8776/v2/fcca3cc49d5e42caae15459e27103efc", + "region": "RegionOne" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:8776/v2/fcca3cc49d5e42caae15459e27103efc", + "id": "c6ea42052268420fa2c8d351ee68c922", + "interface": "internal", + "region_id": "RegionOne" + }, + { + "region_id": "RegionOne", + "id": "91cb24853dc3450d847b0c286a2e44ea", + "interface": "admin", + "region": "RegionOne", + "url": "http://192.168.204.2:8776/v2/fcca3cc49d5e42caae15459e27103efc" + } + ], + "id": "40440057102440739c30be10a66bc5d1" + }, + { + "name": "heat", + "type": "orchestration", + "id": "35300cce88db4bd4bb5a72ffe3b88b00", + "endpoints": [ + { + "id": "58999d7b4a94439089ecfb2aca2d7f6c", + "region_id": "RegionOne", + "interface": "public", + "region": "RegionOne", + "url": "http://128.224.180.14:8004/v1/fcca3cc49d5e42caae15459e27103efc" + }, + { + "url": "http://192.168.204.2:8004/v1/fcca3cc49d5e42caae15459e27103efc", + "region": "RegionOne", + "interface": "internal", + "id": "1e0ee1a2aef84802b921d422372a567e", + "region_id": "RegionOne" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:8004/v1/fcca3cc49d5e42caae15459e27103efc", + "id": "17661bf4859741b8a43a461dedad1871", + "region_id": "RegionOne", + "interface": "admin" + } + ] + }, + { + "id": "08dc6912aea64c01925012c8a6df250a", + "endpoints": [ + { + "id": "02792c4eed77486083f9b2e52d7b94b0", + "region_id": "RegionOne", + "interface": "public", + "region": "RegionOne", + "url": "http://128.224.180.14:5000/v3" + }, + { + "id": "b6d5cad394b94309ae40d8de88059c5f", + "region_id": "RegionOne", + "interface": "internal", + "url": "http://192.168.204.2:5000/v3", + "region": "RegionOne" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:35357/v3", + "region_id": "RegionOne", + "id": "1f18e2b7c6a34493b86853b65917888e", + "interface": "admin" + } + ], + "type": "identity", + "name": "keystone" + }, + { + "name": "vim", + "type": "nfv", + "endpoints": [ + { + "url": "http://128.224.180.14:4545", + "region": "RegionOne", + "id": "b33e317345e4480ab0786e4960995ec9", + "interface": "public", + "region_id": "RegionOne" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:4545", + "interface": "internal", + "id": "03c85828d5bf432ab04831aa65ac9c52", + "region_id": "RegionOne" + }, + { + "id": "067983abb061476cb53a9e23a740d98f", + "region_id": "RegionOne", + "interface": "admin", + "url": "http://192.168.204.2:4545", + "region": "RegionOne" + } + ], + "id": "01636c856fc84988b38b9117eb4a8021" + }, + { + "name": "aodh", + "type": "alarming", + "id": "eb269151d0e44744a5b5449657bdc61c", + "endpoints": [ + { + "id": "5bfc6c056e0244c493642eb82f6aaa11", + "region_id": "RegionOne", + "interface": "public", + "url": "http://128.224.180.14:8042", + "region": "RegionOne" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:8042", + "region_id": "RegionOne", + "id": "ad69c7f76dce4089a195b9221ddbfb44", + "interface": "internal" + }, + { + "interface": "admin", + "id": "3e8fcdfa7bcb40b0ae33c282adfcc9ff", + "region_id": "RegionOne", + "region": "RegionOne", + "url": "http://192.168.204.2:8042" + } + ] + }, + { + "name": "sysinv", + "type": "platform", + "endpoints": [ + { + "region": "RegionOne", + "url": "http://128.224.180.14:6385/v1", + "interface": "public", + "id": "ba4ba8104590421b84672306c7e0e1f1", + "region_id": "RegionOne" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:6385/v1", + "interface": "internal", + "id": "a1cba34b163f496ab1acd6e9b51e39a2", + "region_id": "RegionOne" + }, + { + "url": "http://192.168.204.2:6385/v1", + "region": "RegionOne", + "id": "7c171210a2c841a6a52a5713e316d6fc", + "interface": "admin", + "region_id": "RegionOne" + } + ], + "id": "256bbad671f946fea543e6bd71f98875" + }, + { + "id": "e84665dcce814c05b4c5084964547534", + "endpoints": [ + { + "url": "http://128.224.180.14:8000/v1/fcca3cc49d5e42caae15459e27103efc", + "region": "RegionOne", + "region_id": "RegionOne", + "id": "b2ed1a23dc6944bea129c20861e0286a", + "interface": "public" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:8000/v1/fcca3cc49d5e42caae15459e27103efc", + "interface": "internal", + "id": "c4df7c6bc15646848eff35caf6ffea8e", + "region_id": "RegionOne" + }, + { + "region_id": "RegionOne", + "id": "61b3dabb761443a89ab549f437c05ab0", + "interface": "admin", + "region": "RegionOne", + "url": "http://192.168.204.2:8000/v1/fcca3cc49d5e42caae15459e27103efc" + } + ], + "name": "heat-cfn", + "type": "cloudformation" + }, + { + "id": "823024424a014981a3721229491c0b1a", + "endpoints": [ + { + "region": "RegionOne", + "url": "http://128.224.180.14:8776/v1/fcca3cc49d5e42caae15459e27103efc", + "region_id": "RegionOne", + "id": "4a52e4e54ff440789f9a797919c4a0f2", + "interface": "public" + }, + { + "url": "http://192.168.204.2:8776/v1/fcca3cc49d5e42caae15459e27103efc", + "region": "RegionOne", + "id": "d4f9a84476524a39844f0fce63f1022e", + "region_id": "RegionOne", + "interface": "internal" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:8776/v1/fcca3cc49d5e42caae15459e27103efc", + "interface": "admin", + "id": "81bf3810a8cc4697b68c6e93b5b8fe1f", + "region_id": "RegionOne" + } + ], + "type": "volume", + "name": "cinder" + }, + { + "name": "glance", + "type": "image", + "endpoints": [ + { + "id": "bd930aba961946cfb1401bada56d55e3", + "region_id": "RegionOne", + "interface": "public", + "region": "RegionOne", + "url": "http://128.224.180.14:9292" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:9292", + "id": "c11da585f0b141b99d1e18bb9a607beb", + "region_id": "RegionOne", + "interface": "internal" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:9292", + "id": "31b26c625a6a4fc7910dc5935155996e", + "interface": "admin", + "region_id": "RegionOne" + } + ], + "id": "3b78cf039bc54d1bbb99ab3a4be15ef1" + }, + { + "id": "b8701374bf254de1beee8a2c9ecc6b33", + "endpoints": [ + { + "region_id": "RegionOne", + "id": "f7407f330c8b4577b1d377d3fab9c2f8", + "interface": "public", + "region": "RegionOne", + "url": "http://128.224.180.14:15491" + }, + { + "url": "http://192.168.204.2:5491", + "region": "RegionOne", + "interface": "internal", + "id": "0b37ce31a32f4b6fa5e1aa0d6c20680f", + "region_id": "RegionOne" + }, + { + "region_id": "RegionOne", + "id": "7b87ea72adf245e1991e9e0df29b7ea9", + "interface": "admin", + "region": "RegionOne", + "url": "http://192.168.204.2:5491" + } + ], + "type": "patching", + "name": "patching" + }, + { + "id": "0ec0923a58f04ffeb6fced3bbc5c0947", + "endpoints": [ + { + "url": "http://128.224.180.14:8774/v2.1/fcca3cc49d5e42caae15459e27103efc", + "region": "RegionOne", + "id": "13168b12da17451fb39630de67db168f", + "region_id": "RegionOne", + "interface": "public" + }, + { + "id": "22dd6a44209f42d986b82e3aa6535f82", + "interface": "internal", + "region_id": "RegionOne", + "region": "RegionOne", + "url": "http://192.168.204.2:8774/v2.1/fcca3cc49d5e42caae15459e27103efc" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:8774/v2.1/fcca3cc49d5e42caae15459e27103efc", + "id": "552a991ae501492f841c1b6e2ff38fc5", + "region_id": "RegionOne", + "interface": "admin" + } + ], + "type": "compute", + "name": "nova" + }, + { + "id": "50b219650f1049b097b3f14e8c70cdf8", + "endpoints": [ + { + "interface": "public", + "id": "5a4276cd6e4d43e883cf8640d4e13f7d", + "region_id": "RegionOne", + "region": "RegionOne", + "url": "http://128.224.180.14:8776/v3/fcca3cc49d5e42caae15459e27103efc" + }, + { + "region": "RegionOne", + "url": "http://192.168.204.2:8776/v3/fcca3cc49d5e42caae15459e27103efc", + "region_id": "RegionOne", + "id": "c796df3ca5a84fc18db5b43a55283953", + "interface": "internal" + }, + { + "region_id": "RegionOne", + "id": "cf55c2b34d0049ba835a2e48b9ad0e2e", + "interface": "admin", + "url": "http://192.168.204.2:8776/v3/fcca3cc49d5e42caae15459e27103efc", + "region": "RegionOne" + } + ], + "type": "volumev3", + "name": "cinderv3" + } + ] } MOCK_AUTH_STATE = { - "body" : { - "token" : { - "is_domain" : "false", - "expires_at" : "2017-08-27T14:19:15.000000Z", - "issued_at" : "2017-08-27T13:19:15.000000Z", - "roles" : [ - { - "id" : "9fe2ff9ee4384b1894a90878d3e92bab", - "name" : "_member_" + "body": { + "token": { + "is_domain": "false", + "expires_at": "2017-08-27T14:19:15.000000Z", + "issued_at": "2017-08-27T13:19:15.000000Z", + "roles": [ + { + "id": "9fe2ff9ee4384b1894a90878d3e92bab", + "name": "_member_" + }, + { + "id": "b86a7e02935844b899d3d326f83c1b1f", + "name": "admin" + }, + { + "name": "heat_stack_owner", + "id": "7de502236e954c8282de32e773fc052e" + } + ], + "methods": [ + "password" + ], + "catalog": MOCK_CATALOG_RESPONSE['catalog'], + "project": { + "name": "admin", + "id": "fcca3cc49d5e42caae15459e27103efc", + "domain": { + "id": "default", + "name": "Default" + } }, - { - "id" : "b86a7e02935844b899d3d326f83c1b1f", - "name" : "admin" + "user": { + "name": "admin", + "id": "9efb043c7629497a8028d7325ca1afb0", + "domain": { + "id": "default", + "name": "Default" + } }, - { - "name" : "heat_stack_owner", - "id" : "7de502236e954c8282de32e773fc052e" - } - ], - "methods" : [ - "password" - ], - "catalog" : MOCK_CATALOG_RESPONSE['catalog'], - "project" : { - "name" : "admin", - "id" : "fcca3cc49d5e42caae15459e27103efc", - "domain" : { - "id" : "default", - "name" : "Default" - } - }, - "user" : { - "name" : "admin", - "id" : "9efb043c7629497a8028d7325ca1afb0", - "domain" : { - "id" : "default", - "name" : "Default" - } - }, - "audit_ids" : [ - "_ZWT10DtSZKRXIvIcxun7w" - ] - } - }, - "auth_token" : MOCK_TOKEN_ID + "audit_ids": [ + "_ZWT10DtSZKRXIvIcxun7w" + ] + } + }, + "auth_token": MOCK_TOKEN_ID } MOCK_INTERNAL_METADATA_CATALOG = { - "identity" : { - "proxy_prefix" : "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/identity", - "prefix" : "http://128.224.180.14:5000", - "suffix" : "v3" - }, - "patching" : { - "proxy_prefix" : "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/patching", - "suffix" : "", - "prefix" : "http://128.224.180.14:15491" - }, - "orchestration" : { - "suffix" : "v1/fcca3cc49d5e42caae15459e27103efc", - "prefix" : "http://128.224.180.14:8004", - "proxy_prefix" : "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/orchestration" - }, - "volume" : { - "prefix" : "http://128.224.180.14:8776", - "suffix" : "v1/fcca3cc49d5e42caae15459e27103efc", - "proxy_prefix" : "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/volume" - }, - "metering" : { - "suffix" : "", - "prefix" : "http://128.224.180.14:8777", - "proxy_prefix" : "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/metering" - }, - "volumev3" : { - "prefix" : "http://128.224.180.14:8776", - "suffix" : "v3/fcca3cc49d5e42caae15459e27103efc", - "proxy_prefix" : "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/volumev3" - }, - "compute" : { - "suffix" : "v2.1/fcca3cc49d5e42caae15459e27103efc", - "prefix" : "http://128.224.180.14:8774", - "proxy_prefix" : "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute" - }, - "platform" : { - "prefix" : "http://128.224.180.14:6385", - "suffix" : "v1", - "proxy_prefix" : "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/platform" - }, - "nfv" : { - "proxy_prefix" : "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/nfv", - "prefix" : "http://128.224.180.14:4545", - "suffix" : "" - }, - "volumev2" : { - "proxy_prefix" : "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/volumev2", - "suffix" : "v2/fcca3cc49d5e42caae15459e27103efc", - "prefix" : "http://128.224.180.14:8776" - }, - "image" : { - "suffix" : "", - "prefix" : "http://128.224.180.14:9292", - "proxy_prefix" : "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/image" - }, - "network" : { - "proxy_prefix" : "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/network", - "prefix" : "http://128.224.180.14:9696", - "suffix" : "" - }, - "alarming" : { - "suffix" : "", - "prefix" : "http://128.224.180.14:8042", - "proxy_prefix" : "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/alarming" - }, - "cloudformation" : { - "proxy_prefix" : "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/cloudformation", - "prefix" : "http://128.224.180.14:8000", - "suffix" : "v1/fcca3cc49d5e42caae15459e27103efc" - } + "identity": { + "proxy_prefix": "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/identity", + "prefix": "http://128.224.180.14:5000", + "suffix": "v3" + }, + "patching": { + "proxy_prefix": "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/patching", + "suffix": "", + "prefix": "http://128.224.180.14:15491" + }, + "orchestration": { + "suffix": "v1/fcca3cc49d5e42caae15459e27103efc", + "prefix": "http://128.224.180.14:8004", + "proxy_prefix": "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/orchestration" + }, + "volume": { + "prefix": "http://128.224.180.14:8776", + "suffix": "v1/fcca3cc49d5e42caae15459e27103efc", + "proxy_prefix": "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/volume" + }, + "metering": { + "suffix": "", + "prefix": "http://128.224.180.14:8777", + "proxy_prefix": "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/metering" + }, + "volumev3": { + "prefix": "http://128.224.180.14:8776", + "suffix": "v3/fcca3cc49d5e42caae15459e27103efc", + "proxy_prefix": "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/volumev3" + }, + "compute": { + "suffix": "v2.1/fcca3cc49d5e42caae15459e27103efc", + "prefix": "http://128.224.180.14:8774", + "proxy_prefix": "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute" + }, + "platform": { + "prefix": "http://128.224.180.14:6385", + "suffix": "v1", + "proxy_prefix": "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/platform" + }, + "nfv": { + "proxy_prefix": "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/nfv", + "prefix": "http://128.224.180.14:4545", + "suffix": "" + }, + "volumev2": { + "proxy_prefix": "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/volumev2", + "suffix": "v2/fcca3cc49d5e42caae15459e27103efc", + "prefix": "http://128.224.180.14:8776" + }, + "image": { + "suffix": "", + "prefix": "http://128.224.180.14:9292", + "proxy_prefix": "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/image" + }, + "network": { + "proxy_prefix": "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/network", + "prefix": "http://128.224.180.14:9696", + "suffix": "" + }, + "alarming": { + "suffix": "", + "prefix": "http://128.224.180.14:8042", + "proxy_prefix": "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/alarming" + }, + "cloudformation": { + "proxy_prefix": "http://172.16.77.20:9003/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/cloudformation", + "prefix": "http://128.224.180.14:8000", + "suffix": "v1/fcca3cc49d5e42caae15459e27103efc" + } } MOCK_GET_SERVERS_RESPONSE = { - "servers" : [ - { - "links" : [ - { - "href" : "http://128.224.180.14:8774/v2.1/fcca3cc49d5e42caae15459e27103efc/servers/b2581b5c-7c56-4564-819d-fe7a2ce9c261", - "rel" : "self" - }, - { - "href" : "http://128.224.180.14:8774/fcca3cc49d5e42caae15459e27103efc/servers/b2581b5c-7c56-4564-819d-fe7a2ce9c261", - "rel" : "bookmark" - } - ], - "id" : "b2581b5c-7c56-4564-819d-fe7a2ce9c261", - "name" : "t1" - }, - { - "id" : "ff7b51ca-a272-45f4-b54c-e40b8099e67d", - "name" : "t2", - "links" : [ - { - "rel" : "self", - "href" : "http://128.224.180.14:8774/v2.1/fcca3cc49d5e42caae15459e27103efc/servers/ff7b51ca-a272-45f4-b54c-e40b8099e67d" - }, - { - "rel" : "bookmark", - "href" : "http://128.224.180.14:8774/fcca3cc49d5e42caae15459e27103efc/servers/ff7b51ca-a272-45f4-b54c-e40b8099e67d" - } - ] - } - ] + "servers": [ + { + "links": [ + { + "href": "http://128.224.180.14:8774/v2.1/fcca3cc49d5e42caae15459e27103efc/servers/b2581b5c-7c56-4564-819d-fe7a2ce9c261", + "rel": "self" + }, + { + "href": "http://128.224.180.14:8774/fcca3cc49d5e42caae15459e27103efc/servers/b2581b5c-7c56-4564-819d-fe7a2ce9c261", + "rel": "bookmark" + } + ], + "id": "b2581b5c-7c56-4564-819d-fe7a2ce9c261", + "name": "t1" + }, + { + "id": "ff7b51ca-a272-45f4-b54c-e40b8099e67d", + "name": "t2", + "links": [ + { + "rel": "self", + "href": "http://128.224.180.14:8774/v2.1/fcca3cc49d5e42caae15459e27103efc/servers/ff7b51ca-a272-45f4-b54c-e40b8099e67d" + }, + { + "rel": "bookmark", + "href": "http://128.224.180.14:8774/fcca3cc49d5e42caae15459e27103efc/servers/ff7b51ca-a272-45f4-b54c-e40b8099e67d" + } + ] + } + ] } MOCK_POST_SERVER_REQUEST = { - "server" : { + "server": { "accessIPv4": "1.2.3.4", "accessIPv6": "80fe::", - "name" : "new-server-test", - "imageRef" : "70a599e0-31e7-49b7-b260-868f441e862b", - "flavorRef" : "1", + "name": "new-server-test", + "imageRef": "70a599e0-31e7-49b7-b260-868f441e862b", + "flavorRef": "1", "availability_zone": "nova", "OS-DCF:diskConfig": "AUTO", - "metadata" : { - "My Server Name" : "Apache1" + "metadata": { + "My Server Name": "Apache1" }, "personality": [ { @@ -618,7 +618,7 @@ MOCK_POST_SERVER_REQUEST = { "name": "default" } ], - "user_data" : "IyEvYmluL2Jhc2gKL2Jpbi9zdQplY2hvICJJIGFtIGluIHlvdSEiCg==" + "user_data": "IyEvYmluL2Jhc2gKL2Jpbi9zdQplY2hvICJJIGFtIGluIHlvdSEiCg==" }, "OS-SCH-HNT:scheduler_hints": { "same_host": "48e6a9f6-30af-47e0-bc04-acaed113bb4e" @@ -692,11 +692,11 @@ MOCK_PATCH_IMAGE_RESPONSE = { class MockResponse(object): - status_code = 200 - content = '' + status_code = 200 + content = '' - def json(self): - pass + def json(self): + pass class TestServiceProxy(unittest.TestCase): @@ -707,61 +707,62 @@ class TestServiceProxy(unittest.TestCase): @mock.patch.object(VimDriverUtils, 'get_token_cache') @mock.patch.object(VimDriverUtils, 'get_vim_info') def test_get_token(self, mock_get_vim_info, mock_get_token_cache, mock_get_session): - mock_session_specs = ["head"] - mock_session = mock.Mock(name='mock_session', spec=mock_session_specs) - mock_get_servers_response_obj = mock.Mock(spec=MockResponse) - mock_get_servers_response_obj.status_code=200 - mock_get_servers_response_obj.content = MOCK_GET_SERVERS_RESPONSE - mock_get_servers_response_obj.json.return_value=MOCK_GET_SERVERS_RESPONSE - mock_session.head.return_value = mock_get_servers_response_obj - - mock_get_vim_info.return_value = MOCK_VIM_INFO - mock_get_session.return_value = mock_session - mock_get_token_cache.return_value = (json.dumps(MOCK_AUTH_STATE),json.dumps(MOCK_INTERNAL_METADATA_CATALOG)) - response = self.client.head( - "/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers", - {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_200_OK, response.status_code) + mock_session_specs = ["head"] + mock_session = mock.Mock(name='mock_session', spec=mock_session_specs) + mock_get_servers_response_obj = mock.Mock(spec=MockResponse) + mock_get_servers_response_obj.status_code = 200 + mock_get_servers_response_obj.content = MOCK_GET_SERVERS_RESPONSE + mock_get_servers_response_obj.json.return_value = MOCK_GET_SERVERS_RESPONSE + mock_session.head.return_value = mock_get_servers_response_obj + + mock_get_vim_info.return_value = MOCK_VIM_INFO + mock_get_session.return_value = mock_session + mock_get_token_cache.return_value = (json.dumps(MOCK_AUTH_STATE), + json.dumps(MOCK_INTERNAL_METADATA_CATALOG)) + response = self.client.head( + "/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers", + {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) + self.assertEquals(status.HTTP_200_OK, response.status_code) def test_unauthorized_access(self): - response = self.client.get( - "/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers") - self.assertEquals(status.HTTP_403_FORBIDDEN, response.status_code) + response = self.client.get( + "/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers") + self.assertEquals(status.HTTP_403_FORBIDDEN, response.status_code) @mock.patch.object(VimDriverUtils, 'get_vim_info') def test_expired_auth_token(self, mock_get_vim_info): - mock_get_vim_info.return_value = MOCK_VIM_INFO + mock_get_vim_info.return_value = MOCK_VIM_INFO - response = self.client.get( - "/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers", - {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_403_FORBIDDEN, response.status_code) + response = self.client.get("/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers", + {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) + self.assertEquals(status.HTTP_403_FORBIDDEN, response.status_code) @mock.patch.object(VimDriverUtils, 'get_token_cache') @mock.patch.object(VimDriverUtils, 'get_vim_info') def test_request_without_servicetype(self, mock_get_vim_info, mock_get_token_cache): - mock_get_vim_info.return_value = MOCK_VIM_INFO - mock_get_token_cache.return_value = (json.dumps(MOCK_AUTH_STATE), {}) - servicetype = "compute" - url = ("/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/" + servicetype + - "/v2.1/fcca3cc49d5e42caae15459e27103efc/servers") - response = self.client.get(url, {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code) - - metadata_catalog = copy.deepcopy(MOCK_INTERNAL_METADATA_CATALOG) - metadata_catalog[servicetype] = None - mock_get_token_cache.return_value = (json.dumps(MOCK_AUTH_STATE), json.dumps(metadata_catalog)) - - response = self.client.get(url, {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code) - - metadata_catalog = copy.deepcopy(MOCK_INTERNAL_METADATA_CATALOG) - metadata_catalog[servicetype]['prefix'] = None - metadata_catalog[servicetype]['proxy_prefix'] = None - mock_get_token_cache.return_value = (json.dumps(MOCK_AUTH_STATE), json.dumps(metadata_catalog)) - - response = self.client.get(url, {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code) + mock_get_vim_info.return_value = MOCK_VIM_INFO + mock_get_token_cache.return_value = (json.dumps(MOCK_AUTH_STATE), {}) + servicetype = "compute" + base_url = "/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/" + server_url = "/v2.1/fcca3cc49d5e42caae15459e27103efc/servers" + url = (base_url + servicetype + server_url) + response = self.client.get(url, {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) + self.assertEquals(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code) + + metadata_catalog = copy.deepcopy(MOCK_INTERNAL_METADATA_CATALOG) + metadata_catalog[servicetype] = None + mock_get_token_cache.return_value = (json.dumps(MOCK_AUTH_STATE), json.dumps(metadata_catalog)) + + response = self.client.get(url, {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) + self.assertEquals(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code) + + metadata_catalog = copy.deepcopy(MOCK_INTERNAL_METADATA_CATALOG) + metadata_catalog[servicetype]['prefix'] = None + metadata_catalog[servicetype]['proxy_prefix'] = None + mock_get_token_cache.return_value = (json.dumps(MOCK_AUTH_STATE), json.dumps(metadata_catalog)) + + response = self.client.get(url, {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) + self.assertEquals(status.HTTP_500_INTERNAL_SERVER_ERROR, response.status_code) @mock.patch.object(VimDriverUtils, 'get_vim_info') @mock.patch.object(VimDriverUtils, 'get_session') @@ -769,84 +770,84 @@ class TestServiceProxy(unittest.TestCase): @mock.patch.object(VimDriverUtils, 'update_token_cache') @mock.patch.object(VimDriverUtils, 'get_token_cache') def test_crud_resources(self, mock_get_token_cache, mock_update_token_cache, mock_get_auth_state, mock_get_session, mock_get_vim_info): - ''' - Test service proxy API: GET - - :param mock_get_token_cache: - :param mock_update_token_cache: - :param mock_get_auth_state: - :param mock_get_session: - :param mock_get_vim_info: - :return: - ''' - - #mock VimDriverUtils APIs - mock_session_specs = ["get", "post", "put", "patch", "delete"] - - mock_get_servers_response_obj = mock.Mock(spec=MockResponse) - mock_get_servers_response_obj.status_code=200 - mock_get_servers_response_obj.content = MOCK_GET_SERVERS_RESPONSE - mock_get_servers_response_obj.json.return_value=MOCK_GET_SERVERS_RESPONSE - - mock_post_server_response_obj = mock.Mock(spec=MockResponse) - mock_post_server_response_obj.status_code=202 - mock_post_server_response_obj.content = MOCK_POST_SERVER_RESPONSE - mock_post_server_response_obj.json.return_value=MOCK_POST_SERVER_RESPONSE - - mock_patch_server_response_obj = mock.Mock(spec=MockResponse) - mock_patch_server_response_obj.status_code=202 - mock_patch_server_response_obj.content = MOCK_PATCH_IMAGE_REQUEST - mock_patch_server_response_obj.json.return_value=MOCK_PATCH_IMAGE_REQUEST - - mock_delete_server_response_obj = mock.Mock(spec=MockResponse) - mock_delete_server_response_obj.status_code=204 - - mock_session = mock.Mock(name='mock_session', spec=mock_session_specs) - mock_session.get.return_value = mock_get_servers_response_obj - mock_session.post.return_value = mock_post_server_response_obj - mock_session.patch.return_value = mock_patch_server_response_obj - mock_session.delete.return_value = mock_delete_server_response_obj - - mock_get_vim_info.return_value = MOCK_VIM_INFO - mock_get_session.return_value = mock_session - mock_get_auth_state.return_value = json.dumps(MOCK_AUTH_STATE) - mock_update_token_cache.return_value = MOCK_TOKEN_ID - mock_get_token_cache.return_value = (json.dumps(MOCK_AUTH_STATE),json.dumps(MOCK_INTERNAL_METADATA_CATALOG)) - - # Create resource - response = self.client.post( - "/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers", - MOCK_POST_SERVER_REQUEST, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - - self.assertEquals(status.HTTP_202_ACCEPTED, response.status_code) - context = response.json() - self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token']) - self.assertIsNotNone(context['server']) - - # Retrieve resource - response = self.client.get( - "/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers", - {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_200_OK, response.status_code) - context = response.json() - - self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token']) - self.assertIsNotNone(context['servers']) - - # Update resource - response = self.client.get( - "/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers", - {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - self.assertEquals(status.HTTP_200_OK, response.status_code) - context = response.json() - - self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token']) - self.assertIsNotNone(context['servers']) - - #simulate client to make the request - response = self.client.delete( - "/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers/324dfb7d-f4a9-419a-9a19-237df04b443b", - HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) - - self.assertEquals(status.HTTP_204_NO_CONTENT, response.status_code) - self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token']) + ''' + Test service proxy API: GET + + :param mock_get_token_cache: + :param mock_update_token_cache: + :param mock_get_auth_state: + :param mock_get_session: + :param mock_get_vim_info: + :return: + ''' + + # mock VimDriverUtils APIs + mock_session_specs = ["get", "post", "put", "patch", "delete"] + + mock_get_servers_response_obj = mock.Mock(spec=MockResponse) + mock_get_servers_response_obj.status_code = 200 + mock_get_servers_response_obj.content = MOCK_GET_SERVERS_RESPONSE + mock_get_servers_response_obj.json.return_value = MOCK_GET_SERVERS_RESPONSE + + mock_post_server_response_obj = mock.Mock(spec=MockResponse) + mock_post_server_response_obj.status_code = 202 + mock_post_server_response_obj.content = MOCK_POST_SERVER_RESPONSE + mock_post_server_response_obj.json.return_value = MOCK_POST_SERVER_RESPONSE + + mock_patch_server_response_obj = mock.Mock(spec=MockResponse) + mock_patch_server_response_obj.status_code = 202 + mock_patch_server_response_obj.content = MOCK_PATCH_IMAGE_REQUEST + mock_patch_server_response_obj.json.return_value = MOCK_PATCH_IMAGE_REQUEST + + mock_delete_server_response_obj = mock.Mock(spec=MockResponse) + mock_delete_server_response_obj.status_code = 204 + + mock_session = mock.Mock(name='mock_session', spec=mock_session_specs) + mock_session.get.return_value = mock_get_servers_response_obj + mock_session.post.return_value = mock_post_server_response_obj + mock_session.patch.return_value = mock_patch_server_response_obj + mock_session.delete.return_value = mock_delete_server_response_obj + + mock_get_vim_info.return_value = MOCK_VIM_INFO + mock_get_session.return_value = mock_session + mock_get_auth_state.return_value = json.dumps(MOCK_AUTH_STATE) + mock_update_token_cache.return_value = MOCK_TOKEN_ID + mock_get_token_cache.return_value = (json.dumps(MOCK_AUTH_STATE), json.dumps(MOCK_INTERNAL_METADATA_CATALOG)) + + # Create resource + response = self.client.post( + "/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers", + MOCK_POST_SERVER_REQUEST, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) + + self.assertEquals(status.HTTP_202_ACCEPTED, response.status_code) + context = response.json() + self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token']) + self.assertIsNotNone(context['server']) + + # Retrieve resource + response = self.client.get( + "/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers", + {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) + self.assertEquals(status.HTTP_200_OK, response.status_code) + context = response.json() + + self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token']) + self.assertIsNotNone(context['servers']) + + # Update resource + response = self.client.get( + "/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers", + {}, HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) + self.assertEquals(status.HTTP_200_OK, response.status_code) + context = response.json() + + self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token']) + self.assertIsNotNone(context['servers']) + + # simulate client to make the request + response = self.client.delete( + "/api/multicloud-ocata/v0/windriver-hudson-dc_RegionOne/compute/v2.1/fcca3cc49d5e42caae15459e27103efc/servers/324dfb7d-f4a9-419a-9a19-237df04b443b", + HTTP_X_AUTH_TOKEN=MOCK_TOKEN_ID) + + self.assertEquals(status.HTTP_204_NO_CONTENT, response.status_code) + self.assertEquals(MOCK_TOKEN_ID, response['X-Subject-Token']) diff --git a/ocata/ocata/proxy/views/__init__.py b/ocata/ocata/proxy/views/__init__.py index afa702d3..ae1ce9db 100644 --- a/ocata/ocata/proxy/views/__init__.py +++ b/ocata/ocata/proxy/views/__init__.py @@ -11,4 +11,3 @@ # 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. - diff --git a/ocata/ocata/proxy/views/identityV3.py b/ocata/ocata/proxy/views/identityV3.py index 9a96f66e..ff1178a8 100644 --- a/ocata/ocata/proxy/views/identityV3.py +++ b/ocata/ocata/proxy/views/identityV3.py @@ -22,40 +22,41 @@ logger = logging.getLogger(__name__) # DEBUG=True + class Tokens(newton_identityV3.Tokens): def __init__(self): self.proxy_prefix = settings.MULTICLOUD_PREFIX self._logger = logger + class TokensV2(newton_identityV3.TokensV2): def __init__(self): self.proxy_prefix = settings.MULTICLOUD_PREFIX self._logger = logger + class APIv1Tokens(Tokens): def __init__(self): super(APIv1Tokens, self).__init__() self.proxy_prefix = settings.MULTICLOUD_API_V1_PREFIX - def get(self, request, cloud_owner="", cloud_region_id=""): - self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner,cloud_region_id)) - #self._logger.debug("META> %s" % request.META) - #self._logger.debug("data> %s" % request.data) + self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner, cloud_region_id)) + # self._logger.debug("META> %s" % request.META) + # self._logger.debug("data> %s" % request.data) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) return super(APIv1Tokens, self).get(request, vimid) - def post(self, request, cloud_owner="", cloud_region_id=""): - self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner,cloud_region_id)) - #self._logger.debug("META> %s" % request.META) - #self._logger.debug("data> %s" % request.data) + self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner, cloud_region_id)) + # self._logger.debug("META> %s" % request.META) + # self._logger.debug("data> %s" % request.data) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) - return super(APIv1Tokens,self).post(request, vimid) + return super(APIv1Tokens, self).post(request, vimid) class APIv1TokensV2(TokensV2): @@ -63,20 +64,18 @@ class APIv1TokensV2(TokensV2): super(APIv1TokensV2, self).__init__() self.proxy_prefix = settings.MULTICLOUD_API_V1_PREFIX - def get(self, request, cloud_owner="", cloud_region_id=""): - self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner,cloud_region_id)) - #self._logger.debug("META> %s" % request.META) - #self._logger.debug("data> %s" % request.data) + self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner, cloud_region_id)) + # self._logger.debug("META> %s" % request.META) + # self._logger.debug("data> %s" % request.data) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) return super(APIv1TokensV2, self).get(request, vimid) - def post(self, request, cloud_owner="", cloud_region_id=""): - self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner,cloud_region_id)) - #self._logger.debug("META> %s" % request.META) - #self._logger.debug("data> %s" % request.data) + self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner, cloud_region_id)) + # self._logger.debug("META> %s" % request.META) + # self._logger.debug("data> %s" % request.data) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) - return super(APIv1TokensV2,self).post(request, vimid) + return super(APIv1TokensV2, self).post(request, vimid) diff --git a/ocata/ocata/proxy/views/services.py b/ocata/ocata/proxy/views/services.py index 032cefef..2cdf92d8 100644 --- a/ocata/ocata/proxy/views/services.py +++ b/ocata/ocata/proxy/views/services.py @@ -14,9 +14,6 @@ import logging -from rest_framework import status - -from django.conf import settings from newton_base.proxy import services as newton_services from common.msapi import extsys @@ -24,6 +21,7 @@ logger = logging.getLogger(__name__) # DEBUG=True + class Services(newton_services.Services): def __init__(self): @@ -41,10 +39,11 @@ class GetTenants(newton_services.GetTenants): def get(self, request, vimid="", servicetype="identity", requri='v3/projects'): self._logger.debug("GetTenants--get::META> %s" % request.META) self._logger.debug("GetTenants--get::data> %s" % request.data) - self._logger.debug("GetTenants--get::vimid, servicetype, requri> %s,%s,%s" - % (vimid, servicetype, requri)) + self._logger.debug("GetTenants--get::vimid, servicetype, requri> %s,%s,%s" % + (vimid, servicetype, requri)) + + return super(GetTenants, self).get(request, vimid, servicetype, requri) - return super(GetTenants,self).get(request, vimid, servicetype, requri) class APIv1Services(Services): @@ -58,37 +57,37 @@ class APIv1Services(Services): # self._logger.debug("META, data> %s , %s" % (request.META, request.data)) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) - return super(APIv1Services,self).head(request, vimid, servicetype, requri) + return super(APIv1Services, self).head(request, vimid, servicetype, requri) def get(self, request, cloud_owner="", cloud_region_id="", servicetype="", requri=""): self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner, cloud_region_id)) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) - return super(APIv1Services,self).get(request, vimid, servicetype, requri) + return super(APIv1Services, self).get(request, vimid, servicetype, requri) def post(self, request, cloud_owner="", cloud_region_id="", servicetype="", requri=""): self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner, cloud_region_id)) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) - return super(APIv1Services,self).post(request, vimid, servicetype, requri) + return super(APIv1Services, self).post(request, vimid, servicetype, requri) def put(self, request, cloud_owner="", cloud_region_id="", servicetype="", requri=""): self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner, cloud_region_id)) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) - return super(APIv1Services,self).put(request, vimid, servicetype, requri) + return super(APIv1Services, self).put(request, vimid, servicetype, requri) def patch(self, request, cloud_owner="", cloud_region_id="", servicetype="", requri=""): self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner, cloud_region_id)) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) - return super(APIv1Services,self).patch(request, vimid, servicetype, requri) + return super(APIv1Services, self).patch(request, vimid, servicetype, requri) def delete(self, request, cloud_owner="", cloud_region_id="", servicetype="", requri=""): self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner, cloud_region_id)) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) - return super(APIv1Services,self).delete(request, vimid, servicetype, requri) + return super(APIv1Services, self).delete(request, vimid, servicetype, requri) class APIv1GetTenants(GetTenants): @@ -106,7 +105,7 @@ class APIv1GetTenants(GetTenants): # self._logger.debug("META, data> %s , %s" % (request.META, request.data)) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) - return super(APIv1GetTenants,self).head(request, vimid, servicetype, requri) + return super(APIv1GetTenants, self).head(request, vimid, servicetype, requri) def get(self, request, cloud_owner="", cloud_region_id="", servicetype="identity", requri='v3/projects'): self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner, cloud_region_id)) @@ -114,7 +113,7 @@ class APIv1GetTenants(GetTenants): # self._logger.debug("with META> %s" % request.META) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) - return super(APIv1GetTenants,self).get(request, vimid, servicetype, requri) + return super(APIv1GetTenants, self).get(request, vimid, servicetype, requri) def post(self, request, cloud_owner="", cloud_region_id="", servicetype="identity", requri=""): self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner, cloud_region_id)) @@ -123,22 +122,22 @@ class APIv1GetTenants(GetTenants): # self._logger.debug("with data> %s" % request.data) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) - return super(APIv1GetTenants,self).post(request, vimid, servicetype, requri) + return super(APIv1GetTenants, self).post(request, vimid, servicetype, requri) def put(self, request, cloud_owner="", cloud_region_id="", servicetype="identity", requri=""): self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner, cloud_region_id)) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) - return super(APIv1GetTenants,self).put(request, vimid, servicetype, requri) + return super(APIv1GetTenants, self).put(request, vimid, servicetype, requri) def patch(self, request, cloud_owner="", cloud_region_id="", servicetype="identity", requri=""): self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner, cloud_region_id)) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) - return super(APIv1GetTenants,self).patch(request, vimid, servicetype, requri) + return super(APIv1GetTenants, self).patch(request, vimid, servicetype, requri) def delete(self, request, cloud_owner="", cloud_region_id="", servicetype="identity", requri=""): self._logger.info("cloud_owner,cloud_region_id: %s,%s" % (cloud_owner, cloud_region_id)) vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) - return super(APIv1GetTenants,self).delete(request, vimid, servicetype, requri) + return super(APIv1GetTenants, self).delete(request, vimid, servicetype, requri) |