blob: 083262d294a6e74e14a274eca05e109189acffea [file] [log] [blame]
alshabibb7b40632014-09-28 21:30:00 -07001#!/bin/bash
Pavlin Radoslavov91413792014-10-15 11:00:32 -07002# -----------------------------------------------------------------------------
Ayaka Koshibebad156d2015-09-18 17:30:14 -07003# Starts a Mininet network topology connected to all nodes in a cell.
Pavlin Radoslavov91413792014-10-15 11:00:32 -07004# -----------------------------------------------------------------------------
alshabibb7b40632014-09-28 21:30:00 -07005
Ayaka Koshibebad156d2015-09-18 17:30:14 -07006function __usage() {
7cat << _EOM_
8
9usage:
10 $(basename $0) [file]
11
12options:
13 - [file] : a Mininet topology file. Default is *sol.py* .
14
15summary:
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
alshabibb7b40632014-09-28 21:30:00 -070027[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
28. $ONOS_ROOT/tools/build/envDefaults
29
30SSHCMD="ssh -o PasswordAuthentication=no"
31SCPCMD="scp -q -o PasswordAuthentication=no"
Ayaka Koshibebad156d2015-09-18 17:30:14 -070032topo=${1:-topos/sol.py}
alshabibb7b40632014-09-28 21:30:00 -070033
34echo "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
38echo "Starting Network."
Claudine Chiu45312d02016-06-15 13:17:12 +000039$SSHCMD -t $ONOS_USER@$OCN sudo python $topo $(env | sort | egrep "^OC[0-9]+" | cut -d= -f2)