X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=installation%2Fsdnc%2Fsrc%2Fmain%2Fscripts%2FstartODL.sh;h=d12230278f5f940fd7f8a877a6658f16b2519de8;hb=fccfb7f10a74d6e8961b3f1550321b77ee073fbc;hp=ea46c2ee0d48784c8bb63b67312b3a41f7e23be4;hpb=949fb49609a58e2f31e708a76013076856e5ed49;p=sdnc%2Foam.git diff --git a/installation/sdnc/src/main/scripts/startODL.sh b/installation/sdnc/src/main/scripts/startODL.sh index ea46c2ee..d1223027 100755 --- a/installation/sdnc/src/main/scripts/startODL.sh +++ b/installation/sdnc/src/main/scripts/startODL.sh @@ -101,7 +101,6 @@ install_sdnrwt_features() { # Repository setup provided via sdnc dockerfile if $SDNRWT; then addRepository "$SDNRDM_BASE_REPO" - addRepository "$SDNRDM_ONF_REPO" if $SDNRONLY; then cleanupFeatureBoot @@ -174,23 +173,32 @@ enable_odl_cluster() { printf "This is a local cluster\n" i=0 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') while [ $i -lt "$SDNC_REPLICAS" ]; do node_list="${node_list} ${node_name}-$i.${SERVICE_NAME}-cluster.${NAMESPACE}" - i=$(("$i" + 1)) + i=$(($i + 1)) 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 while [ $i -lt "$SDNC_REPLICAS" ]; do #assemble node list by replacing node-index in hostname with "i" node_name=$(echo "${fqdn}" | sed -r "s/-[0-9]/-$i/g") node_list="${node_list} ${node_name}" - i=$(("$i" + 1)) + i=$(($i + 1)) done "${ODL_HOME}"/bin/configure_cluster.sh $((node_index+1)) "${node_list}" + else + printf "Unhandled cluster scenario. Terminating the container\n" + printf "Any one of the below 2 conditions should be satisfied for successfully enabling cluster mode : \n" + printf "1. OOM Environment - Both SERVICE_NAME and NAMESPACE environment variables have to be set.\n" + printf "2. Docker (standalone) Environment - Neither of SERVICE_NAME and NAMESPACE have to be set.\n" + printf "Current configuration - SERVICE_NAME = $SERVICE_NAME NAMESPACE = $NAMESPACE\n" + exit $NOTOK fi fi } @@ -217,6 +225,7 @@ fi 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} @@ -224,7 +233,6 @@ MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0} 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} @@ -233,10 +241,10 @@ 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} -SDNRDM_ONF_REPO=${SDNRDM_ONF_REPO:-mvn:org.onap.ccsdk.features.sdnr.wt/sdnr-wt-devicemanager-onf-feature/$CCSDKFEATUREVERSION/xml/features} # Add devicemanager features -SDNRDM_SDM_LIST=${SDNRDM_SDM_LIST:-sdnr-wt-devicemanager-onf-feature} +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} @@ -244,6 +252,7 @@ SDNRDBCOMMAND=${SDNRDBCOMMAND:--c init -db $SDNRDBURL -dbu $SDNRDBUSERNAME -dbp 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 @@ -283,6 +292,8 @@ 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 @@ -312,7 +323,8 @@ if $SDNRINIT ; then 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,7 +344,6 @@ fi 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 printf "Installing SDN-C database\n" @@ -343,14 +354,11 @@ then printf "Installing A1-adapter trustStore\n" "${SDNC_HOME}"/bin/addA1TrustStore.sh - #${CCSDK_HOME}/bin/installOdlHostKey.sh - if [ -x "${SDNC_HOME}"/svclogic/bin/install.sh ] then printf "Installing directed graphs\n" "${SDNC_HOME}"/svclogic/bin/install.sh fi - fi if $SDNRWT ; then install_sdnrwt_features ; fi # The enable_odl_cluster call should not be moved above this line as the cleanFeatureBoot will overwrite entries. Ex: odl-jolokia @@ -381,6 +389,8 @@ else printf "Start background cert installer\n" mkdir -p /opt/opendaylight/data/log nohup python3 "${SDNC_BIN}"/installCerts.py & + printf "Start monitoring certificate installation. \n" + nohup sh "${SDNC_BIN}"/monitorCertsInstall.sh & fi printf "Startup opendaylight\n"