blob: 5a35d9ec74a6c425ab9faf05fe85e1bc7a6eecc2 [file] [log] [blame]
Jonathan Hartd956f6f2013-02-01 14:41:17 -08001#!/bin/sh
2
3# Set paths
4FL_HOME=`dirname $0`
5FL_JAR="${FL_HOME}/target/floodlight.jar"
6FL_LOGBACK="${FL_HOME}/logback.xml"
7TITAN_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
20#CLASSPATH=`echo ${FL_HOME}/lib/*.jar ${FL_HOME}/lib/titan/*.jar | sed 's/ /:/g'`
21CLASSPATH="${FL_HOME}/lib/*.jar:${FL_HOME}/lib/titan/*.jar"
22
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
28cat <<EOF_LOGBACK >${FL_LOGBACK}
29<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
67#java ${JVM_OPTS} -Dlogback.configurationFile=${FL_LOGBACK} -Xbootclasspath/a:$CLASSPATH -jar ${FL_JAR} -cf ./onos.properties
68java ${JVM_OPTS} ${CASSANDRA_OPTS} -Dlogback.configurationFile=${FL_LOGBACK} -cp ${CLASSPATH} -jar ${FL_JAR}