本节介绍了如何使用 REST API 部署控制器。
CSP 在 REST API 中使用基本身份验证。
过程
- 使用以下 curl 命令创建控制器服务:
curl -X POST --user admin:AviCsp@2100 -H "Content-Type: application/json" -d '{
"service":{
"name":"Controller",
"power":"on",
"iso_name":"controller.qcow2",
"day0_filename":"avi_meta_controller.yml",
"numcpu":8,
"memory":24576,
"vnics":{
"vnic":[
{
"nic":"0",
"type":"access",
"tagged":"false",
"network_name":"enp1s0f1"
}
]
}
}
}' -k "https://10.8.3.106/api/running/services/"
- CSP 应使用状态代码 201 Created 进行响应。要进行验证,请使用以下 curl 命令获取所有安装的服务:
curl -X GET --user username:password -H "Content-Type: application/json" -k "https://10.8.3.106/api/running/services/service/Controller"
结果
将生成以下输出:
{
{
"vsb:service": {
"name": "Controller",
"uuid": "368bf2e5-7590-4efc-b19b-2a501e616933",
"memory": 24576,
"numcpu": 8,
"macid": 153,
"disk_size": "64.0",
"iso_name": "controller.qcow2",
"power": "on",
"day0_filename": "avi_meta_controller.yml",
"vnics": {
"vnic": [
{
"nic": 0
}
]
},
"operations": {
"export": "/api/running/services/service/Controller/_operations/export",
"monitor": "/api/running/services/service/Controller/_operations/monitor"
}
}
}