From 5c90e87e9e3a9c9dd95a9f08c813974e387fe55c Mon Sep 17 00:00:00 2001 From: maopengzhang Date: Tue, 2 Apr 2019 19:11:27 +0800 Subject: [PATCH] fix NS instantiation serializer error fix NS instantiation serializer error Change-Id: I01fea83f0f2afb5e3413e3168d7abf2c6ce4dfbb Issue-ID: VFC-1214 Signed-off-by: maopengzhang --- lcm/ns/serializers/sol/inst_ns_serializers.py | 116 ++++++++++++++++---------- 1 file changed, 70 insertions(+), 46 deletions(-) diff --git a/lcm/ns/serializers/sol/inst_ns_serializers.py b/lcm/ns/serializers/sol/inst_ns_serializers.py index fd64a00b..bb5c600a 100644 --- a/lcm/ns/serializers/sol/inst_ns_serializers.py +++ b/lcm/ns/serializers/sol/inst_ns_serializers.py @@ -1,4 +1,5 @@ # Copyright (c) 2018, CMCC Technologies Co., Ltd. +# Copyright 2019 ZTE Corporation. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,69 +20,92 @@ from lcm.ns.serializers.sol.update_serializers import AddPnfDataSerializer, VnfI class civicAddressElementSerializer(serializers.Serializer): - caType = serializers.CharField(help_text="Describe the content type of caValue.", required=True) - caValue = serializers.CharField(help_text="Content of civic address element corresponding to the" - "aType.", required=True) + caType = serializers.CharField( + help_text="Describe the content type of caValue.", + required=True) + caValue = serializers.CharField( + help_text="Content of civic address element corresponding to the caType.", + required=True) class LocationConstraintsSerializer(serializers.Serializer): - countryCode = serializers.CharField(help_text="The two-letter ISO 3166 [29] country code in capital" - "letters.", required=True) - civicAddressElement = civicAddressElementSerializer(help_text="Zero or more elements comprising the civic" - "address.", - required=False, allow_null=True, many=True) + countryCode = serializers.CharField( + help_text="The two-letter ISO 3166 [29] country code in capital letters.", + required=True) + civicAddressElement = civicAddressElementSerializer( + help_text="Zero or more elements comprising the civic address.", + required=False, + many=True) class VnfLocationConstraintSerializer(serializers.Serializer): - vnfProfileId = serializers.CharField(help_text="ID of VNF profile", required=False, allow_null=True) - locationConstraints = LocationConstraintsSerializer(help_text="Defines the location constraints for the" - "VNF instance to be created based on the" - "VNF profile.", - required=False, allow_null=True) + vnfProfileId = serializers.CharField( + help_text="Identifier (reference to) of a VnfProfile in the NSD used to manage the lifecycle of the VNF instance.", + required=True) + locationConstraints = LocationConstraintsSerializer( + help_text="Defines the location constraints for the VNF instance to be created based on the VNF profile.", + required=True) class ParamsForVnfSerializer(serializers.Serializer): - vnfProfileId = serializers.CharField(help_text="Identifier of (reference to) a vnfProfile to which the" - "additional parameters apply", required=True) - additionalParams = serializers.DictField(help_text="Content of civic address element corresponding to the" - "caType", - child=serializers.CharField(help_text="KeyValue Pairs", - allow_blank=True), - required=False, allow_null=True) + vnfProfileId = serializers.CharField( + help_text="Identifier of (reference to) a vnfProfile to which the additional parameters apply.", + required=True) + additionalParams = serializers.DictField( + help_text="Additional parameters that are applied for the VNF instance to be created.", + required=False) + + +class NestedNsInstanceDataSerializer(serializers.Serializer): + nestedNsInstanceId = serializers.CharField( + help_text="Identifier of the existing nested NS instance to be used in the NS.", + required=True) + nsProfileId = serializers.CharField( + help_text="Identifier of an NsProfile defined in the NSD which the existing nested NS instance shall be matched with.", + required=True) class InstantNsReqSerializer(serializers.Serializer): - nsFlavourId = serializers.CharField(help_text="Identifier of the NS deployment flavour to be" - "instantiated.", required=True) - sapData = SapDataSerializer(help_text="Create data concerning the SAPs of this NS", - required=False, allow_null=True, many=True) - addpnfData = AddPnfDataSerializer(help_text="Information on the PNF(s) that are part of this NS.", - required=False, allow_null=True, many=True) - vnfInstanceData = VnfInstanceDataSerializer(help_text="Specify an existing VNF instance to be used in " - "the NS.", - required=False, allow_null=True, many=True) - nestedNsInstanceId = serializers.ListField(help_text="Specify an existing NS instance to be used as a " - "nested NS within the NS", - required=False, allow_null=True) - localizationLanguage = VnfLocationConstraintSerializer(help_text="Defines the location constraints for " - "the VNF to be instantiated as part of" - " the NS instantiation.", - required=False, allow_null=True, many=True) + nsFlavourId = serializers.CharField( + help_text="Identifier of the NS deployment flavour to be instantiated.", + required=True) + sapData = SapDataSerializer( + help_text="Create data concerning the SAPs of this NS", + required=False, + many=True) + addpnfData = AddPnfDataSerializer( + help_text="Information on the PNF(s) that are part of this NS.", + required=False, + many=True) + vnfInstanceData = VnfInstanceDataSerializer( + help_text="Specify an existing VNF instance to be used in the NS.", + required=False, + many=True) + nestedNsInstanceData = NestedNsInstanceDataSerializer( + help_text="Specify an existing NS instance to be used as a nested NS within the NS", + required=False, + many=True) + localizationLanguage = VnfLocationConstraintSerializer( + help_text="Defines the location constraints for the VNF to be instantiated as part of the NS instantiation.", + required=False, + many=True) additionalParamForNs = serializers.DictField( help_text="Allows the OSS/BSS to provide additional parameters at the NS level ", - child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True), required=False, allow_null=True ) - additionalParamsForVnf = ParamsForVnfSerializer(help_text="Allows the OSS/BSS to provide additional " - "parameter(s)per VNF instance", - required=False, allow_null=True, many=True) - startTime = serializers.DateTimeField(help_text="Timestamp indicating the earliest time to instantiate" - "the NS.", required=False, allow_null=True) - nsInstantiationLevelId = serializers.CharField(help_text="Identifies one of the NS instantiation levels" - "declared in the DF applicable to this NS " - "instance", required=False, allow_null=True) + additionalParamsForVnf = ParamsForVnfSerializer( + help_text="Allows the OSS/BSS to provide additional parameter(s)per VNF instance", + required=False, + many=True) + startTime = serializers.DateTimeField( + help_text="Timestamp indicating the earliest time to instantiate the NS.", + required=False) + nsInstantiationLevelId = serializers.CharField( + help_text="Identifies one of the NS instantiation levels declared in the DF applicable to this NS instance", + required=False) additionalAffinityOrAntiAffiniityRule = AffinityOrAntiAffinityRuleSerializer( help_text="Specifies additional affinity or anti-affinity constraint for the VNF instances to be" " instantiated as part of the NS instantiation.", - required=False, allow_null=True, many=True) + required=False, + many=True) -- 2.16.6