Method | URI | Description |
---|---|---|
POST | /v2.0/ports | Creates a port on a specified network. |
You must specify the network where the port is to
created in the network_id
attribute in
the request body.
Normal response codes: 201
Error response codes: badRequest (400), unauthorized (401), forbidden (403), itemNotFound (404), macGenerationFailure (503), serviceUnavailable (503)
Example 3.35. Create port: JSON request
{ "port":{ "network_id":"ee2d3158-3e80-4fb3-ba87-c99f515d85e7", "admin_state_up":true } }
Example 3.36. Create port: JSON response
{ "port":{ "status":"DOWN", "binding:host_id":"", "name":"", "allowed_address_pairs":[ ], "admin_state_up":true, "network_id":"ee2d3158-3e80-4fb3-ba87-c99f515d85e7", "tenant_id":"4fd44f30292945e481c7b8a0c8908869", "binding:vif_type":"unbound", "device_owner":"", "binding:capabilities":{ "port_filter":false }, "mac_address":"fa:16:3e:80:14:5b", "fixed_ips":[ ], "id":"6f9f6319-ce4b-4267-a5f8-558d6795632d", "security_groups":[ "d30c3c54-5dba-49cf-a323-48a86f078d2d" ], "device_id":"" } }
Example 3.37. Create port: XML response
<?xml version="1.0" encoding="UTF-8"?> <port 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"> <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>
This operation does not return a response body.