Skip to content

Commit 721342d

Browse files
authored
Merge pull request #208 from netbox-community/develop
Release 0.13.3
2 parents e87af39 + 4dd3e3c commit 721342d

File tree

13 files changed

+88
-171
lines changed

13 files changed

+88
-171
lines changed

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ This plugin provide following Models:
1010

1111
## Compatibility
1212

13-
| | |
14-
|-------------|-----------|
15-
| NetBox 3.4 | >= 0.9.0 |
16-
| NetBox 3.5 | >= 0.10.0 |
17-
| NetBox 3.6 | >= 0.11.0 |
18-
| NetBox 3.7 | >= 0.12.0 |
19-
| NetBox 4.0 | >= 0.13.2 |
13+
| | |
14+
|---------------|-----------|
15+
| NetBox 3.4.x | >= 0.9.0 |
16+
| NetBox 3.5.x | >= 0.10.0 |
17+
| NetBox 3.6.x | >= 0.11.0 |
18+
| NetBox 3.7.x | >= 0.12.0 |
19+
| NetBox 4.0.x | >= 0.13.3 |
2020

2121
## Installation
2222

develop/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARG python_ver=3.12
22
FROM python:${python_ver}
33

4-
ARG netbox_ver=master
4+
ARG netbox_ver=v4.0.11
55
ENV PYTHONUNBUFFERED 1
66

77
RUN mkdir -p /opt
@@ -23,6 +23,6 @@ WORKDIR /source
2323
COPY . /source
2424

2525
#RUN pip install -r requirements.txt
26-
RUN python setup.py develop
26+
RUN python -m pip install --editable .
2727

2828
WORKDIR /opt/netbox/netbox/

netbox_bgp/graphql/schema.py

+10-36
Original file line numberDiff line numberDiff line change
@@ -27,58 +27,32 @@
2727
)
2828

2929

30-
@strawberry.type
30+
@strawberry.type(name="Query")
3131
class NetBoxBGPQuery:
32-
@strawberry.field
33-
def netbox_bgp_community(self, id: int) -> CommunityType:
34-
return Community.objects.get(pk=id)
3532

33+
netbox_bgp_community: CommunityType = strawberry_django.field()
3634
netbox_bgp_community_list: List[CommunityType] = strawberry_django.field()
3735

38-
@strawberry.field
39-
def netbox_bgp_session(self, id: int) -> BGPSessionType:
40-
return BGPSession.objects.get(pk=id)
41-
36+
netbox_bgp_session: BGPSessionType = strawberry_django.field()
4237
netbox_bgp_session_list: List[BGPSessionType] = strawberry_django.field()
4338

44-
@strawberry.field
45-
def netbox_bgp_peer_group(self, id: int) -> BGPPeerGroupType:
46-
return BGPPeerGroup.objects.get(pk=id)
47-
39+
netbox_bgp_peer_group: BGPPeerGroupType = strawberry_django.field()
4840
netbox_bgp_peer_group_list: List[BGPPeerGroupType] = strawberry_django.field()
4941

50-
@strawberry.field
51-
def netbox_bgp_routing_policy(self, id: int) -> RoutingPolicyType:
52-
return RoutingPolicy.objects.get(pk=id)
53-
42+
netbox_bgp_routing_policy: RoutingPolicyType = strawberry_django.field()
5443
netbox_bgp_routing_policy_list: List[RoutingPolicyType] = strawberry_django.field()
5544

56-
@strawberry.field
57-
def netbox_bgp_routing_policy_rule(self, id: int) -> RoutingPolicyRuleType:
58-
return RoutingPolicyRule.objects.get(pk=id)
59-
45+
netbox_bgp_routing_policy_rule: RoutingPolicyRuleType = strawberry_django.field()
6046
netbox_bgp_routing_policy_rule_list: List[RoutingPolicyRuleType] = strawberry_django.field()
6147

62-
@strawberry.field
63-
def netbox_bgp_prefixlist(self, id: int) -> PrefixListType:
64-
return PrefixList.objects.get(pk=id)
65-
48+
netbox_bgp_prefixlist: PrefixListType = strawberry_django.field()
6649
netbox_bgp_prefixlist_list: List[PrefixListType] = strawberry_django.field()
6750

68-
@strawberry.field
69-
def netbox_bgp_prefixlist_rule(self, id: int) -> PrefixListRuleType:
70-
return PrefixListRule.objects.get(pk=id)
71-
51+
netbox_bgp_prefixlist_rule: PrefixListRuleType = strawberry_django.field()
7252
netbox_bgp_prefixlist_rule_list: List[PrefixListRuleType] = strawberry_django.field()
7353

74-
@strawberry.field
75-
def netbox_bgp_communitylist(self, id: int) -> CommunityListType:
76-
return CommunityList.objects.get(pk=id)
77-
54+
netbox_bgp_communitylist: CommunityListType = strawberry_django.field()
7855
netbox_bgp_communitylist_list: List[CommunityListType] = strawberry_django.field()
7956

80-
@strawberry.field
81-
def netbox_bgp_communitylist_rule(self, id: int) -> CommunityListRuleType:
82-
return CommunityListRule.objects.get(pk=id)
83-
57+
netbox_bgp_communitylist_rule: CommunityListRuleType = strawberry_django.field()
8458
netbox_bgp_communitylist_rule_list: List[CommunityListRuleType] = strawberry_django.field()

netbox_bgp/graphql/types.py

+7-11
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class CommunityType(NetBoxObjectType):
3636
site: Annotated["SiteType", strawberry.lazy("dcim.graphql.types")] | None
3737
tenant: Annotated["TenantType", strawberry.lazy("tenancy.graphql.types")] | None
3838
status: str
39-
role: str
39+
role: Annotated["RoleType", strawberry.lazy("ipam.graphql.types")] | None
4040
description: str
4141

4242

@@ -45,7 +45,7 @@ class BGPSessionType(NetBoxObjectType):
4545
name: str
4646
site: Annotated["SiteType", strawberry.lazy("dcim.graphql.types")] | None
4747
tenant: Annotated["TenantType", strawberry.lazy("tenancy.graphql.types")] | None
48-
device: Annotated["DeviceType", strawberry.lazy("dcim.graphql.types")]
48+
device: Annotated["DeviceType", strawberry.lazy("dcim.graphql.types")] | None
4949
local_address: Annotated["IPAddressType", strawberry.lazy("ipam.graphql.types")]
5050
remote_address: Annotated["IPAddressType", strawberry.lazy("ipam.graphql.types")]
5151
local_as: Annotated["ASNType", strawberry.lazy("ipam.graphql.types")]
@@ -62,12 +62,8 @@ class BGPSessionType(NetBoxObjectType):
6262
export_policies: List[
6363
Annotated["RoutingPolicyType", strawberry.lazy("netbox_bgp.graphql.types")]
6464
]
65-
prefix_list_in: List[
66-
Annotated["PrefixListType", strawberry.lazy("netbox_bgp.graphql.types")]
67-
]
68-
prefix_list_out: List[
69-
Annotated["PrefixListType", strawberry.lazy("netbox_bgp.graphql.types")]
70-
]
65+
prefix_list_in: Annotated["PrefixListType", strawberry.lazy("netbox_bgp.graphql.types")] | None
66+
prefix_list_out: Annotated["PrefixListType", strawberry.lazy("netbox_bgp.graphql.types")] | None
7167

7268

7369
@strawberry_django.type(BGPPeerGroup, fields="__all__", filters=BGPPeerGroupFilter)
@@ -98,7 +94,7 @@ class RoutingPolicyRuleType(NetBoxObjectType):
9894
index: BigInt
9995
action: str
10096
description: str
101-
continue_entry: BigInt
97+
continue_entry: BigInt | None
10298
match_community: List[
10399
Annotated["CommunityType", strawberry.lazy("netbox_bgp.graphql.types")]
104100
]
@@ -127,8 +123,8 @@ class PrefixListRuleType(NetBoxObjectType):
127123
]
128124
index: BigInt
129125
action: str
130-
prefix: Annotated["PrefixType", strawberry.lazy("ipam.graphql.types")]
131-
prefix_custom: str
126+
prefix: Annotated["PrefixType", strawberry.lazy("ipam.graphql.types")] | None
127+
prefix_custom: str | None
132128
ge: BigInt
133129
le: BigInt
134130
description: str

netbox_bgp/templates/netbox_bgp/bgppeergroup.html

-14
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,6 @@
99
<li class="breadcrumb-item"><a href="{% url 'plugins:netbox_bgp:bgppeergroup_list' %}">Peer Groups</a></li>
1010
{% endblock %}
1111

12-
{% block tabs %}
13-
<ul class="nav nav-tabs px-3">
14-
{% block tab_items %}
15-
<li class="nav-item" role="presentation">
16-
<a class="nav-link{% if not active_tab %} active{% endif %}" href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a>
17-
</li>
18-
{% endblock tab_items %}
19-
{% if perms.extras.view_objectchange %}
20-
<li role="presentation" class="nav-item">
21-
<a href="{% url 'plugins:netbox_bgp:bgppeergroup_changelog' pk=object.pk %}" class="nav-link{% if active_tab == 'changelog'%} active{% endif %}">Change Log</a>
22-
</li>
23-
{% endif %}
24-
</ul>
25-
{% endblock tabs %}
2612

2713
{% block content %}
2814
<div class="row mb-3">

netbox_bgp/templates/netbox_bgp/bgpsession.html

-14
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,6 @@
99
<li class="breadcrumb-item"><a href="{% url 'plugins:netbox_bgp:bgpsession_list' %}">BGP Sessions</a></li>
1010
{% endblock %}
1111

12-
{% block tabs %}
13-
<ul class="nav nav-tabs px-3">
14-
{% block tab_items %}
15-
<li class="nav-item" role="presentation">
16-
<a class="nav-link{% if not active_tab %} active{% endif %}" href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a>
17-
</li>
18-
{% endblock tab_items %}
19-
{% if perms.extras.view_objectchange %}
20-
<li role="presentation" class="nav-item">
21-
<a href="{% url 'plugins:netbox_bgp:bgpsession_changelog' pk=object.pk %}" class="nav-link{% if active_tab == 'changelog'%} active{% endif %}">Change Log</a>
22-
</li>
23-
{% endif %}
24-
</ul>
25-
{% endblock tabs %}
2612

2713
{% block content %}
2814
<div class="row mb-3">

netbox_bgp/templates/netbox_bgp/community.html

-14
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,6 @@
88
<li class="breadcrumb-item"><a href="{% url 'plugins:netbox_bgp:community_list' %}">Communities</a></li>
99
{% endblock %}
1010

11-
{% block tabs %}
12-
<ul class="nav nav-tabs px-3">
13-
{% block tab_items %}
14-
<li class="nav-item" role="presentation">
15-
<a class="nav-link{% if not active_tab %} active{% endif %}" href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a>
16-
</li>
17-
{% endblock tab_items %}
18-
{% if perms.extras.view_objectchange %}
19-
<li role="presentation" class="nav-item">
20-
<a href="{% url 'plugins:netbox_bgp:community_changelog' pk=object.pk %}" class="nav-link{% if active_tab == 'changelog'%} active{% endif %}">Change Log</a>
21-
</li>
22-
{% endif %}
23-
</ul>
24-
{% endblock tabs %}
2511

2612
{% block content %}
2713
<div class="row mb-3">

netbox_bgp/templates/netbox_bgp/communitylist.html

-14
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@
1717
{% endif %}
1818
</div>
1919
{% endblock extra_controls %}
20-
{% block tabs %}
21-
<ul class="nav nav-tabs px-3">
22-
{% block tab_items %}
23-
<li class="nav-item" role="presentation">
24-
<a class="nav-link{% if not active_tab %} active{% endif %}" href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a>
25-
</li>
26-
{% endblock tab_items %}
27-
{% if perms.extras.view_objectchange %}
28-
<li role="presentation" class="nav-item">
29-
<a href="{% url 'plugins:netbox_bgp:communitylist_changelog' pk=object.pk %}" class="nav-link{% if active_tab == 'changelog'%} active{% endif %}">Change Log</a>
30-
</li>
31-
{% endif %}
32-
</ul>
33-
{% endblock tabs %}
3420

3521
{% block content %}
3622
<div class="row mb-3">

netbox_bgp/templates/netbox_bgp/prefixlist.html

-14
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@
1717
{% endif %}
1818
</div>
1919
{% endblock extra_controls %}
20-
{% block tabs %}
21-
<ul class="nav nav-tabs px-3">
22-
{% block tab_items %}
23-
<li class="nav-item" role="presentation">
24-
<a class="nav-link{% if not active_tab %} active{% endif %}" href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a>
25-
</li>
26-
{% endblock tab_items %}
27-
{% if perms.extras.view_objectchange %}
28-
<li role="presentation" class="nav-item">
29-
<a href="{% url 'plugins:netbox_bgp:prefixlist_changelog' pk=object.pk %}" class="nav-link{% if active_tab == 'changelog'%} active{% endif %}">Change Log</a>
30-
</li>
31-
{% endif %}
32-
</ul>
33-
{% endblock tabs %}
3420

3521
{% block content %}
3622
<div class="row mb-3">

netbox_bgp/templates/netbox_bgp/routingpolicy.html

-14
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@
1717
{% endif %}
1818
</div>
1919
{% endblock extra_controls %}
20-
{% block tabs %}
21-
<ul class="nav nav-tabs px-3">
22-
{% block tab_items %}
23-
<li class="nav-item" role="presentation">
24-
<a class="nav-link{% if not active_tab %} active{% endif %}" href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a>
25-
</li>
26-
{% endblock tab_items %}
27-
{% if perms.extras.view_objectchange %}
28-
<li role="presentation" class="nav-item">
29-
<a href="{% url 'plugins:netbox_bgp:routingpolicy_changelog' pk=object.pk %}" class="nav-link{% if active_tab == 'changelog'%} active{% endif %}">Change Log</a>
30-
</li>
31-
{% endif %}
32-
</ul>
33-
{% endblock tabs %}
3420

3521
{% block content %}
3622
<div class="row mb-3">

0 commit comments

Comments
 (0)