4 # ============LICENSE_START=======================================================
6 # ================================================================================
7 # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
8 # Modifications Copyright © 2018 Amdocs,Bell Canada
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=========================================================
22 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
26 # This script takes care of installing the SDNC & APPC platform components
27 # if not already installed, and starts the APPC Docker Container
30 function enable_odl_cluster(){
31 if [ -z $APPC_REPLICAS ]; then
32 echo "APPC_REPLICAS is not configured in Env field"
36 echo "Update cluster information statically"
38 echo "Get current Hostname ${hm}"
40 node=($(echo ${hm} | sed 's/-[0-9]*$//g'))
41 node_index=($(echo ${hm} | awk -F"-" '{print $NF}'))
42 node_list="${node}-0.{{ .Values.service.name }}-cluster.{{.Release.Namespace}}";
44 for ((i=1;i<${APPC_REPLICAS};i++));
46 node_list="${node_list} ${node}-$i.{{ .Values.service.name }}-cluster.{{.Release.Namespace}}"
49 /opt/opendaylight/current/bin/configure_cluster.sh $((node_index+1)) ${node_list}
52 ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
53 ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-admin}
54 SDNC_HOME=${SDNC_HOME:-/opt/onap/ccsdk}
55 APPC_HOME=${APPC_HOME:-/opt/onap/appc}
56 SLEEP_TIME=${SLEEP_TIME:-120}
57 MYSQL_PASSWD=${MYSQL_PASSWD:-{{.Values.config.dbRootPassword}}}
58 ENABLE_ODL_CLUSTER=${ENABLE_ODL_CLUSTER:-false}
59 ENABLE_AAF=${ENABLE_AAF:-false}
60 AAF_EXT_IP=${AAF_EXT_IP:-{{.Values.config.aafExtIP}}}
61 AAF_EXT_FQDN=${AAF_EXT_FQDN:-{{.Values.config.aafExtFQDN}}}
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 "Installing ODL Host Key"
103 ${SDNC_HOME}/bin/installOdlHostKey.sh
105 echo "Starting OpenDaylight"
106 ${ODL_HOME}/bin/start
108 echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize"
111 echo "Copying a working version of the logging configuration into the opendaylight etc folder"
112 cp ${APPC_HOME}/data/org.ops4j.pax.logging.cfg ${ODL_HOME}/etc/org.ops4j.pax.logging.cfg
113 echo "Copying a new version of aaf cadi shiro into the opendaylight deploy folder"
114 cp ${APPC_HOME}/data/aaf-shiro-aafrealm-osgi-bundle.jar ${ODL_HOME}/deploy/aaf-shiro-aafrealm-osgi-bundle.jar
116 echo "Installing SDNC platform features"
117 ${SDNC_HOME}/bin/installFeatures.sh
119 if [ -x ${SDNC_HOME}/svclogic/bin/install.sh ]
121 echo "Installing directed graphs"
122 ${SDNC_HOME}/svclogic/bin/install.sh
125 if $ENABLE_ODL_CLUSTER ; then echo "Installing Opendaylight cluster features" ; ${ODL_HOME}/bin/client feature:install odl-mdsal-clustering ; ${ODL_HOME}/bin/client feature:install odl-jolokia ; fi
127 echo "Installing APPC platform features"
128 ${APPC_HOME}/bin/installFeatures.sh
130 if [ -x ${APPC_HOME}/svclogic/bin/install.sh ]
132 echo "Installing APPC DGs using platform-logic"
133 ${APPC_HOME}/svclogic/bin/install.sh
136 if [ -x ${APPC_HOME}/svclogic/bin/install-converted-dgs.sh ]
138 echo "Installing APPC JSON DGs converted to XML using dg-loader"
139 ${APPC_HOME}/svclogic/bin/install-converted-dgs.sh
142 if $ENABLE_ODL_CLUSTER ; then enable_odl_cluster ; fi
144 echo "Adding a property system.properties for AAF cadi.properties location"
145 echo "" >> ${ODL_HOME}/etc/system.properties
146 echo "cadi_prop_files=${APPC_HOME}/data/properties/cadi.properties" >> ${ODL_HOME}/etc/system.properties
147 echo "" >> ${ODL_HOME}/etc/system.properties
149 echo "Copying the aaa shiro configuration into opendaylight"
152 echo "${AAF_EXT_IP} ${AAF_EXT_FQDN}" >> /etc/hosts
153 cp ${APPC_HOME}/data/properties/aaa-app-config.xml ${ODL_HOME}/etc/opendaylight/datastore/initial/config/aaa-app-config.xml
155 cp ${APPC_HOME}/data/aaa-app-config.xml ${ODL_HOME}/etc/opendaylight/datastore/initial/config/aaa-app-config.xml
158 echo "Restarting OpenDaylight"
162 while read a b c d e f g h
164 if [ "$h" == "/bin/sh /opt/opendaylight/bin/karaf server" ]
172 while [ $( checkRun ) == 1 ]
174 echo "Karaf is still running, waiting..."
177 echo "Karaf process has stopped"
179 echo "Installed at `date`" > ${SDNC_HOME}/.installed
182 appcInstallEndTime=$(date +%s)
183 echo "Total Appc install took $(expr $appcInstallEndTime - $appcInstallStartTime) seconds"
185 echo "Starting cdt-proxy-service jar, logging to ${APPC_HOME}/cdt-proxy-service/jar.log"
186 java -jar ${APPC_HOME}/cdt-proxy-service/cdt-proxy-service.jar > ${APPC_HOME}/cdt-proxy-service/jar.log &
188 exec ${ODL_HOME}/bin/karaf server