Learn How We Can Help You Keep Teleworkers Protected During the COVID-19 Crisis

API & Integration

Reply
Highlighted
Accepted Solution

Get all instances of an EA on all networks

Authority
Posts: 31
7196     0

Is there a way to get all instances of an EA, regardless of network?  I'm trying to link between our CMDB, which has a circuit ID, and Infoblox IPAM, which has an EA called Circuit_Id.  I can get that information if I know what subnet to look in with this curl request:

 

curl -k1 -u brownlb -X GET https://192.168.238.98/wapi/v2.0/ipv4address  -d 'network=x.x.x.x/24' -d *Circuit_id=322441 -d _return_fields=extattrs

 

But I haven't figured out how to get all instances of a circuit ID in IPAM, regardless of network.  An individual circuit could conceivably be on at least three different subnets...possibly more.  If I remove the reference to a subnet that I already know the circuit id is on, I get this:

 

curl -k1 -u brownlb -X GET https://192.168.238.98/wapi/v2.0/ipv4address  -d *Circuit_id=322441 -d _return_fields=extattrs
{ "Error": "AdmConDataError: None (IBDataError: IB.Data:Search fields must contain a parent member or network view.)",
  "code": "Client.Ibap.Data",
  "text": "Search fields must contain a parent member or network view."
}

Can I define "all networks" somehow?

 

Thanks!

Blair

Highlighted

Re: Get all instances of an EA on all networks

Community Manager
Community Manager
Posts: 152
7196     0

What record type are you storing the circuit ID on? Are they always the same type?  You can search for just that record type, and filter matches to just the results with that EA value.

 

For example, if they're always fixed addresses or reservations, try this search:

 

curl -k1 -u brownlb -X GET https://192.168.238.98/wapi/v2.0/fixedaddress  -d *Circuit_id:=322441 -d _return_fields%2b=extattrs

 

I might reccomend using := instead of =, to do a case-insensitive search.

 

Also I migh reccomend using %2b= instead of =, to return the normal fields like IP address, in addition to the EA fields.

Highlighted

Re: Get all instances of an EA on all networks

Authority
Posts: 31
7196     0

Thanks, MRichard.

 

fixedaddress won't work for me because we're not doing DHCP at all, but I'm looking through the other objects to see if there are any others that might work.  Otherwise, I think I might be looping through the network containers.

 

Thanks!

Blair

Highlighted

Re: Get all instances of an EA on all networks

[ Edited ]
Community Manager
Community Manager
Posts: 152
7196     0

A DHCP Reservation is the same thing as a DHCP Fixed Address but the MAC address is all zeros.  They're treated as a Reservation in the GUI, but with CSV and with API, both are referenced as a "fixedaddr".

 

DHCP Reservations & Fixed Addresses can be used as a placeholder object type, where you can store information.  You can keep names, addresses, comments, and extensible attributes.  You can use the MAC address of all zeros (00:00:00:00:00:00) and it becomes a DHCP reservation in the GUI.

 

DHCP services are not required, however DHCP Reservations & Fixed Addresses must be stored in a network, they cannot be stored directly in a network container or without a network to hold them.

 

If you're still planning your deployment, I'd reccomend using reservations.

 

Best,

Matt

Highlighted

Re: Get all instances of an EA on all networks

[ Edited ]
Authority
Posts: 31
7196     0

Let me first of all apologize for the delay...Obviously I'm not getting to work on this as much as I need to be able to. :-/

 

I'm not sure I follow the reservation and fixed address logic.  The addresses I'm talking about are addresses that truly are in use, and thus have a Circuit_id EA associated with them.  The same Circuit_id could be on any number of IP addresses.  Storing the data isn't the problem, but actually finding the IPs in a reasonable time frame is.

 

I'm able to search each container by using this URL:

https://x.x.x.x/wapi/v2.0/ipv4address?network=x.x.x.x/19&*Circuit_id=556023&_return_fields=ip_address

 

I iterated through each of our 17 top-level containers and it took 10 minutes to find all the IPs with the 556023 Circuit_id.  There are 5 total, and they're all in the same container, but that won't always be the case.

 

Is there something I can do to speed that up?

 

Thanks,

Blair

Highlighted

Re: Get all instances of an EA on all networks

Community Manager
Community Manager
Posts: 152
7196     0

What object type aere the circuit IDs stored in?  Search for just that object type, and filter by the EA values instead of by the network.

 

 

Highlighted

Re: Get all instances of an EA on all networks

Authority
Posts: 31
7196     0

If I search for the object type with this call:

https://192.168.238.98/wapi/v2.0/ipv4address?*Circuit_id=12345&_return_fields=ip_address

I get this error:

 

{ "Error": "AdmConDataError: None (IBDataError: IB.Data:Search fields must contain a parent member or network view.)", 
  "code": "Client.Ibap.Data", 
  "text": "Search fields must contain a parent member or network view."
}

 

 

If I include the network view name like this:

https://192.168.238.98/wapi/v2.0/ipv4address?network_view=default&*Circuit_id=12345&_return_fields=i...

I get this:

 

{ "Error": "AdmConProtoError: When searching by network_view one of \"ip_address\", \"network\" must also be searched on", 
  "code": "Client.Ibap.Proto", 
  "text": "When searching by network_view one of \"ip_address\", \"network\" must also be searched on"
}

 

 

The error makes it sound like you have to define the network...which puts me back to iterating through all the networks and takes way too long.

Highlighted

Re: Get all instances of an EA on all networks

Community Manager
Community Manager
Posts: 152
7196     0

You still haven't answered my very first question.  What object type are the EAs stored on?  Search for that object type, not for all addresses.

 

If you're not sure how to figure that out, please post the results from a search that works properly, and I can assist.

Highlighted

Re: Get all instances of an EA on all networks

Authority
Posts: 31
7196     0

Sorry, I thought ipv4address *was* the object type.

 

Here's all the output from a single IP:

<value type="object">
<status>USED</status>
<network>2.2.2.0/24</network>
<network_view>default</network_view>
<usage>
<list/>
</usage>
<objects>
<list>
<value>
record:host/ZG5zLmhvc3QkLm5vbl9ETlNfaG9zdF9yb290LjAuMTQ5NDUzNzgzNzg0OS5teW5hbWU:myname/%20
</value>
</list>
</objects>
<is_conflict type="boolean">false</is_conflict>
<mac_address/>
<types>
<list>
<value>HOST</value>
</list>
</types>
<_ref>
ipv4address/Li5pcHY0X2FkZHJlc3MkMi4yLjIuMS8w:2.2.2.1
</_ref>
<ip_address>2.2.2.1</ip_address>
<names>
<list>
<value>myname</value>
</list>
</names>
</value>
Highlighted

Re: Get all instances of an EA on all networks

Community Manager
Community Manager
Posts: 152
7196     0

Darn... the documentation actually calls it an object.    Yeah it's what they should probably call a "meta-object", it's not really an object on it's own.  It sometimes acts like one but it really belongs to the the network or host object that contains it.

 

Try it like this:

 

curl -k1 -u admin:infoblox -X GET 'https://192.168.1.2/wapi/v2.0/record:host' -d *Circuit_id:=322441 -d _return_fields%2b=extattrs

 

it will return all host records with that EA value.

 

My concern here, is if there are other record types such as fixedaddrs with also have the EA defined.  It would take another search for fixedaddrs also.  But it would still be better than searching through each network.

Highlighted

Re: Get all instances of an EA on all networks

Authority
Posts: 31
7197     0

Oooh, I like it!  That's significantly faster...almost instantaneous!  I think I'm on the right path now.  Thank you very much for your help!

Showing results for 
Search instead for 
Do you mean 

Recommended for You