Help Center/ Enterprise Switch/ API Reference/ Layer 2 Connection/ Querying the Details About a Layer 2 Connection
Updated on 2025-12-04 GMT+08:00

Querying the Details About a Layer 2 Connection

Function

This API is used to query the details about a Layer 2 connection.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

esw:connection:get

Read

-

-

-

-

URI

GET /v3/{project_id}/l2cg/instances/{instance_id}/connections/{connection_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

connection_id

Yes

String

  • Definition: ID of a Layer 2 connection.

  • Constraints: The value is in the UUID format with hyphens (-).

  • Range: N/A

  • Default value: N/A

instance_id

Yes

String

  • Definition: Unique ID of an enterprise switch.

  • Constraints: The value is in the UUID format with hyphens (-).

  • Range: N/A

  • Default value: N/A

project_id

Yes

String

  • Definition: ID of the project to which the enterprise switch belongs.

  • Constraints: N/A

  • Range: N/A

  • Default value: N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

request_id

String

  • Definition: Unique request ID.

  • Constraints: The value is in the UUID format.

  • Range: N/A

  • Default value: N/A

connection

Connection object

  • Definition: Response body for querying the details of a Layer 2 connection.

  • Constraints: N/A

  • Range: N/A

  • Default value: N/A

Table 3 Connection

Parameter

Type

Description

fixed_ips

Array of strings

  • Definition: Active and standby interface IP addresses used by the enterprise switch in the local Layer 2 subnet.

  • Constraints: The value is a string list. You can configure two strings in the standard IPv4 format. The IP address must be in the CIDR block of the Layer 2 subnet.

  • Range: N/A

  • Default value: N/A

id

String

  • Definition: ID of a Layer 2 connection.

  • Constraints: The value is in the UUID format with hyphens (-).

  • Range: N/A

  • Default value: N/A

instance_id

String

  • Definition: Unique ID of the enterprise switch.

  • Constraints: The value is in the UUID format with hyphens (-).

  • Range: N/A

  • Default value: N/A

name

String

  • Definition: Layer 2 connection name.

  • Constraints:

    • The value can contain 1 to 64 characters.

    • The value can contain letters, digits, underscores (_), hyphens (-), and periods (.).

  • Range: N/A

  • Default value: N/A

project_id

String

  • Definition: ID of the project to which the enterprise switch belongs.

  • Constraints: N/A

  • Range: N/A

  • Default value: N/A

remote_infos

Array of RemoteInfosResult objects

  • Definition: Remote tunnel information.

  • Constraints: N/A

  • Range: N/A

  • Default value: N/A

status

String

  • Definition: Status of the Layer 2 connection.

  • Constraints: N/A

  • Range:

    • pending: The Layer 2 connection is being created.

    • connected: The Layer 2 connection is connected.

    • disconnect: The Layer 2 connection is disconnected.

    • failed: Failed to create the Layer 2 connection.

    • abnormal: The Layer 2 connection is abnormal.

  • Default value: N/A

virsubnet_id

String

  • Definition: ID of the Layer 2 subnet associated with the Layer 2 connection.

  • Constraints:

    • You need to use the IDs of the subnets that you can manage. The ID is the network ID in the subnet details.

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

  • Range: N/A

  • Default value: N/A

vpc_id

String

  • Definition: ID of the VPC where the enterprise switch is created.

  • Constraints:

    • You need to use the IDs of the VPCs that you can manage.

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

  • Range: N/A

  • Default value: N/A

created_at

String

  • Definition: Time when the Layer 2 connection was created.

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

  • Range: N/A

  • Default value: N/A

updated_at

String

  • Definition: Time when the Layer 2 connection was updated.

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

  • Range: N/A

  • Default value: N/A

Table 4 RemoteInfosResult

Parameter

Type

Description

segmentation_id

Integer

  • Definition: The tunnel ID of the Layer 2 connection, also the VXLAN network identifier (VNI).

  • Constraints: The value must be the same as the VNI configured for the remote VXLAN.

  • Range: 1 to 16777216

  • Default value: N/A

tunnel_ip

String

  • Definition: The remote tunnel IP address of the enterprise switch.

  • Constraints: The value cannot conflict with an existing subnet IP address.

  • Range: A standard IPv4 address, for example, 192.168.1.1.

  • Default value: N/A

tunnel_port

Integer

  • Definition: The remote tunnel port of the Layer 2 connection.

  • Constraints: N/A

  • Range: 4789

  • Default value: N/A

tunnel_type

String

  • Definition: The tunnel protocol type of the enterprise switch.

  • Constraints: N/A

  • Range: vxlan

  • Default value: N/A

Example Requests

GET https://{endpoint}/v3/b2782e6708b8475c993e6064bc456bf8/l2cg/instances/94e7bf9d-c5a0-40da-9bcb-4407fde1907d/connections/cf7c95de-1464-48db-9f00-d773a5a8e29d

Example Responses

Status code: 200

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

{
  "request_id" : "7d685ccd5ce38dbd41d4ed4a7ef9cf19",
  "connection" : {
    "name" : "l2conn-ba19",
    "id" : "9cb4f6bd-89a0-4633-b53e-c333b8c9277f",
    "status" : "abnormal",
    "created_at" : "2025-06-24T06:09:03Z",
    "updated_at" : "2025-08-22T02:30:50Z",
    "project_id" : "88104fcc62a640bfa0a0bf687607621c",
    "instance_id" : "16b2eea7-5935-445d-8410-083b7064b939",
    "vpc_id" : "41829b5e-66c0-4928-a3d4-f4570ce81d8f",
    "virsubnet_id" : "7ef08d1e-6e82-4133-9147-5dde6a50ee90",
    "fixed_ips" : [ "192.168.1.170", "192.168.1.140" ],
    "remote_infos" : [ {
      "segmentation_id" : 6790,
      "tunnel_ip" : "192.168.4.202",
      "tunnel_port" : 4789,
      "tunnel_type" : "vxlan"
    } ]
  }
}

Status Codes

Status Code

Description

200

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

Error Codes

See Error Codes.