4 # ============LICENSE_START=======================================================
6 # ================================================================================
7 # Copyright (C) 2017-2018 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=========================================================
24 # This script takes care of installing the SDNC & APPC platform components
25 # if not already installed, and starts the APPC Docker Container
28 ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
29 ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
30 SDNC_HOME=${SDNC_HOME:-/opt/onap/ccsdk}
31 APPC_HOME=${APPC_HOME:-/opt/onap/appc}
32 SLEEP_TIME=${SLEEP_TIME:-120}
33 MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0}
35 appcInstallStartTime=$(date +%s)
38 # Adding the DMAAP_TOPIC_ENV variable into APPC-ASDC-LISTENER properties
40 DMAAP_TOPIC_ENV=${DMAAP_TOPIC_ENV}
42 if [ -z "$DMAAP_TOPIC_ENV" ]
44 echo "DMAAP_TOPIC_ENV shell variable is empty. Adding default value OS-ETE-DFW"
45 DMAAP_TOPIC_ENV="OS-ETE-DFW"
47 echo "DMAAP_TOPIC_ENV shell variable exists and it's $DMAAP_TOPIC_ENV"
50 echo "Adding a value to property appc.asdc.env in appc.properties for appc-asdc-listener feature"
51 echo "" >> $APPC_HOME/data/properties/appc.properties
52 echo "appc.asdc.env=$DMAAP_TOPIC_ENV" >> $APPC_HOME/data/properties/appc.properties
53 echo "" >> $APPC_HOME/data/properties/appc.properties
56 # Wait for database to init properly
58 echo "Waiting for mysql"
59 until mysql -h dbhost -u root -p${MYSQL_PASSWD} mysql &> /dev/null
64 echo -e "\nmysql ready"
66 if [ ! -f ${SDNC_HOME}/.installed ]
68 echo "Installing SDNC database"
69 ${SDNC_HOME}/bin/installSdncDb.sh
70 echo "Installing APPC database"
71 ${APPC_HOME}/bin/installAppcDb.sh
72 echo "Installing ODL Host Key"
73 ${SDNC_HOME}/bin/installOdlHostKey.sh
74 echo "Starting OpenDaylight"
76 echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize"
78 echo "Copying a working version of the logging configuration into the opendaylight etc folder"
79 cp ${APPC_HOME}/data/org.ops4j.pax.logging.cfg ${ODL_HOME}/etc/org.ops4j.pax.logging.cfg
80 echo "Copying a new version of aaf cadi shiro into the opendaylight deploy folder"
81 cp ${APPC_HOME}/data/aaf-shiro-aafrealm-osgi-bundle.jar ${ODL_HOME}/deploy/aaf-shiro-aafrealm-osgi-bundle.jar
82 echo "Installing SDNC platform features"
83 ${SDNC_HOME}/bin/installFeatures.sh
84 if [ -x ${SDNC_HOME}/svclogic/bin/install.sh ]
86 echo "Installing directed graphs"
87 ${SDNC_HOME}/svclogic/bin/install.sh
90 echo "Installing APPC platform features"
91 ${APPC_HOME}/bin/installFeatures.sh
95 if [ -x ${APPC_HOME}/svclogic/bin/install-converted-dgs.sh ]
97 echo "Installing APPC JSON DGs converted to XML using dg-loader"
98 ${APPC_HOME}/svclogic/bin/install-converted-dgs.sh
101 echo "Adding a property system.properties for AAF cadi.properties location"
102 echo "" >> ${ODL_HOME}/etc/system.properties
103 echo "cadi_prop_files=${APPC_HOME}/data/properties/cadi.properties" >> ${ODL_HOME}/etc/system.properties
104 echo "" >> ${ODL_HOME}/etc/system.properties
106 echo "Copying the aaa shiro configuration into opendaylight"
107 cp ${APPC_HOME}/data/aaa-app-config.xml ${ODL_HOME}/etc/opendaylight/datastore/initial/config/aaa-app-config.xml
109 echo "Restarting OpenDaylight"
113 while read a b c d e f g h
115 if [ "$h" == "/bin/sh /opt/opendaylight/bin/karaf server" ]
123 while [ $( checkRun ) == 1 ]
125 echo "Karaf is still running, waiting..."
128 echo "Karaf process has stopped"
130 echo "Installed at `date`" > ${SDNC_HOME}/.installed
133 appcInstallEndTime=$(date +%s)
134 echo "Total Appc install took $(expr $appcInstallEndTime - $appcInstallStartTime) seconds"
136 echo "Starting cdt-proxy-service jar, logging to ${APPC_HOME}/cdt-proxy-service/jar.log"
137 java -jar ${APPC_HOME}/cdt-proxy-service/cdt-proxy-service.jar > ${APPC_HOME}/cdt-proxy-service/jar.log &
139 exec ${ODL_HOME}/bin/karaf server