• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Neutron
  5. Port
  6. Create port

Create port

Function Description

Creating a Port

Interface Format

Method

URI

Description

POST

/v2.0/ports

Creates a port.

Restrictions

N/A

Extension Description

N/A

Request Parameter

Parameter

Type

Mandatory

Description

port

Dict

Yes

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

Mandatory field: network_id

Response Parameter

Parameter

Type

Mandatory

Description

port

Dict

Yes

Specifies the port information. For details, see the Ports object model.

Request Example

POST /v2.0/ports
{
    "port": {
        "admin_state_up": true, 

        "fixed_ips": [
            {
                "ip_address": "10.1.0.150", 
                "subnet_id": "b3ac1347-63f2-4e82-b853-3d86416a0db5"
            }
        ], 
        "name": "test", 
        "network_id": "a54e1b19-ce78-4b7e-b28b-d2d716cdc161", 
        "tenant_id": "6c9298ec8c874f7f99688489ab65f90e"
    }
}

Response Example

{
    "port": {
        "admin_state_up": true, 
        "allowed_address_pairs": [], 
        "binding:host_id": "az3.dc1", 
        "binding:profile": {}, 
        "binding:vif_details": {
            "ovs_hybrid_plug": true, 
            "port_filter": true
        }, 
        "binding:vif_type": "ovs", 
        "binding:vnic_type": "normal", 
        "device_id": "", 
        "device_owner": "compute:az3.dc1", 
        "port_security_enabled":true,
        "extra_dhcp_opts": [], 
        "fixed_ips": [
            {
                "ip_address": "10.1.0.150", 
                "subnet_id": "b3ac1347-63f2-4e82-b853-3d86416a0db5"
            }
        ], 
        "id": "7a9a954a-eb41-4954-a300-11ab17a361a2", 
        "mac_address": "fa:16:3e:7f:60:cb", 
        "name": "test", 
        "network_id": "a54e1b19-ce78-4b7e-b28b-d2d716cdc161", 
        "security_groups": [
            "ef69bc60-2f4b-4f97-b95b-e3b68df0c0b2"
        ], 
        "status": "DOWN", 
        "tenant_id": "6c9298ec8c874f7f99688489ab65f90e"
    }
}

Error Code

See section Return Code Processing.