blob: 90393cf86218020549451a73ed44a81ff7ef2178 [file] [log] [blame]
Gary Wuf5fef8b2017-11-09 10:59:46 -08001#!/bin/bash -x
Gary Wu874794d2017-10-13 12:27:39 -07002
Gary Wu874794d2017-10-13 12:27:39 -07003if [ -z "$WORKSPACE" ]; then
4 export WORKSPACE=`git rev-parse --show-toplevel`
5fi
6
Gary Wu838c34d2017-10-23 14:22:40 -07007source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh
Gary Wu874794d2017-10-13 12:27:39 -07008
Gary Wu99a7c1a2017-10-23 13:12:06 -07009# Delete all existing stacks
10STACKS=$(openstack stack list -c "Stack Name" -f value)
Gary Wuf5fef8b2017-11-09 10:59:46 -080011
Gary Wubd894602017-10-30 11:52:40 -070012if [ ! -z "${STACKS}" ]; then
13 echo "Deleting Stacks ${STACKS}"
14 openstack stack delete -y $STACKS
Gary Wuf5fef8b2017-11-09 10:59:46 -080015 for STACK in ${STACKS}; do
Gary Wu15db6182017-11-09 15:44:38 -080016 until [ "DELETE_IN_PROGRESS" != "$(openstack stack show -c stack_status -f value $STACK)" ]; do
Gary Wuf5fef8b2017-11-09 10:59:46 -080017 sleep 30
18 done
19 done
Gary Wubd894602017-10-30 11:52:40 -070020else
21 echo "No existing stacks to delete."
22fi
Gary Wu874794d2017-10-13 12:27:39 -070023
Gary Wuf5fef8b2017-11-09 10:59:46 -080024
25
26
Gary Wu874794d2017-10-13 12:27:39 -070027STACK="ete-$(uuidgen | cut -c-8)"
Gary Wu99a7c1a2017-10-23 13:12:06 -070028echo "New Stack Name: ${STACK}"
Gary Wub84428e2017-10-30 11:09:27 -070029
30
Gary Wubd894602017-10-30 11:52:40 -070031cp ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.env ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-demo.env
Gary Wub84428e2017-10-30 11:09:27 -070032envsubst < ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-template.env > ${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env
Gary Wuf5fef8b2017-11-09 10:59:46 -080033#diff ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-template.env ${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env
Gary Wub84428e2017-10-30 11:09:27 -070034
Gary Wua770e642017-10-23 12:30:29 -070035openstack stack create -t ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.yaml -e ${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env $STACK
Gary Wu874794d2017-10-13 12:27:39 -070036
Gary Wuf5fef8b2017-11-09 10:59:46 -080037while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value $STACK)" ]; do
Gary Wu778b41b2017-11-09 12:08:24 -080038 sleep 15
Gary Wuf5fef8b2017-11-09 10:59:46 -080039done
40
41STATUS=$(openstack stack show -c stack_status -f value $STACK)
42echo $STATUS
Gary Wu778b41b2017-11-09 12:08:24 -080043if [ "CREATE_COMPLETE" != "$STATUS" ]; then
44 exit 1
45fi
46
47
48# wait until Robot VM initializes
49ROBOT_IP=$(./get-floating-ip.sh onap-robot)
50echo "ROBOT_IP=${ROBOT_IP}"
51
52if [ "" == "${ROBOT_IP}" ]; then
53 exit 1
54fi
55
56ssh-keygen -R ${ROBOT_IP}
57
58SSH_KEY=~/.ssh/onap_key
59
60until ssh -o StrictHostKeychecking=no -i ${SSH_KEY} root@${ROBOT_IP} "docker ps | grep -q openecompete_container"
61do
62 sleep 1m
63done