[refactor] cleaning up uncloud_net for Wireguardvpn

This commit is contained in:
Nico Schottelius 2020-12-13 11:38:41 +01:00
commit 10d5a72c5a
82 changed files with 403 additions and 2180 deletions

View file

@ -1,11 +1,9 @@
# Generated by Django 3.0.6 on 2020-08-01 16:38
# Generated by Django 3.1 on 2020-12-13 10:38
from django.conf import settings
import django.contrib.postgres.fields.jsonb
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
@ -14,7 +12,6 @@ class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('uncloud_pay', '__first__'),
]
operations = [
@ -25,45 +22,31 @@ class Migration(migrations.Migration):
],
),
migrations.CreateModel(
name='VPNPool',
fields=[
('extra_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('network', models.GenericIPAddressField(unique=True)),
('network_size', models.IntegerField(validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(128)])),
('subnetwork_size', models.IntegerField(validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(128)])),
('vpn_hostname', models.CharField(max_length=256)),
('wireguard_private_key', models.CharField(max_length=48)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='VPNNetworkReservation',
fields=[
('extra_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True)),
('address', models.GenericIPAddressField(primary_key=True, serialize=False)),
('status', models.CharField(choices=[('used', 'used'), ('free', 'free')], default='used', max_length=256)),
('vpnpool', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='uncloud_net.VPNPool')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='VPNNetwork',
name='WireGuardVPNPool',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('extra_data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, editable=False, null=True)),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('AWAITING_PAYMENT', 'Awaiting payment'), ('BEING_CREATED', 'Being created'), ('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('MODIFYING', 'Modifying'), ('DELETED', 'Deleted'), ('DISABLED', 'Disabled'), ('UNUSABLE', 'Unusable')], default='AWAITING_PAYMENT', max_length=32)),
('wireguard_public_key', models.CharField(max_length=48)),
('network', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to='uncloud_net.VPNNetworkReservation')),
('order', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.Order')),
('owner', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('network', models.GenericIPAddressField(unique=True)),
('network_mask', models.IntegerField(validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(128)])),
('subnetwork_mask', models.IntegerField(validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(128)])),
('vpn_server_hostname', models.CharField(max_length=256)),
('wireguard_private_key', models.CharField(max_length=48)),
],
),
migrations.CreateModel(
name='WireGuardVPN',
fields=[
('address', models.GenericIPAddressField(primary_key=True, serialize=False)),
('wireguard_public_key', models.CharField(max_length=48)),
('vpnpool', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='uncloud_net.wireguardvpnpool')),
],
),
migrations.CreateModel(
name='ReverseDNSEntry',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('ip_address', models.GenericIPAddressField(unique=True)),
('name', models.CharField(max_length=253)),
('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
),
]

View file

@ -1,20 +0,0 @@
# Generated by Django 3.0.8 on 2020-08-01 23:32
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0003_auto_20200801_2332'),
('uncloud_net', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='vpnnetwork',
name='order',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.Order'),
),
]

View file

@ -1,28 +0,0 @@
# Generated by Django 3.1 on 2020-08-08 19:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_net', '0002_auto_20200801_2332'),
]
operations = [
migrations.AlterField(
model_name='vpnnetwork',
name='extra_data',
field=models.JSONField(blank=True, editable=False, null=True),
),
migrations.AlterField(
model_name='vpnnetworkreservation',
name='extra_data',
field=models.JSONField(blank=True, editable=False, null=True),
),
migrations.AlterField(
model_name='vpnpool',
name='extra_data',
field=models.JSONField(blank=True, editable=False, null=True),
),
]

View file

@ -1,23 +0,0 @@
# Generated by Django 3.1 on 2020-08-09 12:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0013_auto_20200809_1237'),
('uncloud_net', '0003_auto_20200808_1953'),
]
operations = [
migrations.RemoveField(
model_name='vpnnetwork',
name='order',
),
migrations.AddField(
model_name='vpnnetwork',
name='orders',
field=models.ManyToManyField(to='uncloud_pay.Order'),
),
]

View file

@ -1,17 +0,0 @@
# Generated by Django 3.1 on 2020-09-28 18:44
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('uncloud_net', '0004_auto_20200809_1237'),
]
operations = [
migrations.RemoveField(
model_name='vpnnetwork',
name='orders',
),
]

View file

@ -1,25 +0,0 @@
# Generated by Django 3.1 on 2020-09-28 18:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('uncloud_net', '0005_remove_vpnnetwork_orders'),
]
operations = [
migrations.RemoveField(
model_name='vpnnetwork',
name='extra_data',
),
migrations.RemoveField(
model_name='vpnnetwork',
name='owner',
),
migrations.RemoveField(
model_name='vpnnetwork',
name='status',
),
]

View file

@ -1,22 +0,0 @@
# Generated by Django 3.1 on 2020-10-11 19:20
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_net', '0006_auto_20200928_1858'),
]
operations = [
migrations.CreateModel(
name='UncloudNetwork',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('network_address', models.GenericIPAddressField()),
('network_mask', models.IntegerField(validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(128)])),
],
),
]

View file

@ -1,18 +0,0 @@
# Generated by Django 3.1 on 2020-10-11 19:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_net', '0007_uncloudnetwork'),
]
operations = [
migrations.AlterField(
model_name='uncloudnetwork',
name='network_address',
field=models.GenericIPAddressField(unique=True),
),
]

View file

@ -1,19 +0,0 @@
# Generated by Django 3.1 on 2020-10-11 19:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('uncloud_net', '0008_auto_20201011_1924'),
]
operations = [
migrations.AddField(
model_name='uncloudnetwork',
name='description',
field=models.CharField(default='', max_length=256),
preserve_default=False,
),
]

View file

@ -1,21 +0,0 @@
# Generated by Django 3.1 on 2020-10-11 20:09
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('uncloud_net', '0009_uncloudnetwork_description'),
]
operations = [
migrations.RemoveField(
model_name='vpnnetworkreservation',
name='extra_data',
),
migrations.RemoveField(
model_name='vpnpool',
name='extra_data',
),
]

View file

@ -1,29 +0,0 @@
# Generated by Django 3.1 on 2020-10-25 19:31
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('uncloud', '0006_auto_20201025_1931'),
('uncloud_net', '0010_auto_20201011_2009'),
]
operations = [
migrations.CreateModel(
name='ReverseDNSEntry',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('ip_address', models.GenericIPAddressField(unique=True)),
('name', models.CharField(max_length=253)),
('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.DeleteModel(
name='UncloudNetwork',
),
]