Skip to main content

pyinfoblox - Infoblox WAPI module for Python

Latest Version Downloads

pyinfoblox is a Python module for interfacing with the Infoblox WAPI.

For more information about the Infoblox WAPI, please refer to the Infoblox WAPI documentation.

pyinfoblox is Open Source and licensed under the BSD License.

Requirements

Contributions

pyinfoblox is hosted on Github. Please contribute by reporting issues, suggesting features or by sending patches using pull requests.

Installation

The easiest way to install pyinfoblox is by using pip:

$ pip install pyinfoblox

In order to install the latest version of pyinfoblox from the Github repository simply execute these commands instead:

$ git clone https://github.com/dnaeon/pyinfoblox.git
$ cd pyinfoblox
$ python setup.py install

Examples

The first thing we do when using pyinfoblox is to instantiate a new InfobloxWAPI object.

>>> from __future__ import print_function
>>> from pyinfoblox import InfobloxWAPI
>>> infoblox = InfobloxWAPI(
...     username='admin',
...     password='p4ssw0rd',
...     wapi='https://localhost/wapi/v1.1/'
... )

Getting Infoblox networks is as easy as doing:

>>> networks = infoblox.network.get()
>>> print(networks)

Getting a specific network in Infoblox is easy too:

>>> network = infoblox.network.get(network='192.168.1.0/24')
>>> print(network)

Another example that will get all Infoblox ipv4address objects.

>>> ipv4address = infoblox.ipv4address.get()
>>> print(ipv4address)

Here is how to create a new Infoblox network:

>>> objref = infoblox.network.create(
...     network='192.168.1.0/24',
...     comment='This is my test network'
... )
>>> print(objref)
u'network/ZG5zLm5ldHdvcmskMTkyLjE2OC4xLjAvMjQvMA:192.168.1.0/24/default'

Creating new objects returns a reference to the newly created object in Infoblox.

We can also update objects. When we update objects in Infoblox we need to pass the object reference as well. This is how we can update the network we created in the previous example

>>> infoblox.network.update(
...     objref='network/ZG5zLm5ldHdvcmskMTkyLjE2OC4xLjAvMjQvMA:192.168.1.0/24/default',
...     comment='This is my updated network'
... )
u'network/ZG5zLm5ldHdvcmskMTkyLjE2OC4xLjAvMjQvMA:192.168.1.0/24/default'
>>> network = infoblox.network.get(network='192.168.1.0/24')
>>> print(network[0]['comment'])
This is my updated network

When we no longer need an Infoblox object we can always remove it. Just make sure to pass the object reference when deleting objects.

>>> infoblox.network.delete(
...     objref='network/ZG5zLm5ldHdvcmskMTkyLjE2OC4xLjAvMjQvMA:192.168.1.0/24/default'
... )
u'network/ZG5zLm5ldHdvcmskMTkyLjE2OC4xLjAvMjQvMA:192.168.1.0/24/default'

As a last example we will see how to call functions on Infoblox objects.

Here is how to call the next_available_ip function on a network object in order to get the next 3 available IP addresses:

>>> infoblox.network.function(
...     objref='network/ZG5zLm5ldHdvcmskMTkyLjE2OC4xLjAvMjQvMA:192.168.1.0/24/default',
...     _function='next_available_ip',
...     num=3
... )
{u'ips': [u'192.168.1.21', u'192.168.1.22', u'192.168.1.23']}

This example below calls the restartservices function on a grid object:

>>> from __future__ import print_function
>>> from pyinfoblox import InfobloxWAPI
>>> infoblox = InfobloxWAPI(
...     username='admin',
...     password='p4ssw0rd',
...     wapi='https://localhost/wapi/v1.1/'
...)
>>> grids = infoblox.grid.get()
>>> print(grids)
[{'_ref': 'grid/b25lLmNsdXN0ZXIkMA:com'}]
>>> grid = grids[0]['_ref']
>>> infoblox.grid.function(
...     objref=grid,
...     _function='restartservices',
...     member_order='SEQUENTIALLY',
...     restart_option='RESTART_IF_NEEDED',
...     sequential_delay=10,
...     service_option='ALL'
...)

Metadata

Release files for pyinfoblox 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyinfoblox 0.1.5
File Size Uploaded
pyinfoblox-0.1.5.tar.gz 4.8 kB Details

Release files / pyinfoblox-0.1.5.tar.gz

Download URL pyinfoblox-0.1.5.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
88b48a2eb482ddf5eedc850b014d9fc16f04e1b2133891f7e1118894e06bf226
BLAKE2b-256 checksum
How to use checksums
9db361bc73e7e1709ce0afb41af1e3d767d1407d1310162a8bfa4e770864a671
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Release history Release notifications | RSS feed

This release

0.1.5 This release

1 release file

0.1.3

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page