You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This question is similar to #657 : given an existing IP range, I can easily ask for available IPs, but I can't find a way to retrieve the IP objects that actually exist (i.e. the ones that are not available).
nb.ipam.ip_addresses.filter can filter on parent prefixes, but not ranges, and yet the NetBox UI does know that an IP is in a range (see https://<netbox url>/ipam/ip-ranges/<range id>/ip-addresses/).
The best I can think of doing is very convoluted... something like:
list available IPs in the range
use netaddr to list all possible IPs in the range (both available and unavailable ones)
calculate the difference between the full list and the IPs that are still available
lookup the VRF of the range
calculate the smallest prefix that would contain all the existing IPs
query the API filtering on parent prefix and VRF
exclude the results that are beyond the boundaries of the original range
There has to be a better way to retrieve those objects...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This question is similar to #657 : given an existing IP range, I can easily ask for available IPs, but I can't find a way to retrieve the IP objects that actually exist (i.e. the ones that are not available).
nb.ipam.ip_addresses.filter
can filter on parent prefixes, but not ranges, and yet the NetBox UI does know that an IP is in a range (seehttps://<netbox url>/ipam/ip-ranges/<range id>/ip-addresses/
).The best I can think of doing is very convoluted... something like:
There has to be a better way to retrieve those objects...
Beta Was this translation helpful? Give feedback.
All reactions