Merge "Remove unnecessary stuff from northbound directory of A1 controller"
[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 SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc}
31 SDNC_BIN=${SDNC_BIN:-/opt/onap/sdnc/bin}
32 MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0}
33 INSTALLED_DIR=${INSTALLED_FILE:-/opt/opendaylight/current/daexim}
34 export ODL_ADMIN_PASSWORD ODL_ADMIN_USERNAME
35
36 #
37 # Wait for database
38 #
39 echo "Waiting for mysql"
40 until mysql -h dbhost -u root -p${MYSQL_PASSWD} mysql &> /dev/null
41 do
42   printf "."
43   sleep 1
44 done
45 echo -e "\nmysql ready"
46
47 if [ ! -d ${INSTALLED_DIR} ]
48 then
49     mkdir -p ${INSTALLED_DIR}
50 fi
51
52 if [ ! -f ${INSTALLED_DIR}/.installed ]
53 then
54         echo "Installing SDNC-A1 database"
55         ${SDNC_HOME}/bin/installSdncDb.sh
56         echo "Installing SDNC-A1 keyStore"
57         ${SDNC_HOME}/bin/addSdncKeyStore.sh
58
59         if [ -x ${SDNC_HOME}/svclogic/bin/install.sh ]
60         then
61                 echo "Installing directed graphs"
62                 ${SDNC_HOME}/svclogic/bin/install.sh
63         fi
64 fi
65
66 cp /opt/opendaylight/current/certs/* /tmp
67
68 nohup python ${SDNC_BIN}/installCerts.py &
69
70 exec ${ODL_HOME}/bin/karaf server