update copyright to avoid noisy diff after build
[appc/deployment.git] / installation / appc / src / main / scripts / installFeatures.sh
1 #!/bin/bash
2
3 ###
4 # ============LICENSE_START=======================================================
5 # openECOMP : APP-C
6 # ================================================================================
7 # Copyright (C) 2017 OpenECOMP
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 ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
24 APPC_HOME=${APPC_HOME:-/opt/openecomp/appc}
25 APPC_FEATURE_DIR=${APPC_FEATURE_DIR:-${APPC_HOME}/features}
26
27 function featureInstall {
28 COUNT=0
29 while [ $COUNT -lt 10 ]; do
30   ${ODL_HOME}/bin/client -u karaf feature:install $1 2> /tmp/installErr
31   cat /tmp/installErr
32   if grep -q 'Failed to get the session' /tmp/installErr; then
33     sleep 10
34   else
35     let COUNT=10
36   fi
37   let COUNT=COUNT+1
38 done
39 }
40
41 APPC_FEATURES=" \
42  appc-provider \
43  appc-event-listener \
44  appc-dispatcher \
45  appc-chef-adapter \
46  appc-netconf-adapter \
47  appc-rest-adapter \
48  appc-dmaap-adapter \
49  appc-dg-util \
50  appc-metric \
51  appc-dg-shared \
52  appc-asdc-listener"
53  
54 echo "Enabling core APP-C features"
55 featureInstall odl-netconf-connector-all
56 featureInstall odl-restconf-noauth
57 featureInstall odl-netconf-topology
58
59 # When the karaf netconf feature gets installed, need to replace default password with OpenECOMP APP-C ODL Password
60 sed -i 's/admin<\/password>/Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U<\/password>/' ${ODL_HOME}/etc/opendaylight/karaf/99-netconf-connector.xml
61
62 echo "Installing APP-C Features"
63 echo ""
64
65 for feature in ${APPC_FEATURES}
66 do
67   if [ -f ${APPC_FEATURE_DIR}/${feature}/install-feature.sh ]
68   then
69     ${APPC_FEATURE_DIR}/${feature}/install-feature.sh
70   else
71     echo "No installer found for feature ${feature}"
72   fi
73 done