From 78a414334876164ba61f63bed7cc91dc48620fcf Mon Sep 17 00:00:00 2001 From: dyh Date: Wed, 11 Sep 2019 14:26:19 +0800 Subject: update swagger info, add tags for swagger_auto_schema Change-Id: I50867c324e492cc7472bc199a4f72d202f235ce0 Issue-ID: MODELING-221 Signed-off-by: dyh --- README.md | 2 +- catalog/packages/views/catalog_views.py | 15 + catalog/packages/views/health_check_views.py | 1 + catalog/packages/views/ns_descriptor_views.py | 6 + catalog/packages/views/nsdm_subscription_views.py | 4 + catalog/packages/views/pnf_descriptor_views.py | 7 + .../packages/views/vnf_package_artifact_views.py | 1 + .../views/vnf_package_subscription_views.py | 4 + catalog/packages/views/vnf_package_views.py | 7 + catalog/swagger/etsicatalog.swagger.json | 793 +++++++++++++++++++++ catalog/swagger/urls.py | 2 +- catalog/swagger/vfc.catalog.swagger.json | 793 --------------------- catalog/swagger/views.py | 2 +- 13 files changed, 841 insertions(+), 796 deletions(-) create mode 100644 catalog/swagger/etsicatalog.swagger.json delete mode 100644 catalog/swagger/vfc.catalog.swagger.json diff --git a/README.md b/README.md index 8c60c05..663acc9 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ ./ project files ./docker docker related scripts ./logs log file - ./genericparser generic parser management + ./catalog generic parser management ./packages package life cycle API& logic ./ API url definition ./views API related views, each operation is a view diff --git a/catalog/packages/views/catalog_views.py b/catalog/packages/views/catalog_views.py index 6ed9fb9..740c530 100644 --- a/catalog/packages/views/catalog_views.py +++ b/catalog/packages/views/catalog_views.py @@ -46,6 +46,7 @@ logger = logging.getLogger(__name__) @swagger_auto_schema( method='POST', operation_description="On distribute NS package", + tags=["NS packages API"], request_body=NsPackageDistributeRequestSerializer, responses={ status.HTTP_202_ACCEPTED: NsPackageDistributeResponseSerializer, @@ -53,6 +54,7 @@ logger = logging.getLogger(__name__) @swagger_auto_schema( method='GET', operation_description="Query NS packages", + tags=["NS packages API"], request_body=no_body, responses={ status.HTTP_200_OK: NsPackagesSerializer, @@ -98,6 +100,7 @@ def nspackages_rc(request, *args, **kwargs): @swagger_auto_schema( method='POST', operation_description="On distribute Nf package", + tags=["NF packages API"], request_body=NfPackageDistributeRequestSerializer(), responses={ status.HTTP_202_ACCEPTED: PostJobResponseSerializer, @@ -105,6 +108,7 @@ def nspackages_rc(request, *args, **kwargs): @swagger_auto_schema( method='GET', operation_description="Query Nf packages", + tags=["NF packages API"], request_body=no_body, responses={ status.HTTP_200_OK: NfPackagesSerializer, @@ -158,6 +162,7 @@ def nfpackages_rc(request, *args, **kwargs): @swagger_auto_schema( method='DELETE', operation_description="Delete one NS package", + tags=["NS packages API"], request_body=no_body, manual_parameters=[ openapi.Parameter( @@ -174,6 +179,7 @@ def nfpackages_rc(request, *args, **kwargs): @swagger_auto_schema( method='GET', operation_description="Query one NS package", + tags=["NS packages API"], request_body=no_body, manual_parameters=[ openapi.Parameter( @@ -216,6 +222,7 @@ def ns_rd_csar(request, *args, **kwargs): @swagger_auto_schema( method='POST', operation_description="On distribute Service package", + tags=["Service packages API"], request_body=ServicePackageDistributeRequestSerializer, responses={ status.HTTP_202_ACCEPTED: "", @@ -224,6 +231,7 @@ def ns_rd_csar(request, *args, **kwargs): @swagger_auto_schema( method='GET', operation_description="Query Service packages", + tags=["Service packages API"], request_body=no_body, responses={ status.HTTP_200_OK: ServicePackagesSerializer, @@ -267,6 +275,7 @@ def servicepackages_rc(request, *args, **kwargs): @swagger_auto_schema( method='DELETE', operation_description="Delete one Service package", + tags=["Service packages API"], request_body=no_body, manual_parameters=[ openapi.Parameter( @@ -281,6 +290,7 @@ def servicepackages_rc(request, *args, **kwargs): @swagger_auto_schema( method='GET', operation_description="Query one Service package", + tags=["Service packages API"], request_body=no_body, manual_parameters=[ openapi.Parameter( @@ -327,6 +337,7 @@ def service_rd_csar(request, *args, **kwargs): @swagger_auto_schema( method='DELETE', operation_description="Delete one Nf package", + tags=["NF packages API"], request_body=no_body, manual_parameters=[ openapi.Parameter( @@ -343,6 +354,7 @@ def service_rd_csar(request, *args, **kwargs): @swagger_auto_schema( method='GET', operation_description="Query one Nf package", + tags=["NF packages API"], request_body=no_body, manual_parameters=[ openapi.Parameter( @@ -393,6 +405,7 @@ def nf_rd_csar(request, *args, **kwargs): @swagger_auto_schema( method='POST', operation_description="Parse model(NS, Service, VNF, PNF)", + tags=["Parser API"], request_body=ParseModelRequestSerializer, responses={ status.HTTP_202_ACCEPTED: ParseModelResponseSerializer, @@ -453,6 +466,7 @@ def model_parser(request, *args, **kwargs): @swagger_auto_schema( method='POST', operation_description="Parse NS model", + tags=["Parser API"], request_body=ParseModelRequestSerializer, responses={ status.HTTP_202_ACCEPTED: ParseModelResponseSerializer, @@ -486,6 +500,7 @@ def ns_model_parser(request, *args, **kwargs): @swagger_auto_schema( method='POST', operation_description="Parse NF model", + tags=["Parser API"], request_body=ParseModelRequestSerializer, responses={ status.HTTP_202_ACCEPTED: ParseModelResponseSerializer, diff --git a/catalog/packages/views/health_check_views.py b/catalog/packages/views/health_check_views.py index cc1a379..e5aad9a 100644 --- a/catalog/packages/views/health_check_views.py +++ b/catalog/packages/views/health_check_views.py @@ -24,6 +24,7 @@ logger = logging.getLogger(__name__) class HealthCheckView(APIView): @swagger_auto_schema( + tags=["Health check API"], responses={ status.HTTP_200_OK: 'Active'}) def get(self, request, format=None): diff --git a/catalog/packages/views/ns_descriptor_views.py b/catalog/packages/views/ns_descriptor_views.py index 3b8c1f9..797bfec 100644 --- a/catalog/packages/views/ns_descriptor_views.py +++ b/catalog/packages/views/ns_descriptor_views.py @@ -34,6 +34,7 @@ logger = logging.getLogger(__name__) @swagger_auto_schema( method='GET', operation_description="Query a NSD", + tags=["NSD API"], request_body=no_body, responses={ status.HTTP_200_OK: NsdInfoSerializer(), @@ -44,6 +45,7 @@ logger = logging.getLogger(__name__) @swagger_auto_schema( method='DELETE', operation_description="Delete a NSD", + tags=["NSD API"], request_body=no_body, responses={ status.HTTP_204_NO_CONTENT: "No content", @@ -66,6 +68,7 @@ def ns_info_rd(request, **kwargs): @swagger_auto_schema( method='POST', operation_description="Create a NSD", + tags=["NSD API"], request_body=CreateNsdInfoRequestSerializer(), responses={ status.HTTP_201_CREATED: NsdInfoSerializer(), @@ -75,6 +78,7 @@ def ns_info_rd(request, **kwargs): @swagger_auto_schema( method='GET', operation_description="Query multiple NSDs", + tags=["NSD API"], request_body=no_body, responses={ status.HTTP_200_OK: NsdInfosSerializer(), @@ -100,6 +104,7 @@ def ns_descriptors_rc(request): @swagger_auto_schema( method='PUT', operation_description="Upload NSD content", + tags=["NSD API"], request_body=no_body, responses={ status.HTTP_204_NO_CONTENT: 'PNFD file', @@ -109,6 +114,7 @@ def ns_descriptors_rc(request): @swagger_auto_schema( method='GET', operation_description="Download NSD content", + tags=["NSD API"], request_body=no_body, responses={ status.HTTP_204_NO_CONTENT: "No content", diff --git a/catalog/packages/views/nsdm_subscription_views.py b/catalog/packages/views/nsdm_subscription_views.py index 5e6394e..b4b82ae 100644 --- a/catalog/packages/views/nsdm_subscription_views.py +++ b/catalog/packages/views/nsdm_subscription_views.py @@ -44,6 +44,7 @@ def validate_data(data, serializer): @swagger_auto_schema( method='POST', operation_description="Create Subscription for NSD Management", + tags=["NSD API"], request_body=NsdmSubscriptionRequestSerializer(), responses={ status.HTTP_201_CREATED: NsdmSubscriptionSerializer, @@ -55,6 +56,7 @@ def validate_data(data, serializer): @swagger_auto_schema( method='GET', operation_description="Query subscriptions for Nsd Management", + tags=["NSD API"], request_body=no_body, responses={ status.HTTP_200_OK: NsdmSubscriptionsSerializer(), @@ -94,6 +96,7 @@ def nsd_subscription_rc(request): @swagger_auto_schema( method='GET', operation_description="Query subscriptions for Nsd Management", + tags=["NSD API"], request_body=no_body, responses={ status.HTTP_200_OK: NsdmSubscriptionSerializer(), @@ -105,6 +108,7 @@ def nsd_subscription_rc(request): @swagger_auto_schema( method='DELETE', operation_description="Delete subscription for Nsd Management", + tags=["NSD API"], request_body=no_body, responses={ status.HTTP_204_NO_CONTENT: 'No_Content', diff --git a/catalog/packages/views/pnf_descriptor_views.py b/catalog/packages/views/pnf_descriptor_views.py index 9120980..381b557 100644 --- a/catalog/packages/views/pnf_descriptor_views.py +++ b/catalog/packages/views/pnf_descriptor_views.py @@ -39,6 +39,7 @@ logger = logging.getLogger(__name__) @swagger_auto_schema( method='GET', operation_description="Query a PNFD", + tags=["PNFD API"], request_body=no_body, responses={ status.HTTP_200_OK: PnfdInfoSerializer(), @@ -49,6 +50,7 @@ logger = logging.getLogger(__name__) @swagger_auto_schema( method='DELETE', operation_description="Delete a PNFD", + tags=["PNFD API"], request_body=no_body, responses={ status.HTTP_204_NO_CONTENT: "No content", @@ -74,6 +76,7 @@ def pnfd_info_rd(request, **kwargs): # TODO @swagger_auto_schema( method='POST', operation_description="Create a PNFD", + tags=["PNFD API"], request_body=CreatePnfdInfoRequestSerializer(), responses={ status.HTTP_201_CREATED: PnfdInfoSerializer(), @@ -83,6 +86,7 @@ def pnfd_info_rd(request, **kwargs): # TODO @swagger_auto_schema( method='GET', operation_description="Query multiple PNFDs", + tags=["PNFD API"], request_body=no_body, responses={ status.HTTP_200_OK: PnfdInfosSerializer(), @@ -107,6 +111,7 @@ def pnf_descriptors_rc(request): @swagger_auto_schema( method='PUT', operation_description="Upload PNFD content", + tags=["PNFD API"], request_body=no_body, responses={ status.HTTP_204_NO_CONTENT: "No content", @@ -116,6 +121,7 @@ def pnf_descriptors_rc(request): @swagger_auto_schema( method='GET', operation_description="Fetch PNFD content", + tags=["PNFD API"], request_body=no_body, responses={ status.HTTP_204_NO_CONTENT: 'PNFD file', @@ -145,6 +151,7 @@ def pnfd_content_ru(request, **kwargs): @swagger_auto_schema( method='POST', operation_description="Parse PNF model", + tags=["Parser API"], request_body=ParseModelRequestSerializer, responses={ status.HTTP_202_ACCEPTED: ParseModelResponseSerializer, diff --git a/catalog/packages/views/vnf_package_artifact_views.py b/catalog/packages/views/vnf_package_artifact_views.py index 0de9682..23a76c7 100644 --- a/catalog/packages/views/vnf_package_artifact_views.py +++ b/catalog/packages/views/vnf_package_artifact_views.py @@ -38,6 +38,7 @@ VALID_FILTERS = [ class FetchVnfPkgmArtifactsView(APIView): @swagger_auto_schema( + tags=["VNF Package API"], responses={ status.HTTP_200_OK: "HTTP_200_OK", status.HTTP_404_NOT_FOUND: ProblemDetailsSerializer(), diff --git a/catalog/packages/views/vnf_package_subscription_views.py b/catalog/packages/views/vnf_package_subscription_views.py index 32904e3..27be798 100644 --- a/catalog/packages/views/vnf_package_subscription_views.py +++ b/catalog/packages/views/vnf_package_subscription_views.py @@ -46,6 +46,7 @@ VALID_FILTERS = [ class CreateQuerySubscriptionView(APIView): @swagger_auto_schema( + tags=["VNF Package API"], request_body=PkgmSubscriptionRequestSerializer, responses={ status.HTTP_201_CREATED: PkgmSubscriptionSerializer(), @@ -62,6 +63,7 @@ class CreateQuerySubscriptionView(APIView): return Response(data=subscription_info.data, status=status.HTTP_201_CREATED) @swagger_auto_schema( + tags=["VNF Package API"], responses={ status.HTTP_200_OK: PkgmSubscriptionSerializer(), status.HTTP_400_BAD_REQUEST: ProblemDetailsSerializer(), @@ -87,6 +89,7 @@ class CreateQuerySubscriptionView(APIView): class QueryTerminateSubscriptionView(APIView): @swagger_auto_schema( + tags=["VNF Package API"], responses={ status.HTTP_200_OK: PkgmSubscriptionSerializer(), status.HTTP_404_NOT_FOUND: ProblemDetailsSerializer(), @@ -106,6 +109,7 @@ class QueryTerminateSubscriptionView(APIView): return Response(data=subscription_serializer.data, status=status.HTTP_200_OK) @swagger_auto_schema( + tags=["VNF Package API"], responses={ status.HTTP_204_NO_CONTENT: "", status.HTTP_404_NOT_FOUND: ProblemDetailsSerializer(), diff --git a/catalog/packages/views/vnf_package_views.py b/catalog/packages/views/vnf_package_views.py index 9fc143b..44e3df7 100644 --- a/catalog/packages/views/vnf_package_views.py +++ b/catalog/packages/views/vnf_package_views.py @@ -37,6 +37,7 @@ logger = logging.getLogger(__name__) @swagger_auto_schema( method="GET", operation_description="Query multiple VNF package resource", + tags=["VNF Package API"], request_body=no_body, responses={ status.HTTP_200_OK: VnfPkgInfosSerializer(), @@ -46,6 +47,7 @@ logger = logging.getLogger(__name__) @swagger_auto_schema( method="POST", operation_description="Create an individual VNF package resource", + tags=["VNF Package API"], request_body=CreateVnfPkgInfoRequestSerializer, responses={ status.HTTP_201_CREATED: VnfPkgInfoSerializer(), @@ -73,6 +75,7 @@ def vnf_packages_rc(request): @swagger_auto_schema( method='PUT', operation_description="Upload VNF package content", + tags=["VNF Package API"], request_body=no_body, responses={ status.HTTP_202_ACCEPTED: "Successfully", @@ -82,6 +85,7 @@ def vnf_packages_rc(request): @swagger_auto_schema( method="GET", operation_description="Fetch VNF package content", + tags=["VNF Package API"], request_body=no_body, responses={ status.HTTP_200_OK: VnfPkgInfosSerializer(), @@ -113,6 +117,7 @@ def package_content_ru(request, **kwargs): @swagger_auto_schema( method='POST', operation_description="Upload VNF package content from uri", + tags=["VNF Package API"], request_body=UploadVnfPackageFromUriRequestSerializer, responses={ status.HTTP_202_ACCEPTED: "Successfully", @@ -136,6 +141,7 @@ def upload_from_uri_c(request, **kwargs): @swagger_auto_schema( method='GET', operation_description="Query an individual VNF package resource", + tags=["VNF Package API"], request_body=no_body, responses={ status.HTTP_200_OK: VnfPkgInfoSerializer(), @@ -146,6 +152,7 @@ def upload_from_uri_c(request, **kwargs): @swagger_auto_schema( method='DELETE', operation_description="Delete an individual VNF package resource", + tags=["VNF Package API"], request_body=no_body, responses={ status.HTTP_204_NO_CONTENT: "No content", diff --git a/catalog/swagger/etsicatalog.swagger.json b/catalog/swagger/etsicatalog.swagger.json new file mode 100644 index 0000000..941b42a --- /dev/null +++ b/catalog/swagger/etsicatalog.swagger.json @@ -0,0 +1,793 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0", + "title": "ONAP Modeling etsicatalog Rest API", + "description": "Modeling etsicatalog Management API.", + "contact": { + "name": "ONAP Modeling team", + "email": "onap-discuss@lists.onap.org", + "url": "https://gerrit.onap.org/r/#/admin/projects/modeling/etsicatalog" + } + }, + "basePath": "/api/catalog/v1", + "schemes": [ + "http", + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/nspackages": { + "get": { + "tags": [ + "nspackage" + ], + "summary": "query ns packages info", + "description": "query ns packages info", + "operationId": "query_ns_packages", + "parameters": [], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/NsPkgListInfo" + } + }, + "404": { + "description": "URL not found" + }, + "500": { + "description": "internal error" + } + } + }, + "post": { + "tags": [ + "nspackage" + ], + "summary": "ns package distribute", + "description": "ns package distribute", + "operationId": "ns_pkg_distribute", + "parameters": [ + { + "in": "body", + "name": "body", + "description": "distribute request param", + "required": true, + "schema": { + "$ref": "#/definitions/NsPkgDistributeRequest" + } + } + ], + "responses": { + "202": { + "description": "", + "schema": { + "$ref": "#/definitions/NsPkgDistributeResponse" + } + }, + "404": { + "description": "URL not found" + }, + "500": { + "description": "internal error" + } + } + } + }, + "/nspackages/{csarId}": { + "get": { + "tags": [ + "nspackage" + ], + "summary": "query ns package info", + "description": "query ns package info via ns package csarId", + "operationId": "query_ns_package", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "csarId", + "in": "path", + "description": "csar id of ns package", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/NsPkgDetailInfo" + } + }, + "404": { + "description": "URL not found" + }, + "500": { + "description": "internal error" + } + } + }, + "delete": { + "tags": [ + "nspackage" + ], + "summary": "delete ns pkg", + "description": "delete ns pkg", + "operationId": "delete_ns_pkg", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "csarId", + "in": "path", + "description": "csar id of ns package", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "Delete NS Package Response", + "schema": { + "$ref": "#/definitions/NsPkgDelResponse" + } + }, + "404": { + "description": "URL not found" + }, + "500": { + "description": "internal error" + } + } + } + }, + "/parsernsd": { + "post": { + "tags": [ + "model" + ], + "summary": "ns package model", + "description": "ns package model", + "operationId": "ms_model_parser", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "description": "distribute request param", + "required": true, + "schema": { + "$ref": "#/definitions/modelParserRequest" + } + } + ], + "responses": { + "202": { + "description": "", + "schema": { + "$ref": "#/definitions/modelParserResponse" + } + }, + "404": { + "description": "URL not found" + }, + "500": { + "description": "internal error" + } + } + } + }, + "/vnfpackages": { + "get": { + "tags": [ + "vnfpackage" + ], + "summary": "query vnf packages info", + "description": "query vnf packages info", + "operationId": "query_vnf_packages", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VnfPkgListInfo" + } + }, + "404": { + "description": "URL not found" + }, + "500": { + "description": "internal error" + } + } + }, + "post": { + "tags": [ + "vnfpackage" + ], + "summary": "vnf package distribute", + "description": "vnf package distribute", + "operationId": "vnf_pkg_distribute", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "description": "distribute request param", + "required": true, + "schema": { + "$ref": "#/definitions/VnfPkgDistributeRequest" + } + } + ], + "responses": { + "202": { + "description": "", + "schema": { + "$ref": "#/definitions/VnfPkgDistributeResponse" + } + }, + "404": { + "description": "URL not found" + }, + "500": { + "description": "internal error" + } + } + } + }, + "/vnfpackages/{csarId}": { + "get": { + "tags": [ + "vnfpackage" + ], + "summary": "query vnf package info", + "description": "query one vnf package info via vnf package csarId", + "operationId": "query_vnf_package", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "csarId", + "in": "path", + "description": "csar id of vnf package", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/VnfPkgDetailInfo" + } + }, + "404": { + "description": "URL not found" + }, + "500": { + "description": "internal error" + } + } + }, + "delete": { + "tags": [ + "vnfpackage" + ], + "summary": "delete vnf package", + "description": "delete vnf package", + "operationId": "delete_vnf_package", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "csarId", + "in": "path", + "description": "csar id of vnf package", + "required": true, + "type": "string" + } + ], + "responses": { + "202": { + "description": "Delete VNF Pakcage Response", + "schema": { + "$ref": "#/definitions/VnfPkgDelResponse" + } + }, + "404": { + "description": "URL not found" + }, + "500": { + "description": "internal error" + } + } + } + }, + "/parservnfd": { + "post": { + "tags": [ + "model" + ], + "summary": "vnf package model", + "description": "vnf package model", + "operationId": "vnf_model_parser", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "description": "distribute request param", + "required": true, + "schema": { + "$ref": "#/definitions/modelParserRequest" + } + } + ], + "responses": { + "202": { + "description": "", + "schema": { + "$ref": "#/definitions/modelParserResponse" + } + }, + "404": { + "description": "URL not found" + }, + "500": { + "description": "internal error" + } + } + } + }, + "/jobs/{jobId}": { + "get": { + "tags": [ + "job" + ], + "summary": "jobstatus", + "description": "Get Job Status", + "operationId": "get_jobstatus", + "parameters": [ + { + "required": true, + "type": "string", + "description": "job Id", + "name": "jobId", + "in": "path" + }, + { + "required": true, + "type": "string", + "description": "job response message id", + "name": "responseId", + "in": "query" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/JobDetailInfo" + } + } + } + }, + "post": { + "tags": [ + "job" + ], + "summary": "Update Job Status", + "description": "Update Job Status", + "operationId": "post_jobstatus", + "parameters": [ + { + "required": true, + "type": "string", + "description": "job Id", + "name": "jobId", + "in": "path" + }, + { + "required": true, + "schema": { + "$ref": "#/definitions/PostJobRequest" + }, + "description": "job status", + "name": "responseId", + "in": "body" + } + ], + "responses": { + "200": { + "description": "", + "schema": { + "$ref": "#/definitions/JobDetailInfo" + } + } + } + } + } + }, + "definitions": { + "NsPkgDistributeRequest": { + "type": "object", + "properties": { + "csarId": { + "type": "string", + "description": "network service package id, UUID" + } + } + }, + "NsPkgDistributeResponse": { + "type": "object", + "properties": { + "status": { + "type": "string", + "description": "Operation status. value is success or failed" + }, + "statusDescription": { + "type": "string", + "description": "description about the operation result" + }, + "errorCode": { + "type": "string", + "description": "If the status is failed, the errorcode will be returned" + } + } + }, + "NsPkgDelResponse": { + "type": "object", + "properties": { + "status": { + "type": "string", + "description": "Operation status. value is success or failed" + }, + "statusDescription": { + "type": "string", + "description": "description about the operation result" + }, + "errorCode": { + "type": "string", + "description": "If the status is failed, the errorcode will be returned" + } + } + }, + "NsPkgListInfo": { + "type": "array", + "items": { + "$ref": "#/definitions/NsPkgDetailInfo" + } + }, + "NsPkgDetailInfo": { + "type": "object", + "properties": { + "csarId": { + "type": "string" + }, + "packageInfo": { + "$ref": "#/definitions/NsPkgInfo" + } + } + }, + "NsPkgInfo": { + "type": "object", + "properties": { + "nsPackageId": { + "type": "string", + "description": "network service package id, UUID, csarId" + }, + "nsdId": { + "type": "string", + "description": "network service descriptor ID" + }, + "nsdProvider": { + "type": "string", + "description": "network service designer name" + }, + "nsdVersion": { + "type": "string", + "description": "network service descriptor version" + }, + "csarName": { + "type": "string", + "description": "network service package name" + }, + "nsdModel": { + "type": "string", + "description": "ns JSON string parsed and transformed by parser" + }, + "downloadUrl": { + "type": "string", + "description": "download url of network service package" + } + } + }, + "NsInstListInfo": { + "type": "array", + "items": { + "$ref": "#/definitions/NsInstInfo" + } + }, + "NsInstInfo": { + "type": "object", + "properties": { + "nsInstanceId": { + "type": "string", + "description": "network service instance ID" + }, + "nsInstanceName": { + "type": "string", + "description": "network service instance name" + } + } + }, + "VnfPkgDistributeRequest": { + "type": "object", + "properties": { + "csarId": { + "type": "string", + "description": "vnf package id, UUID" + } + } + }, + "VnfPkgDistributeResponse": { + "type": "object", + "properties": { + "jobId": { + "type": "string", + "description": "VNF package distribute job ID" + } + } + }, + "VnfPkgDelResponse": { + "type": "object", + "properties": { + "status": { + "type": "string", + "description": "Operation status. value is success or failed" + }, + "statusDescription": { + "type": "string", + "description": "description about the operation result" + }, + "errorCode": { + "type": "string", + "description": "If the status is failed, the errorcode will be returned" + } + } + }, + "VnfPkgListInfo": { + "type": "array", + "items": { + "$ref": "#/definitions/VnfPkgDetailInfo" + } + }, + "VnfPkgDetailInfo": { + "type": "object", + "properties": { + "csarId": { + "type": "string", + "description": "vnf package id, UUID" + }, + "packageInfo": { + "$ref": "#/definitions/VnfPkgInfo" + }, + "imageInfo": { + "$ref": "#/definitions/VnfPkgImgListInfo" + } + } + }, + "VnfPkgInfo": { + "type": "object", + "description": "vnf package infomation", + "properties": { + "vnfPackageId": { + "type": "string", + "description": "vnf package id (csarId)" + }, + "csarName": { + "type": "string", + "description": "The name of the csar" + }, + "vnfdId": { + "type": "string", + "description": "VNF descriptor ID" + }, + "vnfdProvider": { + "type": "string", + "description": "VNF descriptor vendor ID" + }, + "vnfdModel": { + "type": "string", + "description": "The model of the VNF (JSON) encoded to string" + }, + "vnfdVersion": { + "type": "string", + "description": "VNF descriptor version" + }, + "vnfVersion": { + "type": "string", + "description": "VNF Software version" + }, + "downloadUrl":{ + "type": "string", + "description": "The URL from which the VNF package can be downloaded" + } + } + }, + "VnfInstListInfo": { + "type": "array", + "items": { + "$ref": "#/definitions/VnfInstInfo" + } + }, + "VnfInstInfo": { + "type": "object", + "properties": { + "vnfInstanceId": { + "type": "string", + "description": "VNF instance ID" + }, + "vnfInstanceName": { + "type": "string", + "description": "VNF instance name" + } + } + }, + "VnfPkgImgListInfo": { + "type": "array", + "items": { + "$ref": "#/definitions/VnfPkgImgInfo" + } + }, + "VnfPkgImgInfo": { + "type": "object", + "properties": { + "fileName": { + "type": "string", + "description": "image file name" + }, + "imageUrl": { + "type": "string", + "description": "image file path in the csar or image url in external repository" + } + } + }, + "modelParserRequest":{ + "type": "object", + "properties": { + "csarId": { + "type": "string", + "description": "csar Package Id" + }, + "inputs": { + "type": "object", + "description": "csar package json inputs" + } + } + }, + "modelParserResponse":{ + "type": "object", + "properties": { + "model": { + "type": "object", + "description": "csar model json data" + } + } + }, + "jobResponseInfo": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "progress":{ + "type": "string" + }, + "statusDescription": { + "type": "string" + }, + "errorCode": { + "type": "string" + }, + "responseId": { + "type": "string" + } + } + }, + "PostJobRequest": { + "type": "object", + "properties": { + "progress": { + "type": "string" + }, + "desc": { + "type": "string" + }, + "errcode": { + "type": "string" + } + } + }, + "JobDetailInfo":{ + "type": "object", + "properties": { + "jobId": { + "type": "string" + }, + "responseDescriptor": + { + "type":"object", + "properties": { + "status": { + "type": "string" + }, + "progress":{ + "type": "string" + }, + "statusDescription": { + "type": "string" + }, + "errorCode": { + "type": "string" + }, + "responseId": { + "type": "string" + }, + "responseHistoryList": { + "type": "array", + "items": { + "$ref": "#/definitions/jobResponseInfo" + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/catalog/swagger/urls.py b/catalog/swagger/urls.py index 5437ee5..6de480c 100644 --- a/catalog/swagger/urls.py +++ b/catalog/swagger/urls.py @@ -19,7 +19,7 @@ from rest_framework import permissions # Add code for generating swagger automatically. swagger_info = openapi.Info( - title="VFC Catalog API", + title="Modeling etsicatalog API", default_version='v1', description=""" diff --git a/catalog/swagger/vfc.catalog.swagger.json b/catalog/swagger/vfc.catalog.swagger.json deleted file mode 100644 index 1327462..0000000 --- a/catalog/swagger/vfc.catalog.swagger.json +++ /dev/null @@ -1,793 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "version": "1.0.0", - "title": "ONAP VFC Catalog Rest API", - "description": "VFC Catalog Management API.", - "contact": { - "name": "ONAP VFC team", - "email": "onap-discuss@lists.onap.org", - "url": "https://gerrit.onap.org/r/#/admin/projects/vfc/nfvo/catalog" - } - }, - "basePath": "/api/catalog/v1", - "schemes": [ - "http", - "https" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": { - "/nspackages": { - "get": { - "tags": [ - "nspackage" - ], - "summary": "query ns packages info", - "description": "query ns packages info", - "operationId": "query_ns_packages", - "parameters": [], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/NsPkgListInfo" - } - }, - "404": { - "description": "URL not found" - }, - "500": { - "description": "internal error" - } - } - }, - "post": { - "tags": [ - "nspackage" - ], - "summary": "ns package distribute", - "description": "ns package distribute", - "operationId": "ns_pkg_distribute", - "parameters": [ - { - "in": "body", - "name": "body", - "description": "distribute request param", - "required": true, - "schema": { - "$ref": "#/definitions/NsPkgDistributeRequest" - } - } - ], - "responses": { - "202": { - "description": "", - "schema": { - "$ref": "#/definitions/NsPkgDistributeResponse" - } - }, - "404": { - "description": "URL not found" - }, - "500": { - "description": "internal error" - } - } - } - }, - "/nspackages/{csarId}": { - "get": { - "tags": [ - "nspackage" - ], - "summary": "query ns package info", - "description": "query ns package info via ns package csarId", - "operationId": "query_ns_package", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "csarId", - "in": "path", - "description": "csar id of ns package", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/NsPkgDetailInfo" - } - }, - "404": { - "description": "URL not found" - }, - "500": { - "description": "internal error" - } - } - }, - "delete": { - "tags": [ - "nspackage" - ], - "summary": "delete ns pkg", - "description": "delete ns pkg", - "operationId": "delete_ns_pkg", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "csarId", - "in": "path", - "description": "csar id of ns package", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Delete NS Package Response", - "schema": { - "$ref": "#/definitions/NsPkgDelResponse" - } - }, - "404": { - "description": "URL not found" - }, - "500": { - "description": "internal error" - } - } - } - }, - "/parsernsd": { - "post": { - "tags": [ - "model" - ], - "summary": "ns package model", - "description": "ns package model", - "operationId": "ms_model_parser", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "in": "body", - "name": "body", - "description": "distribute request param", - "required": true, - "schema": { - "$ref": "#/definitions/modelParserRequest" - } - } - ], - "responses": { - "202": { - "description": "", - "schema": { - "$ref": "#/definitions/modelParserResponse" - } - }, - "404": { - "description": "URL not found" - }, - "500": { - "description": "internal error" - } - } - } - }, - "/vnfpackages": { - "get": { - "tags": [ - "vnfpackage" - ], - "summary": "query vnf packages info", - "description": "query vnf packages info", - "operationId": "query_vnf_packages", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/VnfPkgListInfo" - } - }, - "404": { - "description": "URL not found" - }, - "500": { - "description": "internal error" - } - } - }, - "post": { - "tags": [ - "vnfpackage" - ], - "summary": "vnf package distribute", - "description": "vnf package distribute", - "operationId": "vnf_pkg_distribute", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "in": "body", - "name": "body", - "description": "distribute request param", - "required": true, - "schema": { - "$ref": "#/definitions/VnfPkgDistributeRequest" - } - } - ], - "responses": { - "202": { - "description": "", - "schema": { - "$ref": "#/definitions/VnfPkgDistributeResponse" - } - }, - "404": { - "description": "URL not found" - }, - "500": { - "description": "internal error" - } - } - } - }, - "/vnfpackages/{csarId}": { - "get": { - "tags": [ - "vnfpackage" - ], - "summary": "query vnf package info", - "description": "query one vnf package info via vnf package csarId", - "operationId": "query_vnf_package", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "csarId", - "in": "path", - "description": "csar id of vnf package", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "successful operation", - "schema": { - "$ref": "#/definitions/VnfPkgDetailInfo" - } - }, - "404": { - "description": "URL not found" - }, - "500": { - "description": "internal error" - } - } - }, - "delete": { - "tags": [ - "vnfpackage" - ], - "summary": "delete vnf package", - "description": "delete vnf package", - "operationId": "delete_vnf_package", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "name": "csarId", - "in": "path", - "description": "csar id of vnf package", - "required": true, - "type": "string" - } - ], - "responses": { - "202": { - "description": "Delete VNF Pakcage Response", - "schema": { - "$ref": "#/definitions/VnfPkgDelResponse" - } - }, - "404": { - "description": "URL not found" - }, - "500": { - "description": "internal error" - } - } - } - }, - "/parservnfd": { - "post": { - "tags": [ - "model" - ], - "summary": "vnf package model", - "description": "vnf package model", - "operationId": "vnf_model_parser", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "parameters": [ - { - "in": "body", - "name": "body", - "description": "distribute request param", - "required": true, - "schema": { - "$ref": "#/definitions/modelParserRequest" - } - } - ], - "responses": { - "202": { - "description": "", - "schema": { - "$ref": "#/definitions/modelParserResponse" - } - }, - "404": { - "description": "URL not found" - }, - "500": { - "description": "internal error" - } - } - } - }, - "/jobs/{jobId}": { - "get": { - "tags": [ - "job" - ], - "summary": "jobstatus", - "description": "Get Job Status", - "operationId": "get_jobstatus", - "parameters": [ - { - "required": true, - "type": "string", - "description": "job Id", - "name": "jobId", - "in": "path" - }, - { - "required": true, - "type": "string", - "description": "job response message id", - "name": "responseId", - "in": "query" - } - ], - "responses": { - "200": { - "description": "", - "schema": { - "$ref": "#/definitions/JobDetailInfo" - } - } - } - }, - "post": { - "tags": [ - "job" - ], - "summary": "Update Job Status", - "description": "Update Job Status", - "operationId": "post_jobstatus", - "parameters": [ - { - "required": true, - "type": "string", - "description": "job Id", - "name": "jobId", - "in": "path" - }, - { - "required": true, - "schema": { - "$ref": "#/definitions/PostJobRequest" - }, - "description": "job status", - "name": "responseId", - "in": "body" - } - ], - "responses": { - "200": { - "description": "", - "schema": { - "$ref": "#/definitions/JobDetailInfo" - } - } - } - } - } - }, - "definitions": { - "NsPkgDistributeRequest": { - "type": "object", - "properties": { - "csarId": { - "type": "string", - "description": "network service package id, UUID" - } - } - }, - "NsPkgDistributeResponse": { - "type": "object", - "properties": { - "status": { - "type": "string", - "description": "Operation status. value is success or failed" - }, - "statusDescription": { - "type": "string", - "description": "description about the operation result" - }, - "errorCode": { - "type": "string", - "description": "If the status is failed, the errorcode will be returned" - } - } - }, - "NsPkgDelResponse": { - "type": "object", - "properties": { - "status": { - "type": "string", - "description": "Operation status. value is success or failed" - }, - "statusDescription": { - "type": "string", - "description": "description about the operation result" - }, - "errorCode": { - "type": "string", - "description": "If the status is failed, the errorcode will be returned" - } - } - }, - "NsPkgListInfo": { - "type": "array", - "items": { - "$ref": "#/definitions/NsPkgDetailInfo" - } - }, - "NsPkgDetailInfo": { - "type": "object", - "properties": { - "csarId": { - "type": "string" - }, - "packageInfo": { - "$ref": "#/definitions/NsPkgInfo" - } - } - }, - "NsPkgInfo": { - "type": "object", - "properties": { - "nsPackageId": { - "type": "string", - "description": "network service package id, UUID, csarId" - }, - "nsdId": { - "type": "string", - "description": "network service descriptor ID" - }, - "nsdProvider": { - "type": "string", - "description": "network service designer name" - }, - "nsdVersion": { - "type": "string", - "description": "network service descriptor version" - }, - "csarName": { - "type": "string", - "description": "network service package name" - }, - "nsdModel": { - "type": "string", - "description": "ns JSON string parsed and transformed by parser" - }, - "downloadUrl": { - "type": "string", - "description": "download url of network service package" - } - } - }, - "NsInstListInfo": { - "type": "array", - "items": { - "$ref": "#/definitions/NsInstInfo" - } - }, - "NsInstInfo": { - "type": "object", - "properties": { - "nsInstanceId": { - "type": "string", - "description": "network service instance ID" - }, - "nsInstanceName": { - "type": "string", - "description": "network service instance name" - } - } - }, - "VnfPkgDistributeRequest": { - "type": "object", - "properties": { - "csarId": { - "type": "string", - "description": "vnf package id, UUID" - } - } - }, - "VnfPkgDistributeResponse": { - "type": "object", - "properties": { - "jobId": { - "type": "string", - "description": "VNF package distribute job ID" - } - } - }, - "VnfPkgDelResponse": { - "type": "object", - "properties": { - "status": { - "type": "string", - "description": "Operation status. value is success or failed" - }, - "statusDescription": { - "type": "string", - "description": "description about the operation result" - }, - "errorCode": { - "type": "string", - "description": "If the status is failed, the errorcode will be returned" - } - } - }, - "VnfPkgListInfo": { - "type": "array", - "items": { - "$ref": "#/definitions/VnfPkgDetailInfo" - } - }, - "VnfPkgDetailInfo": { - "type": "object", - "properties": { - "csarId": { - "type": "string", - "description": "vnf package id, UUID" - }, - "packageInfo": { - "$ref": "#/definitions/VnfPkgInfo" - }, - "imageInfo": { - "$ref": "#/definitions/VnfPkgImgListInfo" - } - } - }, - "VnfPkgInfo": { - "type": "object", - "description": "vnf package infomation", - "properties": { - "vnfPackageId": { - "type": "string", - "description": "vnf package id (csarId)" - }, - "csarName": { - "type": "string", - "description": "The name of the csar" - }, - "vnfdId": { - "type": "string", - "description": "VNF descriptor ID" - }, - "vnfdProvider": { - "type": "string", - "description": "VNF descriptor vendor ID" - }, - "vnfdModel": { - "type": "string", - "description": "The model of the VNF (JSON) encoded to string" - }, - "vnfdVersion": { - "type": "string", - "description": "VNF descriptor version" - }, - "vnfVersion": { - "type": "string", - "description": "VNF Software version" - }, - "downloadUrl":{ - "type": "string", - "description": "The URL from which the VNF package can be downloaded" - } - } - }, - "VnfInstListInfo": { - "type": "array", - "items": { - "$ref": "#/definitions/VnfInstInfo" - } - }, - "VnfInstInfo": { - "type": "object", - "properties": { - "vnfInstanceId": { - "type": "string", - "description": "VNF instance ID" - }, - "vnfInstanceName": { - "type": "string", - "description": "VNF instance name" - } - } - }, - "VnfPkgImgListInfo": { - "type": "array", - "items": { - "$ref": "#/definitions/VnfPkgImgInfo" - } - }, - "VnfPkgImgInfo": { - "type": "object", - "properties": { - "fileName": { - "type": "string", - "description": "image file name" - }, - "imageUrl": { - "type": "string", - "description": "image file path in the csar or image url in external repository" - } - } - }, - "modelParserRequest":{ - "type": "object", - "properties": { - "csarId": { - "type": "string", - "description": "csar Package Id" - }, - "inputs": { - "type": "object", - "description": "csar package json inputs" - } - } - }, - "modelParserResponse":{ - "type": "object", - "properties": { - "model": { - "type": "object", - "description": "csar model json data" - } - } - }, - "jobResponseInfo": { - "type": "object", - "properties": { - "status": { - "type": "string" - }, - "progress":{ - "type": "string" - }, - "statusDescription": { - "type": "string" - }, - "errorCode": { - "type": "string" - }, - "responseId": { - "type": "string" - } - } - }, - "PostJobRequest": { - "type": "object", - "properties": { - "progress": { - "type": "string" - }, - "desc": { - "type": "string" - }, - "errcode": { - "type": "string" - } - } - }, - "JobDetailInfo":{ - "type": "object", - "properties": { - "jobId": { - "type": "string" - }, - "responseDescriptor": - { - "type":"object", - "properties": { - "status": { - "type": "string" - }, - "progress":{ - "type": "string" - }, - "statusDescription": { - "type": "string" - }, - "errorCode": { - "type": "string" - }, - "responseId": { - "type": "string" - }, - "responseHistoryList": { - "type": "array", - "items": { - "$ref": "#/definitions/jobResponseInfo" - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/catalog/swagger/views.py b/catalog/swagger/views.py index 33d0edb..4739188 100644 --- a/catalog/swagger/views.py +++ b/catalog/swagger/views.py @@ -21,7 +21,7 @@ from rest_framework.views import APIView class SwaggerJsonView(APIView): def get(self, request): - json_file = os.path.join(os.path.dirname(__file__), 'vfc.catalog.swagger.json') + json_file = os.path.join(os.path.dirname(__file__), 'etsicatalog.swagger.json') f = open(json_file) json_data = json.JSONDecoder().decode(f.read()) f.close() -- cgit 1.2.3-korg