From 5ab315f97965decc438a1b058881c3b9f6ef0669 Mon Sep 17 00:00:00 2001 From: maopengzhang Date: Thu, 28 Sep 2017 16:59:05 +0800 Subject: Modify the database in the swagger Add database swagger Change-Id: I182dd1d5c7144790e6fbad7544854657caea5910 Issue-ID: VFC-163 Signed-off-by: maopengzhang --- lcm/swagger/vfc.db.swagger.json | 91 ++++++++++++++++++++++++++++++++++++- lcm/swagger/vfc.others.swagger.json | 78 ------------------------------- lcm/swagger/views.py | 8 ++++ 3 files changed, 98 insertions(+), 79 deletions(-) diff --git a/lcm/swagger/vfc.db.swagger.json b/lcm/swagger/vfc.db.swagger.json index 6c8efb02..fde55d32 100644 --- a/lcm/swagger/vfc.db.swagger.json +++ b/lcm/swagger/vfc.db.swagger.json @@ -1 +1,90 @@ - \ No newline at end of file +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "ONAP VFC Service Internal DB Rest API" + }, + "basePath": "/api/nslcm/v1", + "paths": { + "/mandb/{modelName}": { + "get": { + "tags": [ + "Database" + ], + "summary": "query ns table info", + "description": "query ns table info", + "operationId": "query_ns_table", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "required": true, + "type": "string", + "description": "model Name.", + "name": "modelName", + "in": "path" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/TableInfo" + } + }, + "404": { + "description": "URL not found" + }, + "500": { + "description": "the url is invalid" + } + } + }, + "delete": { + "tags": [ + "Database" + ], + "summary": "ns table delete", + "description": "ns table delete", + "operationId": "ns_table_delete", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "required": true, + "type": "string", + "description": "model Name.", + "name": "modelName", + "in": "path" + } + ], + "responses": { + "204": { + "description": "The tables were deleted successfully." + }, + "404": { + "description": "URL not found" + } + } + } + } + }, + "definitions": { + "TableInfo": { + "type": "object", + "properties": { + "count": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/lcm/swagger/vfc.others.swagger.json b/lcm/swagger/vfc.others.swagger.json index fe0bc826..16d70c0b 100644 --- a/lcm/swagger/vfc.others.swagger.json +++ b/lcm/swagger/vfc.others.swagger.json @@ -48,76 +48,6 @@ } } }, - "/mandb/{modelName}": { - "get": { - "tags": [ - "db" - ], - "summary": "query ns table info", - "description": "query ns table info", - "operationId": "query_ns_table", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "required": true, - "type": "string", - "description": "model Name.", - "name": "modelName", - "in": "path" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/TableInfo" - } - }, - "404": { - "description": "URL not found" - }, - "500": { - "description": "the url is invalid" - } - } - }, - "delete": { - "tags": [ - "db" - ], - "summary": "ns table delete", - "description": "ns table delete", - "operationId": "ns_table_delete", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "required": true, - "type": "string", - "description": "model Name.", - "name": "modelName", - "in": "path" - } - ], - "responses": { - "204": { - "description": "The tables were deleted successfully." - }, - "404": { - "description": "URL not found" - } - } - } - }, "/jobs/{jobId}": { "post": { "tags": [ @@ -178,14 +108,6 @@ "type": "string" } } - }, - "TableInfo": { - "type": "object", - "properties": { - "count": { - "type": "string" - } - } } } } \ No newline at end of file diff --git a/lcm/swagger/views.py b/lcm/swagger/views.py index 5034905c..e78ecead 100644 --- a/lcm/swagger/views.py +++ b/lcm/swagger/views.py @@ -53,6 +53,14 @@ class SwaggerJsonView(APIView): json_data["paths"].update(json_data_temp["paths"]) json_data["definitions"].update(json_data_temp["definitions"]) + json_file = os.path.join(os.path.dirname(__file__), 'vfc.db.swagger.json') + f = open(json_file) + json_data_temp = json.JSONDecoder().decode(f.read()) + f.close() + + json_data["paths"].update(json_data_temp["paths"]) + json_data["definitions"].update(json_data_temp["definitions"]) + json_file = os.path.join(os.path.dirname(__file__), 'vfc.others.swagger.json') f = open(json_file) json_data_temp = json.JSONDecoder().decode(f.read()) -- cgit 1.2.3-korg