netbox-plugin-dns 1.2.5__py3-none-any.whl → 1.2.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.

Potentially problematic release.


This version of netbox-plugin-dns might be problematic. Click here for more details.

Files changed (77) hide show
  1. netbox_dns/__init__.py +16 -8
  2. netbox_dns/api/field_serializers.py +25 -0
  3. netbox_dns/api/nested_serializers.py +19 -1
  4. netbox_dns/api/serializers.py +3 -0
  5. netbox_dns/api/serializers_/dnssec_key_template.py +59 -0
  6. netbox_dns/api/serializers_/dnssec_policy.py +113 -0
  7. netbox_dns/api/serializers_/record.py +2 -0
  8. netbox_dns/api/serializers_/record_template.py +2 -0
  9. netbox_dns/api/serializers_/zone.py +20 -1
  10. netbox_dns/api/serializers_/zone_template.py +13 -4
  11. netbox_dns/api/urls.py +4 -0
  12. netbox_dns/api/views.py +18 -0
  13. netbox_dns/choices/__init__.py +2 -0
  14. netbox_dns/choices/dnssec_key_template.py +63 -0
  15. netbox_dns/choices/dnssec_policy.py +40 -0
  16. netbox_dns/choices/record.py +2 -25
  17. netbox_dns/choices/utilities.py +26 -0
  18. netbox_dns/choices/zone.py +96 -1
  19. netbox_dns/fields/__init__.py +2 -0
  20. netbox_dns/fields/choice_array.py +33 -0
  21. netbox_dns/fields/timeperiod.py +33 -0
  22. netbox_dns/filtersets/__init__.py +3 -0
  23. netbox_dns/filtersets/dnssec_key_template.py +51 -0
  24. netbox_dns/filtersets/dnssec_policy.py +97 -0
  25. netbox_dns/filtersets/zone.py +30 -6
  26. netbox_dns/filtersets/zone_template.py +13 -2
  27. netbox_dns/forms/__init__.py +2 -0
  28. netbox_dns/forms/dnssec_key_template.py +189 -0
  29. netbox_dns/forms/dnssec_policy.py +593 -0
  30. netbox_dns/forms/nameserver.py +2 -0
  31. netbox_dns/forms/record.py +12 -6
  32. netbox_dns/forms/record_template.py +10 -3
  33. netbox_dns/forms/zone.py +142 -31
  34. netbox_dns/forms/zone_template.py +38 -0
  35. netbox_dns/graphql/__init__.py +7 -3
  36. netbox_dns/graphql/filters.py +16 -0
  37. netbox_dns/graphql/schema.py +20 -0
  38. netbox_dns/graphql/types.py +67 -3
  39. netbox_dns/locale/de/LC_MESSAGES/django.mo +0 -0
  40. netbox_dns/locale/fr/LC_MESSAGES/django.mo +0 -0
  41. netbox_dns/migrations/0015_dnssec.py +168 -0
  42. netbox_dns/migrations/0016_dnssec_policy_status.py +18 -0
  43. netbox_dns/migrations/0017_dnssec_policy_zone_zone_template.py +41 -0
  44. netbox_dns/migrations/0018_zone_domain_status_zone_expiration_date.py +23 -0
  45. netbox_dns/models/__init__.py +2 -0
  46. netbox_dns/models/dnssec_key_template.py +114 -0
  47. netbox_dns/models/dnssec_policy.py +203 -0
  48. netbox_dns/models/record.py +1 -1
  49. netbox_dns/models/zone.py +74 -19
  50. netbox_dns/models/zone_template.py +17 -7
  51. netbox_dns/navigation.py +49 -0
  52. netbox_dns/signals/dnssec.py +32 -0
  53. netbox_dns/tables/__init__.py +2 -0
  54. netbox_dns/tables/dnssec_key_template.py +48 -0
  55. netbox_dns/tables/dnssec_policy.py +131 -0
  56. netbox_dns/tables/zone.py +23 -2
  57. netbox_dns/tables/zone_template.py +4 -0
  58. netbox_dns/template_content.py +2 -1
  59. netbox_dns/templates/netbox_dns/dnsseckeytemplate.html +70 -0
  60. netbox_dns/templates/netbox_dns/dnssecpolicy.html +155 -0
  61. netbox_dns/templates/netbox_dns/zone/registration.html +19 -0
  62. netbox_dns/templates/netbox_dns/zone.html +16 -0
  63. netbox_dns/templates/netbox_dns/zonetemplate/child.html +46 -0
  64. netbox_dns/templates/netbox_dns/zonetemplate.html +12 -0
  65. netbox_dns/urls.py +23 -0
  66. netbox_dns/utilities/conversions.py +13 -0
  67. netbox_dns/validators/__init__.py +1 -0
  68. netbox_dns/validators/dnssec.py +148 -0
  69. netbox_dns/views/__init__.py +2 -0
  70. netbox_dns/views/dnssec_key_template.py +87 -0
  71. netbox_dns/views/dnssec_policy.py +155 -0
  72. netbox_dns/views/zone.py +11 -1
  73. {netbox_plugin_dns-1.2.5.dist-info → netbox_plugin_dns-1.2.7.dist-info}/METADATA +3 -2
  74. {netbox_plugin_dns-1.2.5.dist-info → netbox_plugin_dns-1.2.7.dist-info}/RECORD +77 -49
  75. {netbox_plugin_dns-1.2.5.dist-info → netbox_plugin_dns-1.2.7.dist-info}/WHEEL +1 -1
  76. {netbox_plugin_dns-1.2.5.dist-info → netbox_plugin_dns-1.2.7.dist-info/licenses}/LICENSE +0 -0
  77. {netbox_plugin_dns-1.2.5.dist-info → netbox_plugin_dns-1.2.7.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,131 @@
1
+ import django_tables2 as tables
2
+ from django.utils.translation import gettext_lazy as _
3
+
4
+
5
+ from netbox.tables import (
6
+ NetBoxTable,
7
+ TagColumn,
8
+ ChoiceFieldColumn,
9
+ ActionsColumn,
10
+ )
11
+ from tenancy.tables import TenancyColumnsMixin
12
+
13
+ from netbox_dns.models import DNSSECPolicy
14
+
15
+
16
+ __all__ = (
17
+ "DNSSECPolicyTable",
18
+ "DNSSECPolicyDisplayTable",
19
+ )
20
+
21
+
22
+ class DNSSECPolicyTable(TenancyColumnsMixin, NetBoxTable):
23
+ name = tables.Column(
24
+ verbose_name=_("Name"),
25
+ linkify=True,
26
+ )
27
+ status = ChoiceFieldColumn(
28
+ verbose_name=_("Status"),
29
+ )
30
+ dnskey_ttl = tables.Column(
31
+ verbose_name=_("DNSKEY TTL"),
32
+ )
33
+ purge_keys = tables.Column(
34
+ verbose_name=_("Purge Keys"),
35
+ )
36
+ publish_safety = tables.Column(
37
+ verbose_name=_("Publish Safety"),
38
+ )
39
+ retire_safety = tables.Column(
40
+ verbose_name=_("Retire Safety"),
41
+ )
42
+ signatures_jitter = tables.Column(
43
+ verbose_name=_("Signatures Jitter"),
44
+ )
45
+ signatures_refresh = tables.Column(
46
+ verbose_name=_("Signatures Refresh"),
47
+ )
48
+ signatures_validity = tables.Column(
49
+ verbose_name=_("Signatures Validity"),
50
+ )
51
+ signatures_validity_dnskey = tables.Column(
52
+ verbose_name=_("Signatures Validity (DNSKEY)"),
53
+ )
54
+ max_zone_ttl = tables.Column(
55
+ verbose_name=_("Max Zone TTL"),
56
+ )
57
+ dnskey_ttl = tables.Column(
58
+ verbose_name=_("DNSKEY TTL"),
59
+ )
60
+ zone_propagation_delay = tables.Column(
61
+ verbose_name=_("Zone Propagation Delay"),
62
+ )
63
+ create_cdnskey = tables.BooleanColumn(
64
+ verbose_name=_("Create CDNSKEY"),
65
+ )
66
+ cds_digest_types = tables.Column(
67
+ verbose_name=_("CDS Digest Types"),
68
+ )
69
+ parent_ds_ttl = tables.Column(
70
+ verbose_name=_("Parent DS TTL"),
71
+ )
72
+ parent_propagation_delay = tables.Column(
73
+ verbose_name=_("Parent Propagation Delay"),
74
+ )
75
+ use_nsec3 = tables.BooleanColumn(
76
+ verbose_name=_("Use NSEC3"),
77
+ )
78
+ nsec3_iterations = tables.Column(
79
+ verbose_name=_("NSEC3 Iterations"),
80
+ )
81
+ nsec3_opt_out = tables.BooleanColumn(
82
+ verbose_name=_("NSEC3 Opt Out"),
83
+ )
84
+ nsec3_salt_size = tables.Column(
85
+ verbose_name=_("NSEC3 Salt Size"),
86
+ )
87
+ tags = TagColumn(
88
+ url_name="plugins:netbox_dns:dnssecpolicy_list",
89
+ )
90
+
91
+ class Meta(NetBoxTable.Meta):
92
+ model = DNSSECPolicy
93
+ fields = ("description",)
94
+ default_columns = (
95
+ "name",
96
+ "description",
97
+ "status",
98
+ "use_nsec3",
99
+ "tags",
100
+ )
101
+
102
+
103
+ class DNSSECPolicyDisplayTable(TenancyColumnsMixin, NetBoxTable):
104
+ actions = ActionsColumn(actions="")
105
+
106
+ name = tables.Column(
107
+ verbose_name=_("Name"),
108
+ linkify=True,
109
+ )
110
+ status = ChoiceFieldColumn(
111
+ verbose_name=_("Status"),
112
+ )
113
+ create_cdnskey = tables.BooleanColumn(
114
+ verbose_name=_("Create CDNSKEY"),
115
+ )
116
+ use_nsec3 = tables.BooleanColumn(
117
+ verbose_name=_("Use NSEC3"),
118
+ )
119
+ tags = TagColumn(
120
+ url_name="plugins:netbox_dns:dnssecpolicy_list",
121
+ )
122
+
123
+ class Meta(NetBoxTable.Meta):
124
+ model = DNSSECPolicy
125
+ fields = ("description",)
126
+ default_columns = (
127
+ "name",
128
+ "description",
129
+ "status",
130
+ "tags",
131
+ )
netbox_dns/tables/zone.py CHANGED
@@ -5,13 +5,17 @@ from netbox.tables import (
5
5
  ChoiceFieldColumn,
6
6
  NetBoxTable,
7
7
  TagColumn,
8
+ ActionsColumn,
8
9
  )
9
10
  from tenancy.tables import TenancyColumnsMixin
10
11
 
11
12
  from netbox_dns.models import Zone
12
13
 
13
14
 
14
- __all__ = ("ZoneTable",)
15
+ __all__ = (
16
+ "ZoneTable",
17
+ "ZoneDisplayTable",
18
+ )
15
19
 
16
20
 
17
21
  class ZoneTable(TenancyColumnsMixin, NetBoxTable):
@@ -34,7 +38,11 @@ class ZoneTable(TenancyColumnsMixin, NetBoxTable):
34
38
  url_name="plugins:netbox_dns:zone_list",
35
39
  )
36
40
  default_ttl = tables.Column(
37
- verbose_name="Default TTL",
41
+ verbose_name=_("Default TTL"),
42
+ )
43
+ dnssec_policy = tables.Column(
44
+ verbose_name=_("DNSSEC Policy"),
45
+ linkify=True,
38
46
  )
39
47
  rfc2317_prefix = tables.Column(
40
48
  verbose_name=_("RFC2317 Prefix"),
@@ -47,6 +55,9 @@ class ZoneTable(TenancyColumnsMixin, NetBoxTable):
47
55
  verbose_name=_("Registrar"),
48
56
  linkify=True,
49
57
  )
58
+ domain_status = ChoiceFieldColumn(
59
+ verbose_name=_("Domain Status"),
60
+ )
50
61
  registrant = tables.Column(
51
62
  verbose_name=_("Registrant"),
52
63
  linkify=True,
@@ -73,8 +84,11 @@ class ZoneTable(TenancyColumnsMixin, NetBoxTable):
73
84
  "description",
74
85
  "soa_rname",
75
86
  "soa_serial",
87
+ "inline_signing",
76
88
  "rfc2317_parent_managed",
77
89
  "registry_domain_id",
90
+ "expiration_date",
91
+ "domain_status",
78
92
  )
79
93
  default_columns = (
80
94
  "name",
@@ -82,3 +96,10 @@ class ZoneTable(TenancyColumnsMixin, NetBoxTable):
82
96
  "status",
83
97
  "tags",
84
98
  )
99
+
100
+
101
+ class ZoneDisplayTable(ZoneTable):
102
+ actions = ActionsColumn(actions=("changelog",))
103
+
104
+ class Meta(ZoneTable.Meta):
105
+ pass
@@ -25,6 +25,10 @@ class ZoneTemplateTable(TenancyColumnsMixin, NetBoxTable):
25
25
  tags = TagColumn(
26
26
  url_name="plugins:netbox_dns:zonetemplate_list",
27
27
  )
28
+ dnssec_policy = tables.Column(
29
+ verbose_name=_("DNSSEC Policy"),
30
+ linkify=True,
31
+ )
28
32
  registrar = tables.Column(
29
33
  verbose_name=_("Registrar"),
30
34
  linkify=True,
@@ -2,6 +2,7 @@ import django_tables2 as tables
2
2
 
3
3
  from django.conf import settings
4
4
  from django.urls import reverse
5
+ from django.utils.translation import gettext_lazy as _
5
6
 
6
7
  from netbox.plugins.utils import get_plugin_config
7
8
  from netbox.plugins import PluginTemplateExtension
@@ -119,7 +120,7 @@ class IPRelatedDNSRecords(PluginTemplateExtension):
119
120
 
120
121
 
121
122
  address_records = tables.ManyToManyColumn(
122
- verbose_name="DNS Address Records",
123
+ verbose_name=_("DNS Address Records"),
123
124
  accessor="netbox_dns_records",
124
125
  linkify_item=True,
125
126
  transform=lambda obj: (
@@ -0,0 +1,70 @@
1
+ {% extends 'generic/object.html' %}
2
+ {% load render_table from django_tables2 %}
3
+ {% load i18n %}
4
+
5
+ {% block content %}
6
+ <div class="row">
7
+ <div class="col col-md-6">
8
+ <div class="card">
9
+ <h5 class="card-header">{% trans "DNSSEC Key" %}</h5>
10
+ <table class="table table-hover attr-table">
11
+ <tr>
12
+ <th scope="row">{% trans "Name" %}</th>
13
+ <td>{{ object.name }}</td>
14
+ </tr>
15
+ {% if object.description %}
16
+ <tr>
17
+ <th scope="row">{% trans "Description" %}</th>
18
+ <td style="word-break:break-all;">{{ object.description }}</td>
19
+ </tr>
20
+ {% endif %}
21
+ <tr>
22
+ <th scope="row">{% trans "Type" %}</th>
23
+ <td>{% badge object.get_type_display bg_color=object.get_type_color %}</td>
24
+ </tr>
25
+ <tr>
26
+ <th scope="row">{% trans "Lifetime" %}</th>
27
+ <td>{{ object.lifetime|placeholder }}</td>
28
+ </tr>
29
+ <tr>
30
+ <th scope="row">{% trans "Algorithm" %}</th>
31
+ <td>{% badge object.get_algorithm_display %}</td>
32
+ </tr>
33
+ <tr>
34
+ <th scope="row">{% trans "Key Size" %}</th>
35
+ <td>{% badge object.get_key_size_display %}</td>
36
+ </tr>
37
+ {% if object.tenant %}
38
+ <tr>
39
+ <th scope="row">{% trans "Tenant" %}</th>
40
+ <td>
41
+ {% if object.tenant.group %}
42
+ {{ object.tenant.group|linkify }} /
43
+ {% endif %}
44
+ {{ object.tenant|linkify|placeholder }}
45
+ </td>
46
+ </tr>
47
+ {% endif %}
48
+ </table>
49
+ </div>
50
+ {% include 'inc/panels/custom_fields.html' %}
51
+ </div>
52
+ <div class="col col-md-6">
53
+ {% include 'inc/panels/tags.html' %}
54
+ </div>
55
+ </div>
56
+ {% if policy_table %}
57
+ <div class="col col-md-12">
58
+ <div class="card">
59
+ {% if policy_table.rows|length == 1 %}
60
+ <h2 class="card-header">{% trans "Policy" %}</h2>
61
+ {% else %}
62
+ <h2 class="card-header">{% trans "Policies" %}</h2>
63
+ {% endif %}
64
+ <div class="table-responsive">
65
+ {% render_table policy_table 'inc/table.html' %}
66
+ </div>
67
+ </div>
68
+ </div>
69
+ {% endif %}
70
+ {% endblock %}
@@ -0,0 +1,155 @@
1
+ {% extends 'generic/object.html' %}
2
+ {% load i18n %}
3
+
4
+ {% block content %}
5
+ <div class="row">
6
+ <div class="col col-md-6">
7
+ <div class="card">
8
+ <h5 class="card-header">{% trans "DNSSEC Policy" %}</h5>
9
+ <table class="table table-hover attr-table">
10
+ {% if object.description %}
11
+ <tr>
12
+ <th scope="row">{% trans "Description" %}</th>
13
+ <td style="word-break:break-all;">{{ object.description }}</td>
14
+ </tr>
15
+ {% endif %}
16
+ <tr>
17
+ <th scope="row">{% trans "Status" %}</th>
18
+ <td>{% badge object.get_status_display bg_color=object.get_status_color %}</td>
19
+ </tr>
20
+ <tr>
21
+ <th scope="row">{% trans "Key Templates" %}</th>
22
+ <td>
23
+ <table>
24
+ {% for key_template in object.key_templates.all %}
25
+ <tr><td>{{ key_template|linkify }}</td></tr>
26
+ {% for template_id, errors in key_template_errors.items %}
27
+ {% if template_id == key_template.pk %}
28
+ {% for error in errors %}
29
+ <tr><td class="text-danger">{{ error }}</td></tr>
30
+ {% endfor %}
31
+ {% endif %}
32
+ {% endfor %}
33
+ {% endfor %}
34
+ </table>
35
+ </td>
36
+ </tr>
37
+ {% if policy_warning %}
38
+ <tr><td class="text-danger">{{ policy_warning }}</td></tr>
39
+ {% endif %}
40
+ {% if object.tenant %}
41
+ <tr>
42
+ <th scope="row">{% trans "Tenant" %}</th>
43
+ <td>
44
+ {% if object.tenant.group %}
45
+ {{ object.tenant.group|linkify }} /
46
+ {% endif %}
47
+ {{ object.tenant|linkify|placeholder }}
48
+ </td>
49
+ </tr>
50
+ {% endif %}
51
+ </table>
52
+ </div>
53
+ <div class="card">
54
+ <h5 class="card-header">{% trans "Timing" %}</h5>
55
+ <table class="table table-hover attr-table">
56
+ <tr>
57
+ <th scope="row">{% trans "DNSKEY TTL" %}</th>
58
+ <td>{{ object.dnskey_ttl|placeholder }}</td>
59
+ </tr>
60
+ <tr>
61
+ <th scope="row">{% trans "Publish Safety" %}</th>
62
+ <td>{{ object.publish_safety|placeholder }}</td>
63
+ </tr>
64
+ <tr>
65
+ <th scope="row">{% trans "Purge Keys" %}</th>
66
+ <td>{{ object.purge_keys|placeholder }}</td>
67
+ </tr>
68
+ <tr>
69
+ <th scope="row">{% trans "Retire Safety" %}</th>
70
+ <td>{{ object.retire_safety|placeholder }}</td>
71
+ </tr>
72
+ <tr>
73
+ <th scope="row">{% trans "Signatures Jitter" %}</th>
74
+ <td>{{ object.signatures_jitter|placeholder }}</td>
75
+ </tr>
76
+ <tr>
77
+ <th scope="row">{% trans "Signatures Refresh" %}</th>
78
+ <td>{{ object.signatures_refresh|placeholder }}</td>
79
+ </tr>
80
+ <tr>
81
+ <th scope="row">{% trans "Signatures Validity" %}</th>
82
+ <td>{{ object.signatures_validity|placeholder }}</td>
83
+ </tr>
84
+ <tr>
85
+ <th scope="row">{% trans "Signatures Validity (DNSKEY)" %}</th>
86
+ <td>{{ object.signatures_validity_dnskey|placeholder }}</td>
87
+ </tr>
88
+ <tr>
89
+ <th scope="row">{% trans "Max Zone TTL" %}</th>
90
+ <td>{{ object.max_zone_ttl|placeholder }}</td>
91
+ </tr>
92
+ <tr>
93
+ <th scope="row">{% trans "Zone Propagation Delay" %}</th>
94
+ <td>{{ object.zone_propagation_delay|placeholder }}</td>
95
+ </tr>
96
+ </table>
97
+ </div>
98
+ {% include 'inc/panels/custom_fields.html' %}
99
+ </div>
100
+ <div class="col col-md-6">
101
+ {% include 'inc/panels/tags.html' %}
102
+ <div class="card">
103
+ <h5 class="card-header">{% trans "Parent Delegation" %}</h5>
104
+ <table class="table table-hover attr-table">
105
+ <tr>
106
+ <th scope="row">{% trans "Create CDNSKEY" %}</th>
107
+ <td>{% checkmark object.create_cdnskey %}</td>
108
+ </tr>
109
+ <tr>
110
+ <th scope="row">{% trans "CDS Digest Types" %}</th>
111
+ <td>{% if object.cds_digest_types %}{% for digest_type in object.cds_digest_types %}{% badge digest_type %}{% endfor %}{% else %}{{ object_cds_digest_types|placeholder }}{% endif %}</td>
112
+ </tr>
113
+ <tr>
114
+ <th scope="row">{% trans "Parent DS TTL" %}</th>
115
+ <td>{{ object.parent_ds_ttl|placeholder }}</td>
116
+ </tr>
117
+ <tr>
118
+ <th scope="row">{% trans "Parent Propagation Delay" %}</th>
119
+ <td>{{ object.parent_propagation_delay|placeholder }}</td>
120
+ </tr>
121
+ </table>
122
+ </div>
123
+ <div class="card">
124
+ <h5 class="card-header">{% trans "Proof of Non-Existence" %}</h5>
125
+ <table class="table table-hover attr-table">
126
+ <tr>
127
+ <th scope="row">{% trans "Use NSEC3" %}</th>
128
+ <td>{% checkmark object.use_nsec3 %}</td>
129
+ </tr>
130
+ {% if object.use_nsec3 %}
131
+ <tr>
132
+ <th scope="row">{% trans "NSEC3 Iterations" %}</th>
133
+ <td>{{ object.nsec3_iterations|placeholder }}</td>
134
+ </tr>
135
+ <tr>
136
+ <th scope="row">{% trans "NSEC3 Opt Out" %}</th>
137
+ <td>{% checkmark object.nsec3_opt_out %}</td>
138
+ </tr>
139
+ <tr>
140
+ <th scope="row">{% trans "NSEC3 Salt Size" %}</th>
141
+ <td>{{ object.nsec3_salt_size|placeholder }}</td>
142
+ </tr>
143
+ {% if object.nsec3_iterations or object.nsec3_opt_out or object.nsec3_salt_size %}
144
+ <tr>
145
+ <th class="text-warning">
146
+ {% blocktrans with link='<a href="https://datatracker.ietf.org/doc/html/rfc9276.html#section-3.1">RFC 9276, Section 3.1</a>' %}Using NSEC3 options is not recommended (see {{ link }}){% endblocktrans %}
147
+ </th>
148
+ </tr>
149
+ {% endif %}
150
+ {% endif %}
151
+ </table>
152
+ </div>
153
+ </div>
154
+ </div>
155
+ {% endblock %}
@@ -14,6 +14,25 @@
14
14
  <th scope="row">{% trans "Registry Domain ID" %}</th>
15
15
  <td>{{ object.registry_domain_id|placeholder }}</td>
16
16
  </tr>
17
+ <tr>
18
+ <th scope="row">{% trans "Expiration Date" %}</th>
19
+ <td>{{ object.expiration_date|placeholder }}</td>
20
+ </tr>
21
+ {% if expiration_warning %}
22
+ <tr>
23
+ <th class="text-warning" scope="row">{% trans "Warning" %}</th>
24
+ <td class="text-warning">{{ expiration_warning }}</td>
25
+ </tr>
26
+ {% elif expiration_error %}
27
+ <tr>
28
+ <th class="text-danger" scope="row">{% trans "Error" %}</th>
29
+ <td class="text-danger">{{ expiration_error }}</td>
30
+ </tr>
31
+ {% endif %}
32
+ <tr>
33
+ <th scope="row">{% trans "Domain Status" %}</th>
34
+ <td>{% badge object.get_domain_status_display bg_color=object.get_domain_status_color %}</td>
35
+ </tr>
17
36
  <tr>
18
37
  <th scope="row">{% trans "Registrant" %}</th>
19
38
  <td>{{ object.registrant|linkify|placeholder }}</td>
@@ -96,6 +96,22 @@
96
96
  </table>
97
97
  </div>
98
98
 
99
+ {% if object.dnssec_policy %}
100
+ <div class="card">
101
+ <h5 class="card-header">{% trans "DNSSEC" %}</h5>
102
+ <table class="table table-hover attr-table">
103
+ <tr>
104
+ <th scope="row">{% trans "Policy" %}</th>
105
+ <td>{{ object.dnssec_policy|linkify }}</td>
106
+ </tr>
107
+ <tr>
108
+ <th scope="row">{% trans "Use Inline Signing" %}</th>
109
+ <td>{% checkmark object.inline_signing %}</td>
110
+ </tr>
111
+ </table>
112
+ </div>
113
+ {% endif %}
114
+
99
115
  {% include 'inc/panels/tags.html' %}
100
116
  {% include 'inc/panels/custom_fields.html' %}
101
117
  </div>
@@ -0,0 +1,46 @@
1
+ {% extends 'generic/object.html' %}
2
+ {% load helpers %}
3
+ {% load render_table from django_tables2 %}
4
+ {% load perms %}
5
+ {% load i18n %}
6
+
7
+ {% block content %}
8
+ {% include 'inc/table_controls_htmx.html' with table_modal="ZoneTemplateTable_config" %}
9
+
10
+ <form method="post">
11
+ {% csrf_token %}
12
+ <input type="hidden" name="return_url" value="{% if return_url %}{{ return_url }}{% else %}{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}{% endif %}" />
13
+
14
+ <div class="card">
15
+ <div class="htmx-container table-responsive" id="object_list">
16
+ {% include 'htmx/table.html' %}
17
+ </div>
18
+ </div>
19
+
20
+ {% if perms.netbox_dns.change_zonetemplate or perms.netbox_dns.delete_zonetemplate %}
21
+ {% with bulk_edit_url="plugins:netbox_dns:zonetemplate_bulk_edit" bulk_delete_url="plugins:netbox_dns:zonetemplate_bulk_delete" %}
22
+ <div class="noprint bulk-buttons">
23
+ <div class="bulk-button-group">
24
+ {% block bulk_buttons %}{% endblock %}
25
+ {% if bulk_edit_url and perms.netbox_dns.change_zonetemplate %}
26
+ <button type="submit" name="_edit" formaction="{% url bulk_edit_url %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-warning">
27
+ <i class="mdi mdi-pencil" aria-hidden="true"></i> {% trans "Edit Selected" %}
28
+ </button>
29
+ {% endif %}
30
+ {% if bulk_delete_url and perms.netbox_dns.delete_zonetemplate %}
31
+ <button type="submit" name="_delete" formaction="{% url bulk_delete_url %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-danger">
32
+ <i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> {% trans "Delete Selected" %}
33
+ </button>
34
+ {% endif %}
35
+ </div>
36
+ </div>
37
+ {% endwith %}
38
+ {% endif %}
39
+ </form>
40
+
41
+ {% endblock %}
42
+
43
+ {% block modals %}
44
+ {{ block.super }}
45
+ {% table_config_form table %}
46
+ {% endblock modals %}
@@ -53,6 +53,18 @@
53
53
  </table>
54
54
  </div>
55
55
 
56
+ {% if object.dnssec_policy %}
57
+ <div class="card">
58
+ <h5 class="card-header">{% trans "DNSSEC" %}</h5>
59
+ <table class="table table-hover attr-table">
60
+ <tr>
61
+ <th scope="row">{% trans "Policy" %}</th>
62
+ <td>{{ object.dnssec_policy|linkify }}</td>
63
+ </tr>
64
+ </table>
65
+ </div>
66
+ {% endif %}
67
+
56
68
  {% include 'inc/panels/tags.html' %}
57
69
  {% include 'inc/panels/custom_fields.html' %}
58
70
  </div>
netbox_dns/urls.py CHANGED
@@ -2,6 +2,13 @@ from django.urls import include, path
2
2
 
3
3
  from utilities.urls import get_model_urls
4
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
10
+
11
+
5
12
  app_name = "netbox_dns"
6
13
 
7
14
  urlpatterns = (
@@ -69,4 +76,20 @@ urlpatterns = (
69
76
  "zones/<int:pk>/",
70
77
  include(get_model_urls("netbox_dns", "zone")),
71
78
  ),
79
+ path(
80
+ "dnsseckeytemplates/",
81
+ include(get_model_urls("netbox_dns", "dnsseckeytemplate", detail=False)),
82
+ ),
83
+ path(
84
+ "dnsseckeytemplates/<int:pk>/",
85
+ include(get_model_urls("netbox_dns", "dnsseckeytemplate")),
86
+ ),
87
+ path(
88
+ "dnssecpolicies/",
89
+ include(get_model_urls("netbox_dns", "dnssecpolicy", detail=False)),
90
+ ),
91
+ path(
92
+ "dnssecpolicies/<int:pk>/",
93
+ include(get_model_urls("netbox_dns", "dnssecpolicy")),
94
+ ),
72
95
  )
@@ -4,6 +4,8 @@ from dns import name as dns_name
4
4
  from dns.exception import DNSException
5
5
  from netaddr import IPNetwork, AddrFormatError
6
6
 
7
+ from django.utils.dateparse import parse_duration
8
+
7
9
  from netbox.plugins.utils import get_plugin_config
8
10
 
9
11
 
@@ -15,6 +17,7 @@ __all__ = (
15
17
  "normalize_name",
16
18
  "network_to_reverse",
17
19
  "regex_from_list",
20
+ "iso8601_to_int",
18
21
  )
19
22
 
20
23
 
@@ -111,3 +114,13 @@ def network_to_reverse(network):
111
114
 
112
115
  def regex_from_list(names):
113
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())
@@ -1,3 +1,4 @@
1
1
  from .dns_name import *
2
2
  from .dns_value import *
3
3
  from .rfc2317 import *
4
+ from .dnssec import *