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
{{ message }}
Repository navigation
Search for IP address with given address and pagination #19
Hi! First of all, thanks for you library it is really awesome! Everything works nicely.
I'm making OpenStack to NetBox exporter and I want to check if IP address with given IP exists or not. I can obtain all ip addresses and then search if there is object with address same as one I obtain from OpenStack but I wonder if there is a way to search for IP with given address. It is not a big issue but requesting couple of thousands IP addresses and search in them is not so effective as one search query.
I tried NetboxClientRuby.ipam.ip_addresses.filter(address: '192.168.4.40/24') but it doesn't work for me.
Pagination also seems to be not documented(just one entry in example config file). It would be really nice to see an example code block about working with pagination IPAM module.
EDIT: Ok, in code I found out that you can use #all method to get all objects. But you need to remember to set your MAX_PAGE_SIZE to 0 in configuration.py in your NetBox installation if you want to get all objects at once from api.
Activity
[-]Search for IP address with given address[/-][+]Search for IP address with given address and pagination[/+]cimnine commentedon Jan 17, 2018
To work with the pagination, you can do:
limitandoffsetwork just like documented in netbox.pageis a convenience method, which just calculates the offset from the current (default) limit.cimnine commentedon Jan 17, 2018
As for this one:
You're using the API wrong.
In you browser, go to
http://YOUR_NETBOX/api/ipam/ip-addresses/?address=192.168.4.40/24. You'll see that all IPs you have in there are returned.But if you go to
http://YOUR_NETBOX/api/ipam/ip-addresses/?q=192.168.4.40/24instead, you'll see that only the one IP is returned.cimnine commentedon Jan 17, 2018
Btw, I'm sorry for the long response time. I did not see that someone opened an issue.