SDNC ODL cluster POC 75/25475/5
authorHao Kuang <Hao.Kuang@amdocs.com>
Mon, 4 Dec 2017 19:30:01 +0000 (19:30 +0000)
committerHao Kuang <hao.kuang@amdocs.com>
Mon, 11 Dec 2017 20:20:46 +0000 (20:20 +0000)
Issue-ID: SDNC-163
Change-Id: I593b4d7e36e59ebcc3585029f65b24b185172cb2
Signed-off-by: Hao Kuang <Hao.Kuang@amdocs.com>
Former-commit-id: 1d556c7996f91cd9a0d28aadb1ee922d44042e60

installation/sdnc/src/main/scripts/startODL.sh

index 79f5879..ec7fb79 100644 (file)
 # ============LICENSE_END=========================================================
 ###
 
+function enable_odl_cluster(){
+  if [ -z $SDNC_REPLICAS ]; then
+     echo "SDNC_REPLICAS is not configured in Env field"
+     exit
+  fi
+
+  echo "Installing Opendaylight cluster features"
+  ${ODL_HOME}/bin/client -u karaf feature:install odl-mdsal-clustering
+  ${ODL_HOME}/bin/client -u karaf feature:install odl-jolokia
+
+  echo "Update cluster information statically"
+  hm=$(hostname)
+  echo "Get current Hostname ${hm}"
+
+  node=($(echo ${hm} | tr '-' '\n'))
+  node_name=${node[0]}
+  node_index=${node[1]}
+  node_list="${node_name}-0.sdnhost-cluster.onap-sdnc.svc.cluster.local";
+
+  for ((i=1;i<${SDNC_REPLICAS};i++));
+  do
+    node_list="${node_list} ${node_name}-$i.sdnhost-cluster.onap-sdnc.svc.cluster.local"
+  done
+
+  /opt/opendaylight/current/bin/configure_cluster.sh $((node_index+1)) ${node_list}
+}
+
 
 # Install SDN-C platform components if not already installed and start container
 
@@ -29,6 +56,7 @@ ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJv
 SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc}
 SLEEP_TIME=${SLEEP_TIME:-120}
 MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0}
+ENABLE_ODL_CLUSTER=${ENABLE_ODL_CLUSTER:-false}
 
 #
 # Wait for database
@@ -59,6 +87,7 @@ then
                ${SDNC_HOME}/svclogic/bin/install.sh
        fi
 
+        if $ENABLE_ODL_CLUSTER ; then enable_odl_cluster ; fi
 
        echo "Restarting OpenDaylight"
        ${ODL_HOME}/bin/stop