Add vfc-vnflcm vnfInstance 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 VnfInstanceSerializer(serializers.Serializer):
51     id = serializers.CharField(
52         help_text="Identifier of the VNF instance",
53         required=True)
54     vnfInstanceName = serializers.CharField(
55         help_text="Name of the VNF instance.",
56         required=False,
57         allow_null=True,
58         allow_blank=True)
59     vnfInstanceDescription = serializers.CharField(
60         help_text="Human-readable description of the VNF instance.",
61         required=False,
62         allow_null=True,
63         allow_blank=True)
64     vnfdId = serializers.CharField(
65         help_text="Identifier of the VNFD on which the VNF instance is based.",
66         required=False,
67         allow_null=True,
68         allow_blank=True)
69     vnfProvider = serializers.CharField(
70         help_text="Provider of the VNF and the VNFD. The value is copied from the VNFD.",
71         required=False,
72         allow_null=True,
73         allow_blank=True)
74     vnfProductName = serializers.CharField(
75         help_text="Name to identify the VNF Product. The value is copied from the VNFD.",
76         required=False,
77         allow_null=True,
78         allow_blank=True)
79     vnfSoftwareVersion = serializers.CharField(
80         help_text="Software version of the VNF. The value is copied from the VNFD.",
81         required=False,
82         allow_null=True,
83         allow_blank=True)
84     vnfdVersion = serializers.CharField(
85         help_text="Identifies the version of the VNFD. The value is copied from the VNFD.",
86         required=False,
87         allow_null=True,
88         allow_blank=True)
89     vnfPkgId = serializers.CharField(
90         help_text="Identifier of information held by the NFVO about the specific VNF package on which the VNF is based.",
91         required=False,
92         allow_null=True,
93         allow_blank=True)
94     vnfConfigurableProperties = serializers.DictField(
95         help_text="Current values of the configurable properties of the VNF instance.",
96         child=serializers.CharField(allow_blank=True),
97         required=False,
98         allow_null=True)
99     vimConnectionInfo = VimInfoSerializer(
100         help_text="vim",
101         required=False,
102         allow_null=True)
103     instantiationState = serializers.ChoiceField(
104         help_text="The instantiation state of the VNF.",
105         choices=["NOT_INSTANTIATED", "INSTANTIATED"],
106         required=False,
107         allow_null=True)