nfvbenchvm: add 2 debug features to build-image.sh
[nfvbench.git] / nfvbenchvm / dib / elements / nfvbenchvm / post-install.d / 52-nfvbench-script
1 #!/bin/bash
2
3 if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
4     set -x
5 fi
6
7 # Make sure the disk image build fails if nfvbench installation fails
8 set -euo pipefail
9
10 if [ $DIB_DEV_IMAGE != "generator" ]; then
11     exit 0
12 fi
13
14 # TRex installation
15 mkdir -p /opt/trex
16 mkdir /var/log/nfvbench
17
18 wget --no-cache --no-check-certificate https://trex-tgn.cisco.com/trex/release/$TREX_VER.tar.gz
19 tar xzf $TREX_VER.tar.gz -C /opt/trex
20 rm -f /$TREX_VER.tar.gz
21 rm -f /opt/trex/$TREX_VER/trex_client_$TREX_VER.tar.gz
22 cp -a /opt/trex/$TREX_VER/automation/trex_control_plane/interactive/trex /usr/local/lib/python3.6/site-packages/
23 rm -rf /opt/trex/$TREX_VER/automation/trex_control_plane/interactive/trex
24
25 # NFVbench installation
26 cd /opt
27 git clone https://gerrit.opnfv.org/gerrit/nfvbench
28 cd nfvbench/
29 python3 -m pip install . --use-deprecated=legacy-resolver
30 cp xtesting/testcases.yaml /usr/local/lib/python3.6/site-packages/xtesting/ci/testcases.yaml
31 python3 ./docker/cleanup_generators.py
32 rm -rf /opt/nfvbench/.git
33 rm -rf /opt/nfvbench/nfvbench
34 # symlink to NFVbench sources
35 ln -s /usr/local/lib/python3.6/site-packages/nfvbench /opt/nfvbench/nfvbench
36 # persist env variables
37 echo "export TREX_VER=\"$TREX_VER\"" >> /etc/profile.d/nfvbench.sh
38 echo "export TREX_EXT_LIBS=\"/opt/trex/$TREX_VER/external_libs\"" >> /etc/profile.d/nfvbench.sh