summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaibin Huang <haibin.huang@intel.com>2018-12-17 20:34:44 +0800
committerHaibin Huang <haibin.huang@intel.com>2018-12-17 20:41:32 +0800
commit99923657b9999074c4cc38973ab63c0bac1a76d7 (patch)
tree6d3ba97cad5cafa598b3545635a850a07a167b8b
parente437f5ef84e17a07f1cde729f723c518076d5f73 (diff)
Fix registration pep8 error
This patch is only fixing the pep8 issues under the registration folder for pike release, which is only triggered by tox mannually. Change-Id: I22245f9e97277cd48ad0a8061694ab7bfe593e6a Issue-ID: MULTICLOUD-428 Signed-off-by: Haibin Huang <haibin.huang@intel.com>
-rw-r--r--pike/pike/registration/__init__.py1
-rw-r--r--pike/pike/registration/tests/__init__.py1
-rw-r--r--pike/pike/registration/tests/test_registration.py70
-rw-r--r--pike/pike/registration/views/__init__.py1
-rw-r--r--pike/pike/registration/views/registration.py7
5 files changed, 35 insertions, 45 deletions
diff --git a/pike/pike/registration/__init__.py b/pike/pike/registration/__init__.py
index 741e0afb..5a9af6b8 100644
--- a/pike/pike/registration/__init__.py
+++ b/pike/pike/registration/__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/pike/pike/registration/tests/__init__.py b/pike/pike/registration/tests/__init__.py
index 741e0afb..5a9af6b8 100644
--- a/pike/pike/registration/tests/__init__.py
+++ b/pike/pike/registration/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/pike/pike/registration/tests/test_registration.py b/pike/pike/registration/tests/test_registration.py
index 1b12bf65..becbbcc1 100644
--- a/pike/pike/registration/tests/test_registration.py
+++ b/pike/pike/registration/tests/test_registration.py
@@ -35,20 +35,19 @@ PIKE_MOCK_VIM_INFO = {
"vimId": "windriver-hudson-dc_RegionOne",
'cloud_owner': 'windriver-hudson-dc',
'cloud_region_id': 'RegionOne',
- 'cloud_extra_info':
- {
- "ovsDpdk":{
- "version": "v1",
- "arch": "Intel64",
- "libname":"dataProcessingAccelerationLibrary",
- "libversion":"v12.1",
- }
- },
+ 'cloud_extra_info': {
+ "ovsDpdk": {
+ "version": "v1",
+ "arch": "Intel64",
+ "libname": "dataProcessingAccelerationLibrary",
+ "libversion": "v12.1",
+ }
+ },
'insecure': 'True'
}
MOCK_GET_TENANT_RESPONSE = {
- "projects":[
+ "projects": [
{"id": "1", "name": "project"},
{"id": "2", "name": "project2"},
]
@@ -60,8 +59,8 @@ MOCK_GET_FLAVOR_RESPONSE = {
"id": "1", "name": "micro", "vcpus": 1, "ram": "1MB",
"disk": "1G", "OS-FLV-EXT-DATA:ephemeral": False,
"swap": True, "os-flavor-access:is_public": True,
- "OS-FLV-DISABLED:disabled": True, "link": [{"href":1}]
- },
+ "OS-FLV-DISABLED:disabled": True, "link": [{"href": 1}]
+ },
{
"id": "2", "name": "mini", "vcpus": 2, "ram": "2",
"disk": "2G", "OS-FLV-EXT-DATA:ephemeral": True,
@@ -95,7 +94,7 @@ MOCK_GET_AZ_RESPONSE = {
{
"zoneName": "production",
"zoneState": {"available": True},
- "hosts": { "hypervisor": "kvm" }
+ "hosts": {"hypervisor": "kvm"}
},
{
"zoneName": "testing",
@@ -114,9 +113,13 @@ MOCK_GET_SNAPSHOT_RESPONSE = {
{
"id": 1, "name": "test", "metadata":
{
- "architecture": "x86", "os-distro": "clearlinux",
- "os-version": "276", "vendor": "intel", "version": 3,
- "selflink": "test", "prev-snapshot-id": "test-id"
+ "architecture": "x86",
+ "os-distro": "clearlinux",
+ "os-version": "276",
+ "vendor": "intel",
+ "version": 3,
+ "selflink": "test",
+ "prev-snapshot-id": "test-id"
}
},
{"id": 2, "name": "test2"}
@@ -145,7 +148,7 @@ TEST_REGISTER_ENDPOINT_REQUEST = {
# HPA UT1: CPU-PINNING
-MOCK_GET_HPA_FLAVOR_LIST1_RESPONSE= {
+MOCK_GET_HPA_FLAVOR_LIST1_RESPONSE = {
"flavors": [
{
"id": "1", "name": "micro", "vcpus": 1, "ram": "1024",
@@ -187,11 +190,11 @@ MOCK_GET_HPA_FLAVOR_onap_mini_EXTRA_SPECS4_RESPONSE = {
"extra_specs": {
"aggregate_instance_extra_specs:storage": "local_image",
"capabilities:cpu_info:model": "Haswell",
- "hw:numa_nodes": "2",
- "hw:numa_cpus.0": "0,1",
- "hw:numa_cpus.1": "2,3,4,5",
- "hw:numa_mem.0": "2048",
- "hw:numa_mem.1": "2048"
+ "hw:numa_nodes": "2",
+ "hw:numa_cpus.0": "0,1",
+ "hw:numa_cpus.1": "2,3,4,5",
+ "hw:numa_mem.0": "2048",
+ "hw:numa_mem.1": "2048"
}
}
@@ -200,7 +203,7 @@ MOCK_GET_HPA_FLAVOR_onap_mini_EXTRA_SPECS5_RESPONSE = {
"extra_specs": {
"aggregate_instance_extra_specs:storage": "local_image",
"capabilities:cpu_info:model": "Haswell",
- "hw:capabilities:cpu_info:features": "avx,acpi"
+ "hw:capabilities:cpu_info:features": "avx,acpi"
}
}
@@ -209,7 +212,7 @@ MOCK_GET_HPA_FLAVOR_onap_mini_EXTRA_SPECS6_RESPONSE = {
"extra_specs": {
"aggregate_instance_extra_specs:storage": "local_image",
"capabilities:cpu_info:model": "Haswell",
- "pci_passthrough:alias": "sriov-vf-intel-8086-15b3:4"
+ "pci_passthrough:alias": "sriov-vf-intel-8086-15b3:4"
}
}
@@ -321,8 +324,7 @@ class TestRegistration(test_base.TestRequest):
"registry"), TEST_REGISTER_ENDPOINT_REQUEST,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_202_ACCEPTED,
- response.status_code)
+ self.assertEquals(status.HTTP_202_ACCEPTED, response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@mock.patch.object(VimDriverUtils, 'get_vim_info')
@@ -351,8 +353,7 @@ class TestRegistration(test_base.TestRequest):
"registry"), TEST_REGISTER_ENDPOINT_REQUEST,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_202_ACCEPTED,
- response.status_code)
+ self.assertEquals(status.HTTP_202_ACCEPTED, response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@mock.patch.object(VimDriverUtils, 'get_vim_info')
@@ -381,8 +382,7 @@ class TestRegistration(test_base.TestRequest):
"registry"), TEST_REGISTER_ENDPOINT_REQUEST,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_202_ACCEPTED,
- response.status_code)
+ self.assertEquals(status.HTTP_202_ACCEPTED, response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@mock.patch.object(VimDriverUtils, 'get_vim_info')
@@ -411,8 +411,7 @@ class TestRegistration(test_base.TestRequest):
"registry"), TEST_REGISTER_ENDPOINT_REQUEST,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_202_ACCEPTED,
- response.status_code)
+ self.assertEquals(status.HTTP_202_ACCEPTED, response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@mock.patch.object(VimDriverUtils, 'get_vim_info')
@@ -441,8 +440,7 @@ class TestRegistration(test_base.TestRequest):
"registry"), TEST_REGISTER_ENDPOINT_REQUEST,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_202_ACCEPTED,
- response.status_code)
+ self.assertEquals(status.HTTP_202_ACCEPTED, response.status_code)
@mock.patch.object(VimDriverUtils, 'get_session')
@mock.patch.object(VimDriverUtils, 'get_vim_info')
@@ -471,6 +469,4 @@ class TestRegistration(test_base.TestRequest):
"registry"), TEST_REGISTER_ENDPOINT_REQUEST,
HTTP_X_AUTH_TOKEN=mock_info.MOCK_TOKEN_ID)
- self.assertEquals(status.HTTP_202_ACCEPTED,
- response.status_code)
-
+ self.assertEquals(status.HTTP_202_ACCEPTED, response.status_code)
diff --git a/pike/pike/registration/views/__init__.py b/pike/pike/registration/views/__init__.py
index 741e0afb..5a9af6b8 100644
--- a/pike/pike/registration/views/__init__.py
+++ b/pike/pike/registration/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/pike/pike/registration/views/registration.py b/pike/pike/registration/views/registration.py
index 121a39d0..2b34094e 100644
--- a/pike/pike/registration/views/registration.py
+++ b/pike/pike/registration/views/registration.py
@@ -13,21 +13,17 @@
# limitations under the License.
import logging
-import json
-import uuid
-import traceback
from django.conf import settings
from newton_base.registration import registration as newton_registration
-from common.exceptions import VimDriverNewtonException
from common.msapi import extsys
-from keystoneauth1.exceptions import HttpError
logger = logging.getLogger(__name__)
# DEBUG=True
+
class Registry(newton_registration.Registry):
def __init__(self):
@@ -35,6 +31,7 @@ class Registry(newton_registration.Registry):
self.aai_base_url = settings.AAI_BASE_URL
self._logger = logger
+
class RegistryV1(Registry):
def __init__(self):
self.proxy_prefix = settings.MULTICLOUD_API_V1_PREFIX