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
|
# Copyright 2017 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
from catalog.pub.utils.toscaparser.nsdmodel import EtsiNsdInfoModel
from catalog.pub.utils.toscaparser.vnfdmodel import EtsiVnfdInfoModel
class JobResponseSerializer(serializers.Serializer):
progress = serializers.CharField(help_text="progress", required=False)
desc = serializers.CharField(help_text="desc", required=False)
errcode = serializers.CharField(help_text="errcode", required=False)
class JobResponseHistoryListSerializer(serializers.Serializer):
status = serializers.CharField(help_text="status", required=False)
progress = serializers.CharField(help_text="progress", required=False)
statusDescription = serializers.CharField(
help_text="statusDescription", required=False)
errorCode = serializers.CharField(help_text="errcode", required=False)
responseId = serializers.CharField(help_text="responseId", required=False)
class JobResponseDescriptorSerializer(serializers.Serializer):
status = serializers.CharField(help_text="status", required=False)
progress = serializers.CharField(help_text="progress", required=False)
statusDescription = serializers.CharField(
help_text="statusDescription", required=False)
errorCode = serializers.CharField(help_text="errcode", required=False)
responseId = serializers.CharField(help_text="responseId", required=False)
responseHistoryList = JobResponseHistoryListSerializer(
many=True, help_text="responseHistoryList", required=False)
class JobRequestSerializer(serializers.Serializer):
jobId = serializers.CharField(
help_text="this field is generated from a query_serializer",
required=False)
responseDescriptor = JobResponseDescriptorSerializer(
help_text="this one too!", required=False)
class PostJobResponseResultSerializer(serializers.Serializer):
result = serializers.CharField(help_text="result", required=True)
msg = serializers.CharField(help_text="msg", required=False)
class NsPackageDistributeRequestSerializer(serializers.Serializer):
csarId = serializers.CharField(help_text="csarId", required=True)
class NsPackageInfoSerializer(serializers.Serializer):
nsdId = serializers.CharField(help_text="csarId", required=True)
nsPackageId = serializers.CharField(help_text="csarId", required=True)
nsdProvider = serializers.CharField(help_text="csarId", required=True)
nsdVersion = serializers.CharField(help_text="csarId", required=True)
csarName = serializers.CharField(help_text="csarId", required=True)
nsdModel = serializers.CharField(help_text="csarId", required=True)
downloadUrl = serializers.CharField(help_text="csarId", required=True)
class NsPackageSerializer(serializers.Serializer):
csarId = serializers.CharField(help_text="csarId", required=True)
package_info = NsPackageInfoSerializer(
help_text="package_info", required=True)
class NsPackagesSerializer(serializers.ListSerializer):
child = NsPackageSerializer(many=True)
class NfPackageDistributeRequestSerializer(serializers.Serializer):
csar_id = serializers.CharField(help_text="csarId", required=True)
vim_ids = serializers.ListField(
help_text="vim_ids",
child=serializers.CharField(),
required=False)
lab_vim_id = serializers.CharField(help_text="lab_vim_id", required=False)
class NfPackageInfoSerializer(serializers.Serializer):
vnfdId = serializers.CharField(required=True)
vnfPackageId = serializers.CharField(required=True)
vnfdProvider = serializers.CharField(required=True)
vnfdVersion = serializers.CharField(required=True)
vnfVersion = serializers.CharField(required=True)
csarName = serializers.CharField(required=True)
vnfdModel = serializers.CharField(required=True)
downloadUrl = serializers.CharField(required=True)
class NfImageInfoSerializer(serializers.Serializer):
index = serializers.CharField(required=True)
fileName = serializers.CharField(required=True)
imageId = serializers.CharField(required=True)
vimId = serializers.CharField(required=True)
vimUser = serializers.CharField(required=True)
tenant = serializers.CharField(required=True)
status = serializers.CharField(required=True)
class NfPackageSerializer(serializers.Serializer):
csarId = serializers.CharField(help_text="csarId", required=True)
packageInfo = NfPackageInfoSerializer(
help_text="packageInfo", required=True)
imageInfo = NfImageInfoSerializer(help_text="imageInfo", required=False)
class NfPackagesSerializer(serializers.ListSerializer):
child = NfPackageSerializer(many=True)
class PostJobResponseSerializer(serializers.Serializer):
jobId = serializers.CharField(help_text="jobId", required=True)
class ParseModelRequestSerializer(serializers.Serializer):
csarId = serializers.CharField(help_text="csarId", required=True)
inputs = serializers.JSONField(help_text="inputs", required=False)
class EtsiNsdInfoModelSerializer(serializers.ModelSerializer):
class Meta:
model = EtsiNsdInfoModel
class EtsiVnfdInfoModelSerializer(serializers.ModelSerializer):
class Meta:
model = EtsiVnfdInfoModel
class ParseNSPackageResponseSerializer(serializers.Serializer):
model = EtsiNsdInfoModelSerializer(help_text="model", required=True)
class ParseNfPackageResponseSerializer(serializers.Serializer):
model = EtsiVnfdInfoModelSerializer(help_text="model", required=True)
|