- echo "Load DPDK modules and setup hugepages"
- modprobe uio
- mkdir -p "/lib/modules/$(uname -r)/extra"
- cp -r "kmod/igb_uio.ko" "/lib/modules/$(uname -r)/extra"
- depmod -a
- modprobe igb_uio
- sh -c "echo 'uio\nigb_uio\n' > /etc/modules-load.d/nsb.conf"
-
- HUGEPGSZ=$(cat < /proc/meminfo | grep Hugepagesize | cut -d : -f 2 | tr -d ' ')
- Pages=16
- if [[ "$HUGEPGSZ" = "2048kB" ]] ; then
- Pages=16384
- fi
- grep nr_hugepages /etc/sysctl.conf
- if [[ "$?" -eq '1' ]] ; then
- sh -c "echo 'vm.nr_hugepages=$Pages' >> /etc/sysctl.conf"
- fi
- echo "echo $Pages > /sys/kernel/mm/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" > .echo_tmp
- echo "Reserving hugepages"
- sudo sh .echo_tmp
- rm -f .echo_tmp
-
- service procps start
- echo "Creating /mnt/huge and mounting as hugetlbfs"
- sudo mkdir -p /mnt/huge
-
- grep -s '/mnt/huge' /proc/mounts > /dev/null
- if [ $? -ne 0 ] ; then
- sudo mount -t hugetlbfs nodev /mnt/huge
- fi
- popd
- mv "$REPO_DIR/dpdk-16.07" "$INSTALL_BIN_PATH"
- rm dpdk-16.07.zip
- fi
- export RTE_SDK="$INSTALL_BIN_PATH/dpdk-16.07"
- export RTE_TARGET=x86_64-native-linuxapp-gcc
-
- if [ ! -f "$INSTALL_BIN_PATH/vPE_vnf" ]; then
- pushd .
- echo "Building vPE VNF..."
- cd $INSTALL_BIN_PATH/dpdk-16.07/examples/ip_pipeline/
- make clean
- make
- cp build/ip_pipeline $INSTALL_BIN_PATH/vPE_vnf
- popd
- fi
- echo "Done"
-}
-
-
-push_nsb_binary()
-{
- if [ ! -d "$INSTALL_BIN_PATH/trex/scripts" ]; then
- cp -fr "$REPO_DIR/trex" "$INSTALL_BIN_PATH"
- fi
- rm -rf "$REPO_DIR/trex"
-
- if [ -d "$INSTALL_BIN_PATH/trex" ]; then
- echo "Setup Environment variables for Test Harness...."
- PYTHONPATH="$INSTALL_BIN_PATH/trex/scripts/automation/trex_control_plane:$INSTALL_BIN_PATH/trex/scripts/automation/trex_control_plane/stl"
- PY_PATH=$(grep PYTHONPATH ~/.bash_profile)
- if [ "$PY_PATH" = "" ] ; then
- sh -c "echo export PYTHONPATH=$PYTHONPATH >> ~/.bash_profile" > /dev/null
- else
- echo "Your ~/.bash_profile already contains a PYTHONPATH definition."
- echo "Make sure it contains $PYTHONPATH which is required to run TRex"
- fi
- fi
- cp "$REPO_DIR/yardstick/network_services/nfvi/collectd.sh" "$INSTALL_BIN_PATH"
- cp "$REPO_DIR/yardstick/network_services/nfvi/collectd.conf" "$INSTALL_BIN_PATH"
- cp "$REPO_DIR/nsb_setup.sh" "$INSTALL_BIN_PATH"
- echo "Done"
-}
-
-check_installed_files()
-{
- if [ ! -f "$INSTALL_BIN_PATH/yardstick_venv/bin/activate" ]; then
- echo "Installation Error. Failed to create yardstick virtual env..."
- exit 1
- fi
-
- if [ ! -d "$INSTALL_BIN_PATH/dpdk-16.07" ]; then
- echo "Installation Error. Failed to download and install dpdk-16.07..."
- exit 1
- fi
-
- if [ ! -d "$INSTALL_BIN_PATH/trex" ]; then
- echo "Installation Error. Failed to download and configure Trex"
- exit 1
- fi
-
- if [ ! -f "$INSTALL_BIN_PATH/vPE_vnf" ]; then
- echo "Installation Error. vPE VNF not present in install dir $INSTALL_BIN_PATH"
- exit 1
- fi
-}
-
-if [ "$1" == "dpdk" ]; then
- install_libs
- install_dpdk
-else
- install_libs
- install_yardstick
- install_dpdk
- install_trex
- push_nsb_binary
- check_installed_files
-clear
-echo "Installation completed..."
-echo "Virtual Environment : $INSTALL_BIN_PATH/yardstick_venv"
-echo "Please refer to Chapter 13 of the Yardstick User Guide for how to get started with VNF testing."
-fi