mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-22 03:28:45 -06:00
Closes #20304: Object owners (#20634)
Some checks failed
CI / build (20.x, 3.12) (push) Has been cancelled
CI / build (20.x, 3.13) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Has been cancelled
Some checks failed
CI / build (20.x, 3.12) (push) Has been cancelled
CI / build (20.x, 3.13) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Has been cancelled
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from netbox.api.fields import ChoiceField, SerializedPKRelatedField
|
||||
from netbox.api.serializers import NetBoxModelSerializer
|
||||
from netbox.api.serializers import PrimaryModelSerializer
|
||||
from vpn.choices import *
|
||||
from vpn.models import IKEPolicy, IKEProposal, IPSecPolicy, IPSecProfile, IPSecProposal
|
||||
|
||||
@@ -12,7 +12,7 @@ __all__ = (
|
||||
)
|
||||
|
||||
|
||||
class IKEProposalSerializer(NetBoxModelSerializer):
|
||||
class IKEProposalSerializer(PrimaryModelSerializer):
|
||||
authentication_method = ChoiceField(
|
||||
choices=AuthenticationMethodChoices
|
||||
)
|
||||
@@ -31,13 +31,13 @@ class IKEProposalSerializer(NetBoxModelSerializer):
|
||||
model = IKEProposal
|
||||
fields = (
|
||||
'id', 'url', 'display_url', 'display', 'name', 'description', 'authentication_method',
|
||||
'encryption_algorithm', 'authentication_algorithm', 'group', 'sa_lifetime', 'comments', 'tags',
|
||||
'encryption_algorithm', 'authentication_algorithm', 'group', 'sa_lifetime', 'owner', 'comments', 'tags',
|
||||
'custom_fields', 'created', 'last_updated',
|
||||
)
|
||||
brief_fields = ('id', 'url', 'display', 'name', 'description')
|
||||
|
||||
|
||||
class IKEPolicySerializer(NetBoxModelSerializer):
|
||||
class IKEPolicySerializer(PrimaryModelSerializer):
|
||||
version = ChoiceField(
|
||||
choices=IKEVersionChoices
|
||||
)
|
||||
@@ -57,12 +57,12 @@ class IKEPolicySerializer(NetBoxModelSerializer):
|
||||
model = IKEPolicy
|
||||
fields = (
|
||||
'id', 'url', 'display_url', 'display', 'name', 'description', 'version', 'mode', 'proposals',
|
||||
'preshared_key', 'comments', 'tags', 'custom_fields', 'created', 'last_updated',
|
||||
'preshared_key', 'owner', 'comments', 'tags', 'custom_fields', 'created', 'last_updated',
|
||||
)
|
||||
brief_fields = ('id', 'url', 'display', 'name', 'description')
|
||||
|
||||
|
||||
class IPSecProposalSerializer(NetBoxModelSerializer):
|
||||
class IPSecProposalSerializer(PrimaryModelSerializer):
|
||||
encryption_algorithm = ChoiceField(
|
||||
choices=EncryptionAlgorithmChoices,
|
||||
required=False
|
||||
@@ -76,13 +76,13 @@ class IPSecProposalSerializer(NetBoxModelSerializer):
|
||||
model = IPSecProposal
|
||||
fields = (
|
||||
'id', 'url', 'display_url', 'display', 'name', 'description', 'encryption_algorithm',
|
||||
'authentication_algorithm', 'sa_lifetime_seconds', 'sa_lifetime_data', 'comments', 'tags', 'custom_fields',
|
||||
'created', 'last_updated',
|
||||
'authentication_algorithm', 'sa_lifetime_seconds', 'sa_lifetime_data', 'owner', 'comments', 'tags',
|
||||
'custom_fields', 'created', 'last_updated',
|
||||
)
|
||||
brief_fields = ('id', 'url', 'display', 'name', 'description')
|
||||
|
||||
|
||||
class IPSecPolicySerializer(NetBoxModelSerializer):
|
||||
class IPSecPolicySerializer(PrimaryModelSerializer):
|
||||
proposals = SerializedPKRelatedField(
|
||||
queryset=IPSecProposal.objects.all(),
|
||||
serializer=IPSecProposalSerializer,
|
||||
@@ -98,13 +98,13 @@ class IPSecPolicySerializer(NetBoxModelSerializer):
|
||||
class Meta:
|
||||
model = IPSecPolicy
|
||||
fields = (
|
||||
'id', 'url', 'display_url', 'display', 'name', 'description', 'proposals', 'pfs_group', 'comments', 'tags',
|
||||
'custom_fields', 'created', 'last_updated',
|
||||
'id', 'url', 'display_url', 'display', 'name', 'description', 'proposals', 'pfs_group', 'owner', 'comments',
|
||||
'tags', 'custom_fields', 'created', 'last_updated',
|
||||
)
|
||||
brief_fields = ('id', 'url', 'display', 'name', 'description')
|
||||
|
||||
|
||||
class IPSecProfileSerializer(NetBoxModelSerializer):
|
||||
class IPSecProfileSerializer(PrimaryModelSerializer):
|
||||
mode = ChoiceField(
|
||||
choices=IPSecModeChoices
|
||||
)
|
||||
@@ -118,7 +118,7 @@ class IPSecProfileSerializer(NetBoxModelSerializer):
|
||||
class Meta:
|
||||
model = IPSecProfile
|
||||
fields = (
|
||||
'id', 'url', 'display_url', 'display', 'name', 'description', 'mode', 'ike_policy', 'ipsec_policy',
|
||||
'id', 'url', 'display_url', 'display', 'name', 'description', 'mode', 'ike_policy', 'ipsec_policy', 'owner',
|
||||
'comments', 'tags', 'custom_fields', 'created', 'last_updated',
|
||||
)
|
||||
brief_fields = ('id', 'url', 'display', 'name', 'description')
|
||||
|
||||
@@ -5,7 +5,7 @@ from rest_framework import serializers
|
||||
from ipam.api.serializers_.vrfs import RouteTargetSerializer
|
||||
from ipam.models import RouteTarget
|
||||
from netbox.api.fields import ChoiceField, ContentTypeField, SerializedPKRelatedField
|
||||
from netbox.api.serializers import NetBoxModelSerializer
|
||||
from netbox.api.serializers import NetBoxModelSerializer, PrimaryModelSerializer
|
||||
from tenancy.api.serializers_.tenants import TenantSerializer
|
||||
from utilities.api import get_serializer_for_model
|
||||
from vpn.choices import *
|
||||
@@ -17,7 +17,7 @@ __all__ = (
|
||||
)
|
||||
|
||||
|
||||
class L2VPNSerializer(NetBoxModelSerializer):
|
||||
class L2VPNSerializer(PrimaryModelSerializer):
|
||||
type = ChoiceField(choices=L2VPNTypeChoices, required=False)
|
||||
import_targets = SerializedPKRelatedField(
|
||||
queryset=RouteTarget.objects.all(),
|
||||
@@ -40,7 +40,8 @@ class L2VPNSerializer(NetBoxModelSerializer):
|
||||
model = L2VPN
|
||||
fields = [
|
||||
'id', 'url', 'display_url', 'display', 'identifier', 'name', 'slug', 'type', 'status', 'import_targets',
|
||||
'export_targets', 'description', 'comments', 'tenant', 'tags', 'custom_fields', 'created', 'last_updated'
|
||||
'export_targets', 'description', 'owner', 'comments', 'tenant', 'tags', 'custom_fields', 'created',
|
||||
'last_updated',
|
||||
]
|
||||
brief_fields = ('id', 'url', 'display', 'identifier', 'name', 'slug', 'type', 'description')
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from rest_framework import serializers
|
||||
|
||||
from ipam.api.serializers_.ip import IPAddressSerializer
|
||||
from netbox.api.fields import ChoiceField, ContentTypeField, RelatedObjectCountField
|
||||
from netbox.api.serializers import NetBoxModelSerializer
|
||||
from netbox.api.serializers import NetBoxModelSerializer, OrganizationalModelSerializer, PrimaryModelSerializer
|
||||
from tenancy.api.serializers_.tenants import TenantSerializer
|
||||
from utilities.api import get_serializer_for_model
|
||||
from vpn.choices import *
|
||||
@@ -22,7 +22,7 @@ __all__ = (
|
||||
# Tunnels
|
||||
#
|
||||
|
||||
class TunnelGroupSerializer(NetBoxModelSerializer):
|
||||
class TunnelGroupSerializer(OrganizationalModelSerializer):
|
||||
|
||||
# Related object counts
|
||||
tunnel_count = RelatedObjectCountField('tunnels')
|
||||
@@ -30,13 +30,13 @@ class TunnelGroupSerializer(NetBoxModelSerializer):
|
||||
class Meta:
|
||||
model = TunnelGroup
|
||||
fields = [
|
||||
'id', 'url', 'display_url', 'display', 'name', 'slug', 'description', 'tags', 'custom_fields',
|
||||
'id', 'url', 'display_url', 'display', 'name', 'slug', 'description', 'owner', 'tags', 'custom_fields',
|
||||
'created', 'last_updated', 'tunnel_count',
|
||||
]
|
||||
brief_fields = ('id', 'url', 'display', 'name', 'slug', 'description', 'tunnel_count')
|
||||
|
||||
|
||||
class TunnelSerializer(NetBoxModelSerializer):
|
||||
class TunnelSerializer(PrimaryModelSerializer):
|
||||
status = ChoiceField(
|
||||
choices=TunnelStatusChoices
|
||||
)
|
||||
@@ -67,8 +67,8 @@ class TunnelSerializer(NetBoxModelSerializer):
|
||||
model = Tunnel
|
||||
fields = (
|
||||
'id', 'url', 'display_url', 'display', 'name', 'status', 'group', 'encapsulation', 'ipsec_profile',
|
||||
'tenant', 'tunnel_id', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated',
|
||||
'terminations_count',
|
||||
'tenant', 'tunnel_id', 'description', 'owner', 'comments', 'tags', 'custom_fields', 'created',
|
||||
'last_updated', 'terminations_count',
|
||||
)
|
||||
brief_fields = ('id', 'url', 'display', 'name', 'description')
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from django.utils.translation import gettext as _
|
||||
|
||||
from dcim.models import Device, Interface
|
||||
from ipam.models import IPAddress, RouteTarget, VLAN
|
||||
from netbox.filtersets import NetBoxModelFilterSet, OrganizationalModelFilterSet
|
||||
from netbox.filtersets import NetBoxModelFilterSet, OrganizationalModelFilterSet, PrimaryModelFilterSet
|
||||
from tenancy.filtersets import ContactModelFilterSet, TenancyFilterSet
|
||||
from utilities.filters import ContentTypeFilter, MultiValueCharFilter, MultiValueNumberFilter
|
||||
from virtualization.models import VirtualMachine, VMInterface
|
||||
@@ -32,7 +32,7 @@ class TunnelGroupFilterSet(OrganizationalModelFilterSet, ContactModelFilterSet):
|
||||
fields = ('id', 'name', 'slug', 'description')
|
||||
|
||||
|
||||
class TunnelFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSet):
|
||||
class TunnelFilterSet(PrimaryModelFilterSet, TenancyFilterSet, ContactModelFilterSet):
|
||||
status = django_filters.MultipleChoiceFilter(
|
||||
choices=TunnelStatusChoices
|
||||
)
|
||||
@@ -123,7 +123,7 @@ class TunnelTerminationFilterSet(NetBoxModelFilterSet):
|
||||
fields = ('id', 'termination_id')
|
||||
|
||||
|
||||
class IKEProposalFilterSet(NetBoxModelFilterSet):
|
||||
class IKEProposalFilterSet(PrimaryModelFilterSet):
|
||||
ike_policy_id = django_filters.ModelMultipleChoiceFilter(
|
||||
field_name='ike_policies',
|
||||
queryset=IKEPolicy.objects.all(),
|
||||
@@ -162,7 +162,7 @@ class IKEProposalFilterSet(NetBoxModelFilterSet):
|
||||
)
|
||||
|
||||
|
||||
class IKEPolicyFilterSet(NetBoxModelFilterSet):
|
||||
class IKEPolicyFilterSet(PrimaryModelFilterSet):
|
||||
version = django_filters.MultipleChoiceFilter(
|
||||
choices=IKEVersionChoices
|
||||
)
|
||||
@@ -193,7 +193,7 @@ class IKEPolicyFilterSet(NetBoxModelFilterSet):
|
||||
)
|
||||
|
||||
|
||||
class IPSecProposalFilterSet(NetBoxModelFilterSet):
|
||||
class IPSecProposalFilterSet(PrimaryModelFilterSet):
|
||||
ipsec_policy_id = django_filters.ModelMultipleChoiceFilter(
|
||||
field_name='ipsec_policies',
|
||||
queryset=IPSecPolicy.objects.all(),
|
||||
@@ -226,7 +226,7 @@ class IPSecProposalFilterSet(NetBoxModelFilterSet):
|
||||
)
|
||||
|
||||
|
||||
class IPSecPolicyFilterSet(NetBoxModelFilterSet):
|
||||
class IPSecPolicyFilterSet(PrimaryModelFilterSet):
|
||||
pfs_group = django_filters.MultipleChoiceFilter(
|
||||
choices=DHGroupChoices
|
||||
)
|
||||
@@ -254,7 +254,7 @@ class IPSecPolicyFilterSet(NetBoxModelFilterSet):
|
||||
)
|
||||
|
||||
|
||||
class IPSecProfileFilterSet(NetBoxModelFilterSet):
|
||||
class IPSecProfileFilterSet(PrimaryModelFilterSet):
|
||||
mode = django_filters.MultipleChoiceFilter(
|
||||
choices=IPSecModeChoices
|
||||
)
|
||||
@@ -293,7 +293,7 @@ class IPSecProfileFilterSet(NetBoxModelFilterSet):
|
||||
)
|
||||
|
||||
|
||||
class L2VPNFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSet):
|
||||
class L2VPNFilterSet(PrimaryModelFilterSet, TenancyFilterSet, ContactModelFilterSet):
|
||||
type = django_filters.MultipleChoiceFilter(
|
||||
choices=L2VPNTypeChoices,
|
||||
null_value=None
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from django import forms
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from netbox.forms import NetBoxModelBulkEditForm
|
||||
from netbox.forms import NetBoxModelBulkEditForm, OrganizationalModelBulkEditForm, PrimaryModelBulkEditForm
|
||||
from tenancy.models import Tenant
|
||||
from utilities.forms import add_blank_choice
|
||||
from utilities.forms.fields import CommentField, DynamicModelChoiceField, DynamicModelMultipleChoiceField
|
||||
from utilities.forms.fields import DynamicModelChoiceField, DynamicModelMultipleChoiceField
|
||||
from utilities.forms.rendering import FieldSet
|
||||
from vpn.choices import *
|
||||
from vpn.models import *
|
||||
@@ -23,18 +23,12 @@ __all__ = (
|
||||
)
|
||||
|
||||
|
||||
class TunnelGroupBulkEditForm(NetBoxModelBulkEditForm):
|
||||
description = forms.CharField(
|
||||
label=_('Description'),
|
||||
max_length=200,
|
||||
required=False
|
||||
)
|
||||
|
||||
class TunnelGroupBulkEditForm(OrganizationalModelBulkEditForm):
|
||||
model = TunnelGroup
|
||||
nullable_fields = ('description',)
|
||||
|
||||
|
||||
class TunnelBulkEditForm(NetBoxModelBulkEditForm):
|
||||
class TunnelBulkEditForm(PrimaryModelBulkEditForm):
|
||||
status = forms.ChoiceField(
|
||||
label=_('Status'),
|
||||
choices=add_blank_choice(TunnelStatusChoices),
|
||||
@@ -60,16 +54,10 @@ class TunnelBulkEditForm(NetBoxModelBulkEditForm):
|
||||
queryset=Tenant.objects.all(),
|
||||
required=False
|
||||
)
|
||||
description = forms.CharField(
|
||||
label=_('Description'),
|
||||
max_length=200,
|
||||
required=False
|
||||
)
|
||||
tunnel_id = forms.IntegerField(
|
||||
label=_('Tunnel ID'),
|
||||
required=False
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
model = Tunnel
|
||||
fieldsets = (
|
||||
@@ -92,7 +80,7 @@ class TunnelTerminationBulkEditForm(NetBoxModelBulkEditForm):
|
||||
model = TunnelTermination
|
||||
|
||||
|
||||
class IKEProposalBulkEditForm(NetBoxModelBulkEditForm):
|
||||
class IKEProposalBulkEditForm(PrimaryModelBulkEditForm):
|
||||
authentication_method = forms.ChoiceField(
|
||||
label=_('Authentication method'),
|
||||
choices=add_blank_choice(AuthenticationMethodChoices),
|
||||
@@ -117,12 +105,6 @@ class IKEProposalBulkEditForm(NetBoxModelBulkEditForm):
|
||||
label=_('SA lifetime'),
|
||||
required=False
|
||||
)
|
||||
description = forms.CharField(
|
||||
label=_('Description'),
|
||||
max_length=200,
|
||||
required=False
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
model = IKEProposal
|
||||
fieldsets = (
|
||||
@@ -136,7 +118,7 @@ class IKEProposalBulkEditForm(NetBoxModelBulkEditForm):
|
||||
)
|
||||
|
||||
|
||||
class IKEPolicyBulkEditForm(NetBoxModelBulkEditForm):
|
||||
class IKEPolicyBulkEditForm(PrimaryModelBulkEditForm):
|
||||
version = forms.ChoiceField(
|
||||
label=_('Version'),
|
||||
choices=add_blank_choice(IKEVersionChoices),
|
||||
@@ -151,12 +133,6 @@ class IKEPolicyBulkEditForm(NetBoxModelBulkEditForm):
|
||||
label=_('Pre-shared key'),
|
||||
required=False
|
||||
)
|
||||
description = forms.CharField(
|
||||
label=_('Description'),
|
||||
max_length=200,
|
||||
required=False
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
model = IKEPolicy
|
||||
fieldsets = (
|
||||
@@ -167,7 +143,7 @@ class IKEPolicyBulkEditForm(NetBoxModelBulkEditForm):
|
||||
)
|
||||
|
||||
|
||||
class IPSecProposalBulkEditForm(NetBoxModelBulkEditForm):
|
||||
class IPSecProposalBulkEditForm(PrimaryModelBulkEditForm):
|
||||
encryption_algorithm = forms.ChoiceField(
|
||||
label=_('Encryption algorithm'),
|
||||
choices=add_blank_choice(EncryptionAlgorithmChoices),
|
||||
@@ -186,12 +162,6 @@ class IPSecProposalBulkEditForm(NetBoxModelBulkEditForm):
|
||||
label=_('SA lifetime (KB)'),
|
||||
required=False
|
||||
)
|
||||
description = forms.CharField(
|
||||
label=_('Description'),
|
||||
max_length=200,
|
||||
required=False
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
model = IPSecProposal
|
||||
fieldsets = (
|
||||
@@ -205,18 +175,12 @@ class IPSecProposalBulkEditForm(NetBoxModelBulkEditForm):
|
||||
)
|
||||
|
||||
|
||||
class IPSecPolicyBulkEditForm(NetBoxModelBulkEditForm):
|
||||
class IPSecPolicyBulkEditForm(PrimaryModelBulkEditForm):
|
||||
pfs_group = forms.ChoiceField(
|
||||
label=_('PFS group'),
|
||||
choices=add_blank_choice(DHGroupChoices),
|
||||
required=False
|
||||
)
|
||||
description = forms.CharField(
|
||||
label=_('Description'),
|
||||
max_length=200,
|
||||
required=False
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
model = IPSecPolicy
|
||||
fieldsets = (
|
||||
@@ -227,7 +191,7 @@ class IPSecPolicyBulkEditForm(NetBoxModelBulkEditForm):
|
||||
)
|
||||
|
||||
|
||||
class IPSecProfileBulkEditForm(NetBoxModelBulkEditForm):
|
||||
class IPSecProfileBulkEditForm(PrimaryModelBulkEditForm):
|
||||
mode = forms.ChoiceField(
|
||||
label=_('Mode'),
|
||||
choices=add_blank_choice(IPSecModeChoices),
|
||||
@@ -243,12 +207,6 @@ class IPSecProfileBulkEditForm(NetBoxModelBulkEditForm):
|
||||
queryset=IPSecPolicy.objects.all(),
|
||||
required=False
|
||||
)
|
||||
description = forms.CharField(
|
||||
label=_('Description'),
|
||||
max_length=200,
|
||||
required=False
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
model = IPSecProfile
|
||||
fieldsets = (
|
||||
@@ -259,7 +217,7 @@ class IPSecProfileBulkEditForm(NetBoxModelBulkEditForm):
|
||||
)
|
||||
|
||||
|
||||
class L2VPNBulkEditForm(NetBoxModelBulkEditForm):
|
||||
class L2VPNBulkEditForm(PrimaryModelBulkEditForm):
|
||||
status = forms.ChoiceField(
|
||||
label=_('Status'),
|
||||
choices=L2VPNStatusChoices,
|
||||
@@ -274,12 +232,6 @@ class L2VPNBulkEditForm(NetBoxModelBulkEditForm):
|
||||
queryset=Tenant.objects.all(),
|
||||
required=False
|
||||
)
|
||||
description = forms.CharField(
|
||||
label=_('Description'),
|
||||
max_length=200,
|
||||
required=False
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
model = L2VPN
|
||||
fieldsets = (
|
||||
|
||||
@@ -3,9 +3,9 @@ from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from dcim.models import Device, Interface
|
||||
from ipam.models import IPAddress, VLAN
|
||||
from netbox.forms import NetBoxModelImportForm
|
||||
from netbox.forms import NetBoxModelImportForm, OrganizationalModelImportForm, PrimaryModelImportForm
|
||||
from tenancy.models import Tenant
|
||||
from utilities.forms.fields import CSVChoiceField, CSVModelChoiceField, CSVModelMultipleChoiceField, SlugField
|
||||
from utilities.forms.fields import CSVChoiceField, CSVModelChoiceField, CSVModelMultipleChoiceField
|
||||
from virtualization.models import VirtualMachine, VMInterface
|
||||
from vpn.choices import *
|
||||
from vpn.models import *
|
||||
@@ -24,15 +24,14 @@ __all__ = (
|
||||
)
|
||||
|
||||
|
||||
class TunnelGroupImportForm(NetBoxModelImportForm):
|
||||
slug = SlugField()
|
||||
class TunnelGroupImportForm(OrganizationalModelImportForm):
|
||||
|
||||
class Meta:
|
||||
model = TunnelGroup
|
||||
fields = ('name', 'slug', 'description', 'tags')
|
||||
fields = ('name', 'slug', 'description', 'owner', 'tags')
|
||||
|
||||
|
||||
class TunnelImportForm(NetBoxModelImportForm):
|
||||
class TunnelImportForm(PrimaryModelImportForm):
|
||||
status = CSVChoiceField(
|
||||
label=_('Status'),
|
||||
choices=TunnelStatusChoices,
|
||||
@@ -67,7 +66,7 @@ class TunnelImportForm(NetBoxModelImportForm):
|
||||
model = Tunnel
|
||||
fields = (
|
||||
'name', 'status', 'group', 'encapsulation', 'ipsec_profile', 'tenant', 'tunnel_id', 'description',
|
||||
'comments', 'tags',
|
||||
'owner', 'comments', 'tags',
|
||||
)
|
||||
|
||||
|
||||
@@ -140,7 +139,7 @@ class TunnelTerminationImportForm(NetBoxModelImportForm):
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
|
||||
class IKEProposalImportForm(NetBoxModelImportForm):
|
||||
class IKEProposalImportForm(PrimaryModelImportForm):
|
||||
authentication_method = CSVChoiceField(
|
||||
label=_('Authentication method'),
|
||||
choices=AuthenticationMethodChoices
|
||||
@@ -163,11 +162,11 @@ class IKEProposalImportForm(NetBoxModelImportForm):
|
||||
model = IKEProposal
|
||||
fields = (
|
||||
'name', 'description', 'authentication_method', 'encryption_algorithm', 'authentication_algorithm',
|
||||
'group', 'sa_lifetime', 'comments', 'tags',
|
||||
'group', 'sa_lifetime', 'owner', 'comments', 'tags',
|
||||
)
|
||||
|
||||
|
||||
class IKEPolicyImportForm(NetBoxModelImportForm):
|
||||
class IKEPolicyImportForm(PrimaryModelImportForm):
|
||||
version = CSVChoiceField(
|
||||
label=_('Version'),
|
||||
choices=IKEVersionChoices
|
||||
@@ -186,11 +185,11 @@ class IKEPolicyImportForm(NetBoxModelImportForm):
|
||||
class Meta:
|
||||
model = IKEPolicy
|
||||
fields = (
|
||||
'name', 'description', 'version', 'mode', 'proposals', 'preshared_key', 'comments', 'tags',
|
||||
'name', 'description', 'version', 'mode', 'proposals', 'preshared_key', 'owner', 'comments', 'tags',
|
||||
)
|
||||
|
||||
|
||||
class IPSecProposalImportForm(NetBoxModelImportForm):
|
||||
class IPSecProposalImportForm(PrimaryModelImportForm):
|
||||
encryption_algorithm = CSVChoiceField(
|
||||
label=_('Encryption algorithm'),
|
||||
choices=EncryptionAlgorithmChoices,
|
||||
@@ -206,11 +205,11 @@ class IPSecProposalImportForm(NetBoxModelImportForm):
|
||||
model = IPSecProposal
|
||||
fields = (
|
||||
'name', 'description', 'encryption_algorithm', 'authentication_algorithm', 'sa_lifetime_seconds',
|
||||
'sa_lifetime_data', 'comments', 'tags',
|
||||
'sa_lifetime_data', 'owner', 'comments', 'tags',
|
||||
)
|
||||
|
||||
|
||||
class IPSecPolicyImportForm(NetBoxModelImportForm):
|
||||
class IPSecPolicyImportForm(PrimaryModelImportForm):
|
||||
pfs_group = CSVChoiceField(
|
||||
label=_('Diffie-Hellman group for Perfect Forward Secrecy'),
|
||||
choices=DHGroupChoices,
|
||||
@@ -225,11 +224,11 @@ class IPSecPolicyImportForm(NetBoxModelImportForm):
|
||||
class Meta:
|
||||
model = IPSecPolicy
|
||||
fields = (
|
||||
'name', 'description', 'proposals', 'pfs_group', 'comments', 'tags',
|
||||
'name', 'description', 'proposals', 'pfs_group', 'owner', 'comments', 'tags',
|
||||
)
|
||||
|
||||
|
||||
class IPSecProfileImportForm(NetBoxModelImportForm):
|
||||
class IPSecProfileImportForm(PrimaryModelImportForm):
|
||||
mode = CSVChoiceField(
|
||||
label=_('Mode'),
|
||||
choices=IPSecModeChoices,
|
||||
@@ -249,11 +248,11 @@ class IPSecProfileImportForm(NetBoxModelImportForm):
|
||||
class Meta:
|
||||
model = IPSecProfile
|
||||
fields = (
|
||||
'name', 'mode', 'ike_policy', 'ipsec_policy', 'description', 'comments', 'tags',
|
||||
'name', 'mode', 'ike_policy', 'ipsec_policy', 'description', 'owner', 'comments', 'tags',
|
||||
)
|
||||
|
||||
|
||||
class L2VPNImportForm(NetBoxModelImportForm):
|
||||
class L2VPNImportForm(PrimaryModelImportForm):
|
||||
tenant = CSVModelChoiceField(
|
||||
label=_('Tenant'),
|
||||
queryset=Tenant.objects.all(),
|
||||
@@ -273,8 +272,9 @@ class L2VPNImportForm(NetBoxModelImportForm):
|
||||
|
||||
class Meta:
|
||||
model = L2VPN
|
||||
fields = ('identifier', 'name', 'slug', 'tenant', 'type', 'description',
|
||||
'comments', 'tags')
|
||||
fields = (
|
||||
'identifier', 'name', 'slug', 'tenant', 'type', 'description', 'owner', 'comments', 'tags',
|
||||
)
|
||||
|
||||
|
||||
class L2VPNTerminationImportForm(NetBoxModelImportForm):
|
||||
|
||||
@@ -4,7 +4,7 @@ from django.utils.translation import gettext as _
|
||||
|
||||
from dcim.models import Device, Region, Site
|
||||
from ipam.models import RouteTarget, VLAN
|
||||
from netbox.forms import NetBoxModelFilterSetForm
|
||||
from netbox.forms import NetBoxModelFilterSetForm, OrganizationalModelFilterSetForm, PrimaryModelFilterSetForm
|
||||
from tenancy.forms import ContactModelFilterForm, TenancyFilterForm
|
||||
from utilities.forms.fields import (
|
||||
ContentTypeMultipleChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, TagFilterField,
|
||||
@@ -30,19 +30,19 @@ __all__ = (
|
||||
)
|
||||
|
||||
|
||||
class TunnelGroupFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
||||
class TunnelGroupFilterForm(ContactModelFilterForm, OrganizationalModelFilterSetForm):
|
||||
model = TunnelGroup
|
||||
fieldsets = (
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')),
|
||||
)
|
||||
tag = TagFilterField(model)
|
||||
|
||||
|
||||
class TunnelFilterForm(ContactModelFilterForm, TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
class TunnelFilterForm(ContactModelFilterForm, TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||
model = Tunnel
|
||||
fieldsets = (
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||
FieldSet('status', 'encapsulation', 'tunnel_id', name=_('Tunnel')),
|
||||
FieldSet('ipsec_profile_id', name=_('Security')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenancy')),
|
||||
@@ -94,10 +94,10 @@ class TunnelTerminationFilterForm(NetBoxModelFilterSetForm):
|
||||
tag = TagFilterField(model)
|
||||
|
||||
|
||||
class IKEProposalFilterForm(NetBoxModelFilterSetForm):
|
||||
class IKEProposalFilterForm(PrimaryModelFilterSetForm):
|
||||
model = IKEProposal
|
||||
fieldsets = (
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||
FieldSet(
|
||||
'authentication_method', 'encryption_algorithm', 'authentication_algorithm', 'group', name=_('Parameters')
|
||||
),
|
||||
@@ -125,10 +125,10 @@ class IKEProposalFilterForm(NetBoxModelFilterSetForm):
|
||||
tag = TagFilterField(model)
|
||||
|
||||
|
||||
class IKEPolicyFilterForm(NetBoxModelFilterSetForm):
|
||||
class IKEPolicyFilterForm(PrimaryModelFilterSetForm):
|
||||
model = IKEPolicy
|
||||
fieldsets = (
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||
FieldSet('version', 'mode', 'proposal_id', name=_('Parameters')),
|
||||
)
|
||||
version = forms.MultipleChoiceField(
|
||||
@@ -149,10 +149,10 @@ class IKEPolicyFilterForm(NetBoxModelFilterSetForm):
|
||||
tag = TagFilterField(model)
|
||||
|
||||
|
||||
class IPSecProposalFilterForm(NetBoxModelFilterSetForm):
|
||||
class IPSecProposalFilterForm(PrimaryModelFilterSetForm):
|
||||
model = IPSecProposal
|
||||
fieldsets = (
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||
FieldSet('encryption_algorithm', 'authentication_algorithm', name=_('Parameters')),
|
||||
)
|
||||
encryption_algorithm = forms.MultipleChoiceField(
|
||||
@@ -168,10 +168,10 @@ class IPSecProposalFilterForm(NetBoxModelFilterSetForm):
|
||||
tag = TagFilterField(model)
|
||||
|
||||
|
||||
class IPSecPolicyFilterForm(NetBoxModelFilterSetForm):
|
||||
class IPSecPolicyFilterForm(PrimaryModelFilterSetForm):
|
||||
model = IPSecPolicy
|
||||
fieldsets = (
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||
FieldSet('proposal_id', 'pfs_group', name=_('Parameters')),
|
||||
)
|
||||
proposal_id = DynamicModelMultipleChoiceField(
|
||||
@@ -187,10 +187,10 @@ class IPSecPolicyFilterForm(NetBoxModelFilterSetForm):
|
||||
tag = TagFilterField(model)
|
||||
|
||||
|
||||
class IPSecProfileFilterForm(NetBoxModelFilterSetForm):
|
||||
class IPSecProfileFilterForm(PrimaryModelFilterSetForm):
|
||||
model = IPSecProfile
|
||||
fieldsets = (
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||
FieldSet('mode', 'ike_policy_id', 'ipsec_policy_id', name=_('Profile')),
|
||||
)
|
||||
mode = forms.MultipleChoiceField(
|
||||
@@ -211,10 +211,10 @@ class IPSecProfileFilterForm(NetBoxModelFilterSetForm):
|
||||
tag = TagFilterField(model)
|
||||
|
||||
|
||||
class L2VPNFilterForm(ContactModelFilterForm, TenancyFilterForm, NetBoxModelFilterSetForm):
|
||||
class L2VPNFilterForm(ContactModelFilterForm, TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||
model = L2VPN
|
||||
fieldsets = (
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('q', 'filter_id', 'tag', 'owner_id'),
|
||||
FieldSet('type', 'status', 'import_target_id', 'export_target_id', name=_('Attributes')),
|
||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')),
|
||||
|
||||
@@ -4,9 +4,9 @@ from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from dcim.models import Device, Interface
|
||||
from ipam.models import IPAddress, RouteTarget, VLAN
|
||||
from netbox.forms import NetBoxModelForm
|
||||
from netbox.forms import NetBoxModelForm, OrganizationalModelForm, PrimaryModelForm
|
||||
from tenancy.forms import TenancyForm
|
||||
from utilities.forms.fields import CommentField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, SlugField
|
||||
from utilities.forms.fields import DynamicModelChoiceField, DynamicModelMultipleChoiceField, SlugField
|
||||
from utilities.forms.rendering import FieldSet, TabbedGroups
|
||||
from utilities.forms.utils import add_blank_choice, get_field_value
|
||||
from utilities.forms.widgets import HTMXSelect
|
||||
@@ -29,9 +29,7 @@ __all__ = (
|
||||
)
|
||||
|
||||
|
||||
class TunnelGroupForm(NetBoxModelForm):
|
||||
slug = SlugField()
|
||||
|
||||
class TunnelGroupForm(OrganizationalModelForm):
|
||||
fieldsets = (
|
||||
FieldSet('name', 'slug', 'description', 'tags', name=_('Tunnel Group')),
|
||||
)
|
||||
@@ -39,11 +37,11 @@ class TunnelGroupForm(NetBoxModelForm):
|
||||
class Meta:
|
||||
model = TunnelGroup
|
||||
fields = [
|
||||
'name', 'slug', 'description', 'tags',
|
||||
'name', 'slug', 'description', 'owner', 'tags',
|
||||
]
|
||||
|
||||
|
||||
class TunnelForm(TenancyForm, NetBoxModelForm):
|
||||
class TunnelForm(TenancyForm, PrimaryModelForm):
|
||||
group = DynamicModelChoiceField(
|
||||
queryset=TunnelGroup.objects.all(),
|
||||
label=_('Tunnel Group'),
|
||||
@@ -55,7 +53,6 @@ class TunnelForm(TenancyForm, NetBoxModelForm):
|
||||
label=_('IPSec Profile'),
|
||||
required=False
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
FieldSet('name', 'status', 'group', 'encapsulation', 'description', 'tunnel_id', 'tags', name=_('Tunnel')),
|
||||
@@ -67,7 +64,7 @@ class TunnelForm(TenancyForm, NetBoxModelForm):
|
||||
model = Tunnel
|
||||
fields = [
|
||||
'name', 'status', 'group', 'encapsulation', 'description', 'tunnel_id', 'ipsec_profile', 'tenant_group',
|
||||
'tenant', 'comments', 'tags',
|
||||
'tenant', 'owner', 'comments', 'tags',
|
||||
]
|
||||
|
||||
|
||||
@@ -293,7 +290,7 @@ class TunnelTerminationForm(NetBoxModelForm):
|
||||
self.instance.termination = self.cleaned_data.get('termination')
|
||||
|
||||
|
||||
class IKEProposalForm(NetBoxModelForm):
|
||||
class IKEProposalForm(PrimaryModelForm):
|
||||
|
||||
fieldsets = (
|
||||
FieldSet('name', 'description', 'tags', name=_('Proposal')),
|
||||
@@ -307,11 +304,11 @@ class IKEProposalForm(NetBoxModelForm):
|
||||
model = IKEProposal
|
||||
fields = [
|
||||
'name', 'description', 'authentication_method', 'encryption_algorithm', 'authentication_algorithm', 'group',
|
||||
'sa_lifetime', 'comments', 'tags',
|
||||
'sa_lifetime', 'owner', 'comments', 'tags',
|
||||
]
|
||||
|
||||
|
||||
class IKEPolicyForm(NetBoxModelForm):
|
||||
class IKEPolicyForm(PrimaryModelForm):
|
||||
proposals = DynamicModelMultipleChoiceField(
|
||||
queryset=IKEProposal.objects.all(),
|
||||
label=_('Proposals'),
|
||||
@@ -326,11 +323,11 @@ class IKEPolicyForm(NetBoxModelForm):
|
||||
class Meta:
|
||||
model = IKEPolicy
|
||||
fields = [
|
||||
'name', 'description', 'version', 'mode', 'proposals', 'preshared_key', 'comments', 'tags',
|
||||
'name', 'description', 'version', 'mode', 'proposals', 'preshared_key', 'owner', 'comments', 'tags',
|
||||
]
|
||||
|
||||
|
||||
class IPSecProposalForm(NetBoxModelForm):
|
||||
class IPSecProposalForm(PrimaryModelForm):
|
||||
|
||||
fieldsets = (
|
||||
FieldSet('name', 'description', 'tags', name=_('Proposal')),
|
||||
@@ -344,11 +341,11 @@ class IPSecProposalForm(NetBoxModelForm):
|
||||
model = IPSecProposal
|
||||
fields = [
|
||||
'name', 'description', 'encryption_algorithm', 'authentication_algorithm', 'sa_lifetime_seconds',
|
||||
'sa_lifetime_data', 'comments', 'tags',
|
||||
'sa_lifetime_data', 'owner', 'comments', 'tags',
|
||||
]
|
||||
|
||||
|
||||
class IPSecPolicyForm(NetBoxModelForm):
|
||||
class IPSecPolicyForm(PrimaryModelForm):
|
||||
proposals = DynamicModelMultipleChoiceField(
|
||||
queryset=IPSecProposal.objects.all(),
|
||||
label=_('Proposals'),
|
||||
@@ -363,11 +360,11 @@ class IPSecPolicyForm(NetBoxModelForm):
|
||||
class Meta:
|
||||
model = IPSecPolicy
|
||||
fields = [
|
||||
'name', 'description', 'proposals', 'pfs_group', 'comments', 'tags',
|
||||
'name', 'description', 'proposals', 'pfs_group', 'owner', 'comments', 'tags',
|
||||
]
|
||||
|
||||
|
||||
class IPSecProfileForm(NetBoxModelForm):
|
||||
class IPSecProfileForm(PrimaryModelForm):
|
||||
ike_policy = DynamicModelChoiceField(
|
||||
queryset=IKEPolicy.objects.all(),
|
||||
label=_('IKE policy')
|
||||
@@ -376,7 +373,6 @@ class IPSecProfileForm(NetBoxModelForm):
|
||||
queryset=IPSecPolicy.objects.all(),
|
||||
label=_('IPSec policy')
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
FieldSet('name', 'description', 'tags', name=_('Profile')),
|
||||
@@ -386,7 +382,7 @@ class IPSecProfileForm(NetBoxModelForm):
|
||||
class Meta:
|
||||
model = IPSecProfile
|
||||
fields = [
|
||||
'name', 'description', 'mode', 'ike_policy', 'ipsec_policy', 'description', 'comments', 'tags',
|
||||
'name', 'description', 'mode', 'ike_policy', 'ipsec_policy', 'description', 'owner', 'comments', 'tags',
|
||||
]
|
||||
|
||||
|
||||
@@ -394,7 +390,7 @@ class IPSecProfileForm(NetBoxModelForm):
|
||||
# L2VPN
|
||||
#
|
||||
|
||||
class L2VPNForm(TenancyForm, NetBoxModelForm):
|
||||
class L2VPNForm(TenancyForm, PrimaryModelForm):
|
||||
slug = SlugField()
|
||||
import_targets = DynamicModelMultipleChoiceField(
|
||||
label=_('Import targets'),
|
||||
@@ -406,7 +402,6 @@ class L2VPNForm(TenancyForm, NetBoxModelForm):
|
||||
queryset=RouteTarget.objects.all(),
|
||||
required=False
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
FieldSet('name', 'slug', 'type', 'status', 'identifier', 'description', 'tags', name=_('L2VPN')),
|
||||
@@ -417,8 +412,8 @@ class L2VPNForm(TenancyForm, NetBoxModelForm):
|
||||
class Meta:
|
||||
model = L2VPN
|
||||
fields = (
|
||||
'name', 'slug', 'type', 'status', 'identifier', 'import_targets', 'export_targets', 'tenant',
|
||||
'description', 'comments', 'tags'
|
||||
'name', 'slug', 'type', 'status', 'identifier', 'import_targets', 'export_targets', 'tenant', 'description',
|
||||
'owner', 'comments', 'tags'
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import strawberry
|
||||
import strawberry_django
|
||||
|
||||
from extras.graphql.mixins import ContactsMixin, CustomFieldsMixin, TagsMixin
|
||||
from netbox.graphql.types import ObjectType, OrganizationalObjectType, NetBoxObjectType
|
||||
from netbox.graphql.types import ObjectType, OrganizationalObjectType, NetBoxObjectType, PrimaryObjectType
|
||||
from vpn import models
|
||||
from .filters import *
|
||||
|
||||
@@ -58,7 +58,7 @@ class TunnelTerminationType(CustomFieldsMixin, TagsMixin, ObjectType):
|
||||
filters=TunnelFilter,
|
||||
pagination=True
|
||||
)
|
||||
class TunnelType(ContactsMixin, NetBoxObjectType):
|
||||
class TunnelType(ContactsMixin, PrimaryObjectType):
|
||||
group: Annotated["TunnelGroupType", strawberry.lazy('vpn.graphql.types')] | None
|
||||
ipsec_profile: Annotated["IPSecProfileType", strawberry.lazy('vpn.graphql.types')] | None
|
||||
tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None
|
||||
@@ -72,8 +72,7 @@ class TunnelType(ContactsMixin, NetBoxObjectType):
|
||||
filters=IKEProposalFilter,
|
||||
pagination=True
|
||||
)
|
||||
class IKEProposalType(OrganizationalObjectType):
|
||||
|
||||
class IKEProposalType(PrimaryObjectType):
|
||||
ike_policies: List[Annotated["IKEPolicyType", strawberry.lazy('vpn.graphql.types')]]
|
||||
|
||||
|
||||
@@ -83,8 +82,7 @@ class IKEProposalType(OrganizationalObjectType):
|
||||
filters=IKEPolicyFilter,
|
||||
pagination=True
|
||||
)
|
||||
class IKEPolicyType(OrganizationalObjectType):
|
||||
|
||||
class IKEPolicyType(PrimaryObjectType):
|
||||
proposals: List[Annotated["IKEProposalType", strawberry.lazy('vpn.graphql.types')]]
|
||||
ipsec_profiles: List[Annotated["IPSecProfileType", strawberry.lazy('vpn.graphql.types')]]
|
||||
|
||||
@@ -95,8 +93,7 @@ class IKEPolicyType(OrganizationalObjectType):
|
||||
filters=IPSecProposalFilter,
|
||||
pagination=True
|
||||
)
|
||||
class IPSecProposalType(OrganizationalObjectType):
|
||||
|
||||
class IPSecProposalType(PrimaryObjectType):
|
||||
ipsec_policies: List[Annotated["IPSecPolicyType", strawberry.lazy('vpn.graphql.types')]]
|
||||
|
||||
|
||||
@@ -106,8 +103,7 @@ class IPSecProposalType(OrganizationalObjectType):
|
||||
filters=IPSecPolicyFilter,
|
||||
pagination=True
|
||||
)
|
||||
class IPSecPolicyType(OrganizationalObjectType):
|
||||
|
||||
class IPSecPolicyType(PrimaryObjectType):
|
||||
proposals: List[Annotated["IPSecProposalType", strawberry.lazy('vpn.graphql.types')]]
|
||||
ipsec_profiles: List[Annotated["IPSecProfileType", strawberry.lazy('vpn.graphql.types')]]
|
||||
|
||||
@@ -118,7 +114,7 @@ class IPSecPolicyType(OrganizationalObjectType):
|
||||
filters=IPSecProfileFilter,
|
||||
pagination=True
|
||||
)
|
||||
class IPSecProfileType(OrganizationalObjectType):
|
||||
class IPSecProfileType(PrimaryObjectType):
|
||||
ike_policy: Annotated["IKEPolicyType", strawberry.lazy('vpn.graphql.types')]
|
||||
ipsec_policy: Annotated["IPSecPolicyType", strawberry.lazy('vpn.graphql.types')]
|
||||
|
||||
@@ -131,7 +127,7 @@ class IPSecProfileType(OrganizationalObjectType):
|
||||
filters=L2VPNFilter,
|
||||
pagination=True
|
||||
)
|
||||
class L2VPNType(ContactsMixin, NetBoxObjectType):
|
||||
class L2VPNType(ContactsMixin, PrimaryObjectType):
|
||||
tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None
|
||||
|
||||
export_targets: List[Annotated["RouteTargetType", strawberry.lazy('ipam.graphql.types')]]
|
||||
|
||||
68
netbox/vpn/migrations/0010_owner.py
Normal file
68
netbox/vpn/migrations/0010_owner.py
Normal file
@@ -0,0 +1,68 @@
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('users', '0015_owner'),
|
||||
('vpn', '0009_remove_redundant_indexes'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='ikepolicy',
|
||||
name='owner',
|
||||
field=models.ForeignKey(
|
||||
blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='users.owner'
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='ikeproposal',
|
||||
name='owner',
|
||||
field=models.ForeignKey(
|
||||
blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='users.owner'
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='ipsecpolicy',
|
||||
name='owner',
|
||||
field=models.ForeignKey(
|
||||
blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='users.owner'
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='ipsecprofile',
|
||||
name='owner',
|
||||
field=models.ForeignKey(
|
||||
blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='users.owner'
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='ipsecproposal',
|
||||
name='owner',
|
||||
field=models.ForeignKey(
|
||||
blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='users.owner'
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='l2vpn',
|
||||
name='owner',
|
||||
field=models.ForeignKey(
|
||||
blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='users.owner'
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='tunnel',
|
||||
name='owner',
|
||||
field=models.ForeignKey(
|
||||
blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='users.owner'
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='tunnelgroup',
|
||||
name='owner',
|
||||
field=models.ForeignKey(
|
||||
blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='users.owner'
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -1,7 +1,7 @@
|
||||
import django_tables2 as tables
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from netbox.tables import NetBoxTable, columns
|
||||
from netbox.tables import PrimaryModelTable, columns
|
||||
from vpn.models import *
|
||||
|
||||
__all__ = (
|
||||
@@ -13,7 +13,7 @@ __all__ = (
|
||||
)
|
||||
|
||||
|
||||
class IKEProposalTable(NetBoxTable):
|
||||
class IKEProposalTable(PrimaryModelTable):
|
||||
name = tables.Column(
|
||||
verbose_name=_('Name'),
|
||||
linkify=True
|
||||
@@ -33,14 +33,11 @@ class IKEProposalTable(NetBoxTable):
|
||||
sa_lifetime = tables.Column(
|
||||
verbose_name=_('SA Lifetime')
|
||||
)
|
||||
comments = columns.MarkdownColumn(
|
||||
verbose_name=_('Comments'),
|
||||
)
|
||||
tags = columns.TagColumn(
|
||||
url_name='vpn:ikeproposal_list'
|
||||
)
|
||||
|
||||
class Meta(NetBoxTable.Meta):
|
||||
class Meta(PrimaryModelTable.Meta):
|
||||
model = IKEProposal
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'authentication_method', 'encryption_algorithm', 'authentication_algorithm',
|
||||
@@ -52,7 +49,7 @@ class IKEProposalTable(NetBoxTable):
|
||||
)
|
||||
|
||||
|
||||
class IKEPolicyTable(NetBoxTable):
|
||||
class IKEPolicyTable(PrimaryModelTable):
|
||||
name = tables.Column(
|
||||
verbose_name=_('Name'),
|
||||
linkify=True
|
||||
@@ -70,14 +67,11 @@ class IKEPolicyTable(NetBoxTable):
|
||||
preshared_key = tables.Column(
|
||||
verbose_name=_('Pre-shared Key')
|
||||
)
|
||||
comments = columns.MarkdownColumn(
|
||||
verbose_name=_('Comments'),
|
||||
)
|
||||
tags = columns.TagColumn(
|
||||
url_name='vpn:ikepolicy_list'
|
||||
)
|
||||
|
||||
class Meta(NetBoxTable.Meta):
|
||||
class Meta(PrimaryModelTable.Meta):
|
||||
model = IKEPolicy
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'version', 'mode', 'proposals', 'preshared_key', 'description', 'comments', 'tags',
|
||||
@@ -88,7 +82,7 @@ class IKEPolicyTable(NetBoxTable):
|
||||
)
|
||||
|
||||
|
||||
class IPSecProposalTable(NetBoxTable):
|
||||
class IPSecProposalTable(PrimaryModelTable):
|
||||
name = tables.Column(
|
||||
verbose_name=_('Name'),
|
||||
linkify=True
|
||||
@@ -105,14 +99,11 @@ class IPSecProposalTable(NetBoxTable):
|
||||
sa_lifetime_data = tables.Column(
|
||||
verbose_name=_('SA Lifetime (KB)')
|
||||
)
|
||||
comments = columns.MarkdownColumn(
|
||||
verbose_name=_('Comments'),
|
||||
)
|
||||
tags = columns.TagColumn(
|
||||
url_name='vpn:ipsecproposal_list'
|
||||
)
|
||||
|
||||
class Meta(NetBoxTable.Meta):
|
||||
class Meta(PrimaryModelTable.Meta):
|
||||
model = IPSecProposal
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'encryption_algorithm', 'authentication_algorithm', 'sa_lifetime_seconds',
|
||||
@@ -124,7 +115,7 @@ class IPSecProposalTable(NetBoxTable):
|
||||
)
|
||||
|
||||
|
||||
class IPSecPolicyTable(NetBoxTable):
|
||||
class IPSecPolicyTable(PrimaryModelTable):
|
||||
name = tables.Column(
|
||||
verbose_name=_('Name'),
|
||||
linkify=True
|
||||
@@ -136,14 +127,11 @@ class IPSecPolicyTable(NetBoxTable):
|
||||
pfs_group = tables.Column(
|
||||
verbose_name=_('PFS Group')
|
||||
)
|
||||
comments = columns.MarkdownColumn(
|
||||
verbose_name=_('Comments'),
|
||||
)
|
||||
tags = columns.TagColumn(
|
||||
url_name='vpn:ipsecpolicy_list'
|
||||
)
|
||||
|
||||
class Meta(NetBoxTable.Meta):
|
||||
class Meta(PrimaryModelTable.Meta):
|
||||
model = IPSecPolicy
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'proposals', 'pfs_group', 'description', 'comments', 'tags', 'created', 'last_updated',
|
||||
@@ -153,7 +141,7 @@ class IPSecPolicyTable(NetBoxTable):
|
||||
)
|
||||
|
||||
|
||||
class IPSecProfileTable(NetBoxTable):
|
||||
class IPSecProfileTable(PrimaryModelTable):
|
||||
name = tables.Column(
|
||||
verbose_name=_('Name'),
|
||||
linkify=True
|
||||
@@ -169,14 +157,11 @@ class IPSecProfileTable(NetBoxTable):
|
||||
linkify=True,
|
||||
verbose_name=_('IPSec Policy')
|
||||
)
|
||||
comments = columns.MarkdownColumn(
|
||||
verbose_name=_('Comments'),
|
||||
)
|
||||
tags = columns.TagColumn(
|
||||
url_name='vpn:ipsecprofile_list'
|
||||
)
|
||||
|
||||
class Meta(NetBoxTable.Meta):
|
||||
class Meta(PrimaryModelTable.Meta):
|
||||
model = IPSecProfile
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'mode', 'ike_policy', 'ipsec_policy', 'description', 'comments', 'tags', 'created',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import django_tables2 as tables
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from netbox.tables import NetBoxTable, columns
|
||||
from netbox.tables import NetBoxTable, PrimaryModelTable, columns
|
||||
from tenancy.tables import TenancyColumnsMixin
|
||||
from vpn.models import L2VPN, L2VPNTermination
|
||||
|
||||
@@ -17,7 +17,7 @@ L2VPN_TARGETS = """
|
||||
"""
|
||||
|
||||
|
||||
class L2VPNTable(TenancyColumnsMixin, NetBoxTable):
|
||||
class L2VPNTable(TenancyColumnsMixin, PrimaryModelTable):
|
||||
pk = columns.ToggleColumn()
|
||||
name = tables.Column(
|
||||
verbose_name=_('Name'),
|
||||
@@ -36,14 +36,11 @@ class L2VPNTable(TenancyColumnsMixin, NetBoxTable):
|
||||
template_code=L2VPN_TARGETS,
|
||||
orderable=False
|
||||
)
|
||||
comments = columns.MarkdownColumn(
|
||||
verbose_name=_('Comments'),
|
||||
)
|
||||
tags = columns.TagColumn(
|
||||
url_name='vpn:l2vpn_list'
|
||||
)
|
||||
|
||||
class Meta(NetBoxTable.Meta):
|
||||
class Meta(PrimaryModelTable.Meta):
|
||||
model = L2VPN
|
||||
fields = (
|
||||
'pk', 'name', 'slug', 'status', 'identifier', 'type', 'import_targets', 'export_targets', 'tenant',
|
||||
|
||||
@@ -2,7 +2,7 @@ import django_tables2 as tables
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django_tables2.utils import Accessor
|
||||
|
||||
from netbox.tables import NetBoxTable, columns
|
||||
from netbox.tables import NetBoxTable, OrganizationalModelTable, PrimaryModelTable, columns
|
||||
from tenancy.tables import TenancyColumnsMixin
|
||||
from vpn.models import *
|
||||
|
||||
@@ -13,7 +13,7 @@ __all__ = (
|
||||
)
|
||||
|
||||
|
||||
class TunnelGroupTable(NetBoxTable):
|
||||
class TunnelGroupTable(OrganizationalModelTable):
|
||||
name = tables.Column(
|
||||
verbose_name=_('Name'),
|
||||
linkify=True
|
||||
@@ -27,7 +27,7 @@ class TunnelGroupTable(NetBoxTable):
|
||||
url_name='vpn:tunnelgroup_list'
|
||||
)
|
||||
|
||||
class Meta(NetBoxTable.Meta):
|
||||
class Meta(OrganizationalModelTable.Meta):
|
||||
model = TunnelGroup
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'tunnel_count', 'description', 'slug', 'tags', 'actions', 'created', 'last_updated',
|
||||
@@ -35,7 +35,7 @@ class TunnelGroupTable(NetBoxTable):
|
||||
default_columns = ('pk', 'name', 'tunnel_count', 'description')
|
||||
|
||||
|
||||
class TunnelTable(TenancyColumnsMixin, NetBoxTable):
|
||||
class TunnelTable(TenancyColumnsMixin, PrimaryModelTable):
|
||||
name = tables.Column(
|
||||
verbose_name=_('Name'),
|
||||
linkify=True
|
||||
@@ -57,14 +57,11 @@ class TunnelTable(TenancyColumnsMixin, NetBoxTable):
|
||||
url_params={'tunnel_id': 'pk'},
|
||||
verbose_name=_('Terminations')
|
||||
)
|
||||
comments = columns.MarkdownColumn(
|
||||
verbose_name=_('Comments'),
|
||||
)
|
||||
tags = columns.TagColumn(
|
||||
url_name='vpn:tunnel_list'
|
||||
)
|
||||
|
||||
class Meta(NetBoxTable.Meta):
|
||||
class Meta(PrimaryModelTable.Meta):
|
||||
model = Tunnel
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'group', 'status', 'encapsulation', 'ipsec_profile', 'tenant', 'tenant_group',
|
||||
|
||||
Reference in New Issue
Block a user