NFVBENCH-196: New NFVbench image for generator part (nfvbench and TRex codes inside VM)
[nfvbench.git] / nfvbenchvm / dib / elements / nfvbenchvm / static / nfvbench / start-nfvbench.sh
1 #!/bin/bash
2
3
4 restart_nfvbench_service(){
5     service nfvbench restart
6     echo "NFVbench running in screen 'nfvbench'"
7     logger "NFVBENCHVM: NFVbench running in screen 'nfvbench'"
8 }
9
10 start_nfvbench(){
11     ln -sfn /etc/nfvbench/nfvbench.cfg /etc/nfvbench/nfvbench.conf
12     restart_nfvbench_service
13 }
14
15 start_nfvbench_e2e_mode(){
16     ln -sfn /etc/nfvbench/e2e.cfg /etc/nfvbench/nfvbench.conf
17     restart_nfvbench_service
18 }
19
20 start_nfvbench_loopback_mode(){
21     ln -sfn /etc/nfvbench/loopback.cfg /etc/nfvbench/nfvbench.conf
22     restart_nfvbench_service
23 }
24
25 usage() {
26     echo "Usage: $0 action"
27     echo "action (optional):"
28     echo "e2e       start NFVbench with E2E config file"
29     echo "loopback  start NFVbench with loopback config file"
30     echo ""
31     echo "If no action is given NFVbench will start with default config file"
32     exit 1
33 }
34
35 # ----------------------------------------------------------------------------
36 # Parse command line options and configure the script
37 # ----------------------------------------------------------------------------
38 if [ "$#" -lt 1 ]; then
39     start_nfvbench
40     exit 0
41 else
42     if [ $1 = "e2e" ]; then
43         start_nfvbench_e2e_mode
44         exit 0
45     elif [ $1 = "loopback" ]; then
46         start_nfvbench_loopback_mode
47         exit 0
48     else
49         usage
50     fi
51 fi