Add vfc-vnflcm instantiatedVnfInfo schema
[vfc/gvnfm/vnflcm.git] / lcm / lcm / v2 / serializers.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 from rest_framework import serializers
15
16
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.",
20         required=False,
21         max_length=255,
22         allow_null=True)
23     vimId = serializers.CharField(
24         help_text="The identifier of the VIM instance. This identifier is managed by the NFVO.",
25         required=False,
26         max_length=255,
27         allow_null=True)
28     vimType = serializers.CharField(
29         help_text="Discriminator for the different types of the VIM information.",
30         required=False,
31         max_length=255,
32         allow_null=True)
33     interfaceInfo = serializers.DictField(
34         help_text="Information about the interface or interfaces to the VIM",
35         child=serializers.CharField(allow_blank=True),
36         required=False,
37         allow_null=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),
41         required=False,
42         allow_null=True)
43     extra = serializers.DictField(
44         help_text="VIM type specific additional information.",
45         child=serializers.CharField(allow_blank=True),
46         required=False,
47         allow_null=True)
48
49
50 class ScaleInfoSerializer(serializers.Serializer):
51     aspectId = serializers.CharField(
52         help_text="Identifier of the scaling aspect.",
53         required=True,
54         max_length=255,
55         allow_null=True)
56     scaleLevel = serializers.IntegerField(
57         help_text="Indicates the scale level.",
58         required=True)
59
60
61 class instantiatedVnfInfoSerializer(serializers.Serializer):
62     flavourId = serializers.CharField(
63         help_text="Identifier of the VNF deployment flavour applied to this VNF instance.",
64         required=True,
65         max_length=255,
66         allow_null=True)
67     vnfState = serializers.ChoiceField(
68         help_text="State of the VNF instance.",
69         choices=["STARTED", "STOPPED"],
70         required=True,
71         allow_null=True)
72     scaleStatus = ScaleInfoSerializer(
73         help_text="Scale status of the VNF, one entry per aspect.",
74         required=False,
75         many=True)
76
77
78 class VnfInstanceSerializer(serializers.Serializer):
79     id = serializers.CharField(
80         help_text="Identifier of the VNF instance",
81         required=True)
82     vnfInstanceName = serializers.CharField(
83         help_text="Name of the VNF instance.",
84         required=False,
85         allow_null=True,
86         allow_blank=True)
87     vnfInstanceDescription = serializers.CharField(
88         help_text="Human-readable description of the VNF instance.",
89         required=False,
90         allow_null=True,
91         allow_blank=True)
92     vnfdId = serializers.CharField(
93         help_text="Identifier of the VNFD on which the VNF instance is based.",
94         required=False,
95         allow_null=True,
96         allow_blank=True)
97     vnfProvider = serializers.CharField(
98         help_text="Provider of the VNF and the VNFD. The value is copied from the VNFD.",
99         required=False,
100         allow_null=True,
101         allow_blank=True)
102     vnfProductName = serializers.CharField(
103         help_text="Name to identify the VNF Product. The value is copied from the VNFD.",
104         required=False,
105         allow_null=True,
106         allow_blank=True)
107     vnfSoftwareVersion = serializers.CharField(
108         help_text="Software version of the VNF. The value is copied from the VNFD.",
109         required=False,
110         allow_null=True,
111         allow_blank=True)
112     vnfdVersion = serializers.CharField(
113         help_text="Identifies the version of the VNFD. The value is copied from the VNFD.",
114         required=False,
115         allow_null=True,
116         allow_blank=True)
117     vnfPkgId = serializers.CharField(
118         help_text="Identifier of information held by the NFVO about the specific VNF package on which the VNF is based.",
119         required=False,
120         allow_null=True,
121         allow_blank=True)
122     vnfConfigurableProperties = serializers.DictField(
123         help_text="Current values of the configurable properties of the VNF instance.",
124         child=serializers.CharField(allow_blank=True),
125         required=False,
126         allow_null=True)
127     vimConnectionInfo = VimInfoSerializer(
128         help_text="Information about VIM connections to be used for managing the resources for the VNF instance.",
129         required=False,
130         allow_null=True)
131     instantiationState = serializers.ChoiceField(
132         help_text="The instantiation state of the VNF.",
133         choices=["NOT_INSTANTIATED", "INSTANTIATED"],
134         required=False,
135         allow_null=True)
136     instantiatedVnfInfo = instantiatedVnfInfoSerializer(
137         help_text="Information specific to an instantiated VNF instance.",
138         required=False)