- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Curl - Get Next Available IP
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2021 01:47 AM
Hello,
We would like to use script to get the next available IP from a subnet "192.168.1.1". From the refernece guide, the script should be:
curl -k -u admin:infoblox -H 'content-type: application/json' -X POST "https://gridmaster/wapi/v2.11/network/ZG5zLm5ldHdvcmskMTcyLjIxLjEwLjAvMjQvMA:172.21.10.0/24/default?...
=next_available_ip&_return_as_object=1" -d '{"num":1}'
I know "ZG5zLm5ldHdvcmskMTcyLjIxLjEwLjAvMjQvMA:1921.168.1.1/24/default" is the object reference of the subnet 192.168.1.1.
However, how I can get this object reference and then pass as parameter to the above command?
Great if anyone can share the sample for this.
Thanks.
Raymond.
Re: Curl - Get Next Available IP
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2021 01:57 AM
Hi,
You can combine multiple WAPI calls to achieve your requirement using the /request handler:
curl -X POST 'https://grid-master/wapi/v2.11/request' \ -k -u uname:pwd \ -H 'Content-Type: application/json' \ -d '[ { "method": "GET", "object": "network", "data": { "network":"192.168.1.1/24" }, "assign_state": { "network_ref": "_ref" }, "discard": true }, { "method": "POST", "object": "##STATE:network_ref:##", "args": { "_function": "next_available_ip" }, "enable_substitution": true } ]'
Regards,
Krishna