Adding an ECS NIC

Function

This interface is used to add a single NIC to an ECS.

URI

  • URI format

    POST /v2/{project_id}/servers/{server_id}/os-interface

  • Parameter description

    Name

    Mandatory

    Description

    project_id

    Yes

    Specifies the tenant ID.

    server_id

    Yes

    Specifies the ECS ID.

Request

  • Parameter description

    Name

    Mandatory

    Type

    Description

    interfaceAttachment

    Yes

    Dictionary data structure [1]

    Specifies the parameters of the NIC to be added.

[1] interfaceAttachment field data structure description

Name

Mandatory

Type

Description

port_id

No

String

Specifies the port ID.

net_id

No

String

Specifies the network ID.

This parameter is invalid if parameter port_id is specified.

fixed_ips

No

List data structure [2]

Specifies the private IP address.

This parameter is invalid if port_id has been specified. This parameter must be specified together with net_id.

Only the first element in the list is valid.

[2] fixed_ips field data structure description

Name

Type

Description

ip_address

String

Specifies the IP address.

  • Example request
    {
        "interfaceAttachment": {
            "port_id": "ce531f90-199f-48c0-816c-13e38010b442"
        }
    }

Response

  • Response description

    Name

    Type

    Description

    interfaceAttachment

    Dictionary data structure [1]

    Specifies the ECS NIC information.

[1] interfaceAttachment field data structure description

Name

Type

Description

port_state

String

Specifies the port state.

fixed_ips

List data structure [2]

Specifies the NIC IP address.

port_id

String

Specifies the port ID.

net_id

String

Specifies the network ID.

mac_addr

String

Specifies the MAC address.

[2] fixed_ips field data structure description

Name

Type

Description

subnet_id

String

Specifies the ID of the subnet used by the NIC.

ip_address

String

Specifies the NIC IP address.

  • Example response
    {
        "interfaceAttachment": {
            "port_state": "DOWN",
            "fixed_ips": [
                {
                    "subnet_id": "d9cfef77-0151-4c2a-9ed5-d951ada8adf3",
                    "ip_address": "10.0.1.11"
                }
            ],
            "port_id": " ce531f90-199f-48c0-816c-13e38010b442",
            "net_id": "0dc714fa-9022-4a03-bb22-9821a396bb9d",
            "mac_addr": "fa:16:3e:63:75:b2"
        }
    }

Returned Values

See General Request Returned Values.

Registration