| Method | URI | Description |
|---|---|---|
| POST | /v2.0/subnets | Creates multiple subnets in a single request. Specify a list of subnets in the request body. |
The bulk create operation is always atomic. Either all or no subnets in the request body are created.
Normal response codes: 201
Error response codes: badRequest (400), unauthorized (401), forbidden (403), itemNotFound (404), conflict (409)
Example 3.23. Bulk create subnet: JSON request
{
"subnets":[
{
"cidr":"192.168.199.0/24",
"ip_version":4,
"network_id":"e6031bc2-901a-4c66-82da-f4c32ed89406"
},
{
"cidr":"10.56.4.0/22",
"ip_version":4,
"network_id":"64239a54-dcc4-4b39-920b-b37c2144effa"
}
]
}Example 3.24. Bulk create subnet: XML request
<?xml version="1.0" encoding="UTF-8"?>
<subnets>
<subnet>
<name>test_subnet_1</name>
<network_id>a3775a7d-9f8b-4148-be81-c84bbd0837ce</network_id>
<cidr>10.0.0.0/8</cidr>
<ip_version>4</ip_version>
</subnet>
<subnet>
<name>test_subnet_2</name>
<network_id>a3775a7d-9f8b-4148-be81-c84bbd0837ce</network_id>
<cidr>192.168.0.0/16</cidr>
<ip_version>4</ip_version>
</subnet>
</subnets>
This operation does not require a request body.
Example 3.25. Bulk create subnet: JSON response
{
"subnets":[
{
"allocation_pools":[
{
"end":"192.168.199.254",
"start":"192.168.199.2"
}
],
"cidr":"192.168.199.0/24",
"dns_nameservers":[
],
"enable_dhcp":true,
"gateway_ip":"192.168.199.1",
"host_routes":[
],
"id":"0468a7a7-290d-4127-aedd-6c9449775a24",
"ip_version":4,
"name":"",
"network_id":"e6031bc2-901a-4c66-82da-f4c32ed89406",
"tenant_id":"d19231fc08ec4bc4829b668040d34512"
},
{
"allocation_pools":[
{
"end":"10.56.7.254",
"start":"10.56.4.2"
}
],
"cidr":"10.56.4.0/22",
"dns_nameservers":[
],
"enable_dhcp":true,
"gateway_ip":"10.56.4.1",
"host_routes":[
],
"id":"b0e7435c-1512-45fb-aa9e-9a7c5932fb30",
"ip_version":4,
"name":"",
"network_id":"64239a54-dcc4-4b39-920b-b37c2144effa",
"tenant_id":"d19231fc08ec4bc4829b668040d34512"
}
]
}Example 3.26. Bulk create subnet: 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>test_subnet_1</name>
<enable_dhcp quantum:type="bool">True</enable_dhcp>
<network_id>a3775a7d-9f8b-4148-be81-c84bbd0837ce</network_id>
<tenant_id>60cd4f6dbc2f491982a284e7b83b5be3</tenant_id>
<dns_nameservers quantum:type="list"/>
<allocation_pools>
<allocation_pool>
<start>10.0.0.2</start>
<end>10.255.255.254</end>
</allocation_pool>
</allocation_pools>
<host_routes quantum:type="list"/>
<ip_version quantum:type="int">4</ip_version>
<gateway_ip>10.0.0.1</gateway_ip>
<cidr>10.0.0.0/8</cidr>
<id>bd3fd365-fe19-431a-be63-07017a09316c</id>
</subnet>
<subnet>
<name>test_subnet_2</name>
<enable_dhcp quantum:type="bool">True</enable_dhcp>
<network_id>a3775a7d-9f8b-4148-be81-c84bbd0837ce</network_id>
<tenant_id>60cd4f6dbc2f491982a284e7b83b5be3</tenant_id>
<dns_nameservers quantum:type="list"/>
<allocation_pools>
<allocation_pool>
<start>192.168.0.2</start>
<end>192.168.255.254</end>
</allocation_pool>
</allocation_pools>
<host_routes quantum:type="list"/>
<ip_version quantum:type="int">4</ip_version>
<gateway_ip>192.168.0.1</gateway_ip>
<cidr>192.168.0.0/16</cidr>
<id>86e7c838-fb75-402b-9dbf-d68166e3f5fe</id>
</subnet>
</subnets>
This operation does not return a response body.

