Skip to content

Commit 23e4b2d

Browse files
authored
Merge pull request #264 from cruse1977/develop
Fixes for NetBox 4.3
2 parents 0f1a77f + e6e1a32 commit 23e4b2d

File tree

7 files changed

+85
-7
lines changed

7 files changed

+85
-7
lines changed

netbox_bgp/forms.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,13 @@ class BGPSessionImportForm(NetBoxModelImportForm):
352352
queryset=Device.objects.all(),
353353
to_field_name="name",
354354
help_text=_("Assigned device"),
355+
required=False,
355356
)
356357
virtualmachine = CSVModelChoiceField(
357358
queryset=VirtualMachine.objects.all(),
358359
to_field_name="name",
359360
help_text=_("Assigned virtual machine"),
361+
required=False,
360362
)
361363
status = CSVChoiceField(
362364
choices=SessionStatusChoices, required=False, help_text=_("Operational status")
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Generated by Django 5.2.4 on 2025-08-04 19:56
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('netbox_bgp', '0034_aspathlist_routingpolicyrule_match_aspath_list_and_more'),
10+
]
11+
12+
operations = [
13+
migrations.AlterModelOptions(
14+
name='aspathlist',
15+
options={'ordering': ['name']},
16+
),
17+
migrations.AlterModelOptions(
18+
name='aspathlistrule',
19+
options={'ordering': ('aspath_list', 'index')},
20+
),
21+
migrations.AlterModelOptions(
22+
name='bgppeergroup',
23+
options={'ordering': ['name']},
24+
),
25+
migrations.AlterModelOptions(
26+
name='bgpsession',
27+
options={'ordering': ['name']},
28+
),
29+
migrations.AlterModelOptions(
30+
name='community',
31+
options={'ordering': ['value']},
32+
),
33+
migrations.AlterModelOptions(
34+
name='communitylist',
35+
options={'ordering': ['name']},
36+
),
37+
migrations.AlterModelOptions(
38+
name='communitylistrule',
39+
options={'ordering': ['community_list', 'community']},
40+
),
41+
migrations.AlterModelOptions(
42+
name='prefixlist',
43+
options={'ordering': ['name']},
44+
),
45+
migrations.AlterModelOptions(
46+
name='prefixlistrule',
47+
options={'ordering': ['prefix_list', 'index']},
48+
),
49+
migrations.AlterModelOptions(
50+
name='routingpolicy',
51+
options={'ordering': ['name']},
52+
),
53+
migrations.AlterModelOptions(
54+
name='routingpolicyrule',
55+
options={'ordering': ['routing_policy', 'index']},
56+
),
57+
]

netbox_bgp/models.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class ASPathList(NetBoxModel):
2727
class Meta:
2828
verbose_name_plural = 'AS Path Lists'
2929
unique_together = ['name', 'description']
30+
ordering = ['name']
3031

3132
def __str__(self):
3233
return self.name
@@ -69,6 +70,8 @@ def get_absolute_url(self):
6970
def get_action_color(self):
7071
return ActionChoices.colors.get(self.action)
7172

73+
class Meta:
74+
ordering = ['aspath_list', 'index']
7275

7376

7477
class RoutingPolicy(NetBoxModel):
@@ -88,6 +91,7 @@ class RoutingPolicy(NetBoxModel):
8891
class Meta:
8992
verbose_name_plural = 'Routing Policies'
9093
unique_together = ['name', 'description']
94+
ordering = ['name']
9195

9296
def __str__(self):
9397
return self.name
@@ -123,6 +127,7 @@ class BGPPeerGroup(NetBoxModel):
123127
class Meta:
124128
verbose_name_plural = 'Peer Groups'
125129
unique_together = ['name', 'description']
130+
ordering = ['name']
126131

127132
def __str__(self):
128133
return self.name
@@ -180,6 +185,7 @@ class Community(BGPBase):
180185

181186
class Meta:
182187
verbose_name_plural = 'Communities'
188+
ordering = ['value']
183189

184190
def __str__(self):
185191
return self.value
@@ -208,6 +214,7 @@ class CommunityList(NetBoxModel):
208214
class Meta:
209215
verbose_name_plural = 'Community Lists'
210216
unique_together = ['name', 'description']
217+
ordering = ['name']
211218

212219
def __str__(self):
213220
return self.name
@@ -250,6 +257,9 @@ def get_absolute_url(self):
250257
def get_action_color(self):
251258
return ActionChoices.colors.get(self.action)
252259

260+
class Meta:
261+
ordering = ['community_list', 'community']
262+
253263

254264
class PrefixList(NetBoxModel):
255265
"""
@@ -272,6 +282,7 @@ class PrefixList(NetBoxModel):
272282
class Meta:
273283
verbose_name_plural = 'Prefix Lists'
274284
unique_together = ['name', 'description', 'family']
285+
ordering = ['name']
275286

276287
def __str__(self):
277288
return self.name
@@ -323,8 +334,8 @@ class PrefixListRule(NetBoxModel):
323334
)
324335

325336
class Meta:
326-
ordering = ('prefix_list', 'index')
327337
unique_together = ('prefix_list', 'index')
338+
ordering = ['prefix_list','index']
328339

329340
@property
330341
def network(self):
@@ -453,7 +464,8 @@ class BGPSession(NetBoxModel):
453464
class Meta:
454465
verbose_name_plural = 'BGP Sessions'
455466
unique_together = [['device', 'local_address', 'local_as', 'remote_address', 'remote_as'], ['virtualmachine', 'local_address', 'local_as', 'remote_address', 'remote_as']]
456-
467+
ordering = ['name']
468+
457469
def __str__(self):
458470
if self.device:
459471
return f'{self.device}:{self.name}'
@@ -535,8 +547,9 @@ class RoutingPolicyRule(NetBoxModel):
535547
)
536548

537549
class Meta:
538-
ordering = ('routing_policy', 'index')
550+
ordering = ['routing_policy', 'index']
539551
unique_together = ('routing_policy', 'index')
552+
ordering = ['routing_policy', 'index']
540553

541554
def __str__(self):
542555
return f'{self.routing_policy}: Rule {self.index}'

netbox_bgp/tables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class BGPPeerGroupTable(NetBoxTable):
152152
orderable=False
153153
)
154154
tags = TagColumn(
155-
url_name='plugins:netbox_bgp:peer_group_list'
155+
url_name='plugins:netbox_bgp:bgppeergroup_list'
156156
)
157157

158158
class Meta(NetBoxTable.Meta):

netbox_bgp/templates/netbox_bgp/prefixlistrule.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{% extends 'generic/object.html' %}
2+
{% load buttons %}
3+
{% load custom_links %}
24
{% load helpers %}
5+
{% load plugins %}
36
{% load static %}
47

58
{% block content %}

netbox_bgp/templates/netbox_bgp/routingpolicyrule.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{% extends 'generic/object.html' %}
2+
{% load buttons %}
3+
{% load custom_links %}
24
{% load helpers %}
5+
{% load plugins %}
36
{% load static %}
47

58
{% block content %}

netbox_bgp/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ class RoutingPolicyRuleListView(generic.ObjectListView):
281281
filterset = filtersets.RoutingPolicyRuleFilterSet
282282
# filterset_form = RoutingPolicyRuleFilterForm
283283
table = tables.RoutingPolicyRuleTable
284-
actions = {'add': {'add'}, 'bulk_delete': {'delete'}}
284+
actions = {'add': {'add'}, 'bulk_import': {'add'}, 'export': {'export'}, 'bulk_delete': {'delete'}}
285285

286286
@register_model_view(RoutingPolicyRule, "add", detail=False)
287287
@register_model_view(RoutingPolicyRule, "edit")
@@ -451,7 +451,7 @@ class PrefixListRuleListView(generic.ObjectListView):
451451
filterset = filtersets.PrefixListRuleFilterSet
452452
# filterset_form = RoutingPolicyRuleFilterForm
453453
table = tables.PrefixListRuleTable
454-
actions = {'add': {'add'}, 'bulk_delete': {'delete'}}
454+
actions = {'add': {'add'}, 'bulk_import': {'add'}, 'export': {'export'}, 'bulk_delete': {'delete'}}
455455

456456
@register_model_view(PrefixListRule, "add", detail=False)
457457
@register_model_view(PrefixListRule, "edit")
@@ -558,7 +558,7 @@ class ASPathListRuleListView(generic.ObjectListView):
558558
filterset = filtersets.ASPathListRuleFilterSet
559559
# filterset_form = ASPathListRuleFilterForm
560560
table = tables.ASPathListRuleTable
561-
actions = {'add': {'add'}, 'bulk_delete': {'delete'}}
561+
actions = {'add': {'add'}, 'bulk_import': {'add'}, 'export': {'export'}, 'bulk_delete': {'delete'}}
562562

563563

564564
@register_model_view(ASPathListRule, "add", detail=False)

0 commit comments

Comments
 (0)