Gary Wu | f5fef8b | 2017-11-09 10:59:46 -0800 | [diff] [blame] | 1 | #!/bin/bash -x |
Gary Wu | 874794d | 2017-10-13 12:27:39 -0700 | [diff] [blame] | 2 | |
Gary Wu | 874794d | 2017-10-13 12:27:39 -0700 | [diff] [blame] | 3 | if [ -z "$WORKSPACE" ]; then |
| 4 | export WORKSPACE=`git rev-parse --show-toplevel` |
| 5 | fi |
| 6 | |
Gary Wu | 838c34d | 2017-10-23 14:22:40 -0700 | [diff] [blame] | 7 | source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh |
Gary Wu | 874794d | 2017-10-13 12:27:39 -0700 | [diff] [blame] | 8 | |
Gary Wu | 99a7c1a | 2017-10-23 13:12:06 -0700 | [diff] [blame] | 9 | # Delete all existing stacks |
| 10 | STACKS=$(openstack stack list -c "Stack Name" -f value) |
Gary Wu | f5fef8b | 2017-11-09 10:59:46 -0800 | [diff] [blame] | 11 | |
Gary Wu | bd89460 | 2017-10-30 11:52:40 -0700 | [diff] [blame] | 12 | if [ ! -z "${STACKS}" ]; then |
| 13 | echo "Deleting Stacks ${STACKS}" |
| 14 | openstack stack delete -y $STACKS |
Gary Wu | f5fef8b | 2017-11-09 10:59:46 -0800 | [diff] [blame] | 15 | 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 Wu | bd89460 | 2017-10-30 11:52:40 -0700 | [diff] [blame] | 20 | else |
| 21 | echo "No existing stacks to delete." |
| 22 | fi |
Gary Wu | 874794d | 2017-10-13 12:27:39 -0700 | [diff] [blame] | 23 | |
Gary Wu | f5fef8b | 2017-11-09 10:59:46 -0800 | [diff] [blame] | 24 | |
| 25 | |
| 26 | |
Gary Wu | 874794d | 2017-10-13 12:27:39 -0700 | [diff] [blame] | 27 | STACK="ete-$(uuidgen | cut -c-8)" |
Gary Wu | 99a7c1a | 2017-10-23 13:12:06 -0700 | [diff] [blame] | 28 | echo "New Stack Name: ${STACK}" |
Gary Wu | b84428e | 2017-10-30 11:09:27 -0700 | [diff] [blame] | 29 | |
| 30 | |
Gary Wu | bd89460 | 2017-10-30 11:52:40 -0700 | [diff] [blame] | 31 | cp ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.env ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-demo.env |
Gary Wu | b84428e | 2017-10-30 11:09:27 -0700 | [diff] [blame] | 32 | envsubst < ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-template.env > ${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env |
Gary Wu | f5fef8b | 2017-11-09 10:59:46 -0800 | [diff] [blame] | 33 | #diff ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-template.env ${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env |
Gary Wu | b84428e | 2017-10-30 11:09:27 -0700 | [diff] [blame] | 34 | |
Gary Wu | a770e64 | 2017-10-23 12:30:29 -0700 | [diff] [blame] | 35 | openstack stack create -t ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.yaml -e ${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env $STACK |
Gary Wu | 874794d | 2017-10-13 12:27:39 -0700 | [diff] [blame] | 36 | |
Gary Wu | f5fef8b | 2017-11-09 10:59:46 -0800 | [diff] [blame] | 37 | while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value $STACK)" ]; do |
| 38 | sleep 10 |
| 39 | done |
| 40 | |
| 41 | STATUS=$(openstack stack show -c stack_status -f value $STACK) |
| 42 | echo $STATUS |
| 43 | [ "CREATE_COMPLETE" == "$STATUS" ] |