summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2019-03-23 16:11:08 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2019-03-23 16:11:08 +0800
commita75e1bc7c8d208ab1955022b55635618ab391ee0 (patch)
tree9f5f3688a8012fabaec6c4322c327e1863bd85c9
parent189d775690532a69c882902116d6f5572b157f0e (diff)
Add serializer for create Subscribe
Change-Id: I9499933b0193a9dcac87f8934519d255f10a3e34 Issue-ID: VFC-1307 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--zte/vmanager/driver/interfaces/serializers.py31
-rw-r--r--zte/vmanager/driver/interfaces/views.py10
2 files changed, 40 insertions, 1 deletions
diff --git a/zte/vmanager/driver/interfaces/serializers.py b/zte/vmanager/driver/interfaces/serializers.py
index 2e7cbae7..b549b364 100644
--- a/zte/vmanager/driver/interfaces/serializers.py
+++ b/zte/vmanager/driver/interfaces/serializers.py
@@ -468,3 +468,34 @@ class SubscribeSerializer(serializers.Serializer):
class SubscribesRespSerializer(serializers.Serializer):
child = SubscribeSerializer()
+
+
+class SubscribeReqSerializer(serializers.Serializer):
+ nfvoid = serializers.CharField(
+ help_text="nfvoid",
+ max_length=255,
+ required=True,
+ allow_null=True)
+ vnfmid = serializers.CharField(
+ help_text="vnfmid",
+ max_length=255,
+ required=True,
+ allow_null=True)
+ notificationuri = serializers.CharField(
+ help_text="notificationuri",
+ max_length=255,
+ required=True,
+ allow_null=True)
+ filter = SubscribeFilterSerializer(
+ help_text="filter",
+ many=True,
+ required=False,
+ allow_null=True)
+
+
+class SubscribeRespSerializer(serializers.Serializer):
+ subscribeid = serializers.CharField(
+ help_text="subscribeid",
+ max_length=255,
+ required=True,
+ allow_null=True)
diff --git a/zte/vmanager/driver/interfaces/views.py b/zte/vmanager/driver/interfaces/views.py
index 579da8d0..27914f19 100644
--- a/zte/vmanager/driver/interfaces/views.py
+++ b/zte/vmanager/driver/interfaces/views.py
@@ -27,7 +27,8 @@ from django.http import StreamingHttpResponse
from driver.interfaces.serializers import HealReqSerializer, InstScaleHealRespSerializer, ScaleReqSerializer, \
NotifyReqSerializer, GrantRespSerializer, GrantReqSerializer, JobQueryRespSerializer, TerminateVnfRequestSerializer, \
- InstantiateVnfRequestSerializer, QueryVnfResponseSerializer, SubscribesRespSerializer
+ InstantiateVnfRequestSerializer, QueryVnfResponseSerializer, SubscribesRespSerializer, \
+ SubscribeReqSerializer, SubscribeRespSerializer
from driver.pub.config.config import VNF_FTP
from driver.pub.utils import restcall
from driver.pub.utils.restcall import req_by_msb
@@ -648,6 +649,13 @@ class Subscribe(APIView):
}
return Response(data=resp_data, status=status.HTTP_200_OK)
+ @swagger_auto_schema(
+ request_body=SubscribeReqSerializer(),
+ responses={
+ status.HTTP_201_CREATED: SubscribeRespSerializer(),
+ status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
+ }
+ )
def post(self, request):
logger.debug("====Subscribe post====")
resp_data = {"subscribeid": "cdbddb00-452c-11e9-91e8-acc860114657"}