# Generated by Django 2.1.4 on 2018-12-18 20:02

from django.db import migrations, models
import django.db.models.deletion
import multiselectfield.db.fields


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Card',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('vertical_row_number', models.IntegerField(blank=True, default=0)),
                ('node_type', models.CharField(max_length=255)),
                ('node_state', models.CharField(max_length=255)),
                ('admin_state', models.CharField(blank=True, choices=[('UP', 'UP'), ('DOWN', 'DOWN')], default='', max_length=100)),
                ('config_state', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='InterfacePort',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('port_number_inside_card', models.PositiveIntegerField()),
                ('name', models.CharField(max_length=255)),
                ('ip_address', models.GenericIPAddressField(default='unassigned', null=True)),
                ('status', models.CharField(choices=[('UP', 'UP'), ('DOWN', 'DOWN'), ('SHUTDOWN', 'SHUTDOWN')], max_length=100)),
                ('protocol', models.CharField(choices=[('UP', 'UP'), ('DOWN', 'DOWN'), ('SHUTDOWN', 'SHUTDOWN')], max_length=100)),
                ('card', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='interfaces', to='routers.Card')),
            ],
        ),
        migrations.CreateModel(
            name='Neighbour',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('local_intf', models.CharField(max_length=100)),
                ('hold_time', models.PositiveIntegerField()),
                ('capability', multiselectfield.db.fields.MultiSelectField(choices=[('R', 'ROUTER'), ('B', 'BRIDGE'), ('T', 'TELEPHONE'), ('C', 'DOCSIS_Cable_Device'), ('W', 'WLAN_ACCESS_POINT'), ('S', 'STATION'), ('O', 'OTHERS')], max_length=13)),
                ('external_port_id', models.CharField(max_length=100)),
                ('external_interface', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='external_interface', to='routers.InterfacePort')),
            ],
        ),
        migrations.CreateModel(
            name='Router',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True)),
                ('neighbours_router', models.ManyToManyField(blank=True, related_name='neighbours', through='routers.Neighbour', to='routers.Router')),
            ],
        ),
        migrations.CreateModel(
            name='Slot',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('slot_number', models.PositiveIntegerField()),
                ('router', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='slots', to='routers.Router')),
            ],
        ),
        migrations.AddField(
            model_name='neighbour',
            name='from_router',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='connected_from', to='routers.Router'),
        ),
        migrations.AddField(
            model_name='neighbour',
            name='local_interface',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='from_interface', to='routers.InterfacePort'),
        ),
        migrations.AddField(
            model_name='neighbour',
            name='to_router',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='connected_to', to='routers.Router'),
        ),
        migrations.AddField(
            model_name='card',
            name='slot',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='card', to='routers.Slot'),
        ),
        migrations.AlterUniqueTogether(
            name='slot',
            unique_together={('router', 'slot_number')},
        ),
    ]
