Updated on 2025-12-23 GMT+08:00

Querying Ports

Function

This API is used to query information about all ports, including the port ID, IP address, and associated cloud service instance.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    vpc:ports:list

    List

    port *

    -

    • vpc:ports:get

    -

    -

    g:EnterpriseProjectId

URI

GET /v3/{project_id}/ports

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition:

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

Range:

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

id

No

Array of strings

Definition:

Port ID.

Range:

The value is in UUID format with hyphens (-).

name

No

Array of strings

Definition:

Port name.

Range:

The value can contain no more than 255 characters. This parameter is left blank by default.

admin_state_up

No

Boolean

Definition:

Administrative status of the port.

Range:

The value can be true (default) or false.

status

No

String

Definition:

Port status.

Range:

  • ACTIVE: The port is active and can be used for communications.

  • BUILD: The port is being created or configured.

  • DOWN: The port is inactive and cannot be used for communications. The status of a HANA SR-IOV VM port is always DOWN.

virsubnet_id

No

Array of strings

Definition:

ID of the virtual subnet that the port belongs to.

Range:

The value is in UUID format with hyphens (-).

device_id

No

Array of strings

Definition:

ID of the device that the port belongs to.

Range:

The value is in UUID format with hyphens (-).

mac_address

No

Array of strings

Definition:

MAC address of the port.

Range:

N/A

device_owner

No

Array of strings

Definition:

Name of the device that the port belongs to.

Range:

  • network:dhcp: DHCP service

  • network:router_interface_distributed: Subnet gateway address

  • compute:xxx: Private IP address of a cloud server network interface. xxx specifies the AZ name. For example, compute:aa-bb-cc indicates that the private IP address is used by a cloud server in the AZ aa-bb-cc.

  • neutron:VIP_PORT: Virtual IP address

  • neutron:LOADBALANCERV2: Shared load balancer

  • neutron:LOADBALANCERV3: Dedicated load balancer

  • network:endpoint_interface: VPC endpoint

  • network:nat_gateway: NAT gateway

  • network:ucmp: UCMP port, which is used by Enterprise Router

device_owner_prefixlike

No

String

Definition:

Name prefix of the device that the port belongs to.

Range:

  • network: Ports whose device_owner prefix is network will be filtered, such as DHCP ports.

  • compute: Ports whose device_owner prefix is compute will be filtered, such as network interfaces of cloud servers.

  • neutron: Ports whose device_owner prefix is compute will be filtered, such as virtual IP addresses.

description

No

Array of strings

Definition:

Port description.

Range:

The value can contain 0 to 255 characters and cannot contain angle brackets (< or >).

binding:host_id

No

Array of strings

Definition:

ID of the host where the port is located.

Range:

N/A

private_ips

No

Array of strings

Definition:

Private IP address of a port.

Range:

  • private_ips=ip_address={ip_address}, where {ip_address} is an IP address, for example, 192.168.21.22.

  • private_ips=subnet_cidr_id={subnet_id}, where {subnet_id} is the ID of an IPv4 or IPv6 subnet, for example, 011fc878-5521-4654-a1ad-f5b0b5820302.

security_groups

No

Array of strings

Definition:

Security groups associated with a port.

Range:

N/A

vpc_id

No

Array of strings

Definition:

ID of the VPC that the port belongs to.

Range:

The value is in UUID format with hyphens (-).

allowed_address_pairs

No

Array of strings

Definition:

IP address and MAC address pairs of the port.

Range:

  • allowed_address_pairs=ip_address={ip_address}, where {ip_address} is an IP address, for example, 192.168.21.22.

  • allowed_address_pairs=mac_address={mac_address}, where {mac_address} is a MAC address, for example, fa:16:3e:b1:da:62.

instance_id

No

String

Definition:

ID of the instance that the port belongs to, for example, RDS instance ID.

Range:

N/A

instance_type

No

String

Definition:

The type of instance that the port belongs to, for example, RDS.

Range:

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

ports

Array of Port objects

Definition:

Response body for querying the ports.

Range:

N/A.

request_id

String

Definition:

Request ID.

Range:

N/A.

page_info

PageInfo object

Definition:

Pagination information.

Range:

N/A.

Table 4 Port

Parameter

Type

Description

admin_state_up

Boolean

Definition:

Administrative state of this port.

Range:

The value can be true (default) or false

binding:host_id

String

Definition:

ID of the host where the port is located.

Range:

N/A

binding:profile

Object

Definition:

User-defined information of the port.

Range:

N/A

binding:vif_details

binding:vif_details object

Definition:

Detailed information about the VIF.

Range:

N/A

binding:vif_type

String

Definition:

Virtual interface type of the port. The value can be ovs, hw_veb, or others. This is an extended attribute.

Range:

  • ovs: Open vSwitch (OVS) is used as the virtual switch.

  • bridge: Linux kernel bridge is used to implement the virtual network.

  • hw_veb: Hardware Virtual Ethernet Bridge, which is usually used for physical network interfaces that support SR-IOV.

  • vhostuser: The vhost-user protocol uses Unix domain sockets to communicate with external virtual switches.

  • distributed: Distributed virtual switches.

  • binding_failed: The port binding failed.

  • unbound: The port is not bound to any network backend.

binding:vnic_type

String

Definition:

Type of the bound vNIC.

Range:

  • normal: softswitch.

  • direct: SR-IOV PCIe passthrough (not supported).

  • baremetal: used for bare metal servers.

created_at

String

Definition:

Time when the port was created.

Range:

The value is a UTC time in the format of yyyy-MM-ddTHH:mm:ss.

updated_at

String

Definition:

Time when the port was last updated.

Range:

The value is a UTC time in the format of yyyy-MM-ddTHH:mm:ss.

description

String

Definition:

Port description.

Range:

The value can contain 0 to 255 characters and cannot contain angle brackets (< or >).

device_id

String

Definition:

ID of the device that the port belongs to.

Range:

The value is in UUID format with hyphens (-).

device_owner

String

Definition:

Name of the device that the port belongs to.

Range:

  • network:dhcp: DHCP service

  • network:router_interface_distributed: Subnet gateway address

  • compute:xxx: Private IP address of a cloud server network interface. XXX specifies the AZ name. For example, compute:aa-bb-cc indicates that the private IP address is used by a cloud server in the AZ aa-bb-cc.

  • neutron:VIP_PORT: Virtual IP address

  • neutron:LOADBALANCERV2: Shared load balancer

  • neutron:LOADBALANCERV3: Dedicated load balancer

  • network:endpoint_interface: VPC endpoint

  • network:nat_gateway: NAT gateway

  • network:ucmp: UCMP port, which is used by Enterprise Router.

ecs_flavor

String

Definition:

Flavor of the ECS that the port belongs to.

Range:

N/A

id

String

Definition:

Port ID.

Range:

The value is in UUID format with hyphens (-).

instance_id

String

Definition:

ID of the instance that the port belongs to, for example, RDS instance ID.

Range:

N/A

instance_type

String

Definition:

The type of instance that the port belongs to, for example, RDS.

Range:

N/A

mac_address

String

Definition:

MAC address of the port.

Range:

N/A

name

String

Definition:

Port name.

Range:

The value can contain no more than 255 characters. This parameter is left blank by default.

port_security_enabled

Boolean

Definition:

Whether the security option is enabled for a port. If the option is not enabled, the security group and DHCP snooping do not take effect.

Range:

  • true: The security option is enabled for a port.

  • false: The security option is not enabled for a port.

private_ips

Array of PrivateIpInfo objects

Definition:

Private IP address of a port.

Range:

N/A

project_id

String

Definition:

ID of the project that the port belongs to.

Range:

N/A

security_groups

Array of strings

Definition:

Security groups bound to a port.

Range:

N/A

status

String

Definition:

Port status.

Range:

  • ACTIVE: The port is active and can be used for communications.

  • BUILD: The port is being created or configured.

  • DOWN: The port is inactive and cannot be used for communications. The status of a HANA SR-IOV VM port is always DOWN.

tenant_id

String

Definition:

ID of the tenant that the port belongs to.

Range:

N/A

virsubnet_id

String

Definition:

ID of the virtual subnet that the port belongs to.

Range:

The value is in UUID format with hyphens (-).

vpc_id

String

Definition:

ID of the VPC that the port belongs to.

Range:

The value is in UUID format with hyphens (-).

vpc_tenant_id

String

Definition:

Tenant ID of the VPC that the port belongs to.

Range:

N/A

vtep_ip

String

Definition:

VTEP IP address of the port, that is, the IP address of the virtual tunnel endpoint.

Range:

N/A

enable_efi

Boolean

Definition:

Whether to enable efi. If efi is enabled, the port supports vRoCE.

Range:

  • true: efi is enabled.

  • false: efi is disabled.

scope

String

Definition:

Scope of the subnet where the port is located (edge cloud scenario).

Range:

  • center: The subnet is in a central AZ.

  • {publicBorderGroup}: The subnet is in a public border group. The public border group limits the AZs of a subnet but it can have multiple edge AZs associated.

zone_id

String

Definition:

ID of the AZ that the port belongs to.

Range:

N/A

binding:migration_info

Object

Definition:

Information about the destination node where the port is migrated, including binding:vif_details and binding:vif_type of the destination node.

Range:

N/A

extra_dhcp_opts

Array of PortExtraDhcpOpt objects

Definition:

Extended DHCP attributes.

Range:

N/A

position_type

String

Definition:

Location type of the port in the edge scenario.

Range:

Default Value: center

instance_info

Object

Definition:

Information about the instance with the port bound.

Range:

N/A

tags

Array of ResponseTag objects

Definition:

Tags of a port, including tag keys and tag values, which can be used to classify and identify resources. For details, see the tag objects.

Range:

N/A

allowed_address_pairs

Array of AllowedAddressPair objects

Definition:

IP address and MAC address pairs of the port.

Range:

  • The IP address cannot be 0.0.0.0/0.

  • Configure a dedicated security group if a large CIDR block (subnet mask less than 24) is configured for parameter allowed_address_pairs.

  • If the value of allowed_address_pairs is 1.1.1.1/0, the source/destination check is disabled.

  • Set allowed_address_pairs of the cloud server network interface to 1.1.1.1/0.

Table 5 binding:vif_details

Parameter

Type

Description

primary_interface

Boolean

Definition:

Whether this is the primary network interface of the cloud server.

Range:

  • true: This is the primary network interface of the cloud server.

  • false: This is not the primary network interface of the cloud server.

port_filter

Boolean

Definition:

Whether the network service provides port filtering features, such as security groups and anti-MAC/IP spoofing.

Range:

  • true: The network service provides port filtering features.

  • false: The network service does not provide port filtering features.

ovs_hybrid_plug

Boolean

Definition:

Whether the OVS/bridge hybrid mode is used.

Range:

  • true: The OVS/bridge hybrid mode is used.

  • false: The OVS/bridge hybrid mode is not used.

Table 6 PrivateIpInfo

Parameter

Type

Description

subnet_cidr_id

String

Definition:

ID of the subnet where a port works.

Range:

N/A

ip_address

String

Definition:

Private IP address of a port.

Range:

N/A

Table 7 PortExtraDhcpOpt

Parameter

Type

Description

opt_name

String

Definition:

DHCP attribute name. This is the name of additional control information or network configuration parameter transmitted when the DHCP server allocates IP addresses to clients.

Range:

N/A.

opt_value

String

Definition:

DHCP attribute value. This is the value of additional control information or network configuration parameter transmitted when the DHCP server allocates IP addresses to clients.

Range:

N/A.

Table 8 ResponseTag

Parameter

Type

Description

key

String

Definition:

Tag key.

Range:

  • A tag key can contain a maximum of 128 Unicode characters and cannot be left blank.

  • Each tag key of a resource must be unique.

  • The value can contain:

    • Letters

    • Digits

    • Special characters: underscores (_), periods (.), colons (:), plus signs (+), hyphens (-), and equal signs (=)

    • Chinese characters

value

String

Definition:

Tag value.

Range:

  • Each value can contain a maximum of 255 Unicode characters and can be left blank.

  • The value can contain:

    • Letters

    • Digits

    • Special characters: underscores (_), periods (.), colons (:), plus signs (+), hyphens (-), and equal signs (=)

    • Chinese characters

Table 9 AllowedAddressPair

Parameter

Type

Description

ip_address

String

Definition:

IP address.

Constraints:

Configure a dedicated security group if a large CIDR block (subnet mask less than 24) is configured for parameter allowed_address_pairs.

Range:

Single IP address, for example, 192.168.21.25

A CIDR block, for example, 192.168.21.0/24

Default Value:

N/A

mac_address

String

Definition:

MAC address.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

Table 10 PageInfo

Parameter

Type

Description

previous_marker

String

Definition:

The first record on the current page.

Range:

N/A

current_count

Integer

Definition:

Total number of resources on the current page.

Range:

N/A

next_marker

String

Definition:

The last record on the current page. The next_marker field does not exist if the page is the last one.

Range:

N/A

Example Requests

Query ports.

GET https://{Endpoint}/v3/f5dab68cd75740e68c599e9af5fe0aed/ports

Example Responses

Status code: 200

The GET operation is successful. For more status codes, see Status Codes.

{
  "request_id" : "45c58a32dd0619b9ba6ee29fd1d09fa2",
  "ports" : [ {
    "name" : "port-1",
    "id" : "b48145e3-3d89-4dbc-a2f3-98dfac3fbce5",
    "admin_state_up" : true,
    "status" : "DOWN",
    "project_id" : "11e8dd119c77479db890e266e68c1ecf",
    "device_id" : "",
    "mac_address" : "fa:16:3e:66:d5:93",
    "device_owner" : "",
    "description" : "",
    "vpc_id" : "1e8a8ea6-c641-4461-810c-5851868f98be",
    "zone_id" : "",
    "scope" : "center",
    "position_type" : "center",
    "vtep_ip" : null,
    "created_at" : "2025-11-27T02:19:40",
    "updated_at" : "2025-11-27T02:19:40",
    "port_security_enabled" : true,
    "security_groups" : [ "dc0c44a8-4336-4f6d-a31a-b299ff2f394b" ],
    "allowed_address_pairs" : [ ],
    "extra_dhcp_opts" : [ ],
    "instance_info" : null,
    "instance_id" : "",
    "instance_type" : "",
    "ecs_flavor" : "",
    "enable_efi" : false,
    "virsubnet_id" : "26c31230-6c2e-4dc3-b423-97ea75abac7c",
    "private_ips" : [ {
      "subnet_cidr_id" : "0ab40e38-edd2-46ff-bfec-d092d417275b",
      "ip_address" : "192.168.23.213"
    } ],
    "vpc_tenant_id" : "11e8dd119c77479db890e266e68c1ecf",
    "tags" : [ ],
    "binding:host_id" : "",
    "binding:vif_type" : "unbound",
    "binding:vnic_type" : "normal",
    "binding:vif_details" : { },
    "binding:profile" : { },
    "binding:migration_info" : { }
  }, {
    "name" : "port-2",
    "id" : "96af0e0b-b4cc-43b3-95b7-0860995bd09f",
    "admin_state_up" : true,
    "status" : "DOWN",
    "project_id" : "11e8dd119c77479db890e266e68c1ecf",
    "device_id" : "",
    "mac_address" : "fa:16:3e:74:f9:04",
    "device_owner" : "",
    "description" : "",
    "vpc_id" : "a86319e7-8c6e-4d3c-aebc-6227a19debcc",
    "zone_id" : "",
    "scope" : "center",
    "position_type" : "center",
    "vtep_ip" : null,
    "created_at" : "2023-07-31T07:16:08",
    "updated_at" : "2025-07-03T11:40:53",
    "port_security_enabled" : true,
    "security_groups" : [ "bec88803-676d-4f20-a0b2-e231e9474e80" ],
    "allowed_address_pairs" : [ {
      "ip_address" : "1.1.1.1/0",
      "mac_address" : "fa:16:3e:74:f9:04"
    } ],
    "extra_dhcp_opts" : [ ],
    "instance_info" : null,
    "instance_id" : "",
    "instance_type" : "",
    "ecs_flavor" : "",
    "enable_efi" : false,
    "virsubnet_id" : "1bcac697-e9e4-4d46-bf53-02053a98e299",
    "private_ips" : [ {
      "subnet_cidr_id" : "d369c69b-d648-4989-87be-e2c493d96f9b",
      "ip_address" : "192.168.45.56"
    } ],
    "vpc_tenant_id" : "11e8dd119c77479db890e266e68c1ecf",
    "tags" : [ ],
    "binding:host_id" : "",
    "binding:vif_type" : "unbound",
    "binding:vnic_type" : "normal",
    "binding:vif_details" : { },
    "binding:profile" : { },
    "binding:migration_info" : { }
  } ],
  "page_info" : {
    "previous_marker" : "b48145e3-3d89-4dbc-a2f3-98dfac3fbce5",
    "current_count" : 2
  }
}

Status Codes

Status Code

Description

200

The GET operation is successful. For more status codes, see Status Codes.

Error Codes

See Error Codes.