3 if [ "$#" -ne 1 ]; then
4 echo "Usage: $0 <lab-name>"
8 if [ -z "$WORKSPACE" ]; then
9 export WORKSPACE=`git rev-parse --show-toplevel`
12 LAB_DIR=${WORKSPACE}/test/ete/labs/$1
14 if [ ! -d "$LAB_DIR" ]; then
15 echo "Directory $LAB_DIR not found"
19 source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh
22 SENTINEL='Docker versions and branches'
24 YAML_FILE=${LAB_DIR}/onap_openstack.yaml
25 ENV_FILE=${LAB_DIR}/onap-openstack.env
27 # copy heat template to WORKSPACE
28 cp ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.yaml ${YAML_FILE}
30 # generate final env file
31 pushd ${ONAP_WORKDIR}/demo
32 cp ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.env ${LAB_DIR}/onap-openstack-demo.env
33 envsubst < ${LAB_DIR}/onap-openstack-template.env | sed -n "1,/${SENTINEL}/p" > ${ENV_FILE}
34 echo " # Rest of the file was AUTO-GENERATED from" | tee -a ${ENV_FILE}
35 echo " #" $(git config --get remote.origin.url) heat/ONAP/onap_openstack.env $(git rev-parse HEAD) | tee -a ${ENV_FILE}
37 sed "1,/${SENTINEL}/d" ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.env >> ${ENV_FILE}
40 # generate final heat template
41 # add apt proxy to heat template if applicable
42 if [ -x $LAB_DIR/apt-proxy.sh ]; then
43 $LAB_DIR/apt-proxy.sh ${YAML_FILE}
44 diff ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.yaml ${YAML_FILE}
50 #diff ${LAB_DIR}/onap-openstack-template.env ${LAB_DIR}/onap-openstack.env
53 # tear down old deployment
54 $WORKSPACE/test/ete/scripts/teardown-onap.sh
57 STACK="ete-$(uuidgen | cut -c-8)"
58 echo "New Stack Name: ${STACK}"
59 openstack stack create -t ${YAML_FILE} -e ${LAB_DIR}/onap-openstack.env $STACK
61 while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value $STACK)" ]; do
65 STATUS=$(openstack stack show -c stack_status -f value $STACK)
67 if [ "CREATE_COMPLETE" != "$STATUS" ]; then
72 # wait until Robot VM initializes
73 ROBOT_IP=$($WORKSPACE/test/ete/scripts/get-floating-ip.sh onap-robot)
74 echo "ROBOT_IP=${ROBOT_IP}"
76 if [ "" == "${ROBOT_IP}" ]; then
80 ssh-keygen -R ${ROBOT_IP}
82 SSH_KEY=~/.ssh/onap_key
84 until ssh -o StrictHostKeychecking=no -i ${SSH_KEY} root@${ROBOT_IP} "docker ps | grep -q openecompete_container"