blob: 7de4b9a963a2aad3ee204169ff283e435dbc660e [file] [log] [blame]
Moshe0bb532c2018-02-26 13:39:57 +02001#!/bin/bash
2##############################################################################
3# Copyright 2018 EuropeanSoftwareMarketingLtd.
4# ===================================================================
5# Licensed under the ApacheLicense, Version2.0 (the"License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# software distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and limitations under
13# the License
14##############################################################################
15# vnftest comment: this is a modified copy of
16# yardstick/install.sh
17
18# fit for arm64
19DOCKER_ARCH="$(uname -m)"
20
21UBUNTU_PORTS_URL="http://ports.ubuntu.com/ubuntu-ports/"
22UBUNTU_ARCHIVE_URL="http://archive.ubuntu.com/ubuntu/"
23
24source /etc/os-release
25source_file=/etc/apt/sources.list
Moshe0bb532c2018-02-26 13:39:57 +020026
27if [[ "${DOCKER_ARCH}" == "aarch64" ]]; then
28 sed -i -e 's/^deb \([^/[]\)/deb [arch=arm64] \1/g' "${source_file}"
29 DOCKER_ARCH="arm64"
30 DOCKER_REPO="${UBUNTU_PORTS_URL}"
31 EXTRA_ARCH="amd64"
32 EXTRA_REPO="${UBUNTU_ARCHIVE_URL}"
33 dpkg --add-architecture amd64
34else
35 sed -i -e 's/^deb \([^/[]\)/deb [arch=amd64] \1/g' "${source_file}"
36 DOCKER_ARCH="amd64"
37 DOCKER_REPO="${UBUNTU_ARCHIVE_URL}"
38 EXTRA_ARCH="arm64"
39 EXTRA_REPO="${UBUNTU_PORTS_URL}"
40 dpkg --add-architecture arm64
41fi
42
43sed -i -e 's/^deb-src /# deb-src /g' "${source_file}"
44
45VERSION_CODENAME=${VERSION_CODENAME:-trusty}
46
47echo "APT::Default-Release \""${VERSION_CODENAME}"\";" > /etc/apt/apt.conf.d/default-distro
48
49sub_source_file=/etc/apt/sources.list.d/vnftest.list
50touch "${sub_source_file}"
51
52# first add xenial repo needed for installing qemu_static_user/xenial in the container
53# then add complementary architecture repositories in case the cloud image is of different arch
54if [[ "${VERSION_CODENAME}" != "xenial" ]]; then
55 REPO_UPDATE="deb [arch="${DOCKER_ARCH}"] "${DOCKER_REPO}" xenial-updates universe"
56fi
57
58echo -e ""${REPO_UPDATE}"
59deb [arch="${EXTRA_ARCH}"] "${EXTRA_REPO}" "${VERSION_CODENAME}" main universe multiverse restricted
60deb [arch="${EXTRA_ARCH}"] "${EXTRA_REPO}" "${VERSION_CODENAME}"-updates main universe multiverse restricted
61deb [arch="${EXTRA_ARCH}"] "${EXTRA_REPO}" "${VERSION_CODENAME}"-security main universe multiverse restricted
62deb [arch="${EXTRA_ARCH}"] "${EXTRA_REPO}" "${VERSION_CODENAME}"-proposed main universe multiverse restricted" > "${sub_source_file}"
63
64echo "vm.mmap_min_addr = 0" > /etc/sysctl.d/mmap_min_addr.conf
65
66# install tools
67apt-get update && apt-get install -y \
68 qemu-user-static/xenial \
69 bonnie++ \
70 wget \
71 expect \
72 curl \
73 git \
74 sshpass \
75 qemu-utils \
76 kpartx \
77 libffi-dev \
78 libssl-dev \
79 libzmq-dev \
80 python \
81 python-dev \
82 libxml2-dev \
83 libxslt1-dev \
Moshe0bb532c2018-02-26 13:39:57 +020084 supervisor \
85 python-pip \
86 vim \
87 libxft-dev \
88 libxss-dev \
89 sudo \
90 iputils-ping
91
92if [[ "${DOCKER_ARCH}" != "aarch64" ]]; then
93 apt-get install -y libc6:arm64
94fi
95
96apt-get -y autoremove && apt-get clean
97
98git config --global http.sslVerify false
99
Moshe5e5e4932018-08-15 12:19:07 +0300100mkdir -p /etc/vnftest
101cp "${PWD}/etc/vnftest/vnftest.yaml" /etc/vnftest
Moshe0bb532c2018-02-26 13:39:57 +0200102# install vnftest + dependencies
103easy_install -U pip
104pip install -r requirements.txt
Moshefc9a8342018-07-04 09:10:44 +0300105pip install .