blob: f5c7572679f2850c387c38972cdf492072549c43 [file] [log] [blame]
Pavlin Radoslavov0770d0f2014-10-15 15:58:31 -07001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Print the configuration of an ONOS cell.
4# -----------------------------------------------------------------------------
5
6[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7. $ONOS_ROOT/tools/build/envDefaults
8
9function print_usage {
10 echo "Print the configuration of an ONOS cell."
11 echo "If no arguments are specified, it will print the configuration for the default"
12 echo "ONOS cell as specified in the 'ONOS_CELL' environmental variable."
13 echo
14 echo "Optional arguments:"
15 echo " [cell-name] Print the configuration of 'cell-name'"
16 echo " [-h | --help] Print this help"
17}
18
19if [ "${1}" = "-h" -o "${1}" = "--help" ]; then
20 print_usage
21 exit 0
22fi
23
24if [ -n "${1}" ]; then
25 cell="${1}"
26else
27 if [ -z "${ONOS_CELL}" ]; then
Thomas Vachuska85314292014-11-14 17:52:12 -080028 echo "Environmental variable 'ONOS_CELL' is not defined"
Pavlin Radoslavov0770d0f2014-10-15 15:58:31 -070029 exit 1
30 else
31 cell="${ONOS_CELL}"
32 fi
33fi
34
35if [ ! -f $ONOS_ROOT/tools/test/cells/${cell} ]; then
36 echo "No such cell: ${cell}"
37 exit 1
38fi
39
40# Load the cell setup
41. $ONOS_ROOT/tools/test/cells/${cell}
42
Pavlin Radoslavovce0395e2014-11-11 11:58:46 -080043echo "ONOS_CELL=${ONOS_CELL}"
Pavlin Radoslavov0770d0f2014-10-15 15:58:31 -070044echo "ONOS_NIC=${ONOS_NIC}"
Ayaka Koshibeebb54442015-01-09 14:22:19 -080045# get number of OC variables
46max=$( env | egrep 'OC[0-9]+' | wc -l )
47for n in $( seq 0 ${max} ); do
Pavlin Radoslavov0770d0f2014-10-15 15:58:31 -070048 ocn="OC${n}"
49 if [ -n "${!ocn}" ]; then
50 echo "$ocn=${!ocn}"
51 fi
52done
53echo "OCN=${OCN}"
Thomas Vachuska785f5812015-03-19 01:11:00 -070054echo "OCT=${OCT}"
Pavlin Radoslavov0770d0f2014-10-15 15:58:31 -070055echo "OCI=${OCI}"
Thomas Vachuska785f5812015-03-19 01:11:00 -070056echo "ONOS_APPS=${ONOS_APPS}"
57echo "ONOS_BOOT_FEATURES=${ONOS_BOOT_FEATURES}"