-
-
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.
* Update Static Routing and Object models * Add migrations
- Loading branch information
Showing
29 changed files
with
731 additions
and
47 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from .objects import * | ||
|
||
|
||
__all__ = ( | ||
'PrefixListEntryBulkEditForm', | ||
'RouteMapEntryBulkEditForm' | ||
) | ||
|
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,42 @@ | ||
|
||
from django.utils.translation import gettext as _ | ||
|
||
from netbox.forms import NetBoxModelBulkEditForm | ||
from netbox_routing.models import PrefixList, PrefixListEntry, RouteMapEntry, RouteMap | ||
from utilities.forms.fields import DynamicModelChoiceField | ||
|
||
|
||
__all__ = ( | ||
'PrefixListEntryBulkEditForm', | ||
'RouteMapEntryBulkEditForm' | ||
) | ||
|
||
|
||
class PrefixListEntryBulkEditForm(NetBoxModelBulkEditForm): | ||
prefix_list = DynamicModelChoiceField( | ||
queryset=PrefixList.objects.all(), | ||
label=_('Prefix List'), | ||
required=False, | ||
selector=True | ||
) | ||
|
||
model = PrefixListEntry | ||
fieldsets = ( | ||
(None, ('prefix_list', )), | ||
) | ||
nullable_fields = () | ||
|
||
|
||
class RouteMapEntryBulkEditForm(NetBoxModelBulkEditForm): | ||
route_map = DynamicModelChoiceField( | ||
queryset=RouteMap.objects.all(), | ||
label=_('Route Map'), | ||
required=False, | ||
selector=True | ||
) | ||
|
||
model = RouteMapEntry | ||
fieldsets = ( | ||
(None, ('route_map', )), | ||
) | ||
nullable_fields = () |
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,6 +1,19 @@ | ||
from ipam.models import VRF | ||
from netbox.forms import NetBoxModelFilterSetForm | ||
from netbox_routing.models import StaticRoute | ||
from utilities.forms.fields import DynamicModelMultipleChoiceField, TagFilterField | ||
from django.utils.translation import gettext as _ | ||
|
||
|
||
class StaticRouteFilterSetForm(NetBoxModelFilterSetForm): | ||
model = StaticRoute | ||
model = StaticRoute | ||
fieldsets = ( | ||
(None, ('q', 'filter_id', 'tag', 'vrf')), | ||
) | ||
vrf = DynamicModelMultipleChoiceField( | ||
queryset=VRF.objects.all(), | ||
required=False, | ||
selector=True, | ||
label=_('VRF'), | ||
) | ||
tag = TagFilterField(model) |
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,39 @@ | ||
# Generated by Django 4.1.7 on 2023-05-18 13:43 | ||
|
||
from django.db import migrations, models | ||
import utilities.json | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('netbox_routing', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='prefixlist', | ||
name='custom_field_data', | ||
field=models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), | ||
), | ||
migrations.AlterField( | ||
model_name='prefixlistentry', | ||
name='custom_field_data', | ||
field=models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), | ||
), | ||
migrations.AlterField( | ||
model_name='routemap', | ||
name='custom_field_data', | ||
field=models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), | ||
), | ||
migrations.AlterField( | ||
model_name='routemapentry', | ||
name='custom_field_data', | ||
field=models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), | ||
), | ||
migrations.AlterField( | ||
model_name='staticroute', | ||
name='custom_field_data', | ||
field=models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder), | ||
), | ||
] |
54 changes: 54 additions & 0 deletions
54
netbox_routing/migrations/0003_model_ordering_and_constraints.py
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,54 @@ | ||
# Generated by Django 4.1.7 on 2023-05-18 13:45 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.functions.text | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('netbox_routing', '0002_netboxmodel_updates'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='prefixlist', | ||
options={'ordering': ['name']}, | ||
), | ||
migrations.AlterModelOptions( | ||
name='prefixlistentry', | ||
options={'ordering': ['prefix_list', 'sequence']}, | ||
), | ||
migrations.AlterModelOptions( | ||
name='routemap', | ||
options={'ordering': ['name']}, | ||
), | ||
migrations.AlterModelOptions( | ||
name='routemapentry', | ||
options={'ordering': ['route_map', 'sequence']}, | ||
), | ||
migrations.AlterModelOptions( | ||
name='staticroute', | ||
options={'ordering': ['vrf', 'prefix', 'metric']}, | ||
), | ||
migrations.AddConstraint( | ||
model_name='prefixlist', | ||
constraint=models.UniqueConstraint(django.db.models.functions.text.Lower('name'), name='netbox_routing_prefixlist_unique_name', violation_error_message='Name must be unique.'), | ||
), | ||
migrations.AddConstraint( | ||
model_name='prefixlistentry', | ||
constraint=models.UniqueConstraint(models.F('prefix_list'), models.F('sequence'), name='netbox_routing_prefixlistentry_unique_prefixlist_sequence', violation_error_message='Prefix List sequence must be unique.'), | ||
), | ||
migrations.AddConstraint( | ||
model_name='routemap', | ||
constraint=models.UniqueConstraint(django.db.models.functions.text.Lower('name'), name='netbox_routing_routemap_unique_name', violation_error_message='Name must be unique.'), | ||
), | ||
migrations.AddConstraint( | ||
model_name='routemapentry', | ||
constraint=models.UniqueConstraint(models.F('route_map'), models.F('sequence'), name='netbox_routing_routemapentry_unique_routemap_sequence', violation_error_message='Route Map sequence must be unique.'), | ||
), | ||
migrations.AddConstraint( | ||
model_name='staticroute', | ||
constraint=models.UniqueConstraint(models.F('vrf'), models.F('prefix'), models.F('next_hop'), name='netbox_routing_staticroute_unique_vrf_prefix_nexthop', violation_error_message='VRF, Prefix and Next Hop must be unique.'), | ||
), | ||
] |
23 changes: 23 additions & 0 deletions
23
netbox_routing/migrations/0004_alter_prefixlistentry_ge_alter_prefixlistentry_le.py
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,23 @@ | ||
# Generated by Django 4.1.7 on 2023-05-18 13:50 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('netbox_routing', '0003_model_ordering_and_constraints'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='prefixlistentry', | ||
name='ge', | ||
field=models.PositiveSmallIntegerField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='prefixlistentry', | ||
name='le', | ||
field=models.PositiveSmallIntegerField(blank=True, null=True), | ||
), | ||
] |
Oops, something went wrong.