Skip to content

Commit

Permalink
Merge pull request #235 from netbox-community/develop
Browse files Browse the repository at this point in the history
Release 0.15.0
  • Loading branch information
cruse1977 authored Jan 10, 2025
2 parents 68723b5 + 5f8771e commit db12980
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 14 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/manifest-modified.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: NetBox plugin manifest modified

on:
push:
branches: [ develop ]
paths:
- netbox-plugin.yaml

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

jobs:
manifest-modified:
uses: netboxlabs/public-workflows/.github/workflows/reusable-plugin-manifest-modified.yml@release
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This plugin provide following Models:
| NetBox 3.7.x | >= 0.12.0 |
| NetBox 4.0.x | >= 0.13.3 |
| NetBox 4.1.x | >= 0.14.0 |
| NetBox 4.2.x | 0.15.x |

## Installation

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

ARG netbox_ver=v4.1.3
ARG netbox_ver=v4.2.1
ENV PYTHONUNBUFFERED 1

RUN mkdir -p /opt
Expand Down
15 changes: 15 additions & 0 deletions netbox-plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 0.1
package_name: netbox-bgp
compatibility:
- release: 0.15.0
netbox_min: 4.2.0
netbox_max: 4.2.1
- release: 0.14.0
netbox_min: 4.1.0
netbox_max: 4.1.11
- release: 0.13.3
netbox_min: 4.0.9
netbox_max: 4.0.11
- release: 0.13.2
netbox_min: 4.0.0
netbox_max: 4.0.9
4 changes: 2 additions & 2 deletions netbox_bgp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class BGPConfig(PluginConfig):
author_email = '[email protected]'
base_url = 'bgp'
required_settings = []
min_version = '4.1.0'
max_version = '4.1.99'
min_version = '4.2.0'
max_version = '4.2.99'
default_settings = {
'device_ext_page': 'right',
'top_level_menu' : False,
Expand Down
2 changes: 2 additions & 0 deletions netbox_bgp/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ class RoutingPolicyRuleSerializer(NetBoxModelSerializer):
many=True,
)
routing_policy = RoutingPolicySerializer(nested=True)

match_community = SerializedPKRelatedField(
queryset=Community.objects.all(),
serializer=CommunitySerializer,
Expand Down Expand Up @@ -293,6 +294,7 @@ class Meta:
"set_actions",
"match_ipv6_address",
"description",
"continue_entry",
"tags",
"custom_fields",
"comments",
Expand Down
29 changes: 22 additions & 7 deletions netbox_bgp/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
CSVChoiceField,
CommentField,
)
from utilities.forms import add_blank_choice
from utilities.forms.widgets import APISelect, APISelectMultiple
from netbox.forms import (
NetBoxModelForm,
NetBoxModelBulkEditForm,
NetBoxModelFilterSetForm,
NetBoxModelImportForm,
)
from .choices import SessionStatusChoices

from .models import (
Community,
Expand Down Expand Up @@ -206,6 +208,7 @@ class BGPSessionForm(NetBoxModelForm):
)
comments = CommentField()


fieldsets = (
FieldSet(
"name",
Expand Down Expand Up @@ -424,10 +427,11 @@ class BGPSessionBulkEditForm(NetBoxModelBulkEditForm):
site = DynamicModelChoiceField(
label=_("Site"), queryset=Site.objects.all(), required=False
)

status = forms.ChoiceField(
label=_("Status"),
required=False,
choices=SessionStatusChoices,
label=_('Status'),
choices=add_blank_choice(SessionStatusChoices),
required=False
)
description = forms.CharField(
label=_("Description"), max_length=200, required=False
Expand Down Expand Up @@ -604,12 +608,21 @@ class RoutingPolicyRuleForm(NetBoxModelForm):
queryset=CommunityList.objects.all(),
required=False,
)
match_ip_address = forms.MultipleChoiceField(
choices=[], required=False, label="Match IPv4 address Prefix lists"

match_ip_address = DynamicModelMultipleChoiceField(
queryset=PrefixList.objects.all(),
required=False,
query_params={
'family': 'ipv4'
}
)

match_ipv6_address = forms.MultipleChoiceField(
choices=[], required=False, label="Match IPv6 address Prefix lists"
match_ipv6_address = DynamicModelMultipleChoiceField(
queryset=PrefixList.objects.all(),
required=False,
query_params={
'family': 'ipv6'
}
)

match_custom = forms.JSONField(
Expand All @@ -627,13 +640,15 @@ class RoutingPolicyRuleForm(NetBoxModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
instance = kwargs.get("instance", {})
'''
if instance:
_prefix_v4 = PrefixList.objects.filter(family="ipv4")
_prefix_v6 = PrefixList.objects.filter(family="ipv6")
prefix_v4 = list(set([(prefix.id, prefix.name) for prefix in _prefix_v4]))
prefix_v6 = list(set([(prefix.id, prefix.name) for prefix in _prefix_v6]))
self.fields["match_ip_address"].choices = prefix_v4
self.fields["match_ipv6_address"].choices = prefix_v6
'''

class Meta:
model = RoutingPolicyRule
Expand Down
13 changes: 11 additions & 2 deletions netbox_bgp/graphql/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ class BGPPeerGroupType(NetBoxObjectType):
class RoutingPolicyType(NetBoxObjectType):
name: str
description: str
rules: List[
Annotated["RoutingPolicyRuleType", strawberry.lazy("netbox_bgp.graphql.types")]
]


@strawberry_django.type(
Expand All @@ -102,10 +105,10 @@ class RoutingPolicyRuleType(NetBoxObjectType):
Annotated["CommunityListType", strawberry.lazy("netbox_bgp.graphql.types")]
]
match_ip_address: List[
Annotated["PrefixType", strawberry.lazy("ipam.graphql.types")]
Annotated["PrefixListType", strawberry.lazy("netbox_bgp.graphql.types")]
]
match_ipv6_address: List[
Annotated["PrefixType", strawberry.lazy("ipam.graphql.types")]
Annotated["PrefixListType", strawberry.lazy("netbox_bgp.graphql.types")]
]


Expand All @@ -114,6 +117,9 @@ class PrefixListType(NetBoxObjectType):
name: str
description: str
family: str
prefrules: List[
Annotated["PrefixListRuleType", strawberry.lazy("netbox_bgp.graphql.types")]
]


@strawberry_django.type(PrefixListRule, fields="__all__", filters=PrefixListRuleFilter)
Expand All @@ -134,6 +140,9 @@ class PrefixListRuleType(NetBoxObjectType):
class CommunityListType(NetBoxObjectType):
name: str
description: str
commlistrules: List[
Annotated["CommunityListRuleType", strawberry.lazy("netbox_bgp.graphql.types")]
]


@strawberry_django.type(
Expand Down
2 changes: 1 addition & 1 deletion netbox_bgp/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class Meta(NetBoxTable.Meta):
model = RoutingPolicyRule
fields = (
'pk', 'routing_policy', 'index', 'match_statements',
'set_statements', 'action', 'description'
'set_statements', 'action', 'description', 'continue_entry'
)


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.14.0"
__version__ = "0.15.0"

0 comments on commit db12980

Please sign in to comment.