diff options
Diffstat (limited to 'nfvbenchvm/dib/elements/nfvbenchvm/post-install.d')
11 files changed, 127 insertions, 40 deletions
diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/01-update-kernel b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/01-update-kernel index 8094006..0c32b5f 100755 --- a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/01-update-kernel +++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/01-update-kernel @@ -1,5 +1,12 @@ #!/bin/bash +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Stop on error +set -euo pipefail + if [ $DIB_USE_ELREPO_KERNEL != "True" ]; then exit 0 fi diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/02-pip-package b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/02-pip-package new file mode 100755 index 0000000..ee7c5f2 --- /dev/null +++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/02-pip-package @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Stop on error +set -euo pipefail + +python3 -m pip install --upgrade pip +python3 -m pip install setuptools wheel pbr +python3 -m pip install pyyaml diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/02-testpmd-script b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/02-testpmd-script deleted file mode 100755 index 2136c3a..0000000 --- a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/02-testpmd-script +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -DPDK=dpdk-17.08 -DPDK_UNTAR=dpdk-17.08 - -# pick up the kernel version for the target image -kernel_version=`ls -t /lib/modules | awk 'NR==1 {print}'` - -mkdir dpdk -wget http://fast.dpdk.org/rel/$DPDK.tar.xz -tar xfJ $DPDK.tar.xz -cd $DPDK_UNTAR - -export RTE_KERNELDIR=/lib/modules/$kernel_version/build -export ARCH=x86 -make -j4 install T=x86_64-native-linuxapp-gcc - -cp usertools/dpdk-devbind.py ../dpdk -# cp tools/dpdk_nic_bind.py ../dpdk/dpdk-devbind.py -cp x86_64-native-linuxapp-gcc/app/testpmd ../dpdk -cp x86_64-native-linuxapp-gcc/kmod/igb_uio.ko ../dpdk -echo "set promisc all off" > /dpdk/testpmd_cmd.txt - -cd .. -rm -f $DPDK.tar.xz -rm -rf $DPDK_UNTAR diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-add-execute-attribute b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-add-execute-attribute deleted file mode 100755 index a13ab95..0000000 --- a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-add-execute-attribute +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -chmod +x /etc/rc.d/rc.local -chmod +x /etc/sysconfig/network-scripts/ifcfg-eth0 diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-copy-rc-local b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-copy-rc-local new file mode 100755 index 0000000..4a8e66b --- /dev/null +++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-copy-rc-local @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Stop on error +set -euo pipefail + +# set accurate rc.local file corresponding to current image built +if [ $DIB_DEV_IMAGE = "loopvm" ]; then + mv /etc/rc.d/rc.local.loopvm /etc/rc.d/rc.local +else + mv /etc/rc.d/rc.local.generator /etc/rc.d/rc.local +fi diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/04-add-execute-attribute b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/04-add-execute-attribute new file mode 100755 index 0000000..52aed8a --- /dev/null +++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/04-add-execute-attribute @@ -0,0 +1,14 @@ +#!/bin/bash + +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Stop on error +set -euo pipefail + +chmod +x /etc/rc.d/rc.local +chmod +x /etc/sysconfig/network-scripts/ifcfg-eth0 +chmod +x /etc/profile.d/nfvbench.sh +chmod +x /nfvbench/configure-nfvbench.sh +chmod +x /nfvbench/start-nfvbench.sh diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/50-pip-package b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/50-pip-package deleted file mode 100755 index 2d74ff5..0000000 --- a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/50-pip-package +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -cd /tmp -wget https://bootstrap.pypa.io/get-pip.py -python get-pip.py - -pip install setuptools wheel -pip install pyyaml diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/51-cloudcfg-edit b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/51-cloudcfg-edit index 3e4647a..1a0dec9 100755 --- a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/51-cloudcfg-edit +++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/51-cloudcfg-edit @@ -5,7 +5,10 @@ cloudcfg = "/etc/cloud/cloud.cfg" user = "cloud-user" with open(cloudcfg) as f: - cfg = yaml.load(f) + cfg = yaml.safe_load(f) + +# allow SSH password auth +cfg['ssh_pwauth'] = "1" try: if cfg['system_info']['default_user']['name']: diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/52-nfvbench-script b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/52-nfvbench-script new file mode 100755 index 0000000..4edc493 --- /dev/null +++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/52-nfvbench-script @@ -0,0 +1,56 @@ +#!/bin/bash + +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Make sure the disk image build fails if nfvbench installation fails +set -euo pipefail + +if [ $DIB_DEV_IMAGE != "generator" ]; then + exit 0 +fi + +# TRex installation +mkdir -p /opt/trex +mkdir /var/log/nfvbench + +wget --no-cache --no-check-certificate https://trex-tgn.cisco.com/trex/release/$TREX_VER.tar.gz +tar xzf $TREX_VER.tar.gz -C /opt/trex +rm -f /$TREX_VER.tar.gz +rm -f /opt/trex/$TREX_VER/trex_client_$TREX_VER.tar.gz +cp -a /opt/trex/$TREX_VER/automation/trex_control_plane/interactive/trex /usr/local/lib/python3.6/site-packages/ +rm -rf /opt/trex/$TREX_VER/automation/trex_control_plane/interactive/trex + +# NFVbench installation +cd /opt +if [[ "${DIB_NFVBENCH_CODE_ORIGIN}" == "static" ]]; then + # nfvbench code has been copied by the install-static element to + # /opt/nfvbench without the .git/ directory. But pip will need that .git/ + # directory to compute nfvbench version, so will now finish the incomplete + # job of install-static: + STATIC_NFVBENCH_CODE="$(dirname $0)/../static/opt/nfvbench" + [ -d "${STATIC_NFVBENCH_CODE}" ] || { + echo "Error: directory ${STATIC_NFVBENCH_CODE} missing." + echo " You requested a build from local nfvbench code with" + echo " DIB_NFVBENCH_CODE_ORIGIN=static, but you likely forgot" + echo " to clone nfvbench code in elements/nfvbenchvm/static/opt/nfvbench" + exit 1 + } + rsync -lr "${STATIC_NFVBENCH_CODE}"/ /opt/nfvbench/ +else + git clone https://gerrit.opnfv.org/gerrit/nfvbench +fi +cd nfvbench/ +python3 -m pip install . --use-deprecated=legacy-resolver +cp xtesting/testcases.yaml /usr/local/lib/python3.6/site-packages/xtesting/ci/testcases.yaml +python3 ./docker/cleanup_generators.py +rm -rf /opt/nfvbench/.git +rm -rf /opt/nfvbench/nfvbench +rm -rf /opt/nfvbench/behave_tests +# symlink to NFVbench sources +ln -s /usr/local/lib/python3.6/site-packages/nfvbench /opt/nfvbench/nfvbench +ln -s /usr/local/lib/python3.6/site-packages/behave_tests /opt/nfvbench/behave_tests +# persist env variables +echo "export TREX_VER=\"$TREX_VER\"" >> /etc/profile.d/nfvbench.sh +echo "export TREX_EXT_LIBS=\"/opt/trex/$TREX_VER/external_libs\"" >> /etc/profile.d/nfvbench.sh diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/53-sshd-script b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/53-sshd-script new file mode 100755 index 0000000..0c7dfd5 --- /dev/null +++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/53-sshd-script @@ -0,0 +1,11 @@ +#!/bin/bash + +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Stop on error +set -euo pipefail + +# Set UseDNS no value in sshd_config to reduce time to connect +echo "UseDNS no" >> /etc/ssh/sshd_config diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/99-cleanup b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/99-cleanup index 14e9f27..dbb7342 100755 --- a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/99-cleanup +++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/99-cleanup @@ -1,3 +1,10 @@ #!/bin/bash -yum erase -y python-devel libyaml-devel numactl-devel kernel-devel kernel-headers kernel-lt-headers kernel-lt-devel gcc +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +# Stop on error +set -euo pipefail + +yum erase -y python-devel libyaml-devel numactl-devel kernel-devel kernel-headers kernel-lt-headers kernel-lt-devel gcc git python3-dev libpython3.6-dev |