3 if [ "$#" -lt 1 ]; then
4 echo "Usage: $0 <lab-name> [<demo repo directory>]"
9 if [ -z "$WORKSPACE" ]; then
10 export WORKSPACE=`git rev-parse --show-toplevel`
13 LAB_DIR=${WORKSPACE}/test/ete/labs/$1
15 if [ ! -d "$LAB_DIR" ]; then
16 echo "Directory $LAB_DIR not found"
20 source $WORKSPACE/test/ete/scripts/install_openstack_cli.sh
23 DEMO_DIR=${ONAP_WORKDIR}/demo
24 if [ "$#" -ge 2 ]; then
28 SENTINEL='Docker versions and branches'
30 mkdir -p ${LAB_DIR}/target
31 rsync -avt $DEMO_DIR/heat/ONAP/ ${LAB_DIR}/target/
32 YAML_FILE=${LAB_DIR}/target/onap_openstack.yaml
33 ENV_FILE=${LAB_DIR}/target/onap_openstack.env
34 YAML_SRC=${DEMO_DIR}/heat/ONAP/onap_openstack.yaml
35 ENV_SRC=${DEMO_DIR}/heat/ONAP/onap_openstack.env
37 # copy heat template to WORKSPACE
38 cp ${YAML_SRC} ${YAML_FILE}
40 # generate final env file
42 envsubst < ${LAB_DIR}/onap-openstack-template.env | sed -n "1,/${SENTINEL}/p" > ${ENV_FILE}
43 echo " # Rest of the file was AUTO-GENERATED from" | tee -a ${ENV_FILE}
44 echo " #" $(git config --get remote.origin.url) heat/ONAP/onap_openstack.env $(git rev-parse HEAD) | tee -a ${ENV_FILE}
46 sed "1,/${SENTINEL}/d" ${ENV_SRC} >> ${ENV_FILE}
49 diff ${ENV_SRC} ${ENV_FILE}
51 # generate final heat template
52 # add apt proxy to heat template if applicable
53 if [ -x $LAB_DIR/apt-proxy.sh ]; then
54 $LAB_DIR/apt-proxy.sh ${YAML_FILE}
55 diff ${YAML_SRC} ${YAML_FILE}
61 #diff ${LAB_DIR}/onap-openstack-template.env ${LAB_DIR}/onap-openstack.env
64 # tear down old deployment
65 $WORKSPACE/test/ete/scripts/teardown-onap.sh
68 STACK="onap-heat-$(uuidgen | cut -c-4)"
69 echo "New Stack Name: ${STACK}"
70 if ! openstack stack create -t ${YAML_FILE} -e ${ENV_FILE} $STACK; then
74 while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value $STACK)" ]; do
78 STATUS=$(openstack stack show -c stack_status -f value $STACK)
80 if [ "CREATE_COMPLETE" != "$STATUS" ]; then
85 # wait until Robot VM initializes
86 ROBOT_IP=$($WORKSPACE/test/ete/scripts/get-floating-ip.sh onap-robot)
87 echo "ROBOT_IP=${ROBOT_IP}"
89 if [ "" == "${ROBOT_IP}" ]; then
93 ssh-keygen -R ${ROBOT_IP}
95 SSH_KEY=~/.ssh/onap_key
97 for n in $(seq 1 10); do
98 ssh -o StrictHostKeychecking=no -i ${SSH_KEY} ubuntu@${ROBOT_IP} "sudo docker ps" | grep openecompete_container
100 if [ $RESULT -eq 0 ]; then