netbox-plugin-dns 0.22.9__py3-none-any.whl → 1.0.0__py3-none-any.whl
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.
Potentially problematic release.
This version of netbox-plugin-dns might be problematic. Click here for more details.
- netbox_dns/__init__.py +4 -15
- netbox_dns/api/nested_serializers.py +4 -60
- netbox_dns/api/serializers.py +8 -314
- netbox_dns/api/serializers_/__init__.py +0 -0
- netbox_dns/api/serializers_/contact.py +37 -0
- netbox_dns/api/serializers_/nameserver.py +39 -0
- netbox_dns/api/serializers_/record.py +90 -0
- netbox_dns/api/serializers_/registrar.py +31 -0
- netbox_dns/api/serializers_/view.py +34 -0
- netbox_dns/api/serializers_/zone.py +159 -0
- netbox_dns/api/views.py +13 -13
- netbox_dns/fields/network.py +21 -22
- netbox_dns/fields/rfc2317.py +3 -3
- netbox_dns/{filters → filtersets}/contact.py +2 -1
- netbox_dns/filtersets/nameserver.py +37 -0
- netbox_dns/{filters → filtersets}/record.py +51 -6
- netbox_dns/{filters → filtersets}/registrar.py +2 -1
- netbox_dns/{filters → filtersets}/view.py +2 -2
- netbox_dns/filtersets/zone.py +205 -0
- netbox_dns/forms/contact.py +61 -33
- netbox_dns/forms/nameserver.py +21 -8
- netbox_dns/forms/record.py +65 -38
- netbox_dns/forms/registrar.py +45 -15
- netbox_dns/forms/view.py +23 -9
- netbox_dns/forms/zone.py +182 -188
- netbox_dns/graphql/__init__.py +17 -27
- netbox_dns/graphql/filters.py +49 -0
- netbox_dns/graphql/schema.py +66 -7
- netbox_dns/graphql/types.py +143 -0
- netbox_dns/management/commands/cleanup_database.py +0 -4
- netbox_dns/management/commands/cleanup_rrset_ttl.py +2 -4
- netbox_dns/management/commands/setup_coupling.py +15 -15
- netbox_dns/management/commands/update_soa.py +1 -1
- netbox_dns/migrations/0001_squashed_netbox_dns_0_15.py +0 -27
- netbox_dns/migrations/0001_squashed_netbox_dns_0_22.py +558 -0
- netbox_dns/migrations/{0013_add_nameserver_zone_record_description.py → 0002_contact_description_registrar_description.py} +4 -9
- netbox_dns/migrations/0003_default_view.py +15 -0
- netbox_dns/migrations/0004_create_and_assign_default_view.py +26 -0
- netbox_dns/migrations/0005_alter_zone_view_not_null.py +18 -0
- netbox_dns/migrations/0020_netbox_3_4.py +1 -1
- netbox_dns/models/contact.py +6 -1
- netbox_dns/models/nameserver.py +2 -0
- netbox_dns/models/record.py +28 -33
- netbox_dns/models/registrar.py +5 -1
- netbox_dns/models/view.py +54 -1
- netbox_dns/models/zone.py +68 -54
- netbox_dns/navigation.py +1 -15
- netbox_dns/signals/ipam_coupling.py +3 -9
- netbox_dns/tables/contact.py +1 -0
- netbox_dns/tables/nameserver.py +0 -2
- netbox_dns/tables/registrar.py +1 -0
- netbox_dns/tables/view.py +9 -2
- netbox_dns/template_content.py +4 -8
- netbox_dns/templates/netbox_dns/contact.html +60 -56
- netbox_dns/templates/netbox_dns/nameserver.html +27 -27
- netbox_dns/templates/netbox_dns/record.html +92 -94
- netbox_dns/templates/netbox_dns/registrar.html +38 -36
- netbox_dns/templates/netbox_dns/view.html +25 -21
- netbox_dns/templates/netbox_dns/zone/base.html +5 -3
- netbox_dns/templates/netbox_dns/zone/child.html +3 -3
- netbox_dns/templates/netbox_dns/zone/managed_record.html +1 -1
- netbox_dns/templates/netbox_dns/zone/record.html +3 -3
- netbox_dns/templates/netbox_dns/zone/registration.html +26 -27
- netbox_dns/templates/netbox_dns/zone/rfc2317_child_zone.html +1 -1
- netbox_dns/templates/netbox_dns/zone.html +148 -149
- netbox_dns/urls/__init__.py +17 -0
- netbox_dns/urls/contact.py +51 -0
- netbox_dns/urls/nameserver.py +69 -0
- netbox_dns/urls/record.py +41 -0
- netbox_dns/urls/registrar.py +63 -0
- netbox_dns/urls/view.py +39 -0
- netbox_dns/urls/zone.py +57 -0
- netbox_dns/utilities/__init__.py +1 -6
- netbox_dns/utilities/ipam_coupling.py +2 -7
- netbox_dns/validators/dns_name.py +4 -9
- netbox_dns/validators/rfc2317.py +2 -2
- netbox_dns/views/contact.py +4 -4
- netbox_dns/views/nameserver.py +5 -5
- netbox_dns/views/record.py +15 -23
- netbox_dns/views/registrar.py +4 -4
- netbox_dns/views/view.py +4 -4
- netbox_dns/views/zone.py +7 -8
- {netbox_plugin_dns-0.22.9.dist-info → netbox_plugin_dns-1.0.0.dist-info}/METADATA +27 -13
- netbox_plugin_dns-1.0.0.dist-info/RECORD +112 -0
- netbox_dns/filters/nameserver.py +0 -18
- netbox_dns/filters/zone.py +0 -112
- netbox_dns/graphql/contact.py +0 -19
- netbox_dns/graphql/nameserver.py +0 -19
- netbox_dns/graphql/record.py +0 -19
- netbox_dns/graphql/registrar.py +0 -19
- netbox_dns/graphql/view.py +0 -19
- netbox_dns/graphql/zone.py +0 -19
- netbox_dns/migrations/0001_initial.py +0 -115
- netbox_dns/migrations/0002_zone_default_ttl.py +0 -18
- netbox_dns/migrations/0003_soa_managed_records.py +0 -112
- netbox_dns/migrations/0004_create_ptr_for_a_aaaa_records.py +0 -80
- netbox_dns/migrations/0005_update_ns_records.py +0 -41
- netbox_dns/migrations/0006_zone_soa_serial_auto.py +0 -29
- netbox_dns/migrations/0007_alter_zone_soa_serial_auto.py +0 -17
- netbox_dns/migrations/0008_zone_status_names.py +0 -21
- netbox_dns/migrations/0009_netbox32.py +0 -71
- netbox_dns/migrations/0010_update_soa_records.py +0 -58
- netbox_dns/migrations/0011_add_view_model.py +0 -70
- netbox_dns/migrations/0012_adjust_zone_and_record.py +0 -17
- netbox_dns/migrations/0014_add_view_description.py +0 -16
- netbox_dns/migrations/0015_add_record_status.py +0 -17
- netbox_dns/migrations/0016_cleanup_ptr_records.py +0 -38
- netbox_dns/migrations/0017_alter_record_ttl.py +0 -17
- netbox_dns/migrations/0018_zone_arpa_network.py +0 -51
- netbox_dns/migrations/0019_update_ns_ttl.py +0 -19
- netbox_dns/urls.py +0 -297
- netbox_plugin_dns-0.22.9.dist-info/RECORD +0 -117
- /netbox_dns/{filters → filtersets}/__init__.py +0 -0
- {netbox_plugin_dns-0.22.9.dist-info → netbox_plugin_dns-1.0.0.dist-info}/LICENSE +0 -0
- {netbox_plugin_dns-0.22.9.dist-info → netbox_plugin_dns-1.0.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from django.urls import path
|
|
2
|
+
|
|
3
|
+
from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
|
|
4
|
+
|
|
5
|
+
from netbox_dns.models import Record
|
|
6
|
+
from netbox_dns.views import (
|
|
7
|
+
RecordListView,
|
|
8
|
+
RecordView,
|
|
9
|
+
RecordEditView,
|
|
10
|
+
RecordDeleteView,
|
|
11
|
+
RecordBulkImportView,
|
|
12
|
+
RecordBulkEditView,
|
|
13
|
+
RecordBulkDeleteView,
|
|
14
|
+
ManagedRecordListView,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
record_urlpatterns = [
|
|
18
|
+
path("records/", RecordListView.as_view(), name="record_list"),
|
|
19
|
+
path("records/add/", RecordEditView.as_view(), name="record_add"),
|
|
20
|
+
path("records/import/", RecordBulkImportView.as_view(), name="record_import"),
|
|
21
|
+
path("records/edit/", RecordBulkEditView.as_view(), name="record_bulk_edit"),
|
|
22
|
+
path("records/delete/", RecordBulkDeleteView.as_view(), name="record_bulk_delete"),
|
|
23
|
+
path("records/<int:pk>/", RecordView.as_view(), name="record"),
|
|
24
|
+
path("records/<int:pk>/edit/", RecordEditView.as_view(), name="record_edit"),
|
|
25
|
+
path("records/<int:pk>/delete/", RecordDeleteView.as_view(), name="record_delete"),
|
|
26
|
+
path(
|
|
27
|
+
"records/<int:pk>/journal/",
|
|
28
|
+
ObjectJournalView.as_view(),
|
|
29
|
+
name="record_journal",
|
|
30
|
+
kwargs={"model": Record},
|
|
31
|
+
),
|
|
32
|
+
path(
|
|
33
|
+
"records/<int:pk>/changelog/",
|
|
34
|
+
ObjectChangeLogView.as_view(),
|
|
35
|
+
name="record_changelog",
|
|
36
|
+
kwargs={"model": Record},
|
|
37
|
+
),
|
|
38
|
+
path(
|
|
39
|
+
"managedrecords/", ManagedRecordListView.as_view(), name="managed_record_list"
|
|
40
|
+
),
|
|
41
|
+
]
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from django.urls import path
|
|
2
|
+
|
|
3
|
+
from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
|
|
4
|
+
|
|
5
|
+
from netbox_dns.models import Registrar
|
|
6
|
+
from netbox_dns.views import (
|
|
7
|
+
RegistrarListView,
|
|
8
|
+
RegistrarView,
|
|
9
|
+
RegistrarDeleteView,
|
|
10
|
+
RegistrarEditView,
|
|
11
|
+
RegistrarBulkImportView,
|
|
12
|
+
RegistrarBulkEditView,
|
|
13
|
+
RegistrarBulkDeleteView,
|
|
14
|
+
RegistrarZoneListView,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
registrar_urlpatterns = [
|
|
18
|
+
path("registrars/", RegistrarListView.as_view(), name="registrar_list"),
|
|
19
|
+
path("registrars/add/", RegistrarEditView.as_view(), name="registrar_add"),
|
|
20
|
+
path(
|
|
21
|
+
"registrars/import/",
|
|
22
|
+
RegistrarBulkImportView.as_view(),
|
|
23
|
+
name="registrar_import",
|
|
24
|
+
),
|
|
25
|
+
path(
|
|
26
|
+
"registrars/edit/",
|
|
27
|
+
RegistrarBulkEditView.as_view(),
|
|
28
|
+
name="registrar_bulk_edit",
|
|
29
|
+
),
|
|
30
|
+
path(
|
|
31
|
+
"registrars/delete/",
|
|
32
|
+
RegistrarBulkDeleteView.as_view(),
|
|
33
|
+
name="registrar_bulk_delete",
|
|
34
|
+
),
|
|
35
|
+
path("registrars/<int:pk>/", RegistrarView.as_view(), name="registrar"),
|
|
36
|
+
path(
|
|
37
|
+
"registrars/<int:pk>/edit/",
|
|
38
|
+
RegistrarEditView.as_view(),
|
|
39
|
+
name="registrar_edit",
|
|
40
|
+
),
|
|
41
|
+
path(
|
|
42
|
+
"registrars/<int:pk>/delete/",
|
|
43
|
+
RegistrarDeleteView.as_view(),
|
|
44
|
+
name="registrar_delete",
|
|
45
|
+
),
|
|
46
|
+
path(
|
|
47
|
+
"registrars/<int:pk>/zones/",
|
|
48
|
+
RegistrarZoneListView.as_view(),
|
|
49
|
+
name="registrar_zones",
|
|
50
|
+
),
|
|
51
|
+
path(
|
|
52
|
+
"registrars/<int:pk>/journal/",
|
|
53
|
+
ObjectJournalView.as_view(),
|
|
54
|
+
name="registrar_journal",
|
|
55
|
+
kwargs={"model": Registrar},
|
|
56
|
+
),
|
|
57
|
+
path(
|
|
58
|
+
"registrars/<int:pk>/changelog/",
|
|
59
|
+
ObjectChangeLogView.as_view(),
|
|
60
|
+
name="registrar_changelog",
|
|
61
|
+
kwargs={"model": Registrar},
|
|
62
|
+
),
|
|
63
|
+
]
|
netbox_dns/urls/view.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from django.urls import path
|
|
2
|
+
|
|
3
|
+
from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
|
|
4
|
+
|
|
5
|
+
from netbox_dns.models import View
|
|
6
|
+
from netbox_dns.views import (
|
|
7
|
+
ViewListView,
|
|
8
|
+
ViewView,
|
|
9
|
+
ViewDeleteView,
|
|
10
|
+
ViewEditView,
|
|
11
|
+
ViewBulkImportView,
|
|
12
|
+
ViewBulkEditView,
|
|
13
|
+
ViewBulkDeleteView,
|
|
14
|
+
ViewZoneListView,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
view_urlpatterns = [
|
|
18
|
+
path("views/", ViewListView.as_view(), name="view_list"),
|
|
19
|
+
path("views/add/", ViewEditView.as_view(), name="view_add"),
|
|
20
|
+
path("views/import/", ViewBulkImportView.as_view(), name="view_import"),
|
|
21
|
+
path("views/edit/", ViewBulkEditView.as_view(), name="view_bulk_edit"),
|
|
22
|
+
path("views/delete/", ViewBulkDeleteView.as_view(), name="view_bulk_delete"),
|
|
23
|
+
path("views/<int:pk>/", ViewView.as_view(), name="view"),
|
|
24
|
+
path("views/<int:pk>/edit/", ViewEditView.as_view(), name="view_edit"),
|
|
25
|
+
path("views/<int:pk>/delete/", ViewDeleteView.as_view(), name="view_delete"),
|
|
26
|
+
path("views/<int:pk>/zones/", ViewZoneListView.as_view(), name="view_zones"),
|
|
27
|
+
path(
|
|
28
|
+
"views/<int:pk>/journal/",
|
|
29
|
+
ObjectJournalView.as_view(),
|
|
30
|
+
name="view_journal",
|
|
31
|
+
kwargs={"model": View},
|
|
32
|
+
),
|
|
33
|
+
path(
|
|
34
|
+
"views/<int:pk>/changelog/",
|
|
35
|
+
ObjectChangeLogView.as_view(),
|
|
36
|
+
name="view_changelog",
|
|
37
|
+
kwargs={"model": View},
|
|
38
|
+
),
|
|
39
|
+
]
|
netbox_dns/urls/zone.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from django.urls import path
|
|
2
|
+
|
|
3
|
+
from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
|
|
4
|
+
|
|
5
|
+
from netbox_dns.models import Zone
|
|
6
|
+
from netbox_dns.views import (
|
|
7
|
+
ZoneListView,
|
|
8
|
+
ZoneView,
|
|
9
|
+
ZoneDeleteView,
|
|
10
|
+
ZoneEditView,
|
|
11
|
+
ZoneBulkImportView,
|
|
12
|
+
ZoneBulkEditView,
|
|
13
|
+
ZoneBulkDeleteView,
|
|
14
|
+
ZoneRecordListView,
|
|
15
|
+
ZoneManagedRecordListView,
|
|
16
|
+
ZoneRegistrationView,
|
|
17
|
+
ZoneRFC2317ChildZoneListView,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
zone_urlpatterns = [
|
|
21
|
+
path("zones/", ZoneListView.as_view(), name="zone_list"),
|
|
22
|
+
path("zones/add/", ZoneEditView.as_view(), name="zone_add"),
|
|
23
|
+
path("zones/import/", ZoneBulkImportView.as_view(), name="zone_import"),
|
|
24
|
+
path("zones/edit/", ZoneBulkEditView.as_view(), name="zone_bulk_edit"),
|
|
25
|
+
path("zones/delete/", ZoneBulkDeleteView.as_view(), name="zone_bulk_delete"),
|
|
26
|
+
path("zones/<int:pk>/", ZoneView.as_view(), name="zone"),
|
|
27
|
+
path("zones/<int:pk>/delete/", ZoneDeleteView.as_view(), name="zone_delete"),
|
|
28
|
+
path("zones/<int:pk>/edit/", ZoneEditView.as_view(), name="zone_edit"),
|
|
29
|
+
path("zones/<int:pk>/records/", ZoneRecordListView.as_view(), name="zone_records"),
|
|
30
|
+
path(
|
|
31
|
+
"zones/<int:pk>/managedrecords/",
|
|
32
|
+
ZoneManagedRecordListView.as_view(),
|
|
33
|
+
name="zone_managed_records",
|
|
34
|
+
),
|
|
35
|
+
path(
|
|
36
|
+
"zones/<int:pk>/rfc2317childzones/",
|
|
37
|
+
ZoneRFC2317ChildZoneListView.as_view(),
|
|
38
|
+
name="zone_rfc2317_child_zones",
|
|
39
|
+
),
|
|
40
|
+
path(
|
|
41
|
+
"zones/<int:pk>/registration/",
|
|
42
|
+
ZoneRegistrationView.as_view(),
|
|
43
|
+
name="zone_registration",
|
|
44
|
+
),
|
|
45
|
+
path(
|
|
46
|
+
"zones/<int:pk>/journal/",
|
|
47
|
+
ObjectJournalView.as_view(),
|
|
48
|
+
name="zone_journal",
|
|
49
|
+
kwargs={"model": Zone},
|
|
50
|
+
),
|
|
51
|
+
path(
|
|
52
|
+
"zones/<int:pk>/changelog/",
|
|
53
|
+
ObjectChangeLogView.as_view(),
|
|
54
|
+
name="zone_changelog",
|
|
55
|
+
kwargs={"model": Zone},
|
|
56
|
+
),
|
|
57
|
+
]
|
netbox_dns/utilities/__init__.py
CHANGED
|
@@ -4,12 +4,7 @@ from dns import name as dns_name
|
|
|
4
4
|
from dns.exception import DNSException
|
|
5
5
|
from netaddr import IPNetwork, AddrFormatError
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
# NetBox 3.5.0 - 3.5.7, 3.5.9+
|
|
9
|
-
from extras.plugins import get_plugin_config
|
|
10
|
-
except ImportError:
|
|
11
|
-
# NetBox 3.5.8
|
|
12
|
-
from extras.plugins.utils import get_plugin_config
|
|
7
|
+
from netbox.plugins.utils import get_plugin_config
|
|
13
8
|
|
|
14
9
|
|
|
15
10
|
class NameFormatError(Exception):
|
|
@@ -3,12 +3,7 @@ from utilities.permissions import resolve_permission
|
|
|
3
3
|
|
|
4
4
|
from netbox_dns.models import Record, RecordTypeChoices, RecordStatusChoices
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
# NetBox 3.5.0 - 3.5.7, 3.5.9+
|
|
8
|
-
from extras.plugins import get_plugin_config
|
|
9
|
-
except ImportError:
|
|
10
|
-
# NetBox 3.5.8
|
|
11
|
-
from extras.plugins.utils import get_plugin_config
|
|
6
|
+
from netbox.plugins.utils import get_plugin_config
|
|
12
7
|
|
|
13
8
|
|
|
14
9
|
class DNSPermissionDenied(Exception):
|
|
@@ -69,7 +64,7 @@ def new_address_record(instance):
|
|
|
69
64
|
status=address_record_status(instance),
|
|
70
65
|
type=address_record_type(instance),
|
|
71
66
|
value=str(instance.address.ip),
|
|
72
|
-
ipam_ip_address_id=instance.
|
|
67
|
+
ipam_ip_address_id=instance.pk,
|
|
73
68
|
managed=True,
|
|
74
69
|
)
|
|
75
70
|
|
|
@@ -2,12 +2,7 @@ import re
|
|
|
2
2
|
|
|
3
3
|
from django.core.exceptions import ValidationError
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
# NetBox 3.5.0 - 3.5.7, 3.5.9+
|
|
7
|
-
from extras.plugins import get_plugin_config
|
|
8
|
-
except ImportError:
|
|
9
|
-
# NetBox 3.5.8
|
|
10
|
-
from extras.plugins.utils import get_plugin_config
|
|
5
|
+
from netbox.plugins.utils import get_plugin_config
|
|
11
6
|
|
|
12
7
|
LABEL = r"[a-z0-9][a-z0-9-]*(?<!-)"
|
|
13
8
|
TOLERANT_LABEL = r"[a-z0-9][a-z0-9-_]*(?<![-_])"
|
|
@@ -26,7 +21,7 @@ def validate_fqdn(name):
|
|
|
26
21
|
regex = rf"^(\*|{LABEL})(\.{LABEL})+\.?$"
|
|
27
22
|
|
|
28
23
|
if not re.match(regex, name, flags=re.IGNORECASE) or has_invalid_double_dash(name):
|
|
29
|
-
raise ValidationError(
|
|
24
|
+
raise ValidationError("Not a valid fully qualified DNS host name")
|
|
30
25
|
|
|
31
26
|
|
|
32
27
|
def validate_extended_hostname(name, tolerate_leading_underscores=False):
|
|
@@ -41,7 +36,7 @@ def validate_extended_hostname(name, tolerate_leading_underscores=False):
|
|
|
41
36
|
regex = rf"^([*@]|(\*\.)?{LABEL}(\.{LABEL})*\.?)$"
|
|
42
37
|
|
|
43
38
|
if not re.match(regex, name, flags=re.IGNORECASE) or has_invalid_double_dash(name):
|
|
44
|
-
raise ValidationError(
|
|
39
|
+
raise ValidationError("Not a valid DNS host name")
|
|
45
40
|
|
|
46
41
|
|
|
47
42
|
def validate_domain_name(name):
|
|
@@ -54,4 +49,4 @@ def validate_domain_name(name):
|
|
|
54
49
|
regex = rf"^{LABEL}(\.{LABEL})*\.?$"
|
|
55
50
|
|
|
56
51
|
if not re.match(regex, name, flags=re.IGNORECASE) or has_invalid_double_dash(name):
|
|
57
|
-
raise ValidationError(
|
|
52
|
+
raise ValidationError("Not a valid DNS domain name")
|
netbox_dns/validators/rfc2317.py
CHANGED
|
@@ -10,9 +10,9 @@ def validate_prefix(prefix):
|
|
|
10
10
|
|
|
11
11
|
def validate_ipv4(prefix):
|
|
12
12
|
if prefix.version != 4:
|
|
13
|
-
raise ValidationError(
|
|
13
|
+
raise ValidationError("RFC2317 requires an IPv4 prefix.")
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def validate_rfc2317(prefix):
|
|
17
17
|
if prefix.prefixlen <= 24:
|
|
18
|
-
raise ValidationError(
|
|
18
|
+
raise ValidationError("RFC2317 requires at least 25 bit prefix length.")
|
netbox_dns/views/contact.py
CHANGED
|
@@ -5,7 +5,7 @@ from netbox.views import generic
|
|
|
5
5
|
from utilities.views import ViewTab, register_model_view
|
|
6
6
|
|
|
7
7
|
from netbox_dns.models import Contact, Zone
|
|
8
|
-
from netbox_dns.
|
|
8
|
+
from netbox_dns.filtersets import ContactFilterSet, ZoneFilterSet
|
|
9
9
|
from netbox_dns.forms import (
|
|
10
10
|
ContactForm,
|
|
11
11
|
ContactFilterForm,
|
|
@@ -22,7 +22,7 @@ class ContactView(generic.ObjectView):
|
|
|
22
22
|
class ContactListView(generic.ObjectListView):
|
|
23
23
|
queryset = Contact.objects.all()
|
|
24
24
|
table = ContactTable
|
|
25
|
-
filterset =
|
|
25
|
+
filterset = ContactFilterSet
|
|
26
26
|
filterset_form = ContactFilterForm
|
|
27
27
|
|
|
28
28
|
|
|
@@ -46,7 +46,7 @@ class ContactBulkImportView(generic.BulkImportView):
|
|
|
46
46
|
|
|
47
47
|
class ContactBulkEditView(generic.BulkEditView):
|
|
48
48
|
queryset = Contact.objects.all()
|
|
49
|
-
filterset =
|
|
49
|
+
filterset = ContactFilterSet
|
|
50
50
|
table = ContactTable
|
|
51
51
|
form = ContactBulkEditForm
|
|
52
52
|
|
|
@@ -63,7 +63,7 @@ class ContactZoneListView(generic.ObjectChildrenView):
|
|
|
63
63
|
)
|
|
64
64
|
child_model = Zone
|
|
65
65
|
table = ZoneTable
|
|
66
|
-
filterset =
|
|
66
|
+
filterset = ZoneFilterSet
|
|
67
67
|
template_name = "netbox_dns/zone/child.html"
|
|
68
68
|
hide_if_empty = True
|
|
69
69
|
|
netbox_dns/views/nameserver.py
CHANGED
|
@@ -3,7 +3,7 @@ from dns import name as dns_name
|
|
|
3
3
|
from netbox.views import generic
|
|
4
4
|
from utilities.views import ViewTab, register_model_view
|
|
5
5
|
|
|
6
|
-
from netbox_dns.
|
|
6
|
+
from netbox_dns.filtersets import NameServerFilterSet, ZoneFilterSet
|
|
7
7
|
from netbox_dns.forms import (
|
|
8
8
|
NameServerImportForm,
|
|
9
9
|
NameServerFilterForm,
|
|
@@ -16,7 +16,7 @@ from netbox_dns.tables import NameServerTable, ZoneTable
|
|
|
16
16
|
|
|
17
17
|
class NameServerListView(generic.ObjectListView):
|
|
18
18
|
queryset = NameServer.objects.all()
|
|
19
|
-
filterset =
|
|
19
|
+
filterset = NameServerFilterSet
|
|
20
20
|
filterset_form = NameServerFilterForm
|
|
21
21
|
table = NameServerTable
|
|
22
22
|
|
|
@@ -54,7 +54,7 @@ class NameServerBulkImportView(generic.BulkImportView):
|
|
|
54
54
|
|
|
55
55
|
class NameServerBulkEditView(generic.BulkEditView):
|
|
56
56
|
queryset = NameServer.objects.all()
|
|
57
|
-
filterset =
|
|
57
|
+
filterset = NameServerFilterSet
|
|
58
58
|
table = NameServerTable
|
|
59
59
|
form = NameServerBulkEditForm
|
|
60
60
|
|
|
@@ -69,7 +69,7 @@ class NameServerZoneListView(generic.ObjectChildrenView):
|
|
|
69
69
|
queryset = NameServer.objects.all().prefetch_related("zones")
|
|
70
70
|
child_model = Zone
|
|
71
71
|
table = ZoneTable
|
|
72
|
-
filterset =
|
|
72
|
+
filterset = ZoneFilterSet
|
|
73
73
|
template_name = "netbox_dns/zone/child.html"
|
|
74
74
|
hide_if_empty = True
|
|
75
75
|
|
|
@@ -89,7 +89,7 @@ class NameServerSOAZoneListView(generic.ObjectChildrenView):
|
|
|
89
89
|
queryset = NameServer.objects.all().prefetch_related("zones_soa")
|
|
90
90
|
child_model = Zone
|
|
91
91
|
table = ZoneTable
|
|
92
|
-
filterset =
|
|
92
|
+
filterset = ZoneFilterSet
|
|
93
93
|
template_name = "netbox_dns/zone/child.html"
|
|
94
94
|
hide_if_empty = True
|
|
95
95
|
|
netbox_dns/views/record.py
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
from dns import name as dns_name
|
|
2
2
|
|
|
3
|
-
from django.db.models import Q
|
|
4
|
-
from django.db.models.functions import Length
|
|
5
|
-
|
|
6
3
|
from netbox.views import generic
|
|
7
4
|
|
|
8
|
-
from netbox_dns.
|
|
5
|
+
from netbox_dns.filtersets import RecordFilterSet
|
|
9
6
|
from netbox_dns.forms import (
|
|
10
7
|
RecordImportForm,
|
|
11
8
|
RecordFilterForm,
|
|
@@ -21,7 +18,7 @@ class RecordListView(generic.ObjectListView):
|
|
|
21
18
|
queryset = Record.objects.filter(managed=False).prefetch_related(
|
|
22
19
|
"zone", "ptr_record"
|
|
23
20
|
)
|
|
24
|
-
filterset =
|
|
21
|
+
filterset = RecordFilterSet
|
|
25
22
|
filterset_form = RecordFilterForm
|
|
26
23
|
table = RecordTable
|
|
27
24
|
|
|
@@ -30,10 +27,10 @@ class ManagedRecordListView(generic.ObjectListView):
|
|
|
30
27
|
queryset = Record.objects.filter(managed=True).prefetch_related(
|
|
31
28
|
"zone", "address_record"
|
|
32
29
|
)
|
|
33
|
-
filterset =
|
|
30
|
+
filterset = RecordFilterSet
|
|
34
31
|
filterset_form = RecordFilterForm
|
|
35
32
|
table = ManagedRecordTable
|
|
36
|
-
actions =
|
|
33
|
+
actions = {"export": {"view"}}
|
|
37
34
|
template_name = "netbox_dns/record/managed.html"
|
|
38
35
|
|
|
39
36
|
|
|
@@ -41,15 +38,11 @@ class RecordView(generic.ObjectView):
|
|
|
41
38
|
queryset = Record.objects.all().prefetch_related("zone", "ptr_record")
|
|
42
39
|
|
|
43
40
|
def get_value_records(self, instance):
|
|
44
|
-
view_filter = (
|
|
45
|
-
Q(zone__view__isnull=True)
|
|
46
|
-
if instance.zone.view is None
|
|
47
|
-
else Q(zone__view=instance.zone.view)
|
|
48
|
-
)
|
|
49
|
-
|
|
50
41
|
value_fqdn = dns_name.from_text(instance.value_fqdn)
|
|
51
42
|
|
|
52
|
-
cname_targets = Record.objects.filter(
|
|
43
|
+
cname_targets = Record.objects.filter(
|
|
44
|
+
zone__view=instance.zone.view, fqdn=value_fqdn
|
|
45
|
+
)
|
|
53
46
|
|
|
54
47
|
if cname_targets:
|
|
55
48
|
return RelatedRecordTable(
|
|
@@ -59,14 +52,11 @@ class RecordView(generic.ObjectView):
|
|
|
59
52
|
return None
|
|
60
53
|
|
|
61
54
|
def get_cname_records(self, instance):
|
|
62
|
-
view_filter = (
|
|
63
|
-
Q(zone__view__isnull=True)
|
|
64
|
-
if instance.zone.view is None
|
|
65
|
-
else Q(zone__view=instance.zone.view)
|
|
66
|
-
)
|
|
67
55
|
cname_records = set(
|
|
68
56
|
Record.objects.filter(
|
|
69
|
-
|
|
57
|
+
zone__view=instance.zone.view,
|
|
58
|
+
value=instance.fqdn,
|
|
59
|
+
type=RecordTypeChoices.CNAME,
|
|
70
60
|
)
|
|
71
61
|
)
|
|
72
62
|
|
|
@@ -77,12 +67,14 @@ class RecordView(generic.ObjectView):
|
|
|
77
67
|
]
|
|
78
68
|
|
|
79
69
|
parent_zones = Zone.objects.filter(
|
|
80
|
-
instance.zone.
|
|
70
|
+
view=instance.zone.view, name__in=parent_zone_names
|
|
81
71
|
)
|
|
82
72
|
|
|
83
73
|
for parent_zone in parent_zones:
|
|
84
74
|
parent_cname_records = Record.objects.filter(
|
|
85
|
-
|
|
75
|
+
zone__view=instance.zone.view,
|
|
76
|
+
type=RecordTypeChoices.CNAME,
|
|
77
|
+
zone=parent_zone,
|
|
86
78
|
)
|
|
87
79
|
cname_records = cname_records.union(
|
|
88
80
|
set(
|
|
@@ -142,7 +134,7 @@ class RecordBulkImportView(generic.BulkImportView):
|
|
|
142
134
|
|
|
143
135
|
class RecordBulkEditView(generic.BulkEditView):
|
|
144
136
|
queryset = Record.objects.filter(managed=False).prefetch_related("zone")
|
|
145
|
-
filterset =
|
|
137
|
+
filterset = RecordFilterSet
|
|
146
138
|
table = RecordTable
|
|
147
139
|
form = RecordBulkEditForm
|
|
148
140
|
|
netbox_dns/views/registrar.py
CHANGED
|
@@ -3,7 +3,7 @@ from netbox.views import generic
|
|
|
3
3
|
from utilities.views import ViewTab, register_model_view
|
|
4
4
|
|
|
5
5
|
from netbox_dns.models import Registrar, Zone
|
|
6
|
-
from netbox_dns.
|
|
6
|
+
from netbox_dns.filtersets import RegistrarFilterSet, ZoneFilterSet
|
|
7
7
|
from netbox_dns.forms import (
|
|
8
8
|
RegistrarForm,
|
|
9
9
|
RegistrarFilterForm,
|
|
@@ -20,7 +20,7 @@ class RegistrarView(generic.ObjectView):
|
|
|
20
20
|
class RegistrarListView(generic.ObjectListView):
|
|
21
21
|
queryset = Registrar.objects.all()
|
|
22
22
|
table = RegistrarTable
|
|
23
|
-
filterset =
|
|
23
|
+
filterset = RegistrarFilterSet
|
|
24
24
|
filterset_form = RegistrarFilterForm
|
|
25
25
|
|
|
26
26
|
|
|
@@ -44,7 +44,7 @@ class RegistrarBulkImportView(generic.BulkImportView):
|
|
|
44
44
|
|
|
45
45
|
class RegistrarBulkEditView(generic.BulkEditView):
|
|
46
46
|
queryset = Registrar.objects.all()
|
|
47
|
-
filterset =
|
|
47
|
+
filterset = RegistrarFilterSet
|
|
48
48
|
table = RegistrarTable
|
|
49
49
|
form = RegistrarBulkEditForm
|
|
50
50
|
|
|
@@ -59,7 +59,7 @@ class RegistrarZoneListView(generic.ObjectChildrenView):
|
|
|
59
59
|
queryset = Registrar.objects.all().prefetch_related("zone_set")
|
|
60
60
|
child_model = Zone
|
|
61
61
|
table = ZoneTable
|
|
62
|
-
filterset =
|
|
62
|
+
filterset = ZoneFilterSet
|
|
63
63
|
template_name = "netbox_dns/zone/child.html"
|
|
64
64
|
hide_if_empty = True
|
|
65
65
|
|
netbox_dns/views/view.py
CHANGED
|
@@ -3,7 +3,7 @@ from utilities.views import ViewTab, register_model_view
|
|
|
3
3
|
from netbox.views import generic
|
|
4
4
|
|
|
5
5
|
from netbox_dns.models import View, Zone
|
|
6
|
-
from netbox_dns.
|
|
6
|
+
from netbox_dns.filtersets import ViewFilterSet, ZoneFilterSet
|
|
7
7
|
from netbox_dns.forms import ViewForm, ViewFilterForm, ViewImportForm, ViewBulkEditForm
|
|
8
8
|
from netbox_dns.tables import ViewTable, ZoneTable
|
|
9
9
|
|
|
@@ -15,7 +15,7 @@ class ViewView(generic.ObjectView):
|
|
|
15
15
|
class ViewListView(generic.ObjectListView):
|
|
16
16
|
queryset = View.objects.all()
|
|
17
17
|
table = ViewTable
|
|
18
|
-
filterset =
|
|
18
|
+
filterset = ViewFilterSet
|
|
19
19
|
filterset_form = ViewFilterForm
|
|
20
20
|
|
|
21
21
|
|
|
@@ -39,7 +39,7 @@ class ViewBulkImportView(generic.BulkImportView):
|
|
|
39
39
|
|
|
40
40
|
class ViewBulkEditView(generic.BulkEditView):
|
|
41
41
|
queryset = View.objects.all()
|
|
42
|
-
filterset =
|
|
42
|
+
filterset = ViewFilterSet
|
|
43
43
|
table = ViewTable
|
|
44
44
|
form = ViewBulkEditForm
|
|
45
45
|
|
|
@@ -54,7 +54,7 @@ class ViewZoneListView(generic.ObjectChildrenView):
|
|
|
54
54
|
queryset = View.objects.all().prefetch_related("zone_set")
|
|
55
55
|
child_model = Zone
|
|
56
56
|
table = ZoneTable
|
|
57
|
-
filterset =
|
|
57
|
+
filterset = ZoneFilterSet
|
|
58
58
|
template_name = "netbox_dns/zone/child.html"
|
|
59
59
|
hide_if_empty = True
|
|
60
60
|
|
netbox_dns/views/zone.py
CHANGED
|
@@ -3,7 +3,7 @@ from dns import name as dns_name
|
|
|
3
3
|
from netbox.views import generic
|
|
4
4
|
from utilities.views import ViewTab, register_model_view
|
|
5
5
|
|
|
6
|
-
from netbox_dns.
|
|
6
|
+
from netbox_dns.filtersets import ZoneFilterSet, RecordFilterSet
|
|
7
7
|
from netbox_dns.forms import (
|
|
8
8
|
ZoneImportForm,
|
|
9
9
|
ZoneForm,
|
|
@@ -20,7 +20,7 @@ from netbox_dns.tables import (
|
|
|
20
20
|
|
|
21
21
|
class ZoneListView(generic.ObjectListView):
|
|
22
22
|
queryset = Zone.objects.all().prefetch_related("view", "tags")
|
|
23
|
-
filterset =
|
|
23
|
+
filterset = ZoneFilterSet
|
|
24
24
|
filterset_form = ZoneFilterForm
|
|
25
25
|
table = ZoneTable
|
|
26
26
|
|
|
@@ -75,7 +75,7 @@ class ZoneBulkEditView(generic.BulkEditView):
|
|
|
75
75
|
queryset = Zone.objects.all().prefetch_related(
|
|
76
76
|
"view", "tags", "nameservers", "soa_mname"
|
|
77
77
|
)
|
|
78
|
-
filterset =
|
|
78
|
+
filterset = ZoneFilterSet
|
|
79
79
|
table = ZoneTable
|
|
80
80
|
form = ZoneBulkEditForm
|
|
81
81
|
default_return_url = "plugins:netbox_dns:zone_list"
|
|
@@ -109,7 +109,7 @@ class ZoneRecordListView(generic.ObjectChildrenView):
|
|
|
109
109
|
queryset = Zone.objects.all()
|
|
110
110
|
child_model = Record
|
|
111
111
|
table = RecordTable
|
|
112
|
-
filterset =
|
|
112
|
+
filterset = RecordFilterSet
|
|
113
113
|
template_name = "netbox_dns/zone/record.html"
|
|
114
114
|
hide_if_empty = True
|
|
115
115
|
|
|
@@ -131,9 +131,9 @@ class ZoneManagedRecordListView(generic.ObjectChildrenView):
|
|
|
131
131
|
queryset = Zone.objects.all()
|
|
132
132
|
child_model = Record
|
|
133
133
|
table = ManagedRecordTable
|
|
134
|
-
filterset =
|
|
134
|
+
filterset = RecordFilterSet
|
|
135
135
|
template_name = "netbox_dns/zone/managed_record.html"
|
|
136
|
-
actions =
|
|
136
|
+
actions = {"changelog": {"view"}}
|
|
137
137
|
|
|
138
138
|
tab = ViewTab(
|
|
139
139
|
label="Managed Records",
|
|
@@ -153,9 +153,8 @@ class ZoneRFC2317ChildZoneListView(generic.ObjectChildrenView):
|
|
|
153
153
|
queryset = Zone.objects.all()
|
|
154
154
|
child_model = Zone
|
|
155
155
|
table = ZoneTable
|
|
156
|
-
filterset =
|
|
156
|
+
filterset = ZoneFilterSet
|
|
157
157
|
template_name = "netbox_dns/zone/rfc2317_child_zone.html"
|
|
158
|
-
actions = ("changelog",)
|
|
159
158
|
|
|
160
159
|
tab = ViewTab(
|
|
161
160
|
label="RFC2317 Child Zones",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: netbox-plugin-dns
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: NetBox DNS is a NetBox plugin for managing DNS data.
|
|
5
5
|
Home-page: https://github.com/peteeckel/netbox-plugin-dns
|
|
6
6
|
License: MIT
|
|
@@ -21,7 +21,7 @@ Project-URL: Repository, https://github.com/peteeckel/netbox-plugin-dns
|
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
|
|
23
23
|
# NetBox DNS
|
|
24
|
-
The NetBox DNS plugin enables NetBox to manage operational DNS data such as name servers, zones, records and views, as well as registration data for domains. It can automate tasks like creating PTR records, generating zone serial numbers, NS and SOA records, as well as validate names and values values for resource records to ensure zone data is consistent,
|
|
24
|
+
The NetBox DNS plugin enables NetBox to manage operational DNS data such as name servers, zones, records and views, as well as registration data for domains. It can automate tasks like creating PTR records, generating zone serial numbers, NS and SOA records, as well as validate names and values values for resource records to ensure zone data is consistent, up-to-date and compliant with to the relevant RFCs.
|
|
25
25
|
|
|
26
26
|
<div align="center">
|
|
27
27
|
<a href="https://pypi.org/project/netbox-plugin-dns/"><img src="https://img.shields.io/pypi/v/netbox-plugin-dns" alt="PyPi"/></a>
|
|
@@ -36,21 +36,35 @@ The NetBox DNS plugin enables NetBox to manage operational DNS data such as name
|
|
|
36
36
|
<a href="https://pepy.tech/project/netbox-plugin-dns"><img alt="Downloads/Month" src="https://static.pepy.tech/badge/netbox-plugin-dns/week"></a>
|
|
37
37
|
</div>
|
|
38
38
|
|
|
39
|
-
##
|
|
39
|
+
## Objectives
|
|
40
|
+
NetBox DNS is designed to be the 'DNS Source of Truth' analogous to NetBox being the 'Network Source of Truth'.
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
* Automatically generate SOA and NS records for zones
|
|
43
|
-
* Automatically create and update PTR records for IPv4 and IPv6 address records
|
|
44
|
-
* Organize DNS zones in views for split horizon DNS and multi-site deployments
|
|
45
|
-
* Manage domain registrar and registrant information for domains related to zones
|
|
46
|
-
* Manage RFC2317 reverse zones for IPv4 prefixes with a network mask length longer than 24 bits
|
|
42
|
+
The plugin stores information about DNS name servers, DNS views and zones, and DNS records, making it a data source for automatic provisioning of DNS instances. Registration information about DNS registrars and contacts for DNS domains can also be stored and associated with zones.
|
|
47
43
|
|
|
48
|
-
|
|
44
|
+
The main focus of the plugin is to ensure the quality of the data stored in it. To achieve this, there are many validation and automation mechanisms in place:
|
|
45
|
+
|
|
46
|
+
* Validation of record names and values
|
|
47
|
+
* Automatic maintenance of PTR records for IPv6 and IPv4 address records
|
|
48
|
+
* Automatic generation of SOA records, optionally including the serial number of the zone data
|
|
49
|
+
* Validation of record types such as CNAME and singletons, to ensure DNS zone validity
|
|
50
|
+
* Support for [RFC 2317](https://datatracker.ietf.org/doc/html/rfc2317) delegation of PTR zones for IPv4 subnets longer than 24 bits
|
|
51
|
+
|
|
52
|
+
Other main features include:
|
|
53
|
+
|
|
54
|
+
* Support for BIND views, providing lightweight namespaces for zones
|
|
55
|
+
* Support for IDN, including the validation of punycode names
|
|
56
|
+
* Full support for the NetBox REST and GraphQL APIs
|
|
57
|
+
* Support for all major NetBox features such as global search, tenancy, change logs, tagging, journaling etc.
|
|
58
|
+
|
|
59
|
+
## Non-objectives
|
|
60
|
+
In the same way as NetBox is not a network management application, NetBox DNS does not provide any functionality to manage specific name servers or DNS service providers or to generate input such as configuration and zone files for them. The focus is on the completeness and integrity of the data needed to run DNS zones, not on the peculiarities of a plethora of servers and services that actually use the data. This functionality is left to specialized integration tools, or in many cases it can be easily implemented using Ansible or similar tools based on NetBox DNS data. Example code for some simple use cases is provided.
|
|
61
|
+
|
|
62
|
+
For integration with a large number of DNS server implementations integration tools like [octodns-netbox-dns](https://pypi.org/project/octodns-netbox-dns/) are available.
|
|
49
63
|
|
|
50
64
|
## Requirements
|
|
51
65
|
|
|
52
|
-
* NetBox
|
|
53
|
-
* Python 3.
|
|
66
|
+
* NetBox 4.0.0 or higher
|
|
67
|
+
* Python 3.10 or higher
|
|
54
68
|
|
|
55
69
|
## Installation & Configuration
|
|
56
70
|
|
|
@@ -87,7 +101,7 @@ Full documentation on using plugins with NetBox: [Using Plugins - NetBox Documen
|
|
|
87
101
|
|
|
88
102
|
## Contribute
|
|
89
103
|
|
|
90
|
-
Contributions are always welcome! Please see
|
|
104
|
+
Contributions are always welcome! Please see the [Contribution Guidelines](CONTRIBUTING.md)
|
|
91
105
|
|
|
92
106
|
## Documentation
|
|
93
107
|
|