-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdeploy-test.sh
executable file
·278 lines (231 loc) · 6.37 KB
/
deploy-test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
#!/bin/bash
export JSLEE_HOME=$PWD
export LOG=$JSLEE_HOME/test-logs
export REPORTS=$JSLEE_HOME/test-reports
#export REPORT=$REPORTS/deploy-report.log
export DEPLOY_ERRCOUNT=0
export SUCCESS=0
function check
{
echo "Check $1"
pwd
cd $1
pwd
cp $LOG/deploy-jboss.log $LOG/temp-"$1"-0.log
echo "Deploy: $2"
ant $2
echo "Wait $3 seconds.."
sleep $3
diff $LOG/temp-"$1"-0.log $LOG/deploy-jboss.log > $LOG/temp-"$1".deploy.log
# grep error
ERRCOUNT=$(grep -ic " error " $LOG/temp-$1.deploy.log)
if [ "$ERRCOUNT" != 0 ]
then
PERSISTENCE_ERRCOUNT=$(grep -ic "Container is providing a null PersistenceUnitRootUrl" $LOG/temp-$1.deploy.log)
ERRCOUNT=$((ERRCOUNT-PERSISTENCE_ERRCOUNT))
fi
DEPLOY_ERRCOUNT=$((DEPLOY_ERRCOUNT+ERRCOUNT))
printf " %-30s | %-10s | %-20s\n" $1 "Deploy" "$ERRCOUNT error(s)"
printf " %-30s | %-10s | %-20s\n" $1 "Deploy" "$ERRCOUNT error(s)" >> $REPORT
if [ "$ERRCOUNT" != 0 ]
then
echo "" >> $REPORT
grep -i -A 4 -B 2 " error " $LOG/temp-$1.deploy.log >> $REPORT
echo -e "> ... see in file $LOG/temp-$1.deploy.log\n" >> $REPORT
fi
cp $LOG/deploy-jboss.log $LOG/temp-"$1"-1.log
echo "Undeploy: $4"
ant $4
echo "Wait $3 seconds.."
sleep $5
diff $LOG/temp-"$1"-1.log $LOG/deploy-jboss.log > $LOG/temp-"$1".undeploy.log
# grep error
ERRCOUNT=$(grep -ic " error " $LOG/temp-$1.undeploy.log)
DEPLOY_ERRCOUNT=$((DEPLOY_ERRCOUNT+ERRCOUNT))
printf " %-30s | %-10s | %-20s\n" $1 "Undeploy" "$ERRCOUNT error(s)"
printf " %-30s | %-10s | %-20s\n" $1 "Undeploy" "$ERRCOUNT error(s)" >> $REPORT
if [ "$ERRCOUNT" != 0 ]
then
echo "" >> $REPORT
grep -i -A 4 -B 2 " error " $LOG/temp-$1.undeploy.log >> $REPORT
echo -e "> ... see in file $LOG/temp-$1.undeploy.log\n" >> $REPORT
fi
cd ..
}
# Start JSLEE
export JBOSS_HOME=$JSLEE_HOME/jboss-5.1.0.GA
export DIAMETER_STACK=$JSLEE_HOME/extra/restcomm-diameter
export SS7_STACK=$JSLEE_HOME/extra/restcomm-ss7/restcomm-jss7-*/ss7-jboss
export SMPP_SERVER=$JSLEE_HOME/extra/restcomm-smpp-extensions/restcomm-smpp-extensions-*/jboss5
echo $JBOSS_HOME
export START=1
$JBOSS_HOME/bin/run.sh > $LOG/deploy-jboss.log 2>&1 &
JBOSS_PID="$!"
echo "JBOSS: $JBOSS_PID"
#sleep 120
TIME=0
while :; do
sleep 10
TIME=$((TIME+10))
echo " .. $TIME seconds"
STARTED_IN=$(grep -c " Started in " $LOG/deploy-jboss.log)
if [ "$STARTED_IN" == 1 ]; then break; fi
if [ $TIME -gt 300 ]; then
export START=0
break
fi
done
if [ "$START" -eq 0 ]; then
echo "There is a problem with starting JBoss!"
echo "Wait 10 seconds.."
pkill -TERM -P $JBOSS_PID
sleep 10
exit $SUCCESS
fi
echo "================================================================================" >> $REPORT
echo "Deployment Test Report" >> $REPORT
echo "================================================================================" >> $REPORT
# Diameter
# Copy Diameter Mux sar to server/default/deploy
echo -e "\n Deploy jDiameter Stack Mux" >> $REPORT
cp -r $DIAMETER_STACK/restcomm-diameter-mux-*.sar $JBOSS_HOME/server/default/deploy
echo "Wait 10 seconds.."
sleep 10
# Resources
echo -e "\n RAs:\n" >> $REPORT
cd $JSLEE_HOME/resources
check diameter-base deploy 7 undeploy 7
ant -f diameter-base/build.xml deploy
echo "Wait 7 seconds.."
sleep 7
check diameter-cca deploy 7 undeploy 7
ant -f diameter-cca/build.xml deploy
echo "Wait 7 seconds.."
sleep 7
check diameter-gx deploy 7 undeploy 7
check diameter-rx deploy 7 undeploy 7
ant -f diameter-cca/build.xml undeploy
echo "Wait 7 seconds.."
sleep 7
check diameter-cx-dx deploy 7 undeploy 7
check diameter-gq deploy 7 undeploy 7
check diameter-rf deploy 7 undeploy 7
check diameter-ro deploy 7 undeploy 7
check diameter-s6a deploy 7 undeploy 7
check diameter-sh-client deploy 7 undeploy 7
check diameter-sh-server deploy 7 undeploy 7
cd $JSLEE_HOME/resources
ant -f diameter-base/build.xml undeploy
echo "Wait 7 seconds.."
sleep 7
echo -e "\n Enablers:\n" >> $REPORT
# fix hss-client deploy-all
cd $JSLEE_HOME/resources
ant -f diameter-base/build.xml deploy
echo "Wait 7 seconds.."
sleep 7
ant -f diameter-sh-client/build.xml deploy
echo "Wait 7 seconds.."
sleep 7
cd $JSLEE_HOME/enablers
check hss-client deploy 10 undeploy 10
# fix hss-client undeploy-all
cd $JSLEE_HOME/resources
ant -f diameter-sh-client/build.xml undeploy
echo "Wait 7 seconds.."
sleep 7
ant -f diameter-base/build.xml undeploy
echo "Wait 7 seconds.."
sleep 7
# Remove Diameter Mux sar from server/default/deploy
echo -e "\n Undeploy jDiameter Stack Mux\n" >> $REPORT
rm -rf $JBOSS_HOME/server/default/deploy/restcomm-diameter-mux-*.sar
echo "Wait 30 seconds.."
sleep 30
#
echo -e "\n RAs:\n" >> $REPORT
# SS7
# Install jSS7 Stack
echo -e " Deploy jSS7 Stack\n" >> $REPORT
cd $SS7_STACK
ant deploy
echo "Wait 7 seconds.."
sleep 7
cd $JSLEE_HOME/resources
SS7_RA="map cap tcap isup"
for dir in $SS7_RA
do
if [ $dir != "isup" ]
then
echo $dir
check $dir deploy 15 undeploy 15
fi
done
# Uninstall jSS7 Stack
echo -e "\n Undeploy jSS7 Stack\n" >> $REPORT
cd $SS7_STACK
ant undeploy
echo "Wait 7 seconds.."
sleep 7
# Other
# Deploy SMPP Server for SMPP RA
cd $SMPP_SERVER
ant deploy
cd $JSLEE_HOME/resources
for dir in */
do
dir=${dir%*/}
if [ "$dir" == "${dir%diameter*}" ] && [ "${SS7_RA/$dir}" = "$SS7_RA" ]
then
echo "${dir} is not in Diameter and SS7"
check $dir deploy 7 undeploy 7
fi
done
cd $SMPP_SERVER
ant undeploy
# Examples
echo -e "\n Examples:\n" >> $REPORT
cd $JSLEE_HOME/examples
for dir in */
do
dir=${dir%*/}
echo ${dir##*/}
case $dir in
call-controller2)
check $dir deploy-all 10 undeploy-all 20
;;
slee-connectivity)
check $dir deploy 7 undeploy 7
;;
google-talk-bot)
;;
*)
check $dir deploy-all 10 undeploy-all 10
;;
esac
done
# Enablers
echo -e "\n Enablers:\n" >> $REPORT
cd $JSLEE_HOME/enablers
for dir in */
do
dir=${dir%*/}
if [ $dir != "hss-client" ]
then
echo $dir
check $dir deploy-all 7 undeploy-all 7
fi
done
echo -e "\nDeploy Summary: $DEPLOY_ERRCOUNT error(s)\n"
echo -e "\nDeploy Summary: $DEPLOY_ERRCOUNT error(s)\n" >> $REPORT
echo "================================================================================" >> $REPORT
if [ "$DEPLOY_ERRCOUNT" == 0 ]
then
export SUCCESS=1
fi
pkill -TERM -P $JBOSS_PID
echo "Wait 10 seconds.."
sleep 10
rm -f $LOG/temp-*-0.log
rm -f $LOG/temp-*-1.log
exit $SUCCESS