summaryrefslogtreecommitdiffstats
path: root/scripts/stl-sim
blob: 1ca0322e89b96ba63966d887295570aff33a556c (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
#!/bin/bash

# if no variable of $PYTHON is define - we try to find it
function find_python {
    # two candidates - machine python and cisco linux python
    MACHINE_PYTHON=python
    CEL_PYTHON=/router/bin/python

    # try the machine python
    PYTHON=$MACHINE_PYTHON
    
    PCHECK=`$PYTHON -c "import sys; ver = sys.version_info[0] * 10 + sys.version_info[1];sys.exit(ver < 27)"`
    if [ $? -ne 0 ]; then
        PYTHON=$CEL_PYTHON
        PCHECK=`$PYTHON -c "import sys; ver = sys.version_info[0] * 10 + sys.version_info[1];sys.exit(ver < 27)"`
    
        if [ $? -ne 0 ]; then
            echo "*** $PYTHON - python version is too old, 2.7 at least is required"
            exit -1
        fi
    
    fi
    
}

if [ -z "$PYTHON" ]; then
    find_python
fi

$PYTHON automation/trex_control_plane/client/trex_stateless_sim.py $@