Add vnflcm admin db management
[vfc/gvnfm/vnflcm.git] / lcm / 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 NfInstModel
18 from lcm.pub.database.models import NfvoRegInfoModel
19 from lcm.pub.database.models import StorageInstModel
20 from lcm.pub.database.models import VmInstModel
21 from lcm.pub.database.models import VNFCInstModel
22 from lcm.pub.database.models import FlavourInstModel
23 from lcm.pub.database.models import NetworkInstModel
24 from lcm.pub.database.models import SubNetworkInstModel
25 from lcm.pub.database.models import VLInstModel
26 from lcm.pub.database.models import PortInstModel
27 from lcm.pub.database.models import CPInstModel
28 from lcm.pub.database.models import SubscriptionModel
29 from lcm.pub.database.models import VNFLcmOpOccModel
30
31
32 @admin.register(NfInstModel)
33 class NfInstModelAdmin(admin.ModelAdmin):
34     list_display_links = ('nfinstid', 'nf_name')
35     fields = [
36         "nfinstid",
37         "nf_name",
38         "vnfminstid",
39         "package_id",
40         "status",
41         "flavour_id",
42         "location",
43         "version",
44         "vendor",
45         "netype",
46         "vnfd_model",
47         "input_params",
48         "create_time",
49         "lastuptime",
50         "nf_desc",
51         "vnfdid",
52         "vnfSoftwareVersion",
53         "vnfConfigurableProperties",
54         "localizationLanguage",
55         "operationState",
56         "resInfo",
57         "vimInfo"
58     ]
59
60     list_display = [
61         "nfinstid",
62         "nf_name",
63         "vnfminstid",
64         "package_id",
65         "status",
66         "flavour_id",
67         "location",
68         "version",
69         "vendor",
70         "netype",
71         "vnfd_model",
72         "input_params",
73         "create_time",
74         "lastuptime",
75         "nf_desc",
76         "vnfdid",
77         "vnfSoftwareVersion",
78         "vnfConfigurableProperties",
79         "localizationLanguage",
80         "operationState",
81         "resInfo",
82         "vimInfo"
83     ]
84
85     search_fields = (
86         "nfinstid",
87         "nf_name",
88         "vnfminstid",
89         "package_id"
90     )
91
92
93 @admin.register(NfvoRegInfoModel)
94 class NfvoRegInfoModelAdmin(admin.ModelAdmin):
95     list_display_links = ('nfvoid', 'vnfminstid')
96     fields = [
97         "nfvoid",
98         "vnfminstid",
99         "apiurl",
100         "nfvouser",
101         "nfvopassword",
102         "authtype",
103         "clientcert",
104         "servercert",
105         "regtime"
106     ]
107
108     list_display = (
109         "nfvoid",
110         "vnfminstid",
111         "apiurl",
112         "nfvouser",
113         "nfvopassword",
114         "authtype",
115         "clientcert",
116         "servercert",
117         "regtime"
118     )
119
120     search_fields = (
121         "nfvoid",
122         "vnfminstid"
123     )
124
125
126 @admin.register(StorageInstModel)
127 class StorageInstModelAdmin(admin.ModelAdmin):
128     list_display_links = ('storageid', 'vimid')
129     fields = [
130         "storageid",
131         "vimid",
132         "resourceid",
133         "insttype",
134         "instid",
135         "name",
136         "storagetype",
137         "size",
138         "tenant",
139         "is_predefined",
140         "create_time",
141         "nodeId"
142     ]
143
144     list_display = (
145         "storageid",
146         "vimid",
147         "resourceid",
148         "insttype",
149         "instid",
150         "name",
151         "storagetype",
152         "size",
153         "tenant",
154         "is_predefined",
155         "create_time",
156         "nodeId"
157     )
158
159     search_fields = (
160         "storageid",
161         "vimid",
162         "resourceid",
163         "instid"
164     )
165
166
167 @admin.register(VmInstModel)
168 class VmInstModelAdmin(admin.ModelAdmin):
169     list_display_links = ('vmid', 'vimid')
170     fields = [
171         "vmid",
172         "vimid",
173         "tenant",
174         "resourceid",
175         "vmname",
176         "nic_array",
177         "metadata",
178         "volume_array",
179         "server_group",
180         "availability_zone",
181         "flavor_id",
182         "security_groups",
183         "operationalstate",
184         "insttype",
185         "is_predefined",
186         "create_time",
187         "instid",
188         "nodeId"
189     ]
190
191     list_display = [
192         "vmid",
193         "vimid",
194         "tenant",
195         "resourceid",
196         "vmname",
197         "nic_array",
198         "metadata",
199         "volume_array",
200         "server_group",
201         "availability_zone",
202         "flavor_id",
203         "security_groups",
204         "operationalstate",
205         "insttype",
206         "is_predefined",
207         "create_time",
208         "instid",
209         "nodeId"
210     ]
211
212     search_fields = (
213         "vmid",
214         "vimid",
215         "tenant",
216         "resourceid",
217         "vmname"
218     )
219
220
221 @admin.register(VNFLcmOpOccModel)
222 class VNFLcmOpOccModelAdmin(admin.ModelAdmin):
223     list_display_links = ('id', 'operation_state')
224     fields = [
225         "id",
226         "operation_state",
227         "state_entered_time",
228         "start_time",
229         "vnf_instance_id",
230         "operation",
231         "error",
232         "sub_operation",
233         "operation_params",
234         "links"
235     ]
236
237     list_display = [
238         "id",
239         "operation_state",
240         "state_entered_time",
241         "start_time",
242         "vnf_instance_id",
243         "operation",
244         "error",
245         "sub_operation",
246         "operation_params",
247         "links"
248     ]
249
250     search_fields = (
251         "id",
252         "vnf_instance_id"
253     )
254
255
256 admin.site.register(VNFCInstModel)
257 admin.site.register(FlavourInstModel)
258 admin.site.register(NetworkInstModel)
259 admin.site.register(SubNetworkInstModel)
260 admin.site.register(VLInstModel)
261 admin.site.register(PortInstModel)
262 admin.site.register(CPInstModel)
263 admin.site.register(SubscriptionModel)