Document navigation

Physical Network Operations

SetServiceTypeOnHostNetworkInterface

API Request

URLs
POST zstack/v1/hosts/nics/service-types
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "interfaceUuids": [
      "2894f52c7d84366c85dd115b3bc193ca"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"interfaceUuids":["2894f52c7d84366c85dd115b3bc193ca"]}}' \
http://localhost:8080/zstack/v1/hosts/nics/service-types
Request Parameters
Name Type Location Description Optional Value Starting Version
interfaceUuids List body (contained in the params structure) The physical NIC port UUID list. 4.7.11
vlanIds List body (contained in the params structure) Optional. The VLAN interface ID list. 4.7.11
serviceTypes List body (contained in the params structure) Optional. The network type.
  • ManagementNetwork
  • TenantNetwork
  • StorageNetwork
  • BackupNetwork
  • MigrationNetwork
4.7.11
systemTags List body Optional. The system tags. 4.7.11
userTags List body Optional. The user tags. 4.7.11

API Response

Sample Response
{
  "inventory": [
    {
      "id": 0,
      "interfaceUuid": "8534263f624a3962b7603c99a3e44eb2",
      "vlanId": 10,
      "serviceType": "BackupNetwork"
    }
  ]
}
Name Type Description Starting Version
success boolean 4.7.11
inventory List See inventory. 4.7.11
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.7.11
#inventory
Name Type Description Starting Version
interfaceUuid String The physical NIC port UUID. 4.7.11
vlanId Integer The VLAN interface id. 4.7.11
createDate Timestamp The creation date. 4.7.11
lastOpDate Timestamp The last operation date. 4.7.11
serviceType HostNetworkInterfaceServiceType See serviceType. 4.7.11
#serviceType
Name Type Description Starting Version
ManagementNetwork HostNetworkInterfaceServiceType The management network. 4.7.11
TenantNetwork HostNetworkInterfaceServiceType The business network. 4.7.11
StorageNetwork HostNetworkInterfaceServiceType The storage network. 4.7.11
BackupNetwork HostNetworkInterfaceServiceType The backup network. 4.7.11
MigrationNetwork HostNetworkInterfaceServiceType The migration network. 4.7.11
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.7.11
description String The brief description of the error. 4.7.11
details String The details about the error. 4.7.11
elaboration String The reserved field. Default value: null. 4.7.11
opaque LinkedHashMap The reserved field. Default value: null. 4.7.11
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.7.11

SDK Sample

Java SDK
SetServiceTypeOnHostNetworkInterfaceAction action = new SetServiceTypeOnHostNetworkInterfaceAction();
action.interfaceUuids = asList("2894f52c7d84366c85dd115b3bc193ca");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetServiceTypeOnHostNetworkInterfaceAction.Result res = action.call();
Python SDK
SetServiceTypeOnHostNetworkInterfaceAction action = SetServiceTypeOnHostNetworkInterfaceAction()
action.interfaceUuids = [2894f52c7d84366c85dd115b3bc193ca]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SetServiceTypeOnHostNetworkInterfaceAction.Result res = action.call()

SetServiceTypeOnHostNetworkBonding

API Request

URLs
POST zstack/v1/hosts/bondings/service-types
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "bondingUuids": [
      "e96881d20cde3a9ab337cdf0ab4e8b08"
    ],
    "serviceTypes": [
      "TenantNetwork"
    ]
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"bondingUuids":["e96881d20cde3a9ab337cdf0ab4e8b08"],"serviceTypes":["TenantNetwork"]}}' \
http://localhost:8080/zstack/v1/hosts/bondings/service-types
Request Parameters
Name Type Location Description Optional Value Starting Version
bondingUuids List body (contained in the params structure) The bond UUID list. 4.7.11
vlanIds List body (contained in the params structure) Optional. The VLAN interface id list. 4.7.11
serviceTypes List body (contained in the params structure) Optional. The network type.
  • ManagementNetwork
  • TenantNetwork
  • StorageNetwork
  • BackupNetwork
  • MigrationNetwork
4.7.11
systemTags List body Optional. The system tags. 4.7.11
userTags List body Optional. The user tags. 4.7.11

API Response

Sample Response
{
  "inventory": [
    {
      "id": 0,
      "bondingUuid": "d1fd53a607c936859414f6222175c820",
      "vlanId": 10,
      "serviceType": "BackupNetwork"
    }
  ]
}
Name Type Description Starting Version
success boolean 4.7.11
inventory List See inventory. 4.7.11
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.7.11
#inventory
Name Type Description Starting Version
bondingUuid String The bond UUID. 4.7.11
vlanId Integer The VLAN interface ID. 4.7.11
createDate Timestamp The creation date. 4.7.11
lastOpDate Timestamp The last operation date. 4.7.11
serviceType HostNetworkInterfaceServiceType See serviceType. 4.7.11
#serviceType
Name Type Description Starting Version
ManagementNetwork HostNetworkInterfaceServiceType The management network. 4.7.11
TenantNetwork HostNetworkInterfaceServiceType The business network. 4.7.11
StorageNetwork HostNetworkInterfaceServiceType The storage network. 4.7.11
BackupNetwork HostNetworkInterfaceServiceType The backup network. 4.7.11
MigrationNetwork HostNetworkInterfaceServiceType The migration network. 4.7.11
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.7.11
description String The brief description of the error. 4.7.11
details String The details about the error. 4.7.11
elaboration String The reserved field. Default value: null. 4.7.11
opaque LinkedHashMap The reserved field. Default value: null. 4.7.11
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.7.11

SDK Sample

Java SDK
SetServiceTypeOnHostNetworkBondingAction action = new SetServiceTypeOnHostNetworkBondingAction();
action.bondingUuids = asList("e96881d20cde3a9ab337cdf0ab4e8b08");
action.serviceTypes = asList("TenantNetwork");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetServiceTypeOnHostNetworkBondingAction.Result res = action.call();
Python SDK
SetServiceTypeOnHostNetworkBondingAction action = SetServiceTypeOnHostNetworkBondingAction()
action.bondingUuids = [e96881d20cde3a9ab337cdf0ab4e8b08]
action.serviceTypes = [TenantNetwork]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SetServiceTypeOnHostNetworkBondingAction.Result res = action.call()

GetCandidateInterfaceVlanIds

API Request

URLs
GET zstack/v1/host/network-interface-vlan-ids
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/host/network-interface-vlan-ids?interfaceUuids=d25e83af6ccf3d9ca8baa1702861a0c8&limit=1000&start=0
参数列表
Name Type Location Description Optional Value Starting Version
interfaceUuids List query The NIC port UUIDs 4.7.11
limit Integer query 4.7.11
start Integer query 4.7.11
systemTags List query Optional. The system tags. 4.7.11
userTags List query Optional. The user tags. 4.7.11

API Response

Sample Response
{
    "vlanIds": [
        1010,
        1011,
        10,
        11,
        2000,
        1101,
        1110,
        1108,
        1107,
        1109,
        1106,
        1103,
        1102,
        1105,
        1104,
        0
    ],
    "success": true
}
Name Type Description Starting Version
vlanIds List The Vlan interface ID list. 4.7.11
success boolean 4.7.11
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 4.7.11
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.7.11
description String The brief description of the error. 4.7.11
details String The details about the error. 4.7.11
elaboration String The reserved field. Default value: null. 4.7.11
opaque LinkedHashMap The reserved field. Default value: null. 4.7.11
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.7.11

SDK Sample

Java SDK
GetCandidateInterfaceVlanIdsAction action = new GetCandidateInterfaceVlanIdsAction();
action.interfaceUuids = asList("d25e83af6ccf3d9ca8baa1702861a0c8");
action.limit = 1000;
action.start = 0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetCandidateInterfaceVlanIdsAction.Result res = action.call();
Python SDK
GetCandidateInterfaceVlanIdsAction action = GetCandidateInterfaceVlanIdsAction()
action.interfaceUuids = [d25e83af6ccf3d9ca8baa1702861a0c8]
action.limit = 1000
action.start = 0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetCandidateInterfaceVlanIdsAction.Result res = action.call()

GetInterfaceServiceTypeStatistic

API Request

URLs
GET zstack/v1/hosts/hosts-network-interfaces/service-type-statistic
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/hosts/hosts-network-interfaces/service-type-statistic? \
interfaceUuid=d8797841479d3951bcb698164b56bd9e&interfaceType=All&sortBy=CreateDate&sortDirection=asc&start=0&limit=20&replyWithCount=false
Request Parameters
Name Type Location Description Optional Value Starting Version
interfaceUuid String query Optional. The NIC port UUID. 4.7.11
vlanId Integer query Optional. The VLAN interface ID. 4.7.11
interfaceType String query Optional. The NIC port type.
  • All
  • Interface
  • Bonding
4.7.11
serviceType List query Optional. The network type.
  • All
  • ManagementNetwork
  • TenantNetwork
  • StorageNetwork
  • MigrationNetwork
  • BackupNetwork
4.7.11
zoneUuid String query Optional. The zone UUID. 4.7.11
clusterUuid String query Optional. The cluster UUID. 4.7.11
hostUuid String query Optional. The host UUID. 4.7.11
sortBy String query Optional. The sort method.
  • InterfaceName
  • VlanId
  • HostIp
  • HostName
  • ClusterName
  • CreateDate
4.7.11
sortDirection String query Optional. The sort direction.
  • asc
  • desc
4.7.11
start Integer query Optional. The location where the statistics starts. 4.7.11
limit Integer query Optional. The count of the statistics. 4.7.11
replyWithCount boolean query Optional. Whether to return both the statistics result and count. 4.7.11
systemTags List query Optional. The system tags. 4.7.11
userTags List query Optional. The user tags. 4.7.11

API Response

Sample Response
{
  "serviceTypeStatistics": [
    {
      "interfaceUuid": "474f9d7d7a1d3b46b8f17363dca7ebef",
      "serviceTypes": [
        "ManagementNetwork"
      ]
    }
  ],
  "total": 1
}}
Name Type Description Starting Version
total Long The total count of the statistics. 4.7.11
success boolean Whether the API succeeds. 4.7.11
serviceTypeStatistics List See serviceTypeStatistics. 4.7.11
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error 4.7.11
#serviceTypeStatistics
名字 类型 描述 起始版本
interfaceUuid String The network interface UUID. 4.7.11
interfaceName String The network interface name. 4.7.11
vlanId Integer The vlan interface ID. 4.7.11
serviceTypes List The network type list. 4.7.11
hostUuid String The host UUID. 4.7.11
hostName String The host name. 4.7.11
hostIp String The host IP. 4.7.11
clusterUuid String The cluster UUID. 4.7.11
clusterName String The cluster name. 4.7.11
zoneUuid String The zone UUID. 4.7.11
createDate Timestamp The date of creation. 4.7.11
#error
名字 类型 描述 起始版本
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6

SDK Sample

Java SDK
GetInterfaceServiceTypeStatisticAction action = new GetInterfaceServiceTypeStatisticAction();
action.interfaceUuid = "d8797841479d3951bcb698164b56bd9e";
action.interfaceType = "All";
action.sortBy = "CreateDate";
action.sortDirection = "asc";
action.start = 0;
action.limit = 20;
action.replyWithCount = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetInterfaceServiceTypeStatisticAction.Result res = action.call();
Python SDK
GetInterfaceServiceTypeStatisticAction action = GetInterfaceServiceTypeStatisticAction()
action.interfaceUuid = "d8797841479d3951bcb698164b56bd9e"
action.interfaceType = "All"
action.sortBy = "CreateDate"
action.sortDirection = "asc"
action.start = 0
action.limit = 20
action.replyWithCount = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetInterfaceServiceTypeStatisticAction.Result res = action.call()
API Reference | 4.8.38 | ZStack Cloud · ZCF | ZStack Resource Center