reportTestLocally.sh 65.8 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements.  See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1  (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# *      http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# *      contact@openairinterface.org
# */

23
24
function report_test_usage {
    echo "OAI CI VM script"
25
26
27
28
    echo "   Original Author: Raphael Defosseux"
    echo ""
    echo "Usage:"
    echo "------"
29
    echo "    oai-ci-vm-tool report-test [OPTIONS]"
30
    echo ""
31
    command_options_usage
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
function analyzePingFiles {
    for PING_CASE in $PING_LOGS
    do
        echo "      <tr>" >> ./test_simulator_results.html
        NAME=`echo $PING_CASE | sed -e "s#$ARCHIVES_LOC/##"`
        echo "        <td>$NAME</td>" >> ./test_simulator_results.html
        CMD=`egrep "COMMAND IS" $PING_CASE | sed -e "s#COMMAND IS: ##"`
        echo "        <td>$CMD</td>" >> ./test_simulator_results.html
        FILE_COMPLETE=`egrep -c "ping statistics" $PING_CASE`
        if [ $FILE_COMPLETE -eq 0 ]
        then
            echo "        <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
            echo "        <td>N/A</td>" >> ./test_simulator_results.html
        else
            NB_TR_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s# packets transmitted.*##"`
            NB_RC_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*packets transmitted, ##" -e "s# received,.*##"`
            if [ $NB_TR_PACKETS -eq $NB_RC_PACKETS ]
            then
                echo "        <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
            else
                echo "        <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
            fi
            echo "        <td>" >> ./test_simulator_results.html
            echo "            <pre>" >> ./test_simulator_results.html
            STATS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*received, ##" -e "s#, time.*##" -e "s# packet loss##"`
            echo "Packet Loss : $STATS" >> ./test_simulator_results.html
            RTTMIN=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[1] " " $5}'`
            echo "RTT Minimal : $RTTMIN" >> ./test_simulator_results.html
            RTTAVG=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[2] " " $5}'`
            echo "RTT Average : $RTTAVG" >> ./test_simulator_results.html
            RTTMAX=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[3] " " $5}'`
            echo "RTT Maximal : $RTTMAX" >> ./test_simulator_results.html
            echo "            </pre>" >> ./test_simulator_results.html
            echo "        </td>" >> ./test_simulator_results.html
        fi
        echo "      </tr>" >> ./test_simulator_results.html
    done
}

function analyzeIperfFiles {
    for IPERF_CASE in $IPERF_TESTS
    do
        echo "      <tr>" >> ./test_simulator_results.html
        NAME=`echo $IPERF_CASE | sed -e "s#$ARCHIVES_LOC/##"`
        echo "        <td>$NAME</td>" >> ./test_simulator_results.html
        CMD=`egrep "COMMAND IS" $IPERF_CASE | sed -e "s#COMMAND IS: ##"`
        echo "        <td>$CMD</td>" >> ./test_simulator_results.html
        REQ_BITRATE=`echo $CMD | sed -e "s#^.*-b ##" -e "s#-i 1.*##"`
        if [[ $REQ_BITRATE =~ .*K.* ]]
        then
            REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#K##"`
            FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000.0" | bc -l`
        fi
        if [[ $REQ_BITRATE =~ .*M.* ]]
        then
            REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#M##"`
            FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000000.0" | bc -l`
        fi
        if [[ $REQ_BITRATE =~ .*G.* ]]
        then
            REQ_BITRATE=`echo $REQ_BITRATE | sed -e "s#G##"`
            FLOAT_REQ_BITRATE=`echo "$REQ_BITRATE * 1000000000.0" | bc -l`
        fi
        FILE_COMPLETE=`egrep -c "Server Report" $IPERF_CASE`
        if [ $FILE_COMPLETE -eq 0 ]
        then
            SERVER_FILE=`echo $IPERF_CASE | sed -e "s#client#server#"`
            FLOAT_EFF_BITRATE=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*Bytes *##" -e "s#sec *.*#sec#" | awk 'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; printf "%.0f", br}'`
102
            EFFECTIVE_BITRATE=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*Bytes *##" -e "s#sec *.*#sec#" | awk 'BEGIN{s=0;n=0}{n++;if ($2 ~/Mbits/){a = $1 * 1000000};if ($2 ~/Kbits/){a = $1 * 1000};s=s+a}END{br=s/n; if(br>1000000){printf "%.2f MBits/sec", br/1000000}else{printf "%.2f KBits/sec", br/1000}}'`
103
            PERF=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.2f", $0}'`
104
            PERF_INT=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.0f", $0}'`
105
106
107
            JITTER=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*/sec *##" -e "s# *ms.*##" | awk 'BEGIN{s=0;n=0}{n++;s+=$1}END{jitter=s/n; printf "%.3f ms", jitter}'`
            PACKETLOSS_NOSIGN=`grep --color=never sec $SERVER_FILE | sed -e "s#^.*(##" -e "s#%.*##" | awk 'BEGIN{s=0;n=0}{n++;s+=$1}END{per=s/n; printf "%.1f", per}'`
            PACKETLOSS=`echo "${PACKETLOSS_NOSIGN}%"`
108
109
110
111
112
113
            if [[ $PERF_INT -lt 80 ]]
            then
                echo "        <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
            else
                echo "        <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
            fi
114
        else
115
            EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "bits/sec" | sed -e "s#^.*Bytes *##" -e "s#sec.*#sec#"`
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
            if [[ $EFFECTIVE_BITRATE =~ .*Kbits/sec.* ]]
            then
                EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Kbits/sec.*##"`
                FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000" | bc -l`
            fi
            if [[ $EFFECTIVE_BITRATE =~ .*Mbits/sec.* ]]
            then
                EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Mbits/sec.*##"`
                FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000000" | bc -l`
            fi
            if [[ $EFFECTIVE_BITRATE =~ .*Gbits/sec.* ]]
            then
                EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Gbits/sec.*##"`
                FLOAT_EFF_BITRATE=`echo "$EFFECTIVE_BITRATE * 1000000000" | bc -l`
            fi
            PERF=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.2f", $0}'`
            PERF_INT=`echo "100 * $FLOAT_EFF_BITRATE / $FLOAT_REQ_BITRATE" | bc -l | awk '{printf "%.0f", $0}'`
            if [[ $PERF_INT -lt 70 ]]
            then
                echo "        <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
            else
                echo "        <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
            fi
139
140
141
            EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "bits/sec" | sed -e "s#^.*Bytes *##" -e "s#sec.*#sec#"`
            JITTER=`tail -n3 $IPERF_CASE | egrep "bits/sec" | sed -e "s#^.*bits/sec *##" -e "s#ms.*#ms#"`
            PACKETLOSS=`tail -n3 $IPERF_CASE | egrep "bits/sec" | sed -e "s#^.*(##" -e "s#).*##"`
142
143
144
145
146
147
148
149
150
151
152
153
154
        fi
        echo "        <td>" >> ./test_simulator_results.html
        echo "            <pre>" >> ./test_simulator_results.html
        echo "Bitrate      : $EFFECTIVE_BITRATE" >> ./test_simulator_results.html
        echo "Bitrate Perf : $PERF %" >> ./test_simulator_results.html
        echo "Jitter       : $JITTER" >> ./test_simulator_results.html
        echo "Packet Loss  : $PACKETLOSS" >> ./test_simulator_results.html
        echo "            </pre>" >> ./test_simulator_results.html
        echo "        </td>" >> ./test_simulator_results.html
        echo "      </tr>" >> ./test_simulator_results.html
    done
}

155
156
157
158
function report_test {
    echo "############################################################"
    echo "OAI CI VM script"
    echo "############################################################"
159

160
    echo "JENKINS_WKSP        = $JENKINS_WKSP"
161

162
    cd ${JENKINS_WKSP}
163

164
165
166
    echo "<!DOCTYPE html>" > ./test_simulator_results.html
    echo "<html class=\"no-js\" lang=\"en-US\">" >> ./test_simulator_results.html
    echo "<head>" >> ./test_simulator_results.html
167
168
169
170
    echo "  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">" >> ./test_simulator_results.html
    echo "  <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\">" >> ./test_simulator_results.html
    echo "  <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>" >> ./test_simulator_results.html
    echo "  <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\"></script>" >> ./test_simulator_results.html
171
172
173
    echo "  <title>Simulator Results for $JOB_NAME job build #$BUILD_ID</title>" >> ./test_simulator_results.html
    echo "  <base href = \"http://www.openairinterface.org/\" />" >> ./test_simulator_results.html
    echo "</head>" >> ./test_simulator_results.html
174
    echo "<body><div class=\"container\">" >> ./test_simulator_results.html
175
    echo "  <br>" >> ./test_simulator_results.html
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
    echo "  <table style=\"border-collapse: collapse; border: none;\">" >> ./test_simulator_results.html
    echo "    <tr style=\"border-collapse: collapse; border: none;\">" >> ./test_simulator_results.html
    echo "      <td style=\"border-collapse: collapse; border: none;\">" >> ./test_simulator_results.html
    echo "        <a href=\"http://www.openairinterface.org/\">" >> ./test_simulator_results.html
    echo "           <img src=\"/wp-content/uploads/2016/03/cropped-oai_final_logo2.png\" alt=\"\" border=\"none\" height=50 width=150>" >> ./test_simulator_results.html
    echo "           </img>" >> ./test_simulator_results.html
    echo "        </a>" >> ./test_simulator_results.html
    echo "      </td>" >> ./test_simulator_results.html
    echo "      <td style=\"border-collapse: collapse; border: none; vertical-align: center;\">" >> ./test_simulator_results.html
    echo "        <b><font size = \"6\">Job Summary -- Job: $JOB_NAME -- Build-ID: $BUILD_ID</font></b>" >> ./test_simulator_results.html
    echo "      </td>" >> ./test_simulator_results.html
    echo "    </tr>" >> ./test_simulator_results.html
    echo "  </table>" >> ./test_simulator_results.html
    echo "  <br>" >> ./test_simulator_results.html
    echo "   <table border = \"1\">" >> ./test_simulator_results.html
191
    echo "      <tr>" >> ./test_simulator_results.html
192
    echo "        <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-time\"></span> Build Start Time (UTC)</td>" >> ./test_simulator_results.html
193
    echo "        <td>TEMPLATE_BUILD_TIME</td>" >> ./test_simulator_results.html
194
195
    echo "      </tr>" >> ./test_simulator_results.html
    echo "      <tr>" >> ./test_simulator_results.html
196
    echo "        <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-cloud-upload\"></span> GIT Repository</td>" >> ./test_simulator_results.html
197
    echo "        <td><a href=\"$GIT_URL\">$GIT_URL</a></td>" >> ./test_simulator_results.html
198
199
    echo "      </tr>" >> ./test_simulator_results.html
    echo "      <tr>" >> ./test_simulator_results.html
200
    echo "        <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-wrench\"></span> Job Trigger</td>" >> ./test_simulator_results.html
201
202
    if [ $PU_TRIG -eq 1 ]; then echo "        <td>Push Event</td>" >> ./test_simulator_results.html; fi
    if [ $MR_TRIG -eq 1 ]; then echo "        <td>Merge-Request</td>" >> ./test_simulator_results.html; fi
203
    echo "      </tr>" >> ./test_simulator_results.html
204
205
206
    if [ $PU_TRIG -eq 1 ]
    then
        echo "      <tr>" >> ./test_simulator_results.html
207
        echo "        <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tree-deciduous\"></span> Branch</td>" >> ./test_simulator_results.html
208
209
210
        echo "        <td>$SOURCE_BRANCH</td>" >> ./test_simulator_results.html
        echo "      </tr>" >> ./test_simulator_results.html
        echo "      <tr>" >> ./test_simulator_results.html
211
        echo "        <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Commit ID</td>" >> ./test_simulator_results.html
212
213
        echo "        <td>$SOURCE_COMMIT_ID</td>" >> ./test_simulator_results.html
        echo "      </tr>" >> ./test_simulator_results.html
214
215
216
217
218
219
220
221
        if [ -e .git/CI_COMMIT_MSG ]
        then
            echo "      <tr>" >> ./test_simulator_results.html
            echo "        <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-comment\"></span> Commit Message</td>" >> ./test_simulator_results.html
            MSG=`cat .git/CI_COMMIT_MSG`
            echo "        <td>$MSG</td>" >> ./test_simulator_results.html
            echo "      </tr>" >> ./test_simulator_results.html
        fi
222
223
224
225
    fi
    if [ $MR_TRIG -eq 1 ]
    then
        echo "      <tr>" >> ./test_simulator_results.html
226
        echo "        <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-log-out\"></span> Source Branch</td>" >> ./test_simulator_results.html
227
228
229
        echo "        <td>$SOURCE_BRANCH</td>" >> ./test_simulator_results.html
        echo "      </tr>" >> ./test_simulator_results.html
        echo "      <tr>" >> ./test_simulator_results.html
230
        echo "        <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Source Commit ID</td>" >> ./test_simulator_results.html
231
232
        echo "        <td>$SOURCE_COMMIT_ID</td>" >> ./test_simulator_results.html
        echo "      </tr>" >> ./test_simulator_results.html
233
234
235
236
237
238
239
240
        if [ -e .git/CI_COMMIT_MSG ]
        then
            echo "      <tr>" >> ./test_simulator_results.html
            echo "        <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-comment\"></span> Commit Message</td>" >> ./test_simulator_results.html
            MSG=`cat .git/CI_COMMIT_MSG`
            echo "        <td>$MSG</td>" >> ./test_simulator_results.html
            echo "      </tr>" >> ./test_simulator_results.html
        fi
241
        echo "      <tr>" >> ./test_simulator_results.html
242
        echo "        <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-log-in\"></span> Target Branch</td>" >> ./test_simulator_results.html
243
244
245
        echo "        <td>$TARGET_BRANCH</td>" >> ./test_simulator_results.html
        echo "      </tr>" >> ./test_simulator_results.html
        echo "      <tr>" >> ./test_simulator_results.html
246
        echo "        <td bgcolor = \"lightcyan\" > <span class=\"glyphicon glyphicon-tag\"></span> Target Commit ID</td>" >> ./test_simulator_results.html
247
248
249
250
251
        echo "        <td>$TARGET_COMMIT_ID</td>" >> ./test_simulator_results.html
        echo "      </tr>" >> ./test_simulator_results.html
    fi
    echo "   </table>" >> ./test_simulator_results.html
    echo "   <h2>Test Summary</h2>" >> ./test_simulator_results.html
252

253
254
255
    ARCHIVES_LOC=archives/basic_sim/test
    if [ -d $ARCHIVES_LOC ]
    then
256
        echo "   <h3>4G LTE Basic Simulator Check</h3>" >> ./test_simulator_results.html
257

258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
        if [ -f $ARCHIVES_LOC/test_final_status.log ]
        then
            if [ `grep -c TEST_OK $ARCHIVES_LOC/test_final_status.log` -eq 1 ]
            then
                echo "   <div class=\"alert alert-success\">" >> ./test_simulator_results.html
                echo "      <strong>TEST was SUCCESSFUL <span class=\"glyphicon glyphicon-ok-circle\"></span></strong>" >> ./test_simulator_results.html
                echo "   </div>" >> ./test_simulator_results.html
            else
                echo "   <div class=\"alert alert-danger\">" >> ./test_simulator_results.html
                echo "      <strong>TEST was a FAILURE! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html
                echo "   </div>" >> ./test_simulator_results.html
            fi
        else
            echo "   <div class=\"alert alert-danger\">" >> ./test_simulator_results.html
            echo "      <strong>COULD NOT DETERMINE TEST FINAL STATUS! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html
            echo "   </div>" >> ./test_simulator_results.html
        fi

        echo "   <button data-toggle=\"collapse\" data-target=\"#oai-basic-sim-test-details\">More details on Basic Simulator test results</button>" >> ./test_simulator_results.html
        echo "   <div id=\"oai-basic-sim-test-details\" class=\"collapse\">" >> ./test_simulator_results.html
278
279
280
281
282
283
284
        echo "   <table border = \"1\">" >> ./test_simulator_results.html
        echo "      <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html
        echo "        <th>Log File Name</th>" >> ./test_simulator_results.html
        echo "        <th>Command</th>" >> ./test_simulator_results.html
        echo "        <th>Status</th>" >> ./test_simulator_results.html
        echo "        <th>Statistics</th>" >> ./test_simulator_results.html
        echo "      </tr>" >> ./test_simulator_results.html
285

286
287
288
        TRANS_MODES=("fdd" "tdd")
        BW_CASES=(05 10 20)
        for TMODE in ${TRANS_MODES[@]}
289
        do
290
291
292
293
294
295
296
297
            echo "      <tr bgcolor = \"#8FBC8F\" >" >> ./test_simulator_results.html
            if [[ $TMODE =~ .*fdd.* ]]
            then
                echo "          <td align = \"center\" colspan = 4 >Test in FDD</td>" >> ./test_simulator_results.html
            else
                echo "          <td align = \"center\" colspan = 4 >Test in TDD</td>" >> ./test_simulator_results.html
            fi
            echo "      </tr>" >> ./test_simulator_results.html
298
299
300
301
302
            for BW in ${BW_CASES[@]}
            do
                ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_enb.log
                UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"`
                if [ -f $ENB_LOG ] && [ -f $UE_LOG ]
303
                then
304
305
306
307
                    NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
                    NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
                    echo "      <tr>" >> ./test_simulator_results.html
                    echo "        <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html
308
                    echo "        <td>N/A</td>" >> ./test_simulator_results.html
309
310
311
312
                    NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG`
                    NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG`
                    NB_ENB_SYNCED_WITH_UE=`egrep -c "got UE capabilities for UE" $ENB_LOG`
                    if [ $NB_ENB_GOT_SYNC -eq 1 ] && [ $NB_UE_GOT_SYNC -eq 2 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
313
314
315
316
317
                    then
                        echo "        <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
                    else
                        echo "        <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
                    fi
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
                    echo "        <td><pre>" >> ./test_simulator_results.html
                    if [ $NB_ENB_GOT_SYNC -eq 1 ]
                    then
                        echo "<font color = \"blue\">- eNB --> got sync</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- eNB NEVER got sync</b></font>" >> ./test_simulator_results.html
                    fi
                    if [ $NB_UE_GOT_SYNC -eq 2 ]
                    then
                        echo "<font color = \"blue\">- UE --> got sync</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- UE NEVER got sync</b></font>" >> ./test_simulator_results.html
                    fi
                    if [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
                    then
                        echo "<font color = \"blue\">- UE attached to eNB</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- UE NEVER attached to eNB</b></font>" >> ./test_simulator_results.html
                    fi
                    NB_SEGFAULT_ENB=`egrep -i -c "Segmentation Fault" $ENB_LOG`
                    if [ $NB_SEGFAULT_ENB -ne 0 ]
                    then
                        echo "<font color = \"red\"><b>- eNB --> Segmentation Fault</b></font>" >> ./test_simulator_results.html
                    fi
                    NB_SEGFAULT_UE=`egrep -i -c "Segmentation Fault" $UE_LOG`
                    if [ $NB_SEGFAULT_UE -ne 0 ]
                    then
                        echo "<font color = \"red\"><b>- UE --> Segmentation Fault</b></font>" >> ./test_simulator_results.html
                    fi
                    NB_ASSERTION_ENB=`egrep -i -c "Assertion" $ENB_LOG`
                    if [ $NB_ASSERTION_ENB -ne 0 ]
                    then
                        echo "<font color = \"red\"><b>- eNB --> Assertion</b></font>" >> ./test_simulator_results.html
                        awk 'BEGIN{assertion=10}{if(assertion < 3){print "    " $0; assertion++};if ($0 ~/Assertion/){print "    " $0;assertion=1}}END{}' $ENB_LOG >> ./test_simulator_results.html
                    fi
                    NB_ASSERTION_UE=`egrep -i -c "Assertion" $UE_LOG`
                    if [ $NB_ASSERTION_UE -ne 0 ]
                    then
                        echo "<font color = \"red\"><b>- eNB --> Assertion</b></font>" >> ./test_simulator_results.html
                        awk 'BEGIN{assertion=10}{if(assertion < 3){print "    " $0; assertion++};if ($0 ~/Assertion/){print "    " $0;assertion=1}}END{}' $UE_LOG >> ./test_simulator_results.html
                    fi
                    echo "        </pre></td>" >> ./test_simulator_results.html
                    echo "      </tr>" >> ./test_simulator_results.html
361
                fi
362
363
                PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_ping_ue.txt 2> /dev/null`
                analyzePingFiles
364
        
365
366
                IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}*iperf*client*txt 2> /dev/null`
                analyzeIperfFiles
367
            done
368
        done
369

370
        echo "   </table>" >> ./test_simulator_results.html
371
        echo "   </div>" >> ./test_simulator_results.html
372
    fi
373

374
375
    if [ -e $JENKINS_WKSP/flexran/flexran_build_complete.txt ]
    then
376
        echo "   <h3>4G LTE Basic Simulator + FlexRan Controller Check</h3>" >> ./test_simulator_results.html
377
378
379
380
381
        echo "   <div class=\"alert alert-success\">" >> ./test_simulator_results.html
        echo "      <strong>TEST was SUCCESSFUL <span class=\"glyphicon glyphicon-ok-circle\"></span></strong>" >> ./test_simulator_results.html
        echo "   </div>" >> ./test_simulator_results.html
        echo "   <button data-toggle=\"collapse\" data-target=\"#oai-flexran-test-details\">More details on Basic Simulator + Fleran Controller test results</button>" >> ./test_simulator_results.html
        echo "   <div id=\"oai-flexran-test-details\" class=\"collapse\">" >> ./test_simulator_results.html
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
        echo "   <table border = \"1\">" >> ./test_simulator_results.html
        echo "      <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html
        echo "        <th>Log File Name</th>" >> ./test_simulator_results.html
        echo "        <th>JSON Query Response</th>" >> ./test_simulator_results.html
        echo "      </tr>" >> ./test_simulator_results.html

        FLEXRAN_QUERIES=`ls $ARCHIVES_LOC/flexran_ctl_query_*log`
        for QUERY in $FLEXRAN_QUERIES
        do
            echo "      <tr>" >> ./test_simulator_results.html
            NAME=`echo $QUERY | sed -e "s#$ARCHIVES_LOC/##"`
            echo "        <td>$NAME</td>" >> ./test_simulator_results.html
            echo "        <td><pre><code>" >> ./test_simulator_results.html
            egrep -v "LOG_NAME|\-\-\-\-\-" $QUERY >> ./test_simulator_results.html
            echo "        </code></pre></td>" >> ./test_simulator_results.html
            echo "      </tr>" >> ./test_simulator_results.html
        done
        echo "   </table>" >> ./test_simulator_results.html
400
        echo "   </div>" >> ./test_simulator_results.html
401
402
    fi

403
404
405
    ARCHIVES_LOC=archives/rf_sim/test
    if [ -d $ARCHIVES_LOC ]
    then
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
        echo "   <h3>4G LTE RF Simulator Check</h3>" >> ./test_simulator_results.html

        if [ -f $ARCHIVES_LOC/test_final_status.log ]
        then
            if [ `egrep -c "LTE: TEST_OK" $ARCHIVES_LOC/test_final_status.log` -eq 1 ]
            then
                echo "   <div class=\"alert alert-success\">" >> ./test_simulator_results.html
                echo "      <strong>TEST was SUCCESSFUL <span class=\"glyphicon glyphicon-ok-circle\"></span></strong>" >> ./test_simulator_results.html
                echo "   </div>" >> ./test_simulator_results.html
            else
                echo "   <div class=\"alert alert-danger\">" >> ./test_simulator_results.html
                echo "      <strong>TEST was a FAILURE! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html
                echo "   </div>" >> ./test_simulator_results.html
            fi
        else
            echo "   <div class=\"alert alert-danger\">" >> ./test_simulator_results.html
            echo "      <strong>COULD NOT DETERMINE TEST FINAL STATUS! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html
            echo "   </div>" >> ./test_simulator_results.html
        fi

426
427
        echo "   <button data-toggle=\"collapse\" data-target=\"#oai-lte-rf-sim-test-details\">More details on 4G LTE RF Simulator test results</button>" >> ./test_simulator_results.html
        echo "   <div id=\"oai-lte-rf-sim-test-details\" class=\"collapse\">" >> ./test_simulator_results.html
428
429
430
431
432
433
434
435
436
437
        echo "   <table border = \"1\">" >> ./test_simulator_results.html
        echo "      <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html
        echo "        <th>Log File Name</th>" >> ./test_simulator_results.html
        echo "        <th>Command</th>" >> ./test_simulator_results.html
        echo "        <th>Status</th>" >> ./test_simulator_results.html
        echo "        <th>Statistics</th>" >> ./test_simulator_results.html
        echo "      </tr>" >> ./test_simulator_results.html

        EPC_CONFIGS=("wS1 noS1")
        TRANS_MODES=("fdd")
438
        BW_CASES=(05 10)
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
        for CN_CONFIG in ${EPC_CONFIGS[@]}
        do
          for TMODE in ${TRANS_MODES[@]}
          do
            for BW in ${BW_CASES[@]}
            do
                echo "      <tr bgcolor = \"#8FBC8F\" >" >> ./test_simulator_results.html
                if [[ $CN_CONFIG =~ .*wS1.* ]]
                then
                    echo "          <td align = \"center\" colspan = 4 >Test with EPC (aka withS1): ${TMODE} -- ${BW}MHz </td>" >> ./test_simulator_results.html
                else
                    echo "          <td align = \"center\" colspan = 4 >Test without EPC (aka noS1): ${TMODE} -- ${BW}MHz </td>" >> ./test_simulator_results.html
                fi
                echo "      </tr>" >> ./test_simulator_results.html
                ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_enb.log
                UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"`
                if [ -f $ENB_LOG ] && [ -f $UE_LOG ]
                then
                    NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
                    NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
                    echo "      <tr>" >> ./test_simulator_results.html
                    echo "        <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html
                    echo "        <td>N/A</td>" >> ./test_simulator_results.html
                    NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG`
                    if [[ $CN_CONFIG =~ .*noS1.* ]]
                    then
                        NB_ENB_TUNNEL_UP=`egrep -c "Interface oaitun_enb1 successfully configured" $ENB_LOG`
                    fi
                    NB_UE_GOT_SYNC=`egrep -c "rfsimulator: Success" $UE_LOG`
                    NB_ENB_SYNCED_WITH_UE=`egrep -c "Generating RRCConnectionReconfigurationComplete" $UE_LOG`
                    if [[ $CN_CONFIG =~ .*noS1.* ]]
                    then
                        NB_UE_TUNNEL_UP=`egrep -c "Interface oaitun_ue1 successfully configured" $UE_LOG`
                    else
473
                        NB_UE_TUNNEL_UP=`egrep -c "ip link set oaitun_ue1 up" $UE_LOG`
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
                    fi
                    if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -gt 0 ] && [ $NB_ENB_SYNCED_WITH_UE -gt 0 ]
                    then
                        echo "        <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
                    else
                        echo "        <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
                    fi
                    echo "        <td><pre>" >> ./test_simulator_results.html
                    if [ $NB_ENB_GOT_SYNC -gt 0 ]
                    then
                        echo "<font color = \"blue\">- eNB --> got sync</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- eNB NEVER got sync</b></font>" >> ./test_simulator_results.html
                    fi
                    if [[ $CN_CONFIG =~ .*noS1.* ]]
                    then
                        if [ $NB_ENB_TUNNEL_UP -gt 0 ]
                        then
                            echo "<font color = \"blue\">- eNB mounted oaitun_enb1 interface</font>" >> ./test_simulator_results.html
                        else
                            echo "<font color = \"red\"><b>- eNB NEVER mounted oaitun_enb1 interface</b></font>" >> ./test_simulator_results.html
                        fi
                    fi
                    if [ $NB_UE_GOT_SYNC -gt 0 ]
                    then
                        echo "<font color = \"blue\">- LTE UE --> got sync</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- LTE UE NEVER got sync</b></font>" >> ./test_simulator_results.html
                    fi
                    if [ $NB_ENB_SYNCED_WITH_UE -gt 0 ]
                    then
                        echo "<font color = \"blue\">- LTE UE attached to eNB</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- LTE UE NEVER attached to eNB</b></font>" >> ./test_simulator_results.html
                    fi
                    if [ $NB_UE_TUNNEL_UP -gt 0 ]
                    then
                        echo "<font color = \"blue\">- LTE UE mounted oaitun_ue1 interface</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- LTE UE NEVER mounted oaitun_ue1 interface</b></font>" >> ./test_simulator_results.html
                    fi
                    echo "        </pre></td>" >> ./test_simulator_results.html
                    echo "      </tr>" >> ./test_simulator_results.html
                fi
                PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_ping*.log 2> /dev/null`
                analyzePingFiles

                IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_dl*client*txt | grep -v mbms 2> /dev/null`
                analyzeIperfFiles

                IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_ul*client*txt | grep -v mbms 2> /dev/null`
                analyzeIperfFiles
            done
          done
        done

        # MBMS Case
        CN_CONFIG="noS1"
        TMODE="fdd"
        BW_CASES=(05)
        for BW in ${BW_CASES[@]}
        do
            echo "      <tr bgcolor = \"#8FBC8F\" >" >> ./test_simulator_results.html
            echo "          <td align = \"center\" colspan = 4 >Test MBMS without EPC (aka noS1): ${TMODE} -- ${BW}MHz </td>" >> ./test_simulator_results.html
            echo "      </tr>" >> ./test_simulator_results.html
            ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_enb_mbms.log
            UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"`
            if [ -f $ENB_LOG ] && [ -f $UE_LOG ]
            then
                NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
                NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
                echo "      <tr>" >> ./test_simulator_results.html
                echo "        <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html
                echo "        <td>N/A</td>" >> ./test_simulator_results.html
                NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG`
                NB_ENB_TUNNEL_UP=`egrep -c "Interface oaitun_enb1 successfully configured" $ENB_LOG`
                NB_ENB_MTUNNEL_UP=`egrep -c "Interface oaitun_enm1 successfully configured" $ENB_LOG`
                NB_UE_GOT_SYNC=`egrep -c "rfsimulator: Success" $UE_LOG`
                NB_ENB_SYNCED_WITH_UE=`egrep -c "Generating RRCConnectionReconfigurationComplete" $UE_LOG`
                NB_UE_TUNNEL_UP=`egrep -c "Interface oaitun_ue1 successfully configured" $UE_LOG`
                NB_UE_MTUNNEL_UP=`egrep -c "Interface oaitun_uem1 successfully configured" $UE_LOG`
                NB_UE_MBMS_PUSH_MSG=`egrep -c "TRIED TO PUSH MBMS DATA TO" $UE_LOG`
                if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -gt 0 ] && [ $NB_ENB_SYNCED_WITH_UE -gt 0 ] && [ $NB_UE_MBMS_PUSH_MSG -gt 0 ]
                then
                    echo "        <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
                else
                    echo "        <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
                fi
                echo "        <td><pre>" >> ./test_simulator_results.html
                if [ $NB_ENB_GOT_SYNC -gt 0 ]
                then
                    echo "<font color = \"blue\">- eNB --> got sync</font>" >> ./test_simulator_results.html
                else
                    echo "<font color = \"red\"><b>- eNB NEVER got sync</b></font>" >> ./test_simulator_results.html
                fi
                if [ $NB_ENB_TUNNEL_UP -gt 0 ]
                then
                    echo "<font color = \"blue\">- eNB mounted oaitun_enb1 interface</font>" >> ./test_simulator_results.html
                else
                    echo "<font color = \"red\"><b>- eNB NEVER mounted oaitun_enb1 interface</b></font>" >> ./test_simulator_results.html
                fi
                if [ $NB_ENB_MTUNNEL_UP -gt 0 ]
                then
                    echo "<font color = \"blue\">- eNB mounted oaitun_enm1 interface</font>" >> ./test_simulator_results.html
                else
                    echo "<font color = \"red\"><b>- eNB NEVER mounted oaitun_enm1 interface</b></font>" >> ./test_simulator_results.html
                fi
                if [ $NB_UE_GOT_SYNC -gt 0 ]
                then
                    echo "<font color = \"blue\">- LTE UE --> got sync</font>" >> ./test_simulator_results.html
                else
                    echo "<font color = \"red\"><b>- LTE UE NEVER got sync</b></font>" >> ./test_simulator_results.html
                fi
                if [ $NB_ENB_SYNCED_WITH_UE -gt 0 ]
                then
                    echo "<font color = \"blue\">- LTE UE attached to eNB</font>" >> ./test_simulator_results.html
                else
                    echo "<font color = \"red\"><b>- LTE UE NEVER attached to eNB</b></font>" >> ./test_simulator_results.html
                fi
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
                if [ $NB_UE_TUNNEL_UP -gt 0 ]
                then
                    echo "<font color = \"blue\">- LTE UE mounted oaitun_ue1 interface</font>" >> ./test_simulator_results.html
                else
                    echo "<font color = \"red\"><b>- LTE UE NEVER mounted oaitun_ue1 interface</b></font>" >> ./test_simulator_results.html
                fi
                if [ $NB_UE_MTUNNEL_UP -gt 0 ]
                then
                    echo "<font color = \"blue\">- LTE UE mounted oaitun_uem1 interface</font>" >> ./test_simulator_results.html
                else
                    echo "<font color = \"red\"><b>- LTE UE NEVER mounted oaitun_uem1 interface</b></font>" >> ./test_simulator_results.html
                fi
                if [ $NB_UE_MBMS_PUSH_MSG -gt 0 ]
                then
                    echo "<font color = \"blue\">- LTE UE tried to push ${NB_UE_MBMS_PUSH_MSG} MBMS DATA</font>" >> ./test_simulator_results.html
                else
                    echo "<font color = \"red\"><b>- LTE UE NEVER pushed MBMS DATA</b></font>" >> ./test_simulator_results.html
                fi
                echo "        </pre></td>" >> ./test_simulator_results.html
                echo "      </tr>" >> ./test_simulator_results.html
            fi
            #PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_ping*.log 2> /dev/null`
            #analyzePingFiles

            #IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_dl*client*txt | grep -v mbms 2> /dev/null`
            #analyzeIperfFiles

            #IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_ul*client*txt | grep -v mbms 2> /dev/null`
            #analyzeIperfFiles
        done

        # FeMBMS Case
        CN_CONFIG="noS1"
        TMODE="fdd"
        BW_CASES=(05)
        for BW in ${BW_CASES[@]}
        do
            echo "      <tr bgcolor = \"#8FBC8F\" >" >> ./test_simulator_results.html
            echo "          <td align = \"center\" colspan = 4 >Test FeMBMS without EPC (aka noS1): ${TMODE} -- ${BW}MHz </td>" >> ./test_simulator_results.html
            echo "      </tr>" >> ./test_simulator_results.html
            ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_enb_fembms.log
            UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"`
            if [ -f $ENB_LOG ] && [ -f $UE_LOG ]
            then
                NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
                NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
                echo "      <tr>" >> ./test_simulator_results.html
                echo "        <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html
                echo "        <td>N/A</td>" >> ./test_simulator_results.html
                #NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG`
                NB_ENB_TUNNEL_UP=`egrep -c "Interface oaitun_enb1 successfully configured" $ENB_LOG`
                NB_ENB_MTUNNEL_UP=`egrep -c "Interface oaitun_enm1 successfully configured" $ENB_LOG`
                #NB_UE_GOT_SYNC=`egrep -c "rfsimulator: Success" $UE_LOG`
                #NB_ENB_SYNCED_WITH_UE=`egrep -c "Generating RRCConnectionReconfigurationComplete" $UE_LOG`
                NB_UE_TUNNEL_UP=`egrep -c "Interface oaitun_ue1 successfully configured" $UE_LOG`
                NB_UE_MTUNNEL_UP=`egrep -c "Interface oaitun_uem1 successfully configured" $UE_LOG`
                NB_UE_MBMS_PUSH_MSG=`egrep -c "TRIED TO PUSH MBMS DATA TO" $UE_LOG`
                #if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -gt 0 ] && [ $NB_ENB_SYNCED_WITH_UE -gt 0 ] && [ $NB_UE_MBMS_PUSH_MSG -gt 0 ]
                if  [ $NB_UE_MBMS_PUSH_MSG -gt 0 ]
                then
                    echo "        <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
                else
                    echo "        <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
                fi
                echo "        <td><pre>" >> ./test_simulator_results.html
                #if [ $NB_ENB_GOT_SYNC -gt 0 ]
                #then
                #    echo "<font color = \"blue\">- eNB --> got sync</font>" >> ./test_simulator_results.html
                #else
                #    echo "<font color = \"red\"><b>- eNB NEVER got sync</b></font>" >> ./test_simulator_results.html
                #fi
                if [ $NB_ENB_TUNNEL_UP -gt 0 ]
                then
                    echo "<font color = \"blue\">- eNB mounted oaitun_enb1 interface</font>" >> ./test_simulator_results.html
                else
                    echo "<font color = \"red\"><b>- eNB NEVER mounted oaitun_enb1 interface</b></font>" >> ./test_simulator_results.html
                fi
                if [ $NB_ENB_MTUNNEL_UP -gt 0 ]
                then
                    echo "<font color = \"blue\">- eNB mounted oaitun_enm1 interface</font>" >> ./test_simulator_results.html
                else
                    echo "<font color = \"red\"><b>- eNB NEVER mounted oaitun_enm1 interface</b></font>" >> ./test_simulator_results.html
                fi
                #if [ $NB_UE_GOT_SYNC -gt 0 ]
                #then
                #    echo "<font color = \"blue\">- LTE UE --> got sync</font>" >> ./test_simulator_results.html
                #else
                #    echo "<font color = \"red\"><b>- LTE UE NEVER got sync</b></font>" >> ./test_simulator_results.html
                #fi
                #if [ $NB_ENB_SYNCED_WITH_UE -gt 0 ]
                #then
                #    echo "<font color = \"blue\">- LTE UE attached to eNB</font>" >> ./test_simulator_results.html
                #else
                #    echo "<font color = \"red\"><b>- LTE UE NEVER attached to eNB</b></font>" >> ./test_simulator_results.html
                #fi
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
                if [ $NB_UE_TUNNEL_UP -gt 0 ]
                then
                    echo "<font color = \"blue\">- LTE UE mounted oaitun_ue1 interface</font>" >> ./test_simulator_results.html
                else
                    echo "<font color = \"red\"><b>- LTE UE NEVER mounted oaitun_ue1 interface</b></font>" >> ./test_simulator_results.html
                fi
                if [ $NB_UE_MTUNNEL_UP -gt 0 ]
                then
                    echo "<font color = \"blue\">- LTE UE mounted oaitun_uem1 interface</font>" >> ./test_simulator_results.html
                else
                    echo "<font color = \"red\"><b>- LTE UE NEVER mounted oaitun_uem1 interface</b></font>" >> ./test_simulator_results.html
                fi
                if [ $NB_UE_MBMS_PUSH_MSG -gt 0 ]
                then
                    echo "<font color = \"blue\">- LTE UE tried to push ${NB_UE_MBMS_PUSH_MSG} MBMS DATA</font>" >> ./test_simulator_results.html
                else
                    echo "<font color = \"red\"><b>- LTE UE NEVER pushed MBMS DATA</b></font>" >> ./test_simulator_results.html
                fi
                echo "        </pre></td>" >> ./test_simulator_results.html
                echo "      </tr>" >> ./test_simulator_results.html
            fi
            #PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_ping*.log 2> /dev/null`
            #analyzePingFiles

            #IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_dl*client*txt | grep -v mbms 2> /dev/null`
            #analyzeIperfFiles

            #IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${CN_CONFIG}_iperf_ul*client*txt | grep -v mbms 2> /dev/null`
            #analyzeIperfFiles
        done
        echo "   </table>" >> ./test_simulator_results.html
        echo "   </div>" >> ./test_simulator_results.html

721
722
723
724
        echo "   <h3>5G NR RF Simulator Check</h3>" >> ./test_simulator_results.html

        if [ -f $ARCHIVES_LOC/test_final_status.log ]
        then
725
            if [ `egrep -c "5G-NR: TEST_OK" $ARCHIVES_LOC/test_final_status.log` -eq 1 ]
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
            then
                echo "   <div class=\"alert alert-success\">" >> ./test_simulator_results.html
                echo "      <strong>TEST was SUCCESSFUL <span class=\"glyphicon glyphicon-ok-circle\"></span></strong>" >> ./test_simulator_results.html
                echo "   </div>" >> ./test_simulator_results.html
            else
                echo "   <div class=\"alert alert-danger\">" >> ./test_simulator_results.html
                echo "      <strong>TEST was a FAILURE! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html
                echo "   </div>" >> ./test_simulator_results.html
            fi
        else
            echo "   <div class=\"alert alert-danger\">" >> ./test_simulator_results.html
            echo "      <strong>COULD NOT DETERMINE TEST FINAL STATUS! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html
            echo "   </div>" >> ./test_simulator_results.html
        fi

741
742
        echo "   <button data-toggle=\"collapse\" data-target=\"#oai-nr-rf-sim-test-details\">More details on 5G NR RF Simulator test results</button>" >> ./test_simulator_results.html
        echo "   <div id=\"oai-nr-rf-sim-test-details\" class=\"collapse\">" >> ./test_simulator_results.html
743
744
745
746
747
748
749
750
751
        echo "   <table border = \"1\">" >> ./test_simulator_results.html
        echo "      <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html
        echo "        <th>Log File Name</th>" >> ./test_simulator_results.html
        echo "        <th>Command</th>" >> ./test_simulator_results.html
        echo "        <th>Status</th>" >> ./test_simulator_results.html
        echo "        <th>Statistics</th>" >> ./test_simulator_results.html
        echo "      </tr>" >> ./test_simulator_results.html

        EPC_CONFIGS=("noS1")
752
        TRANS_MODES=("fdd" "tdd")
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
        BW_CASES=(106)
        for CN_CONFIG in ${EPC_CONFIGS[@]}
        do
          for TMODE in ${TRANS_MODES[@]}
          do
            for BW in ${BW_CASES[@]}
            do
                echo "      <tr bgcolor = \"#8FBC8F\" >" >> ./test_simulator_results.html
                if [[ $CN_CONFIG =~ .*wS1.* ]]
                then
                    echo "          <td align = \"center\" colspan = 4 >Test with EPC (aka withS1): ${TMODE} -- ${BW}PRB </td>" >> ./test_simulator_results.html
                else
                    echo "          <td align = \"center\" colspan = 4 >Test without EPC (aka noS1): ${TMODE} -- ${BW}PRB </td>" >> ./test_simulator_results.html
                fi
                echo "      </tr>" >> ./test_simulator_results.html
hardy's avatar
hardy committed
768
769
770

                #RA test (--do-ra option)

hardy's avatar
hardy committed
771
772
                #build log files names
                RA_ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_gnb_ra_test.log
hardy's avatar
hardy committed
773
                RA_UE_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_ue_ra_test.log
hardy's avatar
hardy committed
774
775
776
777
778
779
780
781
782
783
                if [ -f $RA_ENB_LOG ] && [ -f $RA_UE_LOG ]
                then
                    #get rid of full path
                    NAME_ENB=`echo $RA_ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
                    NAME_UE=`echo $RA_UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
                    echo "      <tr>" >> ./test_simulator_results.html
                    echo "        <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html
                    echo "        <td>Check if RA proc succeeded</td>" >> ./test_simulator_results.html

                    #gNB RA check
Eurecom's avatar
Eurecom committed
784
                    GNB_RECEIVED=`egrep -c "\[RAPROC\] PUSCH with TC_RNTI (.+) received correctly" $RA_ENB_LOG`
hardy's avatar
hardy committed
785
                    #UE RA check
Eurecom's avatar
Eurecom committed
786
                    UE_RA_PROC_OK=`egrep -c "\[RAPROC\] RA procedure succeeded" $RA_UE_LOG`
hardy's avatar
hardy committed
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811


                    if [ $GNB_RECEIVED -gt 0 ] && [ $UE_RA_PROC_OK -gt 0 ]
                    then
                        echo "        <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
                    else
                        echo "        <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
                    fi

                    echo "        <td><pre>" >> ./test_simulator_results.html
                    if [ $GNB_RECEIVED -gt 0 ]
                    then
                        echo "<font color = \"blue\">- gNB --> RA received</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- gNB RA NOT RECEIVED</b></font>" >> ./test_simulator_results.html
                    fi
                    if [ $UE_RA_PROC_OK -gt 0 ]
                    then
                        echo "<font color = \"blue\">- NR UE  --> RA procedure succeded</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- NR UE RA procedure failed</b></font>" >> ./test_simulator_results.html
                    fi
                    echo "        </pre></td>" >> ./test_simulator_results.html
                    echo "      </tr>" >> ./test_simulator_results.html
                fi
hardy's avatar
hardy committed
812
813

                #SYNC test
814
815
816
817
818
819
820
821
822
823
                ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_gnb.log
                UE_LOG=`echo $ENB_LOG | sed -e "s#gnb#ue#"`
                if [ -f $ENB_LOG ] && [ -f $UE_LOG ]
                then
                    NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
                    NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
                    echo "      <tr>" >> ./test_simulator_results.html
                    echo "        <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html
                    echo "        <td>N/A</td>" >> ./test_simulator_results.html
                    NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG`
824
                    NB_ENB_TUNNEL_UP=`egrep -c "Interface oaitun_enb1 successfully configured" $ENB_LOG`
825
826
                    NB_UE_GOT_SYNC=`egrep -c "rfsimulator: Success" $UE_LOG`
                    NB_ENB_SYNCED_WITH_UE=`egrep -c "Initial sync: starting PBCH detection" $UE_LOG`
827
                    NB_UE_TUNNEL_UP=`egrep -c "Interface oaitun_ue1 successfully configured" $UE_LOG`
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
                    if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -gt 0 ] && [ $NB_ENB_SYNCED_WITH_UE -gt 0 ]
                    then
                        echo "        <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
                    else
                        echo "        <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
                    fi
                    echo "        <td><pre>" >> ./test_simulator_results.html
                    if [ $NB_ENB_GOT_SYNC -gt 0 ]
                    then
                        echo "<font color = \"blue\">- gNB --> got sync</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- gNB NEVER got sync</b></font>" >> ./test_simulator_results.html
                    fi
                    if [ $NB_ENB_TUNNEL_UP -gt 0 ]
                    then
                        echo "<font color = \"blue\">- gNB mounted oaitun_enb1 interface</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- gNB NEVER mounted oaitun_enb1 interface</b></font>" >> ./test_simulator_results.html
                    fi
                    if [ $NB_UE_GOT_SYNC -gt 0 ]
                    then
                        echo "<font color = \"blue\">- NR UE --> got sync</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- NR UE NEVER got sync</b></font>" >> ./test_simulator_results.html
                    fi
                    if [ $NB_ENB_SYNCED_WITH_UE -gt 0 ]
                    then
                        echo "<font color = \"blue\">- NR UE attached to gNB</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- NR UE NEVER attached to eNB</b></font>" >> ./test_simulator_results.html
                    fi
                    if [ $NB_UE_TUNNEL_UP -gt 0 ]
                    then
                        echo "<font color = \"blue\">- NR UE mounted oaitun_ue1 interface</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- NR UE NEVER mounted oaitun_ue1 interface</b></font>" >> ./test_simulator_results.html
                    fi
                    echo "        </pre></td>" >> ./test_simulator_results.html
                    echo "      </tr>" >> ./test_simulator_results.html
                fi
868
869
                PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_ping*.log 2> /dev/null`
                analyzePingFiles
870
871
872
873

                IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_iperf_dl*client*txt 2> /dev/null`
                analyzeIperfFiles

874
875
                IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_iperf_ul*client*txt 2> /dev/null`
                analyzeIperfFiles
876
877
878
879
880
881
882
883
            done
          done
        done

        echo "   </table>" >> ./test_simulator_results.html
        echo "   </div>" >> ./test_simulator_results.html
    fi

884
885
886
    ARCHIVES_LOC=archives/l2_sim/test
    if [ -d $ARCHIVES_LOC ]
    then
887
        echo "   <h3>4G LTE L2-NFAPI Simulator Check</h3>" >> ./test_simulator_results.html
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916

        if [ -f $ARCHIVES_LOC/test_final_status.log ]
        then
            if [ `grep -c TEST_OK $ARCHIVES_LOC/test_final_status.log` -eq 1 ]
            then
                echo "   <div class=\"alert alert-success\">" >> ./test_simulator_results.html
                echo "      <strong>TEST was SUCCESSFUL <span class=\"glyphicon glyphicon-ok-circle\"></span></strong>" >> ./test_simulator_results.html
                echo "   </div>" >> ./test_simulator_results.html
            else
                echo "   <div class=\"alert alert-danger\">" >> ./test_simulator_results.html
                echo "      <strong>TEST was a FAILURE! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html
                echo "   </div>" >> ./test_simulator_results.html
            fi
        else
            echo "   <div class=\"alert alert-danger\">" >> ./test_simulator_results.html
            echo "      <strong>COULD NOT DETERMINE TEST FINAL STATUS! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html
            echo "   </div>" >> ./test_simulator_results.html
        fi

        echo "   <button data-toggle=\"collapse\" data-target=\"#oai-l2-sim-test-details\">More details on L2-NFAPI Simulator test results</button>" >> ./test_simulator_results.html
        echo "   <div id=\"oai-l2-sim-test-details\" class=\"collapse\">" >> ./test_simulator_results.html
        echo "   <table border = \"1\">" >> ./test_simulator_results.html
        echo "      <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html
        echo "        <th>Log File Name</th>" >> ./test_simulator_results.html
        echo "        <th>Command</th>" >> ./test_simulator_results.html
        echo "        <th>Status</th>" >> ./test_simulator_results.html
        echo "        <th>Statistics</th>" >> ./test_simulator_results.html
        echo "      </tr>" >> ./test_simulator_results.html

917
        EPC_CONFIGS=("wS1" "noS1")
918
919
        TRANS_MODES=("fdd")
        BW_CASES=(05)
920
        NB_USERS=(01 04)
921
        for CN_CONFIG in ${EPC_CONFIGS[@]}
922
        do
923
          for TMODE in ${TRANS_MODES[@]}
924
          do
925
            for BW in ${BW_CASES[@]}
926
            do
927
928
              for UES in ${NB_USERS[@]}
              do
929
930
931
932
933
934
935
936
                echo "      <tr bgcolor = \"#8FBC8F\" >" >> ./test_simulator_results.html
                if [[ $CN_CONFIG =~ .*wS1.* ]]
                then
                    echo "          <td align = \"center\" colspan = 4 >Test with EPC (aka withS1): ${TMODE} -- ${BW}MHz -- ${UES} user(s)</td>" >> ./test_simulator_results.html
                else
                    echo "          <td align = \"center\" colspan = 4 >Test without EPC (aka noS1): ${TMODE} -- ${BW}MHz -- ${UES} user(s)</td>" >> ./test_simulator_results.html
                fi
                echo "      </tr>" >> ./test_simulator_results.html
937
                ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_enb.log
938
939
940
941
942
943
944
945
946
947
948
                UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"`
                if [ -f $ENB_LOG ] && [ -f $UE_LOG ]
                then
                    NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
                    NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
                    echo "      <tr>" >> ./test_simulator_results.html
                    echo "        <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html
                    echo "        <td>N/A</td>" >> ./test_simulator_results.html
                    NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG`
                    NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG`
                    NB_ENB_SYNCED_WITH_UE=`egrep -c "Sending NFAPI_START_RESPONSE" $UE_LOG`
949
                    if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -gt 2 ] && [ $NB_ENB_SYNCED_WITH_UE -gt 0 ]
950
951
952
953
954
955
                    then
                        echo "        <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
                    else
                        echo "        <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
                    fi
                    echo "        <td><pre>" >> ./test_simulator_results.html
956
                    if [ $NB_ENB_GOT_SYNC -gt 0 ]
957
958
959
960
961
                    then
                        echo "<font color = \"blue\">- eNB --> got sync</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- eNB NEVER got sync</b></font>" >> ./test_simulator_results.html
                    fi
962
                    if [ $NB_UE_GOT_SYNC -gt 2 ]
963
964
965
966
967
                    then
                        echo "<font color = \"blue\">- UE --> got sync</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- UE NEVER got sync</b></font>" >> ./test_simulator_results.html
                    fi
968
                    if [ $NB_ENB_SYNCED_WITH_UE -gt 0 ]
969
970
971
972
973
974
975
976
                    then
                        echo "<font color = \"blue\">- UE attached to eNB</font>" >> ./test_simulator_results.html
                    else
                        echo "<font color = \"red\"><b>- UE NEVER attached to eNB</b></font>" >> ./test_simulator_results.html
                    fi
                    echo "        </pre></td>" >> ./test_simulator_results.html
                    echo "      </tr>" >> ./test_simulator_results.html
                fi
977
978
979
980
981
                PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping*.log 2> /dev/null`
                analyzePingFiles

                IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_dl*client*txt 2> /dev/null`
                analyzeIperfFiles
982

983
984
                IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_ul*client*txt 2> /dev/null`
                analyzeIperfFiles
985
              done
986
            done
987
          done
988
989
990
991
992
993
        done

        echo "   </table>" >> ./test_simulator_results.html
        echo "   </div>" >> ./test_simulator_results.html
    fi

994
995
996
997
    ARCHIVES_LOC=archives/phy_sim/test
    if [ -d $ARCHIVES_LOC ]
    then
        echo "   <h3>Physical Simulators Check</h3>" >> ./test_simulator_results.html
998

999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
        if [ -f $ARCHIVES_LOC/test_final_status.log ]
        then
            if [ `grep -c TEST_OK $ARCHIVES_LOC/test_final_status.log` -eq 1 ]
            then
                echo "   <div class=\"alert alert-success\">" >> ./test_simulator_results.html
                echo "      <strong>TEST was SUCCESSFUL <span class=\"glyphicon glyphicon-ok-circle\"></span></strong>" >> ./test_simulator_results.html
                echo "   </div>" >> ./test_simulator_results.html
            else
                echo "   <div class=\"alert alert-danger\">" >> ./test_simulator_results.html
                echo "      <strong>TEST was a FAILURE! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html
                echo "   </div>" >> ./test_simulator_results.html
            fi
        else
            echo "   <div class=\"alert alert-danger\">" >> ./test_simulator_results.html
            echo "      <strong>COULD NOT DETERMINE TEST FINAL STATUS! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html
            echo "   </div>" >> ./test_simulator_results.html
        fi

1017
1018
        echo "   <table border = \"1\">" >> ./test_simulator_results.html
        echo "      <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html
1019
1020
1021
1022
1023
        echo "        <th>Log File Name</th>" >> ./test_simulator_results.html
        echo "        <th>Nb Tests</th>" >> ./test_simulator_results.html
        echo "        <th>Nb Errors</th>" >> ./test_simulator_results.html
        echo "        <th>Nb Failures</th>" >> ./test_simulator_results.html
        echo "        <th>Nb Failures</th>" >> ./test_simulator_results.html
1024
        echo "      </tr>" >> ./test_simulator_results.html
1025
1026
1027

        XML_TESTS=`ls $ARCHIVES_LOC/*xml`
        for XML_FILE in $XML_TESTS
1028
1029
        do
            echo "      <tr>" >> ./test_simulator_results.html
1030
1031
1032
1033
1034
1035
            NAME=`echo $XML_FILE | sed -e "s#$ARCHIVES_LOC/##"`
            NB_TESTS=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*tests='##" -e "s#' *time=.*##"`
            NB_ERRORS=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*errors='##" -e "s#' *failures=.*##"`
            NB_FAILURES=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*failures='##" -e "s#' *hostname=.*##"`
            NB_SKIPPED=`egrep "testsuite errors" $XML_FILE | sed -e "s#^.*skipped='##" -e "s#' *tests=.*##"`
            if [ $NB_ERRORS -eq 0 ] && [ $NB_FAILURES -eq 0 ]
1036
            then
1037
                echo "        <td bgcolor = \"green\" >$NAME</td>" >> ./test_simulator_results.html
1038
            else
1039
                echo "        <td bgcolor = \"red\" >$NAME</td>" >> ./test_simulator_results.html
1040
            fi
1041
1042
1043
1044
            echo "        <td>$NB_TESTS</td>" >> ./test_simulator_results.html
            echo "        <td>$NB_ERRORS</td>" >> ./test_simulator_results.html
            echo "        <td>$NB_FAILURES</td>" >> ./test_simulator_results.html
            echo "        <td>$NB_SKIPPED</td>" >> ./test_simulator_results.html
1045
1046
            echo "      </tr>" >> ./test_simulator_results.html
        done
1047

1048
        echo "   </table>" >> ./test_simulator_results.html
1049
1050
1051
1052
        echo "   <br>" >> ./test_simulator_results.html

        echo "   <button data-toggle=\"collapse\" data-target=\"#oai-phy-sim-test-details\">More details on Physical Simulators test results</button>" >> ./test_simulator_results.html
        echo "   <div id=\"oai-phy-sim-test-details\" class=\"collapse\">" >> ./test_simulator_results.html
1053

1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
        echo "   <h4>Details</h4>" >> ./test_simulator_results.html
        for XML_FILE in $XML_TESTS
        do
            echo "   <table border = \"1\">" >> ./test_simulator_results.html
            echo "      <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html
            echo "        <th>Test Name</th>" >> ./test_simulator_results.html
            echo "        <th>Description</th>" >> ./test_simulator_results.html
            echo "        <th>Result</th>" >> ./test_simulator_results.html
            echo "        <th>Time</th>" >> ./test_simulator_results.html
            echo "      </tr>" >> ./test_simulator_results.html
            PREV_SECTION=0
            PREV_TIME_IN_SECS=0
            TESTCASES_LIST=`sed -e "s# #@#g" $XML_FILE | grep testcase`
            for TESTCASE in $TESTCASES_LIST
            do
                NAME=`echo $TESTCASE | sed -e "s#^.*name='##" -e "s#'@description=.*##" | sed -e "s#@# #g"`
                SECTION=`echo $NAME | sed -e "s#\..*##"`
                if [ $SECTION != $PREV_SECTION ]
                then
                    echo "      <tr bgcolor = \"#8FBC8F\" >" >> ./test_simulator_results.html
                    echo "          <td align = \"center\" colspan = 4 >\"$SECTION\" series</td>" >> ./test_simulator_results.html
                    echo "      </tr>" >> ./test_simulator_results.html
                    PREV_SECTION=$SECTION
                    PREV_TIME_IN_SECS=0
                fi
                DESC=`echo $TESTCASE | sed -e "s#^.*description='##" -e "s#'@Run_result=.*##" | sed -e "s#@# #g"`
                RESULT=`echo $TESTCASE | sed -e "s#^.*RESULT='##" -e "s#'.*##" | sed -e "s#@# #g"`
                TIME_IN_SECS=`echo $TESTCASE | sed -e "s#^.*time='##" -e "s#'@RESULT=.*##" | sed -e "s#@# #g" -e "s# s.*##"`
                TIME=`echo "$TIME_IN_SECS - $PREV_TIME_IN_SECS" | bc -l | awk '{printf "%.2f s", $0}'`
                PREV_TIME_IN_SECS=$TIME_IN_SECS
                echo "      <tr>" >> ./test_simulator_results.html
                echo "          <td>$NAME</td>" >> ./test_simulator_results.html
                echo "          <td>$DESC</td>" >> ./test_simulator_results.html
                if [[ $RESULT =~ .*PASS.* ]]
                then
                    echo "          <td bgcolor = \"green\" >$RESULT</td>" >> ./test_simulator_results.html
                else
                    SPLITTED_LINE=`echo -e $TESTCASE | sed -e "s#@#\n#g"`
                    NB_RUNS=`echo -e "${SPLITTED_LINE}" | grep -v Run_result | egrep -c "Run_"`
                    NB_FAILS=`echo -e "${SPLITTED_LINE}" | grep -v Run_result | egrep -c "=FAIL"`
                    echo "          <td bgcolor = \"red\" >${RESULT} (${NB_FAILS}/${NB_RUNS})</td>" >> ./test_simulator_results.html
                fi
                echo "          <td>$TIME</td>" >> ./test_simulator_results.html
                echo "      </tr>" >> ./test_simulator_results.html
            done
            echo "   </table>" >> ./test_simulator_results.html
        done
    fi
1102

1103
1104
    echo "   </div>" >> ./test_simulator_results.html
    echo "   <p></p>" >> ./test_simulator_results.html
1105
1106
    echo "   <div class=\"well well-lg\">End of Test Report -- Copyright <span class=\"glyphicon glyphicon-copyright-mark\"></span> 2018 <a href=\"http://www.openairinterface.org/\">OpenAirInterface</a>. All Rights Reserved.</div>" >> ./test_simulator_results.html
    echo "</div></body>" >> ./test_simulator_results.html
1107
1108
    echo "</html>" >> ./test_simulator_results.html
}