From 111445287e9227410f634706666066615f2da9a7 Mon Sep 17 00:00:00 2001 From: fujinhua Date: Sat, 6 Apr 2019 09:26:18 +0800 Subject: Update serializer for catalog Change-Id: I6e52b8398b1738e8fd634513b3660d016415e7c6 Issue-ID: VFC-1306 Signed-off-by: fujinhua --- .../packages/serializers/vnf_pkg_notifications.py | 42 +++++++++++++++------- .../serializers/vnf_pkg_software_image_info.py | 38 +++++++++++++------- .../packages/serializers/vnf_pkg_subscription.py | 18 ++++++---- 3 files changed, 68 insertions(+), 30 deletions(-) diff --git a/catalog/packages/serializers/vnf_pkg_notifications.py b/catalog/packages/serializers/vnf_pkg_notifications.py index deb0ea03..5e023af0 100755 --- a/catalog/packages/serializers/vnf_pkg_notifications.py +++ b/catalog/packages/serializers/vnf_pkg_notifications.py @@ -25,13 +25,15 @@ class VersionSerializer(serializers.Serializer): help_text="VNF software version to match.", max_length=255, required=True, - allow_null=False) + allow_null=False + ) vnfdVersions = serializers.ListField( child=serializers.CharField(), help_text="Match VNF packages that contain " "VNF products with certain VNFD versions", required=False, - allow_null=False) + allow_null=False + ) class vnfProductsSerializer(serializers.Serializer): @@ -39,7 +41,8 @@ class vnfProductsSerializer(serializers.Serializer): help_text="Name of the VNF product to match.", max_length=255, required=True, - allow_null=False) + allow_null=False + ) versions = VersionSerializer( help_text="match VNF packages that contain " "VNF products with certain versions", @@ -53,7 +56,8 @@ class vnfProductsProvidersSerializer(serializers.Serializer): help_text="Name of the VNFprovider to match.", max_length=255, required=True, - allow_null=False) + allow_null=False + ) vnfProducts = vnfProductsSerializer( help_text="match VNF packages that contain " "VNF products with certain product names, " @@ -65,10 +69,14 @@ class vnfProductsProvidersSerializer(serializers.Serializer): class PkgmNotificationsFilter(serializers.Serializer): notificationTypes = serializers.ListField( - child=serializers.ChoiceField(required=True, choices=NOTIFICATION_TYPES), + child=serializers.ChoiceField( + required=True, + choices=NOTIFICATION_TYPES + ), help_text="Match particular notification types", allow_null=False, - required=False) + required=False + ) vnfProductsFromProviders = vnfProductsProvidersSerializer( help_text="Match VNF packages that contain " "VNF products from certain providers.", @@ -80,20 +88,30 @@ class PkgmNotificationsFilter(serializers.Serializer): help_text="Match VNF packages with a VNFD identifier" "listed in the attribute", required=False, - allow_null=False) + allow_null=False + ) vnfPkgId = serializers.ListField( child=serializers.UUIDField(), help_text="Match VNF packages with a VNFD identifier" "listed in the attribute", required=False, - allow_null=False) + allow_null=False + ) operationalState = serializers.ListField( - child=serializers.ChoiceField(required=True, choices=PackageOperationalStateType), + child=serializers.ChoiceField( + required=True, + choices=PackageOperationalStateType + ), help_text="Operational state of the VNF package.", allow_null=False, - required=False) + required=False + ) usageState = serializers.ListField( - child=serializers.ChoiceField(required=True, choices=PackageUsageStateType), + child=serializers.ChoiceField( + required=True, + choices=PackageUsageStateType + ), help_text="Operational state of the VNF package.", allow_null=False, - required=False) + required=False + ) diff --git a/catalog/packages/serializers/vnf_pkg_software_image_info.py b/catalog/packages/serializers/vnf_pkg_software_image_info.py index e251a77a..7723ec0e 100644 --- a/catalog/packages/serializers/vnf_pkg_software_image_info.py +++ b/catalog/packages/serializers/vnf_pkg_software_image_info.py @@ -21,45 +21,54 @@ class VnfPackageSoftwareImageInfoSerializer(serializers.Serializer): help_text="Identifier of the software image.", required=True, allow_null=False, - allow_blank=False) + allow_blank=False + ) name = serializers.CharField( help_text="Name of the software image.", required=True, allow_null=True, - allow_blank=False) + allow_blank=False + ) provider = serializers.CharField( help_text="Provider of the software image.", required=True, allow_null=True, - allow_blank=False) + allow_blank=False + ) version = serializers.CharField( help_text="Version of the software image.", required=True, allow_null=True, - allow_blank=False) + allow_blank=False + ) checksum = ChecksumSerializer( help_text="Checksum of the software image file.", required=True, - allow_null=False, ) + allow_null=False + ) containerFormat = serializers.ChoiceField( help_text="terminationType: Indicates whether forceful or graceful termination is requested.", choices=["AKI", "AMI", "ARI", "BARE", "DOCKER", "OVA", "OVF"], required=True, - allow_null=True) + allow_null=True + ) diskFormat = serializers.ChoiceField( help_text="Disk format of a software image is the format of the underlying disk image.", choices=["AKI", "AMI", "ARI", "ISO", "QCOW2", "RAW", "VDI", "VHD", "VHDX", "VMDK"], required=True, - allow_null=True) + allow_null=True + ) createdAt = serializers.DateTimeField( help_text="Time when this software image was created.", required=True, format=None, - input_formats=None) + input_formats=None + ) minDisk = serializers.IntegerField( help_text="The minimal disk for this software image in bytes.", required=True, - allow_null=True) + allow_null=True + ) minRam = serializers.IntegerField( help_text="The minimal RAM for this software image in bytes.", required=True, @@ -72,11 +81,16 @@ class VnfPackageSoftwareImageInfoSerializer(serializers.Serializer): ) userMetadata = serializers.DictField( help_text="User-defined data.", - child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True), + child=serializers.CharField( + help_text="KeyValue Pairs", + allow_blank=True + ), required=False, - allow_null=True) + allow_null=True + ) imagePath = serializers.CharField( help_text="Path in the VNF package.", required=True, allow_null=True, - allow_blank=False) + allow_blank=False + ) diff --git a/catalog/packages/serializers/vnf_pkg_subscription.py b/catalog/packages/serializers/vnf_pkg_subscription.py index 8cbac758..edcd6fe3 100755 --- a/catalog/packages/serializers/vnf_pkg_subscription.py +++ b/catalog/packages/serializers/vnf_pkg_subscription.py @@ -23,7 +23,8 @@ class LinkSerializer(serializers.Serializer): help_text="URI of the referenced resource.", required=True, allow_null=False, - allow_blank=False) + allow_blank=False + ) class Meta: ref_name = 'VNF_SUBSCRIPTION_LINKSERIALIZER' @@ -33,7 +34,8 @@ class LinkSelfSerializer(serializers.Serializer): self = LinkSerializer( help_text="URI of this resource.", required=True, - allow_null=False) + allow_null=False + ) class PkgmSubscriptionRequestSerializer(serializers.Serializer): @@ -48,7 +50,8 @@ class PkgmSubscriptionRequestSerializer(serializers.Serializer): help_text="Callback URI to send" "the notification", required=True, - allow_null=False) + allow_null=False + ) authentication = subscription_auth_data.SubscriptionAuthenticationSerializer( help_text="Authentication parameters to configure the use of " "authorization when sending notifications corresponding to" @@ -62,16 +65,19 @@ class PkgmSubscriptionSerializer(serializers.Serializer): id = serializers.UUIDField( help_text="Identifier of this subscription resource.", required=True, - allow_null=False) + allow_null=False + ) callbackUri = serializers.URLField( help_text="The URI of the endpoint to send the notification to.", required=True, - allow_null=False) + allow_null=False + ) _links = LinkSelfSerializer( help_text="Links to resources related to this resource.", required=True, - allow_null=False) + allow_null=False + ) filter = vnf_pkg_notifications.PkgmNotificationsFilter( help_text="Filter settings for this subscription, " -- cgit 1.2.3-korg