Notification endpoint stuffs. 53/64653/3
authorlaili <lai.li@zte.com.cn>
Wed, 5 Sep 2018 08:44:05 +0000 (16:44 +0800)
committerlaili <lai.li@zte.com.cn>
Wed, 5 Sep 2018 09:15:12 +0000 (17:15 +0800)
Add two notification serializers.

Change-Id: I1c1ed3a7851580cc94a7a56b4ff0cad5936f94a7
Issue-ID: VFC-1095
Signed-off-by: laili <lai.li@zte.com.cn>
lcm/ns_vnfs/biz/handle_vnflcmooc_notification.py
lcm/ns_vnfs/serializers/grant_vnf_serializer.py

index 5e6ebed..e8a36fb 100644 (file)
@@ -19,15 +19,16 @@ import uuid
 from rest_framework import status
 from rest_framework.response import Response
 
+from lcm.ns_vnfs.const import INST_TYPE
 from lcm.pub.config.config import REPORT_TO_AAI
-from lcm.pub.database.models import VNFCInstModel, VLInstModel, NfInstModel, VmInstModel, PortInstModel, CPInstModel
+from lcm.pub.database.models import (CPInstModel, NfInstModel, PortInstModel,
+                                     VLInstModel, VmInstModel, VNFCInstModel)
 from lcm.pub.exceptions import NSLCMException
-from lcm.pub.msapi.aai import create_network_aai, query_network_aai, delete_network_aai, query_vserver_aai, \
-    delete_vserver_aai
-from lcm.pub.msapi.aai import create_vserver_aai
-from lcm.pub.msapi.extsys import split_vim_to_owner_region, get_vim_by_id
+from lcm.pub.msapi.aai import (create_network_aai, create_vserver_aai,
+                               delete_network_aai, delete_vserver_aai,
+                               query_network_aai, query_vserver_aai)
+from lcm.pub.msapi.extsys import get_vim_by_id, split_vim_to_owner_region
 from lcm.pub.utils.values import ignore_case_get
-from lcm.ns_vnfs.const import INST_TYPE
 
 logger = logging.getLogger(__name__)
 
index 557c603..d1b865b 100644 (file)
@@ -999,3 +999,85 @@ class VnfLcmOperationOccurrenceNotificationSerializer(serializers.Serializer):
         required=False,
         allow_null=True
     )
+
+
+class VnfIdentifierCreationNotificationSerializer(serializers.Serializer):
+    id = serializers.CharField(
+        help_text="Identifier of this notification. \
+        If a notification is sent multiple times due to multiple subscriptions, \
+        the id attribute of all these notifications shall have the same value.",
+        required=True,
+        allow_null=False,
+        allow_blank=False
+    )
+    notificationType = serializers.CharField(
+        help_text="Discriminator for the different notification types. \
+        Shall be set to VnfIdentifierCreationNotification for this notification type.",
+        required=True,
+        allow_null=False,
+        allow_blank=False
+    )
+    subscriptionId = serializers.CharField(
+        help_text="Identifier of the subscription that this notification relates to.",
+        required=False,
+        allow_null=True,
+        allow_blank=True
+    )
+    timeStamp = serializers.DateField(
+        help_text="Discriminator for the different notification types. \
+        Shall be set to VnfIdentifierCreationNotification for this notification type.",
+        required=True,
+        allow_null=False,
+    )
+    vnfInstanceId = serializers.CharField(
+        help_text="The created VNF instance identifier.",
+        required=True,
+        allow_null=False,
+        allow_blank=False
+    )
+    _links = LccnLinksSerializer(
+        help_text="Links to resources related to this notification.",
+        required=True,
+        allow_null=False
+    )
+
+
+class VnfIdentifierDeletionNotificationSerializer(serializers.Serializer):
+    id = serializers.CharField(
+        help_text="Identifier of this notification. \
+        If a notification is sent multiple times due to multiple subscriptions, \
+        the id attribute of all these notifications shall have the same value.",
+        required=True,
+        allow_null=False,
+        allow_blank=False
+    )
+    notificationType = serializers.CharField(
+        help_text="Discriminator for the different notification types. \
+        Shall be set to VnfIdentifierDeletionNotification for this notification type.",
+        required=True,
+        allow_null=False,
+        allow_blank=False
+    )
+    subscriptionId = serializers.CharField(
+        help_text="Identifier of the subscription that this notification relates to.",
+        required=False,
+        allow_null=True,
+        allow_blank=True
+    )
+    timeStamp = serializers.DateField(
+        help_text="Discriminator for the different notification types. \
+        Shall be set to VnfIdentifierDeletionionNotification for this notification type.",
+        required=True,
+        allow_null=False,
+    )
+    vnfInstanceId = serializers.CharField(
+        help_text="The deleted VNF instance identifier.",
+        required=True,
+        allow_null=False,
+        allow_blank=False
+    )
+    _links = LccnLinksSerializer(
+        help_text="Links to resources related to this notification.",
+        required=True,
+        allow_null=False
+    )