1 # Copyright 2018 ZTE Corporation.
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.
14 from rest_framework import serializers
17 class VimInfoSerializer(serializers.Serializer):
18 id = serializers.CharField(
19 help_text="The identifier of the VIM Connection. This identifier is managed by the NFVO.",
23 vimId = serializers.CharField(
24 help_text="The identifier of the VIM instance. This identifier is managed by the NFVO.",
28 vimType = serializers.CharField(
29 help_text="Discriminator for the different types of the VIM information.",
33 interfaceInfo = serializers.DictField(
34 help_text="Information about the interface or interfaces to the VIM",
35 child=serializers.CharField(allow_blank=True),
38 accessInfo = serializers.DictField(
39 help_text="Authentication credentials for accessing the VIM, and other access-related information",
40 child=serializers.CharField(allow_blank=True),
43 extra = serializers.DictField(
44 help_text="VIM type specific additional information.",
45 child=serializers.CharField(allow_blank=True),
50 class ScaleInfoSerializer(serializers.Serializer):
51 aspectId = serializers.CharField(
52 help_text="Identifier of the scaling aspect.",
56 scaleLevel = serializers.IntegerField(
57 help_text="Indicates the scale level.",
61 class CpProtocolInfoSerializer(serializers.Serializer):
62 layerProtocol = serializers.ChoiceField(
63 help_text="The identifier of layer(s) and protocol(s) associated to the network address information.",
64 choices=["IP_OVER_ETHERNET"],
67 ipOverEthernet = serializers.DictField(
68 help_text="IP addresses over Ethernet to assign to the extCP instance.",
69 child=serializers.CharField(allow_blank=True),
74 class ExtCpInfoSerializer(serializers.Serializer):
75 id = serializers.CharField(
76 help_text="Identifier of the external CP instance and the related information instance.",
80 cpdId = serializers.CharField(
81 help_text="Identifier of the external CPD, VnfExtCpd, in the VNFD.",
85 cpProtocolInfo = CpProtocolInfoSerializer(
86 help_text="Network protocol information for this CP.",
89 extLinkPortId = serializers.CharField(
90 help_text="Identifier of the 'extLinkPortInfo' structure inside the 'extVirtualLinkInfo' structure.",
96 class instantiatedVnfInfoSerializer(serializers.Serializer):
97 flavourId = serializers.CharField(
98 help_text="Identifier of the VNF deployment flavour applied to this VNF instance.",
102 vnfState = serializers.ChoiceField(
103 help_text="State of the VNF instance.",
104 choices=["STARTED", "STOPPED"],
107 scaleStatus = ScaleInfoSerializer(
108 help_text="Scale status of the VNF, one entry per aspect.",
111 extCpInfo = ExtCpInfoSerializer(
112 help_text="Information about the external CPs exposed by the VNF instance.",
117 class VnfInstanceSerializer(serializers.Serializer):
118 id = serializers.CharField(
119 help_text="Identifier of the VNF instance",
121 vnfInstanceName = serializers.CharField(
122 help_text="Name of the VNF instance.",
126 vnfInstanceDescription = serializers.CharField(
127 help_text="Human-readable description of the VNF instance.",
131 vnfdId = serializers.CharField(
132 help_text="Identifier of the VNFD on which the VNF instance is based.",
136 vnfProvider = serializers.CharField(
137 help_text="Provider of the VNF and the VNFD. The value is copied from the VNFD.",
141 vnfProductName = serializers.CharField(
142 help_text="Name to identify the VNF Product. The value is copied from the VNFD.",
146 vnfSoftwareVersion = serializers.CharField(
147 help_text="Software version of the VNF. The value is copied from the VNFD.",
151 vnfdVersion = serializers.CharField(
152 help_text="Identifies the version of the VNFD. The value is copied from the VNFD.",
156 vnfPkgId = serializers.CharField(
157 help_text="Identifier of information held by the NFVO about the specific VNF package on which the VNF is based.",
161 vnfConfigurableProperties = serializers.DictField(
162 help_text="Current values of the configurable properties of the VNF instance.",
163 child=serializers.CharField(allow_blank=True),
166 vimConnectionInfo = VimInfoSerializer(
167 help_text="Information about VIM connections to be used for managing the resources for the VNF instance.",
170 instantiationState = serializers.ChoiceField(
171 help_text="The instantiation state of the VNF.",
172 choices=["NOT_INSTANTIATED", "INSTANTIATED"],
175 instantiatedVnfInfo = instantiatedVnfInfoSerializer(
176 help_text="Information specific to an instantiated VNF instance.",