summaryrefslogtreecommitdiffstats
path: root/nfvbenchvm/dib/elements/nfvbenchvm/static/nfvbench/start-nfvbench.sh
blob: 1f6fa28dd6916cf99898d519e4f19b485d6dc748 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash


restart_nfvbench_service(){
    service nfvbench restart
    echo "NFVbench running in screen 'nfvbench'"
    logger "NFVBENCHVM: NFVbench running in screen 'nfvbench'"
}

start_nfvbench(){
    ln -sfn /etc/nfvbench/nfvbench.cfg /etc/nfvbench/nfvbench.conf
    restart_nfvbench_service
}

start_nfvbench_e2e_mode(){
    ln -sfn /etc/nfvbench/e2e.cfg /etc/nfvbench/nfvbench.conf
    restart_nfvbench_service
}

start_nfvbench_loopback_mode(){
    ln -sfn /etc/nfvbench/loopback.cfg /etc/nfvbench/nfvbench.conf
    restart_nfvbench_service
}

usage() {
    echo "Usage: $0 action"
    echo "action (optional):"
    echo "e2e       start NFVbench with E2E config file"
    echo "loopback  start NFVbench with loopback config file"
    echo ""
    echo "If no action is given NFVbench will start with default config file"
    exit 1
}

# ----------------------------------------------------------------------------
# Parse command line options and configure the script
# ----------------------------------------------------------------------------
if [ "$#" -lt 1 ]; then
    start_nfvbench
    exit 0
else
    if [ $1 = "e2e" ]; then
        start_nfvbench_e2e_mode
        exit 0
    elif [ $1 = "loopback" ]; then
        start_nfvbench_loopback_mode
        exit 0
    else
        usage
    fi
fi