2 # Copyright (c) 2016-2017 Intel Corporation
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # installs required packages
17 # must be run from inside the image (either chrooted or running)
24 # /etc/resolv.conf is a symbolic link to /run, restore at end
26 echo "nameserver $nameserver_ip" > /etc/resolv.conf
27 echo "nameserver 8.8.8.8" >> /etc/resolv.conf
28 echo "nameserver 8.8.4.4" >> /etc/resolv.conf
31 INSTALL_BIN_PATH="/opt/nsb_bin"
34 TREX_DOWNLOAD="https://trex-tgn.cisco.com/trex/release/$TREX_VERSION.tar.gz"
35 TREX_DIR=$INSTALL_BIN_PATH/trex/scripts
41 if [[ "$http_proxy" != "" ]]; then
42 echo 'Acquire::http::Proxy "$http_proxy";' > /etc/apt/apt.conf
49 INSTALL_BIN_PATH="/opt/nsb_bin"
50 DPDK_DOWNLOAD="http://dpdk.org/browse/dpdk/snapshot/dpdk-16.07.zip"
52 TREX_DOWNLOAD="https://trex-tgn.cisco.com/trex/release/$TREX_VERSION.tar.gz"
53 TREX_DIR=$INSTALL_BIN_PATH/trex/scripts
56 echo "Build TRex and installing Trex TG in $INSTALL_BIN_PATH/trex"
57 rm -rf ${TREX_DOWNLOAD##*/}
58 if [ ! -e ${TREX_DOWNLOAD##*/} ] ; then
61 tar zxvf ${TREX_DOWNLOAD##*/}
63 rm -rf $INSTALL_BIN_PATH/trex
64 mkdir -p $INSTALL_BIN_PATH/trex
65 mv $TREX_VERSION trex/scripts
66 rm -rf $TREX_VERSION.tar.gz
67 cd $INSTALL_BIN_PATH/trex/scripts/ko/src/
70 touch "$INSTALL_BIN_PATH/trex/scripts/automation/trex_control_plane/stl/__init__.py"
71 cp "$INSTALL_BIN_PATH/trex/scripts/dpdk_nic_bind.py" "$INSTALL_BIN_PATH"
76 mkdir -p $INSTALL_BIN_PATH
77 echo "Install Sample VNFs"
80 git clone https://git.opnfv.org/samplevnf
82 VNF_CORE=$INSTALL_BIN_PATH/samplevnf
83 ./tools/vnf_build.sh -s -d='17.02'
84 cp $VNF_CORE/VNFs/vACL/build/vACL $INSTALL_BIN_PATH
85 cp $VNF_CORE/VNFs/vCGNAPT/build/vCGNAPT $INSTALL_BIN_PATH
86 cp $VNF_CORE/VNFs/vFW/build/vFW $INSTALL_BIN_PATH
87 cp $VNF_CORE/VNFs/DPPD-PROX/build/prox $INSTALL_BIN_PATH
88 cp $VNF_CORE/VNFs/UDP_Replay/build/UDP_Replay $INSTALL_BIN_PATH
89 cp $VNF_CORE/VNFs/vFW/vnf_template.txt $INSTALL_BIN_PATH
91 # copy to standard path
92 cp $VNF_CORE/VNFs/vACL/build/vACL $BIN_PATH
93 cp $VNF_CORE/VNFs/vCGNAPT/build/vCGNAPT $BIN_PATH
94 cp $VNF_CORE/VNFs/vFW/build/vFW $BIN_PATH
95 cp $VNF_CORE/VNFs/DPPD-PROX/build/prox $BIN_PATH
96 cp $VNF_CORE/VNFs/UDP_Replay/build/UDP_Replay $BIN_PATH
99 cd $VNF_CORE/dpdk/examples/ip_pipeline
100 export RTE_SDK= $VNF_CORE/dpdk
102 cp $VNF_CORE/build/ip_pipeline $INSTALL_BIN_PATH/vPE_vnf
107 # iperf3 only available for trusty in backports
108 if grep -q trusty /etc/apt/sources.list ; then
109 if [ "${YARD_IMG_ARCH}" = "arm64" ]; then
110 echo "deb [arch=${YARD_IMG_ARCH}] http://ports.ubuntu.com/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list
112 echo "deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list
116 # Workaround for building on CentOS (apt-get is not working with http sources)
117 # sed -i 's/http/ftp/' /etc/apt/sources.list
119 # Force apt to use ipv4 due to build problems on LF POD.
120 echo 'Acquire::ForceIPv4 "true";' > /etc/apt/apt.conf.d/99force-ipv4
122 echo 'GRUB_CMDLINE_LINUX="resume=/dev/sda1 default_hugepagesz=1G hugepagesz=1G hugepages=4 iommu=on iommu=pt intel_iommu=on"' >> /etc/default/grub
123 echo 'huge /mnt/huge hugetlbfs defaults 0 0' >> vi /etc/fstab
130 touch /etc/network/interfaces.d/eth$i.cfg
131 chmod 777 /etc/network/interfaces.d/eth$i.cfg
132 echo "auto eth$i" >> /etc/network/interfaces.d/eth$i.cfg
133 echo "iface eth$i inet dhcp" >> /etc/network/interfaces.d/eth$i.cfg
136 # this needs for checking dpdk status, adding interfaces to dpdk, bind, unbind etc..
138 # Add hostname to /etc/hosts.
139 # Allow console access via pwd
140 cat <<EOF >/etc/cloud/cloud.cfg.d/10_etc_hosts.cfg
141 manage_etc_hosts: True
144 chpasswd: { expire: False }
148 linuxheadersversion=$(echo ls boot/vmlinuz* | cut -d- -f2-)
160 linux-tools-generic \
169 linux-headers-"${linuxheadersversion}" \
176 echo "root:root" | chpasswd
183 sed -i -e 's/PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
184 sed -i -e 's/prohibit-password/yes/g' /etc/ssh/sshd_config
187 CLONE_DEST=/opt/tempT
188 # remove before cloning
189 rm -rf -- "${CLONE_DEST}"
190 git clone https://github.com/kdlucas/byte-unixbench.git "${CLONE_DEST}"
191 make --directory "${CLONE_DEST}/UnixBench/"
193 git clone https://github.com/beefyamoeba5/ramspeed.git "${CLONE_DEST}/RAMspeed"
194 cd "${CLONE_DEST}/RAMspeed/ramspeed-2.6.0"
198 git clone https://github.com/beefyamoeba5/cachestat.git "${CLONE_DEST}"/Cachestat
201 ln -sfrT /run/resolvconf/resolv.conf /etc/resolv.conf