d26826c3424043a870ff1a3f8e615517aac95bd1
[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-dmaap-adapter \
61  onap-appc-chef-adapter \
62  onap-appc-netconf-adapter \
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-event-listener \
87  onap-appc-network-inventory-client \
88  onap-appc-design-services \
89  onap-appc-interfaces-service"
90  
91  APPC_FEATURES_UNZIP=" \
92  appc-core \
93  appc-metric \
94  appc-dmaap-adapter \
95  appc-event-listener \
96  appc-chef-adapter \
97  appc-netconf-adapter \
98  appc-rest-adapter \
99  appc-lifecycle-management \
100  appc-dispatcher \
101  appc-provider \
102  appc-dg-util \
103  appc-dg-shared \
104  appc-sdc-listener \
105  appc-oam \
106  appc-iaas-adapter \
107  appc-ansible-adapter \
108  appc-sequence-generator \
109  appc-config-generator \
110  appc-config-data-services \
111  appc-config-adaptor \
112  appc-config-audit \
113  appc-config-encryption-tool \
114  appc-config-flow-controller \
115  appc-config-params \
116  appc-artifact-handler \
117  appc-aai-client \
118  appc-network-inventory-client \
119  appc-design-services \
120  appc-interfaces-service"
121  
122
123  
124
125
126 #echo "Enabling core APP-C features"
127 #featureInstall odl-netconf-connector odl-restconf-noauth odl-netconf-clustered-topology odl-mdsal-clustering
128 #waitForKaraf
129 echo "Installing APP-C Features"
130 echo ""
131
132 for feature in ${APPC_FEATURES_UNZIP}
133 do
134   if [ -f ${APPC_FEATURE_DIR}/${feature}/install-feature.sh ]
135   then
136     ${APPC_FEATURE_DIR}/${feature}/install-feature.sh
137   else
138     echo "No installer found for feature ${feature}"
139   fi
140 done
141
142 for feature in ${APPC_FEATURES_1}
143 do
144   group1Features="${group1Features} ${feature}"
145 done
146
147   echo "Installing features: ${group1Features}"
148   start=$(date +%s)
149 sshpass -pkaraf ssh -o StrictHostKeyChecking=no karaf@localhost -p 8101 "feature:install -r ${group1Features}"
150 #  ${ODL_HOME}/bin/client "feature:install -r ${group1Features}"
151   end=$(date +%s)
152   echo "Install of features took $(expr $end - $start) seconds"
153   sleep 7s
154   echo "Sleep Finished"
155
156   echo "Installing dispatcher features"
157   start=$(date +%s)
158 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"
159 #  ${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"
160   end=$(date +%s)
161   echo "Install of dispatcher features took $(expr $end - $start) seconds"
162   sleep 7s
163   echo "Sleep Finished"
164
165 for feature in ${APPC_FEATURES_2}
166 do
167   group2Features="${group2Features} ${feature}"
168 done
169
170   echo "Installing features: ${group2Features}"
171   start=$(date +%s)
172 sshpass -pkaraf ssh -o StrictHostKeyChecking=no karaf@localhost -p 8101 "feature:install -r ${group2Features}"
173 #  ${ODL_HOME}/bin/client "feature:install -r ${group2Features}"
174   end=$(date +%s)
175   echo "Install of features took $(expr $end - $start) seconds"
176   sleep 7s
177   echo "Sleep Finished"
178   
179 for feature in ${APPC_FEATURES_3}
180 do
181   group3Features="${group3Features} ${feature}"
182 done
183
184   echo "Installing features: ${group3Features}"
185   start=$(date +%s)
186 sshpass -pkaraf ssh -o StrictHostKeyChecking=no karaf@localhost -p 8101 "feature:install -r ${group3Features}"
187 #  ${ODL_HOME}/bin/client "feature:install -r ${group3Features}"
188   end=$(date +%s)
189   echo "Install of features took $(expr $end - $start) seconds"
190   sleep 7s
191   echo "Sleep Finished"
192
193 #Copy json template file for use by the generic restart DG aai fix
194 mkdir -p /opt/onap/appc/restapi/templates
195 cp /opt/onap/appc/data/aai-named-query.json /opt/onap/appc/restapi/templates/aai-named-query.json
196