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=========================================================
21 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
25 # This script takes care of installing the SDNC & APPC platform components
26 # if not already installed, and starts the APPC Docker Container
29 function enable_odl_cluster(){
30 if [ -z $APPC_REPLICAS ]; then
31 echo "APPC_REPLICAS is not configured in Env field"
35 echo "Installing Opendaylight cluster features"
36 ${ODL_HOME}/bin/client -u karaf feature:install odl-mdsal-clustering
37 ${ODL_HOME}/bin/client -u karaf feature:install odl-jolokia
39 echo "Update cluster information statically"
41 echo "Get current Hostname ${hm}"
43 node=($(echo ${hm} | sed 's/-[0-9]*$//g'))
44 node_index=($(echo ${hm} | awk -F"-" '{print $NF}'))
45 node_list="${node}-0.{{ .Values.service.name }}-cluster.{{.Release.Namespace}}";
47 for ((i=1;i<${APPC_REPLICAS};i++));
49 node_list="${node_list} ${node}-$i.{{ .Values.service.name }}-cluster.{{.Release.Namespace}}"
52 /opt/opendaylight/current/bin/configure_cluster.sh $((node_index+1)) ${node_list}
55 ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
56 ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
57 SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc}
58 APPC_HOME=${APPC_HOME:-/opt/onap/appc}
59 SLEEP_TIME=${SLEEP_TIME:-120}
60 MYSQL_PASSWD=${MYSQL_PASSWD:-{{.Values.config.dbRootPassword}}}
61 ENABLE_ODL_CLUSTER=${ENABLE_ODL_CLUSTER:-false}
64 # Adding the DMAAP_TOPIC_ENV variable into APPC-ASDC-LISTENER properties
66 DMAAP_TOPIC_ENV=${DMAAP_TOPIC_ENV}
68 if [ -z "$DMAAP_TOPIC_ENV" ]
70 echo "DMAAP_TOPIC_ENV shell variable is empty. Adding default value OS-ETE-DFW"
71 DMAAP_TOPIC_ENV="OS-ETE-DFW"
73 echo "DMAAP_TOPIC_ENV shell variable exists and it's $DMAAP_TOPIC_ENV"
76 echo "Adding a value to property appc.asdc.env in appc.properties for appc-asdc-listener feature"
77 echo "" >> $APPC_HOME/data/properties/appc.properties
78 echo "appc.asdc.env=$DMAAP_TOPIC_ENV" >> $APPC_HOME/data/properties/appc.properties
79 echo "" >> $APPC_HOME/data/properties/appc.properties
82 # Wait for database to init properly
84 echo "Waiting for mysql"
85 until mysql -h {{.Values.mysql.service.name}}.{{.Release.Namespace}} -u root -p{{.Values.config.dbRootPassword}} mysql &> /dev/null
90 echo -e "\nmysql ready"
92 if [ ! -f ${SDNC_HOME}/.installed ]
94 echo "Installing SDNC database"
95 ${SDNC_HOME}/bin/installSdncDb.sh
96 echo "Installing APPC database"
97 ${APPC_HOME}/bin/installAppcDb.sh
98 echo "Starting OpenDaylight"
100 echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize"
102 echo "Inserting modified installFeatures.sh for sdnc"
103 rm ${SDNC_HOME}/bin/installFeatures.sh
104 cp ${APPC_HOME}/data/sdncInstallFeatures.sh ${SDNC_HOME}/bin/installFeatures.sh
105 echo "Installing SDNC platform features"
106 ${SDNC_HOME}/bin/installFeatures.sh
107 if [ -x ${SDNC_HOME}/svclogic/bin/install.sh ]
109 echo "Installing directed graphs"
110 ${SDNC_HOME}/svclogic/bin/install.sh
113 echo "Installing APPC platform features"
114 ${APPC_HOME}/bin/installFeatures.sh
115 if [ -x ${APPC_HOME}/svclogic/bin/install.sh ]
117 echo "Installing APPC DGs using platform-logic"
118 ${APPC_HOME}/svclogic/bin/install.sh
121 if [ -x ${APPC_HOME}/svclogic/bin/install-converted-dgs.sh ]
123 echo "Installing APPC JSON DGs converted to XML using dg-loader"
124 ${APPC_HOME}/svclogic/bin/install-converted-dgs.sh
127 if $ENABLE_ODL_CLUSTER ; then enable_odl_cluster ; fi
129 echo "Restarting OpenDaylight"
131 echo "Installed at `date`" > ${SDNC_HOME}/.installed
134 exec ${ODL_HOME}/bin/karaf