Docker changes for dmaap microservice
[appc/deployment.git] / installation / appc / src / main / scripts / installFeatures.sh
1 #!/bin/bash
2
3 ###
4 # ============LICENSE_START=======================================================
5 # APPC
6 # ================================================================================
7 # Copyright (C) 2017-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 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 ###
23
24 ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
25 APPC_HOME=${APPC_HOME:-/opt/onap/appc}
26 APPC_FEATURE_DIR=${APPC_FEATURE_DIR:-${APPC_HOME}/features}
27
28 function featureInstall {
29 COUNT=0
30 while [ $COUNT -lt 10 ]; do
31 sshpass -pkaraf ssh -o StrictHostKeyChecking=no karaf@localhost -p 8101 "feature:install $1" 2> /tmp/installErr
32 #  ${ODL_HOME}/bin/client feature:install $1 2> /tmp/installErr
33   cat /tmp/installErr
34   if grep -q 'Failed to get the session' /tmp/installErr; then
35     sleep 10
36   else
37     let COUNT=10
38   fi
39   let COUNT=COUNT+1
40 done
41 }
42 function waitForKaraf {
43 COUNT=0
44 while [ $COUNT -lt 20 ]; do
45 sshpass -pkaraf ssh -o StrictHostKeyChecking=no karaf@localhost -p 8101 "feature:list $1" 2> /tmp/installErr
46 #  ${ODL_HOME}/bin/client feature:list $1 2> /tmp/installErr
47   cat /tmp/installErr
48   if grep -q 'Failed to get the session' /tmp/installErr; then
49     sleep 10
50   else
51     let COUNT=20
52   fi
53   let COUNT=COUNT+1
54 done
55 }
56
57 APPC_FEATURES_1=" \
58  onap-appc-core \
59  onap-appc-metric \
60  onap-appc-chef-adapter \
61  onap-appc-netconf-adapter \
62  onap-appc-service-communicator \
63  onap-appc-rest-adapter \
64  onap-appc-lifecycle-management \
65  onap-appc-license-manager"
66  
67  APPC_FEATURES_2=" \
68  onap-appc-dg-util \
69  onap-appc-dg-shared \
70  onap-appc-sdc-listener \
71  onap-appc-oam \
72  onap-appc-iaas-adapter \
73  onap-appc-ansible-adapter \
74  onap-appc-sequence-generator \
75  onap-appc-config-generator \
76  onap-appc-config-data-services \
77  onap-appc-config-adaptor \
78  onap-appc-config-audit \
79  onap-appc-config-encryption-tool \
80  onap-appc-config-flow-controller \
81  onap-appc-config-params"
82  
83  APPC_FEATURES_3=" \
84  onap-appc-artifact-handler \
85  onap-appc-aai-client \
86  onap-appc-network-inventory-client \
87  onap-appc-design-services \
88  onap-appc-interfaces-service"
89  
90  APPC_FEATURES_UNZIP=" \
91  appc-core \
92  appc-metric \
93  appc-chef-adapter \
94  appc-netconf-adapter \
95  appc-rest-adapter \
96  appc-lifecycle-management \
97  appc-dispatcher \
98  appc-provider \
99  appc-dg-util \
100  appc-dg-shared \
101  appc-sdc-listener \
102  appc-oam \
103  appc-iaas-adapter \
104  appc-ansible-adapter \
105  appc-sequence-generator \
106  appc-config-generator \
107  appc-config-data-services \
108  appc-config-adaptor \
109  appc-config-audit \
110  appc-config-encryption-tool \
111  appc-config-flow-controller \
112  appc-config-params \
113  appc-artifact-handler \
114  appc-aai-client \
115  appc-network-inventory-client \
116  appc-design-services \
117  appc-interfaces-service \
118  appc-service-communicator"
119  
120
121  
122
123
124 #echo "Enabling core APP-C features"
125 #featureInstall odl-netconf-connector odl-restconf-noauth odl-netconf-clustered-topology odl-mdsal-clustering
126 #waitForKaraf
127 echo "Installing APP-C Features"
128 echo ""
129
130 for feature in ${APPC_FEATURES_UNZIP}
131 do
132   if [ -f ${APPC_FEATURE_DIR}/${feature}/install-feature.sh ]
133   then
134     ${APPC_FEATURE_DIR}/${feature}/install-feature.sh
135   else
136     echo "No installer found for feature ${feature}"
137   fi
138 done
139
140 for feature in ${APPC_FEATURES_1}
141 do
142   group1Features="${group1Features} ${feature}"
143 done
144
145   echo "Installing features: ${group1Features}"
146   start=$(date +%s)
147 sshpass -pkaraf ssh -o StrictHostKeyChecking=no karaf@localhost -p 8101 "feature:install -r ${group1Features}"
148 #  ${ODL_HOME}/bin/client "feature:install -r ${group1Features}"
149   end=$(date +%s)
150   echo "Install of features took $(expr $end - $start) seconds"
151   sleep 7s
152   echo "Sleep Finished"
153
154   echo "Installing dispatcher features"
155   start=$(date +%s)
156 sshpass -pkaraf ssh -o StrictHostKeyChecking=no karaf@localhost -p 8101 "feature:install -r onap-appc-request-handler onap-appc-command-executor onap-appc-lifecycle-management onap-appc-workflow-management lock-manager onap-appc-provider"
157 #  ${ODL_HOME}/bin/client "feature:install -r onap-appc-request-handler onap-appc-command-executor onap-appc-lifecycle-management onap-appc-workflow-management lock-manager onap-appc-provider"
158   end=$(date +%s)
159   echo "Install of dispatcher features took $(expr $end - $start) seconds"
160   sleep 7s
161   echo "Sleep Finished"
162
163 for feature in ${APPC_FEATURES_2}
164 do
165   group2Features="${group2Features} ${feature}"
166 done
167
168   echo "Installing features: ${group2Features}"
169   start=$(date +%s)
170 sshpass -pkaraf ssh -o StrictHostKeyChecking=no karaf@localhost -p 8101 "feature:install -r ${group2Features}"
171 #  ${ODL_HOME}/bin/client "feature:install -r ${group2Features}"
172   end=$(date +%s)
173   echo "Install of features took $(expr $end - $start) seconds"
174   sleep 7s
175   echo "Sleep Finished"
176   
177 for feature in ${APPC_FEATURES_3}
178 do
179   group3Features="${group3Features} ${feature}"
180 done
181
182   echo "Installing features: ${group3Features}"
183   start=$(date +%s)
184 sshpass -pkaraf ssh -o StrictHostKeyChecking=no karaf@localhost -p 8101 "feature:install -r ${group3Features}"
185 #  ${ODL_HOME}/bin/client "feature:install -r ${group3Features}"
186   end=$(date +%s)
187   echo "Install of features took $(expr $end - $start) seconds"
188   sleep 7s
189   echo "Sleep Finished"
190
191 #Copy json template file for use by the generic restart DG aai fix
192 mkdir -p /opt/onap/appc/restapi/templates
193 cp /opt/onap/appc/data/aai-named-query.json /opt/onap/appc/restapi/templates/aai-named-query.json
194