tom

Tweaking onos-* test scripts.

...@@ -50,8 +50,8 @@ perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onlab.onos/onos-feature ...@@ -50,8 +50,8 @@ perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onlab.onos/onos-feature
50 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg 50 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
51 51
52 # Patch the Apache Karaf distribution file to load ONOS features 52 # Patch the Apache Karaf distribution file to load ONOS features
53 -perl -pi.old -e 's|^(featuresBoot=.*)|\1,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-tvue,onos-app-fwd|' \ 53 +#perl -pi.old -e 's|^(featuresBoot=.*)|\1,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-tvue,onos-app-fwd|' \
54 - $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg 54 +# $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
55 55
56 # Patch the Apache Karaf distribution with ONOS branding bundle 56 # Patch the Apache Karaf distribution with ONOS branding bundle
57 cp $M2_REPO/org/onlab/onos/onos-branding/$ONOS_VERSION/onos-branding-*.jar \ 57 cp $M2_REPO/org/onlab/onos/onos-branding/$ONOS_VERSION/onos-branding-*.jar \
......
...@@ -45,20 +45,35 @@ alias gui='open http://localhost:8181/onos/tvue' ...@@ -45,20 +45,35 @@ alias gui='open http://localhost:8181/onos/tvue'
45 45
46 # Test related conveniences 46 # Test related conveniences
47 47
48 -# Default virtual box ONOS instances 1,2 & 3
49 -export OC1="192.168.56.101"
50 -export OC2="192.168.56.102"
51 -export OC3="192.168.56.103"
52 -
53 -# Default instance is #1
54 -export OCI="$OC1"
55 -
56 # SSH to a specified ONOS instance 48 # SSH to a specified ONOS instance
57 function sshctl { 49 function sshctl {
58 [ -n "$1" ] && OCI=$1 && shift 50 [ -n "$1" ] && OCI=$1 && shift
59 ssh -Y sdn@$OCI "$@" 51 ssh -Y sdn@$OCI "$@"
60 } 52 }
61 53
54 +# Applies the settings in the specified cell file or lists current cell definition
55 +# if no cell file is given.
56 +function cell {
57 + if [ -n "$1" ]; then
58 + [ ! -f $ONOS_ROOT/tools/test/cells/$1 ] && \
59 + echo "No such cell: $1" >&2 && return 1
60 + . $ONOS_ROOT/tools/test/cells/$1
61 + export OCI=$OC1
62 + export ONOS_CELL=$1
63 + cell
64 + else
65 + env | egrep "ONOS_CELL"
66 + env | egrep "OCI"
67 + env | egrep "OC[0-9]+" | sort
68 + fi
69 +}
70 +
71 +cell local >/dev/null # Default cell is the local VMs
72 +
73 +# Lists available cells
74 +function cells {
75 + ls -1 $ONOS_ROOT/tools/test/cells
76 +}
62 77
63 # Miscellaneous 78 # Miscellaneous
64 function spy { 79 function spy {
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
38 </aws> 38 </aws>
39 </join> 39 </join>
40 <interfaces enabled="true"> 40 <interfaces enabled="true">
41 - <interface>10.1.9.*</interface> 41 + <interface>192.168.56.*</interface>
42 </interfaces> 42 </interfaces>
43 <ssl enabled="false"/> 43 <ssl enabled="false"/>
44 <socket-interceptor enabled="false"/> 44 <socket-interceptor enabled="false"/>
......
...@@ -7,22 +7,60 @@ ...@@ -7,22 +7,60 @@
7 . $ONOS_ROOT/tools/build/envDefaults 7 . $ONOS_ROOT/tools/build/envDefaults
8 8
9 # If the first option is -f attempt uninstall first. 9 # If the first option is -f attempt uninstall first.
10 -[ "$1" = "-f" ] && shift && onos-uninstall ${1:-$OCI} 10 +[ "$1" = "-f" ] && shift && echo 'Uninstalling...' && onos-uninstall ${1:-$OCI}
11 11
12 remote=$ONOS_USER@${1:-$OCI} 12 remote=$ONOS_USER@${1:-$OCI}
13 13
14 scp -q $ONOS_TAR $remote:/tmp 14 scp -q $ONOS_TAR $remote:/tmp
15 15
16 +LOG=$ONOS_INSTALL_DIR/install.log
17 +onos=$ONOS_INSTALL_DIR/bin/onos
18 +
16 ssh $remote " 19 ssh $remote "
17 [ -d $ONOS_INSTALL_DIR/bin ] && echo \"ONOS is already installed\" && exit 1 20 [ -d $ONOS_INSTALL_DIR/bin ] && echo \"ONOS is already installed\" && exit 1
18 21
19 # Prepare a landing zone and unroll the bits 22 # Prepare a landing zone and unroll the bits
23 + echo 'Unpacking...'
20 sudo mkdir -p $ONOS_INSTALL_DIR && sudo chown sdn:sdn $ONOS_INSTALL_DIR 24 sudo mkdir -p $ONOS_INSTALL_DIR && sudo chown sdn:sdn $ONOS_INSTALL_DIR
21 tar zxmf /tmp/$ONOS_BITS.tar.gz -C $ONOS_INSTALL_DIR --strip-components=1 25 tar zxmf /tmp/$ONOS_BITS.tar.gz -C $ONOS_INSTALL_DIR --strip-components=1
22 26
23 # Make a link to the log file directory. 27 # Make a link to the log file directory.
24 - ln -s /opt/onos/$KARAF_DIST/data/log /opt/onos/log 28 + ln -s $ONOS_INSTALL_DIR/$KARAF_DIST/data/log /opt/onos/log
25 29
26 # TODO: Setup ONOS to run as a daemon; for now we at least startup 30 # TODO: Setup ONOS to run as a daemon; for now we at least startup
27 - nohup /opt/onos/bin/onos-ctl server </dev/null 1>/opt/onos/svc.log 2>&1 & 31 + echo 'Starting...'
32 + nohup $ONOS_INSTALL_DIR/bin/onos-ctl server </dev/null | 1>/opt/onos/svc.log 2>&1 &
33 +
34 + # Wait until we reach the run-level 100
35 + echo 'Waiting for cluster bootstrap...'
36 + running=""
37 + while [ -z \$running ]; do
38 + $onos bundle:list 2>>$LOG | grep -q 'START LEVEL 100' && running=1 || sleep 2
39 + done
40 +
41 + # Now create group onos and join it, while quitting the default one
42 + if ! $onos cluster:group-list 2>>$LOG | cut -d \\ -f3 | grep -q onos; then
43 + echo 'Creating ONOS group...'
44 + installRole=primary
45 + $onos cluster:group-create onos 1>>$LOG 2>&1
46 + fi
47 +
48 + echo 'Configuring group membership...'
49 + node=\$($onos cluster:node-list 2>>$LOG | grep '^x' | cut -d \\ -f3)
50 + $onos cluster:group-join onos \$node 1>>$LOG 2>&1
51 + $onos cluster:group-quit default \$node 1>>$LOG 2>&1
52 +
53 + if [ X\$installRole = Xprimary ]; then
54 + echo 'Installing ONOS bundles...'
55 + $onos cluster:feature-install onos onos-api 1>>$LOG 2>&1
56 + $onos cluster:feature-install onos onos-core 1>>$LOG 2>&1
57 + $onos cluster:feature-install onos onos-openflow 1>>$LOG 2>&1
58 + $onos cluster:feature-install onoe onos-cli 1>>$LOG 2>&1
59 + # $onos cluster:feature-install onos onos-gui 1>>$LOG 2>&1
60 + # $onos cluster:feature-install onos onos-rest 1>>$LOG 2>&1
61 + $onos cluster:feature-install onos onos-app-tvue 1>>$LOG 2>&1
62 + $onos cluster:feature-install onos onos-app-fwd 1>>$LOG 2>&1
63 + fi
64 +
65 + echo 'Started...'
28 " 66 "
......