Gary Wu | 874794d | 2017-10-13 12:27:39 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | if [ -z "$OS_AUTH_URL" ] || [ -z "$OS_USERNAME" ] |
| 4 | then |
| 5 | echo "ERROR: OpenStack environment variables not set. Please source your OpenStack RC script first." |
| 6 | exit 1 |
| 7 | fi |
| 8 | |
| 9 | |
| 10 | if [ -z "$WORKSPACE" ]; then |
| 11 | export WORKSPACE=`git rev-parse --show-toplevel` |
| 12 | fi |
| 13 | |
| 14 | |
| 15 | |
| 16 | # Assume that if ROBOT_VENV is set, we don't need to reinstall robot |
| 17 | if [ -f ${WORKSPACE}/env.properties ]; then |
| 18 | source ${WORKSPACE}/env.properties |
| 19 | fi |
| 20 | |
| 21 | if [ ! -z "$ONAP_VENV" ] && [ -f "$ONAP_VENV/bin/activate" ]; then |
| 22 | source ${ONAP_VENV}/bin/activate |
| 23 | else |
| 24 | ONAP_VENV=$(mktemp -d --suffix=_onap_venv) |
| 25 | virtualenv ${ONAP_VENV} |
| 26 | source ${ONAP_VENV}/bin/activate |
| 27 | |
| 28 | pip install --upgrade pip |
| 29 | pip install --upgrade python-openstackclient python-heatclient |
| 30 | |
| 31 | echo "ONAP_VENV=${ONAP_VENV}" >> $WORKSPACE/env.properties |
| 32 | fi |
| 33 | echo "ONAP_VENV=${ONAP_VENV}" |
| 34 | |
| 35 | if [ -z "$ONAP_WORKDIR" ]; then |
| 36 | ONAP_WORKDIR=$(mktemp -d --suffix=_onap_workdir) |
| 37 | echo "ONAP_WORKDIR=${ONAP_WORKDIR}" >> $WORKSPACE/env.properties |
| 38 | fi |
| 39 | echo "ONAP_WORKDIR=${ONAP_WORKDIR}" |
| 40 | if [ ! -d ${ONAP_WORKDIR}/demo ]; then |
| 41 | git clone http://gerrit.onap.org/r/demo ${ONAP_WORKDIR}/demo |
| 42 | else |
| 43 | pushd ${ONAP_WORKDIR}/demo |
| 44 | git pull |
| 45 | popd |
| 46 | fi |
| 47 | |
| 48 | |
Gary Wu | 99a7c1a | 2017-10-23 13:12:06 -0700 | [diff] [blame] | 49 | # Delete all existing stacks |
| 50 | STACKS=$(openstack stack list -c "Stack Name" -f value) |
Gary Wu | 5f71741 | 2017-10-23 13:19:45 -0700 | [diff] [blame^] | 51 | echo "Deleting Stacks ${STACKS}" |
| 52 | openstack stack delete -y $STACKS |
Gary Wu | 874794d | 2017-10-13 12:27:39 -0700 | [diff] [blame] | 53 | |
| 54 | STACK="ete-$(uuidgen | cut -c-8)" |
Gary Wu | 99a7c1a | 2017-10-23 13:12:06 -0700 | [diff] [blame] | 55 | echo "New Stack Name: ${STACK}" |
Gary Wu | a770e64 | 2017-10-23 12:30:29 -0700 | [diff] [blame] | 56 | 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] | 57 | |