Description
Name cannnot be changed.
Only the specified parameter will be updated.
(example : If you want to change only "fixed_ips", request only "fixed_ips."
Request URL
Network API v2.0
PUT /v2.0/ports/{port_id}
Request Paramters
| Parameter | Value | Style | Description |
|---|---|---|---|
| X-Auth-Token | User Token | header | |
| port_id | Port ID | URI | |
| security_groups(Optional) | security groupID | Array | |
| fixed_ips(Optional) | plain | Use this parameter when you want to specify an IP address | |
| allowed_address_pairs(Optional) | plain | Specify when you use VIP. It cannot be accepted when you use the VIP address you do not own. |
The parameter will be different for each network. So you should be careful.
| add ip net | local net | PaaS net | External net | |
|---|---|---|---|---|
| security_groups | Optional | Optional | Optional | Optional |
| fixed_ips | Optional | Optional | x | x |
| allowed_address_pairs | Optional | x | x | Optional |
Request Json
{
"port": {
"fixed_ips": [
{
"ip_address": "157.7.80.144",
"subnet_id": "1ef2a905-9a0e-4845-bf3a-8723df3e72d0"
},
{
"ip_address": "157.7.80.145",
"subnet_id": "1ef2a905-9a0e-4845-bf3a-8723df3e72d0"
}
],
"allowed_address_pairs": [
{
"ip_address": "157.7.80.32"
},
{
"ip_address": "157.7.80.33"
}
],
"security_groups": [
"359710a9-ce31-40d0-9548-32d4f9f2a56a",
"038f84be-0431-4691-a87c-d846436ea354"
]
}
}
Request Json (the example of associating External Port to VIP address)
IPv6 address will be allocated automatically, so just specify the VIP address you want to be associated.
{
"port": {
"allowed_address_pairs": [
{
"ip_address": "157.7.80.144"
}
]
}
}
Request Json (example of deleting allowed_address_pairs)
{
"port": {
"allowed_address_pairs": []
}
}
Request Json (example of deleting fixed_ips)
{
"port": {
"fixed_ips": []
}
}
Request Json (example of deleting security_groups)
{
"port": {
"security_groups": []
}
}
Normal response codes
200
Example
curl -i -X PUT -H "Accept: application/json" -H "X-Auth-Token: 0925897a3d4543218ff0dcd2bb378a8e" -d '{"port": {"security_groups": ["bda5122c-81bc-4dc5-b353-2d349c3e2063"]}}' https://networking.tyo1.cloud.z.com/v2.0/ports/490f1e4f-5a60-4df9-88b1-953de
ebdf139
HTTP/1.1 200 OK
Server: openresty/1.7.10.1
Date: Fri, 08 May 2015 10:48:20 GMT
Content-Type: application/json
Content-Length: 564
Connection: keep-alive
{
"port": {
"status": "ACTIVE",
"name": "local-gnct75294078",
"allowed_address_pairs": [],
"admin_state_up": true,
"network_id": "7d9e6cbf-9473-4e16-a501-284b59300f3f",
"tenant_id": "22394afc818d471ca2f0308c06ae7460",
"extra_dhcp_opts": [],
"binding:vnic_type": "normal",
"device_owner": "compute:None",
"mac_address": "fa:16:3e:79:c8:30",
"fixed_ips": [
{
"subnet_id": "6c480943-b1e9-4b52-8048-8bf1df550503",
"ip_address": "10.10.8.1"
}
],
"id": "490f1e4f-5a60-4df9-88b1-953deebdf139",
"security_groups": [
"bda5122c-81bc-4dc5-b353-2d349c3e2063"
],
"device_id": "8ae928f5-238e-4b67-9861-eca74312d897"
}
}