Iblox API

A Python Module for interacting with the Infoblox WAPI. The module supports auth sessions via the requests module as well as numerous shortcuts for manipulating objects within Infoblox.

class iblox.Infoblox(uri, username=None, password=None, verify_ssl=False)[source]

Create a new instance of the Infoblox WAPI Object

Parameters:
  • uri – Full url to the Infoblox WAPI
  • username – Infoblox User with API Access
  • password – Password for Infoblox User
  • verify_ssl – Verify SSL Certificate
Returns:

Infoblox Object

Property view:

The DNS view to add objects to (default == ‘default’)

add(**kwargs)[source]

Add a record of a given type to Infoblox via the WAPI

Parameters:kwargs – key/value parameters
Returns:string of _return_type (json or xml)
add_alias(fqdn, alias)[source]

Shortcut for adding an alias/CNAME to a given host record

Parameters:
  • fqdn – Fully Qualified Domain Name of the host
  • alias – A fqdn name (or list of fqdns) to add as aliases/CNAMES
Returns:

string of _return_type (json or xml)

add_host(fqdn, ipaddr, **kwargs)[source]

Shortcut for adding a host record with an iPV4 address

Parameters:
  • fqdn – Fully Qualified Domain Name of the host to add
  • ipaddr – IPV4 address of the host (can be a list of ipv4 addresses)
  • kwargs – Key/Value dictionary of any extra options to add to host record
Returns:

string of _return_type (json or xml)

add_host_ip(fqdn, ipaddr)[source]

Shortcut for adding an ip to a given host

Parameters:
  • fqdn – Fully Qualified Domain name of the host
  • ipaddr – IPV4 address of the host (can be a list of ipv4 addresses)
Returns:

Modified host record

call(ref, func, **kwargs)[source]

Call a specific function on a given object

Parameters:
  • ref – The _ref of the object
  • func – The function to call
  • kwargs – Data to be passed to the function
Returns:

String of _return_type(json or xml)

delete(ref, **kwargs)[source]

Delete a record in Infoblox based on its _ref id.

Parameters:
  • ref – Reference id for a given object
  • kwargs – key/value parameters
Returns:

string of _return_type (json or xml)

delete_alias(fqdn, alias)[source]

Shortcut for adding an alias/CNAME to a given host record

Parameters:
  • fqdn – Fully Qualified Domain Name of the host
  • alias – The fqdn of the alias (or list of fqdns) you wish to remove
Returns:

string of _return_type (json or xml)

get(**kwargs)[source]

Query the Infoblox WAPI

Query the Infoblox WAPI for records of a specific type (with or without regular expressions) OR Query the Infoblox WAPI for a specific record by its _ref

Parameters:kwargs – Key/Value parameters
Returns:string of _return_type (json or xml)
get_host(**kwargs)[source]

Shortcut for finding host records

Parameters:kwargs – Can contain dictionary of data to search for or _ref of specific record
Returns:string of _return_type (json or xml)
get_host_by_ip(ipaddr)[source]

Shortcut for finding a host record by its primary IPV4 address

Parameters:ipaddr – IPV4 address
Returns:string of _return_type (json or xml)
get_host_by_name(fqdn)[source]

Shortcut for finding a host record by its fully qualified domain name

Parameters:fqdn – Fully Qualified Domain Name
Returns:string of _return_type (json or xml)
modify(ref, **kwargs)[source]

Modify/Update an existing object

Parameters:
  • ref – The _ref id of the object to update
  • kwargs – key/value parameters
Returns:

string of _return_type (json or xml)

verify(**kwargs)[source]

Private method for verifying the named argument data and preparing it for a wapi call

Note

Key modifiers will also be fixed if the key ends in one of the following strings:

  • _plus = +
  • _regex = ~
  • _notequal = !
  • _ignorecase = :
  • _lessthan = <
  • _greaterthan = >
Parameters:kwargs – key/value pairs
Returns:Dictionary ready for wapi call
iblox.ipv4addr_obj(ipaddr, **kwargs)[source]

Create a new IPv4 Address dictionary

Parameters:
  • ipaddr – ipv4 address
  • kwargs – key/value options for ipv4addr object
Returns:

ipvraddr dictionary with default values