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