• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. Developer Guide
  4. Development Guide
  5. Application Scenarios of the VPC Service
  6. Updating a Port

Updating a Port

Guidelines

You can update a port by performing steps provided in the document of native OpenStack APIs.

PUT /v2.0/ports/{port_id}

Parameters

For the description of parameters, see the interface-related documentation.

The following describes the parameters that have use constraints.

Parameter

Type

Constraint

Mandatory

Description

port

Dict

N/A

Yes

Specifies the port metadata.

Port structure parameters

Parameter

Type

Constraint

Mandatory

Description

name

String

N/A

No

Specifies the port name.

admin_state_up

Bool

true or false

No

Specifies the management status.

fixed_ips

List(Dict)

The value is limited by max_fixed_ips_per_port in the configuration file.

No

Specifies the port IP address.

device_id

String

N/A

No

Specifies the device ID.

device_owner

String

N/A

No

Specifies the owner of the device.

security_groups

List(Uuid-Str)

N/A

No

Specifies the security group of the port.

extra_dhcp_opts

List(Dict)

N/A

No

Specifies the extra DHCP configuration. Observe the following constraints when updating a port:

extra_dhcp_opt type

Attribute

Type

Constraint

Mandatory

Description

opt_name

String

N/A

No

Specifies the option name.

opt_value

String

N/A

No

Specifies the option value.

  1. If both opt_name=3 and opt_name=121 are contained in extra_dhcp_opts, the port is used by the active NIC. Each ECS has only one active NIC.
  2. You can set opt_name in extra_dhcp_opt to 3 or 121 only when the port is used by the active NIC of the ECS.
  3. Ensure that each ECS has only one active NIC. When opt_name is set to 3, opt_value must be set to 0.0.0.0/0,Gateway address of the subnet to which the port belongs. When opt_name is set to 121, opt_value must be set to 0.0.0.0/0,Gateway address of the subnet to which the port belongs. Otherwise, the network communication may be interrupted.

Request Example

{

"port": {

"name": "private-port",

"admin_state_up": true,

"device_owner": "",

"fixed_ips": [

{

"subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2",

"ip_address": "10.0.0.2"

}

],

" extra_dhcp_opts": [{"opt_name": "3","opt_value": "172.16.150.1"},{"opt_name":"121","opt_value":"0.0.0.0/0,172.16.150.1"}],

"security_groups": [

"f0ac4394-7e4a-4409-9701-ba8be283dbc3"

],

"device_id": ""

}

}