blob: d90adbf912b4c278183b18380258c1337aa913d6 [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/tools/vsperf-img-modify.sh
17
18# installs required packages
19# must be run from inside the image (either chrooted or running)
20
21set -ex
22
23if [ $# -eq 1 ]; then
24 nameserver_ip=$1
25
26 # /etc/resolv.conf is a symbolic link to /run, restore at end
27 rm /etc/resolv.conf
28 echo "nameserver $nameserver_ip" > /etc/resolv.conf
29 echo "nameserver 8.8.8.8" >> /etc/resolv.conf
30 echo "nameserver 8.8.4.4" >> /etc/resolv.conf
31fi
32
33# Force apt to use ipv4 due to build problems on LF POD.
34echo 'Acquire::ForceIPv4 "true";' > /etc/apt/apt.conf.d/99force-ipv4
35
36echo 'GRUB_CMDLINE_LINUX="resume=/dev/sda1 default_hugepagesz=1G hugepagesz=1G hugepages=32 iommu=on iommu=pt intel_iommu=on"' >> /etc/default/grub
37
38# Add hostname to /etc/hosts.
39# Allow console access via pwd
40cat <<EOF >/etc/cloud/cloud.cfg.d/10_etc_hosts.cfg
41manage_etc_hosts: True
42password: ubuntu
43chpasswd: { expire: False }
44ssh_pwauth: True
45EOF
46
47linuxheadersversion=`echo ls boot/vmlinuz* | cut -d- -f2-`
48
49apt-get update
50apt-get install -y \
51 linux-headers-$linuxheadersversion \
52 screen \
53 locate \
54 sshpass \
55 git
56
57cd /root
58git clone -b stable/danube https://gerrit.onap.org/gerrit/vswitchperf
59
60# do not compile ovs and qemu
61sed -i.bak -e 's/^\(SUBBUILDS\ =\ src_vanilla\)/#\1/' \
62 -e 's/^\(SUBDIRS\ += ovs.*\)/#\1/' \
63 -e 's/^\(SUBDIRS\ += qemu.*\)/#\1/' \
64 vswitchperf/src/Makefile
65# If these paths do not exist, vsperf wont start
66mkdir -p /root/vswitchperf/src/ovs/ovs/ovsdb/
67touch /root/vswitchperf/src/ovs/ovs/ovsdb/ovsdb-tool
68touch /root/vswitchperf/src/ovs/ovs/ovsdb/ovsdb-server
69mkdir -p /root/vswitchperf/src/qemu/qemu/x86_64-softmmu/
70touch /root/vswitchperf/src/qemu/qemu/x86_64-softmmu/qemu-system-x86_64
71mkdir -p /root/vswitchperf/src/ovs/ovs/utilities/
72touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-dpctl
73touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-vsctl
74touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-ofctl
75touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-appctl
76mkdir -p /root/vswitchperf/src/ovs/ovs/vswitchd/
77touch /root/vswitchperf/src/ovs/ovs/vswitchd/vswitch.ovsschema
78touch /root/vswitchperf/src/ovs/ovs/vswitchd/ovs-vswitchd
79
80# restore symlink
81#ln -sf /run/resolvconf/resolv.conf /etc/resolv.conf