Infoblox-Development / Infoblox-API-Python

Implements the subset of Infoblox API via REST API
Apache License 2.0
90 stars 59 forks source link

next_available_network #17

Closed pavanrsalibindla closed 8 years ago

pavanrsalibindla commented 8 years ago

Below is the error msg when i try using next_availabe_network

from python cmd: ip = iba_api.get_next_available_network('172.16.1.0','30') print ip

Output: Can not find requested number of networks

from API: https://192.168.10.150/wapi/v1.6/networkcontainer/ZG5zLm5ldHdvcmtfY29udGFpbmVyJDE3Mi4xNi4xLjAvMjQvMA:172.16.1.0/24/default?_function=next_available_network&cidr=30

response: { "Error": "AdmConProtoError: Function next_available_network illegal with this method", "code": "Client.Ibap.Proto", "text": "Function next_available_network illegal with this method" }

Below are the network available in 172.16.1.0/24 network [u'172.16.1.0/30', u'172.16.1.4/30', u'172.16.1.8/30', u'172.16.1.12/30', u'172.16.1.16/30', u'172.16.1.20/30', u'172.16.1.24/30', u'172.16.1.28/30', u'172.16.1.32/30', u'172.16.1.36/30', u'172.16.1.40/30', u'172.16.1.44/30', u'172.16.1.48/30', u'172.16.1.52/30', u'172.16.1.56/30', u'172.16.1.60/30', u'172.16.1.64/30', u'172.16.1.68/30', u'172.16.1.72/30', u'172.16.1.76/30', u'172.16.1.80/30', u'172.16.1.84/30', u'172.16.1.88/30', u'172.16.1.92/30', u'172.16.1.96/30', u'172.16.1.100/30', u'172.16.1.104/30', u'172.16.1.108/30', u'172.16.1.112/30', u'172.16.1.116/30', u'172.16.1.120/30', u'172.16.1.124/30', u'172.16.1.128/30', u'172.16.1.132/30', u'172.16.1.136/30', u'172.16.1.140/30', u'172.16.1.144/30', u'172.16.1.148/30', u'172.16.1.152/30', u'172.16.1.156/30', u'172.16.1.160/30', u'172.16.1.164/30', u'172.16.1.168/30', u'172.16.1.172/30', u'172.16.1.176/30', u'172.16.1.180/30', u'172.16.1.184/30', u'172.16.1.188/30', u'172.16.1.192/30', u'172.16.1.196/30', u'172.16.1.200/30', u'172.16.1.204/30', u'172.16.1.208/30', u'172.16.1.212/30', u'172.16.1.216/30', u'172.16.1.220/30', u'172.16.1.224/30', u'172.16.1.228/30', u'172.16.1.232/30', u'172.16.1.236/30', u'172.16.1.240/30', u'172.16.1.244/30', u'172.16.1.248/30', u'172.16.1.252/30']

jauling commented 8 years ago

Hi @strap16,

First param should also be CIDR, so use '172.16.1.0/24'. If you're looking for a /30 network, then 2nd param is as you wrote, '30'. Should work.

pavanrsalibindla commented 8 years ago

@jauling I dont think there is problem with code, but the parameter that i am passing is having issues. "Can not find requested number of networks" -- I dont know what does it mean.

is possible to give me an share example. I am trying to get the next available /30 network in /24 network container. Is it possible to do it ?.

screen shot 2016-04-07 at 9 15 44 am
jauling commented 8 years ago

I never said there was a problem with the code. I told you the first parameter should be CIDR! You are not passing correct parameters!

Do this, this will work:

ip = iba_api.get_next_available_network('172.16.1.0/24','30')
print ip