Retain default behavior of startODL.sh script
Retain default behavior of startODL.sh in standalone environment
Issue-ID: SDNC-1374
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Change-Id: I95f02de192a4ae0f834d9eaf28c27e7a6d0be6f9
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Former-commit-id: c38b604d235010dad873a3f45948242bf0c65dda
diff --git a/installation/sdnc/src/main/scripts/startODL.sh b/installation/sdnc/src/main/scripts/startODL.sh
index 90aa807..57f3cbf 100755
--- a/installation/sdnc/src/main/scripts/startODL.sh
+++ b/installation/sdnc/src/main/scripts/startODL.sh
@@ -173,7 +173,8 @@
else
echo "This is a local cluster"
node_list=""
- if $OOM_ENABLED; then
+ # SERVICE_NAME and NAMESPACE are used to create cluster node names and are provided via Helm charts in OOM environment
+ if [ ! -z "$SERVICE_NAME" ] && [ ! -z "$NAMESPACE" ]; then
# Extract node name minus the index
# Example sdnr from "sdnr-2.logo.ost.das.r32.com"
node_name=($(echo ${fqdn} | sed 's/-[0-9].*$//g'))
@@ -182,7 +183,8 @@
node_list="${node_list} ${node_name}-$i.${SERVICE_NAME}-cluster.${NAMESPACE}"
done
${ODL_HOME}/bin/configure_cluster.sh $((node_index+1)) ${node_list}
- else
+ elif [ -z "$SERVICE_NAME" ] && [ -z "$NAMESPACE" ]; then
+ # Hostname is used in Standalone environment to create cluster node names
for ((i=0;i<${SDNC_REPLICAS};i++));
do
#assemble node list by replacing node-index in hostname with "i"
@@ -190,6 +192,13 @@
node_list="${node_list} ${node_name}"
done
${ODL_HOME}/bin/configure_cluster.sh $((node_index+1)) ${node_list}
+ else
+ echo "Unhandled cluster scenario. Terminating the container"
+ echo "Any one of the below 2 conditions should be satisfied for successfully enabling cluster mode : "
+ echo "1. OOM Environment - Both SERVICE_NAME and NAMESPACE environment variables have to be set."
+ echo "2. Docker (standalone) Environment - Neither of SERVICE_NAME and NAMESPACE have to be set."
+ echo "Current configuration - SERVICE_NAME = $SERVICE_NAME NAMESPACE = $NAMESPACE"
+ exit $NOTOK
fi
fi
}
@@ -216,6 +225,7 @@
ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
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
SDNC_DB_INIT=${SDNC_DB_INIT:-false}
CCSDK_HOME=${CCSDK_HOME:-/opt/onap/ccsdk}
JDEBUG=${JDEBUG:-false}
@@ -223,7 +233,6 @@
ENABLE_ODL_CLUSTER=${ENABLE_ODL_CLUSTER:-false}
GEO_ENABLED=${GEO_ENABLED:-false}
SDNC_AAF_ENABLED=${SDNC_AAF_ENABLED:-false}
-OOM_ENABLED=${OOM_ENABLED:-false}
IS_PRIMARY_CLUSTER=${IS_PRIMARY_CLUSTER:-false}
MY_ODL_CLUSTER=${MY_ODL_CLUSTER:-127.0.0.1}
INSTALLED_DIR=${INSTALLED_FILE:-/opt/opendaylight/current/daexim}
@@ -236,6 +245,7 @@
# Add devicemanager features
SDNRDM_SDM_LIST=${SDNRDM_SDM_LIST:-sdnr-wt-devicemanager-onf-feature}
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}
@@ -243,6 +253,7 @@
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
@@ -282,7 +293,8 @@
echo " PEER_ODL_CLUSTER=$PEER_ODL_CLUSTER"
echo " SDNR_NORTHBOUND=$SDNR_NORTHBOUND"
echo " AAF_ENABLED=$SDNC_AAF_ENABLED"
-echo " OOM_ENABLED=$OOM_ENABLED"
+echo " SERVICE_NAME=$SERVICE_NAME"
+echo " NAMESPACE=$NAMESPACE"
if $SDNC_AAF_ENABLED; then
export SDNC_AAF_STORE_DIR=/opt/app/osaaf/local
@@ -312,7 +324,8 @@
fi
fi
-if ! $OOM_ENABLED; then
+# Check for MySQL DB connectivity only if SDNC_DB_INIT is set to "true"
+if $SDNC_DB_INIT; then
#
# Wait for database
#
@@ -332,26 +345,21 @@
if [ ! -f ${SDNC_HOME}/.installed ]
then
- if ! $OOM_ENABLED; then
# for integration testing. In OOM, a separate job takes care of installing it.
if $SDNC_DB_INIT; then
echo "Installing SDN-C database"
${SDNC_HOME}/bin/installSdncDb.sh
fi
-
- #${CCSDK_HOME}/bin/installOdlHostKey.sh
+ echo "Installing SDN-C keyStore\n"
+ ${SDNC_HOME}/bin/addSdncKeyStore.sh
+ echo "Installing A1-adapter trustStore\n"
+ ${SDNC_HOME}/bin/addA1TrustStore.sh
if [ -x ${SDNC_HOME}/svclogic/bin/install.sh ]
then
echo "Installing directed graphs"
${SDNC_HOME}/svclogic/bin/install.sh
fi
- fi
-
- echo "Installing SDN-C keyStore"
- ${SDNC_HOME}/bin/addSdncKeyStore.sh
- echo "Installing A1-adapter trustStore"
- ${SDNC_HOME}/bin/addA1TrustStore.sh
if $ENABLE_ODL_CLUSTER ; then enable_odl_cluster ; fi
diff --git a/installation/src/main/yaml/docker-compose.yml b/installation/src/main/yaml/docker-compose.yml
index 96f9bb3..a8c561d 100644
--- a/installation/src/main/yaml/docker-compose.yml
+++ b/installation/src/main/yaml/docker-compose.yml
@@ -63,6 +63,7 @@
- ODL_CERT_DIR=/tmp
- ODL_ADMIN_USERNAME=admin
- ODL_ADMIN_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U
+ - SDNC_DB_INIT=true
- A1_TRUSTSTORE_PASSWORD=a1adapter
# The default truststore for A1 adapter can be overridden by mounting a new
# truststore (uncomment the lines below), whereas the corresponding password