aboutsummaryrefslogtreecommitdiffstats
path: root/test/ete/scripts/deploy-onap.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/ete/scripts/deploy-onap.sh')
-rwxr-xr-xtest/ete/scripts/deploy-onap.sh87
1 files changed, 76 insertions, 11 deletions
diff --git a/test/ete/scripts/deploy-onap.sh b/test/ete/scripts/deploy-onap.sh
index 69296ab17..68ca34830 100755
--- a/test/ete/scripts/deploy-onap.sh
+++ b/test/ete/scripts/deploy-onap.sh
@@ -1,26 +1,91 @@
-#!/bin/bash
+#!/bin/bash -x
+
+if [ "$#" -ne 1 ]; then
+ echo "Usage: $0 <lab-name>"
+ exit 1
+fi
if [ -z "$WORKSPACE" ]; then
export WORKSPACE=`git rev-parse --show-toplevel`
fi
+LAB_DIR=${WORKSPACE}/test/ete/labs/$1
+
+if [ ! -d "$LAB_DIR" ]; then
+ echo "Directory $LAB_DIR not found"
+ exit 2
+fi
+
source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh
-# Delete all existing stacks
-STACKS=$(openstack stack list -c "Stack Name" -f value)
-if [ ! -z "${STACKS}" ]; then
- echo "Deleting Stacks ${STACKS}"
- openstack stack delete -y $STACKS
-else
- echo "No existing stacks to delete."
+
+SENTINEL='Docker versions and branches'
+
+mkdir -p ${LAB_DIR}/target
+YAML_FILE=${LAB_DIR}/target/onap_openstack.yaml
+ENV_FILE=${LAB_DIR}/target/onap_openstack.env
+YAML_SRC=${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.yaml
+ENV_SRC=${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.env
+
+# copy heat template to WORKSPACE
+cp ${YAML_SRC} ${YAML_FILE}
+
+# generate final env file
+pushd ${ONAP_WORKDIR}/demo
+envsubst < ${LAB_DIR}/onap-openstack-template.env | sed -n "1,/${SENTINEL}/p" > ${ENV_FILE}
+echo " # Rest of the file was AUTO-GENERATED from" | tee -a ${ENV_FILE}
+echo " #" $(git config --get remote.origin.url) heat/ONAP/onap_openstack.env $(git rev-parse HEAD) | tee -a ${ENV_FILE}
+popd
+sed "1,/${SENTINEL}/d" ${ENV_SRC} >> ${ENV_FILE}
+cat ${ENV_FILE}
+
+sdiff -w 180 ${ENV_SRC} ${ENV_FILE}
+
+# generate final heat template
+# add apt proxy to heat template if applicable
+if [ -x $LAB_DIR/apt-proxy.sh ]; then
+ $LAB_DIR/apt-proxy.sh ${YAML_FILE}
+ sdiff -w 180 ${YAML_SRC} ${YAML_FILE}
fi
+
+#exit 0
+
+#diff ${LAB_DIR}/onap-openstack-template.env ${LAB_DIR}/onap-openstack.env
+
+
+# tear down old deployment
+$WORKSPACE/test/ete/scripts/teardown-onap.sh
+
+# create new stack
STACK="ete-$(uuidgen | cut -c-8)"
echo "New Stack Name: ${STACK}"
+openstack stack create -t ${YAML_FILE} -e ${ENV_FILE} $STACK
+
+while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value $STACK)" ]; do
+ sleep 20
+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
-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
+ssh-keygen -R ${ROBOT_IP}
-openstack stack create -t ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.yaml -e ${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env $STACK
+SSH_KEY=~/.ssh/onap_key
+until ssh -o StrictHostKeychecking=no -i ${SSH_KEY} ubuntu@${ROBOT_IP} "sudo docker ps" | grep openecompete_container
+do
+ sleep 2m
+done