Skip to content

Commit

Permalink
Merge pull request #207 from netbox-community/main
Browse files Browse the repository at this point in the history
Update Develop
  • Loading branch information
cruse1977 authored Sep 20, 2024
2 parents 82e1a76 + a90bccd commit 209b391
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ __pycache__
dist
build
*.egg-info
.idea/
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @k01ek @cruse1977 @natm
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion develop/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG python_ver=3.8
ARG python_ver=3.12
FROM python:${python_ver}

ARG netbox_ver=master
Expand Down
1 change: 1 addition & 0 deletions netbox_bgp/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class Meta:
"import_policies",
"export_policies",
"comments",
"custom_fields",
]
brief_fields = ("id", "url", "display", "name", "description")

Expand Down
17 changes: 11 additions & 6 deletions netbox_bgp/choices.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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'
Expand All @@ -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'),
Expand All @@ -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):
Expand Down
5 changes: 3 additions & 2 deletions netbox_bgp/filtersets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -13,7 +14,7 @@
from dcim.models import Device, Site


class CommunityFilterSet(NetBoxModelFilterSet):
class CommunityFilterSet(NetBoxModelFilterSet, TenancyFilterSet):

class Meta:
model = Community
Expand Down Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion netbox_bgp/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.13.0"
__version__ = "0.13.2"

0 comments on commit 209b391

Please sign in to comment.