Add two fields to workflow model
[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     description = models.CharField(db_column='DESCRIPTION', max_length=255, null=True, blank=True)
40     sdncontroller_id = models.CharField(db_column='SDNCONTROLLERID', max_length=200, null=True, blank=True)
41     flavour_id = models.CharField(db_column='FLAVOURID', max_length=200, null=True, blank=True)
42     ns_level = models.CharField(db_column='NSLEVEL', max_length=200, null=True, blank=True)
43     status = models.CharField(db_column='STATUS', max_length=200, null=True, blank=True)
44     nsd_model = models.TextField(db_column='NSDMODEL', max_length=20000, null=True, blank=True)
45     input_params = models.TextField(db_column='INPUTPARAMS', max_length=2000, null=True, blank=True)
46     scale_params = models.TextField(db_column='SCALEPARAMS', max_length=2000, null=True, blank=True)
47     create_time = models.CharField(db_column='CREATETIME', max_length=200, null=True, blank=True)
48     lastuptime = models.CharField(db_column='LASTUPTIME', max_length=200, null=True, blank=True)
49
50
51 class NfPackageModel(models.Model):
52     uuid = models.CharField(db_column='UUID', primary_key=True, max_length=255)
53     nfpackageid = models.CharField(db_column='NFPACKAGEID', max_length=200)
54     vnfdid = models.CharField(db_column='VNFDID', max_length=255)
55     vendor = models.CharField(db_column='VENDOR', max_length=255)
56     vnfdversion = models.CharField(db_column='VNFDVERSION', max_length=255)
57     vnfversion = models.CharField(db_column='VNFVERSION', max_length=255)
58     vnfdmodel = models.TextField(db_column='VNFDMODEL', max_length=65535, blank=True, null=True)
59     vnfd_path = models.CharField(db_column='VNFDPATH', max_length=300, null=True, blank=True)
60
61     class Meta:
62         db_table = 'NFVO_NFPACKAGE'
63
64
65 class VnfPackageFileModel(models.Model):
66     id = models.AutoField(db_column='ID', primary_key=True)
67     vnfpid = models.CharField(db_column='NFPACKAGEID', max_length=50)
68     filename = models.CharField(db_column='FILENAME', max_length=100)
69     filetype = models.CharField(db_column='FILETYPE', max_length=2)
70     imageid = models.CharField(db_column='IMAGEID', max_length=50)
71     vimid = models.CharField(db_column='VIMID', max_length=50)
72     vimuser = models.CharField(db_column='VIMUSER', max_length=50)
73     tenant = models.CharField(db_column='TENANT', max_length=50)
74     purpose = models.CharField(db_column='PURPOSE', max_length=1000)
75     status = models.CharField(db_column='STATUS', max_length=10)
76
77     class Meta:
78         db_table = 'NFVO_NFPACKAGEFILE'
79
80
81 class FPInstModel(models.Model):
82     class Meta:
83         db_table = 'NFVO_FPINST'
84
85     fpid = models.CharField(db_column='FPID', max_length=255)
86     fpinstid = models.CharField(db_column='FPINSTID', max_length=255, primary_key=True)
87     fpname = models.CharField(db_column='FPNAME', max_length=255)
88     nsinstid = models.CharField(db_column='NSINSTID', max_length=255)
89     vnffginstid = models.CharField(db_column='VNFFGINSTID', max_length=255)
90     symmetric = models.IntegerField(db_column='SYMMETRIC', null=True)
91     policyinfo = models.TextField(db_column='POLICYINFO', max_length=65535)
92     forworderpaths = models.CharField(db_column='FORWORDERPATHS', max_length=255, null=True, blank=True)
93     status = models.CharField(db_column='STATUS', max_length=255)
94     sdncontrollerid = models.CharField(db_column='SDNCONTROLLERID', max_length=255)
95     sfcid = models.CharField(db_column='SFCID', max_length=255)
96     flowclassifiers = models.CharField(db_column='FLOWCLASSIFIERS', max_length=255)
97     portpairgroups = models.TextField(db_column='PORTPAIRGROUPS', max_length=65535)
98
99
100 class VNFFGInstModel(models.Model):
101     class Meta:
102         db_table = 'NFVO_VNFFGINST'
103
104     vnffgdid = models.CharField(db_column='VNFFGDID', max_length=255)
105     vnffginstid = models.CharField(db_column='VNFFGINSTID', max_length=255, primary_key=True)
106     nsinstid = models.CharField(db_column='NSINSTID', max_length=255)
107     desc = models.CharField(db_column='DESC', max_length=255, blank=True, null=True)
108     vendor = models.CharField(db_column='VENDOR', max_length=255, blank=True, null=True)
109     version = models.CharField(db_column='VERSION', max_length=255, blank=True, null=True)
110     endpointnumber = models.IntegerField(db_column='ENDPOINTNUMBER')
111     vllist = models.CharField(db_column='VLLIST', max_length=1024)
112     cplist = models.CharField(db_column='CPLIST', max_length=1024)
113     vnflist = models.CharField(db_column='VNFLIST', max_length=1024)
114     fplist = models.CharField(db_column='FPLIST', max_length=1024)
115     status = models.CharField(db_column='STATUS', max_length=255)
116
117
118 class NfInstModel(models.Model):
119     class Meta:
120         db_table = 'NFVO_NFINST'
121
122     nfinstid = models.CharField(db_column='NFINSTID', max_length=200, primary_key=True)
123     mnfinstid = models.CharField(db_column='M_NFINSTID', max_length=200, blank=True, null=True)
124     nf_name = models.CharField(db_column='NFNAME', max_length=100, blank=True, null=True)
125     template_id = models.CharField(db_column='TEMPLATEID', max_length=200, blank=True, null=True)
126     vnf_id = models.CharField(db_column='VNFID', max_length=200, blank=True, null=True)
127     package_id = models.CharField(db_column='PACKAGEID', max_length=200, blank=True, null=True)
128     vnfm_inst_id = models.CharField(db_column='VNFMINSTID', max_length=200, blank=True, null=True)
129     ns_inst_id = models.CharField(db_column='NSINSTID', max_length=200, blank=True, null=True)
130     status = models.CharField(db_column='STATUS', max_length=20, blank=True, null=True)
131     flavour_id = models.CharField(db_column='FLAVOURID', max_length=200, blank=True, null=True)
132     vnf_level = models.CharField(db_column='VNFLEVEL', max_length=200, blank=True, null=True)
133     location = models.CharField(db_column='LOCATION', max_length=200, blank=True, null=True)
134     max_vm = models.IntegerField(db_column='MAXVM', null=True)
135     max_cpu = models.IntegerField(db_column='MAXCPU', null=True)
136     max_ram = models.IntegerField(db_column='MAXRAM', null=True)
137     max_hd = models.IntegerField(db_column='MAXHD', null=True)
138     max_shd = models.IntegerField(db_column='MAXSHD', null=True)
139     max_net = models.IntegerField(db_column='MAXNET', null=True)
140     version = models.CharField(db_column='VERSION', max_length=255, null=True)
141     vendor = models.CharField(db_column='VENDOR', max_length=255, null=True, blank=True)
142     vnfd_model = models.TextField(db_column='VNFDMODEL', max_length=20000, blank=True, null=True)
143     input_params = models.TextField(db_column='INPUTPARAMS', max_length=2000, blank=True, null=True)
144     scale_params = models.TextField(db_column='SCALEPARAMS', max_length=2000, null=True, blank=True)
145     create_time = models.CharField(db_column='CREATETIME', max_length=200, null=True, blank=True)
146     lastuptime = models.CharField(db_column='LASTUPTIME', max_length=200, blank=True, null=True)
147     extension = models.TextField(db_column='EXTENSION', max_length=65535, blank=True, null=True)
148
149
150 class VmInstModel(models.Model):
151     class Meta:
152         db_table = 'NFVO_VMINST'
153
154     vmid = models.CharField(db_column='VMID', primary_key=True, max_length=255)
155     vimid = models.CharField(db_column='VIMID', max_length=255)
156     resouceid = models.CharField(db_column='RESOURCEID', max_length=255)
157     insttype = models.IntegerField(db_column='INSTTYPE', null=True)
158     instid = models.CharField(db_column='INSTID', max_length=255, null=True)
159     vmname = models.CharField(db_column='VMNAME', max_length=255)
160     operationalstate = models.IntegerField(db_column='OPERATIONALSTATE', default=1)
161     zoneid = models.CharField(db_column='ZONEID', max_length=255, null=True)
162     tenant = models.CharField(db_column='TENANT', max_length=255, null=True)
163     hostid = models.CharField(db_column='HOSTID', max_length=255)
164     detailinfo = models.CharField(db_column='DETAILINFO', max_length=255, null=True)
165
166
167 class VNFCInstModel(models.Model):
168     class Meta:
169         db_table = 'NFVO_VNFCINST'
170
171     vnfcinstanceid = models.CharField(db_column='VNFCINSTANCEID', max_length=255, primary_key=True)
172     vduid = models.CharField(db_column='VDUID', max_length=255)
173     nfinstid = models.CharField(db_column='NFINSTID', max_length=255)
174     vmid = models.CharField(db_column='VMID', max_length=255)
175     status = models.CharField(db_column='STATUS', max_length=255)
176
177
178 class CPInstModel(models.Model):
179     class Meta:
180         db_table = 'NFVO_CPINST'
181
182     cpinstanceid = models.CharField(db_column='CPINSTANCEID', max_length=255, primary_key=True)
183     cpdid = models.CharField(db_column='CPDID', max_length=255)
184     cpinstancename = models.CharField(db_column='CPINSTANCENAME', max_length=255)
185     ownertype = models.IntegerField(db_column='OWNERTYPE')
186     ownerid = models.CharField(db_column='OWNERID', max_length=255)
187     relatedtype = models.IntegerField(db_column='RELATEDTYPE')
188     relatedvl = models.CharField(db_column='RELATEDVL', max_length=255, blank=True, null=True)
189     relatedcp = models.CharField(db_column='RELATEDCP', max_length=255, blank=True, null=True)
190     relatedport = models.CharField(db_column='RELATEDPORT', max_length=255, blank=True, null=True)
191     status = models.CharField(db_column='STATUS', max_length=255)
192
193
194 class VLInstModel(models.Model):
195     class Meta:
196         db_table = 'NFVO_VLINST'
197
198     vlinstanceid = models.CharField(db_column='VLINSTANCEID', max_length=255, primary_key=True)
199     vldid = models.CharField(db_column='VLDID', max_length=255)
200     vlinstancename = models.CharField(db_column='VLINSTANCENAME', max_length=255, blank=True, null=True)
201     ownertype = models.IntegerField(db_column='OWNERTYPE')
202     ownerid = models.CharField(db_column='OWNERID', max_length=255)
203     relatednetworkid = models.CharField(db_column='RELATEDNETWORKID', max_length=255, blank=True, null=True)
204     relatedsubnetworkid = models.CharField(db_column='RELATEDSUBNETWORKID', max_length=255, blank=True, null=True)
205     vltype = models.IntegerField(db_column='VLTYPE', default=0)
206     vimid = models.CharField(db_column='VIMID', max_length=255)
207     tenant = models.CharField(db_column='TENANT', max_length=255)
208     status = models.CharField(db_column='STATUS', max_length=255)
209
210
211 class PortInstModel(models.Model):
212     class Meta:
213         db_table = 'NFVO_PORTINST'
214
215     portid = models.CharField(db_column='PORTID', max_length=255, primary_key=True)
216     networkid = models.CharField(db_column='NETWORKID', max_length=255)
217     subnetworkid = models.CharField(db_column='SUBNETWORKID', max_length=255)
218     vimid = models.CharField(db_column='VIMID', max_length=255)
219     resourceid = models.CharField(db_column='RESOURCEID', max_length=255)
220     name = models.CharField(db_column='NAME', max_length=255)
221     instid = models.CharField(db_column='INSTID', max_length=255)
222     cpinstanceid = models.CharField(db_column='CPINSTANCEID', max_length=255)
223     bandwidth = models.CharField(db_column='BANDWIDTH', max_length=255)
224     operationalstate = models.CharField(db_column='OPERATIONALSTATE', max_length=255)
225     ipaddress = models.CharField(db_column='IPADDRESS', max_length=255)
226     macaddress = models.CharField(db_column='MACADDRESS', max_length=255)
227     floatipaddress = models.CharField(db_column='FLOATIPADDRESS', max_length=255)
228     serviceipaddress = models.CharField(db_column='SERVICEIPADDRESS', max_length=255)
229     typevirtualnic = models.CharField(db_column='TYPEVIRTUALNIC', max_length=255)
230     sfcencapsulation = models.CharField(db_column='SFCENCAPSULATION', max_length=255)
231     direction = models.CharField(db_column='DIRECTION', max_length=255)
232     tenant = models.CharField(db_column='TENANT', max_length=255)
233
234
235 class JobModel(models.Model):
236     class Meta:
237         db_table = 'NFVO_JOB'
238
239     jobid = models.CharField(db_column='JOBID', primary_key=True, max_length=255)
240     jobtype = models.CharField(db_column='JOBTYPE', max_length=255)
241     jobaction = models.CharField(db_column='JOBACTION', max_length=255)
242     resid = models.CharField(db_column='RESID', max_length=255)
243     status = models.IntegerField(db_column='STATUS', null=True, blank=True)
244     starttime = models.CharField(db_column='STARTTIME', max_length=255, null=True, blank=True)
245     endtime = models.CharField(db_column='ENDTIME', max_length=255, null=True, blank=True)
246     progress = models.IntegerField(db_column='PROGRESS', null=True, blank=True)
247     user = models.CharField(db_column='USER', max_length=255, null=True, blank=True)
248     parentjobid = models.CharField(db_column='PARENTJOBID', max_length=255, null=True, blank=True)
249     resname = models.CharField(db_column='RESNAME', max_length=255, null=True, blank=True)
250
251     def toJSON(self):
252         import json
253         return json.dumps(dict([(attr, getattr(self, attr)) for attr in [f.name for f in self._meta.fields]]))
254
255
256 class JobStatusModel(models.Model):
257     class Meta:
258         db_table = 'NFVO_JOB_STATUS'
259
260     indexid = models.IntegerField(db_column='INDEXID')
261     jobid = models.CharField(db_column='JOBID', max_length=255)
262     status = models.CharField(db_column='STATUS', max_length=255)
263     progress = models.IntegerField(db_column='PROGRESS', null=True, blank=True)
264     descp = models.TextField(db_column='DESCP', max_length=65535)
265     errcode = models.CharField(db_column='ERRCODE', max_length=255, null=True, blank=True)
266     addtime = models.CharField(db_column='ADDTIME', max_length=255, null=True, blank=True)
267
268     def toJSON(self):
269         import json
270         return json.dumps(dict([(attr, getattr(self, attr)) for attr in [f.name for f in self._meta.fields]]))
271
272
273 class DefPkgMappingModel(models.Model):
274     class Meta:
275         db_table = 't_lcm_defPackage_mapping'
276
277     service_id = models.CharField(db_column='serviceId', max_length=255, primary_key=True)
278     service_def_id = models.CharField(db_column='serviceDefId', max_length=255)
279     template_id = models.CharField(db_column='templateId', max_length=255)
280     template_name = models.CharField(db_column='templateName', max_length=255)
281
282
283 class InputParamMappingModel(models.Model):
284     class Meta:
285         db_table = 't_lcm_inputParam_mapping'
286
287     service_id = models.CharField(db_column='serviceId', max_length=255)
288     input_key = models.CharField(db_column='inputKey', max_length=255)
289     input_value = models.CharField(db_column='inputValue', max_length=255, null=True, blank=True)
290
291
292 class ServiceBaseInfoModel(models.Model):
293     class Meta:
294         db_table = 't_lcm_servicebaseinfo'
295
296     service_id = models.CharField(db_column='serviceId', max_length=255, primary_key=True)
297     service_name = models.CharField(db_column='serviceName', max_length=255)
298     service_type = models.CharField(db_column='serviceType', max_length=20)
299     description = models.CharField(db_column='description', max_length=255, null=True, blank=True)
300     active_status = models.CharField(db_column='activeStatus', max_length=20)
301     status = models.CharField(db_column='status', max_length=20)
302     creator = models.CharField(db_column='creator', max_length=50)
303     create_time = models.BigIntegerField(db_column='createTime', max_length=20)
304     
305 class WFPlanModel(models.Model):
306     class Meta:
307         db_table = 'NFVO_WF_PLAN'
308
309     deployed_id = models.CharField(db_column='DEPLOYEDID', max_length=255, primary_key=True)
310     process_id = models.CharField(db_column='PROCESSID', max_length=255)
311     status = models.CharField(db_column='STATUS', max_length=255)
312     message = models.CharField(db_column='MESSAGE', max_length=1024)
313     plan_name = models.CharField(db_column='PLANNAME', max_length=255)
314