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/tools/vsperf-img-modify.sh |
| 17 | |
| 18 | # installs required packages |
| 19 | # must be run from inside the image (either chrooted or running) |
| 20 | |
| 21 | set -ex |
| 22 | |
| 23 | if [ $# -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 |
| 31 | fi |
| 32 | |
| 33 | # Force apt to use ipv4 due to build problems on LF POD. |
| 34 | echo 'Acquire::ForceIPv4 "true";' > /etc/apt/apt.conf.d/99force-ipv4 |
| 35 | |
| 36 | echo '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 |
| 40 | cat <<EOF >/etc/cloud/cloud.cfg.d/10_etc_hosts.cfg |
| 41 | manage_etc_hosts: True |
| 42 | password: ubuntu |
| 43 | chpasswd: { expire: False } |
| 44 | ssh_pwauth: True |
| 45 | EOF |
| 46 | |
| 47 | linuxheadersversion=`echo ls boot/vmlinuz* | cut -d- -f2-` |
| 48 | |
| 49 | apt-get update |
| 50 | apt-get install -y \ |
| 51 | linux-headers-$linuxheadersversion \ |
| 52 | screen \ |
| 53 | locate \ |
| 54 | sshpass \ |
| 55 | git |
| 56 | |
| 57 | cd /root |
| 58 | git clone -b stable/danube https://gerrit.onap.org/gerrit/vswitchperf |
| 59 | |
| 60 | # do not compile ovs and qemu |
| 61 | sed -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 |
| 66 | mkdir -p /root/vswitchperf/src/ovs/ovs/ovsdb/ |
| 67 | touch /root/vswitchperf/src/ovs/ovs/ovsdb/ovsdb-tool |
| 68 | touch /root/vswitchperf/src/ovs/ovs/ovsdb/ovsdb-server |
| 69 | mkdir -p /root/vswitchperf/src/qemu/qemu/x86_64-softmmu/ |
| 70 | touch /root/vswitchperf/src/qemu/qemu/x86_64-softmmu/qemu-system-x86_64 |
| 71 | mkdir -p /root/vswitchperf/src/ovs/ovs/utilities/ |
| 72 | touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-dpctl |
| 73 | touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-vsctl |
| 74 | touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-ofctl |
| 75 | touch /root/vswitchperf/src/ovs/ovs/utilities/ovs-appctl |
| 76 | mkdir -p /root/vswitchperf/src/ovs/ovs/vswitchd/ |
| 77 | touch /root/vswitchperf/src/ovs/ovs/vswitchd/vswitch.ovsschema |
| 78 | touch /root/vswitchperf/src/ovs/ovs/vswitchd/ovs-vswitchd |
| 79 | |
| 80 | # restore symlink |
| 81 | #ln -sf /run/resolvconf/resolv.conf /etc/resolv.conf |