netbox-plugin-dns 1.0.7__py3-none-any.whl → 1.1.0b1__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 +21 -5
- netbox_dns/api/nested_serializers.py +16 -17
- netbox_dns/api/serializers.py +1 -0
- netbox_dns/api/serializers_/prefix.py +18 -0
- netbox_dns/api/serializers_/record.py +0 -1
- netbox_dns/api/serializers_/view.py +34 -2
- netbox_dns/api/urls.py +3 -0
- netbox_dns/api/views.py +36 -0
- netbox_dns/fields/__init__.py +1 -0
- netbox_dns/fields/ipam.py +18 -0
- netbox_dns/filtersets/record.py +1 -1
- netbox_dns/filtersets/view.py +16 -0
- netbox_dns/forms/view.py +116 -4
- netbox_dns/forms/zone.py +0 -8
- netbox_dns/graphql/schema.py +40 -16
- netbox_dns/graphql/types.py +1 -0
- netbox_dns/management/commands/setup_autodns.py +120 -0
- netbox_dns/migrations/0007_view_prefixes.py +18 -0
- netbox_dns/models/__init__.py +0 -2
- netbox_dns/models/contact.py +3 -9
- netbox_dns/models/nameserver.py +3 -8
- netbox_dns/models/record.py +71 -17
- netbox_dns/models/record_template.py +1 -4
- netbox_dns/models/registrar.py +1 -7
- netbox_dns/models/view.py +7 -9
- netbox_dns/models/zone.py +28 -29
- netbox_dns/models/zone_template.py +5 -8
- netbox_dns/signals/ipam_autodns.py +138 -0
- netbox_dns/tables/contact.py +1 -0
- netbox_dns/tables/nameserver.py +7 -1
- netbox_dns/tables/record.py +30 -10
- netbox_dns/tables/record_template.py +17 -0
- netbox_dns/tables/registrar.py +2 -0
- netbox_dns/tables/view.py +32 -3
- netbox_dns/tables/zone.py +15 -0
- netbox_dns/tables/zone_template.py +16 -2
- netbox_dns/template_content.py +28 -39
- netbox_dns/templates/netbox_dns/record.html +6 -6
- netbox_dns/templates/netbox_dns/view/related.html +17 -0
- netbox_dns/templates/netbox_dns/view.html +29 -0
- netbox_dns/urls/contact.py +32 -10
- netbox_dns/urls/nameserver.py +38 -14
- netbox_dns/urls/record.py +19 -7
- netbox_dns/urls/record_template.py +27 -18
- netbox_dns/urls/registrar.py +35 -11
- netbox_dns/urls/view.py +22 -8
- netbox_dns/urls/zone.py +46 -8
- netbox_dns/urls/zone_template.py +26 -16
- netbox_dns/utilities/__init__.py +2 -74
- netbox_dns/utilities/conversions.py +83 -0
- netbox_dns/utilities/ipam_autodns.py +205 -0
- netbox_dns/validators/dns_name.py +0 -9
- netbox_dns/views/contact.py +1 -0
- netbox_dns/views/nameserver.py +3 -7
- netbox_dns/views/record.py +2 -9
- netbox_dns/views/record_template.py +1 -1
- netbox_dns/views/registrar.py +1 -0
- netbox_dns/views/view.py +1 -6
- netbox_dns/views/zone.py +6 -7
- netbox_dns/views/zone_template.py +2 -2
- {netbox_plugin_dns-1.0.7.dist-info → netbox_plugin_dns-1.1.0b1.dist-info}/METADATA +2 -2
- {netbox_plugin_dns-1.0.7.dist-info → netbox_plugin_dns-1.1.0b1.dist-info}/RECORD +64 -61
- netbox_dns/management/commands/setup_coupling.py +0 -109
- netbox_dns/migrations/0007_alter_ordering_options.py +0 -25
- netbox_dns/signals/ipam_coupling.py +0 -168
- netbox_dns/templates/netbox_dns/related_dns_objects.html +0 -21
- netbox_dns/utilities/ipam_coupling.py +0 -112
- {netbox_plugin_dns-1.0.7.dist-info → netbox_plugin_dns-1.1.0b1.dist-info}/LICENSE +0 -0
- {netbox_plugin_dns-1.0.7.dist-info → netbox_plugin_dns-1.1.0b1.dist-info}/WHEEL +0 -0
netbox_dns/urls/nameserver.py
CHANGED
|
@@ -1,21 +1,39 @@
|
|
|
1
|
-
from django.urls import
|
|
1
|
+
from django.urls import path
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
|
|
4
4
|
|
|
5
|
+
from netbox_dns.models import NameServer
|
|
5
6
|
from netbox_dns.views import (
|
|
6
|
-
NameServerView,
|
|
7
7
|
NameServerListView,
|
|
8
|
+
NameServerView,
|
|
8
9
|
NameServerEditView,
|
|
9
10
|
NameServerDeleteView,
|
|
10
11
|
NameServerBulkImportView,
|
|
11
12
|
NameServerBulkEditView,
|
|
12
13
|
NameServerBulkDeleteView,
|
|
14
|
+
NameServerZoneListView,
|
|
15
|
+
NameServerSOAZoneListView,
|
|
13
16
|
)
|
|
14
17
|
|
|
15
18
|
nameserver_urlpatterns = [
|
|
16
|
-
path("nameservers/<int:pk>/", NameServerView.as_view(), name="nameserver"),
|
|
17
19
|
path("nameservers/", NameServerListView.as_view(), name="nameserver_list"),
|
|
18
20
|
path("nameservers/add/", NameServerEditView.as_view(), name="nameserver_add"),
|
|
21
|
+
path(
|
|
22
|
+
"nameservers/import/",
|
|
23
|
+
NameServerBulkImportView.as_view(),
|
|
24
|
+
name="nameserver_import",
|
|
25
|
+
),
|
|
26
|
+
path(
|
|
27
|
+
"nameservers/edit/",
|
|
28
|
+
NameServerBulkEditView.as_view(),
|
|
29
|
+
name="nameserver_bulk_edit",
|
|
30
|
+
),
|
|
31
|
+
path(
|
|
32
|
+
"nameservers/delete/",
|
|
33
|
+
NameServerBulkDeleteView.as_view(),
|
|
34
|
+
name="nameserver_bulk_delete",
|
|
35
|
+
),
|
|
36
|
+
path("nameservers/<int:pk>/", NameServerView.as_view(), name="nameserver"),
|
|
19
37
|
path(
|
|
20
38
|
"nameservers/<int:pk>/edit",
|
|
21
39
|
NameServerEditView.as_view(),
|
|
@@ -27,19 +45,25 @@ nameserver_urlpatterns = [
|
|
|
27
45
|
name="nameserver_delete",
|
|
28
46
|
),
|
|
29
47
|
path(
|
|
30
|
-
"nameservers/
|
|
31
|
-
|
|
32
|
-
name="
|
|
48
|
+
"nameservers/<int:pk>/journal/",
|
|
49
|
+
ObjectJournalView.as_view(),
|
|
50
|
+
name="nameserver_journal",
|
|
51
|
+
kwargs={"model": NameServer},
|
|
33
52
|
),
|
|
34
53
|
path(
|
|
35
|
-
"nameservers/
|
|
36
|
-
|
|
37
|
-
name="
|
|
54
|
+
"nameservers/<int:pk>/changelog/",
|
|
55
|
+
ObjectChangeLogView.as_view(),
|
|
56
|
+
name="nameserver_changelog",
|
|
57
|
+
kwargs={"model": NameServer},
|
|
38
58
|
),
|
|
39
59
|
path(
|
|
40
|
-
"nameservers/
|
|
41
|
-
|
|
42
|
-
name="
|
|
60
|
+
"nameservers/<int:pk>/zones/",
|
|
61
|
+
NameServerZoneListView.as_view(),
|
|
62
|
+
name="nameserver_zones",
|
|
63
|
+
),
|
|
64
|
+
path(
|
|
65
|
+
"nameservers/<int:pk>/soazones/",
|
|
66
|
+
NameServerSOAZoneListView.as_view(),
|
|
67
|
+
name="nameserver_soa_zones",
|
|
43
68
|
),
|
|
44
|
-
path("nameservers/<int:pk>/", include(get_model_urls("netbox_dns", "nameserver"))),
|
|
45
69
|
]
|
netbox_dns/urls/record.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
from django.urls import
|
|
1
|
+
from django.urls import path
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
|
|
4
4
|
|
|
5
|
+
from netbox_dns.models import Record
|
|
5
6
|
from netbox_dns.views import (
|
|
6
|
-
RecordView,
|
|
7
7
|
RecordListView,
|
|
8
|
+
RecordView,
|
|
8
9
|
RecordEditView,
|
|
9
10
|
RecordDeleteView,
|
|
10
11
|
RecordBulkImportView,
|
|
@@ -14,15 +15,26 @@ from netbox_dns.views import (
|
|
|
14
15
|
)
|
|
15
16
|
|
|
16
17
|
record_urlpatterns = [
|
|
17
|
-
path("records/<int:pk>/", RecordView.as_view(), name="record"),
|
|
18
18
|
path("records/", RecordListView.as_view(), name="record_list"),
|
|
19
19
|
path("records/add/", RecordEditView.as_view(), name="record_add"),
|
|
20
|
-
path("records/<int:pk>/edit/", RecordEditView.as_view(), name="record_edit"),
|
|
21
|
-
path("records/<int:pk>/delete/", RecordDeleteView.as_view(), name="record_delete"),
|
|
22
20
|
path("records/import/", RecordBulkImportView.as_view(), name="record_import"),
|
|
23
21
|
path("records/edit/", RecordBulkEditView.as_view(), name="record_bulk_edit"),
|
|
24
22
|
path("records/delete/", RecordBulkDeleteView.as_view(), name="record_bulk_delete"),
|
|
25
|
-
path("records/<int:pk>/",
|
|
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
|
+
),
|
|
26
38
|
path(
|
|
27
39
|
"managedrecords/", ManagedRecordListView.as_view(), name="managed_record_list"
|
|
28
40
|
),
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
from django.urls import
|
|
1
|
+
from django.urls import path
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
|
|
4
4
|
|
|
5
|
+
from netbox_dns.models import RecordTemplate
|
|
5
6
|
from netbox_dns.views import (
|
|
6
|
-
RecordTemplateView,
|
|
7
7
|
RecordTemplateListView,
|
|
8
|
+
RecordTemplateView,
|
|
8
9
|
RecordTemplateEditView,
|
|
9
10
|
RecordTemplateDeleteView,
|
|
10
11
|
RecordTemplateBulkImportView,
|
|
@@ -13,9 +14,6 @@ from netbox_dns.views import (
|
|
|
13
14
|
)
|
|
14
15
|
|
|
15
16
|
recordtemplate_urlpatterns = [
|
|
16
|
-
path(
|
|
17
|
-
"recordtemplates/<int:pk>/", RecordTemplateView.as_view(), name="recordtemplate"
|
|
18
|
-
),
|
|
19
17
|
path(
|
|
20
18
|
"recordtemplates/", RecordTemplateListView.as_view(), name="recordtemplate_list"
|
|
21
19
|
),
|
|
@@ -24,16 +22,6 @@ recordtemplate_urlpatterns = [
|
|
|
24
22
|
RecordTemplateEditView.as_view(),
|
|
25
23
|
name="recordtemplate_add",
|
|
26
24
|
),
|
|
27
|
-
path(
|
|
28
|
-
"recordtemplates/<int:pk>/edit/",
|
|
29
|
-
RecordTemplateEditView.as_view(),
|
|
30
|
-
name="recordtemplate_edit",
|
|
31
|
-
),
|
|
32
|
-
path(
|
|
33
|
-
"recordtemplates/<int:pk>/delete/",
|
|
34
|
-
RecordTemplateDeleteView.as_view(),
|
|
35
|
-
name="recordtemplate_delete",
|
|
36
|
-
),
|
|
37
25
|
path(
|
|
38
26
|
"recordtemplates/import/",
|
|
39
27
|
RecordTemplateBulkImportView.as_view(),
|
|
@@ -50,7 +38,28 @@ recordtemplate_urlpatterns = [
|
|
|
50
38
|
name="recordtemplate_bulk_delete",
|
|
51
39
|
),
|
|
52
40
|
path(
|
|
53
|
-
"recordtemplates/<int:pk>/",
|
|
54
|
-
|
|
41
|
+
"recordtemplates/<int:pk>/", RecordTemplateView.as_view(), name="recordtemplate"
|
|
42
|
+
),
|
|
43
|
+
path(
|
|
44
|
+
"recordtemplates/<int:pk>/edit/",
|
|
45
|
+
RecordTemplateEditView.as_view(),
|
|
46
|
+
name="recordtemplate_edit",
|
|
47
|
+
),
|
|
48
|
+
path(
|
|
49
|
+
"recordtemplates/<int:pk>/delete/",
|
|
50
|
+
RecordTemplateDeleteView.as_view(),
|
|
51
|
+
name="recordtemplate_delete",
|
|
52
|
+
),
|
|
53
|
+
path(
|
|
54
|
+
"recordtemplates/<int:pk>/journal/",
|
|
55
|
+
ObjectJournalView.as_view(),
|
|
56
|
+
name="recordtemplate_journal",
|
|
57
|
+
kwargs={"model": RecordTemplate},
|
|
58
|
+
),
|
|
59
|
+
path(
|
|
60
|
+
"recordtemplates/<int:pk>/changelog/",
|
|
61
|
+
ObjectChangeLogView.as_view(),
|
|
62
|
+
name="recordtemplate_changelog",
|
|
63
|
+
kwargs={"model": RecordTemplate},
|
|
55
64
|
),
|
|
56
65
|
]
|
netbox_dns/urls/registrar.py
CHANGED
|
@@ -1,39 +1,63 @@
|
|
|
1
|
-
from django.urls import
|
|
1
|
+
from django.urls import path
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
|
|
4
4
|
|
|
5
|
+
from netbox_dns.models import Registrar
|
|
5
6
|
from netbox_dns.views import (
|
|
6
|
-
RegistrarView,
|
|
7
7
|
RegistrarListView,
|
|
8
|
-
|
|
8
|
+
RegistrarView,
|
|
9
9
|
RegistrarDeleteView,
|
|
10
|
+
RegistrarEditView,
|
|
10
11
|
RegistrarBulkImportView,
|
|
11
12
|
RegistrarBulkEditView,
|
|
12
13
|
RegistrarBulkDeleteView,
|
|
14
|
+
RegistrarZoneListView,
|
|
13
15
|
)
|
|
14
16
|
|
|
15
17
|
registrar_urlpatterns = [
|
|
16
|
-
path("registrars/<int:pk>/", RegistrarView.as_view(), name="registrar"),
|
|
17
18
|
path("registrars/", RegistrarListView.as_view(), name="registrar_list"),
|
|
18
19
|
path("registrars/add/", RegistrarEditView.as_view(), name="registrar_add"),
|
|
19
20
|
path(
|
|
20
|
-
"registrars
|
|
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",
|
|
21
29
|
),
|
|
22
30
|
path(
|
|
23
31
|
"registrars/delete/",
|
|
24
32
|
RegistrarBulkDeleteView.as_view(),
|
|
25
33
|
name="registrar_bulk_delete",
|
|
26
34
|
),
|
|
35
|
+
path("registrars/<int:pk>/", RegistrarView.as_view(), name="registrar"),
|
|
27
36
|
path(
|
|
28
|
-
"registrars/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"registrars/edit/", RegistrarBulkEditView.as_view(), name="registrar_bulk_edit"
|
|
37
|
+
"registrars/<int:pk>/edit/",
|
|
38
|
+
RegistrarEditView.as_view(),
|
|
39
|
+
name="registrar_edit",
|
|
32
40
|
),
|
|
33
41
|
path(
|
|
34
42
|
"registrars/<int:pk>/delete/",
|
|
35
43
|
RegistrarDeleteView.as_view(),
|
|
36
44
|
name="registrar_delete",
|
|
37
45
|
),
|
|
38
|
-
path(
|
|
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
|
+
),
|
|
39
63
|
]
|
netbox_dns/urls/view.py
CHANGED
|
@@ -1,25 +1,39 @@
|
|
|
1
|
-
from django.urls import
|
|
1
|
+
from django.urls import path
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
|
|
4
4
|
|
|
5
|
+
from netbox_dns.models import View
|
|
5
6
|
from netbox_dns.views import (
|
|
6
|
-
ViewView,
|
|
7
7
|
ViewListView,
|
|
8
|
-
|
|
8
|
+
ViewView,
|
|
9
9
|
ViewDeleteView,
|
|
10
|
+
ViewEditView,
|
|
10
11
|
ViewBulkImportView,
|
|
11
12
|
ViewBulkEditView,
|
|
12
13
|
ViewBulkDeleteView,
|
|
14
|
+
ViewZoneListView,
|
|
13
15
|
)
|
|
14
16
|
|
|
15
17
|
view_urlpatterns = [
|
|
16
|
-
path("views/<int:pk>/", ViewView.as_view(), name="view"),
|
|
17
18
|
path("views/", ViewListView.as_view(), name="view_list"),
|
|
18
19
|
path("views/add/", ViewEditView.as_view(), name="view_add"),
|
|
19
|
-
path("views/<int:pk>/edit/", ViewEditView.as_view(), name="view_edit"),
|
|
20
|
-
path("views/<int:pk>/delete/", ViewDeleteView.as_view(), name="view_delete"),
|
|
21
20
|
path("views/import/", ViewBulkImportView.as_view(), name="view_import"),
|
|
22
21
|
path("views/edit/", ViewBulkEditView.as_view(), name="view_bulk_edit"),
|
|
23
22
|
path("views/delete/", ViewBulkDeleteView.as_view(), name="view_bulk_delete"),
|
|
24
|
-
path("views/<int:pk>/",
|
|
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
|
+
),
|
|
25
39
|
]
|
netbox_dns/urls/zone.py
CHANGED
|
@@ -1,25 +1,63 @@
|
|
|
1
|
-
from django.urls import
|
|
1
|
+
from django.urls import path
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
|
|
4
4
|
|
|
5
|
+
from netbox_dns.models import Zone
|
|
5
6
|
from netbox_dns.views import (
|
|
6
|
-
ZoneView,
|
|
7
7
|
ZoneListView,
|
|
8
|
-
|
|
8
|
+
ZoneView,
|
|
9
9
|
ZoneDeleteView,
|
|
10
|
+
ZoneEditView,
|
|
10
11
|
ZoneBulkImportView,
|
|
11
12
|
ZoneBulkEditView,
|
|
12
13
|
ZoneBulkDeleteView,
|
|
14
|
+
ZoneRecordListView,
|
|
15
|
+
ZoneManagedRecordListView,
|
|
16
|
+
ZoneRegistrationView,
|
|
17
|
+
ZoneRFC2317ChildZoneListView,
|
|
18
|
+
ZoneChildZoneListView,
|
|
13
19
|
)
|
|
14
20
|
|
|
15
21
|
zone_urlpatterns = [
|
|
16
|
-
path("zones/<int:pk>/", ZoneView.as_view(), name="zone"),
|
|
17
22
|
path("zones/", ZoneListView.as_view(), name="zone_list"),
|
|
18
23
|
path("zones/add/", ZoneEditView.as_view(), name="zone_add"),
|
|
19
|
-
path("zones/<int:pk>/edit/", ZoneEditView.as_view(), name="zone_edit"),
|
|
20
|
-
path("zones/<int:pk>/delete/", ZoneDeleteView.as_view(), name="zone_delete"),
|
|
21
24
|
path("zones/import/", ZoneBulkImportView.as_view(), name="zone_import"),
|
|
22
25
|
path("zones/edit/", ZoneBulkEditView.as_view(), name="zone_bulk_edit"),
|
|
23
26
|
path("zones/delete/", ZoneBulkDeleteView.as_view(), name="zone_bulk_delete"),
|
|
24
|
-
path("zones/<int:pk>/",
|
|
27
|
+
path("zones/<int:pk>/", ZoneView.as_view(), name="zone"),
|
|
28
|
+
path("zones/<int:pk>/delete/", ZoneDeleteView.as_view(), name="zone_delete"),
|
|
29
|
+
path("zones/<int:pk>/edit/", ZoneEditView.as_view(), name="zone_edit"),
|
|
30
|
+
path("zones/<int:pk>/records/", ZoneRecordListView.as_view(), name="zone_records"),
|
|
31
|
+
path(
|
|
32
|
+
"zones/<int:pk>/managedrecords/",
|
|
33
|
+
ZoneManagedRecordListView.as_view(),
|
|
34
|
+
name="zone_managed_records",
|
|
35
|
+
),
|
|
36
|
+
path(
|
|
37
|
+
"zones/<int:pk>/rfc2317childzones/",
|
|
38
|
+
ZoneRFC2317ChildZoneListView.as_view(),
|
|
39
|
+
name="zone_rfc2317_child_zones",
|
|
40
|
+
),
|
|
41
|
+
path(
|
|
42
|
+
"zones/<int:pk>/childzones/",
|
|
43
|
+
ZoneChildZoneListView.as_view(),
|
|
44
|
+
name="zone_child_zones",
|
|
45
|
+
),
|
|
46
|
+
path(
|
|
47
|
+
"zones/<int:pk>/registration/",
|
|
48
|
+
ZoneRegistrationView.as_view(),
|
|
49
|
+
name="zone_registration",
|
|
50
|
+
),
|
|
51
|
+
path(
|
|
52
|
+
"zones/<int:pk>/journal/",
|
|
53
|
+
ObjectJournalView.as_view(),
|
|
54
|
+
name="zone_journal",
|
|
55
|
+
kwargs={"model": Zone},
|
|
56
|
+
),
|
|
57
|
+
path(
|
|
58
|
+
"zones/<int:pk>/changelog/",
|
|
59
|
+
ObjectChangeLogView.as_view(),
|
|
60
|
+
name="zone_changelog",
|
|
61
|
+
kwargs={"model": Zone},
|
|
62
|
+
),
|
|
25
63
|
]
|
netbox_dns/urls/zone_template.py
CHANGED
|
@@ -1,31 +1,21 @@
|
|
|
1
|
-
from django.urls import
|
|
1
|
+
from django.urls import path
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from netbox.views.generic import ObjectChangeLogView, ObjectJournalView
|
|
4
4
|
|
|
5
|
+
from netbox_dns.models import ZoneTemplate
|
|
5
6
|
from netbox_dns.views import (
|
|
6
|
-
ZoneTemplateView,
|
|
7
7
|
ZoneTemplateListView,
|
|
8
|
-
|
|
8
|
+
ZoneTemplateView,
|
|
9
9
|
ZoneTemplateDeleteView,
|
|
10
|
+
ZoneTemplateEditView,
|
|
10
11
|
ZoneTemplateBulkImportView,
|
|
11
12
|
ZoneTemplateBulkEditView,
|
|
12
13
|
ZoneTemplateBulkDeleteView,
|
|
13
14
|
)
|
|
14
15
|
|
|
15
16
|
zonetemplate_urlpatterns = [
|
|
16
|
-
path("zonetemplates/<int:pk>/", ZoneTemplateView.as_view(), name="zonetemplate"),
|
|
17
17
|
path("zonetemplates/", ZoneTemplateListView.as_view(), name="zonetemplate_list"),
|
|
18
18
|
path("zonetemplates/add/", ZoneTemplateEditView.as_view(), name="zonetemplate_add"),
|
|
19
|
-
path(
|
|
20
|
-
"zonetemplates/<int:pk>/edit/",
|
|
21
|
-
ZoneTemplateEditView.as_view(),
|
|
22
|
-
name="zonetemplate_edit",
|
|
23
|
-
),
|
|
24
|
-
path(
|
|
25
|
-
"zonetemplates/<int:pk>/delete/",
|
|
26
|
-
ZoneTemplateDeleteView.as_view(),
|
|
27
|
-
name="zonetemplate_delete",
|
|
28
|
-
),
|
|
29
19
|
path(
|
|
30
20
|
"zonetemplates/import/",
|
|
31
21
|
ZoneTemplateBulkImportView.as_view(),
|
|
@@ -41,7 +31,27 @@ zonetemplate_urlpatterns = [
|
|
|
41
31
|
ZoneTemplateBulkDeleteView.as_view(),
|
|
42
32
|
name="zonetemplate_bulk_delete",
|
|
43
33
|
),
|
|
34
|
+
path("zonetemplates/<int:pk>/", ZoneTemplateView.as_view(), name="zonetemplate"),
|
|
35
|
+
path(
|
|
36
|
+
"zonetemplates/<int:pk>/delete/",
|
|
37
|
+
ZoneTemplateDeleteView.as_view(),
|
|
38
|
+
name="zonetemplate_delete",
|
|
39
|
+
),
|
|
40
|
+
path(
|
|
41
|
+
"zonetemplates/<int:pk>/edit/",
|
|
42
|
+
ZoneTemplateEditView.as_view(),
|
|
43
|
+
name="zonetemplate_edit",
|
|
44
|
+
),
|
|
45
|
+
path(
|
|
46
|
+
"zonetemplates/<int:pk>/journal/",
|
|
47
|
+
ObjectJournalView.as_view(),
|
|
48
|
+
name="zonetemplate_journal",
|
|
49
|
+
kwargs={"model": ZoneTemplate},
|
|
50
|
+
),
|
|
44
51
|
path(
|
|
45
|
-
"zonetemplates/<int:pk>/",
|
|
52
|
+
"zonetemplates/<int:pk>/changelog/",
|
|
53
|
+
ObjectChangeLogView.as_view(),
|
|
54
|
+
name="zonetemplate_changelog",
|
|
55
|
+
kwargs={"model": ZoneTemplate},
|
|
46
56
|
),
|
|
47
57
|
]
|
netbox_dns/utilities/__init__.py
CHANGED
|
@@ -1,74 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
from dns import name as dns_name
|
|
4
|
-
from dns.exception import DNSException
|
|
5
|
-
from netaddr import IPNetwork, AddrFormatError
|
|
6
|
-
|
|
7
|
-
from netbox.plugins.utils import get_plugin_config
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class NameFormatError(Exception):
|
|
11
|
-
pass
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def arpa_to_prefix(arpa_name):
|
|
15
|
-
name = arpa_name.rstrip(".")
|
|
16
|
-
|
|
17
|
-
if name.endswith(".in-addr.arpa"):
|
|
18
|
-
address = ".".join(reversed(name.replace(".in-addr.arpa", "").split(".")))
|
|
19
|
-
mask = len(address.split(".")) * 8
|
|
20
|
-
address = address + (32 - mask) // 8 * ".0"
|
|
21
|
-
|
|
22
|
-
try:
|
|
23
|
-
return IPNetwork(f"{address}/{mask}")
|
|
24
|
-
except (AddrFormatError, ValueError):
|
|
25
|
-
return None
|
|
26
|
-
|
|
27
|
-
elif name.endswith("ip6.arpa"):
|
|
28
|
-
address = "".join(reversed(name.replace(".ip6.arpa", "").split(".")))
|
|
29
|
-
mask = len(address)
|
|
30
|
-
address = address + "0" * (32 - mask)
|
|
31
|
-
|
|
32
|
-
try:
|
|
33
|
-
return IPNetwork(
|
|
34
|
-
f"{':'.join([(address[i:i+4]) for i in range(0, 32, 4)])}/{mask*4}"
|
|
35
|
-
)
|
|
36
|
-
except AddrFormatError:
|
|
37
|
-
return None
|
|
38
|
-
|
|
39
|
-
else:
|
|
40
|
-
return None
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def name_to_unicode(name):
|
|
44
|
-
if name == "." and get_plugin_config("netbox_dns", "enable_root_zones"):
|
|
45
|
-
return "."
|
|
46
|
-
|
|
47
|
-
try:
|
|
48
|
-
return dns_name.from_text(name, origin=None).to_unicode()
|
|
49
|
-
except dns_name.IDNAException:
|
|
50
|
-
return name
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def value_to_unicode(value):
|
|
54
|
-
return re.sub(
|
|
55
|
-
r"xn--[0-9a-z-_.]*",
|
|
56
|
-
lambda x: name_to_unicode(x.group(0)),
|
|
57
|
-
value,
|
|
58
|
-
flags=re.IGNORECASE,
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def normalize_name(name):
|
|
63
|
-
if name == "." and get_plugin_config("netbox_dns", "enable_root_zones"):
|
|
64
|
-
return "."
|
|
65
|
-
|
|
66
|
-
try:
|
|
67
|
-
return (
|
|
68
|
-
dns_name.from_text(name, origin=dns_name.root)
|
|
69
|
-
.relativize(dns_name.root)
|
|
70
|
-
.to_text()
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
except DNSException as exc:
|
|
74
|
-
raise NameFormatError from exc
|
|
1
|
+
from .conversions import *
|
|
2
|
+
from .ipam_autodns import *
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
from dns import name as dns_name
|
|
4
|
+
from dns.exception import DNSException
|
|
5
|
+
from netaddr import IPNetwork, AddrFormatError
|
|
6
|
+
|
|
7
|
+
from netbox.plugins.utils import get_plugin_config
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
__all__ = (
|
|
11
|
+
"NameFormatError",
|
|
12
|
+
"arpa_to_prefix",
|
|
13
|
+
"name_to_unicode",
|
|
14
|
+
"value_to_unicode",
|
|
15
|
+
"normalize_name",
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class NameFormatError(Exception):
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def arpa_to_prefix(arpa_name):
|
|
24
|
+
name = arpa_name.rstrip(".")
|
|
25
|
+
|
|
26
|
+
if name.endswith(".in-addr.arpa"):
|
|
27
|
+
address = ".".join(reversed(name.replace(".in-addr.arpa", "").split(".")))
|
|
28
|
+
mask = len(address.split(".")) * 8
|
|
29
|
+
address = address + (32 - mask) // 8 * ".0"
|
|
30
|
+
|
|
31
|
+
try:
|
|
32
|
+
return IPNetwork(f"{address}/{mask}")
|
|
33
|
+
except (AddrFormatError, ValueError):
|
|
34
|
+
return None
|
|
35
|
+
|
|
36
|
+
elif name.endswith("ip6.arpa"):
|
|
37
|
+
address = "".join(reversed(name.replace(".ip6.arpa", "").split(".")))
|
|
38
|
+
mask = len(address)
|
|
39
|
+
address = address + "0" * (32 - mask)
|
|
40
|
+
|
|
41
|
+
try:
|
|
42
|
+
return IPNetwork(
|
|
43
|
+
f"{':'.join([(address[i:i+4]) for i in range(0, 32, 4)])}/{mask*4}"
|
|
44
|
+
)
|
|
45
|
+
except AddrFormatError:
|
|
46
|
+
return None
|
|
47
|
+
|
|
48
|
+
else:
|
|
49
|
+
return None
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def name_to_unicode(name):
|
|
53
|
+
if name == "." and get_plugin_config("netbox_dns", "enable_root_zones"):
|
|
54
|
+
return "."
|
|
55
|
+
|
|
56
|
+
try:
|
|
57
|
+
return dns_name.from_text(name, origin=None).to_unicode()
|
|
58
|
+
except dns_name.IDNAException:
|
|
59
|
+
return name
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def value_to_unicode(value):
|
|
63
|
+
return re.sub(
|
|
64
|
+
r"xn--[0-9a-z-_.]*",
|
|
65
|
+
lambda x: name_to_unicode(x.group(0)),
|
|
66
|
+
value,
|
|
67
|
+
flags=re.IGNORECASE,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def normalize_name(name):
|
|
72
|
+
if name == "." and get_plugin_config("netbox_dns", "enable_root_zones"):
|
|
73
|
+
return "."
|
|
74
|
+
|
|
75
|
+
try:
|
|
76
|
+
return (
|
|
77
|
+
dns_name.from_text(name, origin=dns_name.root)
|
|
78
|
+
.relativize(dns_name.root)
|
|
79
|
+
.to_text()
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
except DNSException as exc:
|
|
83
|
+
raise NameFormatError from exc
|