alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Pavlin Radoslavov | 9141379 | 2014-10-15 11:00:32 -0700 | [diff] [blame] | 2 | # ----------------------------------------------------------------------------- |
Ayaka Koshibe | bad156d | 2015-09-18 17:30:14 -0700 | [diff] [blame] | 3 | # Starts a Mininet network topology connected to all nodes in a cell. |
Pavlin Radoslavov | 9141379 | 2014-10-15 11:00:32 -0700 | [diff] [blame] | 4 | # ----------------------------------------------------------------------------- |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 5 | |
Ayaka Koshibe | bad156d | 2015-09-18 17:30:14 -0700 | [diff] [blame] | 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 | |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 27 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 28 | . $ONOS_ROOT/tools/build/envDefaults |
| 29 | |
| 30 | SSHCMD="ssh -o PasswordAuthentication=no" |
| 31 | SCPCMD="scp -q -o PasswordAuthentication=no" |
Ayaka Koshibe | bad156d | 2015-09-18 17:30:14 -0700 | [diff] [blame] | 32 | topo=${1:-topos/sol.py} |
alshabib | b7b4063 | 2014-09-28 21:30:00 -0700 | [diff] [blame] | 33 | |
| 34 | echo "Copying topology files to mininet vm." |
| 35 | $SSHCMD -n $ONOS_USER@$OCN mkdir -p topos |
| 36 | $SCPCMD $ONOS_ROOT/tools/test/topos/* $ONOS_USER@$OCN:topos/ |
| 37 | |
| 38 | echo "Starting Network." |
Claudine Chiu | 45312d0 | 2016-06-15 13:17:12 +0000 | [diff] [blame] | 39 | $SSHCMD -t $ONOS_USER@$OCN sudo python $topo $(env | sort | egrep "^OC[0-9]+" | cut -d= -f2) |