Reply
Highlighted
Accepted Solution

How to exclude ip addresses when you reserve a fixed ip

[ Edited ]
flaviusbura
Techie
Posts: 2
3160     0

Hello

I am trying to reserve a next available fixed ip address but I don't know how to exclude the first 10 ip addresses. My url looks like:

url = "https://127.0.0.1/wapi/v2.1/fixedaddress?_return_fields=ipv4addr"

and my payload

payload = "{\"ipv4addr\":\"func:nextavailableip:network/ZG5zLm5ldHdvcmskMTAwLjY0LjAuMC8yNC8x:10.0.0.0/24/View\",\"_parameters\":{\"exclude\":[\"10.0.0.0\",\"10.0.0.10\"]},\"mac\":\"ef:ff:ff:ff:ff:fe\",\"network_view\":\"View\",\"extattrs\":{\"Location\":{\"value\":\"Loc\"}}}"

When runnig this in python I get following error:

{ "Error": "AdmConProtoError: Unknown argument/field: '_parameters'",
  "code": "Client.Ibap.Proto",
  "text": "Unknown argument/field: '_parameters'"
}

Is it possible to achive what I want?

P.S. I can reserve an ip address without the _parameters attribute.

Thanks in advance!

Re: How to exclude ip addresses when you reserve a fixed ip

Adviser
Posts: 100
3161     0

Hello,

 

The payload needs to be modified as below:

{"ipv4addr":
    {"_object_function":"next_available_ip",
     "_parameters":
          {"exclude":["10.10.10.1","10.10.10.2","10.10.10.3","10.10.10.4","10.10.10.5","10.10.10.6","10.10.10.7","10.10.10.8","10.10.10.9","10.10.10.10"]},
     "_result_field":"ips",
     "_object" : "network",
     "_object_parameters":
          {"network":"10.10.10.0/24",
           "network_view":"demo"}},
 "mac":"00:00:00:00:00:00",
 "network_view":"demo",
 "extattrs":{"Site":{"value":"East"}}}

You can use the following curl command to achieve your use case:

 

curl -k -u admin:infoblox -H 'content-type: application/son' -X POST "https://grid-master/wapi/v2.7/fixedaddress?_return_fields%2B=ipv4addr,mac,extattrs&_return_as_object=1" -d '{"ipv4addr":{"_object_function":"next_available_ip","_parameters":{"exclude":["10.10.10.1","10.10.10.2","10.10.10.3","10.10.10.4","10.10.10.5","10.10.10.6","10.10.10.7","10.10.10.8","10.10.10.9","10.10.10.10"]},"_result_field":"ips","_object" : "network","_object_parameters":{"network":"10.10.10.0/24","network_view":"demo"}},"mac":"00:00:00:00:00:00","network_view":"demo","extattrs":{"Site":{"value":"East"}}}'

Sample Output:

 

 

{
    "result": {
        "_ref": "fixedaddress/ZG5zLmZpeGVkX2FkZHJlc3MkMTAuMTAuMTAuMTIuMi4u:10.10.10.12/demo",
        "extattrs": {
            "Site": {
                "value": "East"
            }
        },
        "ipv4addr": "10.10.10.12",
        "mac": "00:00:00:00:00:00",
        "network_view": "demo"
    }
}

 

Hope this helps,

Krishna

 

Showing results for 
Search instead for 
Do you mean 

Recommended for You