4 # ============LICENSE_START=======================================================
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
13 # http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
24 # This script runs during docker image build.
25 # It starts opendaylight, installs the appc features, then shuts down opendaylight.
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}
34 appcInstallStartTime=$(date +%s)
36 ODL_BOOT_FEATURES_EXTRA="odl-netconf-connector,odl-restconf-noauth,odl-netconf-clustered-topology,odl-mdsal-clustering"
37 sed -i -e "\|featuresBoot[^a-zA-Z]|s|$|,${ODL_BOOT_FEATURES_EXTRA}|" $ODL_HOME/etc/org.apache.karaf.features.cfg
39 echo "Starting OpenDaylight"
41 echo "Waiting ${SLEEP_TIME} seconds for OpenDaylight to initialize"
44 echo "Checking that Karaf can be accessed"
45 clientOutput=$(${ODL_HOME}/bin/client shell:echo KarafLoginCheckIsWorking)
46 if echo "$clientOutput" | grep -q "KarafLoginCheckIsWorking"; then
47 echo "Karaf login succeeded"
49 echo "Error during Karaf login"
53 echo "Copying a working version of the logging configuration into the opendaylight etc folder"
54 cp ${APPC_HOME}/data/org.ops4j.pax.logging.cfg ${ODL_HOME}/etc/org.ops4j.pax.logging.cfg
55 #echo "Copying a new version of aaf cadi shiro into the opendaylight deploy folder"
56 #cp ${APPC_HOME}/data/aaf-shiro-aafrealm-osgi-bundle.jar ${ODL_HOME}/deploy/aaf-shiro-aafrealm-osgi-bundle.jar
58 echo "Installing APPC platform features"
59 ${APPC_HOME}/bin/installFeatures.sh
61 echo "Adding a property system.properties for AAF cadi.properties location"
62 echo "" >> ${ODL_HOME}/etc/system.properties
63 echo "cadi_prop_files=${APPC_HOME}/data/properties/cadi.properties" >> ${ODL_HOME}/etc/system.properties
64 echo "" >> ${ODL_HOME}/etc/system.properties
66 echo "Adding a value to property appc.asdc.env in appc.properties for appc-asdc-listener feature"
67 echo "" >> $APPC_HOME/data/properties/appc.properties
68 echo "appc.asdc.env=$DMAAP_TOPIC_ENV" >> $APPC_HOME/data/properties/appc.properties
69 echo "" >> $APPC_HOME/data/properties/appc.properties
71 echo "Copying the aaa shiro configuration into opendaylight"
72 cp ${APPC_HOME}/data/aaa-app-config.xml ${ODL_HOME}/etc/opendaylight/datastore/initial/config/aaa-app-config.xml
74 echo "Copying jetty, keystore for https into opendalight"
75 cp ${APPC_HOME}/data/jetty.xml ${ODL_HOME}/etc/jetty.xml
76 cp ${APPC_HOME}/data/keystore ${ODL_HOME}/etc/keystore
77 cp ${APPC_HOME}/data/custom.properties ${ODL_HOME}/etc/custom.properties
79 echo "Stopping OpenDaylight and waiting for it to stop"
81 #The karaf command will exit when odl shuts down. This is the most reliable way to wait for opendaylight to stop
82 #before exiting the docker container.
83 ${ODL_HOME}/bin/client
84 echo "Karaf process has stopped"
87 appcInstallEndTime=$(date +%s)
88 echo "Total Appc install took $(expr $appcInstallEndTime - $appcInstallStartTime) seconds"