summaryrefslogtreecommitdiffstats
path: root/framework/src/onos/tools/test/bin/onos-show-cell
blob: f5c7572679f2850c387c38972cdf492072549c43 (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
52
53
54
55
56
57
#!/bin/bash
# -----------------------------------------------------------------------------
# Print the configuration of an ONOS cell.
# -----------------------------------------------------------------------------

[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults

function print_usage {
    echo "Print the configuration of an ONOS cell."
    echo "If no arguments are specified, it will print the configuration for the default"
    echo "ONOS cell as specified in the 'ONOS_CELL' environmental variable."
    echo
    echo "Optional arguments:"
    echo "  [cell-name]       Print the configuration of 'cell-name'"
    echo "  [-h | --help]     Print this help"
}

if [ "${1}" = "-h" -o "${1}" = "--help" ]; then
    print_usage
    exit 0
fi

if [ -n "${1}" ]; then
    cell="${1}"
else
    if [ -z "${ONOS_CELL}" ]; then
        echo "Environmental variable 'ONOS_CELL' is not defined"
        exit 1
    else
        cell="${ONOS_CELL}"
    fi
fi

if [ ! -f $ONOS_ROOT/tools/test/cells/${cell} ]; then
    echo "No such cell: ${cell}"
    exit 1
fi

# Load the cell setup
. $ONOS_ROOT/tools/test/cells/${cell}

echo "ONOS_CELL=${ONOS_CELL}"
echo "ONOS_NIC=${ONOS_NIC}"
# get number of OC variables
max=$( env | egrep 'OC[0-9]+' | wc -l )
for n in $( seq 0 ${max} ); do
    ocn="OC${n}"
    if [ -n "${!ocn}" ]; then
        echo "$ocn=${!ocn}"
    fi
done
echo "OCN=${OCN}"
echo "OCT=${OCT}"
echo "OCI=${OCI}"
echo "ONOS_APPS=${ONOS_APPS}"
echo "ONOS_BOOT_FEATURES=${ONOS_BOOT_FEATURES}"