Merge "Update regenerate-samples.sh api-ref script"

This commit is contained in:
Jenkins 2017-01-10 15:35:23 +00:00 committed by Gerrit Code Review
commit f2d4d76b7d
20 changed files with 65 additions and 42 deletions

View File

@ -18,7 +18,11 @@ export OS_AUTH_TOKEN IRONIC_URL
DOC_CHASSIS_UUID="dff29d23-1ded-43b4-8ae1-5eebb3e30de1"
DOC_NODE_UUID="6d85703a-565d-469a-96ce-30b6de53079d"
DOC_PORT_UUID="d2b30520-907d-46c8-bfee-c5586e6fb3a1"
DOC_PORTGROUP_UUID="e059deab-6e86-40d1-9e70-62d525f16728"
DOC_PORTGROUP_UUID="e43c722c-248e-4c6e-8ce8-0d8ff129387a"
DOC_PROVISION_UPDATED_AT="2016-08-18T22:28:49.946416+00:00"
DOC_CREATED_AT="2016-08-18T22:28:48.643434+11:11"
DOC_UPDATED_AT="2016-08-18T22:28:49.653974+00:00"
DOC_IRONIC_CONDUCTOR_HOSTNAME="897ab1dad809"
function GET {
# GET $RESOURCE
@ -54,6 +58,27 @@ function PUT {
${IRONIC_URL}/$1
}
function wait_for_node_state {
local node="$1"
local field="$2"
local target_state="$3"
local attempt=10
while [[ $attempt -gt 0 ]]; do
res=$(openstack baremetal node show "$node" -f value -c "$field")
if [[ "$res" == "$target_state" ]]; then
break
fi
sleep 1
attempt=$((attempt - 1))
echo "Failed to get node $field == $target_state in $attempt attempts."
done
if [[ $attempt == 0 ]]; then
exit 1
fi
}
pushd source/samples
###########
@ -116,10 +141,14 @@ GET v1/nodes/$NID/vendor_passthru/methods > node-vendor-passthru-response.json
PATCH v1/nodes/$NID node-update-driver.json
PUT v1/nodes/$NID/states/provision node-set-manage-state.json
PUT v1/nodes/$NID/states/provision node-set-available-state.json
# Wait node to become available
wait_for_node_state $NID provision_state available
GET v1/nodes/$NID/validate > node-validate-response.json
PUT v1/nodes/$NID/states/power node-set-power-off.json
# Wait node to reach power off state
wait_for_node_state $NID power_state "power off"
GET v1/nodes/$NID/states > node-get-state-response.json
GET v1/nodes > nodes-list-response.json
@ -216,3 +245,7 @@ sed -i "s/$CID/$DOC_CHASSIS_UUID/" *.json
sed -i "s/$NID/$DOC_NODE_UUID/" *.json
sed -i "s/$PID/$DOC_PORT_UUID/" *.json
sed -i "s/$PGID/$DOC_PORTGROUP_UUID/" *.json
sed -i "s/$(hostname)/$DOC_IRONIC_CONDUCTOR_HOSTNAME/" *.json
sed -i "s/created_at\": \".*\"/created_at\": \"$DOC_CREATED_AT\"/" *.json
sed -i "s/updated_at\": \".*\"/updated_at\": \"$DOC_UPDATED_AT\"/" *.json
sed -i "s/provision_updated_at\": \".*\"/provision_updated_at\": \"$DOC_PROVISION_UPDATED_AT\"/" *.json

View File

@ -1,7 +1,7 @@
{
"chassis": [
{
"created_at": "2016-08-18T22:28:48.165105+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"description": "Sample chassis",
"extra": {},
"links": [

View File

@ -1,5 +1,5 @@
{
"created_at": "2016-08-18T22:28:48.165105+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"description": "Sample chassis",
"extra": {},
"links": [

View File

@ -1,5 +1,5 @@
{
"created_at": "2016-08-18T22:28:48.165105+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"description": "Updated Chassis",
"extra": {},
"links": [
@ -22,6 +22,6 @@
"rel": "bookmark"
}
],
"updated_at": "2016-08-18T22:28:48.556556+00:00",
"updated_at": "2016-08-18T22:28:49.653974+00:00",
"uuid": "dff29d23-1ded-43b4-8ae1-5eebb3e30de1"
}

View File

@ -1,7 +1,8 @@
{
"chassis_uuid": null,
"clean_step": {},
"console_enabled": false,
"created_at": "2016-08-18T22:28:48.643434+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"driver": "agent_ipmitool",
"driver_info": {
"ipmi_password": "******",

View File

@ -3,7 +3,7 @@
"last_error": null,
"power_state": "power off",
"provision_state": "available",
"provision_updated_at": "2016-08-18T22:28:49.382814+00:00",
"provision_updated_at": "2016-08-18T22:28:49.946416+00:00",
"raid_config": {},
"target_power_state": null,
"target_provision_state": null,

View File

@ -2,7 +2,7 @@
"ports": [
{
"address": "22:22:22:22:22:22",
"created_at": "2016-08-18T22:28:49.946416+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"extra": {},
"internal_info": {},
"links": [
@ -23,7 +23,7 @@
"node_uuid": "6d85703a-565d-469a-96ce-30b6de53079d",
"portgroup_uuid": "e43c722c-248e-4c6e-8ce8-0d8ff129387a",
"pxe_enabled": true,
"updated_at": "2016-08-18T22:28:50.148137+00:00",
"updated_at": "2016-08-18T22:28:49.653974+00:00",
"uuid": "d2b30520-907d-46c8-bfee-c5586e6fb3a1"
}
]

View File

@ -2,7 +2,7 @@
"portgroups": [
{
"address": "22:22:22:22:22:22",
"created_at": "2016-08-18T22:28:48.165105+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"extra": {},
"internal_info": {},
"links": [
@ -30,7 +30,7 @@
],
"properties": {},
"standalone_ports_supported": true,
"updated_at": "2016-11-04T17:46:09+00:00",
"updated_at": "2016-08-18T22:28:49.653974+00:00",
"uuid": "e43c722c-248e-4c6e-8ce8-0d8ff129387a"
}
]

View File

@ -1,3 +0,0 @@
{
"target": "power on"
}

View File

@ -1,7 +1,8 @@
{
"chassis_uuid": null,
"clean_step": {},
"console_enabled": false,
"created_at": "2016-08-18T22:28:48.643434+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"driver": "fake",
"driver_info": {
"ipmi_password": "******",
@ -53,7 +54,7 @@
"power_state": "power off",
"properties": {},
"provision_state": "available",
"provision_updated_at": "2016-08-18T22:28:49.382814+00:00",
"provision_updated_at": "2016-08-18T22:28:49.946416+00:00",
"raid_config": {},
"reservation": null,
"resource_class": null,

View File

@ -1,11 +0,0 @@
{
"console_enabled": false,
"last_error": null,
"power_state": "power on",
"provision_state": null,
"provision_updated_at": null,
"raid_config": null,
"target_power_state": "power on",
"target_provision_state": "active",
"target_raid_config": null
}

View File

@ -1,7 +1,8 @@
{
"chassis_uuid": null,
"clean_step": {},
"console_enabled": false,
"created_at": "2016-08-18T22:28:48+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"driver": "fake",
"driver_info": {
"deploy_kernel": "http://127.0.0.1/images/kernel",
@ -55,7 +56,7 @@
"power_state": "power off",
"properties": {},
"provision_state": "available",
"provision_updated_at": "2016-08-18T22:28:49+00:00",
"provision_updated_at": "2016-08-18T22:28:49.946416+00:00",
"raid_config": {},
"reservation": null,
"resource_class": null,
@ -72,6 +73,6 @@
"target_power_state": null,
"target_provision_state": null,
"target_raid_config": {},
"updated_at": "2016-08-18T22:28:50+00:00",
"updated_at": "2016-08-18T22:28:49.653974+00:00",
"uuid": "6d85703a-565d-469a-96ce-30b6de53079d"
}

View File

@ -1,9 +1,10 @@
{
"nodes": [
{
"chassis_uuid": null,
"clean_step": {},
"console_enabled": false,
"created_at": "2016-08-18T22:28:48.643434+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"driver": "fake",
"driver_info": {
"ipmi_password": "******",
@ -55,7 +56,7 @@
"power_state": "power off",
"properties": {},
"provision_state": "available",
"provision_updated_at": "2016-08-18T22:28:49.382814+00:00",
"provision_updated_at": "2016-08-18T22:28:49.946416+00:00",
"raid_config": {},
"reservation": null,
"resource_class": null,

View File

@ -1,6 +1,6 @@
{
"address": "11:11:11:11:11:11",
"created_at": "2016-08-18T22:28:49.946416+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"extra": {},
"internal_info": {},
"links": [

View File

@ -2,7 +2,7 @@
"ports": [
{
"address": "11:11:11:11:11:11",
"created_at": "2016-08-18T22:28:49.946416+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"extra": {},
"internal_info": {},
"links": [

View File

@ -1,6 +1,6 @@
{
"address": "22:22:22:22:22:22",
"created_at": "2016-08-18T22:28:49+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"extra": {},
"internal_info": {},
"links": [
@ -21,6 +21,6 @@
"node_uuid": "6d85703a-565d-469a-96ce-30b6de53079d",
"portgroup_uuid": "e43c722c-248e-4c6e-8ce8-0d8ff129387a",
"pxe_enabled": true,
"updated_at": "2016-08-18T22:28:50+00:00",
"updated_at": "2016-08-18T22:28:49.653974+00:00",
"uuid": "d2b30520-907d-46c8-bfee-c5586e6fb3a1"
}

View File

@ -1,6 +1,6 @@
{
"address": "11:11:11:11:11:11",
"created_at": "2016-08-18T22:28:48.165105+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"extra": {},
"internal_info": {},
"links": [

View File

@ -2,7 +2,7 @@
"portgroups": [
{
"address": "11:11:11:11:11:11",
"created_at": "2016-08-18T22:28:48.165105+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"extra": {},
"internal_info": {},
"links": [

View File

@ -2,7 +2,7 @@
"ports": [
{
"address": "22:22:22:22:22:22",
"created_at": "2016-08-18T22:28:48.165105+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"extra": {},
"internal_info": {},
"links": [
@ -23,7 +23,7 @@
"node_uuid": "6d85703a-565d-469a-96ce-30b6de53079d",
"portgroup_uuid": "e43c722c-248e-4c6e-8ce8-0d8ff129387a",
"pxe_enabled": true,
"updated_at": "2016-11-04T17:46:09+00:00",
"updated_at": "2016-08-18T22:28:49.653974+00:00",
"uuid": "d2b30520-907d-46c8-bfee-c5586e6fb3a1"
}
]

View File

@ -1,6 +1,6 @@
{
"address": "22:22:22:22:22:22",
"created_at": "2016-08-18T22:28:48.165105+00:00",
"created_at": "2016-08-18T22:28:48.643434+11:11",
"extra": {},
"internal_info": {},
"links": [
@ -28,6 +28,6 @@
],
"properties": {},
"standalone_ports_supported": true,
"updated_at": "2016-11-04T17:46:09+00:00",
"updated_at": "2016-08-18T22:28:49.653974+00:00",
"uuid": "e43c722c-248e-4c6e-8ce8-0d8ff129387a"
}