fix a1-adapter-northbound startup
[sdnc/oam.git] / installation / sdnc / src / main / scripts / startODL.sh
index 5e294dd..f029e87 100755 (executable)
@@ -116,7 +116,9 @@ install_sdnr_oauth_features() {
 install_sdnr_northbound_features() {
   addToFeatureBoot "$SDNR_NORTHBOUND_BOOTFEATURES" 
 }
-
+install_a1_northbound_features() {
+  addToFeatureBoot "$A1_ADAPTER_NORTHBOUND_BOOTFEATURES"
+}
 # Reconfigure ODL from default single node configuration to cluster
 
 enable_odl_cluster() {
@@ -213,11 +215,14 @@ ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
 ODL_FEATURES_BOOT_FILE=$ODL_HOME/etc/org.apache.karaf.features.cfg
 
 ODL_ADMIN_USERNAME=${ODL_ADMIN_USERNAME:-admin}
-# do not start container if ADMIN_PASSWORD is not set
-if [ -z "$ODL_ADMIN_PASSWORD" ]; then
-  echo "ODL_ADMIN_PASSWORD is not set"
-  exit 1
+ODL_REMOVEIDMDB=${ODL_REMOVEIDMDB:-true}
+
+if $ODL_REMOVEIDMDB ; then
+  if [ -f $ODL_HOME/data/idmlight.db.mv.db ]; then 
+    rm $ODL_HOME/data/idmlight.db.mv.db
+  fi
 fi
+
 SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc}
 SDNC_BIN=${SDNC_BIN:-/opt/onap/sdnc/bin}
 # Whether to intialize MYSql DB or not. Default is to initialize
@@ -248,6 +253,9 @@ SDNRDBCOMMAND=${SDNRDBCOMMAND:--c init -db $SDNRDBURL -dbu $SDNRDBUSERNAME -dbp
 
 SDNR_NORTHBOUND=${SDNR_NORTHBOUND:-false}
 SDNR_NORTHBOUND_BOOTFEATURES=${SDNR_NORTHBOUND_BOOTFEATURES:-sdnr-northbound-all}
+A1_ADAPTER_NORTHBOUND=${A1_ADAPTER_NORTHBOUND:-true}
+A1_ADAPTER_NORTHBOUND_BOOTFEATURES=${A1_ADAPTER_NORTHBOUND_BOOTFEATURES:-a1-adapter-northbound}
+
 NOTOK=1
 #export for installCerts.py
 export ODL_ADMIN_PASSWORD ODL_ADMIN_USERNAME
@@ -322,6 +330,12 @@ if $SDNRINIT ; then
   fi
 fi
 
+# do not start container if ADMIN_PASSWORD is not set
+if [ -z "$ODL_ADMIN_PASSWORD" ]; then
+  echo "ODL_ADMIN_PASSWORD is not set"
+  exit 1
+fi
+
 # Check for MySQL DB connectivity only if SDNC_DB_INIT is set to "true" 
 if $SDNC_DB_INIT; then
 #
@@ -336,6 +350,7 @@ if $SDNC_DB_INIT; then
   printf "\nmysql ready"
 fi
 
+
 if [ ! -d "${INSTALLED_DIR}" ]
 then
     mkdir -p "${INSTALLED_DIR}"
@@ -360,12 +375,17 @@ then
     fi
 
   if $SDNRWT ; then install_sdnrwt_features ; fi
-  if $ENABLE_OAUTH ; then install_sdnr_oauth_features ; fi
+  if $ENABLE_OAUTH ; then
+    cp $SDNC_HOME/data/oauth-aaa-app-config.xml $ODL_HOME/system/org/opendaylight/aaa/aaa-shiro/0.12.1/aaa-shiro-0.12.1-aaa-app-config.xml
+    install_sdnr_oauth_features 
+  fi
   
   # The enable_odl_cluster call should not be moved above this line as the cleanFeatureBoot will overwrite entries. Ex: odl-jolokia
   if $ENABLE_ODL_CLUSTER ; then enable_odl_cluster ; fi
 
   if $SDNR_NORTHBOUND ; then install_sdnr_northbound_features ; fi
+  if $A1_ADAPTER_NORTHBOUND ; then install_a1_northbound_features ; fi
+  
   printf "%s" "Installed at $(date)" > "${SDNC_HOME}"/.installed
 fi