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