From 9669eba60a67a221dd64759078ca0b07227f16c5 Mon Sep 17 00:00:00 2001 From: fujinhua Date: Thu, 9 Aug 2018 15:02:24 +0800 Subject: Remove useless codes of gvnfmdriver Change-Id: Ic146a473d1221fcdc291353ce8d91e584dc658e6 Issue-ID: VFC-1009 Signed-off-by: fujinhua --- gvnfmadapter/driver/swagger/swagger.json | 468 ------------------------------- gvnfmadapter/driver/swagger/tests.py | 30 -- gvnfmadapter/driver/swagger/urls.py | 1 - gvnfmadapter/driver/swagger/views.py | 27 -- 4 files changed, 526 deletions(-) delete mode 100644 gvnfmadapter/driver/swagger/swagger.json delete mode 100644 gvnfmadapter/driver/swagger/tests.py delete mode 100644 gvnfmadapter/driver/swagger/views.py diff --git a/gvnfmadapter/driver/swagger/swagger.json b/gvnfmadapter/driver/swagger/swagger.json deleted file mode 100644 index eade49b..0000000 --- a/gvnfmadapter/driver/swagger/swagger.json +++ /dev/null @@ -1,468 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "version": "1.0.0", - "title": "GVNFM Driver Service rest API" - }, - "basePath": "/api/{vnfmtype}/v1", - "tags": [ - { - "name": "gvnfmdriver" - } - ], - "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 instantiate", - "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 terminate", - "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 query", - "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" - } - } - } - } - }, - "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": { - "nfInstanceId": { - "type": "string" - }, - "vnfStatus": { - "type": "string" - }, - "version": { - "type": "string" - } - } - } - } - }, - "OperationStatusInfo": { - "type": "object", - "properties": { - "responsedescriptor": { - "type": "object", - "properties": { - "status": { - "type": "string" - }, - "responsehistorylist": { - "type": "array" - }, - "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": "array" - }, - "tenant": { - "type": "string" - }, - "vnfistanceid": { - "type": "string" - }, - "operationright": { - "type": "string" - }, - "vmlist": { - "type": "array" - } - } - }, - "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": "array" - } - } - }, - "ResponseNotifyResult": { - "type": "object" - } - } -} \ No newline at end of file diff --git a/gvnfmadapter/driver/swagger/tests.py b/gvnfmadapter/driver/swagger/tests.py deleted file mode 100644 index 62251fc..0000000 --- a/gvnfmadapter/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/gvnfmdriver/v1/swagger.json") - self.assertEqual(status.HTTP_200_OK, response.status_code, response.content) diff --git a/gvnfmadapter/driver/swagger/urls.py b/gvnfmadapter/driver/swagger/urls.py index 31eaeec..e4bac25 100644 --- a/gvnfmadapter/driver/swagger/urls.py +++ b/gvnfmadapter/driver/swagger/urls.py @@ -36,7 +36,6 @@ SchemaView = get_schema_view( ) urlpatterns = [ - # url(r'^api/gvnfmdriver/v1/swagger.json$', views.SwaggerView.as_view()), url(r'^api/gvnfmdriver/v1/swagger(?P.json|.yaml)$', SchemaView.without_ui(cache_timeout=0), name='schema-json'), url(r'^api/gvnfmdriver/v1/swagger$', SchemaView.with_ui('swagger', cache_timeout=0), diff --git a/gvnfmadapter/driver/swagger/views.py b/gvnfmadapter/driver/swagger/views.py deleted file mode 100644 index e3de4f6..0000000 --- a/gvnfmadapter/driver/swagger/views.py +++ /dev/null @@ -1,27 +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