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 |
Gary Wu | 15db618 | 2017-11-09 15:44:38 -0800 | [diff] [blame^] | 16 | until [ "DELETE_IN_PROGRESS" != "$(openstack stack show -c stack_status -f value $STACK)" ]; do |
Gary Wu | f5fef8b | 2017-11-09 10:59:46 -0800 | [diff] [blame] | 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 |
Gary Wu | 778b41b | 2017-11-09 12:08:24 -0800 | [diff] [blame] | 38 | sleep 15 |
Gary Wu | f5fef8b | 2017-11-09 10:59:46 -0800 | [diff] [blame] | 39 | done |
| 40 | |
| 41 | STATUS=$(openstack stack show -c stack_status -f value $STACK) |
| 42 | echo $STATUS |
Gary Wu | 778b41b | 2017-11-09 12:08:24 -0800 | [diff] [blame] | 43 | if [ "CREATE_COMPLETE" != "$STATUS" ]; then |
| 44 | exit 1 |
| 45 | fi |
| 46 | |
| 47 | |
| 48 | # wait until Robot VM initializes |
| 49 | ROBOT_IP=$(./get-floating-ip.sh onap-robot) |
| 50 | echo "ROBOT_IP=${ROBOT_IP}" |
| 51 | |
| 52 | if [ "" == "${ROBOT_IP}" ]; then |
| 53 | exit 1 |
| 54 | fi |
| 55 | |
| 56 | ssh-keygen -R ${ROBOT_IP} |
| 57 | |
| 58 | SSH_KEY=~/.ssh/onap_key |
| 59 | |
| 60 | until ssh -o StrictHostKeychecking=no -i ${SSH_KEY} root@${ROBOT_IP} "docker ps | grep -q openecompete_container" |
| 61 | do |
| 62 | sleep 1m |
| 63 | done |