blob: 5ed30a13f478f06aa0b552d51c075b02d33dd193 [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
16 until ! openstack stack show -c stack_status -f value $STACK; do
17 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
38 sleep 10
39done
40
41STATUS=$(openstack stack show -c stack_status -f value $STACK)
42echo $STATUS
43[ "CREATE_COMPLETE" == "$STATUS" ]