Pavlin Radoslavov

Minor refactoring in the ONOS cell configuration:

 * Each cell-specific variable is explicitly listed
   in the cell config file:
   ONOS_CELL, ONOS_NIC, OC1-OC9, OCN, OCI, ONOS_FEATURES

 * Cleanup and bug fixes inside bash_profile:
   - Don't export explicitly OCI and ONOS_CELL, because those
     are now exported in the cell config file
   - unset ONOS_CELL, ONOS_NIC, ONOS_FEATURES (the last two weren't
     unset before)
   - The built-in "cell" function shows OC1 to OC9 instead of OC0-OC9;
     OC0 is never used/setup anywhere else

 * Added two new shell commands:
   - tools/test/bin/onos-lsit-cells : lists existing ONOS cell configurations
     It is the equivalent of the "cells" built-in bash command
   - tools/test/bin/onos-show-cell : shows the configuration of an ONOS cell
     It is the equivalent of the "cell" built-in bash command, but
     it can show also the configuration of any ONOS cell (not only
     the default one).
......@@ -61,15 +61,14 @@ function cell {
if [ -n "$1" ]; then
[ ! -f $ONOS_ROOT/tools/test/cells/$1 ] && \
echo "No such cell: $1" >&2 && return 1
unset ONOS_CELL ONOS_NIC ONOS_FEATURES
unset OC1 OC2 OC3 OC4 OC5 OC6 OC7 OC8 OC9 OCN OCI
. $ONOS_ROOT/tools/test/cells/$1
export OCI=$OC1
export ONOS_CELL=$1
cell
else
env | egrep "ONOS_CELL"
env | egrep "OCI"
env | egrep "OC[0-9]+" | sort
env | egrep "OC[1-9]+" | sort
env | egrep "OCN"
env | egrep "ONOS_" | egrep -v 'ONOS_ROOT|ONOS_CELL'
fi
......
#!/bin/bash
# -----------------------------------------------------------------------------
# List available ONOS cells configuration.
# -----------------------------------------------------------------------------
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
# Lists available cells
for cell in $(ls -1 $ONOS_ROOT/tools/test/cells); do
if [ ${cell} = "${ONOS_CELL}" ]; then
cell_id="${cell} *"
else
cell_id="${cell}"
fi
cell_descr="$(grep '^#' $ONOS_ROOT/tools/test/cells/$cell | head -n 1)"
printf "%-12s %s\n" "${cell_id}" "${cell_descr}"
done
#!/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 defiled"
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}"
for n in {0..9}; do
ocn="OC${n}"
if [ -n "${!ocn}" ]; then
echo "$ocn=${!ocn}"
fi
done
echo "OCN=${OCN}"
echo "OCI=${OCI}"
echo "ONOS_FEATURES=${ONOS_FEATURES}"
# Local VirtualBox-based single ONOS instance & ONOS mininet box
export ONOS_CELL="cbench"
export ONOS_NIC=192.168.56.*
export OC1="192.168.56.103"
export OCN="192.168.56.103"
export OCI="${OC1}"
export ONOS_FEATURES="webconsole,onos-api,onos-core-trivial,onos-cli,onos-openflow,onos-app-fwd"
......
# Local VirtualBox-based ONOS instances 1,2 & ONOS mininet box
export ONOS_CELL="local"
export ONOS_NIC=192.168.56.*
export OC1="192.168.56.101"
export OC2="192.168.56.102"
export OCN="192.168.56.103"
export OCI="${OC1}"
export ONOS_FEATURES=""
......
# ProxMox-based cell of ONOS instance; no mininet-box
export ONOS_FEATURES="webconsole,onos-api,onos-core-trivial,onos-cli,onos-openflow,onos-app-fwd,onos-app-mobility,onos-app-tvue,onos-app-proxyarp"
export ONOS_CELL="office"
export ONOS_NIC="10.128.4.*"
export OC1="10.128.4.60"
export OCI="${OC1}"
export ONOS_FEATURES="webconsole,onos-api,onos-core-trivial,onos-cli,onos-openflow,onos-app-fwd,onos-app-mobility,onos-app-tvue,onos-app-proxyarp"
......
# ProxMox-based cell of ONOS instances 1,2 & ONOS mininet box
export ONOS_CELL="prox"
export ONOS_NIC="10.1.9.*"
export OC1="10.1.9.94"
export OC2="10.1.9.82"
export OCN="10.1.9.93"
export OCI="${OC1}"
export ONOS_FEATURES=""
......
# Local VirtualBox-based single ONOS instance & ONOS mininet box
export ONOS_CELL="single"
export ONOS_NIC=192.168.56.*
export OC1="192.168.56.101"
export OCN="192.168.56.103"
export OCI="${OC1}"
export ONOS_FEATURES=""
......
# Local VirtualBox-based ONOS instances 1,2,3 & ONOS mininet box
export ONOS_CELL="triple"
export ONOS_NIC=192.168.56.*
export OC1="192.168.56.101"
export OC2="192.168.56.102"
export OC3="192.168.56.104"
export OCN="192.168.56.103"
export OCI="${OC1}"
export ONOS_FEATURES=""
......