netbox-plugin-dns 0.21.4__py3-none-any.whl → 1.4.7__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.
- netbox_dns/__init__.py +106 -41
- netbox_dns/api/field_serializers.py +25 -0
- netbox_dns/api/nested_serializers.py +95 -52
- netbox_dns/api/serializers.py +14 -296
- netbox_dns/api/serializers_/__init__.py +0 -0
- netbox_dns/api/serializers_/dnssec_key_template.py +69 -0
- netbox_dns/api/serializers_/dnssec_policy.py +165 -0
- netbox_dns/api/serializers_/nameserver.py +56 -0
- netbox_dns/api/serializers_/prefix.py +18 -0
- netbox_dns/api/serializers_/record.py +105 -0
- netbox_dns/api/serializers_/record_template.py +71 -0
- netbox_dns/api/serializers_/registrar.py +45 -0
- netbox_dns/api/serializers_/registration_contact.py +50 -0
- netbox_dns/api/serializers_/view.py +81 -0
- netbox_dns/api/serializers_/zone.py +247 -0
- netbox_dns/api/serializers_/zone_template.py +157 -0
- netbox_dns/api/urls.py +13 -2
- netbox_dns/api/views.py +96 -58
- netbox_dns/choices/__init__.py +4 -0
- netbox_dns/choices/dnssec_key_template.py +67 -0
- netbox_dns/choices/dnssec_policy.py +40 -0
- netbox_dns/choices/record.py +104 -0
- netbox_dns/choices/utilities.py +4 -0
- netbox_dns/choices/zone.py +119 -0
- netbox_dns/fields/__init__.py +4 -0
- netbox_dns/fields/address.py +22 -16
- netbox_dns/fields/choice_array.py +33 -0
- netbox_dns/fields/ipam.py +15 -0
- netbox_dns/fields/network.py +42 -18
- netbox_dns/fields/rfc2317.py +97 -0
- netbox_dns/fields/timeperiod.py +33 -0
- netbox_dns/filters.py +7 -0
- netbox_dns/filtersets/__init__.py +12 -0
- netbox_dns/filtersets/dnssec_key_template.py +57 -0
- netbox_dns/filtersets/dnssec_policy.py +101 -0
- netbox_dns/filtersets/nameserver.py +46 -0
- netbox_dns/filtersets/record.py +135 -0
- netbox_dns/filtersets/record_template.py +59 -0
- netbox_dns/{filters → filtersets}/registrar.py +8 -1
- netbox_dns/{filters/contact.py → filtersets/registration_contact.py} +9 -3
- netbox_dns/filtersets/view.py +45 -0
- netbox_dns/filtersets/zone.py +254 -0
- netbox_dns/filtersets/zone_template.py +165 -0
- netbox_dns/forms/__init__.py +5 -1
- netbox_dns/forms/dnssec_key_template.py +250 -0
- netbox_dns/forms/dnssec_policy.py +654 -0
- netbox_dns/forms/nameserver.py +121 -27
- netbox_dns/forms/record.py +215 -104
- netbox_dns/forms/record_template.py +285 -0
- netbox_dns/forms/registrar.py +108 -31
- netbox_dns/forms/registration_contact.py +282 -0
- netbox_dns/forms/view.py +331 -20
- netbox_dns/forms/zone.py +769 -373
- netbox_dns/forms/zone_template.py +463 -0
- netbox_dns/graphql/__init__.py +25 -22
- netbox_dns/graphql/enums.py +41 -0
- netbox_dns/graphql/filter_lookups.py +13 -0
- netbox_dns/graphql/filters/__init__.py +12 -0
- netbox_dns/graphql/filters/dnssec_key_template.py +63 -0
- netbox_dns/graphql/filters/dnssec_policy.py +124 -0
- netbox_dns/graphql/filters/nameserver.py +32 -0
- netbox_dns/graphql/filters/record.py +89 -0
- netbox_dns/graphql/filters/record_template.py +55 -0
- netbox_dns/graphql/filters/registrar.py +30 -0
- netbox_dns/graphql/filters/registration_contact.py +27 -0
- netbox_dns/graphql/filters/view.py +28 -0
- netbox_dns/graphql/filters/zone.py +147 -0
- netbox_dns/graphql/filters/zone_template.py +97 -0
- netbox_dns/graphql/schema.py +89 -7
- netbox_dns/graphql/types.py +355 -0
- netbox_dns/locale/de/LC_MESSAGES/django.mo +0 -0
- netbox_dns/locale/en/LC_MESSAGES/django.mo +0 -0
- netbox_dns/locale/fr/LC_MESSAGES/django.mo +0 -0
- netbox_dns/management/commands/cleanup_database.py +175 -156
- netbox_dns/management/commands/cleanup_rrset_ttl.py +64 -0
- netbox_dns/management/commands/rebuild_dnssync.py +23 -0
- netbox_dns/management/commands/setup_dnssync.py +140 -0
- netbox_dns/migrations/0001_squashed_netbox_dns_0_15.py +0 -27
- netbox_dns/migrations/0001_squashed_netbox_dns_0_22.py +557 -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/0006_templating.py +172 -0
- netbox_dns/migrations/0007_alter_ordering_options.py +25 -0
- netbox_dns/migrations/0008_view_prefixes.py +18 -0
- netbox_dns/migrations/0009_rename_contact_registrationcontact.py +36 -0
- netbox_dns/migrations/0010_view_ip_address_filter.py +18 -0
- netbox_dns/migrations/0011_rename_related_fields.py +63 -0
- netbox_dns/migrations/0012_natural_ordering.py +88 -0
- netbox_dns/migrations/0013_zonetemplate_soa_mname_zonetemplate_soa_rname.py +30 -0
- netbox_dns/migrations/0014_alter_unique_constraints_lowercase.py +42 -0
- netbox_dns/migrations/0015_dnssec.py +168 -0
- netbox_dns/migrations/{0015_add_record_status.py → 0016_dnssec_policy_status.py} +5 -4
- netbox_dns/migrations/0017_dnssec_policy_zone_zone_template.py +41 -0
- netbox_dns/migrations/0018_zone_domain_status_zone_expiration_date.py +23 -0
- netbox_dns/migrations/0019_dnssecpolicy_parental_agents.py +25 -0
- netbox_dns/migrations/0020_netbox_3_4.py +1 -1
- netbox_dns/migrations/0020_remove_dnssecpolicy_parental_agents_and_more.py +29 -0
- netbox_dns/migrations/0021_alter_record_ptr_record.py +25 -0
- netbox_dns/migrations/0021_record_ip_address.py +1 -1
- netbox_dns/migrations/0022_alter_record_ipam_ip_address.py +26 -0
- netbox_dns/migrations/0023_disable_ptr_false.py +27 -0
- netbox_dns/migrations/0024_zonetemplate_parental_agents.py +25 -0
- netbox_dns/migrations/0025_remove_zone_inline_signing_and_more.py +22 -0
- netbox_dns/migrations/0026_alter_dnssecpolicy_nsec3_opt_out.py +18 -0
- netbox_dns/migrations/0026_domain_registration.py +1 -1
- netbox_dns/migrations/0027_zone_comments.py +18 -0
- netbox_dns/migrations/0028_alter_zone_default_ttl_alter_zone_soa_minimum_and_more.py +54 -0
- netbox_dns/migrations/0028_rfc2317_fields.py +44 -0
- netbox_dns/migrations/0029_alter_registrationcontact_street.py +18 -0
- netbox_dns/migrations/0029_record_fqdn.py +30 -0
- netbox_dns/mixins/__init__.py +1 -0
- netbox_dns/mixins/object_modification.py +57 -0
- netbox_dns/models/__init__.py +5 -1
- netbox_dns/models/dnssec_key_template.py +114 -0
- netbox_dns/models/dnssec_policy.py +203 -0
- netbox_dns/models/nameserver.py +61 -30
- netbox_dns/models/record.py +781 -234
- netbox_dns/models/record_template.py +198 -0
- netbox_dns/models/registrar.py +34 -15
- netbox_dns/models/{contact.py → registration_contact.py} +72 -43
- netbox_dns/models/view.py +129 -9
- netbox_dns/models/zone.py +806 -242
- netbox_dns/models/zone_template.py +209 -0
- netbox_dns/navigation.py +176 -76
- netbox_dns/signals/__init__.py +0 -0
- netbox_dns/signals/dnssec.py +32 -0
- netbox_dns/signals/ipam_dnssync.py +216 -0
- netbox_dns/tables/__init__.py +5 -1
- netbox_dns/tables/dnssec_key_template.py +49 -0
- netbox_dns/tables/dnssec_policy.py +140 -0
- netbox_dns/tables/ipam_dnssync.py +12 -0
- netbox_dns/tables/nameserver.py +14 -17
- netbox_dns/tables/record.py +117 -59
- netbox_dns/tables/record_template.py +91 -0
- netbox_dns/tables/registrar.py +20 -10
- netbox_dns/tables/{contact.py → registration_contact.py} +22 -11
- netbox_dns/tables/view.py +47 -3
- netbox_dns/tables/zone.py +62 -31
- netbox_dns/tables/zone_template.py +78 -0
- netbox_dns/template_content.py +124 -38
- netbox_dns/templates/netbox_dns/dnsseckeytemplate.html +70 -0
- netbox_dns/templates/netbox_dns/dnssecpolicy.html +163 -0
- netbox_dns/templates/netbox_dns/nameserver.html +31 -28
- netbox_dns/templates/netbox_dns/record/managed.html +2 -1
- netbox_dns/templates/netbox_dns/record/related.html +17 -6
- netbox_dns/templates/netbox_dns/record.html +140 -93
- netbox_dns/templates/netbox_dns/recordtemplate.html +96 -0
- netbox_dns/templates/netbox_dns/registrar.html +41 -34
- netbox_dns/templates/netbox_dns/registrationcontact.html +76 -0
- netbox_dns/templates/netbox_dns/view/button.html +10 -0
- netbox_dns/templates/netbox_dns/view/prefix.html +44 -0
- netbox_dns/templates/netbox_dns/view/related.html +33 -0
- netbox_dns/templates/netbox_dns/view.html +62 -18
- netbox_dns/templates/netbox_dns/zone/base.html +6 -3
- netbox_dns/templates/netbox_dns/zone/child.html +6 -5
- netbox_dns/templates/netbox_dns/zone/child_zone.html +18 -0
- netbox_dns/templates/netbox_dns/zone/delegation_record.html +18 -0
- netbox_dns/templates/netbox_dns/zone/managed_record.html +1 -1
- netbox_dns/templates/netbox_dns/zone/record.html +6 -5
- netbox_dns/templates/netbox_dns/zone/registration.html +43 -24
- netbox_dns/templates/netbox_dns/zone/rfc2317_child_zone.html +18 -0
- netbox_dns/templates/netbox_dns/zone.html +178 -119
- netbox_dns/templates/netbox_dns/zonetemplate/child.html +46 -0
- netbox_dns/templates/netbox_dns/zonetemplate.html +124 -0
- netbox_dns/templatetags/netbox_dns.py +10 -0
- netbox_dns/urls.py +50 -210
- netbox_dns/utilities/__init__.py +3 -0
- netbox_dns/{utilities.py → utilities/conversions.py} +55 -7
- netbox_dns/utilities/dns.py +11 -0
- netbox_dns/utilities/ipam_dnssync.py +370 -0
- netbox_dns/validators/__init__.py +4 -0
- netbox_dns/validators/dns_name.py +116 -0
- netbox_dns/validators/dns_value.py +147 -0
- netbox_dns/validators/dnssec.py +148 -0
- netbox_dns/validators/rfc2317.py +28 -0
- netbox_dns/views/__init__.py +5 -1
- netbox_dns/views/dnssec_key_template.py +78 -0
- netbox_dns/views/dnssec_policy.py +146 -0
- netbox_dns/views/nameserver.py +34 -15
- netbox_dns/views/record.py +156 -15
- netbox_dns/views/record_template.py +93 -0
- netbox_dns/views/registrar.py +32 -13
- netbox_dns/views/registration_contact.py +101 -0
- netbox_dns/views/view.py +58 -14
- netbox_dns/views/zone.py +130 -33
- netbox_dns/views/zone_template.py +82 -0
- netbox_plugin_dns-1.4.7.dist-info/METADATA +132 -0
- netbox_plugin_dns-1.4.7.dist-info/RECORD +201 -0
- {netbox_plugin_dns-0.21.4.dist-info → netbox_plugin_dns-1.4.7.dist-info}/WHEEL +2 -1
- {netbox_plugin_dns-0.21.4.dist-info → netbox_plugin_dns-1.4.7.dist-info/licenses}/LICENSE +2 -1
- netbox_plugin_dns-1.4.7.dist-info/top_level.txt +1 -0
- netbox_dns/filters/__init__.py +0 -6
- netbox_dns/filters/nameserver.py +0 -18
- netbox_dns/filters/record.py +0 -53
- netbox_dns/filters/view.py +0 -18
- netbox_dns/filters/zone.py +0 -112
- netbox_dns/forms/contact.py +0 -211
- 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/management/commands/setup_coupling.py +0 -75
- netbox_dns/management/commands/update_soa.py +0 -22
- netbox_dns/middleware.py +0 -226
- 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/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/templates/netbox_dns/contact.html +0 -71
- netbox_dns/templates/netbox_dns/related_dns_objects.html +0 -21
- netbox_dns/templatetags/view_helpers.py +0 -15
- netbox_dns/validators.py +0 -57
- netbox_dns/views/contact.py +0 -83
- netbox_plugin_dns-0.21.4.dist-info/METADATA +0 -101
- netbox_plugin_dns-0.21.4.dist-info/RECORD +0 -110
netbox_dns/urls.py
CHANGED
|
@@ -1,255 +1,95 @@
|
|
|
1
|
-
from django.urls import path
|
|
1
|
+
from django.urls import include, path
|
|
2
2
|
|
|
3
|
-
from
|
|
3
|
+
from utilities.urls import get_model_urls
|
|
4
|
+
|
|
5
|
+
# +
|
|
6
|
+
# Import views so the register_model_view is run. This is required for the
|
|
7
|
+
# URLs to be set up properly with get_model_urls().
|
|
8
|
+
# -
|
|
9
|
+
from .views import * # noqa: F401
|
|
4
10
|
|
|
5
|
-
from netbox_dns.models import View, Zone, Record, NameServer, Contact, Registrar
|
|
6
|
-
from netbox_dns.views import (
|
|
7
|
-
# zone
|
|
8
|
-
ZoneListView,
|
|
9
|
-
ZoneView,
|
|
10
|
-
ZoneDeleteView,
|
|
11
|
-
ZoneEditView,
|
|
12
|
-
ZoneBulkImportView,
|
|
13
|
-
ZoneBulkEditView,
|
|
14
|
-
ZoneBulkDeleteView,
|
|
15
|
-
ZoneRecordListView,
|
|
16
|
-
ZoneManagedRecordListView,
|
|
17
|
-
ZoneRegistrationView,
|
|
18
|
-
# nameserver
|
|
19
|
-
NameServerListView,
|
|
20
|
-
NameServerView,
|
|
21
|
-
NameServerEditView,
|
|
22
|
-
NameServerDeleteView,
|
|
23
|
-
NameServerBulkImportView,
|
|
24
|
-
NameServerBulkEditView,
|
|
25
|
-
NameServerBulkDeleteView,
|
|
26
|
-
NameServerZoneListView,
|
|
27
|
-
NameServerSOAZoneListView,
|
|
28
|
-
# record
|
|
29
|
-
RecordListView,
|
|
30
|
-
RecordView,
|
|
31
|
-
RecordEditView,
|
|
32
|
-
RecordDeleteView,
|
|
33
|
-
RecordBulkImportView,
|
|
34
|
-
RecordBulkEditView,
|
|
35
|
-
RecordBulkDeleteView,
|
|
36
|
-
# managed record
|
|
37
|
-
ManagedRecordListView,
|
|
38
|
-
# view
|
|
39
|
-
ViewListView,
|
|
40
|
-
ViewView,
|
|
41
|
-
ViewDeleteView,
|
|
42
|
-
ViewEditView,
|
|
43
|
-
ViewBulkImportView,
|
|
44
|
-
ViewBulkEditView,
|
|
45
|
-
ViewBulkDeleteView,
|
|
46
|
-
ViewZoneListView,
|
|
47
|
-
# contact
|
|
48
|
-
ContactListView,
|
|
49
|
-
ContactView,
|
|
50
|
-
ContactDeleteView,
|
|
51
|
-
ContactEditView,
|
|
52
|
-
ContactBulkImportView,
|
|
53
|
-
ContactBulkEditView,
|
|
54
|
-
ContactBulkDeleteView,
|
|
55
|
-
ContactZoneListView,
|
|
56
|
-
# registrar
|
|
57
|
-
RegistrarListView,
|
|
58
|
-
RegistrarView,
|
|
59
|
-
RegistrarDeleteView,
|
|
60
|
-
RegistrarEditView,
|
|
61
|
-
RegistrarBulkImportView,
|
|
62
|
-
RegistrarBulkEditView,
|
|
63
|
-
RegistrarBulkDeleteView,
|
|
64
|
-
RegistrarZoneListView,
|
|
65
|
-
)
|
|
66
11
|
|
|
67
12
|
app_name = "netbox_dns"
|
|
68
13
|
|
|
69
|
-
urlpatterns =
|
|
70
|
-
#
|
|
71
|
-
# Zone urls
|
|
72
|
-
#
|
|
73
|
-
path("zones/", ZoneListView.as_view(), name="zone_list"),
|
|
74
|
-
path("zones/add/", ZoneEditView.as_view(), name="zone_add"),
|
|
75
|
-
path("zones/import/", ZoneBulkImportView.as_view(), name="zone_import"),
|
|
76
|
-
path("zones/edit/", ZoneBulkEditView.as_view(), name="zone_bulk_edit"),
|
|
77
|
-
path("zones/delete/", ZoneBulkDeleteView.as_view(), name="zone_bulk_delete"),
|
|
78
|
-
path("zones/<int:pk>/", ZoneView.as_view(), name="zone"),
|
|
79
|
-
path("zones/<int:pk>/delete/", ZoneDeleteView.as_view(), name="zone_delete"),
|
|
80
|
-
path("zones/<int:pk>/edit/", ZoneEditView.as_view(), name="zone_edit"),
|
|
81
|
-
path(
|
|
82
|
-
"zones/<int:pk>/changelog/",
|
|
83
|
-
ObjectChangeLogView.as_view(),
|
|
84
|
-
name="zone_changelog",
|
|
85
|
-
kwargs={"model": Zone},
|
|
86
|
-
),
|
|
87
|
-
path("zones/<int:pk>/records/", ZoneRecordListView.as_view(), name="zone_records"),
|
|
88
|
-
path(
|
|
89
|
-
"zones/<int:pk>/managedrecords/",
|
|
90
|
-
ZoneManagedRecordListView.as_view(),
|
|
91
|
-
name="zone_managed_records",
|
|
92
|
-
),
|
|
93
|
-
path(
|
|
94
|
-
"zones/<int:pk>/registration/",
|
|
95
|
-
ZoneRegistrationView.as_view(),
|
|
96
|
-
name="zone_registration",
|
|
97
|
-
),
|
|
98
|
-
#
|
|
99
|
-
# NameServer urls
|
|
100
|
-
#
|
|
101
|
-
path("nameservers/", NameServerListView.as_view(), name="nameserver_list"),
|
|
102
|
-
path("nameservers/add/", NameServerEditView.as_view(), name="nameserver_add"),
|
|
103
|
-
path(
|
|
104
|
-
"nameservers/import/",
|
|
105
|
-
NameServerBulkImportView.as_view(),
|
|
106
|
-
name="nameserver_import",
|
|
107
|
-
),
|
|
14
|
+
urlpatterns = (
|
|
108
15
|
path(
|
|
109
|
-
"nameservers/
|
|
110
|
-
|
|
111
|
-
name="nameserver_bulk_edit",
|
|
16
|
+
"nameservers/",
|
|
17
|
+
include(get_model_urls("netbox_dns", "nameserver", detail=False)),
|
|
112
18
|
),
|
|
113
19
|
path(
|
|
114
|
-
"nameservers
|
|
115
|
-
|
|
116
|
-
name="nameserver_bulk_delete",
|
|
117
|
-
),
|
|
118
|
-
path("nameservers/<int:pk>/", NameServerView.as_view(), name="nameserver"),
|
|
119
|
-
path(
|
|
120
|
-
"nameservers/<int:pk>/edit",
|
|
121
|
-
NameServerEditView.as_view(),
|
|
122
|
-
name="nameserver_edit",
|
|
20
|
+
"nameservers/<int:pk>/",
|
|
21
|
+
include(get_model_urls("netbox_dns", "nameserver")),
|
|
123
22
|
),
|
|
124
23
|
path(
|
|
125
|
-
"
|
|
126
|
-
|
|
127
|
-
name="nameserver_delete",
|
|
24
|
+
"recordtemplates/",
|
|
25
|
+
include(get_model_urls("netbox_dns", "recordtemplate", detail=False)),
|
|
128
26
|
),
|
|
129
27
|
path(
|
|
130
|
-
"
|
|
131
|
-
|
|
132
|
-
name="nameserver_changelog",
|
|
133
|
-
kwargs={"model": NameServer},
|
|
28
|
+
"recordtemplates/<int:pk>/",
|
|
29
|
+
include(get_model_urls("netbox_dns", "recordtemplate")),
|
|
134
30
|
),
|
|
135
31
|
path(
|
|
136
|
-
"
|
|
137
|
-
|
|
138
|
-
name="nameserver_zones",
|
|
32
|
+
"records/",
|
|
33
|
+
include(get_model_urls("netbox_dns", "record", detail=False)),
|
|
139
34
|
),
|
|
140
35
|
path(
|
|
141
|
-
"
|
|
142
|
-
|
|
143
|
-
name="nameserver_soa_zones",
|
|
36
|
+
"records/<int:pk>/",
|
|
37
|
+
include(get_model_urls("netbox_dns", "record")),
|
|
144
38
|
),
|
|
145
|
-
#
|
|
146
|
-
# Record urls
|
|
147
|
-
#
|
|
148
|
-
path("records/", RecordListView.as_view(), name="record_list"),
|
|
149
|
-
path("records/add/", RecordEditView.as_view(), name="record_add"),
|
|
150
|
-
path("records/import/", RecordBulkImportView.as_view(), name="record_import"),
|
|
151
|
-
path("records/edit/", RecordBulkEditView.as_view(), name="record_bulk_edit"),
|
|
152
|
-
path("records/delete/", RecordBulkDeleteView.as_view(), name="record_bulk_delete"),
|
|
153
|
-
path("records/<int:pk>/", RecordView.as_view(), name="record"),
|
|
154
|
-
path("records/<int:pk>/edit/", RecordEditView.as_view(), name="record_edit"),
|
|
155
|
-
path("records/<int:pk>/delete/", RecordDeleteView.as_view(), name="record_delete"),
|
|
156
39
|
path(
|
|
157
|
-
"
|
|
158
|
-
|
|
159
|
-
name="record_changelog",
|
|
160
|
-
kwargs={"model": Record},
|
|
40
|
+
"registrars",
|
|
41
|
+
include(get_model_urls("netbox_dns", "registrar", detail=False)),
|
|
161
42
|
),
|
|
162
43
|
path(
|
|
163
|
-
"
|
|
44
|
+
"registrars/<int:pk>/",
|
|
45
|
+
include(get_model_urls("netbox_dns", "registrar")),
|
|
164
46
|
),
|
|
165
|
-
#
|
|
166
|
-
# View urls
|
|
167
|
-
#
|
|
168
|
-
path("views/", ViewListView.as_view(), name="view_list"),
|
|
169
|
-
path("views/add/", ViewEditView.as_view(), name="view_add"),
|
|
170
|
-
path("views/import/", ViewBulkImportView.as_view(), name="view_import"),
|
|
171
|
-
path("views/edit/", ViewBulkEditView.as_view(), name="view_bulk_edit"),
|
|
172
|
-
path("views/delete/", ViewBulkDeleteView.as_view(), name="view_bulk_delete"),
|
|
173
|
-
path("views/<int:pk>/", ViewView.as_view(), name="view"),
|
|
174
|
-
path("views/<int:pk>/edit/", ViewEditView.as_view(), name="view_edit"),
|
|
175
|
-
path("views/<int:pk>/delete/", ViewDeleteView.as_view(), name="view_delete"),
|
|
176
|
-
path("views/<int:pk>/zones/", ViewZoneListView.as_view(), name="view_zones"),
|
|
177
47
|
path(
|
|
178
|
-
"
|
|
179
|
-
|
|
180
|
-
name="view_changelog",
|
|
181
|
-
kwargs={"model": View},
|
|
48
|
+
"registrationcontacts/",
|
|
49
|
+
include(get_model_urls("netbox_dns", "registrationcontact", detail=False)),
|
|
182
50
|
),
|
|
183
|
-
#
|
|
184
|
-
# Contact urls
|
|
185
|
-
#
|
|
186
|
-
path("contacts/", ContactListView.as_view(), name="contact_list"),
|
|
187
|
-
path("contacts/add/", ContactEditView.as_view(), name="contact_add"),
|
|
188
|
-
path("contacts/import/", ContactBulkImportView.as_view(), name="contact_import"),
|
|
189
|
-
path("contacts/edit/", ContactBulkEditView.as_view(), name="contact_bulk_edit"),
|
|
190
51
|
path(
|
|
191
|
-
"
|
|
192
|
-
|
|
193
|
-
name="contact_bulk_delete",
|
|
52
|
+
"registrationcontacts/<int:pk>/",
|
|
53
|
+
include(get_model_urls("netbox_dns", "registrationcontact")),
|
|
194
54
|
),
|
|
195
|
-
path("contacts/<int:pk>/", ContactView.as_view(), name="contact"),
|
|
196
|
-
path("contacts/<int:pk>/edit/", ContactEditView.as_view(), name="contact_edit"),
|
|
197
55
|
path(
|
|
198
|
-
"
|
|
199
|
-
|
|
200
|
-
name="contact_delete",
|
|
56
|
+
"views/",
|
|
57
|
+
include(get_model_urls("netbox_dns", "view", detail=False)),
|
|
201
58
|
),
|
|
202
59
|
path(
|
|
203
|
-
"
|
|
204
|
-
|
|
205
|
-
name="contact_zones",
|
|
60
|
+
"views/<int:pk>/",
|
|
61
|
+
include(get_model_urls("netbox_dns", "view")),
|
|
206
62
|
),
|
|
207
63
|
path(
|
|
208
|
-
"
|
|
209
|
-
|
|
210
|
-
name="contact_changelog",
|
|
211
|
-
kwargs={"model": Contact},
|
|
64
|
+
"zonetemplates/",
|
|
65
|
+
include(get_model_urls("netbox_dns", "zonetemplate", detail=False)),
|
|
212
66
|
),
|
|
213
|
-
#
|
|
214
|
-
# Registrar urls
|
|
215
|
-
#
|
|
216
|
-
path("registrars/", RegistrarListView.as_view(), name="registrar_list"),
|
|
217
|
-
path("registrars/add/", RegistrarEditView.as_view(), name="registrar_add"),
|
|
218
67
|
path(
|
|
219
|
-
"
|
|
220
|
-
|
|
221
|
-
name="registrar_import",
|
|
68
|
+
"zonetemplates/<int:pk>/",
|
|
69
|
+
include(get_model_urls("netbox_dns", "zonetemplate")),
|
|
222
70
|
),
|
|
223
71
|
path(
|
|
224
|
-
"
|
|
225
|
-
|
|
226
|
-
name="registrar_bulk_edit",
|
|
72
|
+
"zones/",
|
|
73
|
+
include(get_model_urls("netbox_dns", "zone", detail=False)),
|
|
227
74
|
),
|
|
228
75
|
path(
|
|
229
|
-
"
|
|
230
|
-
|
|
231
|
-
name="registrar_bulk_delete",
|
|
76
|
+
"zones/<int:pk>/",
|
|
77
|
+
include(get_model_urls("netbox_dns", "zone")),
|
|
232
78
|
),
|
|
233
|
-
path("registrars/<int:pk>/", RegistrarView.as_view(), name="registrar"),
|
|
234
79
|
path(
|
|
235
|
-
"
|
|
236
|
-
|
|
237
|
-
name="registrar_edit",
|
|
80
|
+
"dnsseckeytemplates/",
|
|
81
|
+
include(get_model_urls("netbox_dns", "dnsseckeytemplate", detail=False)),
|
|
238
82
|
),
|
|
239
83
|
path(
|
|
240
|
-
"
|
|
241
|
-
|
|
242
|
-
name="registrar_delete",
|
|
84
|
+
"dnsseckeytemplates/<int:pk>/",
|
|
85
|
+
include(get_model_urls("netbox_dns", "dnsseckeytemplate")),
|
|
243
86
|
),
|
|
244
87
|
path(
|
|
245
|
-
"
|
|
246
|
-
|
|
247
|
-
name="registrar_zones",
|
|
88
|
+
"dnssecpolicies/",
|
|
89
|
+
include(get_model_urls("netbox_dns", "dnssecpolicy", detail=False)),
|
|
248
90
|
),
|
|
249
91
|
path(
|
|
250
|
-
"
|
|
251
|
-
|
|
252
|
-
name="registrar_changelog",
|
|
253
|
-
kwargs={"model": Registrar},
|
|
92
|
+
"dnssecpolicies/<int:pk>/",
|
|
93
|
+
include(get_model_urls("netbox_dns", "dnssecpolicy")),
|
|
254
94
|
),
|
|
255
|
-
|
|
95
|
+
)
|
|
@@ -4,12 +4,21 @@ 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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
from django.utils.dateparse import parse_duration
|
|
8
|
+
|
|
9
|
+
from netbox.plugins.utils import get_plugin_config
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
__all__ = (
|
|
13
|
+
"NameFormatError",
|
|
14
|
+
"arpa_to_prefix",
|
|
15
|
+
"name_to_unicode",
|
|
16
|
+
"value_to_unicode",
|
|
17
|
+
"normalize_name",
|
|
18
|
+
"network_to_reverse",
|
|
19
|
+
"regex_from_list",
|
|
20
|
+
"iso8601_to_int",
|
|
21
|
+
)
|
|
13
22
|
|
|
14
23
|
|
|
15
24
|
class NameFormatError(Exception):
|
|
@@ -22,10 +31,11 @@ def arpa_to_prefix(arpa_name):
|
|
|
22
31
|
if name.endswith(".in-addr.arpa"):
|
|
23
32
|
address = ".".join(reversed(name.replace(".in-addr.arpa", "").split(".")))
|
|
24
33
|
mask = len(address.split(".")) * 8
|
|
34
|
+
address = address + (32 - mask) // 8 * ".0"
|
|
25
35
|
|
|
26
36
|
try:
|
|
27
37
|
return IPNetwork(f"{address}/{mask}")
|
|
28
|
-
except AddrFormatError:
|
|
38
|
+
except (AddrFormatError, ValueError):
|
|
29
39
|
return None
|
|
30
40
|
|
|
31
41
|
elif name.endswith("ip6.arpa"):
|
|
@@ -76,3 +86,41 @@ def normalize_name(name):
|
|
|
76
86
|
|
|
77
87
|
except DNSException as exc:
|
|
78
88
|
raise NameFormatError from exc
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def network_to_reverse(network):
|
|
92
|
+
try:
|
|
93
|
+
ip_network = IPNetwork(network)
|
|
94
|
+
except AddrFormatError:
|
|
95
|
+
return
|
|
96
|
+
|
|
97
|
+
if ip_network.first == ip_network.last:
|
|
98
|
+
return
|
|
99
|
+
|
|
100
|
+
labels = None
|
|
101
|
+
match ip_network.version:
|
|
102
|
+
case 4:
|
|
103
|
+
if not ip_network.prefixlen % 8:
|
|
104
|
+
labels = 3 + ip_network.prefixlen // 8
|
|
105
|
+
case 6:
|
|
106
|
+
if not ip_network.prefixlen % 4:
|
|
107
|
+
labels = 3 + ip_network.prefixlen // 4
|
|
108
|
+
case _:
|
|
109
|
+
return
|
|
110
|
+
|
|
111
|
+
if labels:
|
|
112
|
+
return ".".join(ip_network[0].reverse_dns.split(".")[-labels:])
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def regex_from_list(names):
|
|
116
|
+
return f"^({'|'.join(re.escape(name) for name in names)})$"
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def iso8601_to_int(value):
|
|
120
|
+
try:
|
|
121
|
+
return int(value)
|
|
122
|
+
except ValueError:
|
|
123
|
+
duration = parse_duration(value)
|
|
124
|
+
if duration is None:
|
|
125
|
+
raise TypeError
|
|
126
|
+
return int(duration.total_seconds())
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from dns import name as dns_name
|
|
2
|
+
|
|
3
|
+
__all__ = ("get_parent_zone_names",)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def get_parent_zone_names(name, min_labels=1, include_self=False):
|
|
7
|
+
fqdn = dns_name.from_text(name.lower())
|
|
8
|
+
return [
|
|
9
|
+
fqdn.split(i)[1].to_text().rstrip(".")
|
|
10
|
+
for i in range(min_labels + 1, len(fqdn.labels) + include_self)
|
|
11
|
+
]
|