diff options
-rw-r--r-- | mgr/mgr/swagger/swagger.json | 361 | ||||
-rw-r--r-- | mgr/mgr/swagger/tests.py | 30 | ||||
-rw-r--r-- | mgr/mgr/swagger/views.py | 27 |
3 files changed, 0 insertions, 418 deletions
diff --git a/mgr/mgr/swagger/swagger.json b/mgr/mgr/swagger/swagger.json deleted file mode 100644 index 743612b..0000000 --- a/mgr/mgr/swagger/swagger.json +++ /dev/null @@ -1,361 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "version": "1.0.0", - "title": "VNF Mgr Service rest API" - }, - "basePath": "/api/vnfmgr/v1", - "tags": [ - { - "name": "vnfmgr" - } - ], - "paths": { - "/vnfs": { - "post": { - "tags": [ - "vnfReg Resource" - ], - "summary": "save the specified vnfReg info", - "description": "", - "operationId": "save_vnfReg", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "request parameters", - "required": true, - "schema": { - "$ref": "#/definitions/VnfRegRequestParams" - } - } - ], - "responses": { - "201": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/saveVnfRegInfo" - } - }, - "404": { - "description": "the vnf instance id is wrong" - }, - "500": { - "description": "the url is invalid" - } - } - } - }, - "/vnfs/{vnfInstId}": { - "get": { - "tags": [ - "vnfReg Resource" - ], - "summary": "query the specified vnfReg info", - "description": "", - "operationId": "query_vnfReg", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "vnfInstId", - "in": "path", - "description": "vnf instance id", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/VnfRegInfo" - } - }, - "404": { - "description": "the vnf instance id is wrong" - }, - "500": { - "description": "the url is invalid" - } - } - }, - "put": { - "tags": [ - "vnf Resource" - ], - "summary": "save the specified vnf info", - "description": "", - "operationId": "save_vnf", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "request parameters", - "required": true, - "schema": { - "$ref": "#/definitions/VnfRegRequestParams" - } - } - ], - "responses": { - "202": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/saveVnfInfo" - } - }, - "404": { - "description": "the vnf instance id is wrong" - }, - "500": { - "description": "the url is invalid" - } - } - }, - "delete": { - "tags": [ - "vnf Resource" - ], - "summary": "delete the specified vnf info", - "description": "", - "operationId": "delete_vnf", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "vnfInstId", - "in": "path", - "description": "vnf instance id", - "required": true, - "type": "string" - } - ], - "responses": { - "204": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/deleteVnfInfo" - } - }, - "404": { - "description": "the vnf instance id is wrong" - }, - "500": { - "description": "the url is invalid" - } - } - } - }, - "/configuration": { - "post": { - "tags": [ - "vnf Resource" - ], - "summary": "config the specified vnf info", - "description": "", - "operationId": "config_vnf", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "request data", - "required": true, - "schema": { - "$ref": "#/definitions/VnfRequestParams" - } - } - ], - "responses": { - "202": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/configVnfInfo" - } - }, - "404": { - "description": "the vnf instance id is wrong" - }, - "500": { - "description": "the url is invalid" - } - } - } - } - }, - "definitions": { - "VnfRegRequestParams": { - "type": "object", - "properties": { - "vnfInstId": { - "type": "string" - }, - "ip": { - "type": "string" - }, - "port": { - "type": "string" - }, - "username": { - "type": "string" - }, - "password": { - "type": "string" - } - } - }, - "saveVnfRegInfo": { - "type": "object", - "properties": {} - }, - "VnfRegInfo": { - "type": "object", - "properties": { - "vnfInstId": { - "type": "string" - }, - "ip": { - "type": "string" - }, - "port": { - "type": "string" - }, - "username": { - "type": "string" - }, - "password": { - "type": "string" - } - } - }, - "saveVnfInfo": { - "type": "object" - }, - "deleteVnfInfo": { - "type": "object" - }, - "VnfRequestParams": { - "type": "object", - "properties": { - "vnfInstanceId": { - "type": "string" - }, - "vnfConfigurationData": { - "type": "object", - "properties": { - "cp": { - "type": "array", - "items": { - "type": "object" - } - }, - "vnfSpecificData": { - "type": "object", - "properties": { - "autoScalable": { - "type": "string" - }, - "autoHealable": { - "type": "string" - } - } - } - } - }, - "vnfcConfigurationData": { - "type": "object", - "properties": { - "vnfcId": { - "type": "string" - }, - "cp": { - "type": "array", - "items": { - "cpId": { - "type": "string" - }, - "cpdId": { - "type": "string" - }, - "cpAddress": { - "type": "array", - "items": { - "type": "object" - } - } - } - }, - "vnfcSpecificData": {} - } - } - } - }, - "configVnfInfo": { - "type": "object", - "properties": { - "vnfConfigurationData": { - "cp": { - "type": "array", - "items": { - "type": "object" - } - }, - "vnfSpecificData": { - "type": "object", - "properties": { - "autoScalable": { - "type": "string" - }, - "autoHealable": { - "type": "string" - } - } - } - }, - "vnfcConfigurationData": { - "type": "object", - "properties": { - "vnfcId": { - "type": "string" - }, - "cp": { - "type": "array", - "items": { - "type": "object" - } - }, - "vnfcSpecificData": { - "type": "object" - } - } - } - } - } - } -}
\ No newline at end of file diff --git a/mgr/mgr/swagger/tests.py b/mgr/mgr/swagger/tests.py deleted file mode 100644 index 4418b01..0000000 --- a/mgr/mgr/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/vnfmgr/v1/swagger.json") - self.assertEqual(status.HTTP_200_OK, response.status_code, response.content) diff --git a/mgr/mgr/swagger/views.py b/mgr/mgr/swagger/views.py deleted file mode 100644 index e3de4f6..0000000 --- a/mgr/mgr/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) |