Lab as a Service 2.0
[laas.git] / src / resource_inventory / migrations / 0001_initial.py
1 # Generated by Django 2.1 on 2018-09-14 14:48
2
3 from django.conf import settings
4 import django.core.validators
5 from django.db import migrations, models
6 import django.db.models.deletion
7
8
9 class Migration(migrations.Migration):
10
11     initial = True
12
13     dependencies = [
14         migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15         ('account', '0001_initial'),
16     ]
17
18     operations = [
19         migrations.CreateModel(
20             name='ConfigBundle',
21             fields=[
22                 ('id', models.AutoField(primary_key=True, serialize=False)),
23                 ('name', models.CharField(max_length=200, unique=True)),
24                 ('description', models.CharField(default='', max_length=1000)),
25             ],
26         ),
27         migrations.CreateModel(
28             name='CpuProfile',
29             fields=[
30                 ('id', models.AutoField(primary_key=True, serialize=False)),
31                 ('cores', models.IntegerField()),
32                 ('architecture', models.CharField(choices=[('x86_64', 'x86_64'), ('aarch64', 'aarch64')], max_length=50)),
33                 ('cpus', models.IntegerField()),
34                 ('cflags', models.TextField(null=True)),
35             ],
36         ),
37         migrations.CreateModel(
38             name='DiskProfile',
39             fields=[
40                 ('id', models.AutoField(primary_key=True, serialize=False)),
41                 ('size', models.IntegerField()),
42                 ('media_type', models.CharField(choices=[('SSD', 'SSD'), ('HDD', 'HDD')], max_length=50)),
43                 ('name', models.CharField(max_length=50)),
44                 ('rotation', models.IntegerField(default=0)),
45                 ('interface', models.CharField(choices=[('sata', 'sata'), ('sas', 'sas'), ('ssd', 'ssd'), ('nvme', 'nvme'), ('scsi', 'scsi'), ('iscsi', 'iscsi')], default='sata', max_length=50)),
46             ],
47         ),
48         migrations.CreateModel(
49             name='GenericHost',
50             fields=[
51                 ('id', models.AutoField(primary_key=True, serialize=False)),
52             ],
53         ),
54         migrations.CreateModel(
55             name='GenericInterface',
56             fields=[
57                 ('id', models.AutoField(primary_key=True, serialize=False)),
58                 ('host', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='generic_interfaces', to='resource_inventory.GenericHost')),
59             ],
60         ),
61         migrations.CreateModel(
62             name='GenericResource',
63             fields=[
64                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
65                 ('name', models.CharField(max_length=200, validators=[django.core.validators.RegexValidator(message='Enter a valid hostname. Full domain name may be 1-253 characters, each hostname 1-63 characters (including suffixed dot), and valid characters for hostnames are A-Z, a-z, 0-9, hyphen (-), and underscore (_)', regex='(?=^.{1,253}$)(?=(^([A-Za-z0-9\\-\\_]{1,62}\\.)*[A-Za-z0-9\\-\\_]{1,63}$))')])),
66             ],
67         ),
68         migrations.CreateModel(
69             name='GenericResourceBundle',
70             fields=[
71                 ('id', models.AutoField(primary_key=True, serialize=False)),
72                 ('name', models.CharField(max_length=300, unique=True)),
73                 ('xml', models.TextField()),
74                 ('description', models.CharField(default='', max_length=1000)),
75                 ('lab', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='account.Lab')),
76                 ('owner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
77             ],
78         ),
79         migrations.CreateModel(
80             name='Host',
81             fields=[
82                 ('id', models.AutoField(primary_key=True, serialize=False)),
83                 ('booked', models.BooleanField(default=False)),
84                 ('name', models.CharField(max_length=200, unique=True)),
85                 ('labid', models.CharField(default='default_id', max_length=200)),
86                 ('working', models.BooleanField(default=True)),
87                 ('vendor', models.CharField(default='unknown', max_length=100)),
88                 ('model', models.CharField(default='unknown', max_length=150)),
89             ],
90         ),
91         migrations.CreateModel(
92             name='HostConfiguration',
93             fields=[
94                 ('id', models.AutoField(primary_key=True, serialize=False)),
95                 ('bundle', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='hostConfigurations', to='resource_inventory.ConfigBundle')),
96                 ('host', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='configuration', to='resource_inventory.GenericHost')),
97             ],
98         ),
99         migrations.CreateModel(
100             name='HostProfile',
101             fields=[
102                 ('id', models.AutoField(primary_key=True, serialize=False)),
103                 ('host_type', models.PositiveSmallIntegerField()),
104                 ('name', models.CharField(max_length=200, unique=True)),
105                 ('description', models.TextField()),
106                 ('labs', models.ManyToManyField(related_name='hostprofiles', to='account.Lab')),
107             ],
108         ),
109         migrations.CreateModel(
110             name='Image',
111             fields=[
112                 ('id', models.AutoField(primary_key=True, serialize=False)),
113                 ('lab_id', models.IntegerField()),
114                 ('name', models.CharField(max_length=200)),
115                 ('public', models.BooleanField(default=True)),
116                 ('description', models.TextField()),
117                 ('from_lab', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='account.Lab')),
118                 ('host_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='resource_inventory.HostProfile')),
119                 ('owner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
120             ],
121         ),
122         migrations.CreateModel(
123             name='Installer',
124             fields=[
125                 ('id', models.AutoField(primary_key=True, serialize=False)),
126                 ('name', models.CharField(max_length=200)),
127             ],
128         ),
129         migrations.CreateModel(
130             name='Interface',
131             fields=[
132                 ('id', models.AutoField(primary_key=True, serialize=False)),
133                 ('mac_address', models.CharField(max_length=17)),
134                 ('bus_address', models.CharField(max_length=50)),
135                 ('name', models.CharField(default='eth0', max_length=100)),
136             ],
137         ),
138         migrations.CreateModel(
139             name='InterfaceProfile',
140             fields=[
141                 ('id', models.AutoField(primary_key=True, serialize=False)),
142                 ('speed', models.IntegerField()),
143                 ('name', models.CharField(max_length=100)),
144                 ('nic_type', models.CharField(choices=[('onboard', 'onboard'), ('pcie', 'pcie')], default='onboard', max_length=50)),
145                 ('host', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='interfaceprofile', to='resource_inventory.HostProfile')),
146             ],
147         ),
148         migrations.CreateModel(
149             name='Network',
150             fields=[
151                 ('id', models.AutoField(primary_key=True, serialize=False)),
152                 ('vlan_id', models.IntegerField()),
153                 ('name', models.CharField(max_length=100)),
154             ],
155         ),
156         migrations.CreateModel(
157             name='OPNFVConfig',
158             fields=[
159                 ('id', models.AutoField(primary_key=True, serialize=False)),
160                 ('bundle', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='opnfv_config', to='resource_inventory.ConfigBundle')),
161                 ('installer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='resource_inventory.Installer')),
162             ],
163         ),
164         migrations.CreateModel(
165             name='OPNFVRole',
166             fields=[
167                 ('id', models.AutoField(primary_key=True, serialize=False)),
168                 ('name', models.CharField(max_length=200)),
169                 ('description', models.TextField()),
170             ],
171         ),
172         migrations.CreateModel(
173             name='Opsys',
174             fields=[
175                 ('id', models.AutoField(primary_key=True, serialize=False)),
176                 ('name', models.CharField(max_length=100)),
177                 ('sup_installers', models.ManyToManyField(blank=True, to='resource_inventory.Installer')),
178             ],
179         ),
180         migrations.CreateModel(
181             name='RamProfile',
182             fields=[
183                 ('id', models.AutoField(primary_key=True, serialize=False)),
184                 ('amount', models.IntegerField()),
185                 ('channels', models.IntegerField()),
186                 ('host', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='ramprofile', to='resource_inventory.HostProfile')),
187             ],
188         ),
189         migrations.CreateModel(
190             name='ResourceBundle',
191             fields=[
192                 ('id', models.AutoField(primary_key=True, serialize=False)),
193                 ('template', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='resource_inventory.GenericResourceBundle')),
194             ],
195         ),
196         migrations.CreateModel(
197             name='Scenario',
198             fields=[
199                 ('id', models.AutoField(primary_key=True, serialize=False)),
200                 ('name', models.CharField(max_length=300)),
201             ],
202         ),
203         migrations.CreateModel(
204             name='Vlan',
205             fields=[
206                 ('id', models.AutoField(primary_key=True, serialize=False)),
207                 ('vlan_id', models.IntegerField()),
208                 ('tagged', models.BooleanField()),
209             ],
210         ),
211         migrations.CreateModel(
212             name='GenericPod',
213             fields=[
214                 ('genericresource_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='resource_inventory.GenericResource')),
215             ],
216             bases=('resource_inventory.genericresource',),
217         ),
218         migrations.AddField(
219             model_name='opnfvconfig',
220             name='scenario',
221             field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='resource_inventory.Scenario'),
222         ),
223         migrations.AddField(
224             model_name='interface',
225             name='config',
226             field=models.ManyToManyField(to='resource_inventory.Vlan'),
227         ),
228         migrations.AddField(
229             model_name='interface',
230             name='host',
231             field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='interfaces', to='resource_inventory.Host'),
232         ),
233         migrations.AddField(
234             model_name='installer',
235             name='sup_scenarios',
236             field=models.ManyToManyField(blank=True, to='resource_inventory.Scenario'),
237         ),
238         migrations.AddField(
239             model_name='hostconfiguration',
240             name='image',
241             field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='resource_inventory.Image'),
242         ),
243         migrations.AddField(
244             model_name='hostconfiguration',
245             name='opnfvRole',
246             field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='resource_inventory.OPNFVRole'),
247         ),
248         migrations.AddField(
249             model_name='host',
250             name='bundle',
251             field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='hosts', to='resource_inventory.ResourceBundle'),
252         ),
253         migrations.AddField(
254             model_name='host',
255             name='config',
256             field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='configuration', to='resource_inventory.HostConfiguration'),
257         ),
258         migrations.AddField(
259             model_name='host',
260             name='lab',
261             field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='account.Lab'),
262         ),
263         migrations.AddField(
264             model_name='host',
265             name='profile',
266             field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='resource_inventory.HostProfile'),
267         ),
268         migrations.AddField(
269             model_name='host',
270             name='template',
271             field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='resource_inventory.GenericHost'),
272         ),
273         migrations.AddField(
274             model_name='genericresource',
275             name='bundle',
276             field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='generic_resources', to='resource_inventory.GenericResourceBundle'),
277         ),
278         migrations.AddField(
279             model_name='genericinterface',
280             name='profile',
281             field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='resource_inventory.InterfaceProfile'),
282         ),
283         migrations.AddField(
284             model_name='genericinterface',
285             name='vlans',
286             field=models.ManyToManyField(to='resource_inventory.Vlan'),
287         ),
288         migrations.AddField(
289             model_name='generichost',
290             name='profile',
291             field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='resource_inventory.HostProfile'),
292         ),
293         migrations.AddField(
294             model_name='generichost',
295             name='resource',
296             field=models.OneToOneField(on_delete=django.db.models.deletion.DO_NOTHING, related_name='generic_host', to='resource_inventory.GenericResource'),
297         ),
298         migrations.AddField(
299             model_name='diskprofile',
300             name='host',
301             field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='storageprofile', to='resource_inventory.HostProfile'),
302         ),
303         migrations.AddField(
304             model_name='cpuprofile',
305             name='host',
306             field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='cpuprofile', to='resource_inventory.HostProfile'),
307         ),
308         migrations.AddField(
309             model_name='configbundle',
310             name='bundle',
311             field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='resource_inventory.GenericResourceBundle'),
312         ),
313         migrations.AddField(
314             model_name='configbundle',
315             name='owner',
316             field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
317         ),
318         migrations.AddField(
319             model_name='genericpod',
320             name='hosts',
321             field=models.ManyToManyField(to='resource_inventory.GenericHost'),
322         ),
323         migrations.AddField(
324             model_name='genericpod',
325             name='networks',
326             field=models.ManyToManyField(to='resource_inventory.Network'),
327         ),
328     ]