CreateBareMetal2ProvisionNetwork
API Request
URLs
POST zstack/v1/baremetal2/provision-networks
Headers
Authorization: OAuth the-session-uuid
Body
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"name": "BM_PROVISION_NETWORK",
"description": "This is a baremetal2 provision network.",
"zoneUuid": "3391c3bf65fb34d0ae8ace100c28da77",
"dhcpInterface": "eth0",
"dhcpRangeStartIp": "192.168.0.100",
"dhcpRangeEndIp": "192.168.0.200",
"dhcpRangeNetmask": "255.255.255.0",
"dhcpRangeGateway": "192.168.0.1"
},
"systemTags": [],
"userTags": []
}

Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"BM_PROVISION_NETWORK","description":"This is a baremetal2 provision network.","zoneUuid":"3391c3bf65fb34d0ae8ace100c28da77","dhcpInterface":"eth0","dhcpRangeStartIp":"192.168.0.100","dhcpRangeEndIp":"192.168.0.200","dhcpRangeNetmask":"255.255.255.0","dhcpRangeGateway":"192.168.0.1"}}' http://localhost:8080/zstack/v1/baremetal2/provision-networks
Request Parameters
Name | Type | Location | Description | Valid Value | Starting Version |
---|---|---|---|---|---|
name | String | body(contained in the params structure) | The name of the deployment network. | 4.0.0 | |
description | String | body(contained in the params structure) | Optional. The detailed description of the deployment network. | 4.0.0 | |
zoneUuid | String | body(contained in the params structure) | The zone UUID. | 4.0.0 | |
dhcpInterface | String | body(contained in the params structure) | The name of the DHCP NIC. | 4.0.0 | |
dhcpRangeStartIp | String | body(contained in the params structure) | The starting IP address that DHCP assigns to a bare metal instance. | 4.0.0 | |
dhcpRangeEndIp | String | body(contained in the params structure) | The ending IP address that DHCP assigns to a bare metal instance. | 4.0.0 | |
dhcpRangeNetmask | String | body(contained in the params structure) | The netmask of the IP range from which the DHCP server assigns an IP address to a bare metal instance. | 4.0.0 | |
dhcpRangeGateway | String | body(contained in the params structure) | Optional. The gateway IP address. | 4.0.0 | |
resourceUuid | String | body(contained in the params structure) | Optional. The deployment network UUID. | 4.0.0 | |
tagUuids | List | body(contained in the params structure) | Optional. The tag UUIDs. | 4.0.0 | |
systemTags | List | body | Optional. The system tags. | 4.0.0 | |
userTags | List | body | Optional. The user tags. | 4.0.0 |
API Response
Sample Response
{
"inventory": {
"uuid": "0adedb8acdba4a889a4679c0f2a3dccd",
"zoneUuid": "dee0edff3afc42d988c54a3675f56617",
"name": "BM_PROVISION_NETWORK",
"description": "This is a bare metal provision network.",
"dhcpInterface": "eth0",
"dhcpRangeStartIp": "192.168.0.10",
"dhcpRangeEndIp": "192.168.0.100",
"dhcpRangeNetmask": "255.255.255.0",
"dhcpRangeGateway": "192.168.0.1",
"dhcpRangeNetworkCidr": "192.168.0.10/24",
"state": "Enabled",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
}
Name | Type | Description | Starting Version |
---|---|---|---|
error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error | 4.0.0 |
inventory | BareMetal2ProvisionNetworkInventory | See inventory | 4.0.0 |
#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.0.0 |
description | String | The brief description of the error. | 4.0.0 |
details | String | The details about the error. | 4.0.0 |
elaboration | String | The reserved field. Default value: null. | 4.0.0 |
opaque | LinkedHashMap | The reserved field. Default value: null. | 4.0.0 |
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.0.0 |
#inventory
Name | Type | Description | Starting Version |
---|---|---|---|
uuid | String | The deployment network UUID. | 4.0.0 |
zoneUuid | String | The zone UUID. | 4.0.0 |
name | String | The name of the deployment network. | 4.0.0 |
description | String | The detailed description of the deployment network. | 4.0.0 |
dhcpInterface | String | The name of the DHCP NIC. | 4.0.0 |
dhcpRangeStartIp | String | The starting IP address that DHCP assigns to a bare metal instance. | 4.0.0 |
dhcpRangeEndIp | String | The ending IP address that DHCP assigns to a bare metal instance. | 4.0.0 |
dhcpRangeNetmask | String | The netmask of the IP range from which the DHCP server assigns an IP address to a bare metal instance. | 4.0.0 |
dhcpRangeGateway | String | The gateway IP address. | 4.0.0 |
dhcpRangeNetworkCidr | String | The CIDR block. | 4.0.0 |
state | String | The state of the deployment network. | 4.0.0 |
createDate | Timestamp | The time when the deployment network was created. | 4.0.0 |
lastOpDate | Timestamp | The time when the deployment network was last modified. | 4.0.0 |
attachedClusterUuids | List | 4.0.0 |
SDK Sample
Java
SDK
CreateBareMetal2ProvisionNetworkAction action = new CreateBareMetal2ProvisionNetworkAction();
action.name = "BM_PROVISION_NETWORK";
action.description = "This is a baremetal2 provision network.";
action.zoneUuid = "3391c3bf65fb34d0ae8ace100c28da77";
action.dhcpInterface = "eth0";
action.dhcpRangeStartIp = "192.168.0.100";
action.dhcpRangeEndIp = "192.168.0.200";
action.dhcpRangeNetmask = "255.255.255.0";
action.dhcpRangeGateway = "192.168.0.1";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateBareMetal2ProvisionNetworkAction.Result res = action.call();
Python
SDK
CreateBareMetal2ProvisionNetworkAction action = CreateBareMetal2ProvisionNetworkAction()
action.name = "BM_PROVISION_NETWORK"
action.description = "This is a baremetal2 provision network."
action.zoneUuid = "3391c3bf65fb34d0ae8ace100c28da77"
action.dhcpInterface = "eth0"
action.dhcpRangeStartIp = "192.168.0.100"
action.dhcpRangeEndIp = "192.168.0.200"
action.dhcpRangeNetmask = "255.255.255.0"
action.dhcpRangeGateway = "192.168.0.1"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateBareMetal2ProvisionNetworkAction.Result res = action.call()