From 72a9c65ab0a305e487e8aed11ff2d8ac34076943 Mon Sep 17 00:00:00 2001 From: Hao Kuang Date: Mon, 4 Dec 2017 19:30:01 +0000 Subject: [PATCH] SDNC ODL cluster POC Issue-ID: SDNC-163 Change-Id: I593b4d7e36e59ebcc3585029f65b24b185172cb2 Signed-off-by: Hao Kuang Former-commit-id: 1d556c7996f91cd9a0d28aadb1ee922d44042e60 --- installation/sdnc/src/main/scripts/startODL.sh | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/installation/sdnc/src/main/scripts/startODL.sh b/installation/sdnc/src/main/scripts/startODL.sh index 79f58794..ec7fb791 100644 --- a/installation/sdnc/src/main/scripts/startODL.sh +++ b/installation/sdnc/src/main/scripts/startODL.sh @@ -21,6 +21,33 @@ # ============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 -- 2.16.6