Create port

Creates a port on the specified network.

URI

/v2.0/ports

HTTP method

POST

Request parameter

Key Description Type Required/optional
name A symbolic name for the port. xsd:string Optional
allowed_address_pairs Allowed address pairs

It is not possible to specify "0.0.0.0/0", which allows all communication, for ip_address.

xsd:dict Optional
admin_state_up The administrative status of the port, which is up (true) or down (false). xsd:bool Optional
mac_address The MAC address. If you specify an address that is not valid, a 400 Bad Request error is returned. If you do not specify a MAC address, OpenStack Networking tries to allocate one. If a failure occurs, a 503 Service Unavailable error is returned. xsd:string Optional
fixed_ips If you specify only a subnet ID, OpenStack Networking allocates an available IP from that subnet to the port. If you specify both a subnet ID and an IP address, OpenStack Networking tries to allocate the specified address to the port. xsd:dict Optional
security_groups Security groups. Specify one or more security group IDs. csapi:uuid Optional

(Note)

network_id The ID of the network. csapi:uuid Required
availability_zone The Availability Zone name.

If you do not specify this, the resource will be created in the default Availability Zone.

xsd:string Optional

CAUTION:
For a port for use with the Windows virtual server for SAP service or the physical server for SAP HANA service, it is possible to specify the IP address specified in gateway_ip and allocation_pools of the subnet related to the network ID for fixed_ips.

CAUTION:
Do not add the first interface after consecutively creating the subnet. Please issue it after receiving the API response.

Example request


{
    "port": {
        "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
        "name": "private-port",
        "admin_state_up": true,
        "availability_zone": "AZ1"
    }
}   
     

Response status

Status code Description
201 Normal response codes
badRequest (400) Error response codes
unauthorized (401) Error response codes
forbidden (403) Error response codes
itemNotFound (404) Error response codes
macGenerationFailure (503) Error response codes
serviceUnavailable (503) Error response codes

Response body (normal status)


{
    "port": {
        "status": "DOWN",
        "name": "private-port",
        "allowed_address_pairs": [],
        "admin_state_up": true,
        "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
        "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
        "binding:vnic_type": "normal",
        "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"
            }
        ],
        "id": "65c0ee9f-d634-4522-8954-51021b570b0d",
        "security_groups": [
            "f0ac4394-7e4a-4409-9701-ba8be283dbc3"
        ],
        "device_id": "",
        "availability_zone": "AZ1"
    }
}
     

Description of response body (normal status)

Item Description
status The port status. Value is ACTIVE or DOWN.
name The port name.
allowed_address_pairs Allowed address pairs.
admin_state_up The administrative state of the router, which is up (true) or down (false).
network_id The ID of the attached network.
tenant_id The ID of the project who owns the network.
extra_dhcp_opts Extra DHCP options.
device_owner The ID of the entity that uses this port. For example, a dhcp agent.
mac_address The MAC address of the port.
fixed_ips IP addresses for the port. Includes the IP address and subnet ID.
id The ID of the port.
security_groups The IDs of any attached security groups.
device_id The ID of the device that uses this port. For example, a virtual server.
binding:vnic_type The vnic type that is bound to the port.

This value is one of the following:

  • normal(virtual nic)
  • direct(pci passthrough)
  • macvtap(virtual interface with a tap-like software interface)
availability_zone The Availability Zone name

CAUTION:

If security_groups is omitted, the default security group of the project will be used.