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
22 SO_ENCRYPTION_KEY=aa3871669d893c7fb8abbcda31b88b4f
23 export OS_PASSWORD_ENCRYPTED=$(echo -n "$OS_PASSWORD" | openssl aes-128-ecb -e -K "$SO_ENCRYPTION_KEY" -nosalt | xxd -c 256 -p)
25 DEMO_DIR=${ONAP_WORKDIR}/demo
26 if [ "$#" -ge 2 ]; then
30 SENTINEL='Docker versions and branches'
32 mkdir -p ${LAB_DIR}/target
33 rsync -avt $DEMO_DIR/heat/ONAP/ ${LAB_DIR}/target/
34 YAML_FILE=${LAB_DIR}/target/onap_openstack.yaml
35 ENV_FILE=${LAB_DIR}/target/onap_openstack.env
36 YAML_SRC=${DEMO_DIR}/heat/ONAP/onap_openstack.yaml
37 ENV_SRC=${DEMO_DIR}/heat/ONAP/onap_openstack.env
39 # copy heat template to WORKSPACE
40 cp ${YAML_SRC} ${YAML_FILE}
42 # generate final env file
44 envsubst < ${LAB_DIR}/onap-openstack-template.env | sed -n "1,/${SENTINEL}/p" > ${ENV_FILE}
45 echo " # Rest of the file was AUTO-GENERATED from" | tee -a ${ENV_FILE}
46 echo " #" $(git config --get remote.origin.url) heat/ONAP/onap_openstack.env $(git rev-parse HEAD) | tee -a ${ENV_FILE}
48 sed "1,/${SENTINEL}/d" ${ENV_SRC} >> ${ENV_FILE}
51 diff ${ENV_SRC} ${ENV_FILE}
53 # generate final heat template
54 # add apt proxy to heat template if applicable
55 if [ -x $LAB_DIR/apt-proxy.sh ]; then
56 $LAB_DIR/apt-proxy.sh ${YAML_FILE}
57 diff ${YAML_SRC} ${YAML_FILE}
63 #diff ${LAB_DIR}/onap-openstack-template.env ${LAB_DIR}/onap-openstack.env
66 # tear down old deployment
67 $WORKSPACE/test/ete/scripts/teardown-onap.sh -q
70 STACK="onap-heat-$(uuidgen | cut -c-4)"
71 echo "New Stack Name: ${STACK}"
72 if ! openstack stack create -t ${YAML_FILE} -e ${ENV_FILE} $STACK; then
76 while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value $STACK)" ]; do
80 STATUS=$(openstack stack show -c stack_status -f value $STACK)
82 if [ "CREATE_COMPLETE" != "$STATUS" ]; then
87 # wait until Robot VM initializes
88 ROBOT_IP=$($WORKSPACE/test/ete/scripts/get-floating-ip.sh onap-robot)
89 echo "ROBOT_IP=${ROBOT_IP}"
91 if [ "" == "${ROBOT_IP}" ]; then
95 ssh-keygen -R ${ROBOT_IP}
97 SSH_KEY=~/.ssh/onap_key
99 for n in $(seq 1 10); do
100 ssh -o StrictHostKeychecking=no -i ${SSH_KEY} ubuntu@${ROBOT_IP} "sudo docker ps" | grep openecompete_container
102 if [ $RESULT -eq 0 ]; then