Method | URI | Description |
---|---|---|
GET | /v2.0/subnets | Lists subnets to which the specified tenant has access. |
Default policy settings returns exclusively subnets owned by the tenant submitting the request, unless the request is submitted by an user with administrative rights. You can control which attributes are returned by using the fields query parameter. You can filter results by using query string parameters. For information, see Filtering and Column Selection in the OpenStack Networking API v2.0 Reference.
Normal response codes: 200
Error response codes: unauthorized (401)
Example 3.17. List subnets: JSON response
{ "subnets":[ { "name":"private-subnet", "enable_dhcp":true, "network_id":"db193ab3-96e3-4cb3-8fc5-05f4296d0324", "tenant_id":"26a7980765d0414dbc1fc1f88cdb7e6e", "dns_nameservers":[ ], "allocation_pools":[ { "start":"10.0.0.2", "end":"10.0.0.254" } ], "host_routes":[ ], "ip_version":4, "gateway_ip":"10.0.0.1", "cidr":"10.0.0.0/24", "id":"08eae331-0402-425a-923c-34f7cfe39c1b" }, { "name":"my_subnet", "enable_dhcp":true, "network_id":"d32019d3-bc6e-4319-9c1d-6722fc136a22", "tenant_id":"4fd44f30292945e481c7b8a0c8908869", "dns_nameservers":[ ], "allocation_pools":[ { "start":"192.0.0.2", "end":"192.255.255.254" } ], "host_routes":[ ], "ip_version":4, "gateway_ip":"192.0.0.1", "cidr":"192.0.0.0/8", "id":"54d6f61d-db07-451c-9ab3-b9609b6b6f0b" } ] }
Example 3.18. List subnets: XML response
<?xml version='1.0' encoding='UTF-8'?> <subnets xmlns="http://openstack.org/quantum/api/v2.0" xmlns:quantum="http://openstack.org/quantum/api/v2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <subnet> <name>private-subnet</name> <enable_dhcp quantum:type="bool">True</enable_dhcp> <network_id>db193ab3-96e3-4cb3-8fc5-05f4296d0324</network_id> <tenant_id>26a7980765d0414dbc1fc1f88cdb7e6e</tenant_id> <dns_nameservers quantum:type="list"/> <allocation_pools> <allocation_pool> <start>10.0.0.2</start> <end>10.0.0.254</end> </allocation_pool> </allocation_pools> <host_routes quantum:type="list"/> <ip_version quantum:type="long">4</ip_version> <gateway_ip>10.0.0.1</gateway_ip> <cidr>10.0.0.0/24</cidr> <id>08eae331-0402-425a-923c-34f7cfe39c1b</id> </subnet> <subnet> <name>my_subnet</name> <enable_dhcp quantum:type="bool">True</enable_dhcp> <network_id>d32019d3-bc6e-4319-9c1d-6722fc136a22</network_id> <tenant_id>4fd44f30292945e481c7b8a0c8908869</tenant_id> <dns_nameservers quantum:type="list"/> <allocation_pools> <allocation_pool> <start>192.0.0.2</start> <end>192.255.255.254</end> </allocation_pool> </allocation_pools> <host_routes quantum:type="list"/> <ip_version quantum:type="long">4</ip_version> <gateway_ip>192.0.0.1</gateway_ip> <cidr>192.0.0.0/8</cidr> <id>54d6f61d-db07-451c-9ab3-b9609b6b6f0b</id> </subnet> </subnets>
This operation does not return a response body.