diff options
Diffstat (limited to 'zte/vmanager')
-rw-r--r-- | zte/vmanager/driver/interfaces/serializers.py | 31 | ||||
-rw-r--r-- | zte/vmanager/driver/interfaces/views.py | 10 |
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"} |