4 # ============LICENSE_START=======================================================
6 # ================================================================================
7 # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
8 # ================================================================================
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
13 # http://www.apache.org/licenses/LICENSE-2.0
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 # ============LICENSE_END=========================================================
23 function enable_odl_cluster(){
24 if [ -z $SDNC_REPLICAS ]; then
25 echo "SDNC_REPLICAS is not configured in Env field"
29 echo "Installing Opendaylight cluster features"
30 ${ODL_HOME}/bin/client -u karaf feature:install odl-mdsal-clustering
31 ${ODL_HOME}/bin/client -u karaf feature:install odl-jolokia
33 echo "Update cluster information statically"
35 echo "Get current Hostname ${hm}"
37 node=($(echo ${hm} | sed 's/-[0-9]*$//g'))
38 node_index=($(echo ${hm} | awk -F"-" '{print $NF}'))
39 node_list="${node}-0.{{ .Values.service.name }}-cluster.{{.Release.Namespace}}";
41 for ((i=1;i<${SDNC_REPLICAS};i++));
43 node_list="${node_list} ${node}-$i.{{ .Values.service.name }}-cluster.{{.Release.Namespace}}"
46 /opt/opendaylight/current/bin/configure_cluster.sh $((node_index+1)) ${node_list}
49 ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
50 ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
51 SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc}
52 SLEEP_TIME=${SLEEP_TIME:-120}
53 MYSQL_PASSWD=${MYSQL_PASSWD:-{{.Values.config.dbRootPassword}}}
54 ENABLE_ODL_CLUSTER=${ENABLE_ODL_CLUSTER:-false}
57 # Wait for database to init properly
59 echo "Waiting for mysql"
60 until mysql -h {{.Values.mysql.service.name}}.{{.Release.Namespace}} -u root -p{{.Values.config.dbRootPassword}} mysql &> /dev/null
65 echo -e "\nmysql ready"
67 if [ ! -f ${SDNC_HOME}/.installed ]
69 echo "Installing SDNC database"
70 ${SDNC_HOME}/bin/installSdncDb.sh
71 echo "Installing SDN-C keyStore"
72 ${SDNC_HOME}/bin/addSdncKeyStore.sh
73 echo "Starting OpenDaylight"
75 echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize"
77 echo "Installing SDN-C platform features"
78 ${SDNC_HOME}/bin/installFeatures.sh
79 if [ -x ${SDNC_HOME}/svclogic/bin/install.sh ]
81 echo "Installing directed graphs"
82 ${SDNC_HOME}/svclogic/bin/install.sh
85 if $ENABLE_ODL_CLUSTER ; then enable_odl_cluster ; fi
87 echo "Restarting OpenDaylight"
89 echo "Installed at `date`" > ${SDNC_HOME}/.installed
92 exec ${ODL_HOME}/bin/karaf