tom

Sketching cluster related stuff with Madan..

1 +# Environmental defaults for ONOS build, package and test
2 +
3 +# Root of the ONOS source tree
4 +export ONOS_ROOT=${ONOS_ROOT:-~/onos-next}
5 +
6 +# M2 repository and Karaf gold bits
7 +export M2_REPO=${M2_REPO:-~/.m2/repository}
8 +export KARAF_ZIP=${KARAF_ZIP:-~/Downloads/apache-karaf-3.0.1.zip}
9 +export KARAF_DIST=$(basename $KARAF_ZIP .zip)
10 +
11 +# ONOS Version and onos.tar.gz staging environment
12 +export ONOS_VERSION=${ONOS_VERSION:-1.0.0-SNAPSHOT}
13 +export ONOS_STAGE_ROOT=${ONOS_STAGE_ROOT:-/tmp}
14 +export ONOS_BITS=onos-$ONOS_VERSION
15 +export ONOS_STAGE=$ONOS_STAGE_ROOT/$ONOS_BITS
16 +export ONOS_TAR=$ONOS_STAGE.tar.gz
17 +
18 +# Defaults for ONOS testing using remote machines.
19 +export ONOS_INSTALL_DIR="/opt/onos" # Installation directory on remote
20 +export OCI="${OCI:-192.168.56.101}" # ONOS Controller Instance
21 +export ONOS_USER="sdn" # ONOS user on remote system
22 +export ONOS_PWD="rocks" # ONOS user password on remote system
...@@ -3,14 +3,8 @@ ...@@ -3,14 +3,8 @@
3 # Packages ONOS distributable into onos.tar.gz 3 # Packages ONOS distributable into onos.tar.gz
4 #------------------------------------------------------------------------------- 4 #-------------------------------------------------------------------------------
5 5
6 -export M2_REPO=${M2_REPO:-~/.m2/repository} 6 +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7 -export KARAF_ZIP=${KARAF_ZIP:-~/Downloads/apache-karaf-3.0.1.zip} 7 +. $ONOS_ROOT/tools/build/envDefaults
8 -export KARAF_DIST=$(basename $KARAF_ZIP .zip)
9 -
10 -export ONOS_VERSION=${ONOS_VERSION:-1.0.0-SNAPSHOT}
11 -export ONOS_STAGE_ROOT=${ONOS_STAGE_ROOT:-/tmp}
12 -export ONOS_BITS=onos-$ONOS_VERSION
13 -export ONOS_STAGE=$ONOS_STAGE_ROOT/$ONOS_BITS
14 8
15 # Bail on any errors 9 # Bail on any errors
16 set -e 10 set -e
...@@ -26,23 +20,24 @@ rm -fr $ONOS_STAGE # Remove this when package script is completed ...@@ -26,23 +20,24 @@ rm -fr $ONOS_STAGE # Remove this when package script is completed
26 mkdir -p $ONOS_STAGE 20 mkdir -p $ONOS_STAGE
27 cd $ONOS_STAGE 21 cd $ONOS_STAGE
28 22
29 -# Unroll the Apache Karaf bits, prune them and make the ONOS top-level directories. 23 +# Unroll the Apache Karaf bits, prune them and make ONOS top-level directories.
30 -unzip $KARAF_ZIP && rm -rm $KARAF_DIST/demos 24 +unzip -q $KARAF_ZIP && rm -rf $KARAF_DIST/demos
31 mkdir bin 25 mkdir bin
32 26
33 -# Stage the ONOS admin scripts 27 +# Stage the ONOS admin scripts and patch in Karaf service wrapper extras
34 cp -r $ONOS_ROOT/tools/package/bin . 28 cp -r $ONOS_ROOT/tools/package/bin .
29 +cp -r $ONOS_ROOT/tools/package/wrapper/* $KARAF_DIST
35 30
36 # Stage the ONOS bundles 31 # Stage the ONOS bundles
37 -mkdir -p system/org/onlab 32 +mkdir -p $KARAF_DIST/system/org/onlab
38 -cp -r $M2_REPO/org/onlab system/org/ 33 +cp -r $M2_REPO/org/onlab $KARAF_DIST/system/org/
39 34
40 # Patch the Apache Karaf distribution file to add ONOS features repository 35 # Patch the Apache Karaf distribution file to add ONOS features repository
41 perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onlab.onos/onos-features/$ONOS_VERSION/xml/features|" \ 36 perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onlab.onos/onos-features/$ONOS_VERSION/xml/features|" \
42 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg 37 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
43 38
44 # Patch the Apache Karaf distribution file to load ONOS features 39 # Patch the Apache Karaf distribution file to load ONOS features
45 -perl -pi.old -e 's|^(featuresBoot=.*)|\1,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-tvue|' \ 40 +perl -pi.old -e 's|^(featuresBoot=.*)|\1,wrapper,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-tvue|' \
46 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg 41 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
47 42
48 # Patch the Apache Karaf distribution with ONOS branding bundle 43 # Patch the Apache Karaf distribution with ONOS branding bundle
...@@ -51,4 +46,5 @@ cp $M2_REPO/org/onlab/onos/onos-branding/$ONOS_VERSION/onos-branding-*.jar \ ...@@ -51,4 +46,5 @@ cp $M2_REPO/org/onlab/onos/onos-branding/$ONOS_VERSION/onos-branding-*.jar \
51 46
52 # Now package up the ONOS tar file 47 # Now package up the ONOS tar file
53 cd $ONOS_STAGE_ROOT 48 cd $ONOS_STAGE_ROOT
54 -tar zcf $ONOS_BITS.tar.gz $ONOS_BITS 49 +COPYFILE_DISABLE=1 tar zcf $ONOS_TAR $ONOS_BITS
50 +ls -l $ONOS_TAR >&2
......
...@@ -12,7 +12,8 @@ export KARAF_LOG=$KARAF/data/log/karaf.log ...@@ -12,7 +12,8 @@ export KARAF_LOG=$KARAF/data/log/karaf.log
12 12
13 # Setup a path 13 # Setup a path
14 export PS=":" 14 export PS=":"
15 -export PATH="$PATH:$ONOS_ROOT/tools/dev:$ONOS_ROOT/tools/package" 15 +export PATH="$PATH:$ONOS_ROOT/tools/dev:$ONOS_ROOT/tools/build"
16 +export PATH="$PATH:$ONOS_ROOT/tools/test/bin"
16 export PATH="$PATH:$MAVEN/bin:$KARAF/bin" 17 export PATH="$PATH:$MAVEN/bin:$KARAF/bin"
17 export PATH="$PATH:." 18 export PATH="$PATH:."
18 19
...@@ -39,3 +40,13 @@ alias pp='python -m json.tool' ...@@ -39,3 +40,13 @@ alias pp='python -m json.tool'
39 # Short-hand to launch API docs and sample topology viewer GUI 40 # Short-hand to launch API docs and sample topology viewer GUI
40 alias docs='open $ONOS_ROOT/target/site/apidocs/index.html' 41 alias docs='open $ONOS_ROOT/target/site/apidocs/index.html'
41 alias gui='open http://localhost:8181/onos/tvue' 42 alias gui='open http://localhost:8181/onos/tvue'
43 +
44 +
45 +# Miscellaneous
46 +function spy {
47 + ps -ef | egrep "$@" | grep -v egrep
48 +}
49 +
50 +function nuke {
51 + spy | cut -c7-11 | xargs kill
52 +}
......
1 +Artifacts for packaging onos.tar.gz.
1 +#!/bin/bash
2 +#-------------------------------------------------------------------------------
3 +# ONOS command-line client
4 +#-------------------------------------------------------------------------------
5 +
6 +export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
7 +
8 +cd $(dirname $0)/../apache-karaf-*/bin
9 +./client -h localhost "$@"
10 +
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
3 # Starts ONOS Apache Karaf container 3 # Starts ONOS Apache Karaf container
4 #------------------------------------------------------------------------------- 4 #-------------------------------------------------------------------------------
5 5
6 +export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
7 +
6 cd $(dirname $0)/../apache-karaf-*/bin 8 cd $(dirname $0)/../apache-karaf-*/bin
7 ./karaf "$@" 9 ./karaf "$@"
8 10
......
This diff is collapsed. Click to expand it.
No preview for this file type
1 +# ------------------------------------------------------------------------
2 +# Licensed to the Apache Software Foundation (ASF) under one or more
3 +# contributor license agreements. See the NOTICE file distributed with
4 +# this work for additional information regarding copyright ownership.
5 +# The ASF licenses this file to You under the Apache License, Version 2.0
6 +# (the "License"); you may not use this file except in compliance with
7 +# the License. You may obtain a copy of the License at
8 +#
9 +# http://www.apache.org/licenses/LICENSE-2.0
10 +#
11 +# Unless required by applicable law or agreed to in writing, software
12 +# distributed under the License is distributed on an "AS IS" BASIS,
13 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 +# See the License for the specific language governing permissions and
15 +# limitations under the License.
16 +# ------------------------------------------------------------------------
17 +
18 +#********************************************************************
19 +# Wrapper Properties
20 +#********************************************************************
21 +set.default.JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
22 +set.default.KARAF_HOME=/opt/onos/apache-karaf-3.0.1
23 +set.default.KARAF_BASE=/opt/onos/apache-karaf-3.0.1
24 +set.default.KARAF_DATA=/opt/onos/apache-karaf-3.0.1/data
25 +set.default.KARAF_ETC=/opt/onos/apache-karaf-3.0.1/etc
26 +
27 +# Java Application
28 +wrapper.working.dir=%KARAF_BASE%
29 +wrapper.java.command=%JAVA_HOME%/bin/java
30 +wrapper.java.mainclass=org.apache.karaf.wrapper.internal.Main
31 +wrapper.java.classpath.1=%KARAF_HOME%/lib/karaf-wrapper.jar
32 +wrapper.java.classpath.2=%KARAF_HOME%/lib/karaf.jar
33 +wrapper.java.classpath.3=%KARAF_HOME%/lib/karaf-jmx-boot.jar
34 +wrapper.java.classpath.4=%KARAF_HOME%/lib/karaf-jaas-boot.jar
35 +wrapper.java.classpath.5=%KARAF_HOME%/lib/karaf-wrapper-main.jar
36 +wrapper.java.classpath.6=%KARAF_HOME%/lib/karaf-org.osgi.core.jar
37 +wrapper.java.library.path.1=%KARAF_HOME%/lib/
38 +
39 +# Application Parameters. Add parameters as needed starting from 1
40 +#wrapper.app.parameter.1=
41 +
42 +# JVM Parameters
43 +# note that n is the parameter number starting from 1.
44 +wrapper.java.additional.1=-Dkaraf.home=%KARAF_HOME%
45 +wrapper.java.additional.2=-Dkaraf.base=%KARAF_BASE%
46 +wrapper.java.additional.3=-Dkaraf.data=%KARAF_DATA%
47 +wrapper.java.additional.4=-Dkaraf.etc=%KARAF_ETC%
48 +wrapper.java.additional.5=-Dcom.sun.management.jmxremote
49 +wrapper.java.additional.6=-Djavax.management.builder.initial=org.apache.karaf.management.boot.KarafMBeanServerBuilder
50 +wrapper.java.additional.7=-Dkaraf.startLocalConsole=false
51 +wrapper.java.additional.8=-Dkaraf.startRemoteShell=true
52 +wrapper.java.additional.9=-Djava.endorsed.dirs=%JAVA_HOME%/jre/lib/endorsed:%JAVA_HOME%/lib/endorsed:%KARAF_HOME%/lib/endorsed
53 +wrapper.java.additional.10=-Djava.ext.dirs=%JAVA_HOME%/jre/lib/ext:%JAVA_HOME%/lib/ext:%KARAF_HOME%/lib/ext
54 +
55 +# Uncomment to enable jmx
56 +#wrapper.java.additional.n=-Dcom.sun.management.jmxremote.port=1616
57 +#wrapper.java.additional.n=-Dcom.sun.management.jmxremote.authenticate=false
58 +#wrapper.java.additional.n=-Dcom.sun.management.jmxremote.ssl=false
59 +
60 +# Uncomment to enable YourKit profiling
61 +#wrapper.java.additional.n=-Xrunyjpagent
62 +
63 +# Uncomment to enable remote debugging
64 +#wrapper.java.additional.n=-Xdebug -Xnoagent -Djava.compiler=NONE
65 +#wrapper.java.additional.n=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
66 +
67 +# Initial Java Heap Size (in MB)
68 +#wrapper.java.initmemory=3
69 +
70 +# Maximum Java Heap Size (in MB)
71 +wrapper.java.maxmemory=512
72 +
73 +
74 +#********************************************************************
75 +# Wrapper Logging Properties
76 +#********************************************************************
77 +# Format of output for the console. (See docs for formats)
78 +wrapper.console.format=PM
79 +
80 +# Log Level for console output. (See docs for log levels)
81 +wrapper.console.loglevel=INFO
82 +
83 +# Log file to use for wrapper output logging.
84 +wrapper.logfile=%KARAF_DATA%/log/wrapper.log
85 +
86 +# Format of output for the log file. (See docs for formats)
87 +wrapper.logfile.format=LPTM
88 +
89 +# Log Level for log file output. (See docs for log levels)
90 +wrapper.logfile.loglevel=INFO
91 +
92 +# Maximum size that the log file will be allowed to grow to before
93 +# the log is rolled. Size is specified in bytes. The default value
94 +# of 0, disables log rolling. May abbreviate with the 'k' (kb) or
95 +# 'm' (mb) suffix. For example: 10m = 10 megabytes.
96 +wrapper.logfile.maxsize=10m
97 +
98 +# Maximum number of rolled log files which will be allowed before old
99 +# files are deleted. The default value of 0 implies no limit.
100 +wrapper.logfile.maxfiles=5
101 +
102 +# Log Level for sys/event log output. (See docs for log levels)
103 +wrapper.syslog.loglevel=NONE
104 +
105 +#********************************************************************
106 +# Wrapper Windows Properties
107 +#********************************************************************
108 +# Title to use when running as a console
109 +wrapper.console.title=onos
110 +
111 +#********************************************************************
112 +# Wrapper Windows NT/2000/XP Service Properties
113 +#********************************************************************
114 +# WARNING - Do not modify any of these properties when an application
115 +# using this configuration file has been installed as a service.
116 +# Please uninstall the service before modifying this section. The
117 +# service can then be reinstalled.
118 +
119 +# Name of the service
120 +wrapper.ntservice.name=onos
121 +
122 +# Display name of the service
123 +wrapper.ntservice.displayname=onos
124 +
125 +# Description of the service
126 +wrapper.ntservice.description=ONOS
127 +
128 +# Service dependencies. Add dependencies as needed starting from 1
129 +wrapper.ntservice.dependency.1=
130 +
131 +# Mode in which the service is installed. AUTO_START or DEMAND_START
132 +wrapper.ntservice.starttype=AUTO_START
133 +
134 +# Allow the service to interact with the desktop.
135 +wrapper.ntservice.interactive=false
1 +Artifacts for system testing onos.
1 +#!/bin/bash
2 +#-------------------------------------------------------------------------------
3 +# Remotely install & starts ONOS.
4 +#-------------------------------------------------------------------------------
5 +
6 +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7 +. $ONOS_ROOT/tools/build/envDefaults
8 +
9 +remote=$ONOS_USER@${1:-$OCI}
10 +
11 +ssh $remote "
12 + [ -d $ONOS_INSTALL_DIR ] && echo \"ONOS is already installed\" && exit 1
13 +
14 + sudo mkdir $ONOS_INSTALL_DIR && sudo chown sdn:sdn $ONOS_INSTALL_DIR
15 + tar zxmf /tmp/$ONOS_BITS.tar.gz -C $ONOS_INSTALL_DIR --strip-components=1
16 +
17 +"
1 +#!/bin/bash
2 +#-------------------------------------------------------------------------------
3 +# Remotely stops & uninstalls ONOS.
4 +#-------------------------------------------------------------------------------
5 +
6 +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7 +. $ONOS_ROOT/tools/build/envDefaults
8 +
9 +remote=$ONOS_USER@${1:-$OCI}
10 +
11 +ssh $remote "
12 + [ -f $ONOS_INSTALL_DIR/bin/onos ] && $ONOS_INSTALL_DIR/bin/onos halt
13 + sudo rm -fr $ONOS_INSTALL_DIR
14 +"
1 +#!/bin/bash
2 +#-------------------------------------------------------------------------------
3 +# Pushes ONOS distributable bits in onos.tar.gz to a remote machine.
4 +#-------------------------------------------------------------------------------
5 +
6 +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7 +. $ONOS_ROOT/tools/build/envDefaults
8 +
9 +remote=$ONOS_USER@${1:-$OCI}
10 +
11 +scp $ONOS_TAR $remote:/tmp