52e524b3e456e8f65655db00d525bc21178f3630
[appc/deployment.git] / installation / appc / src / main / scripts / startODL.sh
1 #!/bin/bash
2
3 ###
4 # ============LICENSE_START=======================================================
5 # APPC
6 # ================================================================================
7 # Copyright (C) 2017-2019 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
12
13 #      http://www.apache.org/licenses/LICENSE-2.0
14
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 ###
22
23 #
24 # This script takes care of installing the SDNC & APPC platform components 
25 #  if not already installed, and starts the APPC Docker Container
26 #
27
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}
34
35 #
36 # Adding the DMAAP_TOPIC_ENV variable into APPC-ASDC-LISTENER properties
37 #
38 DMAAP_TOPIC_ENV=${DMAAP_TOPIC_ENV}
39
40 if [ -z "$DMAAP_TOPIC_ENV" ]
41         then
42         echo "DMAAP_TOPIC_ENV shell variable is empty. Adding default value OS-ETE-DFW"
43                 DMAAP_TOPIC_ENV="OS-ETE-DFW"
44         else
45                 echo "DMAAP_TOPIC_ENV shell variable exists and it's $DMAAP_TOPIC_ENV"
46 fi
47
48 #
49 # Wait for database to init properly
50 #
51 echo "Waiting for mysql"
52 until mysql -h dbhost -u root -p${MYSQL_PASSWD} mysql &> /dev/null
53 do
54   printf "."
55   sleep 1
56 done
57 echo -e "\nmysql ready"
58
59 if [ ! -f ${SDNC_HOME}/.installed ]
60 then
61         echo "Installing SDNC database"
62         ${SDNC_HOME}/bin/installSdncDb.sh
63         echo "Installing APPC database"
64         ${APPC_HOME}/bin/installAppcDb.sh
65         echo "Installing ODL Host Key"
66         ${SDNC_HOME}/bin/installOdlHostKey.sh
67
68         if [ -x ${SDNC_HOME}/svclogic/bin/install.sh ]
69         then
70                 echo "Installing directed graphs"
71                 ${SDNC_HOME}/svclogic/bin/install.sh
72         fi
73         
74         
75         
76
77         if [ -x ${APPC_HOME}/svclogic/bin/install-converted-dgs.sh ]
78         then
79                 echo "Installing APPC JSON DGs converted to XML using dg-loader"
80                 ${APPC_HOME}/svclogic/bin/install-converted-dgs.sh
81         fi
82         
83 echo "Installed at `date`" > ${SDNC_HOME}/.installed
84 fi
85
86 echo "Starting cdt-proxy-service jar, logging to ${APPC_HOME}/cdt-proxy-service/jar.log"
87 java -jar ${APPC_HOME}/cdt-proxy-service/cdt-proxy-service.jar > ${APPC_HOME}/cdt-proxy-service/jar.log &
88
89 echo "Starting ODL/APPC"
90 exec ${ODL_HOME}/bin/karaf server