Pavlin Radoslavov | 0770d0f | 2014-10-15 15:58:31 -0700 | [diff] [blame] | 1 | #!/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 | |
| 9 | function 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 | |
| 19 | if [ "${1}" = "-h" -o "${1}" = "--help" ]; then |
| 20 | print_usage |
| 21 | exit 0 |
| 22 | fi |
| 23 | |
| 24 | if [ -n "${1}" ]; then |
| 25 | cell="${1}" |
| 26 | else |
| 27 | if [ -z "${ONOS_CELL}" ]; then |
Thomas Vachuska | 8531429 | 2014-11-14 17:52:12 -0800 | [diff] [blame] | 28 | echo "Environmental variable 'ONOS_CELL' is not defined" |
Pavlin Radoslavov | 0770d0f | 2014-10-15 15:58:31 -0700 | [diff] [blame] | 29 | exit 1 |
| 30 | else |
| 31 | cell="${ONOS_CELL}" |
| 32 | fi |
| 33 | fi |
| 34 | |
| 35 | if [ ! -f $ONOS_ROOT/tools/test/cells/${cell} ]; then |
| 36 | echo "No such cell: ${cell}" |
| 37 | exit 1 |
| 38 | fi |
| 39 | |
| 40 | # Load the cell setup |
| 41 | . $ONOS_ROOT/tools/test/cells/${cell} |
| 42 | |
Pavlin Radoslavov | ce0395e | 2014-11-11 11:58:46 -0800 | [diff] [blame] | 43 | echo "ONOS_CELL=${ONOS_CELL}" |
Ayaka Koshibe | ebb5444 | 2015-01-09 14:22:19 -0800 | [diff] [blame] | 44 | # get number of OC variables |
Claudine Chiu | 45312d0 | 2016-06-15 13:17:12 +0000 | [diff] [blame] | 45 | max=$( env | egrep '^OC[0-9]+' | wc -l ) |
Ayaka Koshibe | ebb5444 | 2015-01-09 14:22:19 -0800 | [diff] [blame] | 46 | for n in $( seq 0 ${max} ); do |
Pavlin Radoslavov | 0770d0f | 2014-10-15 15:58:31 -0700 | [diff] [blame] | 47 | ocn="OC${n}" |
| 48 | if [ -n "${!ocn}" ]; then |
| 49 | echo "$ocn=${!ocn}" |
| 50 | fi |
| 51 | done |
| 52 | echo "OCN=${OCN}" |
Thomas Vachuska | 785f581 | 2015-03-19 01:11:00 -0700 | [diff] [blame] | 53 | echo "OCT=${OCT}" |
Pavlin Radoslavov | 0770d0f | 2014-10-15 15:58:31 -0700 | [diff] [blame] | 54 | echo "OCI=${OCI}" |
Thomas Vachuska | 785f581 | 2015-03-19 01:11:00 -0700 | [diff] [blame] | 55 | echo "ONOS_APPS=${ONOS_APPS}" |
| 56 | echo "ONOS_BOOT_FEATURES=${ONOS_BOOT_FEATURES}" |