summaryrefslogtreecommitdiffstats
path: root/catalog/swagger
diff options
context:
space:
mode:
authordyh <dengyuanhong@chinamobile.com>2019-09-04 09:52:48 +0800
committerdyh <dengyuanhong@chinamobile.com>2019-09-04 16:09:26 +0800
commita32c2b20207885d895bd96204cc166fca14db97b (patch)
tree1edd33368158dc5f057a0a9475dced3df6c3b24c /catalog/swagger
parent431a5a35a8e0a26d21c663167303696db8a7a2a6 (diff)
update for change to etsicatalog
Change-Id: Idc2a6950960a324964500a8c4701be422de2b782 Issue-ID: MODELING-216 Signed-off-by: dyh <dengyuanhong@chinamobile.com>
Diffstat (limited to 'catalog/swagger')
-rw-r--r--catalog/swagger/__init__.py13
-rw-r--r--catalog/swagger/management/__init__.py13
-rw-r--r--catalog/swagger/management/commands/__init__.py13
-rw-r--r--catalog/swagger/management/commands/export_swagger.py36
-rw-r--r--catalog/swagger/tests.py28
-rw-r--r--catalog/swagger/urls.py43
-rw-r--r--catalog/swagger/vfc.catalog.swagger.json793
-rw-r--r--catalog/swagger/views.py28
8 files changed, 967 insertions, 0 deletions
diff --git a/catalog/swagger/__init__.py b/catalog/swagger/__init__.py
new file mode 100644
index 0000000..c7b6818
--- /dev/null
+++ b/catalog/swagger/__init__.py
@@ -0,0 +1,13 @@
+# 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.
diff --git a/catalog/swagger/management/__init__.py b/catalog/swagger/management/__init__.py
new file mode 100644
index 0000000..342c2a8
--- /dev/null
+++ b/catalog/swagger/management/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2018 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.
diff --git a/catalog/swagger/management/commands/__init__.py b/catalog/swagger/management/commands/__init__.py
new file mode 100644
index 0000000..342c2a8
--- /dev/null
+++ b/catalog/swagger/management/commands/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2018 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.
diff --git a/catalog/swagger/management/commands/export_swagger.py b/catalog/swagger/management/commands/export_swagger.py
new file mode 100644
index 0000000..bc5fd1a
--- /dev/null
+++ b/catalog/swagger/management/commands/export_swagger.py
@@ -0,0 +1,36 @@
+# Copyright 2018 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 json
+
+from django.core.management.base import BaseCommand
+from django.test import Client
+
+
+class Command(BaseCommand):
+ def add_arguments(self, parser):
+ parser.add_argument(
+ '-f',
+ '--name',
+ action='store',
+ dest='name',
+ default='swagger.json',
+ help='name of swagger file.',
+ )
+
+ def handle(self, *args, **options):
+ self.client = Client()
+ response = self.client.get("/api/catalog/v1/swagger.json")
+ with open(options['name'], 'w') as swagger_file:
+ swagger_file.write(json.dumps(response.data))
+ print("swagger api is written to %s" % options['name'])
diff --git a/catalog/swagger/tests.py b/catalog/swagger/tests.py
new file mode 100644
index 0000000..fc51b62
--- /dev/null
+++ b/catalog/swagger/tests.py
@@ -0,0 +1,28 @@
+# 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.
+
+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_swagger(self):
+ response = self.client.get("/api/catalog/v1/swagger.json")
+ self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
+ self.assertEqual("2.0", response.data.get("swagger"))
diff --git a/catalog/swagger/urls.py b/catalog/swagger/urls.py
new file mode 100644
index 0000000..5437ee5
--- /dev/null
+++ b/catalog/swagger/urls.py
@@ -0,0 +1,43 @@
+# 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.
+
+from django.conf.urls import url
+from drf_yasg import openapi
+from drf_yasg.views import get_schema_view
+from rest_framework import permissions
+
+# Add code for generating swagger automatically.
+swagger_info = openapi.Info(
+ title="VFC Catalog API",
+ default_version='v1',
+ description="""
+
+The `swagger-ui` view can be found [here](/api/catalog/v1/swagger).
+The `ReDoc` view can be found [here](/api/catalog/v1/redoc).
+The swagger YAML document can be found [here](/api/catalog/v1/swagger.yaml).
+The swagger JSON document can be found [here](/api/catalog/v1/swagger.json)."""
+)
+
+SchemaView = get_schema_view(
+ validators=['ssv', 'flex'],
+ public=True,
+ permission_classes=(permissions.AllowAny,),
+)
+
+urlpatterns = [
+ # url(r'^api/catalog/v1/swagger.json$', SwaggerJsonView.as_view()),
+ url(r'^api/catalog/v1/swagger(?P<format>.json|.yaml)$', SchemaView.without_ui(cache_timeout=0), name='schema-json'),
+ url(r'^api/catalog/v1/swagger$', SchemaView.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
+ url(r'^api/catalog/v1/redoc$', SchemaView.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
+]
diff --git a/catalog/swagger/vfc.catalog.swagger.json b/catalog/swagger/vfc.catalog.swagger.json
new file mode 100644
index 0000000..1327462
--- /dev/null
+++ b/catalog/swagger/vfc.catalog.swagger.json
@@ -0,0 +1,793 @@
+{
+ "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
new file mode 100644
index 0000000..33d0edb
--- /dev/null
+++ b/catalog/swagger/views.py
@@ -0,0 +1,28 @@
+# 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 json
+import os
+
+from rest_framework.response import Response
+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')
+ f = open(json_file)
+ json_data = json.JSONDecoder().decode(f.read())
+ f.close()
+ return Response(json_data)