Skip to main content

vSwitch

2.10.1 Add a cluster vSwitch​

API endpoint

POST  /NSphere/api/network-resource/cluster/vswitch

API description

Add a cluster vSwitch.

Request Content-Type

application/json

Response Content-Type

application/json

Request example

{
"clusterId": 0,
"name": "",
"desc": null,
"mode": 0,
"vlanId": null,
"networkType": 2,
"acceleMode": 0,
"enableDpdk": false,
"mtu": 1500,
"multicast": false,
"hostNetInfos": [
{
"hostId": 0,
"phyPrioripy": [],
"ipAddr": null,
"netmask": null,
"gateway": null,
"addressIpv6": null,
"netmaskIpv6": null,
"gatewayIpv6": null,
"lacpMode": "off",
"bondMode": null,
"pnics": [
{
"pnicName": "",
"pciAddr": null,
"mac": null,
"acceleMode": 0
}
],
"reselect": false,
"algorithm": null
}
]
}

Request parameters

Parameter name

Description

Location

Required

Type

schema

apiClusterVSwitchDTO

Parameters for adding a cluster vSwitch

body

true

ApiClusterVSwitchDTO

ApiClusterVSwitchDTO

clusterId

Cluster ID

true

integer(int64)

name

vSwitch name. The name must not be auto, default, eql, all, or vswitch0; must not start with eth, eno, vnet, dhcp, dpdk, or tbr; and must not end with _bond. Only letters, digits, hyphens, and underscores are allowed. The first character cannot be a hyphen, and the name cannot consist entirely of digits.

true

string

desc

vSwitch description.

false

string

mode

Forwarding mode. Valid values: 0 (VEB), 1 (VEPA), 2 (multi-channel), 3 (VXLAN(SDN)), 4 (VXLAN(NSphere)). Default: 0.

true

integer(int32)

vlanId

vSwitch VLAN ID. Value range: integer 2-4094. Default: null.

false

integer(int32)

networkType

vSwitch network type, represented as a binary bit mask. From the low-order bit to the high-order bit: bit 0 management network, bit 1 business network, bit 2 storage network, bit 3 backup network, bit 4 migration network, bit 6 traffic-mirror network, bit 8 mirror network. A bit set to 1 indicates the corresponding network type. For example, 2 in binary is 10, meaning business network; 3 in binary is 11, meaning management network plus business network. Default: 2.

true

integer(int32)

acceleMode

Acceleration mode. Valid values: 0 (normal), 1 (smart NIC), 11 (DPDK). Default: 0.

true

integer(int32)

enableDpdk

Whether DPDK is enabled. Valid values: true (enabled), false (disabled). Default: false.

false

boolean

mtu

MTU. Valid range: an integer 1000-9000 for IPv4, or 1280-9000 for IPv6. Default: 1500.

true

integer(int32)

multicast

Whether multicast is enabled. Valid values: true (enabled), false (disabled). Default: false.

true

boolean

hostNetInfos

Host network configuration for adding a cluster vSwitch

true

array

ApiClusterVSwitchHostNetInfoDTO

hostId

ID of the host where the vSwitch resides

true

integer(int64)

phyPrioripy

Priority of physical interfaces. Default: null. Multiple physical interfaces are separated by commas.

false

array

string

ipAddr

IPv4 address. Default: null. Note: once an IP address is configured, all hosts in the cluster use this IP address when adding this vSwitch.

false

string

netmask

IPv4 subnet mask. Default: null.

false

string

gateway

IPv4 gateway. Default: null.

false

string

addressIpv6

IPv6 address. Default: null. Note: once an IPv6 address is configured, all hosts in the cluster use this IPv6 address when adding this vSwitch.

false

string

netmaskIpv6

IPv6 subnet prefix length. Default: null.

false

integer(int32)

gatewayIpv6

IPv6 gateway. Default: null.

false

string

lacpMode

Link aggregation mode. active: dynamic; off: static.

false

string

bondMode

Load-sharing mode. Valid values: balance-tcp (advanced), balance-slb (basic), active-backup (active-standby). Default: null.

false

string

pnics

vSwitch physical ports

false

array

ApiVSwitchPnicDTO

pnicName

Physical port name

true

string

pciAddr

Physical port unique identifier

false

string

mac

Physical port MAC

false

string

acceleMode

Acceleration mode. Valid values: 0 (normal), 1 (smart NIC), 11 (DPDK). Default: 0.

true

integer(int32)

reselect

Whether failback switch is enabled. Valid values: true (enabled), false (disabled). Default: false.

false

boolean

algorithm

Primary link selection method. Valid values: speed (speed priority), order (manual). Default: null.

false

string

Response status

Status code

Description

schema

200

OK

ApiResponse

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

string

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {}
}

2.10.2 Edit a cluster vSwitch​

API endpoint

PUT  /NSphere/api/network-resource/cluster/vswitch

API description

Edit a cluster vSwitch.

Request Content-Type

application/json

Response Content-Type

application/json

Request example

{
"id": 0,
"clusterId": 0,
"desc": null,
"vlanId": null,
"mtu": 0,
"multicast": true,
"hostNetInfos": [
{
"hostId": 0,
"phyPrioripy": [],
"ipAddr": null,
"netmask": null,
"gateway": null,
"addressIpv6": null,
"netmaskIpv6": null,
"gatewayIpv6": null,
"lacpMode": "off",
"bondMode": null,
"pnics": [
{
"pnicName": "",
"pciAddr": null,
"mac": null,
"acceleMode": 0
}
],
"reselect": false,
"algorithm": null
}
]
}

Request parameters

Parameter name

Description

Location

Required

Type

schema

apiClusterVSwitchModifyDTO

Parameters for adding a cluster vSwitch

body

true

ApiClusterVSwitchModifyDTO

ApiClusterVSwitchModifyDTO

id

vSwitch ID

true

integer(int64)

clusterId

Cluster ID

true

integer(int64)

desc

vSwitch description.

false

string

vlanId

vSwitch VLAN ID. Value range: integer 2-4094. Default: null.

false

integer(int32)

mtu

MTU. Valid range: an integer 1000-9000 for IPv4, or 1280-9000 for IPv6. Default: 1500.

true

integer(int32)

multicast

Whether multicast is enabled. Valid values: true (enabled), false (disabled). Default: false.

true

boolean

hostNetInfos

Host network configuration for adding a cluster vSwitch

true

array

ApiClusterVSwitchHostNetInfoDTO

hostId

ID of the host where the vSwitch resides

true

integer(int64)

phyPrioripy

Priority of physical interfaces. Default: null. Multiple physical interfaces are separated by commas.

false

array

string

ipAddr

IPv4 address. Default: null. Note: once an IP address is configured, all hosts in the cluster use this IP address when adding this vSwitch.

false

string

netmask

IPv4 subnet mask. Default: null.

false

string

gateway

IPv4 gateway. Default: null.

false

string

addressIpv6

IPv6 address. Default: null. Note: once an IPv6 address is configured, all hosts in the cluster use this IPv6 address when adding this vSwitch.

false

string

netmaskIpv6

IPv6 subnet prefix length. Default: null.

false

integer(int32)

gatewayIpv6

IPv6 gateway. Default: null.

false

string

lacpMode

Link aggregation mode. active: dynamic; off: static.

false

string

bondMode

Load-sharing mode. Valid values: balance-tcp (advanced), balance-slb (basic), active-backup (active-standby). Default: null.

false

string

pnics

vSwitch physical ports

false

array

ApiVSwitchPnicDTO

pnicName

Physical port name

true

string

pciAddr

Physical port unique identifier

false

string

mac

Physical port MAC

false

string

acceleMode

Acceleration mode. Valid values: 0 (normal), 1 (smart NIC), 11 (DPDK). Default: 0.

true

integer(int32)

reselect

Whether failback switch is enabled. Valid values: true (enabled), false (disabled). Default: false.

false

boolean

algorithm

Primary link selection method. Valid values: speed (speed priority), order (manual). Default: null.

false

string

Response status

Status code

Description

schema

200

OK

ApiResponse

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

string

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {}
}

2.10.3 Query the network policy template list​

API endpoint

GET  /NSphere/api/network-resource/portprofile

API description

Supports non-paginated query: not passing offset or limit returns the full list. Supports query by network policy template ID and ID list; when both are provided, the intersection is used. New API in E0930.

Request Content-Type

application/x-www-form-urlencoded

Response Content-Type

application/json

Request parameters

Parameter name

Description

Location

Required

Type

schema

offset

Offset. Specifies the record number from which to start returning results. Value must be >= 0; default is 0.

query

false

integer(int32)

limit

Maximum number of records returned per page. Value 1-200; default is 10.

query

false

integer(int32)

sortDir

Sort direction. Not passed or 0: no sorting; 1: ascending; 2: descending. When sortField is empty, no sorting is applied by default.

query

false

integer(int32)

sortField

Sort field. Supported fields: name, description, vlanId, vnetPriority, inAvgBandwidth, inBurstSize, outAvgBandwidth, outBurstSize.

query

false

string

portProfileName

Network policy template name. Supports fuzzy match.

query

false

string

portProfileId

Network policy template ID. If passed together with idList, the intersection of the two is used.

query

false

integer(int64)

idList

Network policy template ID list. If passed together with portProfileId, the intersection of the two is used.

query

false

array

integer

scope

Owner. 1: query public only; 0: query private only. If this parameter is not provided, all are queried by default.

query

false

integer(int32)

Response status

Status code

Description

schema

200

OK

ApiResponseApiPagingListResultApiPortProfileVO

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

ApiPagingListResultApiPortProfileVO

ApiPagingListResultApiPortProfileVO

data

Network policy template entity

array

ApiPortProfileVO

id

Network policy template ID

integer(int64)

name

Network policy template name

string

description

Network policy template description

string

enableVlan

Whether VLAN is enabled

boolean

vlanId

VLAN ID

integer(int32)

inbound

Whether inbound flow rate limiting is enabled. 0: disabled; 1: enabled.

integer(int32)

inAvgBandwidth

Inbound average bandwidth (Kbps)

integer(int64)

inPeakBandwidth

Inbound peak bandwidth (Kbps)

integer(int64)

inBurstSize

Inbound burst buffer size (KBytes)

integer(int64)

outbound

Whether outbound flow rate limiting is enabled. 0: disabled; 1: enabled.

integer(int32)

outAvgBandwidth

Outbound average bandwidth (Kbps)

integer(int64)

outPeakBandWidth

Outbound peak bandwidth (Kbps)

integer(int64)

outBurstSize

Outbound burst buffer size (KBytes)

integer(int64)

enableVsi

Whether VSI is enabled

boolean

vsiMngId

VSI management ID (returned after VSI is enabled on the network policy template).

string

vsiNetResource

Network resource (returned after VSI is enabled on the network policy template).

integer(int64)

vsiTypeId

VSI type ID (returned after VSI is enabled on the network policy template).

integer(int64)

vsiTypeVer

VSI type version (returned after VSI is enabled on the network policy template).

integer(int64)

vsiTypeVerId

VSI type version ID (returned after VSI is enabled on the network policy template).

integer(int64)

vsiIdFormat

VSI ID format (returned after VSI is enabled on the network policy template).

string

operatorGroupId

Operator group ID

integer(int64)

operatorGroupName

Operator group name

string

aclStrategyId

ACL policy ID

integer(int64)

netLimitProfileId

Network rate-limit policy ID

integer(int64)

aclName

ACL policy name

string

type

ACL type. 2: layer 2; 3: IP (layer 3).

integer(int32)

netLimitName

Network rate-limit policy name

string

netLimitTitle

Network rate-limit policy display name

string

vnetPriority

Network priority. -1: none; 0: low; 1: medium; 2: high.

integer(int32)

vlanType

VLAN type. 0: VLAN; 1: XVLAN.

integer(int32)

scope

Owner. 0: private; 1: public.

integer(int32)

offset

Offset. Specifies the record number from which to start returning results.

integer(int32)

size

Number of records returned in the current response.

integer(int32)

total

Total number of records

integer(int64)

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {
"data": [
{
"id": null,
"name": null,
"description": null,
"enableVlan": true,
"vlanId": null,
"inbound": null,
"inAvgBandwidth": null,
"inPeakBandwidth": null,
"inBurstSize": null,
"outbound": null,
"outAvgBandwidth": null,
"outPeakBandWidth": null,
"outBurstSize": null,
"enableVsi": true,
"vsiMngId": null,
"vsiNetResource": null,
"vsiTypeId": null,
"vsiTypeVer": null,
"vsiTypeVerId": null,
"vsiIdFormat": null,
"operatorGroupId": null,
"operatorGroupName": null,
"aclStrategyId": null,
"netLimitProfileId": null,
"aclName": null,
"type": null,
"netLimitName": null,
"netLimitTitle": null,
"vnetPriority": null,
"vlanType": null,
"scope": null
}
],
"offset": null,
"size": null,
"total": null
}
}

2.10.4 Add a route​

API endpoint

POST  /NSphere/api/network-resource/route

API description

Add a route.

Request Content-Type

application/json

Response Content-Type

application/json

Request example

{
"hostId": 0,
"target": "",
"netmask": "",
"gw": ""
}

Request parameters

Parameter name

Description

Location

Required

Type

schema

apiRouteDTO

Add-route entity

body

true

ApiRouteDTO

ApiRouteDTO

hostId

Physical host ID

true

integer(int64)

target

Destination IP subnet/address

true

string

netmask

Netmask

true

string

gw

Gateway

true

string

Response status

Status code

Description

schema

200

OK

ApiResponse

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

string

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {}
}

2.10.5 Edit a route​

API endpoint

PUT  /NSphere/api/network-resource/route

API description

Edit a route. If the route to be edited does not exist, add the route.

Request Content-Type

application/json

Response Content-Type

application/json

Request example

{
"hostId": 0,
"target": "",
"netmask": "",
"gw": "",
"oldTarget": "",
"oldNetmask": "",
"oldGw": ""
}

Request parameters

Parameter name

Description

Location

Required

Type

schema

apiRouteModifyDTO

Edit-route entity

body

true

ApiRouteModifyDTO

ApiRouteModifyDTO

hostId

Physical host ID

true

integer(int64)

target

Destination IP subnet/address

true

string

netmask

Netmask

true

string

gw

Gateway

true

string

oldTarget

Destination IP subnet/address to be modified

true

string

oldNetmask

Netmask to be modified

true

string

oldGw

Gateway to be modified

true

string

Response status

Status code

Description

schema

200

OK

ApiResponse

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

string

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {}
}

2.10.6 Delete a route​

API endpoint

DELETE  /NSphere/api/network-resource/route

API description

Delete a route.

Request Content-Type

application/json

Response Content-Type

application/json

Request example

{
"hostId": 0,
"target": "",
"netmask": "",
"gw": ""
}

Request parameters

Parameter name

Description

Location

Required

Type

schema

apiRouteDTO

Add-route entity

body

true

ApiRouteDTO

ApiRouteDTO

hostId

Physical host ID

true

integer(int64)

target

Destination IP subnet/address

true

string

netmask

Netmask

true

string

gw

Gateway

true

string

Response status

Status code

Description

schema

200

OK

ApiResponse

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

string

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {}
}

2.10.7 Query routes​

API endpoint

GET  /NSphere/api/network-resource/route/list

API description

Query routes.

Request Content-Type

application/x-www-form-urlencoded

Response Content-Type

application/json

Request parameters

Parameter name

Description

Location

Required

Type

schema

hostId

Physical host ID

query

true

integer(int64)

vsName

vSwitch name

query

false

string

Response status

Status code

Description

schema

200

OK

ApiResponse

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

string

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {}
}

2.10.8 Query advanced networks​

API endpoint

GET  /NSphere/api/network-resource/sdn/network

API description

Query advanced networks.

Request Content-Type

application/x-www-form-urlencoded

Response Content-Type

application/json

Request parameters

Parameter name

Description

Location

Required

Type

schema

offset

Offset. Specifies the record number from which to start returning results. Value must be >= 0; default is 0.

query

false

integer(int32)

limit

Maximum number of records returned per page. Value 1-200; default is 10.

query

false

integer(int32)

isExternal

Whether it is an elastic network.

query

false

boolean

Response status

Status code

Description

schema

200

OK

ApiResponseApiPagingListResultApiSdnNetworkVO

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

ApiPagingListResultApiSdnNetworkVO

ApiPagingListResultApiSdnNetworkVO

data

Advanced network entity

array

ApiSdnNetworkVO

id

Network ID

string

tunnelKey

L2VNI

integer(int32)

description

Description

string

mtu

mtu

integer(int32)

name

Name

string

internalName

Internal name

string

vlanPassThru

VLAN pass-through

boolean

subnets

Subnet

array

string

offset

Offset. Specifies the record number from which to start returning results.

integer(int32)

size

Number of records returned in the current response.

integer(int32)

total

Total number of records

integer(int64)

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {
"data": [
{
"id": null,
"tunnelKey": null,
"description": null,
"mtu": null,
"name": null,
"internalName": null,
"vlanPassThru": true,
"subnets": []
}
],
"offset": null,
"size": null,
"total": null
}
}

2.10.9 Query advanced network vNICs​

API endpoint

GET  /NSphere/api/network-resource/sdn/ports

API description

Query advanced network vNICs.

Request Content-Type

application/x-www-form-urlencoded

Response Content-Type

application/json

Request parameters

Parameter name

Description

Location

Required

Type

schema

hasIp

Whether it has an IP. When true, vNICs without an IP are filtered out.

query

false

boolean

subnetId

Subnet ID.

query

false

string

offset

Offset. Specifies the record number from which to start returning results. Value must be >= 0; default is 0.

query

false

integer(int32)

limit

Maximum number of records returned per page. Value 1-200; default is 10.

query

false

integer(int32)

Response status

Status code

Description

schema

200

OK

ApiResponseApiPagingListResultApiSdnPortVO

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

ApiPagingListResultApiSdnPortVO

ApiPagingListResultApiSdnPortVO

data

Advanced network vNIC entity

array

ApiSdnPortVO

id

vNIC ID

string

name

Name

string

subnetInfo

Subnet information

string

ifaceId

Network interface unique identifier

string

macAddress

MAC address

string

networkId

Network internal name

string

qosPolicyId

QoS policy ID

string

allowedAddressPairs

Allowed address pairs

array

object

fixedIp

Fixed IP

array

object

enableGateway

Whether traffic goes through the gateway

boolean

bindingVm

VM display name

string

qosName

QoS policy name

string

offset

Offset. Specifies the record number from which to start returning results.

integer(int32)

size

Number of records returned in the current response.

integer(int32)

total

Total number of records

integer(int64)

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {
"data": [
{
"id": null,
"name": null,
"subnetInfo": null,
"ifaceId": null,
"macAddress": null,
"networkId": null,
"qosPolicyId": null,
"allowedAddressPairs": [],
"fixedIp": [],
"enableGateway": true,
"bindingVm": null,
"qosName": null
}
],
"offset": null,
"size": null,
"total": null
}
}

2.10.10 Add an advanced network policy route​

API endpoint

POST  /NSphere/api/network-resource/sdn/router/protectPolicies

API description

Add an advanced network policy route.

Request Content-Type

application/json

Response Content-Type

application/json

Request example

{
"vmId": 0,
"protectPolicies": [
{
"type": "",
"ifaceId": "",
"serviceId": "",
"serviceIfaceId": ""
}
]
}

Request parameters

Parameter name

Description

Location

Required

Type

schema

apiProtectPoliciesDTO

Add policy-route entity

body

true

ApiProtectPoliciesDTO

ApiProtectPoliciesDTO

vmId

VM ID

true

integer(int32)

protectPolicies

Policy details

true

array

ApiProtectPolicyDTO

type

Policy route type

true

string

ifaceId

Network interface unique identifier

true

string

serviceId

Network service ID

true

string

serviceIfaceId

Network service interface ID

true

string

Response status

Status code

Description

schema

200

OK

ApiResponseHashMapStringProtectPolicy

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

protectPolicy

protectPolicy

type

string

iface_id

string

service_id

string

service_iface_id

string

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {
"additionalProperties1": {
"type": null,
"iface_id": null,
"service_id": null,
"service_iface_id": null
}
}
}

2.10.11 Delete an advanced network policy route​

API endpoint

DELETE  /NSphere/api/network-resource/sdn/router/protectPolicy/{policyId}

API description

Delete an advanced network policy route.

Request Content-Type

application/x-www-form-urlencoded

Response Content-Type

application/json

Request parameters

Parameter name

Description

Location

Required

Type

schema

policyId

Policy route ID.

path

true

string

Response status

Status code

Description

schema

200

OK

ApiResponseBoolean

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

boolean

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": true
}

2.10.12 Query advanced network subnets​

API endpoint

GET  /NSphere/api/network-resource/sdn/subnet

API description

Query advanced network subnets. One of networkId, routerId, or findAll must be provided; they cannot all be empty. When multiple are provided, the query executes with priority networkId > routerId > findAll.

Request Content-Type

application/x-www-form-urlencoded

Response Content-Type

application/json

Request parameters

Parameter name

Description

Location

Required

Type

schema

isExternalUsable

Available elastic subnet.

query

true

boolean

offset

Offset. Specifies the record number from which to start returning results. Value must be >= 0; default is 0.

query

false

integer(int32)

limit

Maximum number of records returned per page. Value 1-200; default is 10.

query

false

integer(int32)

networkId

Network ID

query

false

string

routerId

Router ID

query

false

string

findAll

Whether to return all. When true, all subnets are returned; when false, only unassociated subnets are returned.

query

false

boolean

Response status

Status code

Description

schema

200

OK

ApiResponseApiPagingListResultApiSdnSubnetVO

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

ApiPagingListResultApiSdnSubnetVO

ApiPagingListResultApiSdnSubnetVO

data

Advanced network subnet entity

array

ApiSdnSubnetVO

id

Subnet ID

string

name

Name

string

internalName

Internal name

string

description

Description

string

gatewayIp

Gateway IP

string

ipVersion

Version

integer(int32)

linkFlag

Associated router internal name

string

linked

Whether the subnet is associated with a router

boolean

networkId

Network ID

string

cidr

Subnet address

string

subnetMask

Subnet mask

string

prefix

Prefix

integer(int32)

hostRoutes

Static routes

array

object

dnsNameservers

dns

array

string

allocationPools

IP address pool

array

object

usedByVm

Whether it is used by a VM

boolean

routerName

Associated router name

string

offset

Offset. Specifies the record number from which to start returning results.

integer(int32)

size

Number of records returned in the current response.

integer(int32)

total

Total number of records

integer(int64)

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {
"data": [
{
"id": "",
"name": null,
"internalName": null,
"description": null,
"gatewayIp": null,
"ipVersion": null,
"linkFlag": null,
"linked": true,
"networkId": null,
"cidr": null,
"subnetMask": null,
"prefix": null,
"hostRoutes": [],
"dnsNameservers": [],
"allocationPools": [],
"usedByVm": true,
"routerName": null
}
],
"offset": null,
"size": null,
"total": null
}
}

2.10.13 Add a subnet​

API endpoint

POST  /NSphere/api/network-resource/subnet

API description

Add a subnet. The vSwitch subnet ip and ipv6 cannot both be empty.

Request Content-Type

application/json

Response Content-Type

application/json

Request example

{
"hostId": 0,
"vsName": "",
"networkType": 0,
"name": "",
"ip": null,
"netmask": null,
"vlanId": null,
"bandwidthRatio": 0,
"ipv6": null,
"netmaskIpv6": null
}

Request parameters

Parameter name

Description

Location

Required

Type

schema

apiSubnetDTO

vSwitch subnet response entity

body

true

ApiSubnetDTO

ApiSubnetDTO

hostId

ID of the host where the vSwitch resides

true

integer(int64)

vsName

vSwitch name. The name must not be auto, default, eql, all, or vswitch0; must not start with eth, eno, vnet, dhcp, dpdk, or tbr; and must not end with _bond. Only letters, digits, hyphens, and underscores are allowed. The first character cannot be a hyphen, and the name cannot consist entirely of digits.

true

string

networkType

Network type. Only storage network (4), backup network (8), migration network (16), and combinations thereof are supported. Represented as a binary bit mask; a bit set to 1 indicates the corresponding network type. For example, 4 in binary is 100, meaning storage network; 12 in binary is 1100, meaning storage network plus backup network.

true

integer(int32)

name

Subnet name.

true

string

ip

IPv4 address.

false

string

netmask

IPv4 subnet mask.

false

string

vlanId

VLAN ID.

false

integer(int32)

bandwidthRatio

Bandwidth share.

true

integer(int32)

ipv6

IPv6 address.

false

string

netmaskIpv6

IPv6 subnet prefix length.

false

string

Response status

Status code

Description

schema

200

OK

ApiResponse

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

string

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {}
}

2.10.14 Edit a subnet​

API endpoint

PUT  /NSphere/api/network-resource/subnet

API description

Edit a subnet. The vSwitch subnet ip and ipv6 cannot both be empty.

Request Content-Type

application/json

Response Content-Type

application/json

Request example

{
"hostId": 0,
"vsName": "",
"vswitchId": 0,
"id": 0,
"networkType": 0,
"name": "",
"ip": null,
"netmask": null,
"vlanId": null,
"bandwidthRatio": 0,
"ipv6": null,
"netmaskIpv6": null
}

Request parameters

Parameter name

Description

Location

Required

Type

schema

apiSubnetModifyDTO

vSwitch subnet response entity

body

true

ApiSubnetModifyDTO

ApiSubnetModifyDTO

hostId

ID of the host where the vSwitch resides

true

integer(int64)

vsName

vSwitch name. The name must not be auto, default, eql, all, or vswitch0; must not start with eth, eno, vnet, dhcp, dpdk, or tbr; and must not end with _bond. Only letters, digits, hyphens, and underscores are allowed. The first character cannot be a hyphen, and the name cannot consist entirely of digits.

true

string

vswitchId

ID of the vSwitch this subnet belongs to.

true

integer(int64)

id

Subnet ID.

true

integer(int64)

networkType

Network type. Only storage network (4), backup network (8), migration network (16), and combinations thereof are supported. Represented as a binary bit mask; a bit set to 1 indicates the corresponding network type. For example, 4 in binary is 100, meaning storage network; 12 in binary is 1100, meaning storage network plus backup network.

true

integer(int32)

name

Subnet name.

true

string

ip

IPv4 address.

false

string

netmask

IPv4 subnet mask.

false

string

vlanId

VLAN ID.

false

integer(int32)

bandwidthRatio

Bandwidth share.

true

integer(int32)

ipv6

IPv6 address.

false

string

netmaskIpv6

IPv6 subnet prefix length.

false

string

Response status

Status code

Description

schema

200

OK

ApiResponse

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

string

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {}
}

2.10.15 Delete a subnet​

API endpoint

DELETE  /NSphere/api/network-resource/subnet

API description

Delete a subnet.

Request Content-Type

application/x-www-form-urlencoded

Response Content-Type

application/json

Request parameters

Parameter name

Description

Location

Required

Type

schema

hostId

ID of the host where the vSwitch resides

query

true

integer(int64)

vswitchName

vSwitch name. The name must not be auto, default, eql, all, or vswitch0; must not start with eth, eno, vnet, dhcp, dpdk, or tbr; and must not end with _bond. Only letters, digits, hyphens, and underscores are allowed. The first character cannot be a hyphen, and the name cannot consist entirely of digits.

query

true

string

subnetName

Subnet name.

query

false

string

Response status

Status code

Description

schema

200

OK

ApiResponse

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

string

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {}
}

2.10.16 Query subnets​

API endpoint

GET  /NSphere/api/network-resource/subnet/list

API description

Query subnets.

Request Content-Type

application/x-www-form-urlencoded

Response Content-Type

application/json

Request parameters

Parameter name

Description

Location

Required

Type

schema

hostId

ID of the host where the vSwitch resides

query

true

integer(int64)

vswitchId

vSwitch ID

query

true

integer(int64)

Response status

Status code

Description

schema

200

OK

ApiResponseListApiSubnetVO

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

array

ApiSubnetVO

id

Subnet ID.

integer(int64)

vswitchId

ID of the vSwitch this subnet belongs to.

integer(int64)

networkType

Network type. Only storage network (4), backup network (8), migration network (16), and combinations thereof are supported. Represented as a binary bit mask; a bit set to 1 indicates the corresponding network type. For example, 4 in binary is 100, meaning storage network; 12 in binary is 1100, meaning storage network plus backup network.

integer(int32)

name

Subnet name.

string

ip

IPv4 address.

string

mask

IPv4 subnet mask.

string

vlan

VLAN ID.

integer(int32)

bandwidthRatio

Bandwidth share.

integer(int32)

ipv6

IPv6 address.

string

maskIpv6

IPv6 subnet prefix length.

string

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": [
{
"id": null,
"vswitchId": null,
"networkType": null,
"name": null,
"ip": null,
"mask": null,
"vlan": null,
"bandwidthRatio": null,
"ipv6": null,
"maskIpv6": null
}
]
}

2.10.17 Add a vSwitch​

API endpoint

POST  /NSphere/api/network-resource/vswitch

API description

Add a host vSwitch.

Request Content-Type

application/json

Response Content-Type

application/json

Request example

{
"hostId": 0,
"name": "",
"description": null,
"portNum": 0,
"mode": 0,
"pnic": null,
"phyPrioripy": null,
"address": null,
"netmask": null,
"gateway": null,
"addressIpv6": null,
"netmaskIpv6": null,
"gatewayIpv6": null,
"enableLacp": false,
"isSmartPnic": false,
"bondMode": null,
"vlanId": null,
"flag": 0,
"pnicList": [],
"reselect": false,
"algorithm": null,
"mtu": 1500,
"networkType": 2,
"multicast": false,
"acceleMode": 0,
"engine": null,
"isSmartNic": false,
"vxlanScope": false
}

Request parameters

Parameter name

Description

Location

Required

Type

schema

apiVSwitchDTO

Parameters for adding a host vSwitch

body

true

ApiVSwitchDTO

ApiVSwitchDTO

hostId

ID of the host where the vSwitch resides

true

integer(int64)

name

vSwitch name. The name must not be auto, default, eql, all, or vswitch0; must not start with eth, eno, vnet, dhcp, dpdk, or tbr; and must not end with _bond. Only letters, digits, hyphens, and underscores are allowed. The first character cannot be a hyphen, and the name cannot consist entirely of digits.

true

string

description

vSwitch description.

false

string

portNum

Number of vSwitch ports

true

integer(int32)

mode

Forwarding mode. Valid values: 0 (VEB), 1 (VEPA), 2 (multi-channel), 3 (VXLAN(SDN)), 4 (VXLAN(NSphere)). Default: 0.

true

integer(int32)

pnic

Physical interfaces used by the vSwitch. Default: null. Multiple physical interfaces can be configured, separated by commas. In some cases physical interfaces must be configured; adjust parameters according to the returned error message.

false

string

phyPrioripy

Priority of physical interfaces. Default: null. Multiple physical interfaces are separated by commas.

false

string

address

IPv4 address. Default: null. Note: once an IP address is configured, all hosts in the cluster use this IP address when adding this vSwitch.

false

string

netmask

IPv4 subnet mask. Default: null.

false

string

gateway

IPv4 gateway. Default: null.

false

string

addressIpv6

IPv6 address. Default: null. Note: once an IPv6 address is configured, all hosts in the cluster use this IPv6 address when adding this vSwitch.

false

string

netmaskIpv6

IPv6 subnet prefix length. Default: null.

false

integer(int32)

gatewayIpv6

IPv6 gateway. Default: null.

false

string

enableLacp

Whether LACP is enabled. Valid values: true (enabled), false (disabled). Default: false.

false

boolean

isSmartPnic

Whether it is a smart NIC. true: yes; false: no.

false

boolean

bondMode

Load-sharing mode. Valid values: balance-tcp (advanced), balance-slb (basic), active-backup (active-standby). Default: null.

false

string

vlanId

vSwitch VLAN ID. Value range: integer 2-4094. Default: null.

false

integer(int32)

flag

How the vSwitch is added. 0: added under a host; 1: added under a cluster.

false

integer(int32)

pnicList

vSwitch physical ports

false

array

string

reselect

Whether failback switch is enabled. Valid values: true (enabled), false (disabled). Default: false.

false

boolean

algorithm

Primary link selection method. Valid values: speed (speed priority), order (manual). Default: null.

false

string

mtu

MTU. Valid range: an integer 1000-9000 for IPv4, or 1280-9000 for IPv6. Default: 1500.

true

integer(int32)

networkType

vSwitch network type, represented as a binary bit mask. From the low-order bit to the high-order bit: bit 0 management network, bit 1 business network, bit 2 storage network, bit 3 backup network, bit 4 migration network, bit 6 traffic-mirror network, bit 8 mirror network. A bit set to 1 indicates the corresponding network type. For example, 2 in binary is 10, meaning business network; 3 in binary is 11, meaning management network plus business network. Default: 2.

true

integer(int32)

multicast

Whether multicast is enabled. Valid values: true (enabled), false (disabled). Default: false.

true

boolean

acceleMode

Acceleration mode. Valid values: 0 (normal), 1 (smart NIC), 11 (DPDK). Default: 0.

true

integer(int32)

engine

Engine type. Valid values: ovs, linux.

false

string

isSmartNic

Whether a smart NIC is used. Valid values: true (yes), false (no).

false

boolean

vxlanScope

Whether it is used by a VXLAN domain. Valid values: true (used), false (not used). This field is not actually used; the value is always false.

false

boolean

Response status

Status code

Description

schema

200

OK

ApiResponseLong

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

integer(int64)

integer(int64)

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": null
}

2.10.18 Edit a vSwitch​

API endpoint

PUT  /NSphere/api/network-resource/vswitch

API description

Edit a vSwitch.

Request Content-Type

application/json

Response Content-Type

application/json

Request example

{
"id": 0,
"description": null,
"portNum": 0,
"pnic": null,
"phyPrioripy": null,
"address": null,
"netmask": null,
"gateway": null,
"addressIpv6": null,
"netmaskIpv6": null,
"gatewayIpv6": null,
"enableLacp": true,
"isSmartPnic": true,
"bondMode": null,
"vlanId": null,
"flag": null,
"pnicList": [],
"haStatus": null,
"reselect": true,
"algorithm": null,
"mtu": 0,
"storageNodeSetted": null,
"multicast": true,
"engine": null,
"isSmartNic": true,
"vxlanScope": true
}

Request parameters

Parameter name

Description

Location

Required

Type

schema

apiVSwitchModifyDTO

Parameters for editing a host vSwitch

body

true

ApiVSwitchModifyDTO

ApiVSwitchModifyDTO

id

vSwitch ID

true

integer(int64)

description

vSwitch description.

false

string

portNum

Number of vSwitch ports

true

integer(int32)

pnic

Physical interfaces used by the vSwitch. Default: null. Multiple physical interfaces can be configured, separated by commas. In some cases physical interfaces must be configured; adjust parameters according to the returned error message.

false

string

phyPrioripy

Priority of physical interfaces. Default: null. Multiple physical interfaces are separated by commas.

false

string

address

IPv4 address. Default: null. Note: once an IP address is configured, all hosts in the cluster use this IP address when adding this vSwitch.

false

string

netmask

IPv4 subnet mask. Default: null.

false

string

gateway

IPv4 gateway. Default: null.

false

string

addressIpv6

IPv6 address. Default: null. Note: once an IPv6 address is configured, all hosts in the cluster use this IPv6 address when adding this vSwitch.

false

string

netmaskIpv6

IPv6 subnet prefix length. Default: null.

false

string

gatewayIpv6

IPv6 gateway. Default: null.

false

string

enableLacp

Whether LACP is enabled. Valid values: true (enabled), false (disabled). Default: false.

false

boolean

isSmartPnic

Whether it is a smart NIC. true: yes; false: no.

false

boolean

bondMode

Load-sharing mode. Valid values: balance-tcp (advanced), balance-slb (basic), active-backup (active-standby). Default: null.

false

string

vlanId

vSwitch VLAN ID. Value range: integer 2-4094. Default: null.

false

integer(int32)

flag

How the vSwitch is added. 0: added under a host; 1: added under a cluster.

false

integer(int32)

pnicList

vSwitch physical ports

false

array

string

haStatus

VM HA status. 0: normal; 1: failed.

false

integer(int32)

reselect

Whether failback switch is enabled. Valid values: true (enabled), false (disabled). Default: false.

false

boolean

algorithm

Primary link selection method. Valid values: speed (speed priority), order (manual). Default: null.

false

string

mtu

MTU. Valid range: an integer 1000-9000 for IPv4, or 1280-9000 for IPv6. Default: 1500.

true

integer(int32)

storageNodeSetted

Whether the vSwitch IP has been set on the acesure storage node of this host. 0: not set; 1: set.

false

integer(int32)

multicast

Whether multicast is enabled. Valid values: true (enabled), false (disabled). Default: false.

true

boolean

engine

Engine type. Valid values: ovs, linux.

false

string

isSmartNic

Whether a smart NIC is used. Valid values: true (yes), false (no).

false

boolean

vxlanScope

Whether it is used by a VXLAN domain. Valid values: true (used), false (not used). This field is not actually used; the value is always false.

false

boolean

Response status

Status code

Description

schema

200

OK

ApiResponse

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

string

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {}
}

2.10.19 Query a vSwitch by ID​

API endpoint

GET  /NSphere/api/network-resource/vswitch/{vsId}

API description

Query a vSwitch by ID.

Request Content-Type

application/x-www-form-urlencoded

Response Content-Type

application/json

Request parameters

Parameter name

Description

Location

Required

Type

schema

vsId

vSwitch ID

path

true

integer(int64)

Response status

Status code

Description

schema

200

OK

ApiResponseApiVSwitchDetailVO

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

ApiVSwitchDetailVO

ApiVSwitchDetailVO

id

vSwitch ID

integer(int64)

hostId

ID of the host where the vSwitch resides

integer(int64)

bandwidth

Bandwidth (Kbps).

integer(int64)

name

vSwitch name

string

description

vSwitch description.

string

portNum

Number of vSwitch ports

integer(int32)

mode

Forwarding mode. Valid values: 0 (VEB), 1 (VEPA), 2 (multi-channel), 3 (VXLAN(SDN)), 4 (VXLAN(NSphere)). Default: 0.

integer(int32)

pnic

Physical interfaces used by the vSwitch. Default: null. Multiple physical interfaces can be configured, separated by commas. In some cases physical interfaces must be configured; adjust parameters according to the returned error message.

string

address

IPv4 address. Default: null. Note: once an IP address is configured, all hosts in the cluster use this IP address when adding this vSwitch.

string

netmask

IPv4 subnet mask. Default: null.

string

gateway

IPv4 gateway. Default: null.

string

ipv6

IPv6 address. Default: null. Note: once an IPv6 address is configured, all hosts in the cluster use this IPv6 address when adding this vSwitch.

string

netmaskIpv6

IPv6 subnet prefix length. Default: null.

string

gatewayIpv6

IPv6 gateway. Default: null.

string

enableLacp

Whether LACP is enabled. Valid values: true (enabled), false (disabled). Default: false.

boolean

bondMode

Load-sharing mode. Valid values: balance-tcp (advanced), balance-slb (basic), active-backup (active-standby). Default: null.

string

vlanId

vSwitch VLAN ID. Value range: integer 2-4094. Default: null.

integer(int32)

isManage

Whether it is a management NIC. 1: yes; 0: no.

integer(int32)

status

vSwitch status. Valid values: 0 (inactive), 1 (active).

integer(int32)

clusterId

Cluster ID. Only has a value when the vSwitch is added under a cluster.

integer(int64)

flag

How the vSwitch is added. 0: added under a host; 1: added under a cluster.

integer(int32)

enableDpdk

Whether DPDK is enabled. Valid values: true (enabled), false (disabled). Default: false.

boolean

reselect

Whether failback switch is enabled. Valid values: true (enabled), false (disabled). Default: false.

boolean

algorithm

Primary link selection method. Valid values: speed (speed priority), order (manual). Default: null.

string

vxlanScopeUseVSwitch

Whether the vSwitch is used by a VXLAN domain

boolean

mtu

MTU. Valid range: an integer 1000-9000 for IPv4, or 1280-9000 for IPv6. Default: 1500.

integer(int32)

storageNodeSetted

Whether the vSwitch IP has been set on the acesure storage node of this host. 0: not set; 1: set.

integer(int32)

networkType

vSwitch network type, represented as a binary bit mask. From the low-order bit to the high-order bit: bit 0 management network, bit 1 business network, bit 2 storage network, bit 3 backup network, bit 4 migration network, bit 6 traffic-mirror network, bit 8 mirror network. A bit set to 1 indicates the corresponding network type. For example, 2 in binary is 10, meaning business network; 3 in binary is 11, meaning management network plus business network. Default: 2.

integer(int32)

multicast

Whether multicast is enabled. Valid values: true (enabled), false (disabled). Default: false.

boolean

internalPorts

vSwitch subnet response entity

array

ApiSubnetVO

id

Subnet ID.

integer(int64)

vswitchId

ID of the vSwitch this subnet belongs to.

integer(int64)

networkType

Network type. Only storage network (4), backup network (8), migration network (16), and combinations thereof are supported. Represented as a binary bit mask; a bit set to 1 indicates the corresponding network type. For example, 4 in binary is 100, meaning storage network; 12 in binary is 1100, meaning storage network plus backup network.

integer(int32)

name

Subnet name.

string

ip

IPv4 address.

string

mask

IPv4 subnet mask.

string

vlan

VLAN ID.

integer(int32)

bandwidthRatio

Bandwidth share.

integer(int32)

ipv6

IPv6 address.

string

maskIpv6

IPv6 subnet prefix length.

string

acceleMode

Acceleration mode. Valid values: 0 (normal), 1 (smart NIC), 11 (DPDK). Default: 0.

integer(int32)

engine

Engine type. Valid values: ovs, linux.

string

isSmartNic

Whether a smart NIC is used. Valid values: true (yes), false (no).

boolean

vxlanScope

Whether it is used by a VXLAN domain. Valid values: true (used), false (not used). This field is not actually used; the value is always false.

boolean

enableSegConfig

Whether micro-segmentation protection is enabled. Valid values: true (enabled), false (disabled).

boolean

runingVmUseVSwitch

Whether it is used by a VM

boolean

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {
"id": null,
"hostId": 0,
"bandwidth": null,
"name": "",
"description": null,
"portNum": 0,
"mode": 0,
"pnic": null,
"address": null,
"netmask": null,
"gateway": null,
"ipv6": null,
"netmaskIpv6": null,
"gatewayIpv6": null,
"enableLacp": true,
"bondMode": null,
"vlanId": null,
"isManage": null,
"status": null,
"clusterId": null,
"flag": null,
"enableDpdk": true,
"reselect": true,
"algorithm": null,
"vxlanScopeUseVSwitch": true,
"mtu": null,
"storageNodeSetted": null,
"networkType": null,
"multicast": true,
"internalPorts": [
{
"id": null,
"vswitchId": null,
"networkType": null,
"name": null,
"ip": null,
"mask": null,
"vlan": null,
"bandwidthRatio": null,
"ipv6": null,
"maskIpv6": null
}
],
"acceleMode": null,
"engine": null,
"isSmartNic": true,
"vxlanScope": true,
"enableSegConfig": true,
"runingVmUseVSwitch": true
}
}

2.10.20 Delete a vSwitch​

API endpoint

DELETE  /NSphere/api/network-resource/vswitch/{vsId}

API description

Delete a vSwitch by its ID.

Request Content-Type

application/x-www-form-urlencoded

Response Content-Type

application/json

Request parameters

Parameter name

Description

Location

Required

Type

schema

vsId

vSwitch ID

path

true

integer(int64)

Response status

Status code

Description

schema

200

OK

ApiResponseString

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

string

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": null
}

2.10.21 Batch query vSwitch information​

API endpoint

GET  /NSphere/api/network-resource/vswitch/all

API description

Query vSwitch information under hosts by the specified data center, cluster, or host ID. When multiple parameters are provided, only one takes effect; priority order: host ID, cluster ID, data center ID. If no condition is specified, the full data set is returned. New API in E0930.

Request Content-Type

application/x-www-form-urlencoded

Response Content-Type

application/json

Request parameters

Parameter name

Description

Location

Required

Type

schema

hpId

Data center ID

query

false

string

clusterId

Cluster ID

query

false

string

hostId

Host ID

query

false

string

Response status

Status code

Description

schema

200

OK

ApiResponseListApiHostVSwitchVO

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

array

ApiHostVSwitchVO

id

vSwitch ID

integer(int64)

hostId

ID of the host where the vSwitch resides

integer(int64)

bandwidth

Bandwidth (Kbps).

integer(int64)

name

vSwitch name

string

description

vSwitch description.

string

portNum

Number of vSwitch ports

integer(int32)

mode

Forwarding mode. Valid values: 0 (VEB), 1 (VEPA), 2 (multi-channel), 3 (VXLAN(SDN)), 4 (VXLAN(NSphere)). Default: 0.

integer(int32)

pnic

Physical interfaces used by the vSwitch. Default: null. Multiple physical interfaces can be configured, separated by commas. In some cases physical interfaces must be configured; adjust parameters according to the returned error message.

string

address

IPv4 address. Default: null. Note: once an IP address is configured, all hosts in the cluster use this IP address when adding this vSwitch.

string

netmask

IPv4 subnet mask. Default: null.

string

gateway

IPv4 gateway. Default: null.

string

ipv6

IPv6 address. Default: null. Note: once an IPv6 address is configured, all hosts in the cluster use this IPv6 address when adding this vSwitch.

string

netmaskIpv6

IPv6 subnet prefix length. Default: null.

string

gatewayIpv6

IPv6 gateway. Default: null.

string

enableLacp

Whether LACP is enabled. Valid values: true (enabled), false (disabled). Default: false.

boolean

bondMode

Load-sharing mode. Valid values: balance-tcp (advanced), balance-slb (basic), active-backup (active-standby). Default: null.

string

vlanId

vSwitch VLAN ID. Value range: integer 2-4094. Default: null.

integer(int32)

isManage

Whether it is a management NIC. 1: yes; 0: no.

integer(int32)

status

vSwitch status. Valid values: 0 (inactive), 1 (active).

integer(int32)

clusterId

Cluster ID. Only has a value when the vSwitch is added under a cluster.

integer(int64)

flag

How the vSwitch is added. 0: added under a host; 1: added under a cluster.

integer(int32)

enableDpdk

Whether DPDK is enabled. Valid values: true (enabled), false (disabled). Default: false.

boolean

reselect

Whether failback switch is enabled. Valid values: true (enabled), false (disabled). Default: false.

boolean

algorithm

Primary link selection method. Valid values: speed (speed priority), order (manual). Default: null.

string

vxlanScopeUseVSwitch

Whether the vSwitch is used by a VXLAN domain

boolean

mtu

MTU. Valid range: an integer 1000-9000 for IPv4, or 1280-9000 for IPv6. Default: 1500.

integer(int32)

storageNodeSetted

Whether the vSwitch IP has been set on the acesure storage node of this host. 0: not set; 1: set.

integer(int32)

networkType

vSwitch network type, represented as a binary bit mask. From the low-order bit to the high-order bit: bit 0 management network, bit 1 business network, bit 2 storage network, bit 3 backup network, bit 4 migration network, bit 6 traffic-mirror network, bit 8 mirror network. A bit set to 1 indicates the corresponding network type. For example, 2 in binary is 10, meaning business network; 3 in binary is 11, meaning management network plus business network. Default: 2.

integer(int32)

multicast

Whether multicast is enabled. Valid values: true (enabled), false (disabled). Default: false.

boolean

internalPorts

vSwitch subnet response entity

array

ApiSubnetVO

id

Subnet ID.

integer(int64)

vswitchId

ID of the vSwitch this subnet belongs to.

integer(int64)

networkType

Network type. Only storage network (4), backup network (8), migration network (16), and combinations thereof are supported. Represented as a binary bit mask; a bit set to 1 indicates the corresponding network type. For example, 4 in binary is 100, meaning storage network; 12 in binary is 1100, meaning storage network plus backup network.

integer(int32)

name

Subnet name.

string

ip

IPv4 address.

string

mask

IPv4 subnet mask.

string

vlan

VLAN ID.

integer(int32)

bandwidthRatio

Bandwidth share.

integer(int32)

ipv6

IPv6 address.

string

maskIpv6

IPv6 subnet prefix length.

string

acceleMode

Acceleration mode. Valid values: 0 (normal), 1 (smart NIC), 11 (DPDK). Default: 0.

integer(int32)

engine

Engine type. Valid values: ovs, linux.

string

isSmartNic

Whether a smart NIC is used. Valid values: true (yes), false (no).

boolean

vxlanScope

Whether it is used by a VXLAN domain. Valid values: true (used), false (not used). This field is not actually used; the value is always false.

boolean

enableSegConfig

Whether micro-segmentation protection is enabled. Valid values: true (enabled), false (disabled).

boolean

hostName

Name of the host where the vSwitch resides

string

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": [
{
"id": null,
"hostId": 0,
"bandwidth": null,
"name": "",
"description": null,
"portNum": 0,
"mode": 0,
"pnic": null,
"address": null,
"netmask": null,
"gateway": null,
"ipv6": null,
"netmaskIpv6": null,
"gatewayIpv6": null,
"enableLacp": true,
"bondMode": null,
"vlanId": null,
"isManage": null,
"status": null,
"clusterId": null,
"flag": null,
"enableDpdk": true,
"reselect": true,
"algorithm": null,
"vxlanScopeUseVSwitch": true,
"mtu": null,
"storageNodeSetted": null,
"networkType": null,
"multicast": true,
"internalPorts": [
{
"id": null,
"vswitchId": null,
"networkType": null,
"name": null,
"ip": null,
"mask": null,
"vlan": null,
"bandwidthRatio": null,
"ipv6": null,
"maskIpv6": null
}
],
"acceleMode": null,
"engine": null,
"isSmartNic": true,
"vxlanScope": true,
"enableSegConfig": true,
"hostName": null
}
]
}

2.10.22 Query vSwitches by conditions​

API endpoint

GET  /NSphere/api/network-resource/vswitch/hosts

API description

Query vSwitches by conditions. Priority is hostId, clusterId, cvmIp. vsName only takes effect when cvmIp is not empty.

Request Content-Type

application/x-www-form-urlencoded

Response Content-Type

application/json

Request parameters

Parameter name

Description

Location

Required

Type

schema

hostId

ID of the host where the vSwitch resides

query

false

integer(int64)

clusterId

Cluster ID

query

false

integer(int64)

cvmIp

CVM IP

query

false

string

vsName

vSwitch name

query

false

string

Response status

Status code

Description

schema

200

OK

ApiResponseListApiVSwitchVO

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

array

ApiVSwitchVO

id

vSwitch ID

integer(int64)

hostId

ID of the host where the vSwitch resides

integer(int64)

bandwidth

Bandwidth (Kbps).

integer(int64)

name

vSwitch name

string

description

vSwitch description.

string

portNum

Number of vSwitch ports

integer(int32)

mode

Forwarding mode. Valid values: 0 (VEB), 1 (VEPA), 2 (multi-channel), 3 (VXLAN(SDN)), 4 (VXLAN(NSphere)). Default: 0.

integer(int32)

pnic

Physical interfaces used by the vSwitch. Default: null. Multiple physical interfaces can be configured, separated by commas. In some cases physical interfaces must be configured; adjust parameters according to the returned error message.

string

address

IPv4 address. Default: null. Note: once an IP address is configured, all hosts in the cluster use this IP address when adding this vSwitch.

string

netmask

IPv4 subnet mask. Default: null.

string

gateway

IPv4 gateway. Default: null.

string

ipv6

IPv6 address. Default: null. Note: once an IPv6 address is configured, all hosts in the cluster use this IPv6 address when adding this vSwitch.

string

netmaskIpv6

IPv6 subnet prefix length. Default: null.

string

gatewayIpv6

IPv6 gateway. Default: null.

string

enableLacp

Whether LACP is enabled. Valid values: true (enabled), false (disabled). Default: false.

boolean

bondMode

Load-sharing mode. Valid values: balance-tcp (advanced), balance-slb (basic), active-backup (active-standby). Default: null.

string

vlanId

vSwitch VLAN ID. Value range: integer 2-4094. Default: null.

integer(int32)

isManage

Whether it is a management NIC. 1: yes; 0: no.

integer(int32)

status

vSwitch status. Valid values: 0 (inactive), 1 (active).

integer(int32)

clusterId

Cluster ID. Only has a value when the vSwitch is added under a cluster.

integer(int64)

flag

How the vSwitch is added. 0: added under a host; 1: added under a cluster.

integer(int32)

enableDpdk

Whether DPDK is enabled. Valid values: true (enabled), false (disabled). Default: false.

boolean

reselect

Whether failback switch is enabled. Valid values: true (enabled), false (disabled). Default: false.

boolean

algorithm

Primary link selection method. Valid values: speed (speed priority), order (manual). Default: null.

string

vxlanScopeUseVSwitch

Whether the vSwitch is used by a VXLAN domain

boolean

mtu

MTU. Valid range: an integer 1000-9000 for IPv4, or 1280-9000 for IPv6. Default: 1500.

integer(int32)

storageNodeSetted

Whether the vSwitch IP has been set on the acesure storage node of this host. 0: not set; 1: set.

integer(int32)

networkType

vSwitch network type, represented as a binary bit mask. From the low-order bit to the high-order bit: bit 0 management network, bit 1 business network, bit 2 storage network, bit 3 backup network, bit 4 migration network, bit 6 traffic-mirror network, bit 8 mirror network. A bit set to 1 indicates the corresponding network type. For example, 2 in binary is 10, meaning business network; 3 in binary is 11, meaning management network plus business network. Default: 2.

integer(int32)

multicast

Whether multicast is enabled. Valid values: true (enabled), false (disabled). Default: false.

boolean

internalPorts

vSwitch subnet response entity

array

ApiSubnetVO

id

Subnet ID.

integer(int64)

vswitchId

ID of the vSwitch this subnet belongs to.

integer(int64)

networkType

Network type. Only storage network (4), backup network (8), migration network (16), and combinations thereof are supported. Represented as a binary bit mask; a bit set to 1 indicates the corresponding network type. For example, 4 in binary is 100, meaning storage network; 12 in binary is 1100, meaning storage network plus backup network.

integer(int32)

name

Subnet name.

string

ip

IPv4 address.

string

mask

IPv4 subnet mask.

string

vlan

VLAN ID.

integer(int32)

bandwidthRatio

Bandwidth share.

integer(int32)

ipv6

IPv6 address.

string

maskIpv6

IPv6 subnet prefix length.

string

acceleMode

Acceleration mode. Valid values: 0 (normal), 1 (smart NIC), 11 (DPDK). Default: 0.

integer(int32)

engine

Engine type. Valid values: ovs, linux.

string

isSmartNic

Whether a smart NIC is used. Valid values: true (yes), false (no).

boolean

vxlanScope

Whether it is used by a VXLAN domain. Valid values: true (used), false (not used). This field is not actually used; the value is always false.

boolean

enableSegConfig

Whether micro-segmentation protection is enabled. Valid values: true (enabled), false (disabled).

boolean

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": [
{
"id": null,
"hostId": 0,
"bandwidth": null,
"name": "",
"description": null,
"portNum": 0,
"mode": 0,
"pnic": null,
"address": null,
"netmask": null,
"gateway": null,
"ipv6": null,
"netmaskIpv6": null,
"gatewayIpv6": null,
"enableLacp": true,
"bondMode": null,
"vlanId": null,
"isManage": null,
"status": null,
"clusterId": null,
"flag": null,
"enableDpdk": true,
"reselect": true,
"algorithm": null,
"vxlanScopeUseVSwitch": true,
"mtu": null,
"storageNodeSetted": null,
"networkType": null,
"multicast": true,
"internalPorts": [
{
"id": null,
"vswitchId": null,
"networkType": null,
"name": null,
"ip": null,
"mask": null,
"vlan": null,
"bandwidthRatio": null,
"ipv6": null,
"maskIpv6": null
}
],
"acceleMode": null,
"engine": null,
"isSmartNic": true,
"vxlanScope": true,
"enableSegConfig": true
}
]
}

2.10.23 Query port traffic by host ID and vSwitch ID​

API endpoint

GET  /NSphere/api/network-resource/vswitches/traffic

API description

Query port traffic by host ID and vSwitch ID. E0930 adds new response fields to this API.

Request Content-Type

application/x-www-form-urlencoded

Response Content-Type

application/json

Request parameters

Parameter name

Description

Location

Required

Type

schema

hostId

ID of the host where the vSwitch resides

query

true

integer(int64)

vsId

vSwitch ID

query

true

integer(int64)

Response status

Status code

Description

schema

200

OK

ApiResponseListApiVPortTrafficInfoVO

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

array

ApiVPortTrafficInfoVO

vsName

vSwitch name.

string

vportName

Virtual port name.

string

vmName

VM name.

string

title

VM display name.

string

vmMac

VM MAC address

string

rxPkts

Packets received.

integer(int64)

rxBytes

Bytes received.

integer(int64)

rxErrs

Erroneous packets received.

integer(int64)

txPkts

Packets sent.

integer(int64)

txBytes

Bytes sent.

integer(int64)

txErrs

Erroneous packets sent.

integer(int64)

hostId

Host ID. New field in E0930.

integer(int64)

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": [
{
"vsName": null,
"vportName": null,
"vmName": null,
"title": null,
"vmMac": null,
"rxPkts": null,
"rxBytes": null,
"rxErrs": null,
"txPkts": null,
"txBytes": null,
"txErrs": null,
"hostId": null
}
]
}

2.10.24 Batch query vSwitch port traffic by hpId/clusterId/hostId​

API endpoint

GET  /NSphere/api/network-resource/vswitches/traffic/batch

API description

Batch query vSwitch port traffic by hpId/clusterId/hostId; when none is passed, all are queried by default. When multiple are provided, the query executes with priority hostId > clusterId > hpId. New API in E0930.

Request Content-Type

application/x-www-form-urlencoded

Response Content-Type

application/json

Request parameters

Parameter name

Description

Location

Required

Type

schema

hpId

Data center ID

query

false

integer(int64)

clusterId

Cluster ID

query

false

integer(int64)

hostId

Host ID

query

false

integer(int64)

Response status

Status code

Description

schema

200

OK

ApiResponseListApiVPortTrafficInfoVO

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message

string

failureMessage

Error message; valid when the operation fails or partially succeeds.

string

data

Response data. If the status code is 0, this contains the normal returned data; if non-zero and non-empty, it contains the data required to describe the error.

array

ApiVPortTrafficInfoVO

vsName

vSwitch name.

string

vportName

Virtual port name.

string

vmName

VM name.

string

title

VM display name.

string

vmMac

VM MAC address

string

rxPkts

Packets received.

integer(int64)

rxBytes

Bytes received.

integer(int64)

rxErrs

Erroneous packets received.

integer(int64)

txPkts

Packets sent.

integer(int64)

txBytes

Bytes sent.

integer(int64)

txErrs

Erroneous packets sent.

integer(int64)

hostId

Host ID. New field in E0930.

integer(int64)

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": [
{
"vsName": null,
"vportName": null,
"vmName": null,
"title": null,
"vmMac": null,
"rxPkts": null,
"rxBytes": null,
"rxErrs": null,
"txPkts": null,
"txBytes": null,
"txErrs": null,
"hostId": null
}
]
}