aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/tools/package/bin/onos-service
blob: 2f00ca02bb16f49c46aeb39afee56d62b41b520d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# -----------------------------------------------------------------------------
# Starts ONOS Apache Karaf container
# -----------------------------------------------------------------------------

# uncomment the following line for performance testing
#export JAVA_OPTS="${JAVA_OPTS:--Xms8G -Xmx8G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+PrintGCDetails -XX:+PrintGCTimeStamps}"

# uncomment the following line for Netty TLS encryption
# Do modify the keystore location/password and truststore location/password accordingly
#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}"

ONOS_HOME=/opt/onos
KARAF_ARGS=
SYS_APPS=drivers

[ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/..

# Parse out arguments destinted for karaf invocation v. arguments that
# will be processed in line
while [ $# -gt 0 ]; do
  case $1 in
    apps-clean)
      # Deactivate all applications
      find ${ONOS_HOME}/apps -name "active" -exec rm \{\} \;
      ;;
    *)
      KARAF_ARGS+=" $1"
      ;;
  esac
  shift
done

# Activate the system required applications (SYS_APPS) as well as any
# specified applications in the var ONOS_APPS
for app in ${SYS_APPS//,/ } ${ONOS_APPS//,/ }; do
  if [[ "$app" =~ \. ]]; then
    touch ${ONOS_HOME}/apps/$app/active
  else
    touch ${ONOS_HOME}/apps/org.onosproject.$app/active
  fi
done

exec ${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf $KARAF_ARGS