Are you interested in our Early Access Program (EAP)? This program allows you to preview code, test in your lab and provide feedback prior to General Availability (GA) release of all Infoblox products. If so, please click the link here.

API & Integration, DevOps,NetOps,SecOps

Reply

is there an option to search all ip4 addresses with an specific Extensible

Techie
Posts: 6
101     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?

Showing results for 
Search instead for 
Did you mean: 

Recommended for You