Add 'utilization' field to IPRangeSerializer
NetBox version
v3.7.4
Feature type
Change to existing functionality
Proposed functionality
Show the "utilization" field in the API response for IPRange
Use case
Allowing users to keep track of IP Range utilization via API
Database changes
None
External dependencies
None
Code already existing at https://github.com/netbox-community/netbox/commit/6f4e16d25a401a7ec1ee0f6c302f7c518a24365a
Waiting to be assigned this issue to create a PR
It is not sufficient to merely add the utilization field to the serializer, or this would have already been done. As it stands, your change would effect a new database query to fetch all the IP addresses for each individual IP range returned in an API response. (Take a look at the utilization property defined on the IPRange mode.) This would substantially degrade performance.
This is somewhat similar to #7845, but might be doable by annotating the count of IP addresses for each range on the queryset. @icovada would you like to own that work?