From d2bf9d6e5dedffa406f30547cebf63a239d85c1f Mon Sep 17 00:00:00 2001 From: fujinhua Date: Thu, 9 Aug 2018 15:04:08 +0800 Subject: Remove useless codes of ztevnfmdriver Change-Id: I612342bfd9e0d138da0e8a465281240e9266db3e Issue-ID: VFC-1009 Signed-off-by: fujinhua --- zte/vmanager/driver/swagger/swagger.json | 545 ------------------------------- zte/vmanager/driver/swagger/tests.py | 30 -- zte/vmanager/driver/swagger/urls.py | 1 - zte/vmanager/driver/swagger/views.py | 26 -- 4 files changed, 602 deletions(-) delete mode 100644 zte/vmanager/driver/swagger/swagger.json delete mode 100644 zte/vmanager/driver/swagger/tests.py delete mode 100644 zte/vmanager/driver/swagger/views.py diff --git a/zte/vmanager/driver/swagger/swagger.json b/zte/vmanager/driver/swagger/swagger.json deleted file mode 100644 index dfe53df9..00000000 --- a/zte/vmanager/driver/swagger/swagger.json +++ /dev/null @@ -1,545 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "version": "1.0.0", - "title": "ZTE VNFM Driver Service rest API" - }, - "basePath": "/api/ztevnfmdriver/v1", - "tags": [ - { - "name": "ztevnfmdriver" - } - ], - "paths": { - "/{vnfmid}/vnfs": { - "post": { - "tags": [ - "vnf instantiate" - ], - "summary": "instantiate the vnf", - "description": "", - "operationId": "instantiate_vnf", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "vnfmid", - "in": "path", - "description": "vnfm instance id", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "description": "request parameters", - "required": true, - "schema": { - "$ref": "#/definitions/VnfRequestParams" - } - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/VnfResult" - } - }, - "404": { - "description": "the vnfm instance id is wrong" - }, - "500": { - "description": "the url is invalid" - } - } - } - }, - "/{vnfmid}/vnfs/{vnfInstanceId}/terminate": { - "post": { - "tags": [ - "vnf terminate" - ], - "summary": "terminate the vnf", - "description": "", - "operationId": "terminate_vnf", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "vnfmid", - "in": "path", - "description": "vnfm instance id", - "required": true, - "type": "string" - }, - { - "name": "vnfInstanceId", - "in": "path", - "description": "vnf instance id", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/VnfResult" - } - }, - "404": { - "description": "the vnfmid and vnfInstanceId are wrong" - }, - "500": { - "description": "the url is invalid" - } - } - } - }, - "/{vnfmid}/vnfs/{vnfInstanceId}": { - "get": { - "tags": [ - "query vnf" - ], - "summary": "query the vnf", - "description": "", - "operationId": "query_vnf", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "vnfmid", - "in": "path", - "description": "vnfm instance id", - "required": true, - "type": "string" - }, - { - "name": "vnfInstanceId", - "in": "path", - "description": "vnf instance id", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/returnVnfInfo" - } - }, - "404": { - "description": "the vnfmid and vnfInstanceId are wrong" - }, - "500": { - "description": "the url is invalid" - } - } - } - }, - "/{vnfmid}/jobs/{jobid}": { - "get": { - "tags": [ - "operation status" - ], - "summary": "operation status", - "description": "", - "operationId": "operation_status", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "vnfmid", - "in": "path", - "description": "vnfm instance id", - "required": true, - "type": "string" - }, - { - "name": "jobid", - "in": "path", - "description": "vnf job id", - "required": true, - "type": "string" - }, - { - "name": "responseId", - "in": "path", - "description": "vnf response id", - "required": true, - "type": "integer" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/OperationStatusInfo" - } - }, - "404": { - "description": "the vnfmid ,jobid and responseId are wrong" - }, - "500": { - "description": "the url is invalid" - } - } - } - }, - "/resource/grant": { - "put": { - "tags": [ - "grant vnf" - ], - "summary": "grant the vnf", - "description": "", - "operationId": "grant_vnf", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "request data for grant the vnf", - "required": true, - "schema": { - "$ref": "#/definitions/RequestGrantParams" - } - } - ], - "responses": { - "201": { - "description": "successful grant", - "schema": { - "$ref": "#/definitions/responseGrantResult" - } - }, - "404": { - "description": "the request body is wrong" - }, - "500": { - "description": "the url is invalid" - } - } - } - }, - "/vnfs/lifecyclechangesnotification": { - "post": { - "tags": [ - "life cycle changes notification" - ], - "summary": "life cycle changes notification", - "description": "", - "operationId": "lifecyclechangesnotification", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "request data for grant the vnf", - "required": true, - "schema": { - "$ref": "#/definitions/RequestNotifyParams" - } - } - ], - "responses": { - "201": { - "description": "successful Notify", - "schema": { - "$ref": "#/definitions/ResponseNotifyResult" - } - }, - "404": { - "description": "the request body is wrong" - }, - "500": { - "description": "the url is invalid" - } - } - } - }, - "/{vnfmid}/vnfs/{nfInstanceId}/scale": { - "post": { - "tags": [ - "scale vnf" - ], - "summary": "scale vnf", - "description": "", - "operationId": "scale_vnf", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "vnfmid", - "in": "path", - "description": "vnfm instance id", - "required": true, - "type": "string" - }, - { - "name": "nfInstanceId", - "in": "path", - "description": "nf instance id", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "description": "request data for grant the vnf", - "required": true, - "schema": { - "$ref": "#/definitions/RequestScaleParams" - } - } - ], - "responses": { - "201": { - "description": "successful scale", - "schema": { - "$ref": "#/definitions/ResponseScaleResult" - } - }, - "404": { - "description": "the request body is wrong" - }, - "500": { - "description": "the url is invalid" - } - } - } - } - }, - "definitions": { - "VnfRequestParams": { - "type": "object", - "properties": { - "vnfInstanceName": { - "type": "string" - }, - "vnfPackageId": { - "type": "string" - }, - "vnfDescriptorId": { - "type": "string" - }, - "additionalParam": { - "type": "object", - "properties": { - "sdncontroller": { - "type": "string" - }, - "NatIpRange": { - "type": "string" - }, - "m6000_mng_ip": { - "type": "string" - }, - "externalPluginManageNetworkName": { - "type": "string" - }, - "location": { - "type": "string" - }, - "externalManageNetworkName": { - "type": "string" - }, - "sfc_data_network": { - "type": "string" - }, - "externalDataNetworkName": { - "type": "string" - }, - "inputs": { - "type": "object" - } - } - } - } - }, - "VnfResult": { - "type": "object", - "properties": { - "vnfInstanceId": { - "type": "string" - }, - "jobId": { - "type": "string" - } - } - }, - "returnVnfInfo": { - "type": "object", - "properties": { - "vnfInfo": { - "type": "object", - "properties": { - "vnfStatus": { - "type": "string" - } - } - } - } - }, - "OperationStatusInfo": { - "type": "object", - "properties": { - "responsedescriptor": { - "type": "object", - "properties": { - "status": { - "type": "string" - }, - "responsehistorylist": { - "type": "string" - }, - "responseid": { - "type": "integer" - }, - "errorcode": { - "type": "string" - }, - "progress": { - "type": "integer" - }, - "statusdescription": { - "type": "string" - } - } - }, - "jobid": { - "type": "string" - } - } - }, - "RequestGrantParams": { - "type": "object", - "properties": { - "vnfmid": { - "type": "string" - }, - "nfvoid": { - "type": "string" - }, - "vimid": { - "type": "string" - }, - "exvimidlist": { - "type": "string" - }, - "tenant": { - "type": "string" - }, - "vnfistanceid": { - "type": "string" - }, - "operationright": { - "type": "string" - }, - "vmlist": { - "type": "string" - } - } - }, - "responseGrantResult": { - "type": "object", - "properties": { - "vimid": { - "type": "string" - }, - "tenant": { - "type": "string" - } - } - }, - "RequestNotifyParams": { - "type": "object", - "properties": { - "nfvoid": { - "type": "string" - }, - "vnfmid": { - "type": "string" - }, - "vimid": { - "type": "string" - }, - "timestamp": { - "type": "string" - }, - "vnfinstanceid": { - "type": "string" - }, - "eventtype": { - "type": "string" - }, - "vmlist": { - "type": "string" - } - } - }, - "ResponseNotifyResult": { - "type": "object" - }, - "RequestScaleParams": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "aspectId": { - "type": "string" - }, - "numberOfSteps": { - "type": "string" - }, - "additionalParam": { - "type": "object" - } - } - }, - "ResponseScaleResult": { - "type": "object", - "properties": { - "jobid": { - "type": "string" - }, - "nfInstanceId": { - "type": "string" - } - } - } - } -} \ No newline at end of file diff --git a/zte/vmanager/driver/swagger/tests.py b/zte/vmanager/driver/swagger/tests.py deleted file mode 100644 index 981329a7..00000000 --- a/zte/vmanager/driver/swagger/tests.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2017 ZTE 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 unittest - -from django.test import Client -from rest_framework import status - - -class SwaggerViewTest(unittest.TestCase): - def setUp(self): - self.client = Client() - - def tearDown(self): - pass - - def test_sample(self): - response = self.client.get("/api/ztevnfmdriver/v1/swagger.json") - self.assertEqual(status.HTTP_200_OK, response.status_code, response.content) diff --git a/zte/vmanager/driver/swagger/urls.py b/zte/vmanager/driver/swagger/urls.py index dc377d31..56c3c8b6 100644 --- a/zte/vmanager/driver/swagger/urls.py +++ b/zte/vmanager/driver/swagger/urls.py @@ -35,7 +35,6 @@ SchemaView = get_schema_view( ) urlpatterns = [ - # url(r'^api/ztevnfmdriver/v1/swagger.json$', views.SwaggerView.as_view()), url(r'^api/ztevnfmdriver/v1/swagger(?P.json|.yaml)$', SchemaView.without_ui(cache_timeout=0), name='schema-json'), url(r'^api/ztevnfmdriver/v1/swagger$', SchemaView.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), url(r'^api/ztevnfmdriver/v1/redoc$', SchemaView.with_ui('redoc', cache_timeout=0), name='schema-redoc') diff --git a/zte/vmanager/driver/swagger/views.py b/zte/vmanager/driver/swagger/views.py deleted file mode 100644 index 400d6dd1..00000000 --- a/zte/vmanager/driver/swagger/views.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2017 ZTE 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 os -import json -from rest_framework.views import APIView -from rest_framework.response import Response - - -class SwaggerView(APIView): - def get(self, request, format=None): - json_file = os.path.join(os.path.dirname(__file__), 'swagger.json') - f = open(json_file) - json_data = json.JSONDecoder().decode(f.read()) - f.close() - return Response(json_data) -- cgit 1.2.3-korg