Auto-generate docker versions and repo branches

Auto-generate the docker versions and repo branches using
the latest heat environment file from demo repo.

Change-Id: Ia00ec9f1c0bc59d0cdf9639e0d5ac5b13f9716c8
Issue-ID: INT-278
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
diff --git a/test/ete/labs/windriver/onap-openstack-template.env b/test/ete/labs/windriver/onap-openstack-template.env
index b18c9f1..6fc47ae 100644
--- a/test/ete/labs/windriver/onap-openstack-template.env
+++ b/test/ete/labs/windriver/onap-openstack-template.env
@@ -137,71 +137,6 @@
   ################################
   #                              #
   # Docker versions and branches #
+  # Rest of the file will be autogenerated from demo repo
   #                              #
   ################################
-
-  aai_branch: master
-  appc_branch: master
-  so_branch: master
-  mr_branch: master
-  policy_branch: master
-  portal_branch: release-1.3.0
-  robot_branch: master
-  sdc_branch: master
-  sdnc_branch: master
-  vid_branch: master
-  clamp_branch: master
-  vnfsdk_branch: master
-
-  aai_docker: v1.1.0
-  aai_sparky_docker: v1.0.0
-  appc_docker: v1.2.0
-  so_docker: v1.1.0
-  dcae_docker: v1.1.0
-  policy_docker: v1.1.1
-  portal_docker: v1.3.0
-  robot_docker: 1.1-STAGING-latest
-  sdc_docker: 1.1-STAGING-latest
-  sdnc_docker: 1.2-STAGING-latest
-  vid_docker: v1.1.0
-  clamp_docker: v1.1.0
-  msb_docker: 1.0.0
-  mvim_docker: latest
-  uui_docker: latest
-  esr_docker: v1.0.0
-  dgbuilder_docker: v0.1.0
-  cli_docker: v1.1.0
-
-  vfc_nokia_docker: 1.0.2-STAGING-latest
-  vfc_ztevmanagerdriver_docker: 1.0.2-STAGING-latest
-  vfc_ztesdncdriver_docker: 1.0.0-STAGING-latest
-  vfc_vnfres_docker: 1.0.1-STAGING-latest
-  vfc_vnfmgr_docker: 1.0.1-STAGING-latest
-  vfc_vnflcm_docker: 1.0.1-STAGING-latest
-  vfc_resmanagement_docker: 1.0.0-STAGING-latest
-  vfc_nslcm_docker: 1.0.2-STAGING-latest
-  vfc_huawei_docker: v1.0.0
-  vfc_jujudriver_docker: 1.0.0-STAGING-latest
-  vfc_gvnfmdriver_docker: 1.0.1-STAGING-latest
-  vfc_emsdriver_docker: 1.0.1-STAGING-latest
-  vfc_catalog_docker: 1.0.2-STAGING-latest
-  vfc_wfengine_mgrservice_docker: 1.0.0-STAGING-latest
-  vfc_wfengine_activiti_docker: 1.0.0-STAGING-latest
-
-  #####################
-  #                   #
-  # ONAP repositories #
-  #                   #
-  #####################
-  aai_repo: http://gerrit.onap.org/r/aai/test-config
-  appc_repo: http://gerrit.onap.org/r/appc/deployment.git
-  mr_repo: http://gerrit.onap.org/r/dcae/demo/startup/message-router.git 
-  so_repo: http://gerrit.onap.org/r/so/docker-config.git
-  policy_repo: http://gerrit.onap.org/r/policy/docker.git
-  portal_repo: http://gerrit.onap.org/r/portal.git
-  robot_repo: http://gerrit.onap.org/r/testsuite/properties.git
-  sdc_repo: http://gerrit.onap.org/r/sdc.git
-  sdnc_repo: http://gerrit.onap.org/r/sdnc/oam.git
-  vid_repo: http://gerrit.onap.org/r/vid.git
-  clamp_repo: http://gerrit.onap.org/r/clamp.git
-  vnfsdk_repo: http://gerrit.onap.org/r/vnfsdk/refrepo.git
diff --git a/test/ete/scripts/deploy-onap.sh b/test/ete/scripts/deploy-onap.sh
index 4802e02..9919fe7 100755
--- a/test/ete/scripts/deploy-onap.sh
+++ b/test/ete/scripts/deploy-onap.sh
@@ -28,14 +28,23 @@
 echo "New Stack Name: ${STACK}"
 
 
+SENTINEL='Docker versions and branches'
+ENV_FILE=${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env
 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
+envsubst < ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-template.env | sed -n "1,/${SENTINEL}/p" > ${ENV_FILE}
+pushd ${ONAP_WORKDIR}/demo
+echo "  # Rest of the file was AUTO-GENERATED from"
+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" ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.env >> ${ENV_FILE}
+cat ${ENV_FILE}
+
 #diff ${WORKSPACE}/test/ete/labs/windriver/onap-openstack-template.env ${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env
 
 openstack stack create -t ${ONAP_WORKDIR}/demo/heat/ONAP/onap_openstack.yaml -e ${WORKSPACE}/test/ete/labs/windriver/onap-openstack.env $STACK
 
 while [ "CREATE_IN_PROGRESS" == "$(openstack stack show -c stack_status -f value $STACK)" ]; do
-    sleep 15
+    sleep 20
 done
 
 STATUS=$(openstack stack show -c stack_status -f value $STACK)
@@ -59,5 +68,5 @@
 
 until ssh -o StrictHostKeychecking=no -i ${SSH_KEY} root@${ROBOT_IP} "docker ps | grep -q openecompete_container"
 do
-      sleep 1m
+      sleep 2m
 done