• Virtual Private Cloud

vpc
  1. Help Center
  2. Virtual Private Cloud
  3. API Reference
  4. OpenStack Neutron APIs
  5. Port
  6. Creating a Port

Creating a Port

Function

This interface is used to create a port.

URI

POST /v2.0/ports

Request Message

Table 1 Request parameter

Parameter

Type

Mandatory

Description

port

Dict

Yes

Specifies the port list. For details, see Table 1.

Mandatory field: network_id

Response Message

Table 2 Response parameter

Parameter

Type

Description

port

Dict

Specifies the port information. For details, see Table 1.

Example:

Example request

POST /v2.0/ports 
{
    "port": {
       "admin_state_up": true,
        "network_id": "00ae08c5-f727-49ab-ad4b-b069398aa171",
        "name": "port-test"
    }
}

Example response

{
    "port": {
        "id": "a7d98f3c-b42f-460b-96a1-07601e145961",
        "name": "port-test",
        "status": "DOWN",
        "admin_state_up": true,
        "fixed_ips": [],
        "mac_address": "fa:16:3e:01:f7:90",
        "network_id": "00ae08c5-f727-49ab-ad4b-b069398aa171",
        "tenant_id": "db82c9e1415a464ea68048baa8acc6b8",
        "project_id": "db82c9e1415a464ea68048baa8acc6b8",
        "device_id": "",
        "device_owner": "",
        "security_groups": [
            "d0d58aa9-cda9-414c-9c52-6c3daf8534e6"
        ],
        "extra_dhcp_opts": [],
        "allowed_address_pairs": [],
        "binding:vnic_type": "normal",
        "binding:vif_details": {},
        "binding:profile": {},
        "port_security_enabled": true,
        "created_at": "2018-09-20T01:45:26",
        "updated_at": "2018-09-20T01:45:26"
    }
}

Status Codes

For details, see section Status Codes.