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
|
# 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 CreateVnfReqSerializer(serializers.Serializer):
vnfdId = serializers.CharField(help_text="vnfd Id", required=True)
vnfInstanceName = serializers.CharField(help_text="vnf Instance Name", required=True)
vnfInstanceDescription = serializers.CharField(help_text="vnf Instance Description", required=False, allow_null=True)
class CreateVnfRespSerializer(serializers.Serializer):
vnfInstanceId = serializers.CharField(help_text="vnf Instance Id", required=True)
class virtualStorageResourceInfoSerializer(serializers.Serializer):
pass
class virtualLinkResourceInfoSerializer(serializers.Serializer):
pass
class vnfcResourceInfoSerializer(serializers.Serializer):
pass
class vimInfoSerializer(serializers.Serializer):
pass
class monitoringParametersSerializer(serializers.Serializer):
pass
class ExtVirtualLinkInfoSerializer(serializers.Serializer):
pass
class l3AddressDataSerializer(serializers.Serializer):
iPAddressType = serializers.ChoiceField(help_text="iPAddressType", choices=['IPv4', 'IPv6'], required=True)
iPAddress = serializers.CharField(help_text="iPAddress", required=True)
class NetworkAddressSerializer(serializers.Serializer):
addressType = serializers.ChoiceField(help_text="addressType", choices=['MAC', 'IP'], required=True)
l2AddressData = serializers.CharField(help_text="l2AddressData", required=False)
l3AddressData = l3AddressDataSerializer(help_text="addresses", required=False)
class extCpInfoSerializer(serializers.Serializer):
cpInstanceId = serializers.CharField(help_text="cpInstanceId", required=True)
cpdId = serializers.IntegerField(help_text="cpdId", required=True)
addresses = NetworkAddressSerializer(help_text="addresses", many=True, allow_null=True)
class ScaleInfoSerializer(serializers.Serializer):
aspectId = serializers.CharField(help_text="aspectId", required=True)
scaleLevel = serializers.IntegerField(help_text="scaleLevel", required=True)
class instantiatedVnfInfoSerializer(serializers.Serializer):
flavourId = serializers.CharField(help_text="flavour Id", required=True)
vnfState = serializers.ChoiceField(help_text="vnf State", choices=['STARTED', 'STOPPED'], required=True)
scaleStatus = ScaleInfoSerializer(help_text="scaleStatus", many=True)
extCpInfo = extCpInfoSerializer(help_text="extCpInfo", many=True)
extVirtualLink = ExtVirtualLinkInfoSerializer(help_text="extVirtualLink", many=True)
monitoringParameters = monitoringParametersSerializer(help_text="monitoringParameters", many=True, allow_null=True)
vimInfo = vimInfoSerializer(help_text="vimInfo", many=True)
vnfcResourceInfo = vnfcResourceInfoSerializer(help_text="vnfcResourceInfo", many=True)
virtualLinkResourceInfo = virtualLinkResourceInfoSerializer(help_text="virtualLinkResourceInfo", many=True)
virtualStorageResourceInfo = virtualStorageResourceInfoSerializer(help_text="virtualStorageResourceInfo", many=True)
pass
class VnfsInfoSerializer(serializers.ListSerializer):
vnfInstanceId = serializers.CharField(help_text="vnf Instance Id", required=True)
vnfInstanceName = serializers.CharField(help_text="vnf Instance Name", required=True)
onboardedVnfPkgInfoId = serializers.CharField(help_text="onboarded Vnf Pkg Info Id", required=False,
allow_null=True)
vnfdVersion = serializers.CharField(help_text="vnfd Version", required=False, allow_null=True)
vnfProvider = serializers.CharField(help_text="vnf Provider", required=False, allow_null=True)
instantiatedVnfInfo = instantiatedVnfInfoSerializer(help_text="instantiatedVnfInfo", required=True)
|