1 # Copyright (c) 2018, CMCC Technologies Co., Ltd.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 from rest_framework import serializers
17 from lcm.ns.serializers.update_serializers import AddPnfDataSerializer, VnfInstanceDataSerializer, SapDataSerializer
18 from lcm.ns.serializers.create_ns_serializers import AffinityOrAntiAffinityRuleSerializer
21 class civicAddressElementSerializer(serializers.Serializer):
22 caType = serializers.CharField(help_text="Describe the content type of caValue.", required=True)
23 caValue = serializers.CharField(help_text="Content of civic address element corresponding to the"
24 "aType.", required=True)
27 class LocationConstraintsSerializer(serializers.Serializer):
28 countryCode = serializers.CharField(help_text="The two-letter ISO 3166 [29] country code in capital"
29 "letters.", required=True)
30 civicAddressElement = civicAddressElementSerializer(help_text="Zero or more elements comprising the civic"
32 required=False, allow_null=True, many=True)
35 class VnfLocationConstraintSerializer(serializers.Serializer):
36 vnfProfileId = serializers.CharField(help_text="ID of VNF profile", required=False, allow_null=True)
37 locationConstraints = LocationConstraintsSerializer(help_text="Defines the location constraints for the"
38 "VNF instance to be created based on the"
40 required=False, allow_null=True)
43 class ParamsForVnfSerializer(serializers.Serializer):
44 vnfProfileId = serializers.CharField(help_text="Identifier of (reference to) a vnfProfile to which the"
45 "additional parameters apply", required=True)
46 additionalParams = serializers.DictField(help_text="Content of civic address element corresponding to the"
48 child=serializers.CharField(help_text="KeyValue Pairs",
50 required=False, allow_null=True)
53 class InstantNsReqSerializer(serializers.Serializer):
54 nsFlavourId = serializers.CharField(help_text="Identifier of the NS deployment flavour to be"
55 "instantiated.", required=True)
56 sapData = SapDataSerializer(help_text="Create data concerning the SAPs of this NS",
57 required=False, allow_null=True, many=True)
58 addpnfData = AddPnfDataSerializer(help_text="Information on the PNF(s) that are part of this NS.",
59 required=False, allow_null=True, many=True)
60 vnfInstanceData = VnfInstanceDataSerializer(help_text="Specify an existing VNF instance to be used in "
62 required=False, allow_null=True, many=True)
63 nestedNsInstanceId = serializers.ListField(help_text="Specify an existing NS instance to be used as a "
64 "nested NS within the NS",
65 required=False, allow_null=True)
66 localizationLanguage = VnfLocationConstraintSerializer(help_text="Defines the location constraints for "
67 "the VNF to be instantiated as part of"
68 " the NS instantiation.",
69 required=False, allow_null=True, many=True)
70 additionalParamForNs = serializers.DictField(
71 help_text="Allows the OSS/BSS to provide additional parameters at the NS level ",
72 child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
76 additionalParamsForVnf = ParamsForVnfSerializer(help_text="Allows the OSS/BSS to provide additional "
77 "parameter(s)per VNF instance",
78 required=False, allow_null=True, many=True)
79 startTime = serializers.DateTimeField(help_text="Timestamp indicating the earliest time to instantiate"
80 "the NS.", required=False, allow_null=True)
81 nsInstantiationLevelId = serializers.CharField(help_text="Identifies one of the NS instantiation levels"
82 "declared in the DF applicable to this NS "
83 "instance", required=False, allow_null=True)
84 additionalAffinityOrAntiAffiniityRule = AffinityOrAntiAffinityRuleSerializer(
85 help_text="Specifies additional affinity or anti-affinity constraint for the VNF instances to be"
86 " instantiated as part of the NS instantiation.",
87 required=False, allow_null=True, many=True)
90 class InstNsPostDealReqSerializer(serializers.Serializer):
91 status = serializers.CharField(help_text="Status of NS Inst", required=True)