aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfengyuanxing <feng.yuanxing@zte.com.cn>2018-02-09 14:44:23 +0800
committerfengyuanxing <feng.yuanxing@zte.com.cn>2018-02-09 14:44:34 +0800
commita2bdd44372feb4ac4343e9a2777224a315cdb6f6 (patch)
tree0b28222724a49c26074f5d59a73a44a18babc293
parent518cfba31d85b5e1de1a14c6b8641c244bbe8395 (diff)
Modify swagger code for ns package
Change-Id: I439515f8b21ff7acc2c2126a7e4d83a8ec920ed7 Issue-ID: VFC-685 Signed-off-by: fengyuanxing <feng.yuanxing@zte.com.cn>
-rw-r--r--catalog/packages/views.py7
-rw-r--r--catalog/serializers.py6
2 files changed, 8 insertions, 5 deletions
diff --git a/catalog/packages/views.py b/catalog/packages/views.py
index 2841c10f..26ed83bf 100644
--- a/catalog/packages/views.py
+++ b/catalog/packages/views.py
@@ -25,6 +25,7 @@ from catalog.serializers import NsPackagesSerializer
from catalog.serializers import NsPackageSerializer
from catalog.serializers import NfPackagesSerializer
from catalog.serializers import NsPackageDistributeRequestSerializer
+from catalog.serializers import NsPackageDistributeResponseSerializer
from catalog.serializers import NfPackageDistributeRequestSerializer
from catalog.serializers import NfPackageSerializer
from catalog.serializers import ParseModelRequestSerializer
@@ -43,11 +44,7 @@ logger = logging.getLogger(__name__)
operation_description="On distribute NS package",
request_body=NsPackageDistributeRequestSerializer,
responses={
- status.HTTP_202_ACCEPTED: openapi.Response(
- 'return code',
- openapi.Schema(
- type=openapi.TYPE_STRING,
- pattern='CSAR(\w+) distributed successfully.')),
+ status.HTTP_202_ACCEPTED: NsPackageDistributeResponseSerializer,
status.HTTP_500_INTERNAL_SERVER_ERROR: InternalErrorRequestSerializer})
@swagger_auto_schema(
method='GET',
diff --git a/catalog/serializers.py b/catalog/serializers.py
index d44e21cc..d05e1aee 100644
--- a/catalog/serializers.py
+++ b/catalog/serializers.py
@@ -66,6 +66,12 @@ class NsPackageDistributeRequestSerializer(serializers.Serializer):
csarId = serializers.CharField(help_text="csarId", required=True)
+class NsPackageDistributeResponseSerializer(serializers.Serializer):
+ status = serializers.CharField(help_text="status", required=True)
+ statusDescription = serializers.CharField(help_text="statusDescription", required=True)
+ errorCode = serializers.CharField(help_text="errorCode", required=True)
+
+
class NsPackageInfoSerializer(serializers.Serializer):
nsdId = serializers.CharField(help_text="NSD ID", required=True)
nsPackageId = serializers.CharField(