Committed by
Gerrit Code Review
onos-* scripts
o usage functions as precursor to more documentable scripts o `onos-start-network` takes mininet script as parameter o alias `tail -r` to `tac` for OS X Change-Id: I88e0fd16ca4b406f4250be88b275eda4d720b5d5
Showing
2 changed files
with
44 additions
and
2 deletions
| ... | @@ -3,6 +3,25 @@ | ... | @@ -3,6 +3,25 @@ |
| 3 | # Checks the logs of the remote ONOS instance and makes sure they are clean. | 3 | # Checks the logs of the remote ONOS instance and makes sure they are clean. |
| 4 | # ----------------------------------------------------------------------------- | 4 | # ----------------------------------------------------------------------------- |
| 5 | 5 | ||
| 6 | +function __usage() { | ||
| 7 | +cat << _EOM_ | ||
| 8 | + | ||
| 9 | +usage: | ||
| 10 | + $(basename $0) [node] ['old'] | ||
| 11 | + | ||
| 12 | +options: | ||
| 13 | + - [node] : The node whose logs to inspect. The default is \$OCI. | ||
| 14 | + - ['old'] : If 'old' is specified, the logs are simply searched for errors | ||
| 15 | + and exceptions, and they are displayed. | ||
| 16 | + | ||
| 17 | +summary: | ||
| 18 | + Checks the logs of the remote ONOS instance and makes sure they are clean. | ||
| 19 | + | ||
| 20 | +_EOM_ | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +[ "$1" = "-h" ] && __usage && exit 0 | ||
| 24 | + | ||
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 25 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 7 | . $ONOS_ROOT/tools/build/envDefaults | 26 | . $ONOS_ROOT/tools/build/envDefaults |
| 8 | 27 | ||
| ... | @@ -17,6 +36,7 @@ if [ "$2" = "old" ]; then | ... | @@ -17,6 +36,7 @@ if [ "$2" = "old" ]; then |
| 17 | 36 | ||
| 18 | else | 37 | else |
| 19 | ssh $remote " | 38 | ssh $remote " |
| 39 | + [ "'`uname`'" != "'"Linux"'" ] && alias tac='tail -r' | ||
| 20 | tac $LOG | awk ' | 40 | tac $LOG | awk ' |
| 21 | BEGIN { off = 0; fail = 0; } | 41 | BEGIN { off = 0; fail = 0; } |
| 22 | / org.apache.karaf.main.lock.SimpleFileLock lock/ { | 42 | / org.apache.karaf.main.lock.SimpleFileLock lock/ { | ... | ... |
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- | 2 | # ----------------------------------------------------------------------------- |
| 3 | -# Verifies connectivity to each node in ONOS cell. | 3 | +# Starts a Mininet network topology connected to all nodes in a cell. |
| 4 | # ----------------------------------------------------------------------------- | 4 | # ----------------------------------------------------------------------------- |
| 5 | 5 | ||
| 6 | +function __usage() { | ||
| 7 | +cat << _EOM_ | ||
| 8 | + | ||
| 9 | +usage: | ||
| 10 | + $(basename $0) [file] | ||
| 11 | + | ||
| 12 | +options: | ||
| 13 | + - [file] : a Mininet topology file. Default is *sol.py* . | ||
| 14 | + | ||
| 15 | +summary: | ||
| 16 | + Starts a Mininet network topology connected to all nodes in a cell. | ||
| 17 | + | ||
| 18 | + Currently, all topology files are assumed to be found in | ||
| 19 | + \$OCN's ~/topos directory. Therefore [file] must be specified as | ||
| 20 | + topos/filename. | ||
| 21 | + | ||
| 22 | +_EOM_ | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +[ "$1" = "-h" ] && __usage && exit 0 | ||
| 26 | + | ||
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 27 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 7 | . $ONOS_ROOT/tools/build/envDefaults | 28 | . $ONOS_ROOT/tools/build/envDefaults |
| 8 | 29 | ||
| 9 | SSHCMD="ssh -o PasswordAuthentication=no" | 30 | SSHCMD="ssh -o PasswordAuthentication=no" |
| 10 | SCPCMD="scp -q -o PasswordAuthentication=no" | 31 | SCPCMD="scp -q -o PasswordAuthentication=no" |
| 32 | +topo=${1:-topos/sol.py} | ||
| 11 | 33 | ||
| 12 | echo "Copying topology files to mininet vm." | 34 | echo "Copying topology files to mininet vm." |
| 13 | $SSHCMD -n $ONOS_USER@$OCN mkdir -p topos | 35 | $SSHCMD -n $ONOS_USER@$OCN mkdir -p topos |
| 14 | $SCPCMD $ONOS_ROOT/tools/test/topos/* $ONOS_USER@$OCN:topos/ | 36 | $SCPCMD $ONOS_ROOT/tools/test/topos/* $ONOS_USER@$OCN:topos/ |
| 15 | 37 | ||
| 16 | echo "Starting Network." | 38 | echo "Starting Network." |
| 17 | -$SSHCMD -t $ONOS_USER@$OCN sudo python topos/sol.py $(env | sort | egrep "OC[0-9]+" | cut -d= -f2) | 39 | +$SSHCMD -t $ONOS_USER@$OCN sudo python $topo $(env | sort | egrep "OC[0-9]+" | cut -d= -f2) | ... | ... |
-
Please register or login to post a comment