4ac996d48129fc9ecab5d7123346fc8be6b894d4
[appc/deployment.git] / installation / appc / src / main / scripts / dockerInstall.sh
1 #!/bin/bash
2
3 ###
4 # ============LICENSE_START=======================================================
5 # APPC
6 # ================================================================================
7 # Copyright (C) 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 runs during docker image build.
25 # It starts opendaylight, installs the appc features, then shuts down opendaylight.
26 #
27 ODL_HOME=${ODL_HOME:-/opt/opendaylight}
28 ODL_ADMIN_PASSWORD=${ODL_ADMIN_PASSWORD:-Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U}
29 SDNC_HOME=${SDNC_HOME:-/opt/onap/ccsdk}
30 APPC_HOME=${APPC_HOME:-/opt/onap/appc}
31 SLEEP_TIME=${SLEEP_TIME:-120}
32 MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0}
33
34 appcInstallStartTime=$(date +%s)
35
36
37 echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize"
38 sleep ${SLEEP_TIME}
39
40 echo "Checking that Karaf can be accessed"
41 clientOutput=$(${ODL_HOME}/bin/client shell:echo KarafLoginCheckIsWorking)
42 if echo "$clientOutput" | grep -q "KarafLoginCheckIsWorking"; then
43 echo "Karaf login succeeded"
44 else
45 echo "Error during Karaf login"
46 exit 1
47 fi
48
49 echo "Copying a working version of the logging configuration into the opendaylight etc folder"
50 cp ${APPC_HOME}/data/org.ops4j.pax.logging.cfg ${ODL_HOME}/etc/org.ops4j.pax.logging.cfg
51 #echo "Copying a new version of aaf cadi shiro into the opendaylight deploy folder"
52 #cp ${APPC_HOME}/data/aaf-shiro-aafrealm-osgi-bundle.jar ${ODL_HOME}/deploy/aaf-shiro-aafrealm-osgi-bundle.jar
53
54 echo "Installing APPC platform features"
55 ${APPC_HOME}/bin/installFeatures.sh
56
57 echo "Adding a property system.properties for AAF cadi.properties location"
58 echo "" >> ${ODL_HOME}/etc/system.properties
59 echo "cadi_prop_files=${APPC_HOME}/data/properties/cadi.properties" >> ${ODL_HOME}/etc/system.properties
60 echo "" >> ${ODL_HOME}/etc/system.properties
61
62 echo "Adding a value to property appc.asdc.env in appc.properties for appc-asdc-listener feature"
63 echo "" >> $APPC_HOME/data/properties/appc.properties
64 echo "appc.asdc.env=$DMAAP_TOPIC_ENV" >> $APPC_HOME/data/properties/appc.properties
65 echo "" >> $APPC_HOME/data/properties/appc.properties
66
67 #echo "Stopping OpenDaylight and waiting for it to stop"
68 #${ODL_HOME}/bin/stop
69 #The karaf command will exit when odl shuts down. This is the most reliable way to wait for opendaylight to stop
70 #before exiting the docker container.
71 #${ODL_HOME}/bin/client
72 #echo "Karaf process has stopped"
73 #sleep 10s
74
75 appcInstallEndTime=$(date +%s)
76 echo "Total Appc install took $(expr $appcInstallEndTime - $appcInstallStartTime) seconds"