blob: fe0db44c6bf0f79b82270dc425a052a5f6b8cfa6 [file] [log] [blame]
Jonathan Hartd956f6f2013-02-01 14:41:17 -08001#!/bin/sh
2
3# Set paths
Masayoshi Kobayashi20224872013-06-20 17:00:17 -07004ONOS_HOME=`dirname $0`
5ONOS_JAR="${ONOS_HOME}/target/floodlight.jar"
6ONOS_LOGBACK="${ONOS_HOME}/logback.xml"
Jonathan Hartd956f6f2013-02-01 14:41:17 -08007TITAN_CONFIG="/tmp/cassandra.titan"
8CASSANDRA_CONFIG="/home/`whoami`/apache-cassandra-1.1.4/conf/cassandra.yaml"
9
10# Set JVM options
11JVM_OPTS=""
12#JVM_OPTS="$JVM_OPTS -server -d64"
13#JVM_OPTS="$JVM_OPTS -Xmx2g -Xms2g -Xmn800m"
14#JVM_OPTS="$JVM_OPTS -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods"
15#JVM_OPTS="$JVM_OPTS -XX:MaxInlineSize=8192 -XX:FreqInlineSize=8192"
16#JVM_OPTS="$JVM_OPTS -XX:CompileThreshold=1500 -XX:PreBlockSpin=8"
17#JVM_OPTS="$JVM_OPTS -Dpython.security.respectJavaAccessibility=false"
18
19# Set classpath to include titan libs
Masayoshi Kobayashi20224872013-06-20 17:00:17 -070020#CLASSPATH=`echo ${ONOS_HOME}/lib/*.jar ${ONOS_HOME}/lib/titan/*.jar | sed 's/ /:/g'`
21CLASSPATH="${ONOS_HOME}/lib/*.jar:${ONOS_HOME}/lib/titan/*.jar"
Jonathan Hartd956f6f2013-02-01 14:41:17 -080022
23CASSANDRA_OPTS="-Dcom.sun.management.jmxremote.port=7199"
24CASSANDRA_OPTS="$CASSANDRA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
25CASSANDRA_OPTS="$CASSANDRA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
26
27# Create a logback file if required
Masayoshi Kobayashi20224872013-06-20 17:00:17 -070028cat <<EOF_LOGBACK >${ONOS_LOGBACK}
Jonathan Hartd956f6f2013-02-01 14:41:17 -080029<configuration scan="true" debug="true">
30 <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
31 <encoder>
32 <pattern>%level [%logger:%thread] %msg%n</pattern>
33 </encoder>
34 </appender>
35
36 <appender name="FILE" class="ch.qos.logback.core.FileAppender">
37 <file>onos.log</file>
38 <encoder>
39 <pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
40 </encoder>
41 </appender>
42
43 <logger name="org" level="WARN"/>
44 <logger name="LogService" level="WARN"/> <!-- Restlet access logging -->
45 <logger name="net.floodlightcontroller.logging" level="WARN"/>
46
47 <root level="DEBUG">
48 <appender-ref ref="STDOUT" />
49 <appender-ref ref="FILE" />
50 </root>
51</configuration>
52EOF_LOGBACK
53
54cat <<EOF_TITAN >${TITAN_CONFIG}
55storage.backend=embeddedcassandra
56storage.hostname=127.0.0.1
57storage.keyspace=onos
58storage.cassandra-config-dir=file://${CASSANDRA_CONFIG}
59EOF_TITAN
60
61# Clear logs
62rm onos.log
63
64# Run floodlight
65echo "Starting ONOS controller ..."
66echo
Masayoshi Kobayashi20224872013-06-20 17:00:17 -070067#java ${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -Xbootclasspath/a:$CLASSPATH -jar ${ONOS_JAR} -cf ./onos.properties
68java ${JVM_OPTS} ${CASSANDRA_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -jar ${ONOS_JAR}