Changes for ODL SR2
[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   ${ODL_HOME}/bin/client feature:install $1 2> /tmp/installErr
32   cat /tmp/installErr
33   if grep -q 'Failed to get the session' /tmp/installErr; then
34     sleep 10
35   else
36     let COUNT=10
37   fi
38   let COUNT=COUNT+1
39 done
40 }
41 function waitForKaraf {
42 COUNT=0
43 while [ $COUNT -lt 20 ]; do
44   ${ODL_HOME}/bin/client feature:list $1 2> /tmp/installErr
45   cat /tmp/installErr
46   if grep -q 'Failed to get the session' /tmp/installErr; then
47     sleep 10
48   else
49     let COUNT=20
50   fi
51   let COUNT=COUNT+1
52 done
53 }
54
55 APPC_FEATURES_1=" \
56  onap-appc-core \
57  onap-appc-metric \
58  onap-appc-dmaap-adapter \
59  onap-appc-chef-adapter \
60  onap-appc-netconf-adapter \
61  onap-appc-rest-adapter \
62  onap-appc-lifecycle-management \
63  onap-appc-license-manager"
64  
65  APPC_FEATURES_2=" \
66  onap-appc-dg-util \
67  onap-appc-dg-shared \
68  onap-appc-sdc-listener \
69  onap-appc-oam \
70  onap-appc-iaas-adapter \
71  onap-appc-ansible-adapter \
72  onap-appc-sequence-generator \
73  onap-appc-config-generator \
74  onap-appc-config-data-services \
75  onap-appc-config-adaptor \
76  onap-appc-config-audit \
77  onap-appc-config-encryption-tool \
78  onap-appc-config-flow-controller \
79  onap-appc-config-params"
80  
81  APPC_FEATURES_3=" \
82  onap-appc-artifact-handler \
83  onap-appc-aai-client \
84  onap-appc-event-listener \
85  onap-appc-network-inventory-client \
86  onap-appc-design-services \
87  onap-appc-interfaces-service"
88  
89  APPC_FEATURES_UNZIP=" \
90  appc-core \
91  appc-metric \
92  appc-dmaap-adapter \
93  appc-event-listener \
94  appc-chef-adapter \
95  appc-netconf-adapter \
96  appc-rest-adapter \
97  appc-lifecycle-management \
98  appc-dispatcher \
99  appc-provider \
100  appc-dg-util \
101  appc-dg-shared \
102  appc-sdc-listener \
103  appc-oam \
104  appc-iaas-adapter \
105  appc-ansible-adapter \
106  appc-sequence-generator \
107  appc-config-generator \
108  appc-config-data-services \
109  appc-config-adaptor \
110  appc-config-audit \
111  appc-config-encryption-tool \
112  appc-config-flow-controller \
113  appc-config-params \
114  appc-artifact-handler \
115  appc-aai-client \
116  appc-network-inventory-client \
117  appc-design-services \
118  appc-interfaces-service"
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   ${ODL_HOME}/bin/client "feature:install -r ${group1Features}"
148   end=$(date +%s)
149   echo "Install of features took $(expr $end - $start) seconds"
150   sleep 7s
151   echo "Sleep Finished"
152
153   echo "Installing dispatcher features"
154   start=$(date +%s)
155   ${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"
156   end=$(date +%s)
157   echo "Install of dispatcher features took $(expr $end - $start) seconds"
158   sleep 7s
159   echo "Sleep Finished"
160
161 for feature in ${APPC_FEATURES_2}
162 do
163   group2Features="${group2Features} ${feature}"
164 done
165
166   echo "Installing features: ${group2Features}"
167   start=$(date +%s)
168   ${ODL_HOME}/bin/client "feature:install -r ${group2Features}"
169   end=$(date +%s)
170   echo "Install of features took $(expr $end - $start) seconds"
171   sleep 7s
172   echo "Sleep Finished"
173   
174 for feature in ${APPC_FEATURES_3}
175 do
176   group3Features="${group3Features} ${feature}"
177 done
178
179   echo "Installing features: ${group3Features}"
180   start=$(date +%s)
181   ${ODL_HOME}/bin/client "feature:install -r ${group3Features}"
182   end=$(date +%s)
183   echo "Install of features took $(expr $end - $start) seconds"
184   sleep 7s
185   echo "Sleep Finished"
186
187 #Copy json template file for use by the generic restart DG aai fix
188 mkdir -p /opt/onap/appc/restapi/templates
189 cp /opt/onap/appc/data/aai-named-query.json /opt/onap/appc/restapi/templates/aai-named-query.json
190