Create Host Kernel Interface

POST/zstack/v1/l2-networks/kernel-interfaces

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "zs-kernel",
    "description": "test-description",
    "hostUuid": "ac64f7d9591b34b5a9286d7124e9787c",
    "l2NetworkUuid": "c68967a38bf132bf96f7ca42cdc5c47b",
    "l3NetworkUuid": "1c9547c6bd89392e8c0f50efa83ac990",
    "requiredIp": "172.16.1.1",
    "netmask": "255.255.255.0",
    "trafficTypes": [
      "Management"
    ]
  },
  "systemTags": [],
  "userTags": []
}

The systemTags and userTags fields can be omitted in the above example. They are listed to indicate that the body can contain these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"zs-kernel","description":"test-description","hostUuid":"ac64f7d9591b34b5a9286d7124e9787c","l2NetworkUuid":"c68967a38bf132bf96f7ca42cdc5c47b","l3NetworkUuid":"1c9547c6bd89392e8c0f50efa83ac990","requiredIp":"172.16.1.1","netmask":"255.255.255.0","trafficTypes":["Management"]}}' http://localhost:8080/zstack/v1/l2-networks/kernel-interfaces

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

name

String

body(contained in params structure)

Resource name

 

4.1.0

description (Optional)

String

body(contained in params structure)

Resource description

 

4.1.0

hostUuid

String

body(contained in params structure)

Host UUID

 

4.1.0

l2NetworkUuid

String

body(contained in params structure)

Port group Distributed Switch UUID

 

4.1.0

l3NetworkUuid

String

body(contained in params structure)

Distributed Port Group UUID

 

4.1.0

requiredIp (Optional)

String

body(contained in params structure)

Required IP

 

4.1.0

netmask (Optional)

String

body(contained in params structure)

Netmask

 

4.1.0

trafficTypes (Optional)

List

body(contained in params structure)

Traffic type

  • Management

4.1.0

resourceUuid (Optional)

String

body(contained in params structure)

Resource UUID

 

4.1.0

tagUuids (Optional)

List

body(contained in params structure)

Tag UUID list

 

4.1.0

systemTags (Optional)

List

body

System tags

 

4.1.0

userTags (Optional)

List

body

User tags

 

4.1.0

API Response

Response Example

{
  "inventory": {
    "uuid": "748beaeb70273060a8b599d871a195e6",
    "name": "test-kernel",
    "description": "test-kernel",
    "hostUuid": "3a620091153d3027af5df7c27a0f8fd8",
    "l2NetworkUuid": "f66b2fcb35ae3779a69447cf56a153e3",
    "l3NetworkUuid": "c2372a1dd7ce338d80ce1de8c658e9a6",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
NameTypeDescriptionStarting Version
successboolean 4.1.0
inventoryHostKernelInterfaceInventorySee inventory4.1.0
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. See error4.1.0

inventory

NameTypeDescriptionStarting Version
uuidStringUUID of the resource, uniquely identifies the resource4.1.0
nameStringResource name4.1.0
descriptionStringResource description4.1.0
hostUuidStringHost UUID4.1.0
l2PortGroupUuidStringPort group UUID4.1.0
l3NetworkUuidStringDistributed Port Group UUID4.1.0
usedIpsListIP configuration4.1.0
trafficTypesListTraffic type4.1.0
createDateTimestampCreate date4.1.0
lastOpDateTimestampLast update date4.1.0

error

NameTypeDescriptionStarting Version
codeStringError code, a globally unique identifier of the error, e.g. SYS.1000, HOST.10014.1.0
descriptionStringBrief description of the error4.1.0
detailsStringDetailed error information4.1.0
elaborationStringReserved field, defaults to null4.1.0
opaqueLinkedHashMapReserved field, defaults to null4.1.0
causeErrorCodeRoot cause, the source error that caused the current error, null if no original error4.1.0

SDK Examples

Java SDK

CreateHostKernelInterfaceAction action = new CreateHostKernelInterfaceAction();
action.name = "zs-kernel";
action.description = "test-description";
action.hostUuid = "ac64f7d9591b34b5a9286d7124e9787c";
action.l2NetworkUuid = "c68967a38bf132bf96f7ca42cdc5c47b";
action.l3NetworkUuid = "1c9547c6bd89392e8c0f50efa83ac990";
action.requiredIp = "172.16.1.1";
action.netmask = "255.255.255.0";
action.trafficTypes = asList("Management");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateHostKernelInterfaceAction.Result res = action.call();

Python SDK

CreateHostKernelInterfaceAction action = CreateHostKernelInterfaceAction()
action.name = "zs-kernel"
action.description = "test-description"
action.hostUuid = "ac64f7d9591b34b5a9286d7124e9787c"
action.l2NetworkUuid = "c68967a38bf132bf96f7ca42cdc5c47b"
action.l3NetworkUuid = "1c9547c6bd89392e8c0f50efa83ac990"
action.requiredIp = "172.16.1.1"
action.netmask = "255.255.255.0"
action.trafficTypes = [Management]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateHostKernelInterfaceAction.Result res = action.call()