blob: 8304bb2c89345ab344b3105b76eeb7c380cccf51 [file] [log] [blame]
#!/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=$(/usr/libexec/java_home)
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 PS=":"
export PATH="$PATH:$ONOS_ROOT/tools/dev:$ONOS_ROOT/tools/build"
export PATH="$PATH:$ONOS_ROOT/tools/test/bin"
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|src' | \
egrep "${1:-$ONOS_ROOT}" | head -n 1)
}
# Short-hand for 'mvn clean install' for us lazy folk
alias mci='mvn clean install'
# Short-hand for ONOS build from the top of the source tree.
alias ob='o && mvn clean install javadoc:aggregate'
# Short-hand for tailing the ONOS (karaf) log
alias tl='$ONOS_ROOT/tools/dev/watchLog'
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='open http://localhost:8181/onos/tvue'
# Test related conveniences
# SSH to a specified ONOS instance
alias sshctl=onos-ssh
# 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
. $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
fi
}
cell local >/dev/null # Default cell is the local VMs
# Lists available cells
function cells {
ls -1 $ONOS_ROOT/tools/test/cells
}
# Miscellaneous
function spy {
ps -ef | egrep "$@" | grep -v egrep
}
function nuke {
spy | cut -c7-11 | xargs kill
}