Reply

Adding extattrs to fixedaddress

New Member
Posts: 4
5186     0

Hi,

I've seen people with similar issues but still haven't found a solution.

Because Infoblox isn't our authoritative DNS I can’t associate hosts with IPs. The name field isn’t extensible and hence cannot be searched. So I’ve added the Hostname extensible attribute and I can set it in the GUI fine and search on it using the API.

For some reason I can’t set the extensible attribute using the API. This is from our test rig.

Get the fixedaddress object.

curl -k -u admin:admin -H 'content-type: application/json' -X GET "https://127.0.0.1/wapi/v2.10/fixedaddress_return_fields%2B=ipv4addr&ipv4addr=192.168.65.2&_return_as_object=1"
{
    "result": [
        {
            "_ref": "fixedaddress/ZG5zLmZpeGVkX2FkZHJlc3MkMTkyLjE2OC42NS4yLjAuLg:192.168.65.2/default", 
            "ipv4addr": "192.168.65.2", 
            "network_view": "default"
        }
    ]
}


Now to set the attribute.

curl -k -u admin:admin -H 'content-type: application/json' -XPUT "https://127.0.0.1/wapi/v2.10/record:fixedaddress/ZG5zLmZpeGVkX2FkZHJlc3MkMTkyLjE2OC42NS4yLjAuLg:192.168.65.2/default" -d '{"extattrs":{"Hostname": {"value": "host2"}}}'

{ "Error": "AdmConProtoError: Unknown object type (record:fixedaddress)", 
  "code": "Client.Ibap.Proto", 
  "text": "Unknown object type (record:fixedaddress)", 
  "trace": "  File \"ibapapachemod.py\", line 470, in handlerequest\n  File \"/infoblox/common/lib/python/infoblox/one/admin_conn/wapibase.py\", line 1485, in execute\n  File \"/infoblox/common/lib/python/infoblox/one/admin_conn/wapibase.py\", line 1439, in _exec_handler\n  File \"/infoblox/common/lib/python/infoblox/one/admin_conn/wapihandler.py\", line 1450, in execute\n  File \"/infoblox/common/lib/python/infoblox/one/admin_conn/wapihandler.py\", line 134, in _get_wapi_object\n"


The attribute name is case sensitive and corret but it doesn't get that far it has an issue with the object type.

Any ideas, can't see the wood as they at the moment?

Here is the original call to create the attribute.

curl -k -u admin:admin -H 'content-type: application/json' -X POST "https://127.0.0.1/wapi/v2.10/extensibleattributedef?_return_fields%2B=name,type&_return_as_object=1" -d '{"name": "Hostname","type": "STRING"}'


Thanks Mark

Re: Adding extattrs to fixedaddress

Superuser
Posts: 23
5187     0

You are calling the object "record:fixedaddress", the object name should be just "fixedaddress". 

Re: Adding extattrs to fixedaddress

Superuser
Posts: 23
5187     0

And another tip, when updating extensible attributes, you can use the + symbol to "add". Your call in the example would have removed all existing extensible attributes, and set the Hostname to the new value, which is probably not what you want. You most likely want to keep all existing extensible attributres, and only update "Hostname".
 
It should be as easy as just addin the + symbole to the end of your call so it looks like this:

 

curl -k -u admin:admin -H 'content-type: application/json' \
-XPUT "https://127.0.0.1/wapi/v2.10/fixedaddress/ZG5zLmZpeGVkX2FkZHJlc3MkMTkyLjE2OC42NS4yLjAuLg:192.168.65.2/default" \
-d '{"extattrs+":{"Hostname": {"value": "host2"}}}'

Re: Adding extattrs to fixedaddress

New Member
Posts: 4
5187     0

I added a no zone host using the field:

"configure_for_dns": false
You get a host without any DNS association.

Showing results for 
Search instead for 
Did you mean: 

Recommended for You