blob: 7eef6f5f6e59c86bec48d59960380215c1d54e25 [file] [log] [blame]
Zack Williams2a287092016-05-18 13:41:31 -07001#!/bin/bash
2# -----------------------------------------------------------------------------
3# Starts ONOS Apache Karaf container
4# -----------------------------------------------------------------------------
5
6# uncomment the following line for performance testing
7#export JAVA_OPTS="${JAVA_OPTS:--Xms8G -Xmx8G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+PrintGCDetails -XX:+PrintGCTimeStamps}"
8
9# 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
Zack Williams2b946292016-08-22 15:32:29 -070013export JAVA_OPTS="-Djavax.net.ssl.trustStore=/usr/local/share/ca-certificates/xos-certs.jks -Djavax.net.ssl.trustStorePassword={{ trust_store_pw }}"
Zack Williams2a287092016-05-18 13:41:31 -070014
15set -e # exit on error
16set -u # exit on undefined variable
17
18# If ONOS_HOME is set, respect its value.
19# If ONOS_HOME is not set (e.g. in the init or service environment),
20# set it based on this script's path.
21ONOS_HOME=${ONOS_HOME:-$(cd $(dirname $0)/.. >/dev/null 2>&1 && pwd)}
22KARAF_ARGS=
23SYS_APPS=drivers
24ONOS_APPS=${ONOS_APPS:-} # Empty means don't activate any new apps
25
26cd $ONOS_HOME
27
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-3.0.5/bin/karaf $KARAF_ARGS