Reply

Next available network from a specific segment space in a container

Member
Posts: 1
210     0

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

 

 

Re: Next available network from a specific segment space in a container

Adviser
Posts: 169
211     0

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

Techie
Posts: 7
211     0

Worked for me!  Appreciate the solution.

Showing results for 
Search instead for 
Did you mean: 

Recommended for You

Businesses are investing heavily into securing company resources from cyber-attacks form cybercrimin