blob: 9919fe7880716165a7ac99ab999bfda5d207f279 [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 Wu3cad6f32017-11-15 23:29:11 -080031SENTINEL='Docker versions and branches'
32ENV_FILE=${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env
Gary Wubd894602017-10-30 11:52:40 -070033cp ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.env ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-demo.env
Gary Wu3cad6f32017-11-15 23:29:11 -080034envsubst < ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-template.env | sed -n "1,/${SENTINEL}/p" > ${ENV_FILE}
35pushd ${ONAP_WORKDIR}/demo
36echo " # Rest of the file was AUTO-GENERATED from"
37echo " #" $(git config --get remote.origin.url) heat/ONAP/onap_openstack.env $(git rev-parse HEAD) | tee -a ${ENV_FILE}
38popd
39sed "1,/${SENTINEL}/d" ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.env >> ${ENV_FILE}
40cat ${ENV_FILE}
41
Gary Wuf5fef8b2017-11-09 10:59:46 -080042#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 -070043
Gary Wua770e642017-10-23 12:30:29 -070044openstack 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 -070045
Gary Wuf5fef8b2017-11-09 10:59:46 -080046while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value $STACK)" ]; do
Gary Wu3cad6f32017-11-15 23:29:11 -080047 sleep 20
Gary Wuf5fef8b2017-11-09 10:59:46 -080048done
49
50STATUS=$(openstack stack show -c stack_status -f value $STACK)
51echo $STATUS
Gary Wu778b41b2017-11-09 12:08:24 -080052if [ "CREATE_COMPLETE" != "$STATUS" ]; then
53 exit 1
54fi
55
56
57# wait until Robot VM initializes
Gary Wua3f31bd2017-11-09 17:11:01 -080058ROBOT_IP=$($WORKSPACE/test/ete/scripts/get-floating-ip.sh onap-robot)
Gary Wu778b41b2017-11-09 12:08:24 -080059echo "ROBOT_IP=${ROBOT_IP}"
60
61if [ "" == "${ROBOT_IP}" ]; then
62 exit 1
63fi
64
65ssh-keygen -R ${ROBOT_IP}
66
67SSH_KEY=~/.ssh/onap_key
68
69until ssh -o StrictHostKeychecking=no -i ${SSH_KEY} root@${ROBOT_IP} "docker ps | grep -q openecompete_container"
70do
Gary Wu3cad6f32017-11-15 23:29:11 -080071 sleep 2m
Gary Wu778b41b2017-11-09 12:08:24 -080072done