mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-17 10:21:52 +02:00
* 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).
96 lines
2.8 KiB
Bash
96 lines
2.8 KiB
Bash
#!/bin/bash
|
|
# ONOS developer BASH profile conveniences
|
|
# Simply include in your own .bash_aliases or .bash_profile
|
|
|
|
# Root of the ONOS source tree
|
|
export ONOS_ROOT=${ONOS_ROOT:-~/onos-next}
|
|
|
|
# Setup some environmental context for developers
|
|
export JAVA_HOME=${JAVA_HOME:-$(/usr/libexec/java_home -v 1.7)}
|
|
export MAVEN=${MAVEN:-~/Applications/apache-maven-3.2.2}
|
|
export KARAF=${KARAF:-~/Applications/apache-karaf-3.0.1}
|
|
export KARAF_LOG=$KARAF/data/log/karaf.log
|
|
|
|
# Setup a path
|
|
export PATH="$PATH:$ONOS_ROOT/tools/dev/bin:$ONOS_ROOT/tools/test/bin"
|
|
export PATH="$PATH:$ONOS_ROOT/tools/build"
|
|
export PATH="$PATH:$MAVEN/bin:$KARAF/bin"
|
|
export PATH="$PATH:."
|
|
|
|
# Convenience utility to warp to various ONOS source projects
|
|
# e.g. 'o api', 'o dev', 'o'
|
|
function o {
|
|
cd $(find $ONOS_ROOT/ -type d | egrep -v '\.git|target|gen-src' | \
|
|
egrep "${1:-$ONOS_ROOT}" | egrep -v "$ONOS_ROOT/.+/src/" | head -n 1)
|
|
}
|
|
|
|
# Short-hand for 'mvn clean install' for us lazy folk
|
|
alias mci='mvn clean install'
|
|
|
|
# Short-hand for ONOS build, package and test.
|
|
alias ob='onos-build'
|
|
alias obs='onos-build-selective'
|
|
alias op='onos-package'
|
|
alias ot='onos-test'
|
|
alias ol='onos-log'
|
|
alias ow='onos-watch'
|
|
alias go='ob && ot && onos -w'
|
|
alias pub='onos-push-update-bundle'
|
|
|
|
# Short-hand for tailing the ONOS (karaf) log
|
|
alias tl='$ONOS_ROOT/tools/dev/bin/onos-local-log'
|
|
alias tlo='tl | grep --colour=always org.onlab'
|
|
|
|
# Pretty-print JSON output
|
|
alias pp='python -m json.tool'
|
|
|
|
# Short-hand to launch API docs and sample topology viewer GUI
|
|
alias docs='open $ONOS_ROOT/target/site/apidocs/index.html'
|
|
alias gui='onos-gui'
|
|
|
|
|
|
# Test related conveniences
|
|
|
|
# SSH to a specified ONOS instance
|
|
alias sshctl='onos-ssh'
|
|
alias sshnet='onos-ssh $OCN'
|
|
|
|
# Applies the settings in the specified cell file or lists current cell definition
|
|
# if no cell file is given.
|
|
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
|
|
cell
|
|
else
|
|
env | egrep "ONOS_CELL"
|
|
env | egrep "OCI"
|
|
env | egrep "OC[1-9]+" | sort
|
|
env | egrep "OCN"
|
|
env | egrep "ONOS_" | egrep -v 'ONOS_ROOT|ONOS_CELL'
|
|
fi
|
|
}
|
|
|
|
cell local >/dev/null # Default cell is the local VMs
|
|
|
|
# Lists available cells
|
|
function cells {
|
|
for cell in $(ls -1 $ONOS_ROOT/tools/test/cells); do
|
|
printf "%-12s %s\n" \
|
|
"$([ $cell = $ONOS_CELL ] && echo $cell '*' || echo $cell)" \
|
|
"$(grep '^#' $ONOS_ROOT/tools/test/cells/$cell | head -n 1)"
|
|
done
|
|
}
|
|
|
|
# Miscellaneous
|
|
function spy {
|
|
ps -ef | egrep "$@" | grep -v egrep
|
|
}
|
|
|
|
function nuke {
|
|
spy "$@" | cut -c7-11 | xargs kill
|
|
}
|