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 mkdir -p ${LAB_DIR}/target
25 YAML_FILE=${LAB_DIR}/target/onap_openstack.yaml
26 ENV_FILE=${LAB_DIR}/target/onap_openstack.env
27 YAML_SRC=${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.yaml
28 ENV_SRC=${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.env
30 # copy heat template to WORKSPACE
31 cp ${YAML_SRC} ${YAML_FILE}
33 # generate final env file
34 pushd ${ONAP_WORKDIR}/demo
35 envsubst < ${LAB_DIR}/onap-openstack-template.env | sed -n "1,/${SENTINEL}/p" > ${ENV_FILE}
36 echo " # Rest of the file was AUTO-GENERATED from" | tee -a ${ENV_FILE}
37 echo " #" $(git config --get remote.origin.url) heat/ONAP/onap_openstack.env $(git rev-parse HEAD) | tee -a ${ENV_FILE}
39 sed "1,/${SENTINEL}/d" ${ENV_SRC} >> ${ENV_FILE}
42 sdiff -w 180 ${ENV_SRC} ${ENV_FILE}
44 # generate final heat template
45 # add apt proxy to heat template if applicable
46 if [ -x $LAB_DIR/apt-proxy.sh ]; then
47 $LAB_DIR/apt-proxy.sh ${YAML_FILE}
48 sdiff -w 180 ${YAML_SRC} ${YAML_FILE}
54 #diff ${LAB_DIR}/onap-openstack-template.env ${LAB_DIR}/onap-openstack.env
57 # tear down old deployment
58 $WORKSPACE/test/ete/scripts/teardown-onap.sh
61 STACK="ete-$(uuidgen | cut -c-8)"
62 echo "New Stack Name: ${STACK}"
63 openstack stack create -t ${YAML_FILE} -e ${ENV_FILE} $STACK
65 while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value $STACK)" ]; do
69 STATUS=$(openstack stack show -c stack_status -f value $STACK)
71 if [ "CREATE_COMPLETE" != "$STATUS" ]; then
76 # wait until Robot VM initializes
77 ROBOT_IP=$($WORKSPACE/test/ete/scripts/get-floating-ip.sh onap-robot)
78 echo "ROBOT_IP=${ROBOT_IP}"
80 if [ "" == "${ROBOT_IP}" ]; then
84 ssh-keygen -R ${ROBOT_IP}
86 SSH_KEY=~/.ssh/onap_key
88 until ssh -o StrictHostKeychecking=no -i ${SSH_KEY} root@${ROBOT_IP} "docker ps | grep -q openecompete_container"