From 47cafc3198ced3ca1b4c6b93c407af9049c6bd40 Mon Sep 17 00:00:00 2001 From: Nat Morris Date: Thu, 16 May 2024 10:09:47 +0100 Subject: [PATCH 1/8] chore: BIZ-3 add Jetbrains .idea ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 04b3846..436880d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ __pycache__ dist build *.egg-info +.idea/ \ No newline at end of file From a17200cca78d9d042929b81105d8c0325a51b24c Mon Sep 17 00:00:00 2001 From: Nat Morris Date: Thu, 16 May 2024 10:10:27 +0100 Subject: [PATCH 2/8] feat: BIZ-3 ChoiceSet keys for choices apart from IP family --- netbox_bgp/choices.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/netbox_bgp/choices.py b/netbox_bgp/choices.py index d804e52..612d6b6 100644 --- a/netbox_bgp/choices.py +++ b/netbox_bgp/choices.py @@ -2,6 +2,7 @@ class CommunityStatusChoices(ChoiceSet): + key = "Community.status" STATUS_ACTIVE = 'active' STATUS_RESERVED = 'reserved' @@ -15,6 +16,7 @@ class CommunityStatusChoices(ChoiceSet): class SessionStatusChoices(ChoiceSet): + key = "Session.status" STATUS_OFFLINE = 'offline' STATUS_ACTIVE = 'active' @@ -30,6 +32,7 @@ class SessionStatusChoices(ChoiceSet): class ActionChoices(ChoiceSet): + key = "Action.status" CHOICES = [ ('permit', 'Permit', 'green'), @@ -38,6 +41,8 @@ class ActionChoices(ChoiceSet): class AFISAFIChoices(ChoiceSet): + key = "AFISAFI.options" + AFISAFI_IPV4_UNICAST = 'ipv4-unicast' AFISAFI_IPV4_MULTICAST = 'ipv4-multicast' AFISAFI_IPV4_FLOWSPEC = 'ipv4-flowspec' From 74775f0f8cd24d5ffe0142fdb821c6bc1bb07f37 Mon Sep 17 00:00:00 2001 From: Chris Russell Date: Thu, 16 May 2024 11:14:43 +0100 Subject: [PATCH 3/8] Update Choicesets to lists - required for keys --- netbox_bgp/choices.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/netbox_bgp/choices.py b/netbox_bgp/choices.py index 612d6b6..03d849e 100644 --- a/netbox_bgp/choices.py +++ b/netbox_bgp/choices.py @@ -8,11 +8,11 @@ class CommunityStatusChoices(ChoiceSet): STATUS_RESERVED = 'reserved' STATUS_DEPRECATED = 'deprecated' - CHOICES = ( + CHOICES = [ (STATUS_ACTIVE, 'Active', 'blue'), (STATUS_RESERVED, 'Reserved', 'cyan'), (STATUS_DEPRECATED, 'Deprecated', 'red'), - ) + ] class SessionStatusChoices(ChoiceSet): @@ -23,12 +23,12 @@ class SessionStatusChoices(ChoiceSet): STATUS_PLANNED = 'planned' STATUS_FAILED = 'failed' - CHOICES = ( + CHOICES = [ (STATUS_OFFLINE, 'Offline', 'orange'), (STATUS_ACTIVE, 'Active', 'green'), (STATUS_PLANNED, 'Planned', 'cyan'), (STATUS_FAILED, 'Failed', 'red'), - ) + ] class ActionChoices(ChoiceSet): @@ -62,7 +62,7 @@ class AFISAFIChoices(ChoiceSet): AFISAFI_VPNV6_MULTICAST = 'vpnv6-multicast' AFISAFI_VPNV6_FLOWSPEC = 'vpnv6-flowspec' - CHOICES = ( + CHOICES = [ (AFISAFI_IPV4_UNICAST, 'IPv4 Unicast'), (AFISAFI_IPV4_MULTICAST, 'IPv4 Multicast'), (AFISAFI_IPV4_FLOWSPEC, 'IPv4 Flowspec'), @@ -76,7 +76,7 @@ class AFISAFIChoices(ChoiceSet): (AFISAFI_VPNV6_UNICAST, 'VPNv6 Unicast'), (AFISAFI_VPNV6_MULTICAST, 'VPNv6 Multicast'), (AFISAFI_VPNV6_FLOWSPEC, 'VPNv6 Flowspec') - ) + ] class IPAddressFamilyChoices(ChoiceSet): From 964d590f3146e6a7a5316720ec7c8008cc801ba4 Mon Sep 17 00:00:00 2001 From: Chris Russell Date: Thu, 16 May 2024 11:18:08 +0100 Subject: [PATCH 4/8] Minor version bump --- netbox_bgp/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox_bgp/version.py b/netbox_bgp/version.py index f23a6b3..7e0dc0e 100644 --- a/netbox_bgp/version.py +++ b/netbox_bgp/version.py @@ -1 +1 @@ -__version__ = "0.13.0" +__version__ = "0.13.1" From 153257056bab83dafe15ef1e983f1a015b292368 Mon Sep 17 00:00:00 2001 From: Chris Russell Date: Thu, 16 May 2024 11:32:48 +0100 Subject: [PATCH 5/8] version bump in develop/Dockerfile to python 3.12 --- develop/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/develop/Dockerfile b/develop/Dockerfile index f15dc4c..a2c56d2 100644 --- a/develop/Dockerfile +++ b/develop/Dockerfile @@ -1,4 +1,4 @@ -ARG python_ver=3.8 +ARG python_ver=3.12 FROM python:${python_ver} ARG netbox_ver=master From 3b0b5fb1b3bba8b80f3467884490f1497c56e78d Mon Sep 17 00:00:00 2001 From: Chris Russell Date: Fri, 17 May 2024 10:39:59 +0100 Subject: [PATCH 6/8] Fixes: #180 - add TenancyFilterset to Tenant filtered models --- README.md | 2 +- netbox_bgp/filtersets.py | 5 +++-- netbox_bgp/version.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c4c58f3..371a6f4 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This plugin provide following Models: | NetBox 3.5 | >= 0.10.0 | | NetBox 3.6 | >= 0.11.0 | | NetBox 3.7 | >= 0.12.0 | -| NetBox 4.0 | >= 0.13.0 | +| NetBox 4.0 | >= 0.13.2 | ## Installation diff --git a/netbox_bgp/filtersets.py b/netbox_bgp/filtersets.py index b12b6ff..ae4b0a1 100644 --- a/netbox_bgp/filtersets.py +++ b/netbox_bgp/filtersets.py @@ -3,6 +3,7 @@ from django.db.models import Q from netaddr.core import AddrFormatError from netbox.filtersets import NetBoxModelFilterSet +from tenancy.filtersets import TenancyFilterSet from .models import ( Community, BGPSession, RoutingPolicy, RoutingPolicyRule, @@ -13,7 +14,7 @@ from dcim.models import Device, Site -class CommunityFilterSet(NetBoxModelFilterSet): +class CommunityFilterSet(NetBoxModelFilterSet, TenancyFilterSet): class Meta: model = Community @@ -65,7 +66,7 @@ def search(self, queryset, name, value): return queryset.filter(qs_filter) -class BGPSessionFilterSet(NetBoxModelFilterSet): +class BGPSessionFilterSet(NetBoxModelFilterSet, TenancyFilterSet): remote_as = django_filters.ModelMultipleChoiceFilter( field_name='remote_as__asn', diff --git a/netbox_bgp/version.py b/netbox_bgp/version.py index 7e0dc0e..83ce76f 100644 --- a/netbox_bgp/version.py +++ b/netbox_bgp/version.py @@ -1 +1 @@ -__version__ = "0.13.1" +__version__ = "0.13.2" From 97697aaa42d905fbe511c8d442ae15706b16864e Mon Sep 17 00:00:00 2001 From: Nat Morris Date: Fri, 17 May 2024 16:13:39 +0100 Subject: [PATCH 7/8] chore: Create CODEOWNERS --- CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..1d3b141 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @k01ek @cruse1977 @natm From 2a82e9f52851f6b100c73caf1893161e6ce4f66e Mon Sep 17 00:00:00 2001 From: pl0xym0r <148605740+pl0xym0r@users.noreply.github.com> Date: Mon, 12 Aug 2024 10:55:30 +0000 Subject: [PATCH 8/8] adding custom fields on peer group serializer --- netbox_bgp/api/serializers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/netbox_bgp/api/serializers.py b/netbox_bgp/api/serializers.py index 4402b7e..bace27a 100644 --- a/netbox_bgp/api/serializers.py +++ b/netbox_bgp/api/serializers.py @@ -93,6 +93,7 @@ class Meta: "import_policies", "export_policies", "comments", + "custom_fields", ] brief_fields = ("id", "url", "display", "name", "description")