Updated on 2022-09-23 GMT+08:00

Querying NICs of an ECS

Function

This API is used to query NICs of an ECS.

URI

GET /v1/{project_id}/cloudservers/{server_id}/os-interface

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For details about how to obtain the ID, see Obtaining a Project ID.

server_id

Yes

Specifies the ECS ID.

Request

None

Response

Table 2 describes the response parameters.
Table 2 Response parameters

Parameter

Type

Description

interfaceAttachments

Array of objects

Specifies ECS NICs. For details, see Table 3.

attachableQuantity

Object

Specifies the number of NICs that can be attached to an ECS. For details, see Table 4.

Table 3 interfaceAttachments field description

Parameter

Type

Description

port_state

String

Specifies the NIC port status.

fixed_ips

Array of objects

Specifies private IP addresses for NICs. For details, see Table 5.

net_id

String

Specifies the network ID to which the NIC port belongs.

port_id

String

Specifies the NIC port ID.

mac_addr

String

Specifies the MAC address of the NIC.

delete_on_termination

Boolean

Specifies whether to delete a NIC when detaching it.

true: The NIC will be deleted. false: The NIC will not be deleted.

driver_mode

String

Specifies the NIC driver type in Guest OS. The value can be virtio or hinic. The default value is virtio.

min_rate

Integer

Specifies the minimum NIC bandwidth.

multiqueue_num

Integer

Specifies the number of queues.

The value can be 1, 2, 4, 8, 16, or 28.

pci_address

String

Specifies the BDF number of the network interface in Linux GuestOS.

NOTE:

If the NIC is not supported, no information will be returned.

Table 4 attachableQuantity field description

Parameter

Type

Description

free_nic

Integer

Specifies the remaining number of NICs that can be attached to an ECS.

Table 5 fixed_ips field description

Parameter

Type

Description

subnet_id

String

Specifies the subnet of the NIC private IP address.

ip_address

String

Specifies the NIC private IP address.

Example Request

GET https://{endpoint}/v1/{project_id}/cloudservers/{server_id}/os-interface

Example Response

{
    "interfaceAttachments": [
        {
            "port_state": "ACTIVE",
            "fixed_ips": [
                {
                    "subnet_id": "ba31e1f5-fa76-4530-862c-5176fad033cf",
                    "ip_address": "192.168.0.33"
                }
            ],
            "net_id": "610a4af2-1d90-4d2b-8057-dc238b26febf",
            "port_id": "04819c0a-6a07-44b6-945e-fb932071888e",
            "mac_addr": "fa:16:3e:45:65:c4"        }
    ]
}