Add a service access latency measurement tool
[iec.git] / deploy / compass / deployVM.sh
1 #!/bin/bash
2 set -x
3
4 # Building compass
5 build_compass(){
6   echo "*** begin Compass4nfv build:"
7
8   # Fix docker-compose -> requests version mismatch with other
9   # Akraino CI jobs (installed requests should be >= 2.12)
10   sed -i "s/\(docker-compose\)==1.14.0/\1==1.24.1/g" deploy/prepare.sh
11
12   # Fix bug of getting IP address failure.
13   sed -i "s/inet addr:/inet /g" util/docker-compose/roles/compass/tasks/main.yml
14   sed -i "s/cut -d: -f2/cut -d ' ' -f10/g" util/docker-compose/roles/compass/tasks/main.yml
15
16   if [ ${HOST_ARCH} = 'aarch64' ]; then
17     curl -s http://people.linaro.org/~yibo.cai/compass/compass4nfv-arm64-fixup.sh | bash || true
18   fi
19
20   ./build.sh |& tee log1-Build.txt
21 }
22
23 # Clear environments
24 clear_env(){
25
26   if [ -d "${WORKSPACE}/compass4nfv" ]; then
27     sudo rm -rf ${WORKSPACE}/compass4nfv
28   fi
29
30   if [ -d "${WORKSPACE}/iec" ]; then
31     sudo rm -rf ${WORKSPACE}/iec
32   fi
33 }
34
35 # Configure parameters of Arm VMs
36 config_arm(){
37   # Remove the useless software list from software list( from line 28 to end).
38   sed -i '28,$d' deploy/adapters/ansible/kubernetes/ansible-kubernetes.yml
39   export ADAPTER_OS_PATTERN='(?i)ubuntu-16.04.*arm.*'
40   export OS_VERSION="xenial"
41   export KUBERNETES_VERSION="v1.13.0"
42
43   export DHA="deploy/conf/vm_environment/k8-nosdn-nofeature-noha.yml"
44   export NETWORK="deploy/conf/vm_environment/network.yml"
45   export VIRT_NUMBER=2 VIRT_CPUS=4 VIRT_MEM=4096 VIRT_DISK=50G
46 }
47
48 # Configure parameters of x86 VMs
49 config_x86(){
50   export NETWORK="deploy/conf/vm_environment/network.yml"
51   export DHA="/deploy/conf/vm_environment/os-nosdn-nofeature-noha.yml"
52   export OS_VERSION="xenial"
53   export TAR_URL="file://${INSTALLDIR}/work/building/compass.tar.gz"
54
55   sed -i '44,$d' deploy/adapters/ansible/openstack/HA-ansible-multinodes.yml
56
57   sed -i '/export OPENSTACK_VERSION=queens/a export VIRT_NUMBER=2' deploy.sh
58 }
59
60 echo "*** begin AUTO install: OPNFV Compass4nfv"
61
62 # before starting, stop all the compass docker
63 sudo docker rm -f "$(sudo docker ps | grep compass | cut -f1 -d' ')" || true
64
65 # shellcheck disable=SC2164
66 WORKSPACE=$(cd "$(dirname "$0")";pwd)
67
68 clear_env
69
70 git clone https://gerrit.opnfv.org/gerrit/compass4nfv
71
72 # prepare install directory
73 INSTALLDIR=${WORKSPACE}/compass4nfv
74 HOST_ARCH=$(uname -m)
75
76 cd compass4nfv || exit
77
78 # launch build script
79 build_compass
80
81 # Configure parameters of VMs
82 if [ ${HOST_ARCH} = 'aarch64' ]; then
83   config_arm
84 else
85   config_x86
86 fi
87
88 # launch deploy script
89 echo "*** begin Compass4nfv deploy:"
90 ./deploy.sh