infoblox-client icon indicating copy to clipboard operation
infoblox-client copied to clipboard

Support searching host records by network CIDR

Open srgoni opened this issue 1 month ago • 0 comments

The Infoblox WAPI supports searching for host records by network CIDR in newer WAPI versions. This works much better than the regular-expression based suggestion from the infoblox-client documentation.

I seems like support for this would only require two changes:

  • Set the default WAPI version to 2.13 (maybe earlier, unclear) in https://github.com/infobloxopen/infoblox-client/blob/master/infoblox_client/connector.py#L119
  • Add 'network' to the list of searchable fields of HostRecord: https://github.com/infobloxopen/infoblox-client/blob/master/infoblox_client/objects.py#L14322

Newer WAPI versions may have other changes, please consider adding them as well.

As a workaround, the following approach may be used (note: needs some testing if the higher API level has unexpected side effects):

# initialize the connector with a newer WAPI version than the default
opts = {'host': '192.168.1.10', 'username': 'admin', 'password': 'admin', 'wapi_version': '2.13',}
conn = connector.Connector(opts)
# search for hosts by network CIDR
hosts = conn.get_object('record:host', {'network': '10.0.0.0/24'})

srgoni avatar Dec 08 '25 16:12 srgoni