From 7401fd70501d9431f7f8624455dde59db8f5802e Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 14 Nov 2022 10:40:48 -0800 Subject: [PATCH] 10909 add l2vpn to tenant stats --- netbox/templates/tenancy/tenant.html | 6 ++++++ netbox/tenancy/views.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/netbox/templates/tenancy/tenant.html b/netbox/templates/tenancy/tenant.html index e8dc4b23a..7d2ff0149 100644 --- a/netbox/templates/tenancy/tenant.html +++ b/netbox/templates/tenancy/tenant.html @@ -93,6 +93,12 @@

{{ stats.vlan_count }}

VLANs

+ +
+

{{ stats.l2vpn_count }}

+

L2VPNs

+
+

{{ stats.circuit_count }}

Circuits

diff --git a/netbox/tenancy/views.py b/netbox/tenancy/views.py index d8b810ad9..03b454321 100644 --- a/netbox/tenancy/views.py +++ b/netbox/tenancy/views.py @@ -4,7 +4,7 @@ from django.shortcuts import get_object_or_404 from circuits.models import Circuit from dcim.models import Cable, Device, Location, Rack, RackReservation, Site -from ipam.models import Aggregate, IPAddress, IPRange, Prefix, VLAN, VRF, ASN +from ipam.models import Aggregate, IPAddress, IPRange, L2VPN, Prefix, VLAN, VRF, ASN from netbox.views import generic from utilities.utils import count_related from virtualization.models import VirtualMachine, Cluster @@ -111,6 +111,7 @@ class TenantView(generic.ObjectView): 'iprange_count': IPRange.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'ipaddress_count': IPAddress.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'vlan_count': VLAN.objects.restrict(request.user, 'view').filter(tenant=instance).count(), + 'l2vpn_count': L2VPN.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'circuit_count': Circuit.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'virtualmachine_count': VirtualMachine.objects.restrict(request.user, 'view').filter(tenant=instance).count(), 'cluster_count': Cluster.objects.restrict(request.user, 'view').filter(tenant=instance).count(),