- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Next available network from a specific segment space in a container
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2021 06:24 AM
Hello,
Is it possible to allocate a network in a given container within a specific range using WAPI?
Let's say we have a container 10.0.0.0/16 with no sub-containers.
But I want to specify a range where to allocate from, i.e. 10.0.2.0/24 or 10.0.5.0/24.
In other words, allocate next available network /27 from container 10.0.0.0/16 within 10.0.2.0/24 range.
As a (logical) range is not an object, I assume there is no way to do this.
So, my alternative thought was to querry all available networks in a given container and then find the first available network that is a subnet of a specific range.
Alas, cannot find such a function either.
I would appreciate any help or ideas
Thank you in advance
Solved! Go to Solution.
Re: Next available network from a specific segment space in a container
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2021 04:46 AM
Hi,
You can add a list of networks that need to be excluded like this:
curl --location --request POST 'https://grid-master.lab.com/wapi/v2.11/network' \ --header 'Authorization: Basic YWRtaW46aW5mb2Jsb3g=' \ --header 'Content-Type: application/json' \ --data-raw '{ "network":{ "_object_function": "next_available_network", "_parameters": { "exclude": ["192.168.0.0/24","192.168.1.0/24"], "cidr":27 }, "_result_field": "networks", "_object": "networkcontainer", "_object_parameters": { "network": "192.168.0.0/16" } } }'
If there is no reason to not do it, the simpler option would probably be to create 10.0.2.0/24 network and fetch the next available /27 network within it.
If you want to query the next available networks in a network container, you can do using the following call:
curl --location --request POST 'https://grid-master.lab.com/wapi/v2.11/networkcontainer/ZG5zLm5ldHdvcmtfY29udGFpbmVyJDE5Mi4xNjguMC4wLzE2LzA:192.168.0.0/16/default?_function=next_available_network' \ --header 'Authorization: Basic YWRtaW46aW5mb2Jsb3g=' \ --header 'Content-Type: application/json' \ --data-raw '{ "cidr":27, "num":20 }'
Regards,
Krishna
Re: Next available network from a specific segment space in a container
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2021 06:36 AM
Worked for me! Appreciate the solution.