Accepted Solution

Proper way to update a network

Posts: 31
3842     0

What is the proper way to update a network's EAs in IPAM?  


I know for a host, you have to delete and then readd it, but I've read somewhere on the forums or the documentation that networks are different in that way.  So I tried a PUT to modify it, and it failed in this way:


curl -k -u user:pw -H "Content-Type: application/json" -X PUT -d '[{"comment":"HPBX"}]'
{ "Error": "AdmConProtoError: Input is not an object",
"code": "Client.Ibap.Proto",
"text": "Input is not an object"


To prove that the network really does exist, I did a GET:

curl -k -u toolbox:tool@box  -X GET
        "_ref": "network/ZG5zLm5ldHdvcmskMTAuMTQyLjcxLjAvMjQvMA:",
        "network": "",
        "network_view": "default"



So I moved on to the delete/add method.  I can delete with no problem, but I can only POST if I have no EAs.

Here's where it works: 

curl -k -u user:pw -H "Content-Type: application/json" -X POST -d '{"network":""}'
"_ref": "network/ZG5zLm5ldHdvcmskMTAuMTQyLjcxLjAvMjQvMA:",
"extattrs": {
"Type": {
"inheritance_source": {
"_ref": "networkcontainer/ZG5zLm5ldHdvcmtfY29udGFpbmVyJDEwLjAuMC4wLzgvMA:"
"value": "Private"


And here's where it fails, when I add the Circuit_id EA to it, which is defined as an EA in the admin console:

curl -k -u user:pw  -H "Content-Type: application/json"  -X POST -d '[{"network": {"value": "\/24"},"extattrs": {"Circuit_id": {"value": 77867}}}]'
{ "Error": "AdmConProtoError: Multiple-object requests should be submitted to the \"request\" object only",
  "code": "Client.Ibap.Proto",
  "text": "Multiple-object requests should be submitted to the \"request\" object only"


That JSON validates in the last example, but it must not be what it's looking for.  That error doesn't make any sense.  The only "multiple" is where I added the EA to the JSON data.  But if I can't directly update a network (see first section in this post) and I can only have a single value in the JSON when I add a network, how am I supposed to add EAs to a network?  It's a catch-22, so I must be missing something!




Re: Proper way to update a network

Moderator BRampling
Posts: 69
3843     0

Here is an example that will update or add an EA on a network:


curl -k1 -u admin:infoblox -H "Content-Type: application/json" -X PUT -d '{"extattrs+":{"TestEA2":{"value":"Test String"}}}'

Pay close attention to that "extaddrs+" as that is what tells the WAPI to add or update the EA value. Without the + the entire set of EAs will be replaced with the one specified.


See the "Extensible attributes update" section of the WAPI help for more information.

Re: Proper way to update a network

Posts: 31
3843     0

Thank you!  Now I'm hopeful that that will make updating the ipv4addr's easier too! Smiley Happy

Re: Proper way to update a network

Posts: 41
3843     0

I have a related issue.  The WAPI guide gives this example as to how to search for networks that have an EA with a particular value:


GET /wapi/v2.5/network?*Building:='Data Center'

That's great and all but not exactly what I need.  Suppose I have a network object: 




I want to be able to retreive that object, and while doing so, also retrieve the values assigned to any/all extensible attributes for that network object. Now granted, for the most part,but network objects will not have many (if any) but over time, it's my intent to populate the object with valuable metadata, and update it upon occasion.  By update Imeant update one EA, not replace the whole shooting match with one new value.


I plan on using something like this:

ea =    { "zone":       { "value": ea_zone },
          "vrf":        { "value": ea_vrf },
          "vlan_id":    { "value": ea_vlan_id },
          "vlan_name":  { "value": ea_vlanname },
          "DHCP":       { "value": ea_dhcp },
          "usage":      { "value": ea_usage },
          "Lab Name":   { "value": ea_lab_name },
          "access_sw":  { "value": ea_switch },
          "legacy_vlan":{ "value": ea_legacy_vlan },
          "building":   { "value": ea_building },
          "tech":       { "value": ea_tech },
          "dept":       { "value": ea_dept },
          "fac_dept":   { "value": ea_fac_dept },
          "fac_owner":  { "value": ea_fac_owner },
          "floor":      { "value": ea_floor },
          "renewal_dt": { "value": ea_renewal_dt },
          "service":    { "value": ea_service },
          "site":       { "value": ea_site },
          "source":     { "value": ea_source }}

where some EAs will be mandatory going forward, but most will be optional.  In any case, I need to be able to read them in, make updates, and write them back out.


I've tried using 'extattrs' in the _return_fields: clause, but all I seem to get is _ref, address,/CIDR, view, and Comment.



{'_ref': 'network/ZG5zLm5ldHdvcmskMTAuMjAuMTAwLjAvMjQvMA:', 'comment': 'R10N Core Network Services-McLean', 'network': '', 'network_view': 'default'}

Re: Proper way to update a network

Moderator BRampling
Posts: 69
3843     0

This works for me to get all of the EAs assigned to the object:


curl -k1 -u admin:infoblox -H "Content-Type: appliction/json" -X GET -d '{"network":""}'

Note that the %2B is URL encoding for a +. The _return_fields+=extattrs adds the EAs to the fields normally returned. If you omit the + you will just get the EAs.

Showing results for 
Search instead for 
Do you mean 

Recommended for You

Infoblox ActiveTrust and a Deeper Dive Into your DNS Security