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 |
| 28 | echo "Environmental variable 'ONOS_CELL' is not defiled" |
| 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 | |
| 43 | echo "ONOS_CELL=${ONOS_CELL}" |
| 44 | echo "ONOS_NIC=${ONOS_NIC}" |
Pavlin Radoslavov | 711145a | 2014-10-16 17:45:48 -0700 | [diff] [blame] | 45 | for n in {0..9}; do |
Pavlin Radoslavov | 0770d0f | 2014-10-15 15:58:31 -0700 | [diff] [blame] | 46 | ocn="OC${n}" |
| 47 | if [ -n "${!ocn}" ]; then |
| 48 | echo "$ocn=${!ocn}" |
| 49 | fi |
| 50 | done |
| 51 | echo "OCN=${OCN}" |
| 52 | echo "OCI=${OCI}" |
| 53 | echo "ONOS_FEATURES=${ONOS_FEATURES}" |