netbox-plugin-dns 1.2.7b2__py3-none-any.whl → 1.3b1__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 +55 -29
- netbox_dns/api/field_serializers.py +25 -0
- netbox_dns/api/nested_serializers.py +19 -1
- netbox_dns/api/serializers_/dnssec_key_template.py +13 -0
- netbox_dns/api/serializers_/dnssec_policy.py +30 -0
- netbox_dns/api/serializers_/record.py +2 -0
- netbox_dns/api/serializers_/record_template.py +2 -0
- netbox_dns/api/serializers_/zone.py +10 -1
- netbox_dns/choices/dnssec_key_template.py +4 -4
- netbox_dns/choices/dnssec_policy.py +2 -2
- netbox_dns/choices/record.py +64 -19
- netbox_dns/choices/utilities.py +4 -26
- netbox_dns/choices/zone.py +96 -1
- netbox_dns/fields/choice_array.py +13 -0
- netbox_dns/fields/timeperiod.py +15 -13
- netbox_dns/filtersets/dnssec_policy.py +25 -1
- netbox_dns/filtersets/zone.py +7 -2
- netbox_dns/filtersets/zone_template.py +2 -2
- netbox_dns/forms/dnssec_key_template.py +2 -1
- netbox_dns/forms/dnssec_policy.py +32 -2
- netbox_dns/forms/nameserver.py +2 -0
- netbox_dns/forms/record_template.py +1 -0
- netbox_dns/forms/zone.py +78 -15
- netbox_dns/forms/zone_template.py +9 -0
- 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 +123 -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 +146 -0
- netbox_dns/graphql/filters/zone_template.py +97 -0
- netbox_dns/locale/de/LC_MESSAGES/django.mo +0 -0
- netbox_dns/locale/fr/LC_MESSAGES/django.mo +0 -0
- netbox_dns/migrations/0018_zone_domain_status_zone_expiration_date.py +23 -0
- netbox_dns/models/dnssec_key_template.py +0 -5
- netbox_dns/models/dnssec_policy.py +5 -8
- netbox_dns/models/nameserver.py +0 -5
- netbox_dns/models/record.py +4 -6
- netbox_dns/models/record_template.py +0 -5
- netbox_dns/models/registrar.py +0 -5
- netbox_dns/models/registration_contact.py +0 -5
- netbox_dns/models/view.py +0 -5
- netbox_dns/models/zone.py +44 -7
- netbox_dns/models/zone_template.py +1 -6
- netbox_dns/tables/zone.py +6 -1
- netbox_dns/template_content.py +2 -1
- netbox_dns/templates/netbox_dns/zone/registration.html +19 -0
- netbox_dns/urls.py +7 -0
- netbox_dns/utilities/conversions.py +13 -0
- netbox_dns/validators/dns_value.py +3 -0
- netbox_dns/validators/dnssec.py +10 -8
- netbox_dns/views/dnssec_key_template.py +0 -9
- netbox_dns/views/dnssec_policy.py +3 -10
- netbox_dns/views/nameserver.py +0 -9
- netbox_dns/views/record.py +0 -9
- netbox_dns/views/record_template.py +0 -3
- netbox_dns/views/registrar.py +0 -3
- netbox_dns/views/registration_contact.py +0 -3
- netbox_dns/views/view.py +0 -9
- netbox_dns/views/zone.py +11 -11
- netbox_dns/views/zone_template.py +0 -4
- {netbox_plugin_dns-1.2.7b2.dist-info → netbox_plugin_dns-1.3b1.dist-info}/METADATA +5 -3
- {netbox_plugin_dns-1.2.7b2.dist-info → netbox_plugin_dns-1.3b1.dist-info}/RECORD +72 -58
- {netbox_plugin_dns-1.2.7b2.dist-info → netbox_plugin_dns-1.3b1.dist-info}/WHEEL +1 -1
- netbox_dns/graphql/filters.py +0 -88
- {netbox_plugin_dns-1.2.7b2.dist-info → netbox_plugin_dns-1.3b1.dist-info/licenses}/LICENSE +0 -0
- {netbox_plugin_dns-1.2.7b2.dist-info → netbox_plugin_dns-1.3b1.dist-info}/top_level.txt +0 -0
netbox_dns/fields/timeperiod.py
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
from django.forms import Field
|
|
2
|
-
from django.utils.dateparse import parse_duration
|
|
1
|
+
from django.forms import Field, TextInput
|
|
3
2
|
from django.core.exceptions import ValidationError
|
|
4
3
|
|
|
4
|
+
from netbox_dns.utilities import iso8601_to_int
|
|
5
5
|
|
|
6
6
|
__all__ = ("TimePeriodField",)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class TimePeriodField(Field):
|
|
10
|
+
def __init__(self, *args, **kwargs):
|
|
11
|
+
placeholder = kwargs.pop("placeholder", None)
|
|
12
|
+
|
|
13
|
+
if placeholder is not None:
|
|
14
|
+
self.widget = TextInput(attrs={"placeholder": placeholder})
|
|
15
|
+
|
|
16
|
+
return super().__init__(*args, **kwargs)
|
|
17
|
+
|
|
10
18
|
def to_python(self, value):
|
|
11
19
|
if not value:
|
|
12
20
|
return None
|
|
13
21
|
|
|
14
22
|
try:
|
|
15
|
-
return
|
|
16
|
-
except
|
|
17
|
-
|
|
18
|
-
duration
|
|
19
|
-
|
|
20
|
-
raise TypeError
|
|
21
|
-
return int(duration.total_seconds())
|
|
22
|
-
except TypeError:
|
|
23
|
-
raise ValidationError(
|
|
24
|
-
"Enter a valid integer or ISO 8601 duration (W, M and Y are not supported)"
|
|
25
|
-
)
|
|
23
|
+
return iso8601_to_int(value)
|
|
24
|
+
except TypeError:
|
|
25
|
+
raise ValidationError(
|
|
26
|
+
"Enter a valid integer or ISO 8601 duration (W, M and Y are not supported)"
|
|
27
|
+
)
|
|
26
28
|
|
|
27
29
|
def validate(self, value):
|
|
28
30
|
super().validate(value)
|
|
@@ -7,7 +7,7 @@ from netbox.filtersets import NetBoxModelFilterSet
|
|
|
7
7
|
from tenancy.filtersets import TenancyFilterSet
|
|
8
8
|
from utilities.filters import MultiValueCharFilter
|
|
9
9
|
|
|
10
|
-
from netbox_dns.models import DNSSECPolicy, DNSSECKeyTemplate
|
|
10
|
+
from netbox_dns.models import DNSSECPolicy, DNSSECKeyTemplate, Zone, ZoneTemplate
|
|
11
11
|
from netbox_dns.choices import DNSSECPolicyStatusChoices
|
|
12
12
|
|
|
13
13
|
__all__ = ("DNSSECPolicyFilterSet",)
|
|
@@ -59,6 +59,30 @@ class DNSSECPolicyFilterSet(TenancyFilterSet, NetBoxModelFilterSet):
|
|
|
59
59
|
to_field_name="id",
|
|
60
60
|
label=_("DNSSEC Key Template IDs"),
|
|
61
61
|
)
|
|
62
|
+
zone = django_filters.ModelMultipleChoiceFilter(
|
|
63
|
+
field_name="zones__name",
|
|
64
|
+
queryset=Zone.objects.all(),
|
|
65
|
+
to_field_name="name",
|
|
66
|
+
label=_("Zones"),
|
|
67
|
+
)
|
|
68
|
+
zone_id = django_filters.ModelMultipleChoiceFilter(
|
|
69
|
+
field_name="zones",
|
|
70
|
+
queryset=Zone.objects.all(),
|
|
71
|
+
to_field_name="id",
|
|
72
|
+
label=_("Zone IDs"),
|
|
73
|
+
)
|
|
74
|
+
zone_template = django_filters.ModelMultipleChoiceFilter(
|
|
75
|
+
field_name="zone_templates__name",
|
|
76
|
+
queryset=ZoneTemplate.objects.all(),
|
|
77
|
+
to_field_name="name",
|
|
78
|
+
label=_("Zone Templates"),
|
|
79
|
+
)
|
|
80
|
+
zone_template_id = django_filters.ModelMultipleChoiceFilter(
|
|
81
|
+
field_name="zone_templates",
|
|
82
|
+
queryset=ZoneTemplate.objects.all(),
|
|
83
|
+
to_field_name="id",
|
|
84
|
+
label=_("Zone Template IDs"),
|
|
85
|
+
)
|
|
62
86
|
|
|
63
87
|
def filter_cds_digest_types(self, queryset, name, value):
|
|
64
88
|
if not value:
|
netbox_dns/filtersets/zone.py
CHANGED
|
@@ -16,7 +16,7 @@ from netbox_dns.models import (
|
|
|
16
16
|
NameServer,
|
|
17
17
|
DNSSECPolicy,
|
|
18
18
|
)
|
|
19
|
-
from netbox_dns.choices import ZoneStatusChoices
|
|
19
|
+
from netbox_dns.choices import ZoneStatusChoices, ZoneEPPStatusChoices
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
__all__ = ("ZoneFilterSet",)
|
|
@@ -86,7 +86,7 @@ class ZoneFilterSet(TenancyFilterSet, NetBoxModelFilterSet):
|
|
|
86
86
|
)
|
|
87
87
|
registrar_id = django_filters.ModelMultipleChoiceFilter(
|
|
88
88
|
queryset=Registrar.objects.all(),
|
|
89
|
-
label="Registrar ID",
|
|
89
|
+
label=_("Registrar ID"),
|
|
90
90
|
)
|
|
91
91
|
registrar = django_filters.ModelMultipleChoiceFilter(
|
|
92
92
|
queryset=Registrar.objects.all(),
|
|
@@ -94,6 +94,10 @@ class ZoneFilterSet(TenancyFilterSet, NetBoxModelFilterSet):
|
|
|
94
94
|
to_field_name="name",
|
|
95
95
|
label=_("Registrar"),
|
|
96
96
|
)
|
|
97
|
+
expiration_date = django_filters.DateFromToRangeFilter()
|
|
98
|
+
domain_status = django_filters.MultipleChoiceFilter(
|
|
99
|
+
choices=ZoneEPPStatusChoices,
|
|
100
|
+
)
|
|
97
101
|
registrant_id = django_filters.ModelMultipleChoiceFilter(
|
|
98
102
|
queryset=RegistrationContact.objects.all(),
|
|
99
103
|
label=_("Registrant ID"),
|
|
@@ -160,6 +164,7 @@ class ZoneFilterSet(TenancyFilterSet, NetBoxModelFilterSet):
|
|
|
160
164
|
"rfc2317_parent_managed",
|
|
161
165
|
"inline_signing",
|
|
162
166
|
"registry_domain_id",
|
|
167
|
+
"domain_status",
|
|
163
168
|
)
|
|
164
169
|
|
|
165
170
|
def filter_arpa_network(self, queryset, name, value):
|
|
@@ -48,13 +48,13 @@ class ZoneTemplateFilterSet(TenancyFilterSet, NetBoxModelFilterSet):
|
|
|
48
48
|
queryset=NameServer.objects.all(),
|
|
49
49
|
field_name="soa_mname",
|
|
50
50
|
to_field_name="id",
|
|
51
|
-
label=_("SOA
|
|
51
|
+
label=_("SOA MName ID"),
|
|
52
52
|
)
|
|
53
53
|
soa_mname = django_filters.ModelMultipleChoiceFilter(
|
|
54
54
|
queryset=NameServer.objects.all(),
|
|
55
55
|
field_name="soa_mname__name",
|
|
56
56
|
to_field_name="name",
|
|
57
|
-
label=_("SOA
|
|
57
|
+
label=_("SOA MName"),
|
|
58
58
|
)
|
|
59
59
|
dnssec_policy_id = django_filters.ModelMultipleChoiceFilter(
|
|
60
60
|
queryset=DNSSECPolicy.objects.all(),
|
|
@@ -68,7 +68,7 @@ class DNSSECKeyTemplateFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
|
68
68
|
fieldsets = (
|
|
69
69
|
FieldSet("q", "filter_id", "tag"),
|
|
70
70
|
FieldSet("name", "description", name=_("Attributes")),
|
|
71
|
-
FieldSet("
|
|
71
|
+
FieldSet("policiy_id", name=_("Policies")),
|
|
72
72
|
FieldSet("type", "lifetime", "algorithm", "key_size", name=_("Key Properties")),
|
|
73
73
|
FieldSet("tenant_group_id", "tenant_id", name=_("Tenancy")),
|
|
74
74
|
)
|
|
@@ -82,6 +82,7 @@ class DNSSECKeyTemplateFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
|
82
82
|
policy_id = DynamicModelMultipleChoiceField(
|
|
83
83
|
queryset=DNSSECPolicy.objects.all(),
|
|
84
84
|
required=False,
|
|
85
|
+
null_option=_("None"),
|
|
85
86
|
label=_("Policies"),
|
|
86
87
|
)
|
|
87
88
|
type = forms.MultipleChoiceField(
|
|
@@ -23,7 +23,7 @@ from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES, add_blank_choice
|
|
|
23
23
|
from tenancy.models import Tenant, TenantGroup
|
|
24
24
|
from tenancy.forms import TenancyForm, TenancyFilterForm
|
|
25
25
|
|
|
26
|
-
from netbox_dns.models import DNSSECPolicy, DNSSECKeyTemplate
|
|
26
|
+
from netbox_dns.models import DNSSECPolicy, DNSSECKeyTemplate, Zone, ZoneTemplate
|
|
27
27
|
from netbox_dns.choices import DNSSECPolicyDigestChoices, DNSSECPolicyStatusChoices
|
|
28
28
|
from netbox_dns.fields import TimePeriodField
|
|
29
29
|
|
|
@@ -74,7 +74,7 @@ class DNSSECPolicyForm(TenancyForm, NetBoxModelForm):
|
|
|
74
74
|
"nsec3_salt_size",
|
|
75
75
|
name=_("Proof of Non-Existence"),
|
|
76
76
|
),
|
|
77
|
-
FieldSet("
|
|
77
|
+
FieldSet("tenant_group", "tenant", name=_("Tenancy")),
|
|
78
78
|
FieldSet("tags", name=_("Tags")),
|
|
79
79
|
)
|
|
80
80
|
|
|
@@ -119,50 +119,62 @@ class DNSSECPolicyForm(TenancyForm, NetBoxModelForm):
|
|
|
119
119
|
dnskey_ttl = TimePeriodField(
|
|
120
120
|
required=False,
|
|
121
121
|
label=_("DNSKEY TTL"),
|
|
122
|
+
placeholder=DNSSECPolicy.get_fallback_setting("dnskey_ttl"),
|
|
122
123
|
)
|
|
123
124
|
purge_keys = TimePeriodField(
|
|
124
125
|
required=False,
|
|
125
126
|
label=_("Purge Keys"),
|
|
127
|
+
placeholder=DNSSECPolicy.get_fallback_setting("purge_keys"),
|
|
126
128
|
)
|
|
127
129
|
publish_safety = TimePeriodField(
|
|
128
130
|
required=False,
|
|
129
131
|
label=_("Publish Safety"),
|
|
132
|
+
placeholder=DNSSECPolicy.get_fallback_setting("publish_safety"),
|
|
130
133
|
)
|
|
131
134
|
retire_safety = TimePeriodField(
|
|
132
135
|
required=False,
|
|
133
136
|
label=_("Retire Safety"),
|
|
137
|
+
placeholder=DNSSECPolicy.get_fallback_setting("retire_safety"),
|
|
134
138
|
)
|
|
135
139
|
signatures_jitter = TimePeriodField(
|
|
136
140
|
required=False,
|
|
137
141
|
label=_("Signatures Jitter"),
|
|
142
|
+
placeholder=DNSSECPolicy.get_fallback_setting("signatures_jitter"),
|
|
138
143
|
)
|
|
139
144
|
signatures_refresh = TimePeriodField(
|
|
140
145
|
required=False,
|
|
141
146
|
label=_("Signatures Refresh"),
|
|
147
|
+
placeholder=DNSSECPolicy.get_fallback_setting("signatures_refresh"),
|
|
142
148
|
)
|
|
143
149
|
signatures_validity = TimePeriodField(
|
|
144
150
|
required=False,
|
|
145
151
|
label=_("Signatures Validity"),
|
|
152
|
+
placeholder=DNSSECPolicy.get_fallback_setting("signatures_validity"),
|
|
146
153
|
)
|
|
147
154
|
signatures_validity_dnskey = TimePeriodField(
|
|
148
155
|
required=False,
|
|
149
156
|
label=_("Signatures Validity (DNSKEY)"),
|
|
157
|
+
placeholder=DNSSECPolicy.get_fallback_setting("signatures_validity_dnskey"),
|
|
150
158
|
)
|
|
151
159
|
max_zone_ttl = TimePeriodField(
|
|
152
160
|
required=False,
|
|
153
161
|
label=_("Max Zone TTL"),
|
|
162
|
+
placeholder=DNSSECPolicy.get_fallback_setting("max_zone_ttl"),
|
|
154
163
|
)
|
|
155
164
|
zone_propagation_delay = TimePeriodField(
|
|
156
165
|
required=False,
|
|
157
166
|
label=_("Zone Propagation Delay"),
|
|
167
|
+
placeholder=DNSSECPolicy.get_fallback_setting("zone_propagation_delay"),
|
|
158
168
|
)
|
|
159
169
|
parent_ds_ttl = TimePeriodField(
|
|
160
170
|
required=False,
|
|
161
171
|
label=_("Parent DS TTL"),
|
|
172
|
+
placeholder=DNSSECPolicy.get_fallback_setting("parent_ds_ttl"),
|
|
162
173
|
)
|
|
163
174
|
parent_propagation_delay = TimePeriodField(
|
|
164
175
|
required=False,
|
|
165
176
|
label=_("Parent Propagation Delay"),
|
|
177
|
+
placeholder=DNSSECPolicy.get_fallback_setting("parent_propagation_delay"),
|
|
166
178
|
)
|
|
167
179
|
|
|
168
180
|
|
|
@@ -177,6 +189,11 @@ class DNSSECPolicyFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
|
177
189
|
"key_template_id",
|
|
178
190
|
name=_("Attributes"),
|
|
179
191
|
),
|
|
192
|
+
FieldSet(
|
|
193
|
+
"zone_id",
|
|
194
|
+
"zone_template_id",
|
|
195
|
+
name=_("Assignments"),
|
|
196
|
+
),
|
|
180
197
|
FieldSet(
|
|
181
198
|
"dnskey_ttl",
|
|
182
199
|
"purge_keys",
|
|
@@ -222,8 +239,21 @@ class DNSSECPolicyFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
|
222
239
|
key_template_id = DynamicModelMultipleChoiceField(
|
|
223
240
|
queryset=DNSSECKeyTemplate.objects.all(),
|
|
224
241
|
required=False,
|
|
242
|
+
null_option=_("None"),
|
|
225
243
|
label=_("Key Templates"),
|
|
226
244
|
)
|
|
245
|
+
zone_id = DynamicModelMultipleChoiceField(
|
|
246
|
+
queryset=Zone.objects.all(),
|
|
247
|
+
required=False,
|
|
248
|
+
null_option=_("None"),
|
|
249
|
+
label=_("Zones"),
|
|
250
|
+
)
|
|
251
|
+
zone_template_id = DynamicModelMultipleChoiceField(
|
|
252
|
+
queryset=ZoneTemplate.objects.all(),
|
|
253
|
+
required=False,
|
|
254
|
+
null_option=_("None"),
|
|
255
|
+
label=_("Zone Templates"),
|
|
256
|
+
)
|
|
227
257
|
dnskey_ttl = TimePeriodField(
|
|
228
258
|
required=False,
|
|
229
259
|
label=_("DNSKEY TTL"),
|
netbox_dns/forms/nameserver.py
CHANGED
|
@@ -64,11 +64,13 @@ class NameServerFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
|
64
64
|
zone_id = DynamicModelMultipleChoiceField(
|
|
65
65
|
queryset=Zone.objects.all(),
|
|
66
66
|
required=False,
|
|
67
|
+
null_option=_("None"),
|
|
67
68
|
label=_("Zones"),
|
|
68
69
|
)
|
|
69
70
|
soa_zone_id = DynamicModelMultipleChoiceField(
|
|
70
71
|
queryset=Zone.objects.all(),
|
|
71
72
|
required=False,
|
|
73
|
+
null_option=_("None"),
|
|
72
74
|
label=_("SOA Zones"),
|
|
73
75
|
)
|
|
74
76
|
description = forms.CharField(
|
|
@@ -146,6 +146,7 @@ class RecordTemplateFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
|
146
146
|
zone_template_id = DynamicModelMultipleChoiceField(
|
|
147
147
|
queryset=ZoneTemplate.objects.all(),
|
|
148
148
|
required=False,
|
|
149
|
+
null_option=_("None"),
|
|
149
150
|
label=_("Zone Templates"),
|
|
150
151
|
)
|
|
151
152
|
tag = TagFilterField(RecordTemplate)
|
netbox_dns/forms/zone.py
CHANGED
|
@@ -23,7 +23,7 @@ from utilities.forms.fields import (
|
|
|
23
23
|
DynamicModelChoiceField,
|
|
24
24
|
)
|
|
25
25
|
from utilities.release import load_release_data
|
|
26
|
-
from utilities.forms.widgets import BulkEditNullBooleanSelect
|
|
26
|
+
from utilities.forms.widgets import BulkEditNullBooleanSelect, DatePicker
|
|
27
27
|
from utilities.forms.rendering import FieldSet
|
|
28
28
|
from utilities.forms import BOOLEAN_WITH_BLANK_CHOICES, add_blank_choice
|
|
29
29
|
from tenancy.models import Tenant, TenantGroup
|
|
@@ -38,7 +38,7 @@ from netbox_dns.models import (
|
|
|
38
38
|
ZoneTemplate,
|
|
39
39
|
DNSSECPolicy,
|
|
40
40
|
)
|
|
41
|
-
from netbox_dns.choices import ZoneStatusChoices
|
|
41
|
+
from netbox_dns.choices import ZoneStatusChoices, ZoneEPPStatusChoices
|
|
42
42
|
from netbox_dns.utilities import name_to_unicode, network_to_reverse
|
|
43
43
|
from netbox_dns.fields import RFC2317NetworkFormField, TimePeriodField
|
|
44
44
|
from netbox_dns.validators import validate_ipv4, validate_prefix, validate_rfc2317
|
|
@@ -59,10 +59,21 @@ class RollbackTransaction(Exception):
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
class ZoneTemplateUpdateMixin:
|
|
62
|
+
def _check_soa_mname(self):
|
|
63
|
+
if (
|
|
64
|
+
self.cleaned_data.get("soa_mname") is None
|
|
65
|
+
and "soa_mname" in self.fields.keys()
|
|
66
|
+
):
|
|
67
|
+
self.add_error(
|
|
68
|
+
"soa_mname",
|
|
69
|
+
_("soa_mname not set and no template or default value defined"),
|
|
70
|
+
)
|
|
71
|
+
|
|
62
72
|
def clean(self, *args, **kwargs):
|
|
63
73
|
super().clean(*args, **kwargs)
|
|
64
74
|
|
|
65
75
|
if (template := self.cleaned_data.get("template")) is None:
|
|
76
|
+
self._check_soa_mname()
|
|
66
77
|
return
|
|
67
78
|
|
|
68
79
|
if not self.cleaned_data.get("nameservers") and template.nameservers.all():
|
|
@@ -77,11 +88,7 @@ class ZoneTemplateUpdateMixin:
|
|
|
77
88
|
) not in (None, ""):
|
|
78
89
|
self.cleaned_data[field] = getattr(template, field)
|
|
79
90
|
|
|
80
|
-
|
|
81
|
-
self.add_error(
|
|
82
|
-
"soa_mname",
|
|
83
|
-
_("soa_mname not set and no template or default value defined"),
|
|
84
|
-
)
|
|
91
|
+
self._check_soa_mname()
|
|
85
92
|
|
|
86
93
|
if self.errors:
|
|
87
94
|
return
|
|
@@ -285,6 +292,8 @@ class ZoneForm(ZoneTemplateUpdateMixin, TenancyForm, NetBoxModelForm):
|
|
|
285
292
|
FieldSet(
|
|
286
293
|
"registrar",
|
|
287
294
|
"registry_domain_id",
|
|
295
|
+
"expiration_date",
|
|
296
|
+
"domain_status",
|
|
288
297
|
"registrant",
|
|
289
298
|
"admin_c",
|
|
290
299
|
"tech_c",
|
|
@@ -379,6 +388,8 @@ class ZoneForm(ZoneTemplateUpdateMixin, TenancyForm, NetBoxModelForm):
|
|
|
379
388
|
"inline_signing",
|
|
380
389
|
"registrar",
|
|
381
390
|
"registry_domain_id",
|
|
391
|
+
"expiration_date",
|
|
392
|
+
"domain_status",
|
|
382
393
|
"registrant",
|
|
383
394
|
"admin_c",
|
|
384
395
|
"tech_c",
|
|
@@ -387,8 +398,8 @@ class ZoneForm(ZoneTemplateUpdateMixin, TenancyForm, NetBoxModelForm):
|
|
|
387
398
|
"tenant",
|
|
388
399
|
"tags",
|
|
389
400
|
)
|
|
390
|
-
|
|
391
|
-
"
|
|
401
|
+
widgets = {
|
|
402
|
+
"expiration_date": DatePicker,
|
|
392
403
|
}
|
|
393
404
|
|
|
394
405
|
|
|
@@ -412,7 +423,7 @@ class ZoneFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
|
412
423
|
name=_("SOA"),
|
|
413
424
|
),
|
|
414
425
|
FieldSet(
|
|
415
|
-
"
|
|
426
|
+
"dnssec_policy_id",
|
|
416
427
|
"inline_signing",
|
|
417
428
|
name=_("DNSSEC"),
|
|
418
429
|
),
|
|
@@ -425,6 +436,9 @@ class ZoneFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
|
425
436
|
FieldSet(
|
|
426
437
|
"registrar_id",
|
|
427
438
|
"registry_domain_id",
|
|
439
|
+
"expiration_date_before",
|
|
440
|
+
"expiration_date_after",
|
|
441
|
+
"domain_status",
|
|
428
442
|
"registrant_id",
|
|
429
443
|
"admin_c_id",
|
|
430
444
|
"tech_c_id",
|
|
@@ -451,6 +465,7 @@ class ZoneFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
|
451
465
|
nameserver_id = DynamicModelMultipleChoiceField(
|
|
452
466
|
queryset=NameServer.objects.all(),
|
|
453
467
|
required=False,
|
|
468
|
+
null_option=_("None"),
|
|
454
469
|
label=_("Nameservers"),
|
|
455
470
|
)
|
|
456
471
|
active = forms.NullBooleanField(
|
|
@@ -488,40 +503,67 @@ class ZoneFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
|
488
503
|
rfc2317_parent_zone_id = DynamicModelMultipleChoiceField(
|
|
489
504
|
queryset=Zone.objects.all(),
|
|
490
505
|
required=False,
|
|
506
|
+
null_option=_("None"),
|
|
491
507
|
label=_("Parent Zone"),
|
|
492
508
|
)
|
|
493
|
-
registrar_id = DynamicModelMultipleChoiceField(
|
|
494
|
-
queryset=Registrar.objects.all(),
|
|
495
|
-
required=False,
|
|
496
|
-
label=_("Registrar"),
|
|
497
|
-
)
|
|
498
509
|
dnssec_policy_id = DynamicModelMultipleChoiceField(
|
|
499
510
|
queryset=DNSSECPolicy.objects.all(),
|
|
500
511
|
required=False,
|
|
512
|
+
null_option=_("None"),
|
|
501
513
|
label=_("DNSSEC Policy"),
|
|
502
514
|
)
|
|
515
|
+
inline_signing = forms.NullBooleanField(
|
|
516
|
+
required=False,
|
|
517
|
+
widget=forms.Select(choices=BOOLEAN_WITH_BLANK_CHOICES),
|
|
518
|
+
label=_("Use Inline Signing"),
|
|
519
|
+
)
|
|
520
|
+
registrar_id = DynamicModelMultipleChoiceField(
|
|
521
|
+
queryset=Registrar.objects.all(),
|
|
522
|
+
required=False,
|
|
523
|
+
null_option=_("None"),
|
|
524
|
+
label=_("Registrar"),
|
|
525
|
+
)
|
|
503
526
|
registry_domain_id = forms.CharField(
|
|
504
527
|
required=False,
|
|
505
528
|
label=_("Registry Domain ID"),
|
|
506
529
|
)
|
|
530
|
+
expiration_date_after = forms.DateField(
|
|
531
|
+
required=False,
|
|
532
|
+
label=_("Expiration Date after"),
|
|
533
|
+
widget=DatePicker,
|
|
534
|
+
)
|
|
535
|
+
expiration_date_before = forms.DateField(
|
|
536
|
+
required=False,
|
|
537
|
+
label=_("Expiration Date before"),
|
|
538
|
+
widget=DatePicker,
|
|
539
|
+
)
|
|
540
|
+
domain_status = forms.MultipleChoiceField(
|
|
541
|
+
choices=ZoneEPPStatusChoices,
|
|
542
|
+
required=False,
|
|
543
|
+
label=_("Domain Status"),
|
|
544
|
+
)
|
|
507
545
|
registrant_id = DynamicModelMultipleChoiceField(
|
|
508
546
|
queryset=RegistrationContact.objects.all(),
|
|
509
547
|
required=False,
|
|
548
|
+
null_option=_("None"),
|
|
510
549
|
label=_("Registrant"),
|
|
511
550
|
)
|
|
512
551
|
admin_c_id = DynamicModelMultipleChoiceField(
|
|
513
552
|
queryset=RegistrationContact.objects.all(),
|
|
514
553
|
required=False,
|
|
554
|
+
null_option=_("None"),
|
|
515
555
|
label=_("Administrative Contact"),
|
|
516
556
|
)
|
|
517
557
|
tech_c_id = DynamicModelMultipleChoiceField(
|
|
518
558
|
queryset=RegistrationContact.objects.all(),
|
|
519
559
|
required=False,
|
|
560
|
+
null_option=_("None"),
|
|
520
561
|
label=_("Technical Contact"),
|
|
521
562
|
)
|
|
522
563
|
billing_c_id = DynamicModelMultipleChoiceField(
|
|
523
564
|
queryset=RegistrationContact.objects.all(),
|
|
524
565
|
required=False,
|
|
566
|
+
null_option=_("None"),
|
|
525
567
|
label=_("Billing Contact"),
|
|
526
568
|
)
|
|
527
569
|
tag = TagFilterField(Zone)
|
|
@@ -638,6 +680,11 @@ class ZoneImportForm(ZoneTemplateUpdateMixin, NetBoxModelImportForm):
|
|
|
638
680
|
required=False,
|
|
639
681
|
label=_("Registry Domain ID"),
|
|
640
682
|
)
|
|
683
|
+
domain_status = CSVChoiceField(
|
|
684
|
+
choices=ZoneEPPStatusChoices,
|
|
685
|
+
required=False,
|
|
686
|
+
label=_("Domain Status"),
|
|
687
|
+
)
|
|
641
688
|
registrant = CSVModelChoiceField(
|
|
642
689
|
queryset=RegistrationContact.objects.all(),
|
|
643
690
|
required=False,
|
|
@@ -713,6 +760,8 @@ class ZoneImportForm(ZoneTemplateUpdateMixin, NetBoxModelImportForm):
|
|
|
713
760
|
"rfc2317_parent_managed",
|
|
714
761
|
"registrar",
|
|
715
762
|
"registry_domain_id",
|
|
763
|
+
"expiration_date",
|
|
764
|
+
"domain_status",
|
|
716
765
|
"registrant",
|
|
717
766
|
"admin_c",
|
|
718
767
|
"tech_c",
|
|
@@ -846,6 +895,16 @@ class ZoneBulkEditForm(NetBoxModelBulkEditForm):
|
|
|
846
895
|
required=False,
|
|
847
896
|
label=_("Registry Domain ID"),
|
|
848
897
|
)
|
|
898
|
+
expiration_date = forms.DateField(
|
|
899
|
+
required=False,
|
|
900
|
+
label=_("Expiration Date"),
|
|
901
|
+
widget=DatePicker,
|
|
902
|
+
)
|
|
903
|
+
domain_status = forms.ChoiceField(
|
|
904
|
+
choices=add_blank_choice(ZoneEPPStatusChoices),
|
|
905
|
+
required=False,
|
|
906
|
+
label=_("Domain Status"),
|
|
907
|
+
)
|
|
849
908
|
registrant = DynamicModelChoiceField(
|
|
850
909
|
queryset=RegistrationContact.objects.all(),
|
|
851
910
|
required=False,
|
|
@@ -913,6 +972,8 @@ class ZoneBulkEditForm(NetBoxModelBulkEditForm):
|
|
|
913
972
|
FieldSet(
|
|
914
973
|
"registrar",
|
|
915
974
|
"registry_domain_id",
|
|
975
|
+
"expiration_date",
|
|
976
|
+
"domain_status",
|
|
916
977
|
"registrant",
|
|
917
978
|
"admin_c",
|
|
918
979
|
"tech_c",
|
|
@@ -927,6 +988,8 @@ class ZoneBulkEditForm(NetBoxModelBulkEditForm):
|
|
|
927
988
|
"nameservers",
|
|
928
989
|
"rfc2317_prefix",
|
|
929
990
|
"registrar",
|
|
991
|
+
"expiration_date",
|
|
992
|
+
"domain_status",
|
|
930
993
|
"registry_domain_id",
|
|
931
994
|
"registrant",
|
|
932
995
|
"admin_c",
|
|
@@ -127,11 +127,13 @@ class ZoneTemplateFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
|
127
127
|
nameserver_id = DynamicModelMultipleChoiceField(
|
|
128
128
|
queryset=NameServer.objects.all(),
|
|
129
129
|
required=False,
|
|
130
|
+
null_option=_("None"),
|
|
130
131
|
label=_("Nameservers"),
|
|
131
132
|
)
|
|
132
133
|
soa_mname_id = DynamicModelMultipleChoiceField(
|
|
133
134
|
queryset=NameServer.objects.all(),
|
|
134
135
|
required=False,
|
|
136
|
+
null_option=_("None"),
|
|
135
137
|
label=_("MName"),
|
|
136
138
|
)
|
|
137
139
|
soa_rname = forms.CharField(
|
|
@@ -141,6 +143,7 @@ class ZoneTemplateFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
|
141
143
|
record_template_id = DynamicModelMultipleChoiceField(
|
|
142
144
|
queryset=RecordTemplate.objects.all(),
|
|
143
145
|
required=False,
|
|
146
|
+
null_option=_("None"),
|
|
144
147
|
label=_("Record Templates"),
|
|
145
148
|
)
|
|
146
149
|
description = forms.CharField(
|
|
@@ -149,31 +152,37 @@ class ZoneTemplateFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|
|
149
152
|
dnssec_policy_id = DynamicModelMultipleChoiceField(
|
|
150
153
|
queryset=DNSSECPolicy.objects.all(),
|
|
151
154
|
required=False,
|
|
155
|
+
null_option=_("None"),
|
|
152
156
|
label=_("DNSSEC Policy ID"),
|
|
153
157
|
)
|
|
154
158
|
registrar_id = DynamicModelMultipleChoiceField(
|
|
155
159
|
queryset=Registrar.objects.all(),
|
|
156
160
|
required=False,
|
|
161
|
+
null_option=_("None"),
|
|
157
162
|
label=_("Registrar"),
|
|
158
163
|
)
|
|
159
164
|
registrant_id = DynamicModelMultipleChoiceField(
|
|
160
165
|
queryset=RegistrationContact.objects.all(),
|
|
161
166
|
required=False,
|
|
167
|
+
null_option=_("None"),
|
|
162
168
|
label=_("Registrant"),
|
|
163
169
|
)
|
|
164
170
|
admin_c_id = DynamicModelMultipleChoiceField(
|
|
165
171
|
queryset=RegistrationContact.objects.all(),
|
|
166
172
|
required=False,
|
|
173
|
+
null_option=_("None"),
|
|
167
174
|
label=_("Administrative Contact"),
|
|
168
175
|
)
|
|
169
176
|
tech_c_id = DynamicModelMultipleChoiceField(
|
|
170
177
|
queryset=RegistrationContact.objects.all(),
|
|
171
178
|
required=False,
|
|
179
|
+
null_option=_("None"),
|
|
172
180
|
label=_("Technical Contact"),
|
|
173
181
|
)
|
|
174
182
|
billing_c_id = DynamicModelMultipleChoiceField(
|
|
175
183
|
queryset=RegistrationContact.objects.all(),
|
|
176
184
|
required=False,
|
|
185
|
+
null_option=_("None"),
|
|
177
186
|
label=_("Billing Contact"),
|
|
178
187
|
)
|
|
179
188
|
tag = TagFilterField(ZoneTemplate)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import strawberry
|
|
2
|
+
|
|
3
|
+
from netbox_dns.choices import (
|
|
4
|
+
RecordTypeChoices,
|
|
5
|
+
RecordClassChoices,
|
|
6
|
+
RecordStatusChoices,
|
|
7
|
+
ZoneStatusChoices,
|
|
8
|
+
DNSSECPolicyDigestChoices,
|
|
9
|
+
DNSSECPolicyStatusChoices,
|
|
10
|
+
DNSSECKeyTemplateTypeChoices,
|
|
11
|
+
DNSSECKeyTemplateAlgorithmChoices,
|
|
12
|
+
DNSSECKeyTemplateKeySizeChoices,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
__all__ = (
|
|
16
|
+
"NetBoxDNSRecordTypeEnum",
|
|
17
|
+
"NetBoxDNSRecordClassEnum",
|
|
18
|
+
"NetBoxDNSRecordStatusEnum",
|
|
19
|
+
"NetBoxDNSZoneStatusEnum",
|
|
20
|
+
"NetBoxDNSDNSSECPolicyDigestEnum",
|
|
21
|
+
"NetBoxDNSDNSSECPolicyStatusEnum",
|
|
22
|
+
"NetBoxDNSDNSSECKeyTemplateTypeEnum",
|
|
23
|
+
"NetBoxDNSDNSSECKeyTemplateAlgorithmEnum",
|
|
24
|
+
"NetBoxDNSDNSSECKeyTemplateKeySizeEnum",
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
NetBoxDNSRecordTypeEnum = strawberry.enum(RecordTypeChoices.as_enum())
|
|
28
|
+
NetBoxDNSRecordClassEnum = strawberry.enum(RecordClassChoices.as_enum())
|
|
29
|
+
NetBoxDNSRecordStatusEnum = strawberry.enum(RecordStatusChoices.as_enum())
|
|
30
|
+
NetBoxDNSZoneStatusEnum = strawberry.enum(ZoneStatusChoices.as_enum())
|
|
31
|
+
NetBoxDNSDNSSECPolicyDigestEnum = strawberry.enum(DNSSECPolicyDigestChoices.as_enum())
|
|
32
|
+
NetBoxDNSDNSSECPolicyStatusEnum = strawberry.enum(DNSSECPolicyStatusChoices.as_enum())
|
|
33
|
+
NetBoxDNSDNSSECKeyTemplateTypeEnum = strawberry.enum(
|
|
34
|
+
DNSSECKeyTemplateTypeChoices.as_enum()
|
|
35
|
+
)
|
|
36
|
+
NetBoxDNSDNSSECKeyTemplateAlgorithmEnum = strawberry.enum(
|
|
37
|
+
DNSSECKeyTemplateAlgorithmChoices.as_enum()
|
|
38
|
+
)
|
|
39
|
+
NetBoxDNSDNSSECKeyTemplateKeySizeEnum = strawberry.enum(
|
|
40
|
+
DNSSECKeyTemplateKeySizeChoices.as_enum()
|
|
41
|
+
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import strawberry
|
|
2
|
+
|
|
3
|
+
from netbox.graphql.filter_lookups import ArrayLookup
|
|
4
|
+
|
|
5
|
+
from netbox_dns.graphql.enums import NetBoxDNSDNSSECPolicyDigestEnum
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@strawberry.input(
|
|
9
|
+
one_of=True,
|
|
10
|
+
description="Lookup for Array fields. Only one of the lookup fields can be set.",
|
|
11
|
+
)
|
|
12
|
+
class PolicyDigestArrayLookup(ArrayLookup[NetBoxDNSDNSSECPolicyDigestEnum]):
|
|
13
|
+
pass
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from .view import *
|
|
2
|
+
from .zone import *
|
|
3
|
+
from .nameserver import *
|
|
4
|
+
from .record import *
|
|
5
|
+
from .registration_contact import *
|
|
6
|
+
from .registrar import *
|
|
7
|
+
|
|
8
|
+
from .zone_template import *
|
|
9
|
+
from .record_template import *
|
|
10
|
+
|
|
11
|
+
from .dnssec_key_template import *
|
|
12
|
+
from .dnssec_policy import *
|