2521e8eea7420c8496201806c9bdf66c5638d337
[vfc/gvnfm/vnflcm.git] / lcm / lcm / nf / serializers / vnf_instance.py
1 # Copyright 2018 ZTE Corporation.
2 #
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
6 #
7 #         http://www.apache.org/licenses/LICENSE-2.0
8 #
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
15
16 from rest_framework import serializers
17
18 from vim_connection_info import VimConnectionInfoSerializer
19 from instantiated_vnf_info import InstantiatedVnfInfoSerializer
20 from _links import _LinksSerializer
21
22
23 class VnfInstanceSerializer(serializers.Serializer):
24     id = serializers.CharField(
25         help_text="Identifier of the VNF instance.",
26         max_length=255,
27         required=True,
28         allow_null=False,
29         allow_blank=False)
30     vnfInstanceName = serializers.CharField(
31         help_text="Name of the VNF instance. \
32         This attribute can be modified with the PATCH method.",
33         max_length=255,
34         required=False,
35         allow_null=True,
36         allow_blank=True)
37     vnfInstanceDescription = serializers.CharField(
38         help_text="Human-readable description of the VNF instance. \
39         This attribute can be modified with the PATCH method.",
40         required=False,
41         allow_null=True,
42         allow_blank=True)
43     vnfdId = serializers.CharField(
44         help_text="Identifier of the VNFD on which the VNF instance is based.",
45         max_length=255,
46         required=False,
47         allow_null=True,
48         allow_blank=True)
49     vnfProvider = serializers.CharField(
50         help_text="Provider of the VNF and the VNFD. \
51         The value is copied from the VNFD. ",
52         max_length=255,
53         required=False,
54         allow_null=True,
55         allow_blank=True)
56     vnfProductName = serializers.CharField(
57         help_text="Name to identify the VNF Product. \
58         The value is copied from the VNFD.",
59         max_length=255,
60         required=False,
61         allow_null=True,
62         allow_blank=True)
63     vnfSoftwareVersion = serializers.CharField(
64         help_text="Software version of the VNF. \
65         The value is copied from the VNFD.",
66         max_length=255,
67         required=False,
68         allow_null=True,
69         allow_blank=True)
70     vnfdVersion = serializers.CharField(
71         help_text="Identifies the version of the VNFD. \
72         The value is copied from the VNFD.",
73         max_length=255,
74         required=False,
75         allow_null=True,
76         allow_blank=True)
77     vnfPkgId = serializers.CharField(
78         help_text="Identifier of information held by the NFVO about the specific VNF package on which the VNF is based. \
79         This attribute can be modified with the PATCH method.",
80         max_length=255,
81         required=False,
82         allow_null=True,
83         allow_blank=True)
84     vnfConfigurableProperties = serializers.DictField(
85         help_text="Current values of the configurable properties of the VNF instance. \
86         Configurable properties referred in this attribute are declared in the VNFD",
87         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
88         required=False,
89         allow_null=True)
90     vimConnectionInfo = VimConnectionInfoSerializer(
91         help_text="Information about VIM connections to be used for managing the resources for the VNF instance. \
92         This attribute can be modified with the PATCH method.",
93         required=False,
94         allow_null=True)
95     instantiationState = serializers.ChoiceField(
96         help_text="The instantiation state of the VNF.",
97         choices=["NOT_INSTANTIATED", "INSTANTIATED"],
98         required=True,
99         allow_null=False,
100         allow_blank=False)
101     instantiatedVnfInfo = InstantiatedVnfInfoSerializer(
102         help_text="Information specific to an instantiated VNF instance. \
103         This attribute shall be present if the instantiateState attribute value is INSTANTIATED",
104         required=False,
105         allow_null=True)
106     metadata = serializers.DictField(
107         help_text="Additional VNF-specific metadata describing the VNF instance.\
108         This attribute can be modified with the PATCH method.",
109         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
110         required=False,
111         allow_null=True)
112     extensions = serializers.DictField(
113         help_text="VNF-specific attributes that affect the lifecycle management of this VNF instance by the VNFM, or the lifecycle management scripts. \
114         This attribute can be modified with the PATCH method.",
115         child=serializers.CharField(help_text="KeyValue Pairs", allow_blank=True),
116         required=False,
117         allow_null=True)
118     _links = _LinksSerializer(
119         help_text="Links to resources related to this resource.",
120         required=False,
121         allow_null=False)