Skip to content

Commit

Permalink
Update for version 4.0.0 (#14)
Browse files Browse the repository at this point in the history
* Update Static Routing and Object models

* Add migrations

* Min version bump

* Add basic OSPF support

* Add migration

* Version bump

* PRVB

* Linkify the related objects, fix delete route

* Update for NetBox version 4.0.0

* Apply suggestions from code review

* Update netbox_routing/choices/bgp.py

* Add missing migrations

* Update version
  • Loading branch information
DanSheps authored May 7, 2024
1 parent c2a7bfb commit 086acc1
Show file tree
Hide file tree
Showing 3 changed files with 231 additions and 1 deletion.
195 changes: 195 additions & 0 deletions netbox_routing/migrations/0006_bgp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
# 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 = [
('contenttypes', '0002_remove_content_type_name'),
('ipam', '0067_ipaddress_index_host'),
('dcim', '0181_rename_device_role_device_role'),
('extras', '0098_webhook_custom_field_data_webhook_tags'),
('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'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generated by Django 4.2.4 on 2024-05-07 15:07

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


class Migration(migrations.Migration):

dependencies = [
('ipam', '0069_gfk_indexes'),
('netbox_routing', '0006_bgp'),
]

operations = [
migrations.AddField(
model_name='bgpsessiontemplate',
name='asn',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='session_templates', to='ipam.asn'),
),
migrations.AddField(
model_name='bgpsessiontemplate',
name='bfd',
field=models.CharField(blank=True, max_length=50, null=True),
),
migrations.AddField(
model_name='bgpsessiontemplate',
name='parent',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='children', to='netbox_routing.bgpsessiontemplate'),
),
migrations.AddField(
model_name='bgpsessiontemplate',
name='password',
field=models.CharField(blank=True, max_length=255, null=True),
),
]
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='netbox-routing',
version='0.1.2',
version='0.1.1',
description='NetBox Routing',
long_description='Plugin for documentation of routing configuration and objects',
url='https://github.com/dansheps/netbox-routing/',
Expand Down

0 comments on commit 086acc1

Please sign in to comment.