• 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. Creating a Port

Creating a Port

Guidelines

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

POST /v2.0/ports

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. For details, see the following table.

Port structure parameters

Parameter

Type

Constraint

Mandatory

Description

name

String

N/A

No

Specifies the port name.

network_id

Uuid-Str

An existing network ID

Yes

Specifies the ID of the belonged network that is created using the subnet creation interface of VPC. For details, see section "Creating a Subnet" in the Virtual Private Cloud API Reference. The subnet ID is the network ID to be specified for this API.

admin_state_up

Bool

true or false

No

Specifies the management status.

mac_address

String

A valid MAC address

No

Specifies the MAC address of the port.

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.

tenant_id

Uuid-Str

The same as the tenant_id value of the network

Yes

This parameter is mandatory in the system that does not use Keystone for authentication.

Specifies the tenant ID.

security_groups

List(Uuid-Str)

N/A

No

Specifies the security group of the port.

allowed_address_pairs

List(Dict)

N/A

No

Specifies the address pair that can be configured.

extra_dhcp_opts

List(Dict)

N/A

No

Specifies the extra DHCP configuration. opt_name in extra_dhcp_opts cannot be set to 3 or 121 when you create a port.

Request Example

{

"port": {

"name": "private-port",

"allowed_address_pairs": [],

"admin_state_up": true,

"network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",

"tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",

"device_owner": "",

"mac_address": "fa:16:3e:c9:cb:f0",

"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": ""

}

}