From a568e340a8fe1b4e34b221c04c4fd96f78738887 Mon Sep 17 00:00:00 2001 From: "Jingzhao.Ni" Date: Thu, 25 Jul 2019 19:21:47 +0800 Subject: [PATCH] Integrate the VM deployment tools into IEC For easy deployment on host, the Virtual-Machine automatic deployment tool was integrated into IEC project. Firstly, for supporting different arch platform, the compass4nfv project in OPNFV was used for deployment tools. Secondly, after VMs deployment, the IEC infrastructure will be deployed on those VMs without any user cases. Signed-off-by: Jingzhao.Ni Change-Id: I0b8d0a3e56a77bfa3aded76503e3f040d34de214 --- deploy/compass/deploy.sh | 8 +++++ deploy/compass/deployIEC.sh | 20 +++++++++++ deploy/compass/deployVM.sh | 86 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100755 deploy/compass/deploy.sh create mode 100755 deploy/compass/deployIEC.sh create mode 100755 deploy/compass/deployVM.sh diff --git a/deploy/compass/deploy.sh b/deploy/compass/deploy.sh new file mode 100755 index 0000000..d657f3d --- /dev/null +++ b/deploy/compass/deploy.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -ex +# deploy VMs +source ./deployVM.sh + +# install iec +source ./deployIEC.sh + diff --git a/deploy/compass/deployIEC.sh b/deploy/compass/deployIEC.sh new file mode 100755 index 0000000..509ce68 --- /dev/null +++ b/deploy/compass/deployIEC.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +sleep 10 +echo "Start IEC installation:" +rm -rf iec +rm -rf ~/.ssh/known_hosts + +git clone "https://gerrit.akraino.org/r/iec" + +cd iec/src/foundation/scripts + +sed -i.bak 's/10.169.36.152/10.1.0.50/g' ./config +sed -i "/^K8S_MASTERPW=/cK8S_MASTERPW=\"root\"" ./config +sed -i "/^HOST_USER=/cHOST_USER=\${HOST_USER:-root}" ./config +sed -i "s/10.169.40.106,123456/10.1.0.51,root/g" ./config +HOST_USER=root +export HOST_USER +./startup.sh + diff --git a/deploy/compass/deployVM.sh b/deploy/compass/deployVM.sh new file mode 100755 index 0000000..8276ae4 --- /dev/null +++ b/deploy/compass/deployVM.sh @@ -0,0 +1,86 @@ +#!/bin/bash +set -x + +# Building compass +build_compass(){ + echo "*** begin Compass4nfv build:" + + # Fix bug of getting IP address failure. + sed -i "s/inet addr:/inet /g" util/docker-compose/roles/compass/tasks/main.yml + sed -i "s/cut -d: -f2/cut -d ' ' -f10/g" util/docker-compose/roles/compass/tasks/main.yml + + if [ ${HOST_ARCH} = 'aarch64' ]; then + curl -s http://people.linaro.org/~yibo.cai/compass/compass4nfv-arm64-fixup.sh | bash || true + fi + + ./build.sh |& tee log1-Build.txt +} + +# Clear environments +clear_env(){ + + if [ -d "${WORKSPACE}/compass4nfv" ]; then + sudo rm -rf ${WORKSPACE}/compass4nfv + fi + + if [ -d "${WORKSPACE}/iec" ]; then + sudo rm -rf ${WORKSPACE}/iec + fi +} + +# Configure parameters of Arm VMs +config_arm(){ + # Remove the useless software list from software list( from line 28 to end). + sed -i '28,$d' deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml + export ADAPTER_OS_PATTERN='(?i)ubuntu-16.04.*arm.*' + export OS_VERSION="xenial" + export KUBERNETES_VERSION="v1.13.0" + + export DHA="deploy/conf/vm_environment/k8-nosdn-nofeature-noha.yml" + export NETWORK="deploy/conf/vm_environment/network.yml" + export VIRT_NUMBER=2 VIRT_CPUS=4 VIRT_MEM=4096 VIRT_DISK=50G +} + +# Configure parameters of x86 VMs +config_x86(){ + export NETWORK="deploy/conf/vm_environment/network.yml" + export DHA="/deploy/conf/vm_environment/os-nosdn-nofeature-noha.yml" + export OS_VERSION="xenial" + export TAR_URL="file://${INSTALLDIR}/work/building/compass.tar.gz" + + sed -i '44,$d' deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml + + sed -i '/export OPENSTACK_VERSION=queens/a export VIRT_NUMBER=2' deploy.sh +} + +echo "*** begin AUTO install: OPNFV Compass4nfv" + +# before starting, stop all the compass docker +sudo docker rm -f "$(sudo docker ps | grep compass | cut -f1 -d' ')" || true + +# shellcheck disable=SC2164 +WORKSPACE=$(cd "$(dirname "$0")";pwd) + +clear_env + +git clone https://gerrit.opnfv.org/gerrit/compass4nfv + +# prepare install directory +INSTALLDIR=${WORKSPACE}/compass4nfv +HOST_ARCH=$(uname -m) + +cd compass4nfv || exit + +# launch build script +build_compass + +# Configure parameters of VMs +if [ ${HOST_ARCH} = 'aarch64' ]; then + config_arm +else + config_x86 +fi + +# launch deploy script +echo "*** begin Compass4nfv deploy:" +./deploy.sh -- 2.16.6