4 # ============LICENSE_START=======================================================
6 # ================================================================================
7 # Copyright (C) 2017 AT&T Intellectual Property. All rights
9 # ================================================================================
10 # Licensed under the Apache License, Version 2.0 (the "License");
11 # you may not use this file except in compliance with the License.
12 # You may obtain a copy of the License at
14 # http://www.apache.org/licenses/LICENSE-2.0
16 # Unless required by applicable law or agreed to in writing, software
17 # distributed under the License is distributed on an "AS IS" BASIS,
18 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 # See the License for the specific language governing permissions and
20 # limitations under the License.
21 # ============LICENSE_END=========================================================
24 function enable_odl_cluster(){
25 if [ -z $SDNC_REPLICAS ]; then
26 echo "SDNC_REPLICAS is not configured in Env field"
30 echo "Installing Opendaylight cluster features"
31 ${ODL_HOME}/bin/client feature:install odl-mdsal-clustering
32 ${ODL_HOME}/bin/client feature:install odl-jolokia
34 echo "Update cluster information statically"
36 echo "Get current Hostname ${hm}"
38 node=($(echo ${hm} | tr '-' '\n'))
42 if [ -z $PEER_ODL_CLUSTER ]; then
43 echo "This is a local cluster"
44 node_list="${node_name}-0.sdnhost-cluster.onap.svc.cluster.local";
46 for ((i=1;i<${SDNC_REPLICAS};i++));
48 node_list="${node_list} ${node_name}-$i.sdnhost-cluster.onap.svc.cluster.local"
50 /opt/opendaylight/current/bin/configure_cluster.sh $((node_index+1)) ${node_list}
52 echo "This is a Geo cluster"
54 if $IS_PRIMARY_CLUSTER; then
55 PRIMARY_NODE=${MY_ODL_CLUSTER}
56 SECONDARY_NODE=${PEER_ODL_CLUSTER}
58 PRIMARY_NODE=${PEER_ODL_CLUSTER}
59 SECONDARY_NODE=${MY_ODL_CLUSTER}
63 node_list="${PRIMARY_NODE} ${SECONDARY_NODE}"
64 /opt/onap/sdnc/bin/configure_geo_cluster.sh $((node_index+member_offset)) ${node_list}
69 # Install SDN-C platform components if not already installed and start container
71 ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
72 ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
73 SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc}
74 CCSDK_HOME=${CCSDK_HOME:-/opt/onap/ccsdk}
75 SLEEP_TIME=${SLEEP_TIME:-120}
76 MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0}
77 ENABLE_ODL_CLUSTER=${ENABLE_ODL_CLUSTER:-false}
78 IS_PRIMARY_CLUSTER=${IS_PRIMARY_CLUSTER:-false}
79 MY_ODL_CLUSTER=${MY_ODL_CLUSTER:-127.0.0.1}
84 echo "Waiting for mysql"
85 until mysql -h dbhost -u root -p${MYSQL_PASSWD} mysql &> /dev/null
90 echo -e "\nmysql ready"
92 if [ ! -f ${SDNC_HOME}/.installed ]
94 echo "Installing SDN-C database"
95 ${SDNC_HOME}/bin/installSdncDb.sh
96 echo "Installing SDN-C keyStore"
97 ${SDNC_HOME}/bin/addSdncKeyStore.sh
98 echo "Starting OpenDaylight"
99 ${CCSDK_HOME}/bin/installOdlHostKey.sh
100 ${ODL_HOME}/bin/start
101 echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize"
103 echo "Installing SDN-C platform features"
104 ${SDNC_HOME}/bin/installFeatures.sh
105 if [ -x ${SDNC_HOME}/svclogic/bin/install.sh ]
107 echo "Installing directed graphs"
108 ${SDNC_HOME}/svclogic/bin/install.sh
111 if $ENABLE_ODL_CLUSTER ; then enable_odl_cluster ; fi
113 echo "Restarting OpenDaylight"
115 echo "Waiting 60 seconds for OpenDaylight stop to complete"
117 echo "Installed at `date`" > ${SDNC_HOME}/.installed
120 exec ${ODL_HOME}/bin/karaf