netbox-plugin-dns 1.3b1__py3-none-any.whl → 1.3.1__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 +3 -2
- netbox_dns/api/nested_serializers.py +54 -49
- netbox_dns/api/serializers_/dnssec_key_template.py +22 -13
- netbox_dns/api/serializers_/dnssec_policy.py +89 -40
- netbox_dns/api/serializers_/nameserver.py +25 -13
- netbox_dns/api/serializers_/record.py +46 -38
- netbox_dns/api/serializers_/record_template.py +21 -12
- netbox_dns/api/serializers_/registrar.py +14 -5
- netbox_dns/api/serializers_/registration_contact.py +13 -5
- netbox_dns/api/serializers_/view.py +28 -19
- netbox_dns/api/serializers_/zone.py +87 -62
- netbox_dns/api/serializers_/zone_template.py +40 -34
- netbox_dns/choices/dnssec_key_template.py +4 -0
- netbox_dns/choices/record.py +4 -2
- netbox_dns/filtersets/dnssec_key_template.py +10 -4
- netbox_dns/filtersets/dnssec_policy.py +2 -0
- netbox_dns/filtersets/nameserver.py +9 -4
- netbox_dns/filtersets/record.py +16 -15
- netbox_dns/filtersets/record_template.py +13 -12
- netbox_dns/filtersets/registrar.py +1 -0
- netbox_dns/filtersets/registration_contact.py +1 -0
- netbox_dns/filtersets/view.py +10 -4
- netbox_dns/filtersets/zone.py +39 -20
- netbox_dns/filtersets/zone_template.py +10 -9
- netbox_dns/forms/dnssec_key_template.py +97 -46
- netbox_dns/forms/dnssec_policy.py +124 -105
- netbox_dns/forms/nameserver.py +71 -36
- netbox_dns/forms/record.py +96 -78
- netbox_dns/forms/record_template.py +87 -59
- netbox_dns/forms/registrar.py +55 -39
- netbox_dns/forms/registration_contact.py +64 -41
- netbox_dns/forms/view.py +98 -51
- netbox_dns/forms/zone.py +273 -243
- netbox_dns/forms/zone_template.py +151 -101
- netbox_dns/graphql/types.py +3 -3
- netbox_dns/locale/de/LC_MESSAGES/django.mo +0 -0
- netbox_dns/locale/fr/LC_MESSAGES/django.mo +0 -0
- netbox_dns/migrations/0019_dnssecpolicy_parental_agents.py +25 -0
- 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/models/dnssec_key_template.py +24 -22
- netbox_dns/models/dnssec_policy.py +17 -16
- netbox_dns/models/nameserver.py +26 -25
- netbox_dns/models/record.py +117 -61
- netbox_dns/models/record_template.py +30 -29
- netbox_dns/models/registrar.py +13 -12
- netbox_dns/models/registration_contact.py +33 -32
- netbox_dns/models/view.py +16 -15
- netbox_dns/models/zone.py +88 -57
- netbox_dns/models/zone_template.py +35 -34
- netbox_dns/tables/dnssec_key_template.py +13 -12
- netbox_dns/tables/dnssec_policy.py +18 -15
- netbox_dns/tables/nameserver.py +10 -8
- netbox_dns/tables/record.py +55 -34
- netbox_dns/tables/record_template.py +21 -17
- netbox_dns/tables/registrar.py +15 -9
- netbox_dns/tables/registration_contact.py +15 -9
- netbox_dns/tables/view.py +25 -12
- netbox_dns/tables/zone.py +23 -21
- netbox_dns/tables/zone_template.py +17 -13
- netbox_dns/template_content.py +13 -2
- netbox_dns/templates/netbox_dns/record.html +13 -11
- netbox_dns/templates/netbox_dns/zone.html +10 -0
- netbox_dns/validators/dns_name.py +1 -1
- netbox_dns/views/dnssec_key_template.py +3 -3
- netbox_dns/views/record.py +19 -3
- netbox_dns/views/record_template.py +3 -1
- netbox_dns/views/zone_template.py +5 -3
- {netbox_plugin_dns-1.3b1.dist-info → netbox_plugin_dns-1.3.1.dist-info}/METADATA +3 -2
- {netbox_plugin_dns-1.3b1.dist-info → netbox_plugin_dns-1.3.1.dist-info}/RECORD +73 -70
- {netbox_plugin_dns-1.3b1.dist-info → netbox_plugin_dns-1.3.1.dist-info}/WHEEL +1 -1
- {netbox_plugin_dns-1.3b1.dist-info → netbox_plugin_dns-1.3.1.dist-info}/licenses/LICENSE +0 -0
- {netbox_plugin_dns-1.3b1.dist-info → netbox_plugin_dns-1.3.1.dist-info}/top_level.txt +0 -0
netbox_dns/models/zone.py
CHANGED
|
@@ -16,6 +16,7 @@ from django.db.models.functions import Length, Lower
|
|
|
16
16
|
from django.db.models.signals import m2m_changed
|
|
17
17
|
from django.dispatch import receiver
|
|
18
18
|
from django.conf import settings
|
|
19
|
+
from django.contrib.postgres.fields import ArrayField
|
|
19
20
|
from django.utils.translation import gettext_lazy as _
|
|
20
21
|
|
|
21
22
|
from netbox.models import NetBoxModel
|
|
@@ -81,6 +82,80 @@ class ZoneManager(models.Manager.from_queryset(RestrictedQuerySet)):
|
|
|
81
82
|
|
|
82
83
|
|
|
83
84
|
class Zone(ObjectModificationMixin, ContactsMixin, NetBoxModel):
|
|
85
|
+
class Meta:
|
|
86
|
+
verbose_name = _("Zone")
|
|
87
|
+
verbose_name_plural = _("Zones")
|
|
88
|
+
|
|
89
|
+
ordering = (
|
|
90
|
+
"view",
|
|
91
|
+
"name",
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
constraints = [
|
|
95
|
+
UniqueConstraint(
|
|
96
|
+
Lower("name"),
|
|
97
|
+
"view",
|
|
98
|
+
name="name_view_unique_ci",
|
|
99
|
+
violation_error_message=_(
|
|
100
|
+
"There is already a zone with the same name in this view"
|
|
101
|
+
),
|
|
102
|
+
),
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
clone_fields = (
|
|
106
|
+
"view",
|
|
107
|
+
"name",
|
|
108
|
+
"description",
|
|
109
|
+
"status",
|
|
110
|
+
"nameservers",
|
|
111
|
+
"default_ttl",
|
|
112
|
+
"soa_ttl",
|
|
113
|
+
"soa_mname",
|
|
114
|
+
"soa_rname",
|
|
115
|
+
"soa_refresh",
|
|
116
|
+
"soa_retry",
|
|
117
|
+
"soa_expire",
|
|
118
|
+
"soa_minimum",
|
|
119
|
+
"tenant",
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
soa_clean_fields = {
|
|
123
|
+
"description",
|
|
124
|
+
"status",
|
|
125
|
+
"dnssec_policy",
|
|
126
|
+
"inline_signing",
|
|
127
|
+
"parental_agents",
|
|
128
|
+
"registrar",
|
|
129
|
+
"registry_domain_id",
|
|
130
|
+
"expiration_date",
|
|
131
|
+
"domain_status",
|
|
132
|
+
"registrant",
|
|
133
|
+
"admin_c",
|
|
134
|
+
"tech_c",
|
|
135
|
+
"billing_c",
|
|
136
|
+
"rfc2317_parent_managed",
|
|
137
|
+
"tenant",
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
objects = ZoneManager()
|
|
141
|
+
|
|
142
|
+
def __str__(self):
|
|
143
|
+
if self.name == "." and get_plugin_config("netbox_dns", "enable_root_zones"):
|
|
144
|
+
name = ". (root zone)"
|
|
145
|
+
else:
|
|
146
|
+
try:
|
|
147
|
+
name = dns_name.from_text(self.name, origin=None).to_unicode()
|
|
148
|
+
except DNSException:
|
|
149
|
+
name = self.name
|
|
150
|
+
|
|
151
|
+
try:
|
|
152
|
+
if not self.view.default_view:
|
|
153
|
+
return f"[{self.view}] {name}"
|
|
154
|
+
except ObjectDoesNotExist:
|
|
155
|
+
return f"[<no view assigned>] {name}"
|
|
156
|
+
|
|
157
|
+
return str(name)
|
|
158
|
+
|
|
84
159
|
def __init__(self, *args, **kwargs):
|
|
85
160
|
kwargs.pop("template", None)
|
|
86
161
|
|
|
@@ -192,6 +267,14 @@ class Zone(ObjectModificationMixin, ContactsMixin, NetBoxModel):
|
|
|
192
267
|
help_text=_("Use inline signing for DNSSEC"),
|
|
193
268
|
default=True,
|
|
194
269
|
)
|
|
270
|
+
parental_agents = ArrayField(
|
|
271
|
+
base_field=models.GenericIPAddressField(
|
|
272
|
+
protocol="both",
|
|
273
|
+
),
|
|
274
|
+
blank=True,
|
|
275
|
+
null=True,
|
|
276
|
+
default=list,
|
|
277
|
+
)
|
|
195
278
|
registrar = models.ForeignKey(
|
|
196
279
|
verbose_name=_("Registrar"),
|
|
197
280
|
to="Registrar",
|
|
@@ -285,61 +368,6 @@ class Zone(ObjectModificationMixin, ContactsMixin, NetBoxModel):
|
|
|
285
368
|
null=True,
|
|
286
369
|
)
|
|
287
370
|
|
|
288
|
-
objects = ZoneManager()
|
|
289
|
-
|
|
290
|
-
clone_fields = (
|
|
291
|
-
"view",
|
|
292
|
-
"name",
|
|
293
|
-
"description",
|
|
294
|
-
"status",
|
|
295
|
-
"nameservers",
|
|
296
|
-
"default_ttl",
|
|
297
|
-
"soa_ttl",
|
|
298
|
-
"soa_mname",
|
|
299
|
-
"soa_rname",
|
|
300
|
-
"soa_refresh",
|
|
301
|
-
"soa_retry",
|
|
302
|
-
"soa_expire",
|
|
303
|
-
"soa_minimum",
|
|
304
|
-
"tenant",
|
|
305
|
-
)
|
|
306
|
-
|
|
307
|
-
class Meta:
|
|
308
|
-
verbose_name = _("Zone")
|
|
309
|
-
verbose_name_plural = _("Zones")
|
|
310
|
-
|
|
311
|
-
ordering = (
|
|
312
|
-
"view",
|
|
313
|
-
"name",
|
|
314
|
-
)
|
|
315
|
-
constraints = [
|
|
316
|
-
UniqueConstraint(
|
|
317
|
-
Lower("name"),
|
|
318
|
-
"view",
|
|
319
|
-
name="name_view_unique_ci",
|
|
320
|
-
violation_error_message=_(
|
|
321
|
-
"There is already a zone with the same name in this view"
|
|
322
|
-
),
|
|
323
|
-
),
|
|
324
|
-
]
|
|
325
|
-
|
|
326
|
-
def __str__(self):
|
|
327
|
-
if self.name == "." and get_plugin_config("netbox_dns", "enable_root_zones"):
|
|
328
|
-
name = ". (root zone)"
|
|
329
|
-
else:
|
|
330
|
-
try:
|
|
331
|
-
name = dns_name.from_text(self.name, origin=None).to_unicode()
|
|
332
|
-
except DNSException:
|
|
333
|
-
name = self.name
|
|
334
|
-
|
|
335
|
-
try:
|
|
336
|
-
if not self.view.default_view:
|
|
337
|
-
return f"[{self.view}] {name}"
|
|
338
|
-
except ObjectDoesNotExist:
|
|
339
|
-
return f"[<no view assigned>] {name}"
|
|
340
|
-
|
|
341
|
-
return str(name)
|
|
342
|
-
|
|
343
371
|
@property
|
|
344
372
|
def fqdn(self):
|
|
345
373
|
return f"{self.name}."
|
|
@@ -907,7 +935,9 @@ class Zone(ObjectModificationMixin, ContactsMixin, NetBoxModel):
|
|
|
907
935
|
|
|
908
936
|
changed_fields = self.changed_fields
|
|
909
937
|
|
|
910
|
-
if self.soa_serial_auto
|
|
938
|
+
if self.soa_serial_auto and (
|
|
939
|
+
changed_fields is None or changed_fields - self.soa_clean_fields
|
|
940
|
+
):
|
|
911
941
|
self.soa_serial = self.get_auto_serial()
|
|
912
942
|
|
|
913
943
|
super().save(*args, **kwargs)
|
|
@@ -1006,7 +1036,7 @@ class Zone(ObjectModificationMixin, ContactsMixin, NetBoxModel):
|
|
|
1006
1036
|
for address_record in address_records:
|
|
1007
1037
|
address_record.ptr_record.delete()
|
|
1008
1038
|
|
|
1009
|
-
ptr_records = self.records.filter(
|
|
1039
|
+
ptr_records = self.records.filter(address_records__isnull=False)
|
|
1010
1040
|
update_records = list(
|
|
1011
1041
|
Record.objects.filter(ptr_record__in=ptr_records).values_list(
|
|
1012
1042
|
"pk", flat=True
|
|
@@ -1079,6 +1109,7 @@ def update_ns_records(**kwargs):
|
|
|
1079
1109
|
@register_search
|
|
1080
1110
|
class ZoneIndex(SearchIndex):
|
|
1081
1111
|
model = Zone
|
|
1112
|
+
|
|
1082
1113
|
fields = (
|
|
1083
1114
|
("name", 100),
|
|
1084
1115
|
("view", 150),
|
|
@@ -18,6 +18,40 @@ __all__ = (
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
class ZoneTemplate(NetBoxModel):
|
|
21
|
+
class Meta:
|
|
22
|
+
verbose_name = _("Zone Template")
|
|
23
|
+
verbose_name_plural = _("Zone Templates")
|
|
24
|
+
|
|
25
|
+
ordering = ("name",)
|
|
26
|
+
|
|
27
|
+
clone_fields = (
|
|
28
|
+
"description",
|
|
29
|
+
"nameservers",
|
|
30
|
+
"record_templates",
|
|
31
|
+
"dnssec_policy",
|
|
32
|
+
"registrar",
|
|
33
|
+
"registrant",
|
|
34
|
+
"admin_c",
|
|
35
|
+
"tech_c",
|
|
36
|
+
"billing_c",
|
|
37
|
+
"tenant",
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
template_fields = (
|
|
41
|
+
"soa_mname",
|
|
42
|
+
"soa_rname",
|
|
43
|
+
"dnssec_policy",
|
|
44
|
+
"registrar",
|
|
45
|
+
"registrant",
|
|
46
|
+
"admin_c",
|
|
47
|
+
"tech_c",
|
|
48
|
+
"billing_c",
|
|
49
|
+
"tenant",
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
def __str__(self):
|
|
53
|
+
return str(self.name)
|
|
54
|
+
|
|
21
55
|
name = models.CharField(
|
|
22
56
|
verbose_name=_("Template Name"),
|
|
23
57
|
unique=True,
|
|
@@ -111,40 +145,6 @@ class ZoneTemplate(NetBoxModel):
|
|
|
111
145
|
null=True,
|
|
112
146
|
)
|
|
113
147
|
|
|
114
|
-
clone_fields = (
|
|
115
|
-
"description",
|
|
116
|
-
"nameservers",
|
|
117
|
-
"record_templates",
|
|
118
|
-
"dnssec_policy",
|
|
119
|
-
"registrar",
|
|
120
|
-
"registrant",
|
|
121
|
-
"admin_c",
|
|
122
|
-
"tech_c",
|
|
123
|
-
"billing_c",
|
|
124
|
-
"tenant",
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
template_fields = (
|
|
128
|
-
"soa_mname",
|
|
129
|
-
"soa_rname",
|
|
130
|
-
"dnssec_policy",
|
|
131
|
-
"registrar",
|
|
132
|
-
"registrant",
|
|
133
|
-
"admin_c",
|
|
134
|
-
"tech_c",
|
|
135
|
-
"billing_c",
|
|
136
|
-
"tenant",
|
|
137
|
-
)
|
|
138
|
-
|
|
139
|
-
class Meta:
|
|
140
|
-
verbose_name = _("Zone Template")
|
|
141
|
-
verbose_name_plural = _("Zone Templates")
|
|
142
|
-
|
|
143
|
-
ordering = ("name",)
|
|
144
|
-
|
|
145
|
-
def __str__(self):
|
|
146
|
-
return str(self.name)
|
|
147
|
-
|
|
148
148
|
def apply_to_zone_data(self, data):
|
|
149
149
|
fields_changed = False
|
|
150
150
|
for field in self.template_fields:
|
|
@@ -183,6 +183,7 @@ class ZoneTemplate(NetBoxModel):
|
|
|
183
183
|
@register_search
|
|
184
184
|
class ZoneTemplateIndex(SearchIndex):
|
|
185
185
|
model = ZoneTemplate
|
|
186
|
+
|
|
186
187
|
fields = (
|
|
187
188
|
("name", 100),
|
|
188
189
|
("tenant", 300),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import django_tables2 as tables
|
|
2
2
|
from django.utils.translation import gettext_lazy as _
|
|
3
3
|
|
|
4
|
-
|
|
5
4
|
from netbox.tables import (
|
|
6
5
|
NetBoxTable,
|
|
7
6
|
ChoiceFieldColumn,
|
|
@@ -16,6 +15,19 @@ __all__ = ("DNSSECKeyTemplateTable",)
|
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
class DNSSECKeyTemplateTable(TenancyColumnsMixin, NetBoxTable):
|
|
18
|
+
class Meta(NetBoxTable.Meta):
|
|
19
|
+
model = DNSSECKeyTemplate
|
|
20
|
+
|
|
21
|
+
fields = ("description",)
|
|
22
|
+
|
|
23
|
+
default_columns = (
|
|
24
|
+
"name",
|
|
25
|
+
"type",
|
|
26
|
+
"algorithm",
|
|
27
|
+
"key_size",
|
|
28
|
+
"tags",
|
|
29
|
+
)
|
|
30
|
+
|
|
19
31
|
name = tables.Column(
|
|
20
32
|
verbose_name=_("Name"),
|
|
21
33
|
linkify=True,
|
|
@@ -35,14 +47,3 @@ class DNSSECKeyTemplateTable(TenancyColumnsMixin, NetBoxTable):
|
|
|
35
47
|
tags = TagColumn(
|
|
36
48
|
url_name="plugins:netbox_dns:dnsseckeytemplate_list",
|
|
37
49
|
)
|
|
38
|
-
|
|
39
|
-
class Meta(NetBoxTable.Meta):
|
|
40
|
-
model = DNSSECKeyTemplate
|
|
41
|
-
fields = ("description",)
|
|
42
|
-
default_columns = (
|
|
43
|
-
"name",
|
|
44
|
-
"type",
|
|
45
|
-
"algorithm",
|
|
46
|
-
"key_size",
|
|
47
|
-
"tags",
|
|
48
|
-
)
|
|
@@ -20,6 +20,19 @@ __all__ = (
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
class DNSSECPolicyTable(TenancyColumnsMixin, NetBoxTable):
|
|
23
|
+
class Meta(NetBoxTable.Meta):
|
|
24
|
+
model = DNSSECPolicy
|
|
25
|
+
|
|
26
|
+
fields = ("description",)
|
|
27
|
+
|
|
28
|
+
default_columns = (
|
|
29
|
+
"name",
|
|
30
|
+
"description",
|
|
31
|
+
"status",
|
|
32
|
+
"use_nsec3",
|
|
33
|
+
"tags",
|
|
34
|
+
)
|
|
35
|
+
|
|
23
36
|
name = tables.Column(
|
|
24
37
|
verbose_name=_("Name"),
|
|
25
38
|
linkify=True,
|
|
@@ -88,21 +101,20 @@ class DNSSECPolicyTable(TenancyColumnsMixin, NetBoxTable):
|
|
|
88
101
|
url_name="plugins:netbox_dns:dnssecpolicy_list",
|
|
89
102
|
)
|
|
90
103
|
|
|
104
|
+
|
|
105
|
+
class DNSSECPolicyDisplayTable(TenancyColumnsMixin, NetBoxTable):
|
|
91
106
|
class Meta(NetBoxTable.Meta):
|
|
92
107
|
model = DNSSECPolicy
|
|
108
|
+
|
|
93
109
|
fields = ("description",)
|
|
110
|
+
|
|
94
111
|
default_columns = (
|
|
95
112
|
"name",
|
|
96
113
|
"description",
|
|
97
114
|
"status",
|
|
98
|
-
"use_nsec3",
|
|
99
115
|
"tags",
|
|
100
116
|
)
|
|
101
117
|
|
|
102
|
-
|
|
103
|
-
class DNSSECPolicyDisplayTable(TenancyColumnsMixin, NetBoxTable):
|
|
104
|
-
actions = ActionsColumn(actions="")
|
|
105
|
-
|
|
106
118
|
name = tables.Column(
|
|
107
119
|
verbose_name=_("Name"),
|
|
108
120
|
linkify=True,
|
|
@@ -119,13 +131,4 @@ class DNSSECPolicyDisplayTable(TenancyColumnsMixin, NetBoxTable):
|
|
|
119
131
|
tags = TagColumn(
|
|
120
132
|
url_name="plugins:netbox_dns:dnssecpolicy_list",
|
|
121
133
|
)
|
|
122
|
-
|
|
123
|
-
class Meta(NetBoxTable.Meta):
|
|
124
|
-
model = DNSSECPolicy
|
|
125
|
-
fields = ("description",)
|
|
126
|
-
default_columns = (
|
|
127
|
-
"name",
|
|
128
|
-
"description",
|
|
129
|
-
"status",
|
|
130
|
-
"tags",
|
|
131
|
-
)
|
|
134
|
+
actions = ActionsColumn(actions="")
|
netbox_dns/tables/nameserver.py
CHANGED
|
@@ -11,6 +11,16 @@ __all__ = ("NameServerTable",)
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class NameServerTable(TenancyColumnsMixin, NetBoxTable):
|
|
14
|
+
class Meta(NetBoxTable.Meta):
|
|
15
|
+
model = NameServer
|
|
16
|
+
|
|
17
|
+
fields = ("description",)
|
|
18
|
+
|
|
19
|
+
default_columns = (
|
|
20
|
+
"name",
|
|
21
|
+
"tags",
|
|
22
|
+
)
|
|
23
|
+
|
|
14
24
|
name = tables.Column(
|
|
15
25
|
verbose_name=_("Name"),
|
|
16
26
|
linkify=True,
|
|
@@ -21,11 +31,3 @@ class NameServerTable(TenancyColumnsMixin, NetBoxTable):
|
|
|
21
31
|
|
|
22
32
|
def render_name(self, value, record):
|
|
23
33
|
return record.display_name
|
|
24
|
-
|
|
25
|
-
class Meta(NetBoxTable.Meta):
|
|
26
|
-
model = NameServer
|
|
27
|
-
fields = ("description",)
|
|
28
|
-
default_columns = (
|
|
29
|
-
"name",
|
|
30
|
-
"tags",
|
|
31
|
-
)
|
netbox_dns/tables/record.py
CHANGED
|
@@ -68,6 +68,24 @@ class RecordBaseTable(TenancyColumnsMixin, NetBoxTable):
|
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
class RecordTable(RecordBaseTable):
|
|
71
|
+
class Meta(NetBoxTable.Meta):
|
|
72
|
+
model = Record
|
|
73
|
+
|
|
74
|
+
fields = (
|
|
75
|
+
"status",
|
|
76
|
+
"description",
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
default_columns = (
|
|
80
|
+
"name",
|
|
81
|
+
"zone",
|
|
82
|
+
"ttl",
|
|
83
|
+
"type",
|
|
84
|
+
"value",
|
|
85
|
+
"tags",
|
|
86
|
+
"active",
|
|
87
|
+
)
|
|
88
|
+
|
|
71
89
|
status = ChoiceFieldColumn(
|
|
72
90
|
verbose_name=_("Status"),
|
|
73
91
|
)
|
|
@@ -82,27 +100,31 @@ class RecordTable(RecordBaseTable):
|
|
|
82
100
|
linkify=True,
|
|
83
101
|
)
|
|
84
102
|
|
|
103
|
+
|
|
104
|
+
class ManagedRecordTable(RecordBaseTable):
|
|
85
105
|
class Meta(NetBoxTable.Meta):
|
|
86
106
|
model = Record
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
)
|
|
107
|
+
|
|
108
|
+
fields = ()
|
|
109
|
+
|
|
91
110
|
default_columns = (
|
|
92
111
|
"name",
|
|
93
112
|
"zone",
|
|
94
113
|
"ttl",
|
|
95
114
|
"type",
|
|
96
115
|
"value",
|
|
97
|
-
"tags",
|
|
98
116
|
"active",
|
|
99
117
|
)
|
|
100
118
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
address_record = tables.Column(
|
|
104
|
-
verbose_name=_("Address Record"),
|
|
119
|
+
address_records = tables.ManyToManyColumn(
|
|
120
|
+
verbose_name=_("Address Records"),
|
|
105
121
|
linkify=True,
|
|
122
|
+
linkify_item=True,
|
|
123
|
+
transform=lambda obj: (
|
|
124
|
+
obj.fqdn.rstrip(".")
|
|
125
|
+
if obj.zone.view.default_view
|
|
126
|
+
else f"[{obj.zone.view.name}] {obj.fqdn.rstrip('.')}"
|
|
127
|
+
),
|
|
106
128
|
)
|
|
107
129
|
ipam_ip_address = tables.Column(
|
|
108
130
|
verbose_name=_("IPAM IP Address"),
|
|
@@ -115,27 +137,19 @@ class ManagedRecordTable(RecordBaseTable):
|
|
|
115
137
|
)
|
|
116
138
|
actions = ActionsColumn(actions=("changelog",))
|
|
117
139
|
|
|
118
|
-
class Meta(NetBoxTable.Meta):
|
|
119
|
-
model = Record
|
|
120
|
-
fields = ()
|
|
121
|
-
default_columns = (
|
|
122
|
-
"name",
|
|
123
|
-
"zone",
|
|
124
|
-
"ttl",
|
|
125
|
-
"type",
|
|
126
|
-
"value",
|
|
127
|
-
"active",
|
|
128
|
-
)
|
|
129
|
-
|
|
130
140
|
def render_related_ip_address(self, record):
|
|
131
141
|
if record.ipam_ip_address is not None:
|
|
132
142
|
address = record.ipam_ip_address
|
|
133
|
-
elif (
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
143
|
+
elif hasattr(record, "address_records"):
|
|
144
|
+
address_record = record.address_records.filter(
|
|
145
|
+
ipam_ip_address__isnull=False
|
|
146
|
+
).first()
|
|
147
|
+
if address_record is not None:
|
|
148
|
+
address = address_record.ipam_ip_address
|
|
149
|
+
else:
|
|
150
|
+
address = None
|
|
151
|
+
|
|
152
|
+
if address is None:
|
|
139
153
|
return format_html("—")
|
|
140
154
|
|
|
141
155
|
return format_html(f"<a href='{address.get_absolute_url()}'>{address}</a>")
|
|
@@ -143,19 +157,22 @@ class ManagedRecordTable(RecordBaseTable):
|
|
|
143
157
|
def value_related_ip_address(self, record):
|
|
144
158
|
if record.ipam_ip_address is not None:
|
|
145
159
|
return record.ipam_ip_address
|
|
146
|
-
elif (
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
160
|
+
elif hasattr(record, "address_records"):
|
|
161
|
+
address_record = record.address_records.filter(
|
|
162
|
+
ipam_ip_address__isnull=False
|
|
163
|
+
).first()
|
|
164
|
+
if address_record is not None:
|
|
165
|
+
return address_record.ipam_ip_address
|
|
151
166
|
|
|
167
|
+
return None
|
|
152
168
|
|
|
153
|
-
class RelatedRecordTable(RecordBaseTable):
|
|
154
|
-
actions = ActionsColumn(actions=())
|
|
155
169
|
|
|
170
|
+
class RelatedRecordTable(RecordBaseTable):
|
|
156
171
|
class Meta(NetBoxTable.Meta):
|
|
157
172
|
model = Record
|
|
173
|
+
|
|
158
174
|
fields = ()
|
|
175
|
+
|
|
159
176
|
default_columns = (
|
|
160
177
|
"name",
|
|
161
178
|
"zone",
|
|
@@ -163,11 +180,15 @@ class RelatedRecordTable(RecordBaseTable):
|
|
|
163
180
|
"value",
|
|
164
181
|
)
|
|
165
182
|
|
|
183
|
+
actions = ActionsColumn(actions=())
|
|
184
|
+
|
|
166
185
|
|
|
167
186
|
class DelegationRecordTable(RecordBaseTable):
|
|
168
187
|
class Meta(NetBoxTable.Meta):
|
|
169
188
|
model = Record
|
|
189
|
+
|
|
170
190
|
fields = ()
|
|
191
|
+
|
|
171
192
|
default_columns = (
|
|
172
193
|
"name",
|
|
173
194
|
"zone",
|
|
@@ -15,6 +15,23 @@ __all__ = (
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class RecordTemplateTable(TenancyColumnsMixin, NetBoxTable):
|
|
18
|
+
class Meta(NetBoxTable.Meta):
|
|
19
|
+
model = RecordTemplate
|
|
20
|
+
|
|
21
|
+
fields = (
|
|
22
|
+
"status",
|
|
23
|
+
"description",
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
default_columns = (
|
|
27
|
+
"name",
|
|
28
|
+
"record_name",
|
|
29
|
+
"ttl",
|
|
30
|
+
"type",
|
|
31
|
+
"value",
|
|
32
|
+
"tags",
|
|
33
|
+
)
|
|
34
|
+
|
|
18
35
|
name = tables.Column(
|
|
19
36
|
verbose_name=_("Name"),
|
|
20
37
|
linkify=True,
|
|
@@ -47,31 +64,16 @@ class RecordTemplateTable(TenancyColumnsMixin, NetBoxTable):
|
|
|
47
64
|
def render_unicode_value(self, value):
|
|
48
65
|
return value_to_unicode(value)
|
|
49
66
|
|
|
50
|
-
class Meta(NetBoxTable.Meta):
|
|
51
|
-
model = RecordTemplate
|
|
52
|
-
fields = (
|
|
53
|
-
"status",
|
|
54
|
-
"description",
|
|
55
|
-
)
|
|
56
|
-
default_columns = (
|
|
57
|
-
"name",
|
|
58
|
-
"record_name",
|
|
59
|
-
"ttl",
|
|
60
|
-
"type",
|
|
61
|
-
"value",
|
|
62
|
-
"tags",
|
|
63
|
-
)
|
|
64
|
-
|
|
65
67
|
|
|
66
68
|
class RecordTemplateDisplayTable(RecordTemplateTable):
|
|
67
|
-
actions = ActionsColumn(actions="")
|
|
68
|
-
|
|
69
69
|
class Meta(NetBoxTable.Meta):
|
|
70
70
|
model = RecordTemplate
|
|
71
|
+
|
|
71
72
|
fields = (
|
|
72
73
|
"status",
|
|
73
74
|
"description",
|
|
74
75
|
)
|
|
76
|
+
|
|
75
77
|
default_columns = (
|
|
76
78
|
"name",
|
|
77
79
|
"record_name",
|
|
@@ -79,3 +81,5 @@ class RecordTemplateDisplayTable(RecordTemplateTable):
|
|
|
79
81
|
"type",
|
|
80
82
|
"value",
|
|
81
83
|
)
|
|
84
|
+
|
|
85
|
+
actions = ActionsColumn(actions="")
|
netbox_dns/tables/registrar.py
CHANGED
|
@@ -10,16 +10,9 @@ __all__ = ("RegistrarTable",)
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class RegistrarTable(NetBoxTable):
|
|
13
|
-
name = tables.Column(
|
|
14
|
-
verbose_name=_("Name"),
|
|
15
|
-
linkify=True,
|
|
16
|
-
)
|
|
17
|
-
tags = TagColumn(
|
|
18
|
-
url_name="plugins:netbox_dns:registrar_list",
|
|
19
|
-
)
|
|
20
|
-
|
|
21
13
|
class Meta(NetBoxTable.Meta):
|
|
22
14
|
model = Registrar
|
|
15
|
+
|
|
23
16
|
fields = (
|
|
24
17
|
"description",
|
|
25
18
|
"iana_id",
|
|
@@ -28,4 +21,17 @@ class RegistrarTable(NetBoxTable):
|
|
|
28
21
|
"abuse_email",
|
|
29
22
|
"abuse_phone",
|
|
30
23
|
)
|
|
31
|
-
|
|
24
|
+
|
|
25
|
+
default_columns = (
|
|
26
|
+
"name",
|
|
27
|
+
"iana_id",
|
|
28
|
+
"referral_url",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
name = tables.Column(
|
|
32
|
+
verbose_name=_("Name"),
|
|
33
|
+
linkify=True,
|
|
34
|
+
)
|
|
35
|
+
tags = TagColumn(
|
|
36
|
+
url_name="plugins:netbox_dns:registrar_list",
|
|
37
|
+
)
|
|
@@ -10,16 +10,9 @@ __all__ = ("RegistrationContactTable",)
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class RegistrationContactTable(NetBoxTable):
|
|
13
|
-
contact_id = tables.Column(
|
|
14
|
-
verbose_name=_("Contact ID"),
|
|
15
|
-
linkify=True,
|
|
16
|
-
)
|
|
17
|
-
tags = TagColumn(
|
|
18
|
-
url_name="plugins:netbox_dns:registrationcontact_list",
|
|
19
|
-
)
|
|
20
|
-
|
|
21
13
|
class Meta(NetBoxTable.Meta):
|
|
22
14
|
model = RegistrationContact
|
|
15
|
+
|
|
23
16
|
fields = (
|
|
24
17
|
"name",
|
|
25
18
|
"description",
|
|
@@ -35,4 +28,17 @@ class RegistrationContactTable(NetBoxTable):
|
|
|
35
28
|
"fax_ext",
|
|
36
29
|
"email",
|
|
37
30
|
)
|
|
38
|
-
|
|
31
|
+
|
|
32
|
+
default_columns = (
|
|
33
|
+
"contact_id",
|
|
34
|
+
"name",
|
|
35
|
+
"email",
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
contact_id = tables.Column(
|
|
39
|
+
verbose_name=_("Contact ID"),
|
|
40
|
+
linkify=True,
|
|
41
|
+
)
|
|
42
|
+
tags = TagColumn(
|
|
43
|
+
url_name="plugins:netbox_dns:registrationcontact_list",
|
|
44
|
+
)
|