-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from DanSheps/develop
v0.0.2 Release
- Loading branch information
Showing
18 changed files
with
216 additions
and
43 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,3 +127,5 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
from netbox.api.viewsets import ModelViewSet | ||
from netbox.api.viewsets import NetBoxModelViewSet | ||
from netbox_routing.api.serializers import PrefixListSerializer, PrefixListEntrySerializer, RouteMapSerializer, \ | ||
RouteMapEntrySerializer | ||
from netbox_routing.models import PrefixList, PrefixListEntry, RouteMap, RouteMapEntry | ||
|
||
|
||
class PrefixListViewSet(ModelViewSet): | ||
class PrefixListViewSet(NetBoxModelViewSet): | ||
queryset = PrefixList.objects.all() | ||
serializer_class = PrefixListSerializer | ||
|
||
|
||
class PrefixListEntryViewSet(ModelViewSet): | ||
class PrefixListEntryViewSet(NetBoxModelViewSet): | ||
queryset = PrefixListEntry.objects.all() | ||
serializer_class = PrefixListEntrySerializer | ||
|
||
|
||
class RouteMapViewSet(ModelViewSet): | ||
class RouteMapViewSet(NetBoxModelViewSet): | ||
queryset = RouteMap.objects.all() | ||
serializer_class = RouteMapSerializer | ||
|
||
|
||
class RouteMapEntryViewSet(ModelViewSet): | ||
class RouteMapEntryViewSet(NetBoxModelViewSet): | ||
queryset = RouteMapEntry.objects.all() | ||
serializer_class = RouteMapEntrySerializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
from netbox.api.viewsets import ModelViewSet | ||
from netbox.api.viewsets import NetBoxModelViewSet | ||
from netbox_routing.api.serializers import StaticRouteSerializer | ||
from netbox_routing.models import StaticRoute | ||
|
||
|
||
class StaticRouteViewSet(ModelViewSet): | ||
class StaticRouteViewSet(NetBoxModelViewSet): | ||
queryset = StaticRoute.objects.all() | ||
serializer_class = StaticRouteSerializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Generated by Django 4.0.3 on 2022-04-01 18:02 | ||
|
||
import django.core.serializers.json | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import ipam.fields | ||
import netbox_routing.fields.ip | ||
import taggit.managers | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
('ipam', '0057_created_datetimefield'), | ||
('extras', '0072_created_datetimefield'), | ||
('dcim', '0153_created_datetimefield'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='PrefixList', | ||
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=django.core.serializers.json.DjangoJSONEncoder)), | ||
('name', models.CharField(max_length=255)), | ||
('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='RouteMap', | ||
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=django.core.serializers.json.DjangoJSONEncoder)), | ||
('name', models.CharField(max_length=255)), | ||
('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='StaticRoute', | ||
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=django.core.serializers.json.DjangoJSONEncoder)), | ||
('prefix', ipam.fields.IPNetworkField()), | ||
('next_hop', netbox_routing.fields.ip.IPAddressField()), | ||
('name', models.CharField(blank=True, max_length=50, null=True)), | ||
('metric', models.PositiveSmallIntegerField()), | ||
('permanent', models.BooleanField()), | ||
('devices', models.ManyToManyField(related_name='static_routes', to='dcim.device')), | ||
('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='staticroutes', to='ipam.vrf')), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='RouteMapEntry', | ||
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=django.core.serializers.json.DjangoJSONEncoder)), | ||
('type', models.CharField(max_length=6)), | ||
('sequence', models.PositiveSmallIntegerField()), | ||
('route_map', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='entries', to='netbox_routing.routemap')), | ||
('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='PrefixListEntry', | ||
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=django.core.serializers.json.DjangoJSONEncoder)), | ||
('sequence', models.PositiveSmallIntegerField()), | ||
('type', models.CharField(max_length=6)), | ||
('prefix', ipam.fields.IPNetworkField()), | ||
('ge', models.PositiveSmallIntegerField()), | ||
('le', models.PositiveSmallIntegerField()), | ||
('prefix_list', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='entries', to='netbox_routing.prefixlist')), | ||
('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
), | ||
migrations.AddConstraint( | ||
model_name='staticroute', | ||
constraint=models.CheckConstraint(check=models.Q(models.Q(('metric__lte', 255), ('metric__gte', 0))), name='metric_gte_lte'), | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from django.db import models | ||
|
||
from netbox.models import NetBoxModel, WebhooksMixin, ChangeLoggedModel | ||
|
||
from netbox_routing.fields.ip import IPAddressField | ||
|
||
|
||
__all__ = ( | ||
'OSPFInstance', | ||
'OSPFArea', | ||
) | ||
|
||
|
||
class OSPFInstance(NetBoxModel): | ||
router_id = IPAddressField() | ||
process_id = models.IntegerField() | ||
|
||
|
||
class OSPFArea(NetBoxModel): | ||
instance = models.ForeignKey( | ||
to='netbox_routing.OSPFInstance' | ||
) | ||
area_id = models.IntegerField() | ||
interfaces = models.ManyToManyField( | ||
to='netbox_routing.OSPFArea', | ||
on_delete=models.PROTECT, | ||
related_name='ospf', | ||
blank=False, | ||
null=False | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,36 @@ | ||
from extras.plugins import PluginMenuButton, PluginMenuItem | ||
from extras.plugins import PluginMenuButton, PluginMenuItem, PluginMenu | ||
from utilities.choices import ButtonColorChoices | ||
|
||
menu_items = ( | ||
PluginMenuItem( | ||
link='plugins:netbox_routing:staticroute_list', | ||
link_text='Static Route', | ||
buttons=( | ||
PluginMenuButton('plugins:netbox_routing:staticroute_add', 'Add', 'mdi mdi-plus', ButtonColorChoices.GREEN), | ||
PluginMenuButton('plugins:netbox_routing:staticroute_import', 'Import', 'mdi mdi-upload', ButtonColorChoices.CYAN), | ||
) | ||
), | ||
PluginMenuItem( | ||
link='plugins:netbox_routing:prefixlist_list', | ||
link_text='Prefix Lists', | ||
buttons=( | ||
PluginMenuButton('plugins:netbox_routing:prefixlist_add', 'Add', 'mdi mdi-plus', ButtonColorChoices.GREEN), | ||
PluginMenuButton('plugins:netbox_routing:prefixlist_import', 'Import', 'mdi mdi-upload', ButtonColorChoices.CYAN), | ||
) | ||
), | ||
PluginMenuItem( | ||
link='plugins:netbox_routing:routemap_list', | ||
link_text='Route Maps', | ||
buttons=( | ||
PluginMenuButton('plugins:netbox_routing:routemap_add', 'Add', 'mdi mdi-plus', ButtonColorChoices.GREEN), | ||
PluginMenuButton('plugins:netbox_routing:routemap_import', 'Import', 'mdi mdi-upload', ButtonColorChoices.CYAN), | ||
) | ||
static = PluginMenuItem( | ||
link='plugins:netbox_routing:staticroute_list', | ||
link_text='Static Route', | ||
buttons=( | ||
PluginMenuButton('plugins:netbox_routing:staticroute_add', 'Add', 'mdi mdi-plus', ButtonColorChoices.GREEN), | ||
PluginMenuButton('plugins:netbox_routing:staticroute_import', 'Import', 'mdi mdi-upload', ButtonColorChoices.CYAN), | ||
) | ||
) | ||
prefixlist = PluginMenuItem( | ||
link='plugins:netbox_routing:prefixlist_list', | ||
link_text='Prefix Lists', | ||
buttons=( | ||
PluginMenuButton('plugins:netbox_routing:prefixlist_add', 'Add', 'mdi mdi-plus', ButtonColorChoices.GREEN), | ||
PluginMenuButton('plugins:netbox_routing:prefixlist_import', 'Import', 'mdi mdi-upload', ButtonColorChoices.CYAN), | ||
) | ||
) | ||
routemap = PluginMenuItem( | ||
link='plugins:netbox_routing:routemap_list', | ||
link_text='Route Maps', | ||
buttons=( | ||
PluginMenuButton('plugins:netbox_routing:routemap_add', 'Add', 'mdi mdi-plus', ButtonColorChoices.GREEN), | ||
PluginMenuButton('plugins:netbox_routing:routemap_import', 'Import', 'mdi mdi-upload', ButtonColorChoices.CYAN), | ||
) | ||
) | ||
|
||
menu = PluginMenu( | ||
label='Netbox Routing', | ||
groups=( | ||
('Routing Objects', (prefixlist, routemap )), | ||
('Support Contracts', (static, )), | ||
), | ||
) | ||
icon_class='mdi mdi-router' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters