lopes / netbox-scanner

A scanner util for NetBox
MIT License
164 stars 39 forks source link

Check for existing IP´s in netbox in sync_network #5

Closed roterschnee closed 5 years ago

roterschnee commented 5 years ago

Instead of looping over every not found IP in the specified Network (could be quite a lot in a for e.g. /16 scenario) and checking with the netbox api for existence, download a complete list of all IP´s in netbox and check locally, thus minimising the API requests and speeding things up a lot. In my case a /16 net was causing an hour long delay and is now down to sub 1 second.

lopes commented 5 years ago

You're totally right: the amount of memory used to store locally all IP addresses and process the delete routine is quite low. Doing one request per IP address is much more slower. Thank you so much for your contribution.