diff options
Diffstat (limited to 'test/ete/scripts/deploy-onap.sh')
-rwxr-xr-x | test/ete/scripts/deploy-onap.sh | 86 |
1 files changed, 48 insertions, 38 deletions
diff --git a/test/ete/scripts/deploy-onap.sh b/test/ete/scripts/deploy-onap.sh index 3c69e15e8..4802e02ce 100755 --- a/test/ete/scripts/deploy-onap.sh +++ b/test/ete/scripts/deploy-onap.sh @@ -1,53 +1,63 @@ -#!/bin/bash - -if [ -z "$OS_AUTH_URL" ] || [ -z "$OS_USERNAME" ] -then - echo "ERROR: OpenStack environment variables not set. Please source your OpenStack RC script first." - exit 1 -fi - +#!/bin/bash -x if [ -z "$WORKSPACE" ]; then export WORKSPACE=`git rev-parse --show-toplevel` fi +source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh +# Delete all existing stacks +STACKS=$(openstack stack list -c "Stack Name" -f value) -# Assume that if ROBOT_VENV is set, we don't need to reinstall robot -if [ -f ${WORKSPACE}/env.properties ]; then - source ${WORKSPACE}/env.properties -fi - -if [ ! -z "$ONAP_VENV" ] && [ -f "$ONAP_VENV/bin/activate" ]; then - source ${ONAP_VENV}/bin/activate +if [ ! -z "${STACKS}" ]; then + echo "Deleting Stacks ${STACKS}" + openstack stack delete -y $STACKS + for STACK in ${STACKS}; do + until [ "DELETE_IN_PROGRESS" != "$(openstack stack show -c stack_status -f value $STACK)" ]; do + sleep 30 + done + done else - ONAP_VENV=$(mktemp -d --suffix=_onap_venv) - virtualenv ${ONAP_VENV} - source ${ONAP_VENV}/bin/activate - - pip install --upgrade pip - pip install --upgrade python-openstackclient python-heatclient - - echo "ONAP_VENV=${ONAP_VENV}" >> $WORKSPACE/env.properties + echo "No existing stacks to delete." fi -echo "ONAP_VENV=${ONAP_VENV}" -if [ -z "$ONAP_WORKDIR" ]; then - ONAP_WORKDIR=$(mktemp -d --suffix=_onap_workdir) - echo "ONAP_WORKDIR=${ONAP_WORKDIR}" >> $WORKSPACE/env.properties -fi -echo "ONAP_WORKDIR=${ONAP_WORKDIR}" -if [ ! -d ${ONAP_WORKDIR}/demo ]; then - git clone http://gerrit.onap.org/r/demo ${ONAP_WORKDIR}/demo -else - pushd ${ONAP_WORKDIR}/demo - git pull - popd -fi STACK="ete-$(uuidgen | cut -c-8)" -echo "Stack Name: ${STACK}" -openstack stack create -t ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.yaml -e ${WORKSPACE}/test/ete/labs/windriver/onap.env $STACK +echo "New Stack Name: ${STACK}" + + +cp ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.env ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-demo.env +envsubst < ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-template.env > ${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env +#diff ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-template.env ${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env + +openstack stack create -t ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.yaml -e ${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env $STACK + +while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value $STACK)" ]; do + sleep 15 +done + +STATUS=$(openstack stack show -c stack_status -f value $STACK) +echo $STATUS +if [ "CREATE_COMPLETE" != "$STATUS" ]; then + exit 1 +fi + + +# wait until Robot VM initializes +ROBOT_IP=$($WORKSPACE/test/ete/scripts/get-floating-ip.sh onap-robot) +echo "ROBOT_IP=${ROBOT_IP}" + +if [ "" == "${ROBOT_IP}" ]; then + exit 1 +fi + +ssh-keygen -R ${ROBOT_IP} + +SSH_KEY=~/.ssh/onap_key +until ssh -o StrictHostKeychecking=no -i ${SSH_KEY} root@${ROBOT_IP} "docker ps | grep -q openecompete_container" +do + sleep 1m +done |