Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#17542 contact assignment to vpn tunnels #18491

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions netbox/vpn/models/tunnels.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.utils.translation import gettext_lazy as _

from netbox.models import ChangeLoggedModel, OrganizationalModel, PrimaryModel
from netbox.models.features import CustomFieldsMixin, CustomLinksMixin, TagsMixin
from netbox.models.features import CustomFieldsMixin, CustomLinksMixin, TagsMixin, ContactsMixin
from vpn.choices import *

__all__ = (
Expand All @@ -16,7 +16,7 @@
)


class TunnelGroup(OrganizationalModel):
class TunnelGroup(ContactsMixin, OrganizationalModel):
"""
An administrative grouping of Tunnels. This can be used to correlate peer-to-peer tunnels which form a mesh,
for example.
Expand All @@ -27,7 +27,7 @@ class Meta:
verbose_name_plural = _('tunnel groups')


class Tunnel(PrimaryModel):
class Tunnel(ContactsMixin, PrimaryModel):
name = models.CharField(
verbose_name=_('name'),
max_length=100,
Expand Down
10 changes: 10 additions & 0 deletions netbox/vpn/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,15 @@ class TunnelGroupBulkDeleteView(generic.BulkDeleteView):
table = tables.TunnelGroupTable


@register_model_view(Tunnel, 'contacts')
class TunnelGroupContactsView(ObjectContactsView):
queryset = TunnelGroup.objects.all()

#
# Tunnels
#


@register_model_view(Tunnel, 'list', path='', detail=False)
class TunnelListView(generic.ObjectListView):
queryset = Tunnel.objects.annotate(
Expand Down Expand Up @@ -132,10 +137,15 @@ class TunnelBulkDeleteView(generic.BulkDeleteView):
table = tables.TunnelTable


@register_model_view(Tunnel, 'contacts')
class TunnelContactsView(ObjectContactsView):
queryset = Tunnel.objects.all()

#
# Tunnel terminations
#


@register_model_view(TunnelTermination, 'list', path='', detail=False)
class TunnelTerminationListView(generic.ObjectListView):
queryset = TunnelTermination.objects.all()
Expand Down