Method | URI | Description |
---|---|---|
POST | /v2.0/ports | Creates multiple ports in a single request. Specify a list of ports in the request body. |
Guarantees the atomic completion of the bulk operation.
Normal response codes: 201
Error response codes: badRequest (400), unauthorized (401), forbidden (403), itemNotFound (404), conflict (409), macGenerationFailure (503)
Example 3.38. Bulk create ports: JSON request
{ "ports":[ { "name":"sample_port_1", "admin_state_up":false, "network_id":"a3775a7d-9f8b-4148-be81-c84bbd0837ce" }, { "name":"sample_port_2", "admin_state_up":false, "network_id":"a3775a7d-9f8b-4148-be81-c84bbd0837ce" } ] }
Example 3.39. Bulk create ports: XML request
<?xml version="1.0" encoding="UTF-8"?> <ports> <port> <name>test_port_1</name> <network_id>a3775a7d-9f8b-4148-be81-c84bbd0837ce</network_id> </port> <port> <name>test_port_2</name> <network_id>a3775a7d-9f8b-4148-be81-c84bbd0837ce</network_id> </port> </ports>
This operation does not require a request body.
Example 3.40. Bulk create ports: JSON response
{ "ports":[ { "status":"DOWN", "binding:host_id":null, "name":"sample_port_1", "admin_state_up":true, "network_id":"a3775a7d-9f8b-4148-be81-c84bbd0837ce", "tenant_id":"60cd4f6dbc2f491982a284e7b83b5be3", "binding:vif_type":"ovs", "device_owner":"", "binding:capabilities":{ "port_filter":true }, "mac_address":"fa:16:3e:2e:7c:8a", "fixed_ips":[ ], "id":"8fb361d8-bab0-418d-b1b8-7204a230fb06", "security_groups":[ "99f465bc-0d7c-4142-8829-7ae0179f2fa8" ], "device_id":"" }, { "status":"DOWN", "binding:host_id":null, "name":"sample_port_2", "admin_state_up":false, "network_id":"a3775a7d-9f8b-4148-be81-c84bbd0837ce", "tenant_id":"60cd4f6dbc2f491982a284e7b83b5be3", "binding:vif_type":"ovs", "device_owner":"", "binding:capabilities":{ "port_filter":true }, "mac_address":"fa:16:3e:0a:4e:13", "fixed_ips":[ ], "id":"d4c93b0b-f593-424e-a199-d648478a5a3c", "security_groups":[ "99f465bc-0d7c-4142-8829-7ae0179f2fa8" ], "device_id":"" } ] }
Example 3.41. Bulk create ports: XML response
<?xml version='1.0' encoding='UTF-8'?> <ports xmlns="http://openstack.org/quantum/api/v2.0" xmlns:binding="http://docs.openstack.org/ext/binding/api/v1.0" xmlns:quantum="http://openstack.org/quantum/api/v2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <port> <status>DOWN</status> <binding:host_id xsi:nil="true"/> <name>test_port_1</name> <admin_state_up quantum:type="bool">True</admin_state_up> <network_id>a3775a7d-9f8b-4148-be81-c84bbd0837ce</network_id> <tenant_id>60cd4f6dbc2f491982a284e7b83b5be3</tenant_id> <binding:vif_type>ovs</binding:vif_type> <device_owner/> <binding:capabilities> <port_filter quantum:type="bool">True</port_filter> </binding:capabilities> <mac_address>fa:16:3e:c9:8d:cf</mac_address> <fixed_ips quantum:type="list"/> <id>7f0aa3f1-883a-43b2-8d1b-e85fac52b417</id> <security_groups> <security_group>99f465bc-0d7c-4142-8829-7ae0179f2fa8</security_group> </security_groups> <device_id/> </port> <port> <status>DOWN</status> <binding:host_id xsi:nil="true"/> <name>test_port_2</name> <admin_state_up quantum:type="bool">True</admin_state_up> <network_id>a3775a7d-9f8b-4148-be81-c84bbd0837ce</network_id> <tenant_id>60cd4f6dbc2f491982a284e7b83b5be3</tenant_id> <binding:vif_type>ovs</binding:vif_type> <device_owner/> <binding:capabilities> <port_filter quantum:type="bool">True</port_filter> </binding:capabilities> <mac_address>fa:16:3e:79:90:81</mac_address> <fixed_ips quantum:type="list"/> <id>a4a81484-c1c4-4b2b-95bc-f8c4484241d0</id> <security_groups> <security_group>99f465bc-0d7c-4142-8829-7ae0179f2fa8</security_group> </security_groups> <device_id/> </port> </ports>
This operation does not return a response body.