mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-23 07:56:44 -06:00
Cleanup
This commit is contained in:
parent
c1ce3c9dc0
commit
ff1bbf670c
@ -14,77 +14,31 @@
|
|||||||
<th scope="row">{% trans "Name" %}</th>
|
<th scope="row">{% trans "Name" %}</th>
|
||||||
<td>{{ object.name }}</td>
|
<td>{{ object.name }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Protocol" %}</th>
|
|
||||||
<td>{{ object.get_protocol_display }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "IKE Version" %}</th>
|
|
||||||
<td>{{ object.get_ike_version_display }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans "Description" %}</th>
|
<th scope="row">{% trans "Description" %}</th>
|
||||||
<td>{{ object.description|placeholder }}</td>
|
<td>{{ object.description|placeholder }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans "Mode" %}</th>
|
||||||
|
<td>{{ object.get_mode_display }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans "IKE Policy" %}</th>
|
||||||
|
<td>{{ object.ike_policy|linkify }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans "IPSec Policy" %}</th>
|
||||||
|
<td>{{ object.ipsec_policy|linkify }}</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% include 'inc/panels/custom_fields.html' %}
|
|
||||||
{% include 'inc/panels/tags.html' %}
|
{% include 'inc/panels/tags.html' %}
|
||||||
{% include 'inc/panels/comments.html' %}
|
{% include 'inc/panels/comments.html' %}
|
||||||
{% plugin_left_page object %}
|
{% plugin_left_page object %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col col-md-6">
|
<div class="col col-md-6">
|
||||||
<div class="card">
|
{% include 'inc/panels/custom_fields.html' %}
|
||||||
<h5 class="card-header">{% trans "Phase 1 Parameters" %}</h5>
|
|
||||||
<div class="card-body">
|
|
||||||
<table class="table table-hover attr-table">
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Encryption" %}</th>
|
|
||||||
<td>{{ object.get_phase1_encryption_display }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Authentication" %}</th>
|
|
||||||
<td>{{ object.get_phase1_authentication_display }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "DH Group" %}</th>
|
|
||||||
<td>{{ object.get_phase1_group_display }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "SA Lifetime" %}</th>
|
|
||||||
<td>{{ object.phase1_sa_lifetime|placeholder }}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card">
|
|
||||||
<h5 class="card-header">{% trans "Phase 2 Parameters" %}</h5>
|
|
||||||
<div class="card-body">
|
|
||||||
<table class="table table-hover attr-table">
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Encryption" %}</th>
|
|
||||||
<td>{{ object.get_phase2_encryption_display }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "Authentication" %}</th>
|
|
||||||
<td>{{ object.get_phase2_authentication_display }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "DH Group" %}</th>
|
|
||||||
<td>{{ object.get_phase2_group_display }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "SA Lifetime (Seconds)" %}</th>
|
|
||||||
<td>{{ object.phase2_sa_lifetime|placeholder }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row">{% trans "SA Lifetime (KB)" %}</th>
|
|
||||||
<td>{{ object.phase2_sa_lifetime_data|placeholder }}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% plugin_right_page object %}
|
{% plugin_right_page object %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -50,7 +50,7 @@ class NestedIKEPolicySerializer(WritableNestedSerializer):
|
|||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.IKEProposal
|
model = models.IKEPolicy
|
||||||
fields = ('id', 'url', 'display', 'name')
|
fields = ('id', 'url', 'display', 'name')
|
||||||
|
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ class NestedIPSecPolicySerializer(WritableNestedSerializer):
|
|||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.IPSecProposal
|
model = models.IPSecPolicy
|
||||||
fields = ('id', 'url', 'display', 'name')
|
fields = ('id', 'url', 'display', 'name')
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,12 +118,6 @@ class IKEPolicySerializer(NetBoxModelSerializer):
|
|||||||
mode = ChoiceField(
|
mode = ChoiceField(
|
||||||
choices=IKEModeChoices
|
choices=IKEModeChoices
|
||||||
)
|
)
|
||||||
authentication_algorithm = ChoiceField(
|
|
||||||
choices=AuthenticationAlgorithmChoices
|
|
||||||
)
|
|
||||||
group = ChoiceField(
|
|
||||||
choices=DHGroupChoices
|
|
||||||
)
|
|
||||||
proposals = SerializedPKRelatedField(
|
proposals = SerializedPKRelatedField(
|
||||||
queryset=IKEProposal.objects.all(),
|
queryset=IKEProposal.objects.all(),
|
||||||
serializer=NestedIKEProposalSerializer,
|
serializer=NestedIKEProposalSerializer,
|
||||||
@ -149,9 +143,6 @@ class IPSecProposalSerializer(NetBoxModelSerializer):
|
|||||||
authentication_algorithm = ChoiceField(
|
authentication_algorithm = ChoiceField(
|
||||||
choices=AuthenticationAlgorithmChoices
|
choices=AuthenticationAlgorithmChoices
|
||||||
)
|
)
|
||||||
group = ChoiceField(
|
|
||||||
choices=DHGroupChoices
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = IPSecProposal
|
model = IPSecProposal
|
||||||
@ -187,36 +178,15 @@ class IPSecProfileSerializer(NetBoxModelSerializer):
|
|||||||
url = serializers.HyperlinkedIdentityField(
|
url = serializers.HyperlinkedIdentityField(
|
||||||
view_name='vpn-api:ipsecprofile-detail'
|
view_name='vpn-api:ipsecprofile-detail'
|
||||||
)
|
)
|
||||||
protocol = ChoiceField(
|
mode = ChoiceField(
|
||||||
choices=IPSecModeChoices
|
choices=IPSecModeChoices
|
||||||
)
|
)
|
||||||
ike_version = ChoiceField(
|
ike_policy = NestedIKEPolicySerializer()
|
||||||
choices=IKEVersionChoices
|
ipsec_policy = NestedIPSecPolicySerializer()
|
||||||
)
|
|
||||||
phase1_encryption = ChoiceField(
|
|
||||||
choices=EncryptionAlgorithmChoices
|
|
||||||
)
|
|
||||||
phase1_authentication = ChoiceField(
|
|
||||||
choices=AuthenticationAlgorithmChoices
|
|
||||||
)
|
|
||||||
phase1_group = ChoiceField(
|
|
||||||
choices=DHGroupChoices
|
|
||||||
)
|
|
||||||
phase2_encryption = ChoiceField(
|
|
||||||
choices=EncryptionAlgorithmChoices
|
|
||||||
)
|
|
||||||
phase2_authentication = ChoiceField(
|
|
||||||
choices=AuthenticationAlgorithmChoices
|
|
||||||
)
|
|
||||||
phase2_group = ChoiceField(
|
|
||||||
choices=DHGroupChoices
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = IPSecProfile
|
model = IPSecProfile
|
||||||
fields = (
|
fields = (
|
||||||
'id', 'url', 'display', 'name', 'protocol', 'ike_version', 'phase1_encryption', 'phase1_authentication',
|
'id', 'url', 'display', 'name', 'description', 'mode', 'ike_policy', 'ipsec_policy', 'comments', 'tags',
|
||||||
'phase1_group', 'phase1_sa_lifetime', 'phase2_encryption', 'phase2_authentication', 'phase2_group',
|
'custom_fields', 'created', 'last_updated',
|
||||||
'phase2_sa_lifetime', 'phase2_sa_lifetime_data', 'comments', 'tags', 'custom_fields', 'created',
|
|
||||||
'last_updated',
|
|
||||||
)
|
)
|
||||||
|
@ -63,7 +63,7 @@ class IPSecProposalViewSet(NetBoxModelViewSet):
|
|||||||
|
|
||||||
|
|
||||||
class IPSecPolicyViewSet(NetBoxModelViewSet):
|
class IPSecPolicyViewSet(NetBoxModelViewSet):
|
||||||
queryset = IKEPolicy.objects.all()
|
queryset = IPSecPolicy.objects.all()
|
||||||
serializer_class = serializers.IPSecPolicySerializer
|
serializer_class = serializers.IPSecPolicySerializer
|
||||||
filterset_class = filtersets.IPSecPolicyFilterSet
|
filterset_class = filtersets.IPSecPolicyFilterSet
|
||||||
|
|
||||||
|
@ -97,18 +97,25 @@ class IKEProposalBulkEditForm(NetBoxModelBulkEditForm):
|
|||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
sa_lifetime = forms.IntegerField(
|
sa_lifetime = forms.IntegerField(
|
||||||
|
label=_('SA lifetime'),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
description = forms.CharField(
|
||||||
|
label=_('Description'),
|
||||||
|
max_length=200,
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
comments = CommentField()
|
||||||
|
|
||||||
model = IKEProposal
|
model = IKEProposal
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(None, ('name', 'description')),
|
(None, (
|
||||||
(_('Parameters'), (
|
|
||||||
'authentication_method', 'encryption_algorithm', 'authentication_algorithm', 'group', 'sa_lifetime',
|
'authentication_method', 'encryption_algorithm', 'authentication_algorithm', 'group', 'sa_lifetime',
|
||||||
|
'description',
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
nullable_fields = (
|
nullable_fields = (
|
||||||
'description', 'sa_lifetime', 'comments',
|
'sa_lifetime', 'description', 'comments',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -131,16 +138,21 @@ class IKEPolicyBulkEditForm(NetBoxModelBulkEditForm):
|
|||||||
label=_('Certificate'),
|
label=_('Certificate'),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
description = forms.CharField(
|
||||||
|
label=_('Description'),
|
||||||
|
max_length=200,
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
comments = CommentField()
|
||||||
|
|
||||||
model = IKEPolicy
|
model = IKEPolicy
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(None, ('name', 'description')),
|
(None, (
|
||||||
(_('Parameters'), (
|
'version', 'mode', 'preshared_key', 'certificate', 'description',
|
||||||
'version', 'mode', 'preshared_key', 'certificate',
|
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
nullable_fields = (
|
nullable_fields = (
|
||||||
'description', 'preshared_key', 'certificate', 'comments',
|
'preshared_key', 'certificate', 'description', 'comments',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -156,21 +168,29 @@ class IPSecProposalBulkEditForm(NetBoxModelBulkEditForm):
|
|||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
sa_lifetime_seconds = forms.IntegerField(
|
sa_lifetime_seconds = forms.IntegerField(
|
||||||
|
label=_('SA lifetime (seconds)'),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
sa_lifetime_data = forms.IntegerField(
|
sa_lifetime_data = forms.IntegerField(
|
||||||
|
label=_('SA lifetime (KB)'),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
description = forms.CharField(
|
||||||
|
label=_('Description'),
|
||||||
|
max_length=200,
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
comments = CommentField()
|
||||||
|
|
||||||
model = IPSecProposal
|
model = IPSecProposal
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(None, ('name', 'description')),
|
(None, (
|
||||||
(_('Parameters'), (
|
|
||||||
'encryption_algorithm', 'authentication_algorithm', 'sa_lifetime_seconds', 'sa_lifetime_data',
|
'encryption_algorithm', 'authentication_algorithm', 'sa_lifetime_seconds', 'sa_lifetime_data',
|
||||||
|
'description',
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
nullable_fields = (
|
nullable_fields = (
|
||||||
'description', 'sa_lifetime_seconds', 'sa_lifetime_data', 'comments',
|
'sa_lifetime_seconds', 'sa_lifetime_data', 'description', 'comments',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -180,20 +200,38 @@ class IPSecPolicyBulkEditForm(NetBoxModelBulkEditForm):
|
|||||||
choices=add_blank_choice(DHGroupChoices),
|
choices=add_blank_choice(DHGroupChoices),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
description = forms.CharField(
|
||||||
|
label=_('Description'),
|
||||||
|
max_length=200,
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
comments = CommentField()
|
||||||
|
|
||||||
model = IPSecPolicy
|
model = IPSecPolicy
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(None, ('name', 'description')),
|
(None, ('pfs_group', 'description',)),
|
||||||
(_('Parameters'), (
|
|
||||||
'pfs_group',
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
nullable_fields = (
|
nullable_fields = (
|
||||||
'description', 'pfs_group', 'comments',
|
'pfs_group', 'description', 'comments',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class IPSecProfileBulkEditForm(NetBoxModelBulkEditForm):
|
class IPSecProfileBulkEditForm(NetBoxModelBulkEditForm):
|
||||||
|
mode = forms.ChoiceField(
|
||||||
|
label=_('Mode'),
|
||||||
|
choices=add_blank_choice(IPSecModeChoices),
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
ike_policy = DynamicModelChoiceField(
|
||||||
|
label=_('IKE policy'),
|
||||||
|
queryset=IKEPolicy.objects.all(),
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
ipsec_policy = DynamicModelChoiceField(
|
||||||
|
label=_('IPSec policy'),
|
||||||
|
queryset=IPSecPolicy.objects.all(),
|
||||||
|
required=False
|
||||||
|
)
|
||||||
description = forms.CharField(
|
description = forms.CharField(
|
||||||
label=_('Description'),
|
label=_('Description'),
|
||||||
max_length=200,
|
max_length=200,
|
||||||
@ -204,7 +242,7 @@ class IPSecProfileBulkEditForm(NetBoxModelBulkEditForm):
|
|||||||
model = IPSecProfile
|
model = IPSecProfile
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('Profile'), (
|
(_('Profile'), (
|
||||||
'protocol', 'ike_version', 'description',
|
'mode', 'ike_policy', 'ipsec_policy', 'description',
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
nullable_fields = (
|
nullable_fields = (
|
||||||
|
@ -157,10 +157,6 @@ class IKEPolicyImportForm(NetBoxModelImportForm):
|
|||||||
|
|
||||||
|
|
||||||
class IPSecProposalImportForm(NetBoxModelImportForm):
|
class IPSecProposalImportForm(NetBoxModelImportForm):
|
||||||
authentication_method = CSVChoiceField(
|
|
||||||
label=_('Authentication method'),
|
|
||||||
choices=AuthenticationMethodChoices
|
|
||||||
)
|
|
||||||
encryption_algorithm = CSVChoiceField(
|
encryption_algorithm = CSVChoiceField(
|
||||||
label=_('Encryption algorithm'),
|
label=_('Encryption algorithm'),
|
||||||
choices=EncryptionAlgorithmChoices
|
choices=EncryptionAlgorithmChoices
|
||||||
@ -169,10 +165,6 @@ class IPSecProposalImportForm(NetBoxModelImportForm):
|
|||||||
label=_('Authentication algorithm'),
|
label=_('Authentication algorithm'),
|
||||||
choices=AuthenticationAlgorithmChoices
|
choices=AuthenticationAlgorithmChoices
|
||||||
)
|
)
|
||||||
group = CSVChoiceField(
|
|
||||||
label=_('Group'),
|
|
||||||
choices=DHGroupChoices
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = IPSecProposal
|
model = IPSecProposal
|
||||||
@ -216,5 +208,5 @@ class IPSecProfileImportForm(NetBoxModelImportForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = IPSecProfile
|
model = IPSecProfile
|
||||||
fields = (
|
fields = (
|
||||||
'name', 'ike_policy', 'ipsec_policy', 'description', 'comments', 'tags',
|
'name', 'mode', 'ike_policy', 'ipsec_policy', 'description', 'comments', 'tags',
|
||||||
)
|
)
|
||||||
|
@ -143,7 +143,7 @@ class IPSecPolicyFilterForm(NetBoxModelFilterSetForm):
|
|||||||
model = IPSecPolicy
|
model = IPSecPolicy
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(None, ('q', 'filter_id', 'tag')),
|
(None, ('q', 'filter_id', 'tag')),
|
||||||
(_('Parameters'), ('proposal', 'pfs_group')),
|
(_('Parameters'), ('proposal_id', 'pfs_group')),
|
||||||
)
|
)
|
||||||
proposal_id = DynamicModelMultipleChoiceField(
|
proposal_id = DynamicModelMultipleChoiceField(
|
||||||
queryset=IKEProposal.objects.all(),
|
queryset=IKEProposal.objects.all(),
|
||||||
@ -162,14 +162,7 @@ class IPSecProfileFilterForm(NetBoxModelFilterSetForm):
|
|||||||
model = IPSecProfile
|
model = IPSecProfile
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(None, ('q', 'filter_id', 'tag')),
|
(None, ('q', 'filter_id', 'tag')),
|
||||||
(_('Profile'), ('protocol', 'ike_version')),
|
(_('Profile'), ('mode', 'ike_policy_id', 'ipsec_policy_id')),
|
||||||
(_('Phase 1 Parameters'), (
|
|
||||||
'phase1_encryption', 'phase1_authentication', 'phase1_group', 'phase1_sa_lifetime',
|
|
||||||
)),
|
|
||||||
(_('Phase 2 Parameters'), (
|
|
||||||
'phase2_encryption', 'phase2_authentication', 'phase2_group', 'phase2_sa_lifetime',
|
|
||||||
'phase2_sa_lifetime_data',
|
|
||||||
)),
|
|
||||||
)
|
)
|
||||||
mode = forms.MultipleChoiceField(
|
mode = forms.MultipleChoiceField(
|
||||||
label=_('Mode'),
|
label=_('Mode'),
|
||||||
|
@ -287,7 +287,8 @@ class IKEProposalForm(NetBoxModelForm):
|
|||||||
|
|
||||||
class IKEPolicyForm(NetBoxModelForm):
|
class IKEPolicyForm(NetBoxModelForm):
|
||||||
proposals = DynamicModelMultipleChoiceField(
|
proposals = DynamicModelMultipleChoiceField(
|
||||||
queryset=IKEProposal.objects.all()
|
queryset=IKEProposal.objects.all(),
|
||||||
|
label=_('Proposals')
|
||||||
)
|
)
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
@ -322,7 +323,8 @@ class IPSecProposalForm(NetBoxModelForm):
|
|||||||
|
|
||||||
class IPSecPolicyForm(NetBoxModelForm):
|
class IPSecPolicyForm(NetBoxModelForm):
|
||||||
proposals = DynamicModelMultipleChoiceField(
|
proposals = DynamicModelMultipleChoiceField(
|
||||||
queryset=IPSecProposal.objects.all()
|
queryset=IPSecProposal.objects.all(),
|
||||||
|
label=_('Proposals')
|
||||||
)
|
)
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
@ -338,17 +340,23 @@ class IPSecPolicyForm(NetBoxModelForm):
|
|||||||
|
|
||||||
|
|
||||||
class IPSecProfileForm(NetBoxModelForm):
|
class IPSecProfileForm(NetBoxModelForm):
|
||||||
|
ike_policy = DynamicModelChoiceField(
|
||||||
|
queryset=IKEPolicy.objects.all(),
|
||||||
|
label=_('IKE policy')
|
||||||
|
)
|
||||||
|
ipsec_policy = DynamicModelChoiceField(
|
||||||
|
queryset=IPSecPolicy.objects.all(),
|
||||||
|
label=_('IPSec policy')
|
||||||
|
)
|
||||||
comments = CommentField()
|
comments = CommentField()
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('Profile'), (
|
(_('Profile'), ('name', 'description', 'tags')),
|
||||||
'name', 'mode', 'description', 'tags',
|
(_('Parameters'), ('mode', 'ike_policy', 'ipsec_policy')),
|
||||||
)),
|
|
||||||
(_('Policies'), ('ipsec_policy', 'description', 'tags')),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = IPSecProfile
|
model = IPSecProfile
|
||||||
fields = [
|
fields = [
|
||||||
'name', 'description', 'mode', 'ipsec_policy', 'description', 'comments', 'tags',
|
'name', 'description', 'mode', 'ike_policy', 'ipsec_policy', 'description', 'comments', 'tags',
|
||||||
]
|
]
|
||||||
|
@ -7,12 +7,37 @@ from .types import *
|
|||||||
|
|
||||||
|
|
||||||
class VPNQuery(graphene.ObjectType):
|
class VPNQuery(graphene.ObjectType):
|
||||||
|
|
||||||
|
ike_policy = ObjectField(IKEPolicyType)
|
||||||
|
ike_policy_list = ObjectListField(IKEPolicyType)
|
||||||
|
|
||||||
|
def resolve_ike_policy_list(root, info, **kwargs):
|
||||||
|
return gql_query_optimizer(models.IKEPolicy.objects.all(), info)
|
||||||
|
|
||||||
|
ike_proposal = ObjectField(IKEProposalType)
|
||||||
|
ike_proposal_list = ObjectListField(IKEProposalType)
|
||||||
|
|
||||||
|
def resolve_ike_proposal_list(root, info, **kwargs):
|
||||||
|
return gql_query_optimizer(models.IKEProposal.objects.all(), info)
|
||||||
|
|
||||||
|
ipsec_policy = ObjectField(IPSecPolicyType)
|
||||||
|
ipsec_policy_list = ObjectListField(IPSecPolicyType)
|
||||||
|
|
||||||
|
def resolve_ipsec_policy_list(root, info, **kwargs):
|
||||||
|
return gql_query_optimizer(models.IPSecPolicy.objects.all(), info)
|
||||||
|
|
||||||
ipsec_profile = ObjectField(IPSecProfileType)
|
ipsec_profile = ObjectField(IPSecProfileType)
|
||||||
ipsec_profile_list = ObjectListField(IPSecProfileType)
|
ipsec_profile_list = ObjectListField(IPSecProfileType)
|
||||||
|
|
||||||
def resolve_ipsec_profile_list(root, info, **kwargs):
|
def resolve_ipsec_profile_list(root, info, **kwargs):
|
||||||
return gql_query_optimizer(models.IPSecProfile.objects.all(), info)
|
return gql_query_optimizer(models.IPSecProfile.objects.all(), info)
|
||||||
|
|
||||||
|
ipsec_proposal = ObjectField(IPSecProposalType)
|
||||||
|
ipsec_proposal_list = ObjectListField(IPSecProposalType)
|
||||||
|
|
||||||
|
def resolve_ipsec_proposal_list(root, info, **kwargs):
|
||||||
|
return gql_query_optimizer(models.IPSecProposal.objects.all(), info)
|
||||||
|
|
||||||
tunnel = ObjectField(TunnelType)
|
tunnel = ObjectField(TunnelType)
|
||||||
tunnel_list = ObjectListField(TunnelType)
|
tunnel_list = ObjectListField(TunnelType)
|
||||||
|
|
||||||
|
@ -3,7 +3,11 @@ from netbox.graphql.types import ObjectType, OrganizationalObjectType, NetBoxObj
|
|||||||
from vpn import filtersets, models
|
from vpn import filtersets, models
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
|
'IKEPolicyType',
|
||||||
|
'IKEProposalType',
|
||||||
|
'IPSecPolicyType',
|
||||||
'IPSecProfileType',
|
'IPSecProfileType',
|
||||||
|
'IPSecProposalType',
|
||||||
'TunnelTerminationType',
|
'TunnelTerminationType',
|
||||||
'TunnelType',
|
'TunnelType',
|
||||||
)
|
)
|
||||||
@ -25,6 +29,38 @@ class TunnelType(NetBoxObjectType):
|
|||||||
filterset_class = filtersets.TunnelFilterSet
|
filterset_class = filtersets.TunnelFilterSet
|
||||||
|
|
||||||
|
|
||||||
|
class IKEProposalType(OrganizationalObjectType):
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = models.IKEProposal
|
||||||
|
fields = '__all__'
|
||||||
|
filterset_class = filtersets.IKEProposalFilterSet
|
||||||
|
|
||||||
|
|
||||||
|
class IKEPolicyType(OrganizationalObjectType):
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = models.IKEPolicy
|
||||||
|
fields = '__all__'
|
||||||
|
filterset_class = filtersets.IKEPolicyFilterSet
|
||||||
|
|
||||||
|
|
||||||
|
class IPSecProposalType(OrganizationalObjectType):
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = models.IPSecProposal
|
||||||
|
fields = '__all__'
|
||||||
|
filterset_class = filtersets.IPSecProposalFilterSet
|
||||||
|
|
||||||
|
|
||||||
|
class IPSecPolicyType(OrganizationalObjectType):
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = models.IPSecPolicy
|
||||||
|
fields = '__all__'
|
||||||
|
filterset_class = filtersets.IPSecPolicyFilterSet
|
||||||
|
|
||||||
|
|
||||||
class IPSecProfileType(OrganizationalObjectType):
|
class IPSecProfileType(OrganizationalObjectType):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -53,6 +53,10 @@ class IKEProposal(NetBoxModel):
|
|||||||
help_text=_('Security association lifetime (in seconds)')
|
help_text=_('Security association lifetime (in seconds)')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
clone_fields = (
|
||||||
|
'authentication_method', 'encryption_algorithm', 'authentication_algorithm', 'group', 'sa_lifetime',
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('name',)
|
ordering = ('name',)
|
||||||
verbose_name = _('IKE proposal')
|
verbose_name = _('IKE proposal')
|
||||||
@ -99,6 +103,13 @@ class IKEPolicy(NetBoxModel):
|
|||||||
blank=True
|
blank=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
clone_fields = (
|
||||||
|
'version', 'mode', 'proposals',
|
||||||
|
)
|
||||||
|
prerequisite_models = (
|
||||||
|
'vpn.IKEProposal',
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('name',)
|
ordering = ('name',)
|
||||||
verbose_name = _('IKE policy')
|
verbose_name = _('IKE policy')
|
||||||
@ -108,7 +119,7 @@ class IKEPolicy(NetBoxModel):
|
|||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse('vpn:ikeprofile', args=[self.pk])
|
return reverse('vpn:ikepolicy', args=[self.pk])
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -147,6 +158,10 @@ class IPSecProposal(NetBoxModel):
|
|||||||
help_text=_('Security association lifetime (in kilobytes)')
|
help_text=_('Security association lifetime (in kilobytes)')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
clone_fields = (
|
||||||
|
'encryption_algorithm', 'authentication_algorithm', 'sa_lifetime_seconds', 'sa_lifetime_data',
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('name',)
|
ordering = ('name',)
|
||||||
verbose_name = _('IPSec proposal')
|
verbose_name = _('IPSec proposal')
|
||||||
@ -183,6 +198,13 @@ class IPSecPolicy(NetBoxModel):
|
|||||||
help_text=_('Diffie-Hellman group for Perfect Forward Secrecy')
|
help_text=_('Diffie-Hellman group for Perfect Forward Secrecy')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
clone_fields = (
|
||||||
|
'proposals', 'pfs_group',
|
||||||
|
)
|
||||||
|
prerequisite_models = (
|
||||||
|
'vpn.IPSecProposal',
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('name',)
|
ordering = ('name',)
|
||||||
verbose_name = _('IPSec policy')
|
verbose_name = _('IPSec policy')
|
||||||
@ -219,6 +241,10 @@ class IPSecProfile(PrimaryModel):
|
|||||||
clone_fields = (
|
clone_fields = (
|
||||||
'mode', 'ike_policy', 'ipsec_policy',
|
'mode', 'ike_policy', 'ipsec_policy',
|
||||||
)
|
)
|
||||||
|
prerequisite_models = (
|
||||||
|
'vpn.IKEPolicy',
|
||||||
|
'vpn.IPSecPolicy',
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('name',)
|
ordering = ('name',)
|
||||||
|
@ -97,16 +97,16 @@ class IKEProposalTable(NetBoxTable):
|
|||||||
verbose_name=_('Name'),
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
authentication_method = columns.ChoiceFieldColumn(
|
authentication_method = tables.Column(
|
||||||
verbose_name=_('Authentication Method')
|
verbose_name=_('Authentication Method')
|
||||||
)
|
)
|
||||||
encryption_algorithm = columns.ChoiceFieldColumn(
|
encryption_algorithm = tables.Column(
|
||||||
verbose_name=_('Encryption Algorithm')
|
verbose_name=_('Encryption Algorithm')
|
||||||
)
|
)
|
||||||
authentication_algorithm = columns.ChoiceFieldColumn(
|
authentication_algorithm = tables.Column(
|
||||||
verbose_name=_('Authentication Algorithm')
|
verbose_name=_('Authentication Algorithm')
|
||||||
)
|
)
|
||||||
group = columns.ChoiceFieldColumn(
|
group = tables.Column(
|
||||||
verbose_name=_('Group')
|
verbose_name=_('Group')
|
||||||
)
|
)
|
||||||
sa_lifetime = tables.Column(
|
sa_lifetime = tables.Column(
|
||||||
@ -133,10 +133,10 @@ class IKEPolicyTable(NetBoxTable):
|
|||||||
verbose_name=_('Name'),
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
version = columns.ChoiceFieldColumn(
|
version = tables.Column(
|
||||||
verbose_name=_('Version')
|
verbose_name=_('Version')
|
||||||
)
|
)
|
||||||
mode = columns.ChoiceFieldColumn(
|
mode = tables.Column(
|
||||||
verbose_name=_('Mode')
|
verbose_name=_('Mode')
|
||||||
)
|
)
|
||||||
proposals = tables.ManyToManyColumn(
|
proposals = tables.ManyToManyColumn(
|
||||||
@ -169,10 +169,10 @@ class IPSecProposalTable(NetBoxTable):
|
|||||||
verbose_name=_('Name'),
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
encryption_algorithm = columns.ChoiceFieldColumn(
|
encryption_algorithm = tables.Column(
|
||||||
verbose_name=_('Encryption Algorithm')
|
verbose_name=_('Encryption Algorithm')
|
||||||
)
|
)
|
||||||
authentication_algorithm = columns.ChoiceFieldColumn(
|
authentication_algorithm = tables.Column(
|
||||||
verbose_name=_('Authentication Algorithm')
|
verbose_name=_('Authentication Algorithm')
|
||||||
)
|
)
|
||||||
sa_lifetime_seconds = tables.Column(
|
sa_lifetime_seconds = tables.Column(
|
||||||
@ -206,7 +206,7 @@ class IPSecPolicyTable(NetBoxTable):
|
|||||||
linkify_item=True,
|
linkify_item=True,
|
||||||
verbose_name=_('Proposals')
|
verbose_name=_('Proposals')
|
||||||
)
|
)
|
||||||
pfs_group = columns.ChoiceFieldColumn(
|
pfs_group = tables.Column(
|
||||||
verbose_name=_('PFS Group')
|
verbose_name=_('PFS Group')
|
||||||
)
|
)
|
||||||
tags = columns.TagColumn(
|
tags = columns.TagColumn(
|
||||||
@ -228,7 +228,7 @@ class IPSecProfileTable(NetBoxTable):
|
|||||||
verbose_name=_('Name'),
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
mode = columns.ChoiceFieldColumn(
|
mode = tables.Column(
|
||||||
verbose_name=_('Mode')
|
verbose_name=_('Mode')
|
||||||
)
|
)
|
||||||
ike_policy = tables.Column(
|
ike_policy = tables.Column(
|
||||||
|
Loading…
Reference in New Issue
Block a user