• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Neutron
  5. Subnets
  6. List subnets

List subnets

Function Description

This interface is used to query a subnet list.

Interface Format

Method

URI

Description

GET

/v2.0/subnets?name={subnet_name }&ip_version={ip_version}&network_id={network_id}&cidr={subnet_cidr_address}&gateway_ip={subnet_gateway}&tenant_id={tenant_id}& enable_dhcp={is_enable_dhcp}

Queries all subnets accessible to the tenant submitting the request.

Restrictions

N/A

Request Parameter

None

Response Parameter

Parameter

Type

Mandatory

Description

subnets

List(subnet)

Yes

Specifies the subnet list. For details, see Table 1.

Request Example

GET /v2.0/subnets

Response Example

{
    "subnets": [
        {
            "name": "",
            "enable_dhcp": true,
            "network_id": "9daeac7c-a98f-430f-8e38-67f9c044e299",
            "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f",
            "dns_nameservers": [,],
"allocation_pools": [
                {
                    "start": "192.150.73.2",
                    "end": "192.150.73.254"
                }
            ],
            "host_routes": [],
            "ip_version": 4,
            "gateway_ip": "192.150.73.1",
            "cidr": "192.150.73.0/24",
            "id": "132dc12d-c02a-4c90-9cd5-c31669aace04"
        },
        {
            "name": "testsubnet",
            "enable_dhcp": true,
            "network_id": "60c809cb-6731-45d0-ace8-3bf5626421a9",
            "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f",
            "dns_nameservers": [
                "8.8.4.4",
                "8.8.8.8"
            ],
            "allocation_pools": [
                {
                    "start": "10.0.10.2",
                    "end": "10.0.10.254"
                }
            ],
            "host_routes": [],
            "ip_version": 4,
            "gateway_ip": "10.0.10.1",
            "cidr": "10.0.10.0/24",
            "id": "e0fa7de1-a6e2-44c9-b052-b9d8cebe93c4"
        },
        {
            "name": "subnet02",
            "enable_dhcp": true,
            "network_id": "3d42a0d4-a980-4613-ae76-a2cddecff054",
            "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f",
            "dns_nameservers": [
                "8.8.8.7",
                "8.8.8.8"
            ],
            "allocation_pools": [
                {
                    "start": "10.1.1.2",
                    "end": "10.1.1.254"
                }
            ],
            "host_routes": [],
            "ip_version": 4,
            "gateway_ip": "10.1.1.1",
            "cidr": "10.1.1.0/24",
            "id": "e25189a8-54df-4948-9396-d8291ffc92a0"
        }
    ]
}

Error Code

See section Return Code Processing.