From 36e4b9754dedef27637c09b510829f686bd469e4 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sat, 16 Sep 2017 21:13:11 +0200 Subject: PDF parsing support - add new git submodule pointing to OPNFV Pharos; - use Pharos 'generate_config.sh' to parse the PDF using the Fuel installer adapter and generate dynamically; - build outside current git repo and sync separately to prevent sensitive data leak; - add PDF sample based on LF-POD2, should be used with 'ci/deploy.sh -l local -p pod1'; Change-Id: I4e1b95f180bcd5ade5d86f516628eb8edbe64b1c Signed-off-by: Alexandru Avadanii --- ci/deploy.sh | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) (limited to 'ci') diff --git a/ci/deploy.sh b/ci/deploy.sh index f6af1b57a..dc5f77427 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -61,8 +61,11 @@ It depends on the OPNFV official configuration directory/file structure and provides a fairly simple mechanism to execute a deployment. $(notify "Input parameters to the build script are:" 2) --b Base URI to the configuration directory (needs to be provided in a URI - style, it can be a local resource: file:// or a remote resource http(s)://) +-b Base URI to the configuration directory (needs to be provided in URI style, + it can be a local resource: file:// or a remote resource http(s)://). + A POD Descriptor File (PDF) should be available at: + /labs//.yaml + The default is './mcp/config'. -B Bridges to be used by deploy script. It can be specified several times, or as a comma separated list of bridges, or both: -B br1 -B br2,br3 First occurence sets PXE Brige, next Mgmt, then Internal and Public. @@ -77,7 +80,7 @@ $(notify "Input parameters to the build script are:" 2) -h Print this message and exit -L Deployment log path and name, eg. -L /home/jenkins/job.log.tar.gz -l Lab name as defined in the configuration directory, e.g. lf --p POD name as defined in the configuration directory, e.g. pod-1 +-p POD name as defined in the configuration directory, e.g. pod2 -s Deployment-scenario, this points to a short deployment scenario name, which has to be defined in config directory (e.g. os-odl-nofeature-ha). -S Storage dir for VM images, default is mcp/deploy/images @@ -97,7 +100,7 @@ $(notify "[NOTE] sudo & virsh priviledges are needed for this script to run" 3) Example: $(notify "sudo $(basename "$0") \\ - -b file:///home/jenkins/lab-config \\ + -b file:///home/jenkins/securedlab \\ -l lf -p pod2 \\ -s os-odl-nofeature-ha" 2) EOF @@ -132,13 +135,14 @@ clean() { ############################################################################## # BEGIN of variables to customize # -SCRIPT_PATH=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")") -DEPLOY_DIR=$(cd "${SCRIPT_PATH}/../mcp/scripts"; pwd) -STORAGE_DIR=$(cd "${SCRIPT_PATH}/../mcp/deploy/images"; pwd) -RECLASS_CLUSTER_DIR=$(cd "${SCRIPT_PATH}/../mcp/reclass/classes/cluster"; pwd) +REPO_ROOT_PATH=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")/..") +DEPLOY_DIR=$(cd "${REPO_ROOT_PATH}/mcp/scripts"; pwd) +STORAGE_DIR=$(cd "${REPO_ROOT_PATH}/mcp/deploy/images"; pwd) +RECLASS_CLUSTER_DIR=$(cd "${REPO_ROOT_PATH}/mcp/reclass/classes/cluster"; pwd) DEPLOY_TYPE='baremetal' OPNFV_BRIDGES=('pxebr' 'mgmt' 'internal' 'public') URI_REGEXP='(file|https?|ftp)://.*' +BASE_CONFIG_URI="file://${REPO_ROOT_PATH}/mcp/config" export SSH_KEY=${SSH_KEY:-"/var/lib/opnfv/mcp.rsa"} export SALT_MASTER=${INSTALLER_IP:-10.20.0.2} @@ -300,6 +304,28 @@ if [ "$(uname -i)" = "aarch64" ]; then [ -n "$(command -v yum)" ] && sudo yum install -y --skip-broken vgabios fi +# Clone git submodules and apply our patches +make -C "${REPO_ROOT_PATH}/mcp/patches" deepclean patches-import + +# Convert Pharos-compatible POD Descriptor File (PDF) to reclass model input +PHAROS_GEN_CONFIG_SCRIPT="./pharos/config/utils/generate_config.py" +PHAROS_INSTALLER_ADAPTER="./pharos/config/installers/fuel/pod_config.yml.j2" +BASE_CONFIG_PDF="${BASE_CONFIG_URI}/labs/${TARGET_LAB}/${TARGET_POD}.yaml" +LOCAL_PDF="${STORAGE_DIR}/$(basename "${BASE_CONFIG_PDF}")" +LOCAL_PDF_RECLASS="${STORAGE_DIR}/pod_config.yml" +if ! curl --create-dirs -o "${LOCAL_PDF}" "${BASE_CONFIG_PDF}"; then + if [ "${DEPLOY_TYPE}" = 'baremetal' ]; then + notify "[ERROR] Could not retrieve PDF (Pod Descriptor File)!\n" 1>&2 + exit 1 + else + notify "[WARN] Could not retrieve PDF (Pod Descriptor File)!\n" 3 + fi +elif ! "${PHAROS_GEN_CONFIG_SCRIPT}" -y "${LOCAL_PDF}" \ + -j "${PHAROS_INSTALLER_ADAPTER}" > "${LOCAL_PDF_RECLASS}"; then + notify "[ERROR] Could not convert PDF to reclass model input!\n" 1>&2 + exit 1 +fi + # Check scenario file existence SCENARIO_DIR="../config/scenario" if [ ! -f "${SCENARIO_DIR}/${DEPLOY_TYPE}/${DEPLOY_SCENARIO}.yaml" ]; then @@ -342,12 +368,12 @@ generate_ssh_key prepare_vms virtual_nodes "${base_image}" "${STORAGE_DIR}" create_networks OPNFV_BRIDGES create_vms virtual_nodes virtual_nodes_ram virtual_nodes_vcpus \ - OPNFV_BRIDGES "${STORAGE_DIR}" + OPNFV_BRIDGES "${STORAGE_DIR}" update_mcpcontrol_network start_vms virtual_nodes check_connection -./salt.sh +./salt.sh "${LOCAL_PDF_RECLASS}" # Openstack cluster setup for state in "${cluster_states[@]}"; do -- cgit 1.2.3-korg