Updating a Port
Function
This API is used to update a port. For example, you can update the security group of the cloud service resource that the port belongs to and associate the port with an ECS or virtual IP address.
URI
PUT /v1/{project_id}/ports/{port_id}
Parameter |
Mandatory |
Description |
---|---|---|
port_id |
Yes |
Specifies the port ID that uniquely identifies the port. For example, if this API is used to change the security group of an ECS, port_id is the ID of the ECS network interface. |
project_id |
Yes |
Specifies the project ID. For details about how to obtain a project ID, see Obtaining a Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
port |
Yes |
port object |
Specifies the port objects. For details, see Table 2. You must specify at least one attribute when updating a port. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
No |
String |
|
security_groups |
No |
Array of strings |
|
allowed_address_pairs |
No |
Array of allowed_address_pairs objects |
|
extra_dhcp_opts |
No |
Array of extra_dhcp_opt objects |
Specifies the extended option (extended attribute) of DHCP. For details, see Table 4. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
ip_address |
Yes |
String |
|
mac_address |
No |
String |
Specifies the MAC address. By default, the MAC address of the local port is used. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
opt_name |
No |
String |
Specifies the name of the DHCP option. The value of this parameter can only be 51, indicating the DHCP lease time of the IPv4 network interface. If the value of this parameter is set to 651, indicating the DHCP lease time of the IPv6 network interface. |
opt_value |
No |
String |
|
Example Request
- Change the name of the port whose ID is 7204e0da-40de-4207-a536-6f59b84f6f0e to abc.
PUT https://{Endpoint}/v1/{project_id}/ports/7204e0da-40de-4207-a536-6f59b84f6f0e { "port": { "name": "abc" } }
Response Parameters
Parameter |
Type |
Description |
---|---|---|
port |
port object |
Specifies the port objects. For details, see Table 6. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Specifies the port ID that uniquely identifies the port. |
name |
String |
|
network_id |
String |
NOTE:
To obtain the network ID:
|
admin_state_up |
Boolean |
|
mac_address |
String |
|
fixed_ips |
Array of fixed_ip objects |
|
device_id |
String |
|
device_owner |
String |
|
tenant_id |
String |
Specifies the project ID. |
status |
String |
|
security_groups |
Array of strings |
Specifies the security group UUID (extended attribute). |
allowed_address_pairs |
Array of allowed_address_pairs objects |
|
extra_dhcp_opts |
Array of extra_dhcp_opt objects |
Specifies the extended option (extended attribute) of DHCP. For details, see Table 9. |
binding:vif_details |
binding:vif_details object |
For details, see Table 10. |
binding:profile |
Object |
Specifies the user-defined settings. This is an extended attribute. Note:
|
binding:vnic_type |
String |
|
dns_assignment |
Array of dns_assignment objects |
|
dns_name |
String |
|
instance_id |
String |
|
instance_type |
String |
|
port_security_enabled |
Boolean |
|
zone_id |
String |
Specifies the availability zone that the port belongs to. |
enable_efi |
Boolean |
|
ipv6_bandwidth_id |
String |
|
Parameter |
Type |
Description |
---|---|---|
subnet_id |
String |
|
ip_address |
String |
Specifies the port IP address. |
Parameter |
Type |
Description |
---|---|---|
ip_address |
String |
|
mac_address |
String |
Specifies the MAC address. By default, the MAC address of the local port is used. |
Parameter |
Type |
Description |
---|---|---|
opt_name |
String |
Specifies the name of the DHCP option. The value of this parameter can only be 51, indicating the DHCP lease time of the IPv4 network interface. If the value of this parameter is set to 651, indicating the DHCP lease time of the IPv6 network interface. |
opt_value |
String |
|
Parameter |
Type |
Description |
---|---|---|
primary_interface |
Boolean |
If the value is true, this is the primary NIC. |
port_filter |
Boolean |
Specifies the port used for filtering in security groups to protect against MAC or IP spoofing. |
ovs_hybrid_plug |
Boolean |
Specifies that OVS hybrid plug should be used by Nova APIs. |
Example Response
{ "port": { "id": "7204e0da-40de-4207-a536-6f59b84f6f0e", "name": "abc", "status": "DOWN", "admin_state_up": "true", "fixed_ips": [ { "subnet_id": "689156ca-038f-4478-b265-fd26aa8bbe31", "ip_address": "192.168.0.9" } ], "mac_address": "fa:16:3e:d7:f2:6c", "network_id": "b4152e98-e3af-4e49-bb7f-7766e2b5ec63", "tenant_id": "caa6cf4337ea47fb823b15709ebe8591", "device_id": "", "device_owner": "", "security_groups": [ "59b39002-e79b-4bac-8e27-aa884ab1beb6" ], "extra_dhcp_opts": [], "allowed_address_pairs": [], "binding:vnic_type": "normal", "enable_efi": false } }
Status Code
See Status Codes.
Error Code
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot