Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
is there an option to search all ip4 addresses with an specific Extensible
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2022 11:46 PM
870     0
Hi,
we need to have a search option for all IPv4 address with a certain extensible attribute. I have tried this example which is in the infoblox_client readme:
def search_extensible_attribute(connection, place_to_check: str, extensible_attribute: str, value: str): """ Find extensible attributes. :param connection: Infoblox connection :param place_to_check: Can be `network`, `networkcontainer` or `record:host` and so on. :param extensible_attribute: Which extensible attribute to search for. Can be `CustomerCode`, `Location` and so on. :param value: The value you want to search for. :return: result """ extensible_args = [ place_to_check, { f"*{extensible_attribute}:~": value, } ] kwargs = { 'return_fields': [ 'default', 'extattrs', ] } result = {"type": f"{place_to_check}", "objects": connection.get_object(*extensible_args, **kwargs)} return result
and this is working fine for "networks", or "record:host" type of objects but when I use it to search for "ipv4address" I am gettin the following error:
Failed on object search with url https://<fqdn>/wapi/v2.11.2/ipv4address?%2AGROUPUUID%3A~=12345678-12345678-12345678&_return_fields%2B=extattrs&_paging=1&_return_as_object=1&_max_results=1000: b'{ "Error": "AdmConDataError: None (IBDataError: IB.Data:Search fields must contain a parent member or network view.)", \n "code": "Client.Ibap.Data", \n "text": "Search fields must contain a parent member or network view."\n}'
I also tried to include &network_view=<view> in the search but this gives this error:
{ "Error": "AdmConProtoError: When searching by network_view one of\"ip_address\\", \\"network\\" must also be searched on", \n "code": "Client.Ibap.Proto", \n "text": "When searching by network_view one of \\"ip_address\\", \\"network\\" must also be searched on"\n}'
any idea's if this type of search is possible with the infoblox_client?