54a7b6b6aef9bef1b54c7288cd52030e1e686e51
[nonrtric.git] / sdnc-a1-controller / oam / installation / sdnc-a1 / src / main / scripts / 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 (C) 2020 Nordix Foundation.
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 # Install SDN-C platform components if not already installed and start container
26
27 ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
28 ODL_ADMIN_USERNAME=${ODL_ADMIN_USERNAME:-admin}
29 ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
30 HTTPS_PROPS=${HTTPS_PROPS:-/opt/onap/sdnc/data/properties/https-props.properties}
31 SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc}
32 SDNC_BIN=${SDNC_BIN:-/opt/onap/sdnc/bin}
33 MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0}
34 INSTALLED_DIR=${INSTALLED_FILE:-/opt/opendaylight/current/daexim}
35 export ODL_ADMIN_PASSWORD ODL_ADMIN_USERNAME
36
37 echo org.ops4j.pax.web.ssl.keystore=$(cat $HTTPS_PROPS | grep -w key-store | cut -d '=' -f2) >> /opt/opendaylight/etc/custom.properties
38 echo org.ops4j.pax.web.ssl.password=$(cat $HTTPS_PROPS | grep -w keystore-password | cut -d '=' -f2) >> /opt/opendaylight/etc/custom.properties
39 echo org.ops4j.pax.web.ssl.keypassword=$(cat $HTTPS_PROPS | grep -w key-password | cut -d '=' -f2) >> /opt/opendaylight/etc/custom.properties
40
41 #
42 # Wait for database
43 #
44 echo "Waiting for mysql"
45 until mysql -h dbhost -u root -p${MYSQL_PASSWD} mysql &> /dev/null
46 do
47   printf "."
48   sleep 1
49 done
50 echo -e "\nmysql ready"
51
52 if [ ! -d ${INSTALLED_DIR} ]
53 then
54     mkdir -p ${INSTALLED_DIR}
55 fi
56
57 if [ ! -f ${INSTALLED_DIR}/.installed ]
58 then
59         echo "Installing SDNC-A1 database"
60         ${SDNC_HOME}/bin/installSdncDb.sh
61
62         if [ -x ${SDNC_HOME}/svclogic/bin/install.sh ]
63         then
64                 echo "Installing directed graphs"
65                 ${SDNC_HOME}/svclogic/bin/install.sh
66         fi
67 fi
68
69 nohup python ${SDNC_BIN}/healthcheck.py &
70
71 exec ${ODL_HOME}/bin/karaf server