Merge "Upgrade APPC to use common mariadb galera charts"
[oom.git] / kubernetes / appc / resources / config / appc / opt / onap / ccsdk / bin / startODL.sh
1 #!/bin/bash
2
3 ###
4 # ============LICENSE_START=======================================================
5 # openECOMP : SDN-C
6 # ================================================================================
7 # Copyright (C) 2017 AT&T Intellectual Property. All rights
8 #                                                       reserved.
9 # Modifications Copyright © 2018 Amdocs,Bell Canada
10 # ================================================================================
11 # Licensed under the Apache License, Version 2.0 (the "License");
12 # you may not use this file except in compliance with the License.
13 # You may obtain a copy of the License at
14 #
15 #      http://www.apache.org/licenses/LICENSE-2.0
16 #
17 # Unless required by applicable law or agreed to in writing, software
18 # distributed under the License is distributed on an "AS IS" BASIS,
19 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 # See the License for the specific language governing permissions and
21 # limitations under the License.
22 # ============LICENSE_END=========================================================
23 ###
24
25
26 # Install SDN-C platform components if not already installed and start container
27
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 SLEEP_TIME=${SLEEP_TIME:-120}
32 MYSQL_PASSWD=${MYSQL_PASSWD:-{{.Values.config.mariadbRootPassword}}}
33
34 #
35 # Wait for database
36 #
37 echo "Waiting for mariadbgalera"
38 until mysql -h {{.Values.config.mariadbGaleraSVCName}}.{{.Release.Namespace}} -u root -p{{.Values.config.mariadbRootPassword}} mysql &> /dev/null
39 do
40   printf "."
41   sleep 1
42 done
43 echo -e "\nmariadbgalera ready"
44
45 if [ ! -f ${SDNC_HOME}/.installed ]
46 then
47         echo "Installing SDN-C database"
48         ${SDNC_HOME}/bin/installSdncDb.sh
49         echo "Starting OpenDaylight"
50         ${ODL_HOME}/bin/start
51         echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize"
52         sleep ${SLEEP_TIME}
53         echo "Installing SDN-C platform features"
54         ${SDNC_HOME}/bin/installFeatures.sh
55         if [ -x ${SDNC_HOME}/svclogic/bin/install.sh ]
56         then
57                 echo "Installing directed graphs"
58                 ${SDNC_HOME}/svclogic/bin/install.sh
59         fi
60
61
62         echo "Restarting OpenDaylight"
63         ${ODL_HOME}/bin/stop
64         echo "Installed at `date`" > ${SDNC_HOME}/.installed
65 fi
66
67 exec ${ODL_HOME}/bin/karaf
68