Verb | URI | Description |
PUT | /ports/port-id |
Updates a specified port. |
Normal Response Code: 200
Error Response Codes: Bad Request (400), Unauthorized (401), Forbidden (403), Not Found (404), Conflict (409)
You can use this operation to update information
for a port, such as its symbolic name and
associated IPs. When you update IPs for a port,
the previously associated IPs are removed,
returned to the respective subnets allocation
pools, and replaced by the IPs specified in the
body for the update request. Therefore, this
operation replaces the
fixed_ip
attribute when
it is specified in the request body. If the new IP
addresses are not valid, for example, they are
already in use, the operation fails and the
existing IP addresses are not removed from the
port.
When you update security groups for a port and the operation succeeds, any associated security groups are removed and replaced by the security groups specified in the body for the update request. Therefore, this operation replaces the security_groups attribute when you specify it in the request body. However, if the specified security groups are not valid, the operation fails and the existing security groups are not removed from the port.
This operation requires a request body.
This operation returns a response body.
Example 4.35. Update Port: JSON Request
PUT /v2.0/ports/1d8591f4-7b62-428e-857d-e82a15e5a7f1.json HTTP/1.1 Content-Length: 63 content-type: application/json accept: application/json
{ "port":{ "security_groups":[ "85cc3048-abc3-43cc-89b3-377341426ac5", "c5ab5c29-2c99-44cb-a4b8-e70a88b77799" ] } }
Example 4.36. Update Port: JSON Response
{ "port":{ "admin_state_up":true, "device_id":"24df1d04-d5cb-41e1-8de5-61ed77c558df", "device_owner":"compute:None", "fixed_ips":[ { "ip_address":"10.0.0.3", "subnet_id":"3b498f11-0a20-43ed-b992-0e4202d5f930" } ], "id":"1d8591f4-7b62-428e-857d-e82a15e5a7f1", "mac_address":"fa:16:3e:b6:da:54", "name":"", "network_id":"abaf2e70-4305-4e8d-ac70-3e4cc5f66a07", "security_groups":[ "85cc3048-abc3-43cc-89b3-377341426ac5", "c5ab5c29-2c99-44cb-a4b8-e70a88b77799" ], "status":"ACTIVE", "tenant_id":"e4f50856753b4dc6afee5fa6b9b6c550" } }