Coverage for vpn/tables/crypto.py: 100%
58 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 18:35 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 18:35 +0000
1import django_tables2 as tables
2from django.utils.translation import gettext_lazy as _
4from netbox.tables import PrimaryModelTable, columns
5from vpn.models import *
7__all__ = (
8 'IKEPolicyTable',
9 'IKEProposalTable',
10 'IPSecPolicyTable',
11 'IPSecProfileTable',
12 'IPSecProposalTable',
13)
16class IKEProposalTable(PrimaryModelTable):
17 name = tables.Column(
18 verbose_name=_('Name'),
19 linkify=True
20 )
21 authentication_method = tables.Column(
22 verbose_name=_('Authentication Method')
23 )
24 encryption_algorithm = tables.Column(
25 verbose_name=_('Encryption Algorithm')
26 )
27 authentication_algorithm = tables.Column(
28 verbose_name=_('Authentication Algorithm')
29 )
30 group = tables.Column(
31 verbose_name=_('Group')
32 )
33 sa_lifetime = tables.Column(
34 verbose_name=_('SA Lifetime')
35 )
36 tags = columns.TagColumn(
37 url_name='vpn:ikeproposal_list'
38 )
40 class Meta(PrimaryModelTable.Meta):
41 model = IKEProposal
42 fields = (
43 'pk', 'id', 'name', 'authentication_method', 'encryption_algorithm', 'authentication_algorithm',
44 'group', 'sa_lifetime', 'description', 'comments', 'tags', 'created', 'last_updated',
45 )
46 default_columns = (
47 'pk', 'name', 'authentication_method', 'encryption_algorithm', 'authentication_algorithm', 'group',
48 'sa_lifetime', 'description',
49 )
52class IKEPolicyTable(PrimaryModelTable):
53 name = tables.Column(
54 verbose_name=_('Name'),
55 linkify=True
56 )
57 version = tables.Column(
58 verbose_name=_('Version')
59 )
60 mode = tables.Column(
61 verbose_name=_('Mode')
62 )
63 proposals = columns.ManyToManyColumn(
64 linkify_item=True,
65 verbose_name=_('Proposals')
66 )
67 preshared_key = tables.Column(
68 verbose_name=_('Pre-shared Key')
69 )
70 tags = columns.TagColumn(
71 url_name='vpn:ikepolicy_list'
72 )
74 class Meta(PrimaryModelTable.Meta):
75 model = IKEPolicy
76 fields = (
77 'pk', 'id', 'name', 'version', 'mode', 'proposals', 'preshared_key', 'description', 'comments', 'tags',
78 'created', 'last_updated',
79 )
80 default_columns = (
81 'pk', 'name', 'version', 'mode', 'proposals', 'description',
82 )
85class IPSecProposalTable(PrimaryModelTable):
86 name = tables.Column(
87 verbose_name=_('Name'),
88 linkify=True
89 )
90 encryption_algorithm = tables.Column(
91 verbose_name=_('Encryption Algorithm')
92 )
93 authentication_algorithm = tables.Column(
94 verbose_name=_('Authentication Algorithm')
95 )
96 sa_lifetime_seconds = tables.Column(
97 verbose_name=_('SA Lifetime (Seconds)')
98 )
99 sa_lifetime_data = tables.Column(
100 verbose_name=_('SA Lifetime (KB)')
101 )
102 tags = columns.TagColumn(
103 url_name='vpn:ipsecproposal_list'
104 )
106 class Meta(PrimaryModelTable.Meta):
107 model = IPSecProposal
108 fields = (
109 'pk', 'id', 'name', 'encryption_algorithm', 'authentication_algorithm', 'sa_lifetime_seconds',
110 'sa_lifetime_data', 'description', 'comments', 'tags', 'created', 'last_updated',
111 )
112 default_columns = (
113 'pk', 'name', 'encryption_algorithm', 'authentication_algorithm', 'sa_lifetime_seconds',
114 'sa_lifetime_data', 'description',
115 )
118class IPSecPolicyTable(PrimaryModelTable):
119 name = tables.Column(
120 verbose_name=_('Name'),
121 linkify=True
122 )
123 proposals = columns.ManyToManyColumn(
124 linkify_item=True,
125 verbose_name=_('Proposals')
126 )
127 pfs_group = tables.Column(
128 verbose_name=_('PFS Group')
129 )
130 tags = columns.TagColumn(
131 url_name='vpn:ipsecpolicy_list'
132 )
134 class Meta(PrimaryModelTable.Meta):
135 model = IPSecPolicy
136 fields = (
137 'pk', 'id', 'name', 'proposals', 'pfs_group', 'description', 'comments', 'tags', 'created', 'last_updated',
138 )
139 default_columns = (
140 'pk', 'name', 'proposals', 'pfs_group', 'description',
141 )
144class IPSecProfileTable(PrimaryModelTable):
145 name = tables.Column(
146 verbose_name=_('Name'),
147 linkify=True
148 )
149 mode = tables.Column(
150 verbose_name=_('Mode')
151 )
152 ike_policy = tables.Column(
153 linkify=True,
154 verbose_name=_('IKE Policy')
155 )
156 ipsec_policy = tables.Column(
157 linkify=True,
158 verbose_name=_('IPSec Policy')
159 )
160 tags = columns.TagColumn(
161 url_name='vpn:ipsecprofile_list'
162 )
164 class Meta(PrimaryModelTable.Meta):
165 model = IPSecProfile
166 fields = (
167 'pk', 'id', 'name', 'mode', 'ike_policy', 'ipsec_policy', 'description', 'comments', 'tags', 'created',
168 'last_updated',
169 )
170 default_columns = ('pk', 'name', 'mode', 'ike_policy', 'ipsec_policy', 'description')