+INSTALLED_DIR=${INSTALLED_FILE:-/opt/opendaylight/current/daexim}
+SDNRWT=${SDNRWT:-false}
+SDNRWT_BOOTFEATURES=${SDNRWT_BOOTFEATURES:-sdnr-wt-feature-aggregator}
+SDNRDM=${SDNRDM:-false}
+# Add devicemanager base and specific repositories
+SDNRDM_BASE_REPO=${SDNRDM_BASE_REPO:-mvn:org.onap.ccsdk.features.sdnr.wt/sdnr-wt-feature-aggregator-devicemanager-base/$CCSDKFEATUREVERSION/xml/features}
+# Add devicemanager features
+SDNRDM_SDM_LIST=${SDNRDM_SDM_LIST:-sdnr-wt-feature-aggregator-devicemanager}
+SDNRDM_BOOTFEATURES=${SDNRDM_BOOTFEATURES:-sdnr-wt-feature-aggregator-devicemanager-base, ${SDNRDM_SDM_LIST}}
+# Whether to Initialize the ElasticSearch DB.
+SDNRINIT=${SDNRINIT:-false}
+SDNRONLY=${SDNRONLY:-false}
+SDNRDBURL=${SDNRDBURL:-http://sdnrdb:9200}
+SDNRDBCOMMAND=${SDNRDBCOMMAND:--c init -db $SDNRDBURL -dbu $SDNRDBUSERNAME -dbp $SDNRDBPASSWORD $SDNRDBPARAMETER}
+
+SDNR_NORTHBOUND=${SDNR_NORTHBOUND:-false}
+SDNR_NORTHBOUND_BOOTFEATURES=${SDNR_NORTHBOUND_BOOTFEATURES:-sdnr-northbound-all}
+NOTOK=1
+export ODL_ADMIN_PASSWORD ODL_ADMIN_USERNAME
+
+if $JDEBUG ; then
+ printf "Activate remote debugging\n"
+ #JSTADTPOLICYFILE="$ODL_HOME/etc/tools.policy"
+ #echo -e "grant codebase \"file:${JAVA_HOME}/lib/tools.jar\" {\n permission java.security.AllPermission;\n };" > $JSTADTPOLICYFILE
+ #sleep 1
+ #$JAVA_HOME/bin/jstatd -p 1089 -J-Djava.security.policy=$JSTADTPOLICYFILE &
+ EXTRA_JAVA_OPTS="${EXTRA_JAVA_OPTS} -Dcom.sun.management.jmxremote.port=1090"
+ EXTRA_JAVA_OPTS="${EXTRA_JAVA_OPTS} -Dcom.sun.management.jmxremote.rmi.port=1090"
+ EXTRA_JAVA_OPTS="${EXTRA_JAVA_OPTS} -Djava.rmi.server.hostname=$(hostname) "
+ EXTRA_JAVA_OPTS="${EXTRA_JAVA_OPTS} -Dcom.sun.management.jmxremote.local.only=false"
+ EXTRA_JAVA_OPTS="${EXTRA_JAVA_OPTS} -Dcom.sun.management.jmxremote.ssl=false"
+ EXTRA_JAVA_OPTS="${EXTRA_JAVA_OPTS} -Dcom.sun.management.jmxremote.authenticate=false"
+ export EXTRA_JAVA_OPTS
+fi
+
+
+printf "Settings:\n"
+printf "%s\n" " SDNC_BIN=$SDNC_BIN"
+printf "%s\n" " SDNC_HOME=$SDNC_HOME"
+printf "%s\n" " SDNC_DB_INIT=$SDNC_DB_INIT"
+printf "%s\n" " ODL_CERT_DIR=$ODL_CERT_DIR"
+printf "%s\n" " CCSDKFEATUREVERSION=$CCSDKFEATUREVERSION"
+printf "%s\n" " ENABLE_ODL_CLUSTER=$ENABLE_ODL_CLUSTER"
+printf "%s\n" " ODL_REMOVEIDMDB=$ODL_REMOVEIDMDB"
+printf "%s\n" " SDNC_REPLICAS=$SDNC_REPLICAS"
+printf "%s\n" " SDNRWT=$SDNRWT"
+printf "%s\n" " SDNRDM=$SDNRDM"
+printf "%s\n" " SDNRONLY=$SDNRONLY"
+printf "%s\n" " SDNRINIT=$SDNRINIT"
+printf "%s\n" " SDNRDBURL=$SDNRDBURL"
+printf "%s\n" " SDNRDBUSERNAME=$SDNRDBUSERNAME"
+printf "%s\n" " GEO_ENABLED=$GEO_ENABLED"
+printf "%s\n" " IS_PRIMARY_CLUSTER=$IS_PRIMARY_CLUSTER"
+printf "%s\n" " MY_ODL_CLUSTER=$MY_ODL_CLUSTER"
+printf "%s\n" " PEER_ODL_CLUSTER=$PEER_ODL_CLUSTER"
+printf "%s\n" " SDNR_NORTHBOUND=$SDNR_NORTHBOUND"
+printf "%s\n" " AAF_ENABLED=$SDNC_AAF_ENABLED"
+printf "%s\n" " SERVICE_NAME=$SERVICE_NAME"
+printf "%s\n" " NAMESPACE=$NAMESPACE"
+
+if "$SDNC_AAF_ENABLED"; then
+ export SDNC_AAF_STORE_DIR=/opt/app/osaaf/local
+ export SDNC_AAF_CONFIG_DIR=/opt/app/osaaf/local
+ export SDNC_KEYPASS=$(cat /opt/app/osaaf/local/.pass)
+ export SDNC_KEYSTORE=org.onap.sdnc.p12
+ sed -i '/cadi_prop_files/d' "$ODL_HOME"/etc/system.properties
+ echo "cadi_prop_files=$SDNC_AAF_CONFIG_DIR/org.onap.sdnc.props" >> "$ODL_HOME"/etc/system.properties
+
+ sed -i '/org.ops4j.pax.web.ssl.keystore/d' "$ODL_HOME"/etc/custom.properties
+ sed -i '/org.ops4j.pax.web.ssl.password/d' "$ODL_HOME"/etc/custom.properties
+ sed -i '/org.ops4j.pax.web.ssl.keypassword/d' "$ODL_HOME"/etc/custom.properties
+ echo "org.ops4j.pax.web.ssl.keystore=$SDNC_AAF_STORE_DIR/$SDNC_KEYSTORE" >> "$ODL_HOME"/etc/custom.properties
+ echo "org.ops4j.pax.web.ssl.password=$SDNC_KEYPASS" >> "$ODL_HOME"/etc/custom.properties
+ echo "org.ops4j.pax.web.ssl.keypassword=$SDNC_KEYPASS" >> "$ODL_HOME"/etc/custom.properties
+fi
+
+if $SDNRINIT ; then
+ #One time intialization action
+ initialize_sdnr
+ init_result=$?
+ printf "%s\n" "Result of init script: $init_result"
+ if $SDNRWT ; then
+ printf "Proceed to initialize sdnr\n"
+ else
+ exit $init_result
+ fi
+fi