Configure IP on Physical Interface
Headers
Authorization: OAuth the-session-uuidBody
{
"params": {
"ipAddress": "1.1.1.1",
"netmask": "255.255.0.0"
},
"systemTags": [],
"userTags": []
}In the above example, systemTags and userTags fields can be omitted. They are listed to indicate that these two fields can be included in the body.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"ipAddress":"1.1.1.1","netmask":"255.255.0.0"}}' http://localhost:8080/zstack/v1/hosts/nics/d50ade48aec73edc87b0f7c2d6a84bcc/ipParameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| interfaceUuid | String | url | Physical NIC UUID | 4.7.0 | |
| ipAddress (optional) | String | body (contained in params structure) | IP address | 4.7.0 | |
| netmask (optional) | String | body (contained in params structure) | Subnet mask | 4.7.0 | |
| isDefaultRoute (optional) | Boolean | body (contained in params structure) | Whether to set as default route | 4.7.0 | |
| systemTags (optional) | List | body | System tag | 4.7.0 | |
| userTags (optional) | List | body | User tag | 4.7.0 |
API Response
Response Example
{
"inventory": {
"hostUuid": "d7fd94874d4235439abe33e041dd0928",
"ipAddresses": [
"192.168.1.1"
]
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.7.0 | |
| inventory | HostNetworkInterfaceInventory | See details inventory | 4.7.0 |
| error | ErrorCode | Error code. If not null, the operation failed. If null, the operation succeeded. See details error | 4.7.0 |
inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, uniquely identifies the resource | 4.7.0 |
| hostUuid | String | Host UUID | 4.7.0 |
| bondingUuid | String | Bond UUID | 4.7.0 |
| interfaceName | String | NIC name | 4.7.0 |
| interfaceType | String | NIC usage state, can be nomaster, bridgeSlave, bondSlave | 4.7.0 |
| speed | Long | NIC speed | 4.7.0 |
| slaveActive | Boolean | Bond link status | 4.7.0 |
| carrierActive | Boolean | Physical link status | 4.7.0 |
| ipAddresses | List | IP addresses | 4.7.0 |
| gateway | String | Gateway address | 4.7.0 |
| mac | String | MAC address | 4.7.0 |
| callBackIp | String | Callback address | 4.7.0 |
| pciDeviceAddress | String | NIC PCI address | 4.7.0 |
| offloadStatus | String | 4.7.0 | |
| description | String | Resource description | 4.7.0 |
| createDate | Timestamp | Creation time | 4.7.0 |
| lastOpDate | Timestamp | Last modification time | 4.7.0 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, globally unique identifier of the error, e.g. SYS.1000, HOST.1001 | 4.7.0 |
| description | String | Brief description of the error | 4.7.0 |
| details | String | Detailed error information | 4.7.0 |
| elaboration | String | Reserved field, default is null | 4.7.0 |
| opaque | LinkedHashMap | Reserved field, default is null | 4.7.0 |
| cause | ErrorCode | Root cause, the error that caused the current error. If there is no original error, this field is null | 4.7.0 |
SDK Examples
Java SDK
SetIpOnHostNetworkInterfaceAction action = new SetIpOnHostNetworkInterfaceAction();
action.interfaceUuid = "d50ade48aec73edc87b0f7c2d6a84bcc";
action.ipAddress = "1.1.1.1";
action.netmask = "255.255.0.0";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetIpOnHostNetworkInterfaceAction.Result res = action.call();Python SDK
SetIpOnHostNetworkInterfaceAction action = SetIpOnHostNetworkInterfaceAction()
action.interfaceUuid = "d50ade48aec73edc87b0f7c2d6a84bcc"
action.ipAddress = "1.1.1.1"
action.netmask = "255.255.0.0"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SetIpOnHostNetworkInterfaceAction.Result res = action.call()