Add nslcm admin db management
[vfc/nfvo/lcm.git] / lcm / pub / database / admin.py
1 # Copyright 2019 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
15 from django.contrib import admin
16
17 from lcm.pub.database.models import NSDModel
18 from lcm.pub.database.models import NSInstModel
19 from lcm.pub.database.models import NfPackageModel
20 from lcm.pub.database.models import VnfPackageFileModel
21 from lcm.pub.database.models import FPInstModel
22 from lcm.pub.database.models import VNFFGInstModel
23 from lcm.pub.database.models import NfInstModel
24 from lcm.pub.database.models import VmInstModel
25 from lcm.pub.database.models import VNFCInstModel
26 from lcm.pub.database.models import CPInstModel
27 from lcm.pub.database.models import VLInstModel
28 from lcm.pub.database.models import PortInstModel
29 from lcm.pub.database.models import JobModel
30 from lcm.pub.database.models import JobStatusModel
31 from lcm.pub.database.models import DefPkgMappingModel
32 from lcm.pub.database.models import InputParamMappingModel
33 from lcm.pub.database.models import ServiceBaseInfoModel
34 from lcm.pub.database.models import WFPlanModel
35 from lcm.pub.database.models import OOFDataModel
36 from lcm.pub.database.models import SubscriptionModel
37 from lcm.pub.database.models import NSLcmOpOccModel
38 from lcm.pub.database.models import PNFInstModel
39
40
41 @admin.register(NSDModel)
42 class NSDModelAdmin(admin.ModelAdmin):
43     list_display_links = ('id', 'name')
44     fields = [
45         "id",
46         "nsd_id",
47         "name",
48         "vendor",
49         "description",
50         "version",
51         "nsd_model",
52         "nsd_path"
53     ]
54
55     list_display = [
56         "id",
57         "nsd_id",
58         "name",
59         "vendor",
60         "description",
61         "version",
62         "nsd_model",
63         "nsd_path"
64     ]
65
66     search_fields = (
67         "id",
68         "nsd_id",
69         "name"
70     )
71
72
73 @admin.register(NSInstModel)
74 class NSInstModelAdmin(admin.ModelAdmin):
75     list_display_links = ('id', 'name')
76     fields = [
77         "id",
78         "name",
79         "nspackage_id",
80         "nsd_id",
81         "nsd_invariant_id",
82         "description",
83         "sdncontroller_id",
84         "flavour_id",
85         "ns_level",
86         "status",
87         "nsd_model",
88         "input_params",
89         "scale_params",
90         "create_time",
91         "lastuptime",
92         "global_customer_id",
93         "service_type"
94     ]
95
96     list_display = [
97         "id",
98         "name",
99         "nspackage_id",
100         "nsd_id",
101         "nsd_invariant_id",
102         "description",
103         "sdncontroller_id",
104         "flavour_id",
105         "ns_level",
106         "status",
107         "nsd_model",
108         "input_params",
109         "scale_params",
110         "create_time",
111         "lastuptime",
112         "global_customer_id",
113         "service_type"
114     ]
115
116     search_fields = (
117         "id",
118         "name",
119         "nsd_id"
120     )
121
122
123 @admin.register(NfInstModel)
124 class NfInstModelAdmin(admin.ModelAdmin):
125     list_display_links = ('nfinstid', 'nf_name')
126     fields = [
127         "nfinstid",
128         "mnfinstid",
129         "nf_name",
130         "template_id",
131         "vnf_id",
132         "package_id",
133         "vnfm_inst_id",
134         "ns_inst_id",
135         "status",
136         "flavour_id",
137         "vnf_level",
138         "location",
139         "max_vm",
140         "max_cpu",
141         "max_ram",
142         "max_hd",
143         "max_shd",
144         "max_net",
145         "version",
146         "vendor",
147         "vnfd_model",
148         "input_params",
149         "scale_params",
150         "create_time",
151         "lastuptime",
152         "extension"
153     ]
154
155     list_display = [
156         "nfinstid",
157         "mnfinstid",
158         "nf_name",
159         "template_id",
160         "vnf_id",
161         "package_id",
162         "vnfm_inst_id",
163         "ns_inst_id",
164         "status",
165         "flavour_id",
166         "vnf_level",
167         "location",
168         "max_vm",
169         "max_cpu",
170         "max_ram",
171         "max_hd",
172         "max_shd",
173         "max_net",
174         "version",
175         "vendor",
176         "vnfd_model",
177         "input_params",
178         "scale_params",
179         "create_time",
180         "lastuptime",
181         "extension"
182     ]
183
184     search_fields = (
185         "nfinstid",
186         "nf_name",
187         "ns_inst_id"
188     )
189
190
191 @admin.register(VmInstModel)
192 class VmInstModelAdmin(admin.ModelAdmin):
193     list_display_links = ('vmid', 'resouceid')
194     fields = [
195         "vmid",
196         "vimid",
197         "resouceid",
198         "insttype",
199         "instid",
200         "vmname",
201         "operationalstate",
202         "zoneid",
203         "tenant",
204         "hostid",
205         "detailinfo"
206     ]
207
208     list_display = [
209         "vmid",
210         "vimid",
211         "resouceid",
212         "insttype",
213         "instid",
214         "vmname",
215         "operationalstate",
216         "zoneid",
217         "tenant",
218         "hostid",
219         "detailinfo"
220     ]
221
222     search_fields = (
223         "vmid",
224         "vimid",
225         "resouceid"
226     )
227
228
229 @admin.register(VNFCInstModel)
230 class VNFCInstModelAdmin(admin.ModelAdmin):
231     list_display_links = ('vnfcinstanceid', 'vduid')
232     fields = [
233         "vnfcinstanceid",
234         "vduid",
235         "nfinstid",
236         "vmid",
237         "status"
238     ]
239
240     list_display = [
241         "vnfcinstanceid",
242         "vduid",
243         "nfinstid",
244         "vmid",
245         "status"
246     ]
247
248     search_fields = (
249         "vnfcinstanceid",
250         "vduid",
251         "nfinstid"
252     )
253
254
255 @admin.register(VLInstModel)
256 class VLInstModelAdmin(admin.ModelAdmin):
257     list_display_links = ('vlinstanceid', 'vldid')
258     fields = [
259         "vlinstanceid",
260         "vldid",
261         "vlinstancename",
262         "ownertype",
263         "ownerid",
264         "relatednetworkid",
265         "relatedsubnetworkid",
266         "vltype",
267         "vimid",
268         "tenant",
269         "status",
270     ]
271
272     list_display = [
273         "vlinstanceid",
274         "vldid",
275         "vlinstancename",
276         "ownertype",
277         "ownerid",
278         "relatednetworkid",
279         "relatedsubnetworkid",
280         "vltype",
281         "vimid",
282         "tenant",
283         "status",
284     ]
285
286     search_fields = (
287         "vlinstanceid",
288         "vldid",
289         "vlinstancename"
290     )
291
292
293 @admin.register(OOFDataModel)
294 class OOFDataModelAdmin(admin.ModelAdmin):
295     list_display_links = ('request_id', 'transaction_id')
296     fields = [
297         "request_id",
298         "transaction_id",
299         "request_status",
300         "request_module_name",
301         "service_resource_id",
302         "vim_id",
303         "cloud_owner",
304         "cloud_region_id",
305         "vdu_info"
306     ]
307
308     list_display = [
309         "request_id",
310         "transaction_id",
311         "request_status",
312         "request_module_name",
313         "service_resource_id",
314         "vim_id",
315         "cloud_owner",
316         "cloud_region_id",
317         "vdu_info"
318     ]
319
320     search_fields = (
321         "request_id",
322         "transaction_id"
323     )
324
325
326 admin.site.register(NfPackageModel)
327 admin.site.register(VnfPackageFileModel)
328 admin.site.register(FPInstModel)
329 admin.site.register(CPInstModel)
330 admin.site.register(VNFFGInstModel)
331 admin.site.register(PortInstModel)
332 admin.site.register(JobModel)
333 admin.site.register(JobStatusModel)
334 admin.site.register(DefPkgMappingModel)
335 admin.site.register(InputParamMappingModel)
336 admin.site.register(ServiceBaseInfoModel)
337 admin.site.register(WFPlanModel)
338 admin.site.register(SubscriptionModel)
339 admin.site.register(NSLcmOpOccModel)
340 admin.site.register(PNFInstModel)