summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
authorAlex Yang <yangyang1@zte.com.cn>2017-08-03 11:48:13 +0800
committerAlex Yang <yangyang1@zte.com.cn>2017-08-03 19:28:52 +0800
commitbd241b3bdc1f7494cd8bb7fc120155c8b1cb305f (patch)
treef35c2ac5f9f88242ab67cc7d96905582a168e936 /ci
parente17dc35e2e445a7b7d52398a55d196cca8a680b3 (diff)
Use PDF(POD descriptor file) and correct the mapping of nodes and roles
JIRA: DAISY-42 JIRA: DAISY-56 In bare metal deployment, we can use PDF to get MAC addresses of nodes https://gerrit.opnfv.org/gerrit/#/c/38387/. Then we can use the MACs to help to distinguish the discovered nodes and assign roles to them, like virtual deployment in the link https://gerrit.opnfv.org/gerrit/#/c/38381/. Change-Id: Ib0f1a60b8935f528a828f716ccc916b767cfa6f9 Signed-off-by: Alex Yang <yangyang1@zte.com.cn>
Diffstat (limited to 'ci')
-rwxr-xr-xci/deploy/deploy.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/ci/deploy/deploy.sh b/ci/deploy/deploy.sh
index bfe0f6fa..a4f1e7a3 100755
--- a/ci/deploy/deploy.sh
+++ b/ci/deploy/deploy.sh
@@ -172,6 +172,40 @@ done
BMDEPLOY_DAISY_SERVER_NET=$WORKSPACE/templates/physical_environment/networks/daisy.xml
BMDEPLOY_DAISY_SERVER_VM=$WORKSPACE/templates/physical_environment/vms/daisy.xml
+function update_dha_by_pdf()
+{
+ local pdf_yaml=securedlab/labs/$LAB_NAME/${POD_NAME}.yaml
+ local jinja2_template=securedlab/installers/daisy/pod_config.yaml.j2
+ local generate_config=securedlab/utils/generate_config.py
+ if [ ! -f ${generate_config} ] || [ ! -f ${pdf_yaml} ] || [ ! -f ${jinja2_template} ]; then
+ return
+ fi
+
+ local tmpfile=$(mktemp XXXXXXXX.yml)
+ python ${generate_config} -j ${jinja2_template} -y ${pdf_yaml} > ${tmpfile}
+ if [ $? -ne 0 ]; then
+ echo "Cannot generate config from POD Descriptor File, use original deploy.yml !"
+ return
+ fi
+ if [ -z $(awk "BEGIN{}(/daisy_ip/){print NR}" $tmpfile) ]; then
+ line=$(awk "BEGIN{}(/daisy_gateway/){print NR}" $tmpfile)
+ sed -i "${line}b\daisy_ip: $INSTALLER_IP" $tmpfile
+ fi
+ if [ $? -ne 0 ]; then
+ echo "Cannot write INSTALLER_IP to config file, use original deploy.yml !"
+ return
+ fi
+ cp ${tmpfile} ${DHA_CONF}
+ echo "====== Update deploy.yml from POD Descriptor File ======"
+ rm -f $tmpfile
+}
+
+if [[ ! -z $INSTALLER_IP ]]; then
+ pushd ${WORKSPACE}
+ update_dha_by_pdf
+ popd
+fi
+
PARAS_FROM_DEPLOY=`python $WORKSPACE/deploy/get_conf.py --dha $DHA_CONF`
TARGET_HOSTS_NUM=`echo $PARAS_FROM_DEPLOY | cut -d " " -f 1`
DAISY_IP=`echo $PARAS_FROM_DEPLOY | cut -d " " -f 2`