How to exclude a range of ip addresses or how to select next available ip address within a range

I wanted to know if it was a way to use the API to either exclude IP addresses using a range instead of listing them one by one or is it a way to use next available ip and use a range. Currently I have something like the following:

Re: How to exclude a range of ip addresses or how to select next available ip address within a range

next_available_ip's exclude option only takes individual IP addresses. You could create a reserved range (a dhcp range not assigned to any appliances) in the network, and that range would not be available to the next_available_ip function.

Re: How to exclude a range of ip addresses or how to select next available ip address within a range

You could build an array to pass to the exclude parameter. If you know you want to exclude the first 10 IPs, then something like a for loop counting from 0 to 10 and appending each new counted number to the last octet and then append the full IP to the array.