netbox-plugin-dhcp 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- netbox_plugin_dhcp-0.0.1/PKG-INFO +9 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/__init__.py +24 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/api/nested_serializers.py +0 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/api/serializers.py +11 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/api/serializers_/client_class.py +33 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/api/serializers_/ddns.py +33 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/api/serializers_/dhcp_cluster.py +33 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/api/serializers_/dhcp_server.py +33 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/api/serializers_/host_reservation.py +33 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/api/serializers_/option.py +33 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/api/serializers_/pd_pool.py +33 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/api/serializers_/shared_network.py +33 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/api/serializers_/subnet.py +33 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/api/urls.py +29 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/api/views.py +96 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/apps.py +6 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/filtersets/__init__.py +9 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/filtersets/client_class.py +25 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/filtersets/ddns.py +25 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/filtersets/dhcp_cluster.py +25 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/filtersets/dhcp_server.py +25 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/filtersets/host_reservation.py +25 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/filtersets/option.py +25 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/filtersets/pd_pool.py +25 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/filtersets/shared_network.py +25 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/filtersets/subnet.py +25 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/forms/__init__.py +9 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/forms/client_class.py +100 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/forms/ddns.py +100 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/forms/dhcp_cluster.py +100 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/forms/dhcp_server.py +100 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/forms/host_reservation.py +100 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/forms/option.py +100 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/forms/pd_pool.py +100 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/forms/shared_network.py +100 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/forms/subnet.py +100 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/migrations/0001_initial.py +378 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/migrations/__init__.py +0 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/models/__init__.py +9 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/models/client_class.py +44 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/models/ddns.py +44 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/models/dhcp_cluster.py +44 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/models/dhcp_server.py +44 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/models/host_reservation.py +44 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/models/option.py +44 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/models/pd_pool.py +44 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/models/shared_network.py +44 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/models/subnet.py +44 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/navigation.py +193 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/tables/__init__.py +9 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/tables/client_class.py +27 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/tables/ddns.py +27 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/tables/dhcp_cluster.py +27 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/tables/dhcp_server.py +27 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/tables/host_reservation.py +27 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/tables/option.py +27 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/tables/pd_pool.py +27 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/tables/shared_network.py +27 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/tables/subnet.py +27 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/templates/netbox_dhcp/client_class.html +28 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/templates/netbox_dhcp/ddns.html +28 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/templates/netbox_dhcp/dhcpcluster.html +28 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/templates/netbox_dhcp/dhcpserver.html +28 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/templates/netbox_dhcp/hostreservation.html +28 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/templates/netbox_dhcp/option.html +28 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/templates/netbox_dhcp/pdpool.html +28 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/templates/netbox_dhcp/sharednetwork.html +28 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/templates/netbox_dhcp/subnet.html +28 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/urls.py +86 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/views/__init__.py +9 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/views/client_class.py +71 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/views/ddns.py +71 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/views/dhcp_cluster.py +71 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/views/dhcp_server.py +71 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/views/host_reservation.py +71 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/views/option.py +71 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/views/pd_pool.py +71 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/views/shared_network.py +71 -0
- netbox_plugin_dhcp-0.0.1/netbox_dhcp/views/subnet.py +71 -0
- netbox_plugin_dhcp-0.0.1/netbox_plugin_dhcp.egg-info/PKG-INFO +9 -0
- netbox_plugin_dhcp-0.0.1/netbox_plugin_dhcp.egg-info/SOURCES.txt +83 -0
- netbox_plugin_dhcp-0.0.1/netbox_plugin_dhcp.egg-info/dependency_links.txt +1 -0
- netbox_plugin_dhcp-0.0.1/netbox_plugin_dhcp.egg-info/top_level.txt +2 -0
- netbox_plugin_dhcp-0.0.1/pyproject.toml +33 -0
- netbox_plugin_dhcp-0.0.1/setup.cfg +4 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: netbox-plugin-dhcp
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: NetBox DHCP is a NetBox plugin for DHCP data.
|
|
5
|
+
Author-email: Peter Eckel <pe@sys4.de>
|
|
6
|
+
Keywords: netbox,netbox-plugin,dhcp
|
|
7
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from django.utils.translation import gettext_lazy as _
|
|
2
|
+
|
|
3
|
+
from netbox.plugins import PluginConfig
|
|
4
|
+
|
|
5
|
+
__version__ = "0.0.1"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class DHCPConfig(PluginConfig):
|
|
9
|
+
name = "netbox_dhcp"
|
|
10
|
+
verbose_name = _("NetBox DHCP")
|
|
11
|
+
description = _("NetBox plugin for DHCP")
|
|
12
|
+
min_version = "4.3.7"
|
|
13
|
+
version = __version__
|
|
14
|
+
author = "Peter Eckel, sys4 AG"
|
|
15
|
+
author_email = "pe@sys4.de"
|
|
16
|
+
required_settings = []
|
|
17
|
+
default_settings = {}
|
|
18
|
+
base_url = "netbox-dhcp"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
#
|
|
22
|
+
# Initialize plugin config
|
|
23
|
+
#
|
|
24
|
+
config = DHCPConfig
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from .serializers_.client_class import *
|
|
2
|
+
from .serializers_.ddns import *
|
|
3
|
+
from .serializers_.dhcp_cluster import *
|
|
4
|
+
from .serializers_.dhcp_server import *
|
|
5
|
+
from .serializers_.host_reservation import *
|
|
6
|
+
from .serializers_.option import *
|
|
7
|
+
from .serializers_.pd_pool import *
|
|
8
|
+
from .serializers_.shared_network import *
|
|
9
|
+
from .serializers_.subnet import *
|
|
10
|
+
|
|
11
|
+
from .nested_serializers import *
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.models import ClientClass
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("ClientClassSerializer",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ClientClassSerializer(NetBoxModelSerializer):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = ClientClass
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"url",
|
|
18
|
+
"display",
|
|
19
|
+
"name",
|
|
20
|
+
"description",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
brief_fields = (
|
|
24
|
+
"id",
|
|
25
|
+
"url",
|
|
26
|
+
"display",
|
|
27
|
+
"name",
|
|
28
|
+
"description",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
url = serializers.HyperlinkedIdentityField(
|
|
32
|
+
view_name="plugins-api:netbox_dhcp-api:clientclass-detail"
|
|
33
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.models import DDNS
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("DDNSSerializer",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class DDNSSerializer(NetBoxModelSerializer):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = DDNS
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"url",
|
|
18
|
+
"display",
|
|
19
|
+
"name",
|
|
20
|
+
"description",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
brief_fields = (
|
|
24
|
+
"id",
|
|
25
|
+
"url",
|
|
26
|
+
"display",
|
|
27
|
+
"name",
|
|
28
|
+
"description",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
url = serializers.HyperlinkedIdentityField(
|
|
32
|
+
view_name="plugins-api:netbox_dhcp-api:ddns-detail"
|
|
33
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.models import DHCPCluster
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("DHCPClusterSerializer",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class DHCPClusterSerializer(NetBoxModelSerializer):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = DHCPCluster
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"url",
|
|
18
|
+
"display",
|
|
19
|
+
"name",
|
|
20
|
+
"description",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
brief_fields = (
|
|
24
|
+
"id",
|
|
25
|
+
"url",
|
|
26
|
+
"display",
|
|
27
|
+
"name",
|
|
28
|
+
"description",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
url = serializers.HyperlinkedIdentityField(
|
|
32
|
+
view_name="plugins-api:netbox_dhcp-api:dhcpcluster-detail"
|
|
33
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.models import DHCPServer
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("DHCPServerSerializer",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class DHCPServerSerializer(NetBoxModelSerializer):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = DHCPServer
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"url",
|
|
18
|
+
"display",
|
|
19
|
+
"name",
|
|
20
|
+
"description",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
brief_fields = (
|
|
24
|
+
"id",
|
|
25
|
+
"url",
|
|
26
|
+
"display",
|
|
27
|
+
"name",
|
|
28
|
+
"description",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
url = serializers.HyperlinkedIdentityField(
|
|
32
|
+
view_name="plugins-api:netbox_dhcp-api:dhcpserver-detail"
|
|
33
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.models import HostReservation
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("HostReservationSerializer",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class HostReservationSerializer(NetBoxModelSerializer):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = HostReservation
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"url",
|
|
18
|
+
"display",
|
|
19
|
+
"name",
|
|
20
|
+
"description",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
brief_fields = (
|
|
24
|
+
"id",
|
|
25
|
+
"url",
|
|
26
|
+
"display",
|
|
27
|
+
"name",
|
|
28
|
+
"description",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
url = serializers.HyperlinkedIdentityField(
|
|
32
|
+
view_name="plugins-api:netbox_dhcp-api:hostreservation-detail"
|
|
33
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.models import Option
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("OptionSerializer",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class OptionSerializer(NetBoxModelSerializer):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = Option
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"url",
|
|
18
|
+
"display",
|
|
19
|
+
"name",
|
|
20
|
+
"description",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
brief_fields = (
|
|
24
|
+
"id",
|
|
25
|
+
"url",
|
|
26
|
+
"display",
|
|
27
|
+
"name",
|
|
28
|
+
"description",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
url = serializers.HyperlinkedIdentityField(
|
|
32
|
+
view_name="plugins-api:netbox_dhcp-api:option-detail"
|
|
33
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.models import PDPool
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("PDPoolSerializer",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class PDPoolSerializer(NetBoxModelSerializer):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = PDPool
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"url",
|
|
18
|
+
"display",
|
|
19
|
+
"name",
|
|
20
|
+
"description",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
brief_fields = (
|
|
24
|
+
"id",
|
|
25
|
+
"url",
|
|
26
|
+
"display",
|
|
27
|
+
"name",
|
|
28
|
+
"description",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
url = serializers.HyperlinkedIdentityField(
|
|
32
|
+
view_name="plugins-api:netbox_dhcp-api:pdpool-detail"
|
|
33
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.models import SharedNetwork
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("SharedNetworkSerializer",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SharedNetworkSerializer(NetBoxModelSerializer):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = SharedNetwork
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"url",
|
|
18
|
+
"display",
|
|
19
|
+
"name",
|
|
20
|
+
"description",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
brief_fields = (
|
|
24
|
+
"id",
|
|
25
|
+
"url",
|
|
26
|
+
"display",
|
|
27
|
+
"name",
|
|
28
|
+
"description",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
url = serializers.HyperlinkedIdentityField(
|
|
32
|
+
view_name="plugins-api:netbox_dhcp-api:sharednetwork-detail"
|
|
33
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from rest_framework import serializers
|
|
2
|
+
|
|
3
|
+
from netbox.api.serializers import NetBoxModelSerializer
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.models import Subnet
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("SubnetSerializer",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SubnetSerializer(NetBoxModelSerializer):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = Subnet
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"url",
|
|
18
|
+
"display",
|
|
19
|
+
"name",
|
|
20
|
+
"description",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
brief_fields = (
|
|
24
|
+
"id",
|
|
25
|
+
"url",
|
|
26
|
+
"display",
|
|
27
|
+
"name",
|
|
28
|
+
"description",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
url = serializers.HyperlinkedIdentityField(
|
|
32
|
+
view_name="plugins-api:netbox_dhcp-api:subnet-detail"
|
|
33
|
+
)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from netbox.api.routers import NetBoxRouter
|
|
2
|
+
|
|
3
|
+
from netbox_dhcp.api.views import (
|
|
4
|
+
NetBoxDHCPRootView,
|
|
5
|
+
ClientClassViewSet,
|
|
6
|
+
DDNSViewSet,
|
|
7
|
+
DHCPClusterViewSet,
|
|
8
|
+
DHCPServerViewSet,
|
|
9
|
+
HostReservationViewSet,
|
|
10
|
+
OptionViewSet,
|
|
11
|
+
PDPoolViewSet,
|
|
12
|
+
SharedNetworkViewSet,
|
|
13
|
+
SubnetViewSet,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
router = NetBoxRouter()
|
|
17
|
+
router.APIRootView = NetBoxDHCPRootView
|
|
18
|
+
|
|
19
|
+
router.register("clientclasses", ClientClassViewSet)
|
|
20
|
+
router.register("ddns", DDNSViewSet)
|
|
21
|
+
router.register("dhcpclusters", DHCPClusterViewSet)
|
|
22
|
+
router.register("dhcpservers", DHCPServerViewSet)
|
|
23
|
+
router.register("hostreservations", HostReservationViewSet)
|
|
24
|
+
router.register("options", OptionViewSet)
|
|
25
|
+
router.register("pdpools", PDPoolViewSet)
|
|
26
|
+
router.register("sharednetworks", SharedNetworkViewSet)
|
|
27
|
+
router.register("subnets", SubnetViewSet)
|
|
28
|
+
|
|
29
|
+
urlpatterns = router.urls
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
from rest_framework.routers import APIRootView
|
|
2
|
+
|
|
3
|
+
from netbox.api.viewsets import NetBoxModelViewSet
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.api.serializers import (
|
|
6
|
+
ClientClassSerializer,
|
|
7
|
+
DDNSSerializer,
|
|
8
|
+
DHCPClusterSerializer,
|
|
9
|
+
DHCPServerSerializer,
|
|
10
|
+
HostReservationSerializer,
|
|
11
|
+
OptionSerializer,
|
|
12
|
+
PDPoolSerializer,
|
|
13
|
+
SharedNetworkSerializer,
|
|
14
|
+
SubnetSerializer,
|
|
15
|
+
)
|
|
16
|
+
from netbox_dhcp.filtersets import (
|
|
17
|
+
ClientClassFilterSet,
|
|
18
|
+
DDNSFilterSet,
|
|
19
|
+
DHCPClusterFilterSet,
|
|
20
|
+
DHCPServerFilterSet,
|
|
21
|
+
HostReservationFilterSet,
|
|
22
|
+
OptionFilterSet,
|
|
23
|
+
PDPoolFilterSet,
|
|
24
|
+
SharedNetworkFilterSet,
|
|
25
|
+
SubnetFilterSet,
|
|
26
|
+
)
|
|
27
|
+
from netbox_dhcp.models import (
|
|
28
|
+
ClientClass,
|
|
29
|
+
DDNS,
|
|
30
|
+
DHCPCluster,
|
|
31
|
+
DHCPServer,
|
|
32
|
+
HostReservation,
|
|
33
|
+
Option,
|
|
34
|
+
PDPool,
|
|
35
|
+
SharedNetwork,
|
|
36
|
+
Subnet,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class NetBoxDHCPRootView(APIRootView):
|
|
41
|
+
def get_view_name(self):
|
|
42
|
+
return "NetBoxDHCP"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class ClientClassViewSet(NetBoxModelViewSet):
|
|
46
|
+
queryset = ClientClass.objects.all()
|
|
47
|
+
serializer_class = ClientClassSerializer
|
|
48
|
+
filterset_class = ClientClassFilterSet
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class DDNSViewSet(NetBoxModelViewSet):
|
|
52
|
+
queryset = DDNS.objects.all()
|
|
53
|
+
serializer_class = DDNSSerializer
|
|
54
|
+
filterset_class = DDNSFilterSet
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class DHCPClusterViewSet(NetBoxModelViewSet):
|
|
58
|
+
queryset = DHCPCluster.objects.all()
|
|
59
|
+
serializer_class = DHCPClusterSerializer
|
|
60
|
+
filterset_class = DHCPClusterFilterSet
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class DHCPServerViewSet(NetBoxModelViewSet):
|
|
64
|
+
queryset = DHCPServer.objects.all()
|
|
65
|
+
serializer_class = DHCPServerSerializer
|
|
66
|
+
filterset_class = DHCPServerFilterSet
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class HostReservationViewSet(NetBoxModelViewSet):
|
|
70
|
+
queryset = HostReservation.objects.all()
|
|
71
|
+
serializer_class = HostReservationSerializer
|
|
72
|
+
filterset_class = HostReservationFilterSet
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class OptionViewSet(NetBoxModelViewSet):
|
|
76
|
+
queryset = Option.objects.all()
|
|
77
|
+
serializer_class = OptionSerializer
|
|
78
|
+
filterset_class = OptionFilterSet
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class PDPoolViewSet(NetBoxModelViewSet):
|
|
82
|
+
queryset = PDPool.objects.all()
|
|
83
|
+
serializer_class = PDPoolSerializer
|
|
84
|
+
filterset_class = PDPoolFilterSet
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class SharedNetworkViewSet(NetBoxModelViewSet):
|
|
88
|
+
queryset = SharedNetwork.objects.all()
|
|
89
|
+
serializer_class = SharedNetworkSerializer
|
|
90
|
+
filterset_class = SharedNetworkFilterSet
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class SubnetViewSet(NetBoxModelViewSet):
|
|
94
|
+
queryset = Subnet.objects.all()
|
|
95
|
+
serializer_class = SubnetSerializer
|
|
96
|
+
filterset_class = SubnetFilterSet
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from django.db.models import Q
|
|
2
|
+
|
|
3
|
+
from netbox.filtersets import NetBoxModelFilterSet
|
|
4
|
+
|
|
5
|
+
from ..models import ClientClass
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("ClientClassFilterSet",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ClientClassFilterSet(NetBoxModelFilterSet):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = ClientClass
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"name",
|
|
18
|
+
"description",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
def search(self, queryset, name, value):
|
|
22
|
+
if not value.strip():
|
|
23
|
+
return queryset
|
|
24
|
+
qs_filter = Q(name__icontains=value)
|
|
25
|
+
return queryset.filter(qs_filter)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from django.db.models import Q
|
|
2
|
+
|
|
3
|
+
from netbox.filtersets import NetBoxModelFilterSet
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.models import DDNS
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("DDNSFilterSet",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class DDNSFilterSet(NetBoxModelFilterSet):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = DDNS
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"name",
|
|
18
|
+
"description",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
def search(self, queryset, name, value):
|
|
22
|
+
if not value.strip():
|
|
23
|
+
return queryset
|
|
24
|
+
qs_filter = Q(name__icontains=value)
|
|
25
|
+
return queryset.filter(qs_filter)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from django.db.models import Q
|
|
2
|
+
|
|
3
|
+
from netbox.filtersets import NetBoxModelFilterSet
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.models import DHCPCluster
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("DHCPClusterFilterSet",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class DHCPClusterFilterSet(NetBoxModelFilterSet):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = DHCPCluster
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"name",
|
|
18
|
+
"description",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
def search(self, queryset, name, value):
|
|
22
|
+
if not value.strip():
|
|
23
|
+
return queryset
|
|
24
|
+
qs_filter = Q(name__icontains=value)
|
|
25
|
+
return queryset.filter(qs_filter)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from django.db.models import Q
|
|
2
|
+
|
|
3
|
+
from netbox.filtersets import NetBoxModelFilterSet
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.models import DHCPServer
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("DHCPServerFilterSet",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class DHCPServerFilterSet(NetBoxModelFilterSet):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = DHCPServer
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"name",
|
|
18
|
+
"description",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
def search(self, queryset, name, value):
|
|
22
|
+
if not value.strip():
|
|
23
|
+
return queryset
|
|
24
|
+
qs_filter = Q(name__icontains=value)
|
|
25
|
+
return queryset.filter(qs_filter)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from django.db.models import Q
|
|
2
|
+
|
|
3
|
+
from netbox.filtersets import NetBoxModelFilterSet
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.models import HostReservation
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("HostReservationFilterSet",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class HostReservationFilterSet(NetBoxModelFilterSet):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = HostReservation
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"name",
|
|
18
|
+
"description",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
def search(self, queryset, name, value):
|
|
22
|
+
if not value.strip():
|
|
23
|
+
return queryset
|
|
24
|
+
qs_filter = Q(name__icontains=value)
|
|
25
|
+
return queryset.filter(qs_filter)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from django.db.models import Q
|
|
2
|
+
|
|
3
|
+
from netbox.filtersets import NetBoxModelFilterSet
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.models import Option
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("OptionFilterSet",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class OptionFilterSet(NetBoxModelFilterSet):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = Option
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"name",
|
|
18
|
+
"description",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
def search(self, queryset, name, value):
|
|
22
|
+
if not value.strip():
|
|
23
|
+
return queryset
|
|
24
|
+
qs_filter = Q(name__icontains=value)
|
|
25
|
+
return queryset.filter(qs_filter)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from django.db.models import Q
|
|
2
|
+
|
|
3
|
+
from netbox.filtersets import NetBoxModelFilterSet
|
|
4
|
+
|
|
5
|
+
from netbox_dhcp.models import PDPool
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
__all__ = ("PDPoolFilterSet",)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class PDPoolFilterSet(NetBoxModelFilterSet):
|
|
12
|
+
class Meta:
|
|
13
|
+
model = PDPool
|
|
14
|
+
|
|
15
|
+
fields = (
|
|
16
|
+
"id",
|
|
17
|
+
"name",
|
|
18
|
+
"description",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
def search(self, queryset, name, value):
|
|
22
|
+
if not value.strip():
|
|
23
|
+
return queryset
|
|
24
|
+
qs_filter = Q(name__icontains=value)
|
|
25
|
+
return queryset.filter(qs_filter)
|