# Generated by Django 4.2.4 on 2023-12-19 17:18

from django.db import migrations, models
import django.db.models.deletion
import netbox_routing.fields.ip
import taggit.managers
import utilities.json


class Migration(migrations.Migration):

    dependencies = [
        ('netbox_routing', '0005_ospf'),
    ]

    operations = [
        migrations.CreateModel(
            name='BGPAddressFamily',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                ('address_family', models.CharField(max_length=50)),
            ],
            options={
                'verbose_name': 'BGP Address Family',
            },
        ),
        migrations.CreateModel(
            name='BGPRouter',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                (
                    'asn',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='router',
                        to='ipam.asn',
                    ),
                ),
                (
                    'device',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='router',
                        to='dcim.device',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
            ],
            options={
                'verbose_name': 'BGP Router',
            },
        ),
        migrations.AddField(
            model_name='routemapentry',
            name='match',
            field=models.JSONField(blank=True, null=True),
        ),
        migrations.AddField(
            model_name='routemapentry',
            name='set',
            field=models.JSONField(blank=True, null=True),
        ),
        migrations.CreateModel(
            name='BGPSetting',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                (
                    'assigned_object_id',
                    models.PositiveBigIntegerField(blank=True, null=True),
                ),
                ('key', models.CharField()),
                ('value', models.CharField()),
                (
                    'assigned_object_type',
                    models.ForeignKey(
                        blank=True,
                        limit_choices_to=models.Q(
                            models.Q(
                                models.Q(
                                    ('app_label', 'netbox_routing'),
                                    ('model', 'bgprouter'),
                                ),
                                models.Q(
                                    ('app_label', 'netbox_routing'),
                                    ('model', 'bgpscope'),
                                ),
                                _connector='OR',
                            )
                        ),
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='+',
                        to='contenttypes.contenttype',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
            ],
            options={
                'verbose_name': 'BGP Setting',
            },
        ),
        migrations.CreateModel(
            name='BGPSessionTemplate',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                ('name', models.CharField(max_length=255)),
                ('enabled', models.BooleanField(blank=True, null=True)),
                (
                    'router',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='session_templates',
                        to='netbox_routing.bgprouter',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='BGPScope',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                (
                    'router',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='scopes',
                        to='netbox_routing.bgprouter',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
                (
                    'vrf',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='scopes',
                        to='ipam.vrf',
                    ),
                ),
            ],
            options={
                'verbose_name': 'BGP Scope',
            },
        ),
        migrations.CreateModel(
            name='BGPPoliyTemplate',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                ('name', models.CharField(max_length=255)),
                ('enabled', models.BooleanField(blank=True, null=True)),
                (
                    'prefixlist_in',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='template_afs_in',
                        to='netbox_routing.prefixlist',
                    ),
                ),
                (
                    'prefixlist_out',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='template_afs_out',
                        to='netbox_routing.prefixlist',
                    ),
                ),
                (
                    'routemap_in',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='template_afs_in',
                        to='netbox_routing.routemap',
                    ),
                ),
                (
                    'routemap_out',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='template_afs_out',
                        to='netbox_routing.routemap',
                    ),
                ),
                (
                    'router',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='policy_templates',
                        to='netbox_routing.bgprouter',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='BGPPeerTemplate',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                ('name', models.CharField(max_length=255)),
                ('enabled', models.BooleanField(blank=True, null=True)),
                (
                    'remote_as',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='+',
                        to='ipam.asn',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='BGPPeerAddressFamily',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                (
                    'assigned_object_id',
                    models.PositiveBigIntegerField(blank=True, null=True),
                ),
                ('enabled', models.BooleanField(blank=True, null=True)),
                (
                    'address_family',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='address_families',
                        to='netbox_routing.bgpaddressfamily',
                    ),
                ),
                (
                    'assigned_object_type',
                    models.ForeignKey(
                        blank=True,
                        limit_choices_to=models.Q(
                            models.Q(
                                models.Q(
                                    ('app_label', 'netbox_routing'),
                                    ('model', 'bgppeer'),
                                ),
                                models.Q(
                                    ('app_label', 'netbox_routing'),
                                    ('model', 'bgppeergroup'),
                                ),
                                models.Q(
                                    ('app_label', 'netbox_routing'),
                                    ('model', 'bgptemplatepeer'),
                                ),
                                models.Q(
                                    ('app_label', 'netbox_routing'),
                                    ('model', 'bgptemplatepeerpolicy'),
                                ),
                                _connector='OR',
                            )
                        ),
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='+',
                        to='contenttypes.contenttype',
                    ),
                ),
                (
                    'peer_session',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peer_afs',
                        to='netbox_routing.bgpsessiontemplate',
                    ),
                ),
                (
                    'prefixlist_in',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peer_afs_in',
                        to='netbox_routing.prefixlist',
                    ),
                ),
                (
                    'prefixlist_out',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peer_afs_out',
                        to='netbox_routing.prefixlist',
                    ),
                ),
                (
                    'routemap_in',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peer_afs_in',
                        to='netbox_routing.routemap',
                    ),
                ),
                (
                    'routemap_out',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peer_afs_out',
                        to='netbox_routing.routemap',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='BGPPeer',
            fields=[
                (
                    'id',
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False
                    ),
                ),
                ('created', models.DateTimeField(auto_now_add=True, null=True)),
                ('last_updated', models.DateTimeField(auto_now=True, null=True)),
                (
                    'custom_field_data',
                    models.JSONField(
                        blank=True,
                        default=dict,
                        encoder=utilities.json.CustomFieldJSONEncoder,
                    ),
                ),
                (
                    'assigned_object_id',
                    models.PositiveBigIntegerField(blank=True, null=True),
                ),
                ('peer', netbox_routing.fields.ip.IPAddressField()),
                ('enabled', models.BooleanField(blank=True, null=True)),
                (
                    'assigned_object_type',
                    models.ForeignKey(
                        blank=True,
                        limit_choices_to=models.Q(
                            models.Q(
                                models.Q(
                                    ('app_label', 'netbox_routing'),
                                    ('model', 'bgprouter'),
                                ),
                                models.Q(
                                    ('app_label', 'netbox_routing'),
                                    ('model', 'bgpscope'),
                                ),
                                _connector='OR',
                            )
                        ),
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='+',
                        to='contenttypes.contenttype',
                    ),
                ),
                (
                    'peer_group',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peers',
                        to='netbox_routing.bgppeertemplate',
                    ),
                ),
                (
                    'peer_policy',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='peers',
                        to='netbox_routing.bgppoliytemplate',
                    ),
                ),
                (
                    'remote_as',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name='+',
                        to='ipam.asn',
                    ),
                ),
                (
                    'tags',
                    taggit.managers.TaggableManager(
                        through='extras.TaggedItem', to='extras.Tag'
                    ),
                ),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='bgpaddressfamily',
            name='scope',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                related_name='address_families',
                to='netbox_routing.bgpscope',
            ),
        ),
        migrations.AddField(
            model_name='bgpaddressfamily',
            name='tags',
            field=taggit.managers.TaggableManager(
                through='extras.TaggedItem', to='extras.Tag'
            ),
        ),
    ]
