diff options
author | fujinhua <fu.jinhua@zte.com.cn> | 2018-11-05 18:02:16 +0800 |
---|---|---|
committer | fujinhua <fu.jinhua@zte.com.cn> | 2018-11-05 18:04:25 +0800 |
commit | f5dcaa6129e8970d7b366fdecf0f7e9dce43e261 (patch) | |
tree | b7b0a933581c2ac4f1512899dac5f88bb0244ccc | |
parent | 2c3ec81199e28d241ee6c37d3979981fe79fb2bf (diff) |
Fix serializer def of vnf api
Change-Id: I0c0763ce604dd5d6f6c949ed82e779fce346657d
Issue-ID: VFC-1163
Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r-- | lcm/ns_vnfs/serializers/serializers.py | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/lcm/ns_vnfs/serializers/serializers.py b/lcm/ns_vnfs/serializers/serializers.py index 7dd01150..0d7b8a84 100644 --- a/lcm/ns_vnfs/serializers/serializers.py +++ b/lcm/ns_vnfs/serializers/serializers.py @@ -18,7 +18,7 @@ from rest_framework import serializers class InstVnfReqSerializer(serializers.Serializer): vnfIndex = serializers.CharField(help_text="Index of VNF", required=True) nsInstanceId = serializers.CharField(help_text="ID of NS instance", required=True) - additionalParamForVnf = serializers.CharField(help_text="Additional param for VNF", required=False, allow_null=True) + additionalParamForVnf = serializers.CharField(help_text="Additional param for VNF", required=False, allow_null=True, allow_blank=True) class InstVnfRespSerializer(serializers.Serializer): @@ -28,7 +28,7 @@ class InstVnfRespSerializer(serializers.Serializer): class VnfVmsSerializer(serializers.Serializer): vmID = serializers.CharField(help_text="ID of VM", required=True) - vmName = serializers.CharField(help_text="Name of VM", required=False, allow_null=True) + vmName = serializers.CharField(help_text="Name of VM", required=False, allow_null=True, allow_blank=True) class GetVnfRespSerializer(serializers.Serializer): @@ -40,7 +40,7 @@ class GetVnfRespSerializer(serializers.Serializer): class TerminateVnfReqSerializer(serializers.Serializer): terminationType = serializers.CharField(help_text="Termination Type", required=False, allow_null=True) - gracefulTerminationTimeout = serializers.CharField(help_text="Graceful Termination Timeout", required=False, allow_null=True) + gracefulTerminationTimeout = serializers.CharField(help_text="Graceful Termination Timeout", required=False, allow_null=True, allow_blank=True) class TerminateVnfRespSerializer(serializers.Serializer): @@ -49,19 +49,19 @@ class TerminateVnfRespSerializer(serializers.Serializer): class ResourceChangeSerializer(serializers.Serializer): type = serializers.ChoiceField(help_text="Change Type", choices=["VDU"], required=True) - resourceDefinitionId = serializers.CharField(help_text="Identifier of resource", required=False, allow_null=True) - vdu = serializers.CharField(help_text="Identifier identifier of VDU", required=False, allow_null=True) + resourceDefinitionId = serializers.CharField(help_text="Identifier of resource", required=False, allow_null=True, allow_blank=True) + vdu = serializers.CharField(help_text="Identifier identifier of VDU", required=False, allow_null=True, allow_blank=True) class GrantVnfReqSerializer(serializers.Serializer): vnfInstanceId = serializers.CharField(help_text="ID of VNF instance", required=True) - vnfDescriptorId = serializers.CharField(help_text="ID of VNF Descriptor", required=False, allow_null=True) + vnfDescriptorId = serializers.CharField(help_text="ID of VNF Descriptor", required=False, allow_null=True, allow_blank=True) lifecycleOperation = serializers.ChoiceField( help_text="Lifecycle Operation", choices=["Terminal", "Instantiate", "Scalein", "Scaleout", "Scaledown", "Scaleup", "Heal"], required=True ) - jobId = serializers.CharField(help_text="ID of Job", required=False, allow_null=True) + jobId = serializers.CharField(help_text="ID of Job", required=False, allow_null=True, allow_blank=True) addResource = ResourceChangeSerializer(help_text="Add resources", many=True) removeResource = ResourceChangeSerializer(help_text="Remove resources", many=True) additionalParam = serializers.DictField( @@ -83,21 +83,21 @@ class VimSerializer(serializers.Serializer): class GrantVnfRespSerializer(serializers.Serializer): - vnfInstanceId = serializers.CharField(help_text="ID of VNF instance", required=False, allow_null=True) + vnfInstanceId = serializers.CharField(help_text="ID of VNF instance", required=False, allow_null=True, allow_blank=True) vim = VimSerializer(help_text="VIM Info", required=True) class AffectedVnfcSerializer(serializers.Serializer): - vnfcInstanceId = serializers.CharField(help_text="ID of VNFC instance", required=False, allow_null=True) - vduId = serializers.CharField(help_text="ID of VDU in VNFD", required=False, allow_null=True) + vnfcInstanceId = serializers.CharField(help_text="ID of VNFC instance", required=False, allow_null=True, allow_blank=True) + vduId = serializers.CharField(help_text="ID of VDU in VNFD", required=False, allow_null=True, allow_blank=True) changeType = serializers.ChoiceField( help_text="Type of Change", choices=["added", "removed", "modified"], required=True ) - vimId = serializers.CharField(help_text="ID of VIM", required=False, allow_null=True) - vmId = serializers.CharField(help_text="ID of virtual machine", required=False, allow_null=True) - vmName = serializers.CharField(help_text="Name of virtual machine", required=False, allow_null=True) + vimId = serializers.CharField(help_text="ID of VIM", required=False, allow_null=True, allow_blank=True) + vmId = serializers.CharField(help_text="ID of virtual machine", required=False, allow_null=True, allow_blank=True) + vmName = serializers.CharField(help_text="Name of virtual machine", required=False, allow_null=True, allow_blank=True) class NetworkResourceSerializer(serializers.Serializer): @@ -106,13 +106,13 @@ class NetworkResourceSerializer(serializers.Serializer): choices=["network", "port"], required=True ) - resourceId = serializers.CharField(help_text="ID of network resource", required=False, allow_null=True) - resourceName = serializers.CharField(help_text="Name of network resource", required=False, allow_null=True) + resourceId = serializers.CharField(help_text="ID of network resource", required=False, allow_null=True, allow_blank=True) + resourceName = serializers.CharField(help_text="Name of network resource", required=False, allow_null=True, allow_blank=True) class AffectedVirtualLinkSerializer(serializers.Serializer): - vlInstanceId = serializers.CharField(help_text="ID of VL instance", required=False, allow_null=True) - vldId = serializers.CharField(help_text="ID of VLD in VNFD", required=False, allow_null=True) + vlInstanceId = serializers.CharField(help_text="ID of VL instance", required=False, allow_null=True, allow_blank=True) + vldId = serializers.CharField(help_text="ID of VLD in VNFD", required=False, allow_null=True, allow_blank=True) changeType = serializers.ChoiceField( help_text="Type of Change", choices=["added", "removed", "modified"], @@ -122,13 +122,13 @@ class AffectedVirtualLinkSerializer(serializers.Serializer): class PortResourceSerializer(serializers.Serializer): - vimId = serializers.CharField(help_text="ID of VIM", required=False, allow_null=True) - resourceId = serializers.CharField(help_text="ID of Resource", required=False, allow_null=True) - resourceName = serializers.CharField(help_text="Name of Resource", required=False, allow_null=True) - tenant = serializers.CharField(help_text="ID of Tenant", required=False, allow_null=True) - ipAddress = serializers.CharField(help_text="IP address of port", required=False, allow_null=True) - macAddress = serializers.CharField(help_text="MAC address of port", required=False, allow_null=True) - instId = serializers.CharField(help_text="Instance id of server to which the port is attached to", required=False, allow_null=True) + vimId = serializers.CharField(help_text="ID of VIM", required=False, allow_null=True, allow_blank=True) + resourceId = serializers.CharField(help_text="ID of Resource", required=False, allow_null=True, allow_blank=True) + resourceName = serializers.CharField(help_text="Name of Resource", required=False, allow_null=True, allow_blank=True) + tenant = serializers.CharField(help_text="ID of Tenant", required=False, allow_null=True, allow_blank=True) + ipAddress = serializers.CharField(help_text="IP address of port", required=False, allow_null=True, allow_blank=True) + macAddress = serializers.CharField(help_text="MAC address of port", required=False, allow_null=True, allow_blank=True) + instId = serializers.CharField(help_text="Instance id of server to which the port is attached to", required=False, allow_null=True, allow_blank=True) class AffectedCpSerializer(serializers.Serializer): @@ -137,11 +137,11 @@ class AffectedCpSerializer(serializers.Serializer): choices=["added", "removed", "modified"], required=True ) - virtualLinkInstanceId = serializers.CharField(help_text="ID of VL instance", required=False, allow_null=True) - cpInstanceId = serializers.CharField(help_text="ID of CP instance", required=False, allow_null=True) - cpdId = serializers.CharField(help_text="ID of CPD in VNFD", required=False, allow_null=True) - ownerType = serializers.CharField(help_text="Type of Owner", required=False, allow_null=True) - ownerId = serializers.CharField(help_text="ID of Owner", required=False, allow_null=True) + virtualLinkInstanceId = serializers.CharField(help_text="ID of VL instance", required=False, allow_null=True, allow_blank=True) + cpInstanceId = serializers.CharField(help_text="ID of CP instance", required=False, allow_null=True, allow_blank=True) + cpdId = serializers.CharField(help_text="ID of CPD in VNFD", required=False, allow_null=True, allow_blank=True) + ownerType = serializers.CharField(help_text="Type of Owner", required=False, allow_null=True, allow_blank=True) + ownerId = serializers.CharField(help_text="ID of Owner", required=False, allow_null=True, allow_blank=True) portResource = PortResourceSerializer(help_text="Port Resource", required=False, allow_null=True) @@ -160,8 +160,8 @@ class NotifyLcmReqSerializer(serializers.Serializer): choices=["Terminal", "Instantiate", "Scalein", "Scaleout", "Scaledown", "Scaleup", "Heal"], required=True ) - jobId = serializers.CharField(help_text="ID of Job", required=False, allow_null=True) - vnfdmodule = serializers.CharField(help_text="VNFD Module", required=False, allow_null=True) + jobId = serializers.CharField(help_text="ID of Job", required=False, allow_null=True, allow_blank=True) + vnfdmodule = serializers.CharField(help_text="VNFD Module", required=False, allow_null=True, allow_blank=True) affectedVnfc = AffectedVnfcSerializer(help_text="Affected VNFC", many=True) affectedVl = AffectedVirtualLinkSerializer(help_text="Affected VL", many=True) affectedCp = AffectedCpSerializer(help_text="Affected CP", many=True) @@ -174,8 +174,8 @@ class ScaleVnfDataSerializer(serializers.Serializer): choices=["SCALE_IN", "SCALE_OUT"], required=True ) - aspectId = serializers.CharField(help_text="Aspect ID of the VNF that is requested to be scaled", required=False, allow_null=True) - numberOfSteps = serializers.CharField(help_text="Number of scaling steps to be executed as part of this ScaleVnf operation", required=False, allow_null=True) + aspectId = serializers.CharField(help_text="Aspect ID of the VNF that is requested to be scaled", required=False, allow_null=True, allow_blank=True) + numberOfSteps = serializers.CharField(help_text="Number of scaling steps to be executed as part of this ScaleVnf operation", required=False, allow_null=True, allow_blank=True) additionalParam = serializers.DictField( help_text="Additional parameters passed by the NFVO as input to the scaling process, specific to the VNF being scaled", child=serializers.CharField(help_text="Additional parameters", allow_blank=True), @@ -246,7 +246,7 @@ class CandidateSerializer(serializers.Serializer): required=True ) cloudOwner = serializers.CharField( - help_text="The name of a cloud owner. Only required if identifier Type is cloudRegionId", required=False) + help_text="The name of a cloud owner. Only required if identifier Type is cloudRegionId", required=False, allow_null=True, allow_blank=True) class LicenseSolutionSerializer(serializers.Serializer): @@ -306,8 +306,8 @@ class SolutionSerializer(serializers.Serializer): class PlaceVnfReqSerializer(serializers.Serializer): requestId = serializers.CharField(help_text="ID of Homing Request", required=True) - transactionId = serializers.CharField(help_text="ID of Homing Transaction", required=True, allow_null=False) - statusMessage = serializers.CharField(help_text="Status Message of Request", required=False, allow_null=True) + transactionId = serializers.CharField(help_text="ID of Homing Transaction", required=True, allow_null=False, allow_blank=True) + statusMessage = serializers.CharField(help_text="Status Message of Request", required=False, allow_null=True, allow_blank=True) requestStatus = serializers.ChoiceField( help_text="The Status of a Request", choices=["completed", "failed", "pending"], |