Moshe | 0bb532c | 2018-02-26 13:39:57 +0200 | [diff] [blame] | 1 | #!/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 |
| 19 | DOCKER_ARCH="$(uname -m)" |
| 20 | |
| 21 | UBUNTU_PORTS_URL="http://ports.ubuntu.com/ubuntu-ports/" |
| 22 | UBUNTU_ARCHIVE_URL="http://archive.ubuntu.com/ubuntu/" |
| 23 | |
| 24 | source /etc/os-release |
| 25 | source_file=/etc/apt/sources.list |
Moshe | 0bb532c | 2018-02-26 13:39:57 +0200 | [diff] [blame] | 26 | |
| 27 | if [[ "${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 |
| 34 | else |
| 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 |
| 41 | fi |
| 42 | |
| 43 | sed -i -e 's/^deb-src /# deb-src /g' "${source_file}" |
| 44 | |
| 45 | VERSION_CODENAME=${VERSION_CODENAME:-trusty} |
| 46 | |
| 47 | echo "APT::Default-Release \""${VERSION_CODENAME}"\";" > /etc/apt/apt.conf.d/default-distro |
| 48 | |
| 49 | sub_source_file=/etc/apt/sources.list.d/vnftest.list |
| 50 | touch "${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 |
| 54 | if [[ "${VERSION_CODENAME}" != "xenial" ]]; then |
| 55 | REPO_UPDATE="deb [arch="${DOCKER_ARCH}"] "${DOCKER_REPO}" xenial-updates universe" |
| 56 | fi |
| 57 | |
| 58 | echo -e ""${REPO_UPDATE}" |
| 59 | deb [arch="${EXTRA_ARCH}"] "${EXTRA_REPO}" "${VERSION_CODENAME}" main universe multiverse restricted |
| 60 | deb [arch="${EXTRA_ARCH}"] "${EXTRA_REPO}" "${VERSION_CODENAME}"-updates main universe multiverse restricted |
| 61 | deb [arch="${EXTRA_ARCH}"] "${EXTRA_REPO}" "${VERSION_CODENAME}"-security main universe multiverse restricted |
| 62 | deb [arch="${EXTRA_ARCH}"] "${EXTRA_REPO}" "${VERSION_CODENAME}"-proposed main universe multiverse restricted" > "${sub_source_file}" |
| 63 | |
| 64 | echo "vm.mmap_min_addr = 0" > /etc/sysctl.d/mmap_min_addr.conf |
| 65 | |
| 66 | # install tools |
| 67 | apt-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 \ |
Moshe | 0bb532c | 2018-02-26 13:39:57 +0200 | [diff] [blame] | 84 | supervisor \ |
| 85 | python-pip \ |
| 86 | vim \ |
| 87 | libxft-dev \ |
| 88 | libxss-dev \ |
| 89 | sudo \ |
| 90 | iputils-ping |
| 91 | |
| 92 | if [[ "${DOCKER_ARCH}" != "aarch64" ]]; then |
| 93 | apt-get install -y libc6:arm64 |
| 94 | fi |
| 95 | |
| 96 | apt-get -y autoremove && apt-get clean |
| 97 | |
| 98 | git config --global http.sslVerify false |
| 99 | |
Moshe | 5e5e493 | 2018-08-15 12:19:07 +0300 | [diff] [blame] | 100 | mkdir -p /etc/vnftest |
| 101 | cp "${PWD}/etc/vnftest/vnftest.yaml" /etc/vnftest |
Moshe | 0bb532c | 2018-02-26 13:39:57 +0200 | [diff] [blame] | 102 | # install vnftest + dependencies |
| 103 | easy_install -U pip |
| 104 | pip install -r requirements.txt |
Moshe | fc9a834 | 2018-07-04 09:10:44 +0300 | [diff] [blame] | 105 | pip install . |