07-22-2014 05:10 PM
07-30-2014 10:38 AM
I skimmed through the code for this on Github. This looks very nice: a comprehensive set of methods, good use of the requests module, and lots of error handling. I think it would also serve as a good guide to people looking to learn how the Infoblox API works with Python, even if they end up not using the code as-is.
My one question: Are you planning to write any unit tests for this code? Besides whatever use they would be in keeping the code up to date, I think they could also be useful to people looking to confirm that their own API setup was working correctly. (For example, that they are using the right API version, that the userid has the proper permissions, and so on.)
07-30-2014 03:21 PM
We actually use this code in a couple of projectcs in the company. I just finally got some time to shape it a bit and put some more methods which we plan to use in the future. All methods are tested. I'll publish an intergration with OpenStack. Will publish URL here as well. Hopefully we will upgrade our IBA's soon so I have a chance to put a new code to deal with race conditions for get_next_available_ip.
07-30-2014 05:28 PM
Integration with OpenStack
We use this code in our OpenStack dev environment to develop, test, and maintain our cloud images so we can utilize Horizon dashboard for image tests.
08-05-2014 07:11 AM
Great code! Thanks for posting for all to use! I'm getting a JSON error...can anyone point me in the right direction?
[root@swack-redhat Infoblox-API-Python]# python -V
[root@swack-redhat Infoblox-API-Python]# cat swack1.py
iba_api = infoblox.Infoblox('infoblox', 'srvinfoblox', [snip], '1.0', 'internal', 'default', False)
host = iba_api.get_host_by_ip('172.20.19.10')
except Exception as e:
[root@swack-redhat Infoblox-API-Python]# python swack1.py
No JSON object could be decoded
08-07-2014 09:35 AM
Most likely authentication problem or WAPI version is not matching.
Try to add ValueError exception in infoblox.py in get_host_by_ip method. The method code should be ending like the following:
If you see <Response > - this is an authentication issue
If it's <Response > - most likely WAPI version issue. Look which WAPI your IBA supports an use that one.
Meantime, I'll fix exceptions in github code to catch JSON ValueError exception.
04-17-2015 12:46 PM
i have the following:
iba_api = infoblox.Infoblox('gridmaster.uncc.edu', 'user', 'password', '2.0', 'internal', 'default')
try: ip_v4 = iba_api.get_host_by_ip('10.18.0.10') print ip_v4
Looking in infoblox.py it looks like 'names' should be returning the hostnames associated to the ip address. Should my "print ip_v4" be returning the hostnames? If not, what value should I print to see the returned hostname(s)?
I'm very new to Python and APIs.
Two months since the last post and not a peep, not even a cursory "good lock on getting an answer" comment by an Infoblox employee.
Infoblox, you need to improve your customer support. You have a great product but you're going to kill yourself as a company with bad customer support.
[Did this get anyone's attention?]
06-09-2015 11:24 AM
Apologies for the delay in responding. Note that these forums aren't intended as a replacement for the formal Infoblox customer support mechanism (at support.infoblox.com). I can't speak for other Infoblox employees who participate in the forums, but I respond to questions in my spare time because I like answering questions; my actual job is working with our US government customers.
In any case your question is about the infoblox.py code created by Igor Feoktistov, who is not an Infoblox employee. (So in this case at least Infoblox support would not have been able to help.) I haven't used his code myself (which is one reason I didn't comment on your question when you posted it), but from looking at the original source it appears that the function get_host_by_ip() should return an array of hostnames, so printing that returned value should get you something like
['host1.example.com', 'host2.example.com', 'host3.example.com']
assuming that there are three hosts associated with the IP address in question.
Are you not seeing that, or are you seeing an error message of some sort? If you can post the complete source of your program and its output I'd be glad to take a look at it. (Or perhaps Igor is still reading the forums and can respond.)
06-09-2015 12:53 PM
OK, I was able to get a version of your code running on my own lab grid. Here's what I did:
First, I downloaded a copy of Igor Feoktistov's infoblox.py program from https://raw.githubusercontent.com/Infoblox-Development/Infoblox-API-Python/master/infoblox.py and saved it into a file
Next I created a separate file
example.py in the same directory, containing the following code:
import infoblox iba_api = infoblox.Infoblox('gm.example.com', 'admin', 'infoblox', '2.1', 'internal', 'default', False) try: hosts = iba_api.get_host_by_ip('192.168.0.3') print hosts except Exception as e: print e
Then I ran the example code:
It produced the following output:
In this case I had two host records defined, one for "host1.example.com" and one for "host2.example.com", both pointing to the IP address 18.104.22.168. If I had only one host record defined for that IP address (the usual case) then the program would have printed the following:
(The "u" characters in front of the hostnames mean that they are Unicode strings, i.e., they could contain non-ASCII characters. Also, to print the first hostname in the array you can refer to
One major difference from your code is that I added a final parameter
False to the call to
get_hosts_by_ip(). This tells the function that you don't want to verify the SSL certificate of the grid master you're connecting to. (This is the case for most Infoblox installations, since people generally don't bother to get and install real SSL certificates from a public CA.)