update link to upper-constraints.txt
[vfc/nfvo/lcm.git] / lcm / pub / database / models.py
1 # Copyright 2016 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 from django.db import models
15
16
17 class NSDModel(models.Model):
18     class Meta:
19         db_table = 'NFVO_NSPACKAGE'
20
21     id = models.CharField(db_column='ID', primary_key=True, max_length=200)
22     nsd_id = models.CharField(db_column='NSDID', max_length=200)
23     name = models.CharField(db_column='NAME', max_length=200)
24     vendor = models.CharField(db_column='VENDOR', max_length=200, null=True, blank=True)
25     description = models.CharField(db_column='DESCRIPTION', max_length=200, null=True, blank=True)
26     version = models.CharField(db_column='VERSION', max_length=200, null=True, blank=True)
27     nsd_model = models.TextField(db_column='NSDMODEL', max_length=65535, null=True, blank=True)
28     nsd_path = models.CharField(db_column='NSDPATH', max_length=300, null=True, blank=True)
29
30
31 class NSInstModel(models.Model):
32     class Meta:
33         db_table = 'NFVO_NSINST'
34
35     id = models.CharField(db_column='ID', primary_key=True, max_length=200)
36     name = models.CharField(db_column='NAME', max_length=200)
37     nspackage_id = models.CharField(db_column='NSPACKAGEID', max_length=200, null=True, blank=True)
38     nsd_id = models.CharField(db_column='NSDID', max_length=200)
39     nsd_invariant_id = models.CharField(db_column='NSDINVARIANTID', max_length=200)
40     description = models.CharField(db_column='DESCRIPTION', max_length=255, null=True, blank=True)
41     sdncontroller_id = models.CharField(db_column='SDNCONTROLLERID', max_length=200, null=True, blank=True)
42     flavour_id = models.CharField(db_column='FLAVOURID', max_length=200, null=True, blank=True)
43     ns_level = models.CharField(db_column='NSLEVEL', max_length=200, null=True, blank=True)
44     status = models.CharField(db_column='STATUS', max_length=200, null=True, blank=True)
45     nsd_model = models.TextField(db_column='NSDMODEL', max_length=20000, null=True, blank=True)
46     input_params = models.TextField(db_column='INPUTPARAMS', max_length=2000, null=True, blank=True)
47     scale_params = models.TextField(db_column='SCALEPARAMS', max_length=2000, null=True, blank=True)
48     create_time = models.CharField(db_column='CREATETIME', max_length=200, null=True, blank=True)
49     lastuptime = models.CharField(db_column='LASTUPTIME', max_length=200, null=True, blank=True)
50     global_customer_id = models.CharField(db_column='GLOBALCUSTOMERID', max_length=50, null=True, blank=True)
51     service_type = models.CharField(db_column='SERVICETYPE', max_length=50, null=True, blank=True)
52
53
54 class NfPackageModel(models.Model):
55     uuid = models.CharField(db_column='UUID', primary_key=True, max_length=255)
56     nfpackageid = models.CharField(db_column='NFPACKAGEID', max_length=200)
57     vnfdid = models.CharField(db_column='VNFDID', max_length=255)
58     vendor = models.CharField(db_column='VENDOR', max_length=255)
59     vnfdversion = models.CharField(db_column='VNFDVERSION', max_length=255)
60     vnfversion = models.CharField(db_column='VNFVERSION', max_length=255)
61     vnfdmodel = models.TextField(db_column='VNFDMODEL', max_length=65535, blank=True, null=True)
62     vnfd_path = models.CharField(db_column='VNFDPATH', max_length=300, null=True, blank=True)
63
64     class Meta:
65         db_table = 'NFVO_NFPACKAGE'
66
67
68 class VnfPackageFileModel(models.Model):
69     id = models.AutoField(db_column='ID', primary_key=True)
70     vnfpid = models.CharField(db_column='NFPACKAGEID', max_length=50)
71     filename = models.CharField(db_column='FILENAME', max_length=100)
72     filetype = models.CharField(db_column='FILETYPE', max_length=2)
73     imageid = models.CharField(db_column='IMAGEID', max_length=50)
74     vimid = models.CharField(db_column='VIMID', max_length=50)
75     vimuser = models.CharField(db_column='VIMUSER', max_length=50)
76     tenant = models.CharField(db_column='TENANT', max_length=50)
77     purpose = models.CharField(db_column='PURPOSE', max_length=1000)
78     status = models.CharField(db_column='STATUS', max_length=10)
79
80     class Meta:
81         db_table = 'NFVO_NFPACKAGEFILE'
82
83
84 class FPInstModel(models.Model):
85     class Meta:
86         db_table = 'NFVO_FPINST'
87
88     fpid = models.CharField(db_column='FPID', max_length=255)
89     fpinstid = models.CharField(db_column='FPINSTID', max_length=255, primary_key=True)
90     fpname = models.CharField(db_column='FPNAME', max_length=255)
91     nsinstid = models.CharField(db_column='NSINSTID', max_length=255)
92     vnffginstid = models.CharField(db_column='VNFFGINSTID', max_length=255)
93     symmetric = models.IntegerField(db_column='SYMMETRIC', null=True)
94     policyinfo = models.TextField(db_column='POLICYINFO', max_length=65535)
95     forworderpaths = models.CharField(db_column='FORWORDERPATHS', max_length=255, null=True, blank=True)
96     status = models.CharField(db_column='STATUS', max_length=255)
97     sdncontrollerid = models.CharField(db_column='SDNCONTROLLERID', max_length=255)
98     sfcid = models.CharField(db_column='SFCID', max_length=255)
99     flowclassifiers = models.CharField(db_column='FLOWCLASSIFIERS', max_length=255)
100     portpairgroups = models.TextField(db_column='PORTPAIRGROUPS', max_length=65535)
101
102
103 class VNFFGInstModel(models.Model):
104     class Meta:
105         db_table = 'NFVO_VNFFGINST'
106
107     vnffgdid = models.CharField(db_column='VNFFGDID', max_length=255)
108     vnffginstid = models.CharField(db_column='VNFFGINSTID', max_length=255, primary_key=True)
109     nsinstid = models.CharField(db_column='NSINSTID', max_length=255)
110     desc = models.CharField(db_column='DESC', max_length=255, blank=True, null=True)
111     vendor = models.CharField(db_column='VENDOR', max_length=255, blank=True, null=True)
112     version = models.CharField(db_column='VERSION', max_length=255, blank=True, null=True)
113     endpointnumber = models.IntegerField(db_column='ENDPOINTNUMBER')
114     vllist = models.CharField(db_column='VLLIST', max_length=1024)
115     cplist = models.CharField(db_column='CPLIST', max_length=1024)
116     vnflist = models.CharField(db_column='VNFLIST', max_length=1024)
117     fplist = models.CharField(db_column='FPLIST', max_length=1024)
118     status = models.CharField(db_column='STATUS', max_length=255)
119
120
121 class NfInstModel(models.Model):
122     class Meta:
123         db_table = 'NFVO_NFINST'
124
125     nfinstid = models.CharField(db_column='NFINSTID', max_length=200, primary_key=True)
126     mnfinstid = models.CharField(db_column='M_NFINSTID', max_length=200, blank=True, null=True)
127     nf_name = models.CharField(db_column='NFNAME', max_length=100, blank=True, null=True)
128     template_id = models.CharField(db_column='TEMPLATEID', max_length=200, blank=True, null=True)
129     vnf_id = models.CharField(db_column='VNFID', max_length=200, blank=True, null=True)
130     package_id = models.CharField(db_column='PACKAGEID', max_length=200, blank=True, null=True)
131     vnfm_inst_id = models.CharField(db_column='VNFMINSTID', max_length=200, blank=True, null=True)
132     ns_inst_id = models.CharField(db_column='NSINSTID', max_length=200, blank=True, null=True)
133     status = models.CharField(db_column='STATUS', max_length=20, blank=True, null=True)
134     flavour_id = models.CharField(db_column='FLAVOURID', max_length=200, blank=True, null=True)
135     vnf_level = models.CharField(db_column='VNFLEVEL', max_length=200, blank=True, null=True)
136     location = models.CharField(db_column='LOCATION', max_length=200, blank=True, null=True)
137     max_vm = models.IntegerField(db_column='MAXVM', null=True)
138     max_cpu = models.IntegerField(db_column='MAXCPU', null=True)
139     max_ram = models.IntegerField(db_column='MAXRAM', null=True)
140     max_hd = models.IntegerField(db_column='MAXHD', null=True)
141     max_shd = models.IntegerField(db_column='MAXSHD', null=True)
142     max_net = models.IntegerField(db_column='MAXNET', null=True)
143     version = models.CharField(db_column='VERSION', max_length=255, null=True)
144     vendor = models.CharField(db_column='VENDOR', max_length=255, null=True, blank=True)
145     vnfd_model = models.TextField(db_column='VNFDMODEL', max_length=20000, blank=True, null=True)
146     input_params = models.TextField(db_column='INPUTPARAMS', max_length=2000, blank=True, null=True)
147     scale_params = models.TextField(db_column='SCALEPARAMS', max_length=2000, null=True, blank=True)
148     create_time = models.CharField(db_column='CREATETIME', max_length=200, null=True, blank=True)
149     lastuptime = models.CharField(db_column='LASTUPTIME', max_length=200, blank=True, null=True)
150     extension = models.TextField(db_column='EXTENSION', max_length=65535, blank=True, null=True)
151
152
153 class VmInstModel(models.Model):
154     class Meta:
155         db_table = 'NFVO_VMINST'
156
157     vmid = models.CharField(db_column='VMID', primary_key=True, max_length=255)
158     vimid = models.CharField(db_column='VIMID', max_length=255)
159     resouceid = models.CharField(db_column='RESOURCEID', max_length=255)
160     insttype = models.IntegerField(db_column='INSTTYPE', null=True)
161     instid = models.CharField(db_column='INSTID', max_length=255, null=True)
162     vmname = models.CharField(db_column='VMNAME', max_length=255)
163     operationalstate = models.IntegerField(db_column='OPERATIONALSTATE', default=1)
164     zoneid = models.CharField(db_column='ZONEID', max_length=255, null=True)
165     tenant = models.CharField(db_column='TENANT', max_length=255, null=True)
166     hostid = models.CharField(db_column='HOSTID', max_length=255)
167     detailinfo = models.CharField(db_column='DETAILINFO', max_length=255, null=True)
168
169
170 class VNFCInstModel(models.Model):
171     class Meta:
172         db_table = 'NFVO_VNFCINST'
173
174     vnfcinstanceid = models.CharField(db_column='VNFCINSTANCEID', max_length=255, primary_key=True)
175     vduid = models.CharField(db_column='VDUID', max_length=255)
176     nfinstid = models.CharField(db_column='NFINSTID', max_length=255)
177     vmid = models.CharField(db_column='VMID', max_length=255)
178     status = models.CharField(db_column='STATUS', max_length=255)
179
180
181 class CPInstModel(models.Model):
182     class Meta:
183         db_table = 'NFVO_CPINST'
184
185     cpinstanceid = models.CharField(db_column='CPINSTANCEID', max_length=255, primary_key=True)
186     cpdid = models.CharField(db_column='CPDID', max_length=255)
187     cpinstancename = models.CharField(db_column='CPINSTANCENAME', max_length=255)
188     ownertype = models.IntegerField(db_column='OWNERTYPE')
189     ownerid = models.CharField(db_column='OWNERID', max_length=255)
190     relatedtype = models.IntegerField(db_column='RELATEDTYPE')
191     relatedvl = models.CharField(db_column='RELATEDVL', max_length=255, blank=True, null=True)
192     relatedcp = models.CharField(db_column='RELATEDCP', max_length=255, blank=True, null=True)
193     relatedport = models.CharField(db_column='RELATEDPORT', max_length=255, blank=True, null=True)
194     status = models.CharField(db_column='STATUS', max_length=255)
195
196
197 class VLInstModel(models.Model):
198     class Meta:
199         db_table = 'NFVO_VLINST'
200
201     vlinstanceid = models.CharField(db_column='VLINSTANCEID', max_length=255, primary_key=True)
202     vldid = models.CharField(db_column='VLDID', max_length=255)
203     vlinstancename = models.CharField(db_column='VLINSTANCENAME', max_length=255, blank=True, null=True)
204     ownertype = models.IntegerField(db_column='OWNERTYPE')
205     ownerid = models.CharField(db_column='OWNERID', max_length=255)
206     relatednetworkid = models.CharField(db_column='RELATEDNETWORKID', max_length=255, blank=True, null=True)
207     relatedsubnetworkid = models.CharField(db_column='RELATEDSUBNETWORKID', max_length=255, blank=True,
208                                            null=True)
209     vltype = models.IntegerField(db_column='VLTYPE', default=0)
210     vimid = models.CharField(db_column='VIMID', max_length=255)
211     tenant = models.CharField(db_column='TENANT', max_length=255)
212     status = models.CharField(db_column='STATUS', max_length=255)
213
214
215 class PortInstModel(models.Model):
216     class Meta:
217         db_table = 'NFVO_PORTINST'
218
219     portid = models.CharField(db_column='PORTID', max_length=255, primary_key=True)
220     networkid = models.CharField(db_column='NETWORKID', max_length=255)
221     subnetworkid = models.CharField(db_column='SUBNETWORKID', max_length=255)
222     vimid = models.CharField(db_column='VIMID', max_length=255)
223     resourceid = models.CharField(db_column='RESOURCEID', max_length=255)
224     name = models.CharField(db_column='NAME', max_length=255)
225     instid = models.CharField(db_column='INSTID', max_length=255)
226     cpinstanceid = models.CharField(db_column='CPINSTANCEID', max_length=255)
227     bandwidth = models.CharField(db_column='BANDWIDTH', max_length=255)
228     operationalstate = models.CharField(db_column='OPERATIONALSTATE', max_length=255)
229     ipaddress = models.CharField(db_column='IPADDRESS', max_length=255)
230     macaddress = models.CharField(db_column='MACADDRESS', max_length=255)
231     floatipaddress = models.CharField(db_column='FLOATIPADDRESS', max_length=255)
232     serviceipaddress = models.CharField(db_column='SERVICEIPADDRESS', max_length=255)
233     typevirtualnic = models.CharField(db_column='TYPEVIRTUALNIC', max_length=255)
234     sfcencapsulation = models.CharField(db_column='SFCENCAPSULATION', max_length=255)
235     direction = models.CharField(db_column='DIRECTION', max_length=255)
236     tenant = models.CharField(db_column='TENANT', max_length=255)
237
238
239 class JobModel(models.Model):
240     class Meta:
241         db_table = 'NFVO_JOB'
242
243     jobid = models.CharField(db_column='JOBID', primary_key=True, max_length=255)
244     jobtype = models.CharField(db_column='JOBTYPE', max_length=255)
245     jobaction = models.CharField(db_column='JOBACTION', max_length=255)
246     resid = models.CharField(db_column='RESID', max_length=255)
247     status = models.IntegerField(db_column='STATUS', null=True, blank=True)
248     starttime = models.CharField(db_column='STARTTIME', max_length=255, null=True, blank=True)
249     endtime = models.CharField(db_column='ENDTIME', max_length=255, null=True, blank=True)
250     progress = models.IntegerField(db_column='PROGRESS', null=True, blank=True)
251     user = models.CharField(db_column='USER', max_length=255, null=True, blank=True)
252     parentjobid = models.CharField(db_column='PARENTJOBID', max_length=255, null=True, blank=True)
253     resname = models.CharField(db_column='RESNAME', max_length=255, null=True, blank=True)
254
255     def toJSON(self):
256         import json
257         return json.dumps(dict([(attr, getattr(self, attr)) for attr in [f.name for f in self._meta.fields]]))
258
259
260 class JobStatusModel(models.Model):
261     class Meta:
262         db_table = 'NFVO_JOB_STATUS'
263
264     indexid = models.IntegerField(db_column='INDEXID')
265     jobid = models.CharField(db_column='JOBID', max_length=255)
266     status = models.CharField(db_column='STATUS', max_length=255)
267     progress = models.IntegerField(db_column='PROGRESS', null=True, blank=True)
268     descp = models.TextField(db_column='DESCP', max_length=65535)
269     errcode = models.CharField(db_column='ERRCODE', max_length=255, null=True, blank=True)
270     addtime = models.CharField(db_column='ADDTIME', max_length=255, null=True, blank=True)
271
272     def toJSON(self):
273         import json
274         return json.dumps(dict([(attr, getattr(self, attr)) for attr in [f.name for f in self._meta.fields]]))
275
276
277 class DefPkgMappingModel(models.Model):
278     class Meta:
279         db_table = 't_lcm_defPackage_mapping'
280
281     service_id = models.CharField(db_column='serviceId', max_length=255, primary_key=True)
282     service_def_id = models.CharField(db_column='serviceDefId', max_length=255)
283     template_id = models.CharField(db_column='templateId', max_length=255)
284     template_name = models.CharField(db_column='templateName', max_length=255)
285
286
287 class InputParamMappingModel(models.Model):
288     class Meta:
289         db_table = 't_lcm_inputParam_mapping'
290
291     service_id = models.CharField(db_column='serviceId', max_length=255)
292     input_key = models.CharField(db_column='inputKey', max_length=255)
293     input_value = models.CharField(db_column='inputValue', max_length=255, null=True, blank=True)
294
295
296 class ServiceBaseInfoModel(models.Model):
297     class Meta:
298         db_table = 't_lcm_servicebaseinfo'
299
300     service_id = models.CharField(db_column='serviceId', max_length=255, primary_key=True)
301     service_name = models.CharField(db_column='serviceName', max_length=255)
302     service_type = models.CharField(db_column='serviceType', max_length=20)
303     description = models.CharField(db_column='description', max_length=255, null=True, blank=True)
304     active_status = models.CharField(db_column='activeStatus', max_length=20)
305     status = models.CharField(db_column='status', max_length=20)
306     creator = models.CharField(db_column='creator', max_length=50)
307     create_time = models.BigIntegerField(db_column='createTime')
308
309
310 class WFPlanModel(models.Model):
311     class Meta:
312         db_table = 'NFVO_WF_PLAN'
313
314     deployed_id = models.CharField(db_column='DEPLOYEDID', max_length=255, primary_key=True)
315     process_id = models.CharField(db_column='PROCESSID', max_length=255)
316     status = models.CharField(db_column='STATUS', max_length=255)
317     message = models.CharField(db_column='MESSAGE', max_length=1024)
318     plan_name = models.CharField(db_column='PLANNAME', max_length=255)
319
320
321 class OOFDataModel(models.Model):
322     class Meta:
323         db_table = 'NFVO_OOF_DATA'
324
325     request_id = models.CharField(db_column='REQUESTID', max_length=255)
326     transaction_id = models.CharField(db_column='TRANSACTIONID', max_length=255)
327     request_status = models.CharField(db_column='REQUESTSTATUS', max_length=50)
328     request_module_name = models.CharField(db_column='RESOURCEMODULENAME', max_length=100)
329     service_resource_id = models.CharField(db_column='SERVICERESOURCEID', max_length=255, primary_key=True)
330     vim_id = models.CharField(db_column='VIMID', max_length=255, null=True, blank=True)
331     cloud_owner = models.CharField(db_column='CLOUDOWNER', max_length=100, null=True, blank=True)
332     cloud_region_id = models.CharField(db_column='CLOUDREGIONID', max_length=255, null=True, blank=True)
333     vdu_info = models.TextField(db_column='VDUINFO', max_length=65535, null=True, blank=True)
334
335
336 class SubscriptionModel(models.Model):
337     class Meta:
338         db_table = 'NFVO_SUBSCRIPTION'
339
340     subscription_id = models.CharField(db_column='SUBSCRIPTIONID', max_length=255, primary_key=True)
341     vnf_instance_filter = models.TextField(db_column='VNFINSTANCEFILTER', null=True)
342     ns_instance_filter = models.TextField(db_column='NSINSTANCEFILTER', null=True)
343     notification_types = models.TextField(db_column='NOTIFICATIONTYPES', null=True)
344     operation_types = models.TextField(db_column='OPERATIONTYPES', null=True)
345     operation_states = models.TextField(db_column='OPERATIONSTATES', null=True)
346     ns_component_types = models.TextField(db_column='NSCOMPONENTTYPES', null=True)
347     lcm_opname_impacting_nscomponent = models.TextField(db_column='LCMOPNAMEIMPACTINGNSCOMPONENT', null=True)
348     lcm_opoccstatus_impacting_nscomponent = models.TextField(db_column='LCMOPOCCSTATUSIMPACTINGNSCOMPONENT', null=True)
349     callback_uri = models.CharField(db_column='CALLBACKURI', max_length=255)
350     links = models.TextField(db_column='LINKS', max_length=20000)
351     auth_info = models.TextField(db_column='AUTHINFO', max_length=20000, blank=True, null=True)
352
353
354 class NSLcmOpOccModel(models.Model):
355     class Meta:
356         db_table = 'NSLCMOPOCCS'
357
358     id = models.CharField(db_column='ID', max_length=255, primary_key=True)
359     operation_state = models.CharField(db_column='OPERATIONSTATE', null=False, max_length=30)
360     state_entered_time = models.CharField(db_column='STATEENTEREDTIME', null=False, max_length=30)
361     start_time = models.CharField(db_column='STARTTIME', null=False, max_length=30)
362     ns_instance_id = models.CharField(db_column='NSINSTANCEID', null=False, max_length=255)
363     operation = models.CharField(db_column='OPERATION', null=False, max_length=30)
364     is_automatic_invocation = models.CharField(db_column='ISAUTOMATICINVOCATION', null=False, max_length=5)
365     operation_params = models.TextField(db_column='OPERATIONPARAMS', null=False)
366     is_cancel_pending = models.CharField(db_column='ISCANCELPENDING', null=False, max_length=5)
367     cancel_mode = models.TextField(db_column='CANCELMODE', null=True)
368     error = models.TextField(db_column='ERROR', null=True)
369     resource_changes = models.TextField(db_column='RESOURCECHANGES', null=True)
370     links = models.TextField(db_column='LINKS', null=False)
371
372
373 class PNFInstModel(models.Model):
374     class Meta:
375         db_table = 'NFVO_PNFINST'
376
377     pnfId = models.CharField(db_column='PNFID', primary_key=True, max_length=255)
378     pnfName = models.CharField(db_column='PNFNAME', max_length=255)
379     pnfdId = models.CharField(db_column='PNFDID', max_length=50)
380     pnfdInfoId = models.CharField(db_column='PNFDINFOID', max_length=100)
381     pnfProfileId = models.CharField(db_column='PNFPROFILEID', max_length=255)
382     cpInfo = models.TextField(db_column='CPINFO', max_length=255, null=True, blank=True)
383     emsId = models.CharField(db_column='EMSID', null=True, max_length=255)
384     nsInstances = models.TextField(db_column='NSINSTANCES', max_length=1000, null=True, blank=True)