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 diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..1d3b141 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @k01ek @cruse1977 @natm 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/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 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") diff --git a/netbox_bgp/choices.py b/netbox_bgp/choices.py index d804e52..03d849e 100644 --- a/netbox_bgp/choices.py +++ b/netbox_bgp/choices.py @@ -2,34 +2,37 @@ class CommunityStatusChoices(ChoiceSet): + key = "Community.status" STATUS_ACTIVE = 'active' STATUS_RESERVED = 'reserved' STATUS_DEPRECATED = 'deprecated' - CHOICES = ( + CHOICES = [ (STATUS_ACTIVE, 'Active', 'blue'), (STATUS_RESERVED, 'Reserved', 'cyan'), (STATUS_DEPRECATED, 'Deprecated', 'red'), - ) + ] class SessionStatusChoices(ChoiceSet): + key = "Session.status" STATUS_OFFLINE = 'offline' STATUS_ACTIVE = 'active' 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): + 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' @@ -57,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'), @@ -71,7 +76,7 @@ class AFISAFIChoices(ChoiceSet): (AFISAFI_VPNV6_UNICAST, 'VPNv6 Unicast'), (AFISAFI_VPNV6_MULTICAST, 'VPNv6 Multicast'), (AFISAFI_VPNV6_FLOWSPEC, 'VPNv6 Flowspec') - ) + ] class IPAddressFamilyChoices(ChoiceSet): 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 f23a6b3..83ce76f 100644 --- a/netbox_bgp/version.py +++ b/netbox_bgp/version.py @@ -1 +1 @@ -__version__ = "0.13.0" +__version__ = "0.13.2"