diff options
author | maopengzhang <zhang.maopeng1@zte.com.cn> | 2017-09-28 16:59:05 +0800 |
---|---|---|
committer | maopengzhang <zhang.maopeng1@zte.com.cn> | 2017-09-28 16:59:05 +0800 |
commit | 5ab315f97965decc438a1b058881c3b9f6ef0669 (patch) | |
tree | d208aa2e56428f2ccdb90cda7a4f1014f790ccd5 | |
parent | d4d9f19a30092bdf1df6aabe5b66855b000dbc66 (diff) |
Modify the database in the swagger
Add database swagger
Change-Id: I182dd1d5c7144790e6fbad7544854657caea5910
Issue-ID: VFC-163
Signed-off-by: maopengzhang <zhang.maopeng1@zte.com.cn>
-rw-r--r-- | lcm/swagger/vfc.db.swagger.json | 91 | ||||
-rw-r--r-- | lcm/swagger/vfc.others.swagger.json | 78 | ||||
-rw-r--r-- | 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()) |