Description
ISSUE TYPE
- Feature Idea
SUMMARY
Right now when the inventory plugin fetches the services and interfaces associated with devices and VMs, it does a separate request for each device's services and interfaces. In some circumstances it could be more efficient to just query for all interfaces and all services (similar to how everything else is queried) and then match them up with each device the whole list has been downloaded.
This method would be more efficient in the case where the entire contents of Netbox is wanted in the Ansible inventory. The down side of this would be if there are query_filters in place the limit what devices are required - there would be no way to filter the services or interfaces by device.
Right now I've got 2000 devices in Netbox, less than 1000 services defined, and 10,000 interfaces. And this is less than 10% of our current infrastructure - we're only getting started putting stuff into Netbox. This currently requires 4000 HTTP requests to get the services and interfaces of each device, when it could be achieved with just a couple of batch requests. I haven't even looked at what sort of server CPU and database load this creates.
Alternatively - should I make a request with the Netbox project to include returning interfaces and services as part of the main /dcim/devices/ query?
EXPECTED RESULTS
Fetching: https://netbox/api/ipam/services/?limit=0
ACTUAL RESULTS
Fetching: https://netbox/api/ipam/services/?device=HIL-01
Fetching: https://netbox/api/ipam/services/?device=HIL-02
Fetching: https://netbox/api/ipam/services/?device=HIL-03
Fetching: https://netbox/api/ipam/services/?device=HIL-04
Fetching: https://netbox/api/ipam/services/?device=HIL-05
Fetching: https://netbox/api/ipam/services/?device=HIL-06
Fetching: https://netbox/api/ipam/services/?device=HIL-07
Fetching: https://netbox/api/ipam/services/?device=HIL-08
...