blob: 5cc20093ca31a25ba31b12f17cb8ce727ad48f49 [file] [log] [blame]
tom4d0c6632014-09-15 23:27:01 -07001#!/bin/bash
Pavlin Radoslavov91413792014-10-15 11:00:32 -07002# -----------------------------------------------------------------------------
tom4d0c6632014-09-15 23:27:01 -07003# Starts ONOS Apache Karaf container
Pavlin Radoslavov91413792014-10-15 11:00:32 -07004# -----------------------------------------------------------------------------
tom4d0c6632014-09-15 23:27:01 -07005
Brian O'Connor9362d882015-03-10 11:56:35 -07006# uncomment the following line for performance testing
7#export JAVA_OPTS="${JAVA_OPTS:--Xms8G -Xmx8G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+PrintGCDetails -XX:+PrintGCTimeStamps}"
tom5c255702014-09-18 06:57:39 -07008
JunHuy Lam39eb4292015-06-26 17:24:23 +09009# uncomment the following line for Netty TLS encryption
10# Do modify the keystore location/password and truststore location/password accordingly
11#export JAVA_OPTS="${JAVA_OPTS:--DenableNettyTLS=true -Djavax.net.ssl.keyStore=/home/ubuntu/onos.jks -Djavax.net.ssl.keyStorePassword=222222 -Djavax.net.ssl.trustStore=/home/ubuntu/onos.jks -Djavax.net.ssl.trustStorePassword=222222}"
12
Thomas Vachuska045c01d2014-12-04 00:18:06 -080013ONOS_HOME=/opt/onos
David Bainbridgeff4fb042015-08-17 12:53:29 -070014KARAF_ARGS=
15SYS_APPS=drivers
Jian Li7343bfa2016-01-27 15:42:05 -080016CURRENT_ONOS_HOME="`( cd $(dirname $0)/.. && pwd )`"
17
18# check whether executable onos binary is located under /opt/onos
19# if not try to reconfigure ONOS_HOME with current path
20if [ $CURRENT_ONOS_HOME != $ONOS_HOME ]; then
21 ONOS_HOME=$CURRENT_ONOS_HOME
22fi
23
24echo $ONOS_HOME
Thomas Vachuska045c01d2014-12-04 00:18:06 -080025
26[ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/..
David Bainbridgeff4fb042015-08-17 12:53:29 -070027
28# Parse out arguments destinted for karaf invocation v. arguments that
29# will be processed in line
30while [ $# -gt 0 ]; do
31 case $1 in
32 apps-clean)
33 # Deactivate all applications
34 find ${ONOS_HOME}/apps -name "active" -exec rm \{\} \;
35 ;;
36 *)
37 KARAF_ARGS+=" $1"
38 ;;
39 esac
40 shift
41done
42
43# Activate the system required applications (SYS_APPS) as well as any
44# specified applications in the var ONOS_APPS
45for app in ${SYS_APPS//,/ } ${ONOS_APPS//,/ }; do
46 if [[ "$app" =~ \. ]]; then
47 touch ${ONOS_HOME}/apps/$app/active
48 else
49 touch ${ONOS_HOME}/apps/org.onosproject.$app/active
50 fi
51done
52
53exec ${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf $KARAF_ARGS