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/sdnc}
31 APPC_HOME=${APPC_HOME:-/opt/onap/appc}
32 SLEEP_TIME=${SLEEP_TIME:-120}
33 MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0}
36 # Adding the DMAAP_TOPIC_ENV variable into APPC-ASDC-LISTENER properties
38 DMAAP_TOPIC_ENV=${DMAAP_TOPIC_ENV}
40 if [ -z "$DMAAP_TOPIC_ENV" ]
42 echo "DMAAP_TOPIC_ENV shell variable is empty. Adding default value OS-ETE-DFW"
43 DMAAP_TOPIC_ENV="OS-ETE-DFW"
45 echo "DMAAP_TOPIC_ENV shell variable exists and it's $DMAAP_TOPIC_ENV"
48 echo "Adding a value to property appc.asdc.env in appc.properties for appc-asdc-listener feature"
49 echo "" >> $APPC_HOME/data/properties/appc.properties
50 echo "appc.asdc.env=$DMAAP_TOPIC_ENV" >> $APPC_HOME/data/properties/appc.properties
51 echo "" >> $APPC_HOME/data/properties/appc.properties
54 # Wait for database to init properly
56 echo "Waiting for mysql"
57 until mysql -h dbhost -u root -p${MYSQL_PASSWD} mysql &> /dev/null
62 echo -e "\nmysql ready"
64 if [ ! -f ${SDNC_HOME}/.installed ]
66 echo "Installing SDNC database"
67 ${SDNC_HOME}/bin/installSdncDb.sh
68 echo "Installing APPC database"
69 ${APPC_HOME}/bin/installAppcDb.sh
70 echo "Starting OpenDaylight"
72 echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize"
74 echo "Inserting modified installFeatures.sh for sdnc"
75 rm ${SDNC_HOME}/bin/installFeatures.sh
76 cp ${APPC_HOME}/data/sdncInstallFeatures.sh ${SDNC_HOME}/bin/installFeatures.sh
77 echo "Copying a working version of the logging configuration into the opendaylight etc folder"
78 cp ${APPC_HOME}/data/org.ops4j.pax.logging.cfg ${ODL_HOME}/etc/org.ops4j.pax.logging.cfg
79 echo "Copying a new version of aaf cadi shiro into the opendaylight deploy folder"
80 cp ${APPC_HOME}/data/aaf-cadi-shiro.jar ${ODL_HOME}/deploy/aaf-cadi-shiro.jar
81 echo "Installing SDNC platform features"
82 ${SDNC_HOME}/bin/installFeatures.sh
83 if [ -x ${SDNC_HOME}/svclogic/bin/install.sh ]
85 echo "Installing directed graphs"
86 ${SDNC_HOME}/svclogic/bin/install.sh
89 echo "Installing APPC platform features"
90 ${APPC_HOME}/bin/installFeatures.sh
91 if [ -x ${APPC_HOME}/svclogic/bin/install.sh ]
93 echo "Installing APPC DGs using platform-logic"
94 ${APPC_HOME}/svclogic/bin/install.sh
97 if [ -x ${APPC_HOME}/svclogic/bin/install-converted-dgs.sh ]
99 echo "Installing APPC JSON DGs converted to XML using dg-loader"
100 ${APPC_HOME}/svclogic/bin/install-converted-dgs.sh
103 echo "Adding a property system.properties for AAF cadi.properties location"
104 echo "" >> ${ODL_HOME}/etc/system.properties
105 echo "cadi_prop_files=${APPC_HOME}/data/properties/cadi.properties" >> ${ODL_HOME}/etc/system.properties
106 echo "" >> ${ODL_HOME}/etc/system.properties
108 echo "Copying a working version of the shiro configuration into the opendaylight etc folder"
109 cp ${APPC_HOME}/data/shiro.ini ${ODL_HOME}/etc/shiro.ini
111 echo "Restarting OpenDaylight"
113 echo "Installed at `date`" > ${SDNC_HOME}/.installed
116 exec ${ODL_HOME}/bin/karaf