Reply

How to get all subnets within an IPv4 network container ?

Member
Posts: 2
1814     0

Hi,

 

How to get all subnets within an IPv4 network container, with REST API ?

 

Regards,

Aurelien

Re: How to get all subnets within an IPv4 network container ?

Adviser
Posts: 201
1815     0

Hi Aurelien,

 

You can filter the networks by their container like below:

API Call: 
https://<grid_ip>/wapi/v2.10/network?network_container=10.0.0.0/16&_return_fields%2B=network_container

Sample Output:
[
    {
        "_ref": "network/ZG5zLm5ldHdvcmskMTAuMC4xMC4wLzI0LzA:10.0.10.0/24/Company%201",
        "comment": "Lab",
        "network": "10.0.10.0/24",
        "network_container": "10.0.0.0/16",
        "network_view": "Company 1"
    },
    {
        "_ref": "network/ZG5zLm5ldHdvcmskMTAuMC4xLjAvMjQvMA:10.0.1.0/24/Company%201",
        "network": "10.0.1.0/24",
        "network_container": "10.0.0.0/16",
        "network_view": "Company 1"
    }
]

Hope this is helpful,

Krishna

 

Re: How to get all subnets within an IPv4 network container ?

[ Edited ]
New Member
Posts: 1
1815     0

How to Get A Docker Container IP Address - Explained with Examples and run an application in a loosely isolated environment called a container.

mypennmedicine

Re: How to get all subnets within an IPv4 network container ?

Member
Posts: 2
1815     0

Thanks Krishna.

Is there a way to get comment field of an IPv4 network container ?

Re: How to get all subnets within an IPv4 network container ?

[ Edited ]
Adviser
Posts: 201
1815     0

Hi,

 

You can add it to the list of _return_fields like below:

For network:
https://<grid_ip>/wapi/v2.10/network?network_container=10.0.0.0/16&_return_fields%2B=network_container,comment

For network container:
https://<grid_ip>/wapi/v2.10/networkcontainer?_return_fields%2B=comment

 Regards,

Krishna Vasudevan

Re: How to get all subnets within an IPv4 network container ?

Techie
Posts: 13
1815     0

Are you able to return the network container's comments within the output for all networks?

 

https://<grid>/wapi/v2.10/network?network_container=10.0.0.0/8&_return_fields%2B=network_container

plus something...

And get output like this?

[{
"_ref": "network/ZG5z...jgvMA:10.10.10.0/24/default",

"comment": "Example network comment",
"network": "10.10.10.0/24",
"network_container": "10.0.0.0/8",

"network_container:comment": "Example container comment",
"network_view": "default"
}]

Re: How to get all subnets within an IPv4 network container ?

Adviser
Posts: 201
1815     0

Hi,

 

I'm not clear regarding your question.

 

This is the output I get:

[
    {
        "_ref": "network/ZG5zLm5ldHdvcmskMTAuMC4xMC4wLzI0LzA:10.0.10.0/24/Company%201",
        "comment": "Lab",
        "network": "10.0.10.0/24",
        "network_container": "10.0.0.0/16",
        "network_view": "Company 1"
    },
    {
        "_ref": "network/ZG5zLm5ldHdvcmskMTAuMC4xLjAvMjQvMA:10.0.1.0/24/Company%201",
        "network": "10.0.1.0/24",
        "network_container": "10.0.0.0/16",
        "network_view": "Company 1"
    }
]

The comment field is returned by default if there is a comment added to the network/container.

 

Regards,

Krishna Vasudevan

Showing results for 
Search instead for 
Did you mean: 

Recommended for You