1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
|
# Copyright 2018 ZTE Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from rest_framework import serializers
class InstVnfReqSerializer(serializers.Serializer):
vnfIndex = serializers.CharField(help_text="Index of VNF", required=True)
nsInstanceId = serializers.CharField(help_text="ID of NS instance", required=True)
additionalParamForVnf = serializers.CharField(help_text="Additional param for VNF", required=False, allow_null=True, allow_blank=True)
class InstVnfRespSerializer(serializers.Serializer):
vnfInstId = serializers.CharField(help_text="ID of VNF instance", required=True)
jobId = serializers.CharField(help_text="ID of Job", required=True)
class VnfVmsSerializer(serializers.Serializer):
vmID = serializers.CharField(help_text="ID of VM", required=True)
vmName = serializers.CharField(help_text="Name of VM", required=False, allow_null=True, allow_blank=True)
class GetVnfRespSerializer(serializers.Serializer):
vnfInstId = serializers.CharField(help_text="ID of VNF instance", required=True)
vnfName = serializers.CharField(help_text="Name of VNF instance", required=True)
vnfStatus = serializers.CharField(help_text="Status of VNF instance", required=True)
vnfVms = VnfVmsSerializer(help_text="VMs of VNF", many=True)
class TerminateVnfReqSerializer(serializers.Serializer):
terminationType = serializers.CharField(help_text="Termination Type", required=False, allow_null=True)
gracefulTerminationTimeout = serializers.CharField(help_text="Graceful Termination Timeout", required=False, allow_null=True, allow_blank=True)
class TerminateVnfRespSerializer(serializers.Serializer):
jobId = serializers.CharField(help_text="ID of Job", required=True)
class ResourceChangeSerializer(serializers.Serializer):
type = serializers.ChoiceField(help_text="Change Type", choices=["VDU"], required=True)
resourceDefinitionId = serializers.CharField(help_text="Identifier of resource", required=False, allow_null=True, allow_blank=True)
vdu = serializers.CharField(help_text="Identifier identifier of VDU", required=False, allow_null=True, allow_blank=True)
class GrantVnfReqSerializer(serializers.Serializer):
vnfInstanceId = serializers.CharField(help_text="ID of VNF instance", required=True)
vnfDescriptorId = serializers.CharField(help_text="ID of VNF Descriptor", required=False, allow_null=True, allow_blank=True)
lifecycleOperation = serializers.ChoiceField(
help_text="Lifecycle Operation",
choices=["Terminal", "Instantiate", "Scalein", "Scaleout", "Scaledown", "Scaleup", "Heal"],
required=True
)
jobId = serializers.CharField(help_text="ID of Job", required=False, allow_null=True, allow_blank=True)
addResource = ResourceChangeSerializer(help_text="Add resources", many=True)
removeResource = ResourceChangeSerializer(help_text="Remove resources", many=True)
additionalParam = serializers.DictField(
help_text="Additional parameters passed to the NFVO, specific to the VNF and the LCM operation. The currently interpreted keys are the following: vimId",
child=serializers.CharField(help_text="Additional parameters", allow_blank=True),
required=False,
allow_null=True
)
class AccessinfoSerializer(serializers.Serializer):
tenant = serializers.CharField(help_text="Name of tenant", required=True)
class VimSerializer(serializers.Serializer):
vimid = serializers.CharField(help_text="ID of VIM", required=True)
accessinfo = AccessinfoSerializer(help_text="Access Info", required=False)
accessInfo = AccessinfoSerializer(help_text="Access Info", required=False)
class GrantVnfRespSerializer(serializers.Serializer):
vnfInstanceId = serializers.CharField(help_text="ID of VNF instance", required=False, allow_null=True, allow_blank=True)
vim = VimSerializer(help_text="VIM Info", required=True)
class AffectedVnfcLcmSerializer(serializers.Serializer):
vnfcInstanceId = serializers.CharField(help_text="ID of VNFC instance", required=False, allow_null=True, allow_blank=True)
vduId = serializers.CharField(help_text="ID of VDU in VNFD", required=False, allow_null=True, allow_blank=True)
changeType = serializers.ChoiceField(
help_text="Type of Change",
choices=["added", "removed", "modified"],
required=True
)
vimId = serializers.CharField(help_text="ID of VIM", required=False, allow_null=True, allow_blank=True)
vmId = serializers.CharField(help_text="ID of virtual machine", required=False, allow_null=True, allow_blank=True)
vmName = serializers.CharField(help_text="Name of virtual machine", required=False, allow_null=True, allow_blank=True)
class NetworkResourceSerializer(serializers.Serializer):
resourceType = serializers.ChoiceField(
help_text="Type of Resource",
choices=["network", "port"],
required=True
)
resourceId = serializers.CharField(help_text="ID of network resource", required=False, allow_null=True, allow_blank=True)
resourceName = serializers.CharField(help_text="Name of network resource", required=False, allow_null=True, allow_blank=True)
class AffectedVirtualLinkLcmSerializer(serializers.Serializer):
vlInstanceId = serializers.CharField(help_text="ID of VL instance", required=False, allow_null=True, allow_blank=True)
vldId = serializers.CharField(help_text="ID of VLD in VNFD", required=False, allow_null=True, allow_blank=True)
changeType = serializers.ChoiceField(
help_text="Type of Change",
choices=["added", "removed", "modified"],
required=True
)
networkResource = NetworkResourceSerializer(help_text="Network Resource", required=False, allow_null=True)
class PortResourceSerializer(serializers.Serializer):
vimId = serializers.CharField(help_text="ID of VIM", required=False, allow_null=True, allow_blank=True)
resourceId = serializers.CharField(help_text="ID of Resource", required=False, allow_null=True, allow_blank=True)
resourceName = serializers.CharField(help_text="Name of Resource", required=False, allow_null=True, allow_blank=True)
tenant = serializers.CharField(help_text="ID of Tenant", required=False, allow_null=True, allow_blank=True)
ipAddress = serializers.CharField(help_text="IP address of port", required=False, allow_null=True, allow_blank=True)
macAddress = serializers.CharField(help_text="MAC address of port", required=False, allow_null=True, allow_blank=True)
instId = serializers.CharField(help_text="Instance id of server to which the port is attached to", required=False, allow_null=True, allow_blank=True)
class AffectedCpSerializer(serializers.Serializer):
changeType = serializers.ChoiceField(
help_text="Type of Change",
choices=["added", "removed", "modified"],
required=True
)
virtualLinkInstanceId = serializers.CharField(help_text="ID of VL instance", required=False, allow_null=True, allow_blank=True)
cpInstanceId = serializers.CharField(help_text="ID of CP instance", required=False, allow_null=True, allow_blank=True)
cpdId = serializers.CharField(help_text="ID of CPD in VNFD", required=False, allow_null=True, allow_blank=True)
ownerType = serializers.CharField(help_text="Type of Owner", required=False, allow_null=True, allow_blank=True)
ownerId = serializers.CharField(help_text="ID of Owner", required=False, allow_null=True, allow_blank=True)
portResource = PortResourceSerializer(help_text="Port Resource", required=False, allow_null=True)
class AffectedVirtualStorageLcm(serializers.Serializer):
pass
class NotifyLcmReqSerializer(serializers.Serializer):
status = serializers.ChoiceField(
help_text="Status of operation",
choices=["result", "start"],
required=True
)
operation = serializers.ChoiceField(
help_text="Lifecycle Operation",
choices=["Terminal", "Instantiate", "Scalein", "Scaleout", "Scaledown", "Scaleup", "Heal"],
required=True
)
jobId = serializers.CharField(help_text="ID of Job", required=False, allow_null=True, allow_blank=True)
vnfdmodule = serializers.CharField(help_text="VNFD Module", required=False, allow_null=True, allow_blank=True)
affectedVnfc = AffectedVnfcLcmSerializer(help_text="Affected VNFC", many=True)
affectedVl = AffectedVirtualLinkLcmSerializer(help_text="Affected VL", many=True)
affectedCp = AffectedCpSerializer(help_text="Affected CP", many=True)
affectedVirtualStorage = AffectedVirtualStorageLcm(help_text="Affected Virtual Storage(Not supported)", many=True)
class ScaleVnfDataSerializer(serializers.Serializer):
type = serializers.ChoiceField(
help_text="Direction of the scaling",
choices=["SCALE_IN", "SCALE_OUT"],
required=True
)
aspectId = serializers.CharField(help_text="Aspect ID of the VNF that is requested to be scaled", required=False, allow_null=True, allow_blank=True)
numberOfSteps = serializers.CharField(help_text="Number of scaling steps to be executed as part of this ScaleVnf operation", required=False, allow_null=True, allow_blank=True)
additionalParam = serializers.DictField(
help_text="Additional parameters passed by the NFVO as input to the scaling process, specific to the VNF being scaled",
child=serializers.CharField(help_text="Additional parameters", allow_blank=True),
required=False,
allow_null=True
)
class ScaleVnfReqSerializer(serializers.Serializer):
scaleVnfData = ScaleVnfDataSerializer(help_text="Scale data", many=False)
class ScaleVnfRespSerializer(serializers.Serializer):
jobId = serializers.CharField(help_text="ID of Job", required=True)
class VerifyVnfReqSerializer(serializers.Serializer):
PackageID = serializers.CharField(help_text="ID of Package", required=True)
class VerifyVnfRespSerializer(serializers.Serializer):
jobId = serializers.CharField(help_text="ID of Job", required=True)
class VnfmInfoRespSerializer(serializers.Serializer):
vnfmId = serializers.CharField(help_text="ID of VNFM", required=True)
name = serializers.CharField(help_text="Name of VNFM", required=True)
type = serializers.CharField(help_text="Type of VNFM", required=True)
vimId = serializers.CharField(help_text="ID of VIM", required=True)
vendor = serializers.CharField(help_text="Vendor of VNFM", required=False, allow_null=True, allow_blank=True)
version = serializers.CharField(help_text="Version of VNFM", required=False, allow_null=True, allow_blank=True)
description = serializers.CharField(help_text="Description of VNFM", required=False, allow_null=True, allow_blank=True)
certificateUrl = serializers.CharField(help_text="Certificate PEM of VNFM", required=False, allow_null=True, allow_blank=True)
url = serializers.CharField(help_text="url of VNFM", required=False, allow_null=True, allow_blank=True)
userName = serializers.CharField(help_text="User Name of VNFM", required=False, allow_null=True, allow_blank=True)
password = serializers.CharField(help_text="Password of VNFM", required=False, allow_null=True, allow_blank=True)
createTime = serializers.CharField(help_text="Create Time of VNFM", required=False, allow_null=True, allow_blank=True)
class VimInfoRespSerializer(serializers.Serializer):
vimId = serializers.CharField(help_text="ID of VIM", required=True)
name = serializers.CharField(help_text="Name of VIM", required=True)
url = serializers.CharField(help_text="Url of VIM", required=True)
userName = serializers.CharField(help_text="User Name of VIM", required=True)
password = serializers.CharField(help_text="Password of VIM", required=True)
tenantId = serializers.CharField(help_text="Tenant ID of VIM", required=False, allow_null=True, allow_blank=True)
tenant = serializers.CharField(help_text="Default Tenant of VIM", required=False, allow_null=True, allow_blank=True)
vendor = serializers.CharField(help_text="Vendor of VIM", required=False, allow_null=True, allow_blank=True)
version = serializers.CharField(help_text="Version of VIM", required=False, allow_null=True, allow_blank=True)
description = serializers.CharField(help_text="Description of VIM", required=False, allow_null=True, allow_blank=True)
domain = serializers.CharField(help_text="Domain of VIM", required=False, allow_null=True, allow_blank=True)
type = serializers.CharField(help_text="Type of VIM", required=True)
createTime = serializers.CharField(help_text="Create Time of VIM", required=False, allow_null=True, allow_blank=True)
sslCacert = serializers.CharField(help_text="SSL Cacert of VIM", required=False, allow_null=True, allow_blank=True)
sslInsecure = serializers.CharField(help_text="SSL Insecure of VIM", required=False, allow_null=True, allow_blank=True)
status = serializers.CharField(help_text="Status of VIM", required=False, allow_null=True, allow_blank=True)
class CandidateSerializer(serializers.Serializer):
identifierType = serializers.ChoiceField(
help_text="The type of a candidate",
choices=["serviceInstanceId", "vnfName", "cloudRegionId", "vimId"],
required=True
)
identifiers = serializers.ListField(
help_text="A list of identifiers",
child=serializers.CharField(help_text="One identifier", required=True),
required=True
)
cloudOwner = serializers.CharField(
help_text="The name of a cloud owner. Only required if identifier Type is cloudRegionId", required=False, allow_null=True, allow_blank=True)
class LicenseSolutionSerializer(serializers.Serializer):
resourceModuleName = serializers.CharField(help_text="Name of Resource as defined in the Service Model",
required=True)
serviceResourceId = serializers.CharField(help_text="Resource Id defined in the Service Model", required=True)
entitlementPoolUUID = serializers.ListField(
help_text="A list of entitlementPoolUUIDs",
child=serializers.CharField(help_text="entitlementPoolUUID", required=True),
required=True
)
licenseKeyGroupUUID = serializers.ListField(
help_text="A list of licenseKeyGroupUUID",
child=serializers.CharField(help_text="licenseKeyGroupUUID", required=True),
required=True
)
entitlementPoolInvariantUUID = serializers.ListField(
help_text="A list of entitlementPoolInvariantUUIDs",
child=serializers.CharField(help_text="entitlementPoolInvariantUUID", required=True),
required=True
)
licenseKeyGroupInvariantUUID = serializers.ListField(
help_text="A list of licenseKeyGroupInvariantUUID",
child=serializers.CharField(help_text="licenseKeyGroupInvariantUUID", required=True),
required=True
)
class AssignmentInfoSerializer(serializers.Serializer):
key = serializers.CharField(help_text="Any attribute Key needed", required=True)
value = serializers.JSONField(help_text="Attribute value for that key", required=True)
class PlacementSolutionSerializer(serializers.Serializer):
resourceModuleName = serializers.CharField(help_text="Name of Resource as defined in the Service Model",
required=True)
serviceResourceId = serializers.CharField(help_text="Resource Id defined in the Service Model", required=True)
solution = CandidateSerializer(help_text="The Placement Solution", required=True)
assignmentInfo = AssignmentInfoSerializer(help_text="Additonal information related to a candidate",
required=False, many=True)
class ComprehensiveSolutionSerializer(serializers.ListSerializer):
child = PlacementSolutionSerializer(help_text="A list of placement solutions",
allow_null=True,
required=True)
class SolutionSerializer(serializers.Serializer):
placementSolutions = ComprehensiveSolutionSerializer(help_text="A list of Placement Solutions",
required=True,
allow_empty=True,
many=True)
licenseSolutions = LicenseSolutionSerializer(help_text="A list of License Solutions",
required=True, many=True)
class PlaceVnfReqSerializer(serializers.Serializer):
requestId = serializers.CharField(help_text="ID of Homing Request", required=True)
transactionId = serializers.CharField(help_text="ID of Homing Transaction", required=True, allow_null=False, allow_blank=True)
statusMessage = serializers.CharField(help_text="Status Message of Request", required=False, allow_null=True, allow_blank=True)
requestStatus = serializers.ChoiceField(
help_text="The Status of a Request",
choices=["completed", "failed", "pending"],
required=True,
allow_null=False
)
solutions = SolutionSerializer(help_text="Request Solutions", required=True, allow_null=False)
|