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 feature:install odl-mdsal-clustering
37 ${ODL_HOME}/bin/client 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:-admin}
57 SDNC_HOME=${SDNC_HOME:-/opt/onap/ccsdk}
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}
63 appcInstallStartTime=$(date +%s)
66 # Adding the DMAAP_TOPIC_ENV variable into APPC-ASDC-LISTENER properties
68 DMAAP_TOPIC_ENV=${DMAAP_TOPIC_ENV}
70 if [ -z "$DMAAP_TOPIC_ENV" ]
72 echo "DMAAP_TOPIC_ENV shell variable is empty. Adding default value OS-ETE-DFW"
73 DMAAP_TOPIC_ENV="OS-ETE-DFW"
75 echo "DMAAP_TOPIC_ENV shell variable exists and it's $DMAAP_TOPIC_ENV"
78 echo "Adding a value to property appc.asdc.env in appc.properties for appc-asdc-listener feature"
79 echo "" >> $APPC_HOME/data/properties/appc.properties
80 echo "appc.asdc.env=$DMAAP_TOPIC_ENV" >> $APPC_HOME/data/properties/appc.properties
81 echo "" >> $APPC_HOME/data/properties/appc.properties
84 # Wait for database to init properly
86 echo "Waiting for mysql"
87 until mysql -h {{.Values.mysql.service.name}}.{{.Release.Namespace}} -u root -p{{.Values.config.dbRootPassword}} mysql &> /dev/null
92 echo -e "\nmysql ready"
94 if [ ! -f ${SDNC_HOME}/.installed ]
96 echo "Installing SDNC database"
97 ${SDNC_HOME}/bin/installSdncDb.sh
99 echo "Installing APPC database"
100 ${APPC_HOME}/bin/installAppcDb.sh
102 echo "Starting OpenDaylight"
103 ${ODL_HOME}/bin/start
105 echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize"
108 echo "Copying a working version of the logging configuration into the opendaylight etc folder"
109 cp ${APPC_HOME}/data/org.ops4j.pax.logging.cfg ${ODL_HOME}/etc/org.ops4j.pax.logging.cfg
110 echo "Copying a new version of aaf cadi shiro into the opendaylight deploy folder"
111 cp ${APPC_HOME}/data/aaf-cadi-shiro.jar ${ODL_HOME}/deploy/aaf-cadi-shiro.jar
113 echo "Installing SDNC platform features"
114 ${SDNC_HOME}/bin/installFeatures.sh
116 if [ -x ${SDNC_HOME}/svclogic/bin/install.sh ]
118 echo "Installing directed graphs"
119 ${SDNC_HOME}/svclogic/bin/install.sh
122 echo "Installing APPC platform features"
123 ${APPC_HOME}/bin/installFeatures.sh
125 if [ -x ${APPC_HOME}/svclogic/bin/install.sh ]
127 echo "Installing APPC DGs using platform-logic"
128 ${APPC_HOME}/svclogic/bin/install.sh
131 if [ -x ${APPC_HOME}/svclogic/bin/install-converted-dgs.sh ]
133 echo "Installing APPC JSON DGs converted to XML using dg-loader"
134 ${APPC_HOME}/svclogic/bin/install-converted-dgs.sh
137 if $ENABLE_ODL_CLUSTER ; then enable_odl_cluster ; fi
139 echo "Adding a property system.properties for AAF cadi.properties location"
140 echo "" >> ${ODL_HOME}/etc/system.properties
141 echo "cadi_prop_files=${APPC_HOME}/data/properties/cadi.properties" >> ${ODL_HOME}/etc/system.properties
142 echo "" >> ${ODL_HOME}/etc/system.properties
144 echo "Copying a working version of the shiro configuration into the opendaylight etc folder"
145 cp ${APPC_HOME}/data/shiro.ini ${ODL_HOME}/etc/shiro.ini
147 echo "Restarting OpenDaylight"
149 echo "Waiting 60 seconds for OpenDaylight stop to complete"
151 echo "Installed at `date`" > ${SDNC_HOME}/.installed
154 appcInstallEndTime=$(date +%s)
155 echo "Total Appc install took $(expr $appcInstallEndTime - $appcInstallStartTime) seconds"
157 exec ${ODL_HOME}/bin/karaf