From 16a3d1339a2a0fb7e7d3e85eeda44902715cb5cb Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 8 Mar 2021 15:57:17 -0500 Subject: [PATCH] Closes #5592: Add IP addresses count to VRF view --- docs/release-notes/version-2.10.md | 1 + netbox/ipam/views.py | 2 ++ netbox/templates/ipam/vrf.html | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/docs/release-notes/version-2.10.md b/docs/release-notes/version-2.10.md index 79b0d29b7..2996bdf96 100644 --- a/docs/release-notes/version-2.10.md +++ b/docs/release-notes/version-2.10.md @@ -4,6 +4,7 @@ ### Enhancements +* [#5592](https://github.com/netbox-community/netbox/issues/5592) - Add IP addresses count to VRF view * [#5630](https://github.com/netbox-community/netbox/issues/5630) - Add QSFP+ (64GFC) FibreChannel Interface option * [#5884](https://github.com/netbox-community/netbox/issues/5884) - Enable custom links for device components diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py index 39a840f7f..a43baa2a1 100644 --- a/netbox/ipam/views.py +++ b/netbox/ipam/views.py @@ -30,6 +30,7 @@ class VRFView(generic.ObjectView): def get_extra_context(self, request, instance): prefix_count = Prefix.objects.restrict(request.user, 'view').filter(vrf=instance).count() + ipaddress_count = IPAddress.objects.restrict(request.user, 'view').filter(vrf=instance).count() import_targets_table = tables.RouteTargetTable( instance.import_targets.prefetch_related('tenant'), @@ -42,6 +43,7 @@ class VRFView(generic.ObjectView): return { 'prefix_count': prefix_count, + 'ipaddress_count': ipaddress_count, 'import_targets_table': import_targets_table, 'export_targets_table': export_targets_table, } diff --git a/netbox/templates/ipam/vrf.html b/netbox/templates/ipam/vrf.html index d17f8e9b9..79360f1a2 100644 --- a/netbox/templates/ipam/vrf.html +++ b/netbox/templates/ipam/vrf.html @@ -95,6 +95,12 @@ {{ prefix_count }} + + + IP Addresses + + {{ ipaddress_count }} +