summaryrefslogtreecommitdiffstats
path: root/zte
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2019-03-23 15:44:06 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2019-03-23 15:52:40 +0800
commit189d775690532a69c882902116d6f5572b157f0e (patch)
treea6fd4aa0585fcf143a09b7f86f63b7bb83c0ac9d /zte
parent7536954d9305e244274ae8ef5012c5385d6a4b04 (diff)
Add serializer for Subscribe
Change-Id: Iea14a6d0852bef83959499160b8e22f7403e0228 Issue-ID: VFC-1307 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
Diffstat (limited to 'zte')
-rw-r--r--zte/vmanager/driver/interfaces/serializers.py35
-rw-r--r--zte/vmanager/driver/interfaces/views.py8
2 files changed, 42 insertions, 1 deletions
diff --git a/zte/vmanager/driver/interfaces/serializers.py b/zte/vmanager/driver/interfaces/serializers.py
index eafe0939..2e7cbae7 100644
--- a/zte/vmanager/driver/interfaces/serializers.py
+++ b/zte/vmanager/driver/interfaces/serializers.py
@@ -433,3 +433,38 @@ class InstScaleHealRespSerializer(serializers.Serializer):
max_length=255,
required=True,
allow_null=True)
+
+
+class SubscribeFilterSerializer(serializers.Serializer):
+ vendor = serializers.CharField(
+ help_text="vendor",
+ max_length=255,
+ required=True,
+ allow_null=True)
+ type = serializers.CharField(
+ help_text="type",
+ max_length=255,
+ required=True,
+ allow_null=True)
+
+
+class SubscribeSerializer(serializers.Serializer):
+ subscribeid = serializers.CharField(
+ help_text="subscribeid",
+ 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 SubscribesRespSerializer(serializers.Serializer):
+ child = SubscribeSerializer()
diff --git a/zte/vmanager/driver/interfaces/views.py b/zte/vmanager/driver/interfaces/views.py
index 54325b39..579da8d0 100644
--- a/zte/vmanager/driver/interfaces/views.py
+++ b/zte/vmanager/driver/interfaces/views.py
@@ -27,7 +27,7 @@ from django.http import StreamingHttpResponse
from driver.interfaces.serializers import HealReqSerializer, InstScaleHealRespSerializer, ScaleReqSerializer, \
NotifyReqSerializer, GrantRespSerializer, GrantReqSerializer, JobQueryRespSerializer, TerminateVnfRequestSerializer, \
- InstantiateVnfRequestSerializer, QueryVnfResponseSerializer
+ InstantiateVnfRequestSerializer, QueryVnfResponseSerializer, SubscribesRespSerializer
from driver.pub.config.config import VNF_FTP
from driver.pub.utils import restcall
from driver.pub.utils.restcall import req_by_msb
@@ -628,6 +628,12 @@ class SampleList(APIView):
class Subscribe(APIView):
+ @swagger_auto_schema(
+ responses={
+ status.HTTP_200_OK: SubscribesRespSerializer(),
+ status.HTTP_500_INTERNAL_SERVER_ERROR: "Internal error"
+ }
+ )
def get(self, request):
logger.debug("====Subscribe get====")
resp_data = {