Updated on 2022-08-11 GMT+08:00

Creating a Port (Discarded)

Function

This API is used to create a port.

URI

POST /v1/ports

Request Message

  • Request parameter
    Table 1 Request parameter

    Name

    Mandatory

    Type

    Description

    port

    Yes

    port object

    Specifies the port objects. For details, see Table 2.

    Table 2 Description of the port field

    Name

    Mandatory

    Type

    Description

    name

    No

    String

    • Specifies the port name.
    • The value can contain no more than 255 characters. This parameter is left blank by default.

    network_id

    Yes

    String

    • Specifies the ID of the network to which the port belongs.
    • The network ID must be a real one in the network environment.

    admin_state_up

    No

    Boolean

    • Specifies the administrative state of the port.
    • The value can only be true, and the default value is true.

    fixed_ips

    No

    Array of fixed_ip objects

    • Specifies the port IP address. For details, see Table 3.

      For example, the value is "fixed_ips": [{"subnet_id": "4dc70db6-cb7f-4200-9790-a6a910776bba", "ip_address": "192.169.25.79"}].

    • A port supports only one fixed IP address that cannot be changed.

    tenant_id

    No

    String

    Specifies the project ID.

    security_groups

    No

    Array of strings

    Specifies the UUID of the security group, for example, "security_groups": ["a0608cbf-d047-4f54-8b28-cd7b59853fff"]. This is an extended attribute.

    allowed_address_pairs

    No

    Array of allow_address_pair objects

    • Specifies a set of zero or more allowed address pairs. An address pair consists of an IP address and MAC address. This attribute is extended. For details, see parameter allow_address_pair in Table 4.
    • The IP address cannot be 0.0.0.0.
    • Configure a dedicated security group for the port if the parameter allowed_address_pairs has a large CIDR block (subnet mask less than 24).
    • If the value of allowed_address_pairs is 1.1.1.1/0, the source/destination check is disabled.

    extra_dhcp_opts

    No

    Array of extra_dhcp_opt objects

    Specifies the extended option (extended attribute) of DHCP.

    port_security_enabled

    No

    Boolean

    Specifies whether the security option is enabled for the port. If the option is not enabled, the security group and DHCP snooping do not take effect. The default value is true.

    Table 3 fixed_ip object

    Name

    Mandatory

    Type

    Description

    subnet_id

    No

    String

    • Specifies the subnet ID.
    • You cannot change the parameter value.

    ip_address

    No

    String

    • Specifies the port IP address.
    • You cannot change the parameter value.
    Table 4 allow_address_pair object

    Name

    Mandatory

    Type

    Description

    ip_address

    No

    String

    • Specifies the IP address.
    • You cannot set it to 0.0.0.0.
    • Configure a dedicated security group for the port if the parameter allowed_address_pairs has a large CIDR block (subnet mask less than 24).
    • If the value of allowed_address_pairs is 1.1.1.1/0, the source/destination check is disabled.

    mac_address

    No

    String

    Specifies the MAC address.

    Table 5 extra_dhcp_opt object

    Name

    Mandatory

    Type

    Description

    opt_name

    No

    String

    Specifies the option name.

    opt_value

    No

    String

    Specifies the option value.

  • Example request
    POST https://{Endpoint}/v1/ports
    
    {
        "port": {
            "fixed_ips": [
                {
                    "ip_address": "192.168.0.38",
                    "subnet_id": "06bc2359-d75e-4f96-82f4-313e39c7148c"
                }
            ],
            "network_id": "28a1c93c-9a5e-4a9f-813b-e495bdef7d34",
            "security_groups": [
                "f2c5b3fc-b971-4a86-87b9-032586260e3e"
            ]
        }
    }

Response Message

  • Response parameter
    Table 6 Response parameter

    Name

    Type

    Description

    port

    port object

    Specifies the port objects. For details, see Table 7.

    Table 7 Description of the port field

    Name

    Type

    Description

    id

    String

    Specifies the port ID, which uniquely identifies the port.

    name

    String

    • Specifies the port name.
    • The value can contain no more than 255 characters. This parameter is left blank by default.

    network_id

    String

    • Specifies the ID of the network to which the port belongs.
    • The network ID must be a real one in the network environment.

    admin_state_up

    Boolean

    • Specifies the administrative state of the port.
    • The value can only be true, and the default value is true.

    mac_address

    String

    • Specifies the port MAC address.
    • The system automatically sets this parameter, and you are not allowed to configure the parameter value.

    fixed_ips

    Array of fixed_ip objects

    • Specifies the port IP address. For example, the value is "fixed_ips": [{"subnet_id": "4dc70db6-cb7f-4200-9790-a6a910776bba", "ip_address": "192.169.25.79"}].
    • A port supports only one fixed IP address that cannot be changed.

    device_id

    String

    • Specifies the ID of the device to which the port belongs.
    • The system automatically sets this parameter, and you are not allowed to configure or change the parameter value.

    device_owner

    String

    • Specifies the belonged device, which can be the DHCP server, router, load balancer, or Nova.
    • The system automatically sets this parameter, and you are not allowed to configure or change the parameter value.

    tenant_id

    String

    Specifies the project ID.

    status

    String

    • Specifies the port status. The status of a HANA SR-IOV VM port is always DOWN.
    • The value can be ACTIVE, BUILD, or DOWN.

    security_groups

    Array of strings

    Specifies the security group UUID (extended attribute).

    allowed_address_pairs

    Array of allow_address_pairobjects

    • Specifies a set of zero or more allowed address pairs. An address pair consists of an IP address and MAC address. This attribute is extended. For details, see parameter allow_address_pair in Table 9.
    • The IP address cannot be 0.0.0.0.
    • Configure a dedicated security group for the port if the parameter allowed_address_pairs has a large CIDR block (subnet mask less than 24).
    • If the value of allowed_address_pairs is 1.1.1.1/0, the source/destination check is disabled.

    extra_dhcp_opts

    Array of extra_dhcp_opt objects

    Specifies the extended option (extended attribute) of DHCP. For details, see Table 10.

    binding:vif_details

    Object

    Specifies the VIF details. Parameter ovs_hybrid_plug specifies whether the OVS/bridge hybrid mode is used.

    binding:profile

    Object

    Specifies the user-defined settings. This is an extended attribute.

    Instructions:

    • The internal_elb field is in boolean type and is available to common tenants. Set the value of this parameter to true only when you assign a virtual IP address to an internal network load balancer. Common tenants do not have the permission to change the value of this field, which is maintained by the system.

      Example:

      {"internal_elb": true}

    • The disable_security_groups field is in boolean type and is available to common tenants. The default value is false. In high-performance communication scenarios, you can set the parameter value to true, which makes this parameter to be available to common tenants. You can specify this parameter when creating a port. Currently, the value of this parameter can only be set to true.

      Example:

      {"disable_security_groups": true },

      Currently, the value can only be set to true. When the value is set to true, the FWaaS function does not take effect.

    binding:vnic_type

    String

    • Specifies the type of the bound vNIC.
    • The value can be normal or direct. Parameter normal indicates software switching. Parameter direct indicates SR-IOV PCIe passthrough, which is not supported.

    port_security_enabled

    Boolean

    Specifies whether the security option is enabled for the port. If the option is not enabled, the security group and DHCP snooping do not take effect. The default value is true.

    Table 8 fixed_ip object

    Name

    Type

    Description

    subnet_id

    String

    • Specifies the subnet ID.
    • You cannot change the parameter value.

    ip_address

    String

    Specifies the port IP address.

    Table 9 allow_address_pair object

    Name

    Type

    Description

    ip_address

    String

    • Specifies the IP address.
    • You cannot set it to 0.0.0.0.
    • Configure a dedicated security group for the port if the parameter allowed_address_pairs has a large CIDR block (subnet mask less than 24).

    mac_address

    String

    Specifies the MAC address.

    Table 10 extra_dhcp_opt object

    Name

    Type

    Description

    opt_name

    String

    Specifies the option name.

    opt_value

    String

    Specifies the option value.

  • Example response
    {
        "port": {
            "id": "d00f9c13-412f-4855-8af3-de5d8c24cd60",
            "name": "test",
            "status": "DOWN",
            "admin_state_up": "true",
            "fixed_ips": [
                {
                    "subnet_id": "70f2e74b-e660-410a-b754-0ca46744348a",
                    "ip_address": "10.128.1.10"
                }
            ],
            "mac_address": "fa:16:3e:d7:f2:6c",
            "network_id": "5b808927-13c9-4e60-a4f4-ed6ffe225167",
            "tenant_id": "43f2d1cca56a40729dcb17212482f34d",
            "device_id": "",
            "device_owner": "",
            "security_groups": [
                "02b4e8ee-74fa-4a31-802e-5490df11245e"
            ],
            "extra_dhcp_opts": [],
            "allowed_address_pairs": [],
            "binding:vnic_type": "normal",
            "binding:vif_details": {},
            "binding:profile": {},
            "port_security_enabled":true
        }
    }

Status Code

See Status Codes.

Error Code

See Error Codes.