diff options
author | 2018-09-05 16:44:05 +0800 | |
---|---|---|
committer | 2018-09-05 17:15:12 +0800 | |
commit | d391b773aba38ee676c40ba60141c5b2fcb0e5b7 (patch) | |
tree | 9586de053c6c37be9003d5f065a28f5beaec42d1 | |
parent | 6c67c86e11abaed2f34b2d7380bbb23e2ad8015e (diff) |
Notification endpoint stuffs.
Add two notification serializers.
Change-Id: I1c1ed3a7851580cc94a7a56b4ff0cad5936f94a7
Issue-ID: VFC-1095
Signed-off-by: laili <lai.li@zte.com.cn>
-rw-r--r-- | lcm/ns_vnfs/biz/handle_vnflcmooc_notification.py | 13 | ||||
-rw-r--r-- | lcm/ns_vnfs/serializers/grant_vnf_serializer.py | 82 |
2 files changed, 89 insertions, 6 deletions
diff --git a/lcm/ns_vnfs/biz/handle_vnflcmooc_notification.py b/lcm/ns_vnfs/biz/handle_vnflcmooc_notification.py index 5e6ebedb..e8a36fb4 100644 --- a/lcm/ns_vnfs/biz/handle_vnflcmooc_notification.py +++ b/lcm/ns_vnfs/biz/handle_vnflcmooc_notification.py @@ -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__) diff --git a/lcm/ns_vnfs/serializers/grant_vnf_serializer.py b/lcm/ns_vnfs/serializers/grant_vnf_serializer.py index 557c603c..d1b865b5 100644 --- a/lcm/ns_vnfs/serializers/grant_vnf_serializer.py +++ b/lcm/ns_vnfs/serializers/grant_vnf_serializer.py @@ -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 + ) |