ItsBtp_TestCases.ttcn 14.1 KB
Newer Older
filatov's avatar
filatov committed
1
2
3
4
5
/**
 *  @author   ETSI / STF405
 *  @version  $URL$
 *            $Id$
 *  @desc     Testcases for Basic Transport Protocol (TP version: 0.0.3)
garciay's avatar
garciay committed
6
7
8
9
 *  @copyright   ETSI Copyright Notification
 *               No part may be reproduced except as authorized by written permission.
 *               The copyright and the foregoing restriction extend to reproduction in all media.
 *               All rights reserved.
filatov's avatar
filatov committed
10
11
12
13
14
15
 *
 */
module ItsBtp_TestCases {
    
    // LibCommon
    import from LibCommon_Sync all;
16
    import from LibCommon_Time all;
filatov's avatar
filatov committed
17
//    import from LibCommon_VerdictControl all;
filatov's avatar
filatov committed
18
19
20
21
22

    // LibIts
    import from LibItsBtp_TestSystem all;
    import from LibItsBtp_Functions all;
    import from LibItsBtp_Templates all;
filatov's avatar
filatov committed
23
24
25
//    import from LibItsBtp_Pixits all;
//    import from LibItsBtp_TypesAndValues all;
//    import from LibItsCommon_Functions all;
filatov's avatar
filatov committed
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    
    group btpPacketGeneration {
        
        group btpBtpA {

        /**
         * @desc    Checks that BTP-A packets is well-formatted
         * <pre>        
         * PICS Selection: none 
         * Initial conditions:
         *  with {
         *      the IUT being in the "initial state"
         *  }
         * Expected behaviour:
         *  ensure that {
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
         *      when {
         *          the IUT is requested to send a BTP packet via a BTP-data request
         *              containing BTP Type
         *                  indicationg value 'BTP-A'
         *              containing Source PorT
         *                  indicating value 'SOURCE_PORT'
         *              containing Destination Port
         *                  indicating value 'DESTINATION_PORT'
         *      }
         *      then {
         *          the IUT sends a valid BTP-A packet
         *              containing source port
         *                  indicating 'SOURCE_PORT',
         *              containing destination port
         *                  indicating 'DESTINATION_PORT',
         *              containing the Upper Layer payload
         *      }
filatov's avatar
filatov committed
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
         *  }
         * </pre>
         * 
         * @version 0.0.3
         * @see     ETSI TS 102 870-2 v1.1.1 TP/BTP/PGA/BV/01
         */
        testcase TC_BTP_PGA_BV_01() runs on ItsBtp system ItsBtpSystem {

            // Local variables
                        
            // Test control
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                                
            // Test Body
            f_utTriggerEvent(m_generateBtpA(f_getBtpDstPort(), f_getBtpSrcPort()));
            tc_ac.start;
            alt {
83
                [] btpPort.receive( mw_btpInd( mw_btpA (f_getBtpDstPort(), f_getBtpSrcPort(), *)))  {
filatov's avatar
filatov committed
84
85
86
87
                    tc_ac.stop;
                    log("*** TC_BTP_PGA_BV_01: PASS: BTP-A packet correclty received ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); 
                }
88
                    
filatov's avatar
filatov committed
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
                [] tc_ac.timeout {
                    log("*** TC_BTP_PGA_BV_01: INCONC: Expected BTP packet not received ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                }   
             }

            // Postamble
            f_poDefault();
            f_cfDown();
                  
        }// end TC_BTP_PGA_BV_0
          
        } // end btpBtpA
        
        group btpBtpB {
          
        /**
         * @desc    Checks that BTP-B packets is well-formatted if Destination Port info is provided
         * <pre>        
         * PICS Selection: none 
         * Initial conditions:
         *  with {
         *      the IUT being in the "initial state"
         *  }
         * Expected behaviour:
         *  ensure that {
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
         *      when {
         *          the IUT is requested to send a BTP packet via a BTP-data request
         *              containing BTP Type
         *                  indicationg value 'BTP-B'
         *              containing Destination Port
         *                  indicating value 'DESTINATION_PORT'
         *              containing Destination Port Info
         *                  indicating value 'DESTINATION_PORT_INFO'
         *      }
         *      then {
         *          the IUT sends a valid BTP-B packet
         *              containing Destination Port
         *                  indicating value 'DESTINATION_PORT'
         *              containing Destination Port Info
         *                  indicating value 'DESTINATION_PORT_INFO'
         *              containing the Upper Layer payload
         *      }
filatov's avatar
filatov committed
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
         *  }
         * </pre>
         * 
         * @version 0.0.3
         * @see     ETSI TS 102 870-2 v1.1.1 TP/BTP/PGB/BV/01
         */
        testcase TC_BTP_PGB_BV_01() runs on ItsBtp system ItsBtpSystem {

            // Local variables
                        
            // Test control
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                                
            // Test Body
            f_utTriggerEvent(m_generateBtpB(f_getBtpDstPort(), f_getBtpDstPortInfo()));
            tc_ac.start;
            alt {
157
158
159
160
                [] btpPort.receive( mw_btpInd( mw_btpB (f_getBtpDstPort(), f_getBtpDstPortInfo(), *))) {
                    tc_ac.stop;
                    log("*** TC_BTP_PGB_BV_01: PASS: BTP-B packet correclty received ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); 
filatov's avatar
filatov committed
161
                }
162
                    
filatov's avatar
filatov committed
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
                [] tc_ac.timeout {
                    log("*** TC_BTP_PGB_BV_01: INCONC: Expected BTP packet not received ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
                }   
             }
            
            // Postamble
            f_poDefault();
            f_cfDown();
                  
        }// end TC_BTP_PGB_BV_01

        /**
         * @desc    Checks that BTP-B packets are well-formatted if no Destination Port Info is provided
         * <pre>        
         * PICS Selection: none 
         * Initial conditions:
         *  with {
         *      the IUT being in the "initial state"
         *  }
         * Expected behaviour:
         *  ensure that {
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
         *      when {
         *          the IUT is requested to send a BTP packet via a BTP-data request
         *              containing BTP Type
         *                  indicationg value 'BTP-B'
         *              containing Destination Port
         *                  indicating value 'DESTINATION_PORT'
         *              not containing Destination Port Info parameter
         *      }
         *      then {
         *          the IUT sends a valid BTP-B packet
         *              containing Destination Port
         *                  indicating value 'DESTINATION_PORT'
         *              containing Destination Port Info
         *                  indicating '0'
         *              containing the Upper Layer payload
         *      }
filatov's avatar
filatov committed
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
         *  }
         * </pre>
         * 
         * @version 0.0.3
         * @see     ETSI TS 102 870-2 v1.1.1 TP/BTP/PGB/BV/02
         */
        testcase TC_BTP_PGB_BV_02() runs on ItsBtp system ItsBtpSystem {

            // Local variables
                        
            // Test control
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                                
            // Test Body
            f_utTriggerEvent(m_generateBtpB(f_getBtpDstPort(), 0));
            tc_ac.start;
            alt {
226
227
228
229
                [] btpPort.receive( mw_btpInd( mw_btpB (f_getBtpDstPort(), 0, *))) {
                    tc_ac.stop;
                    log("*** TC_BTP_PGB_BV_02: PASS: BTP-B packet correclty received ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); 
filatov's avatar
filatov committed
230
                }
231
                
filatov's avatar
filatov committed
232
233
234
                [] tc_ac.timeout {
                    log("*** TC_BTP_PGB_BV_02: INCONC: Expected BTP packet not received ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
235
                }
filatov's avatar
filatov committed
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
             }
            
            // Postamble
            f_poDefault();
            f_cfDown();
                  
        }// end TC_BTP_PGB_BV_02

        } // end btpBtpB
        
    } // end btpPacketGeneration
    
    group btpPacketProcessing {
    
        group btpValid {
          
        /**
         * @desc    Checks that BTP passes a valid BTP-A packets to the upper protocol entity
         * <pre>        
         * PICS Selection: none 
         * Initial conditions:
         *  with {
         *      the IUT being in the "initial state"
         *  }
         * Expected behaviour:
         *  ensure that {
262
263
264
265
266
267
268
269
270
271
272
         *      when {
         *          the IUT receives a valid BTP-A packet
         *              containing Source Port
         *                  indicating 'SOURCE_PORT'
         *              containing Destination Port
         *                  indicating'DESTINATION_PORT'
         *              containing the payload
         *      }
         *      then {
         *          the IUT passes the payload to the upper layer
         *      }
filatov's avatar
filatov committed
273
274
275
276
277
278
279
280
281
         *  }
         * </pre>
         * 
         * @version 0.0.3
         * @see     ETSI TS 102 870-2 v1.1.1 TP/BTP/PP/BV/01
         */
        testcase TC_BTP_PP_BV_01() runs on ItsBtp system ItsBtpSystem {

            // Local variables
282
283
284
            var BtpReq v_btpReq;
            var integer i;
            
filatov's avatar
filatov committed
285
286
287
288
289
290
291
292
293
294
            // Test control
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
295
            
filatov's avatar
filatov committed
296
            // Test Body
297
298
            v_btpReq := valueof(m_btpReq( m_btpAWithPorts (f_getBtpDstPort(), f_getBtpSrcPort(), f_getBtpPayload())));
            btpPort.send(v_btpReq);
filatov's avatar
filatov committed
299

300
301
302
303
304
            f_sleep(PX_TNOAC);
            for(i:=0; i < lengthof(vc_utEvents) and not match(v_btpReq.msgOut.payload.rawPayload, vc_utEvents[i].rawPayload); i:=i+1) {
                // empty on purpose 
            }
            if(i < lengthof(vc_utEvents)) {
305
                log("*** " & testcasename() & ": PASS: BTP was transmitted to upper layer***");
306
307
308
                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
            }
            else {
309
                log("*** " & testcasename() & ": FAIL: BTP was not transmitted to upper layer***");
310
311
                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
            }
filatov's avatar
filatov committed
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328

            // Postamble
            f_poDefault();
            f_cfDown();
                  
        }// end TC_BTP_PP_BV_01
          
        /**
         * @desc    Checks that BTP passes a valid BTP-B packets to the upper protocol entity
         * <pre>        
         * PICS Selection: none 
         * Initial conditions:
         *  with {
         *      the IUT being in the "initial state"
         *  }
         * Expected behaviour:
         *  ensure that {
329
330
331
332
333
334
335
336
337
338
339
         *      when {
         *          the IUT receives a valid BTP-B packet
         *              containing Destination Port
         *                  indicating'DESTINATION_PORT'
         *              containing Destination Port Info
         *                  indicating'DESTINATION_PORT_INFO'
         *              containing the payload
         *      }
         *      then {
         *          the IUT passes the payload to the upper layer
         *      }
filatov's avatar
filatov committed
340
341
342
343
344
345
346
347
348
         *  }
         * </pre>
         * 
         * @version 0.0.3
         * @see     ETSI TS 102 870-2 v1.1.1 TP/BTP/PP/BV/02
         */
        testcase TC_BTP_PP_BV_02() runs on ItsBtp system ItsBtpSystem {

            // Local variables
349
350
351
            var BtpReq v_btpReq;
            var integer i;
            
filatov's avatar
filatov committed
352
353
354
355
356
357
358
359
360
361
362
363
            // Test control
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                                
            // Test Body
364
365
            v_btpReq := valueof(m_btpReq( m_btpBWithPorts (f_getBtpDstPort(), f_getBtpDstPortInfo(), f_getBtpPayload())));
            btpPort.send(v_btpReq);
filatov's avatar
filatov committed
366

367
368
369
370
371
            f_sleep(PX_TNOAC);
            for(i:=0; i < lengthof(vc_utEvents) and not match(v_btpReq.msgOut.payload.rawPayload, vc_utEvents[i].rawPayload); i:=i+1) {
                // empty on purpose 
            }
            if(i < lengthof(vc_utEvents)) {
372
                log("*** " & testcasename() & ": PASS: BTP was transmitted to upper layer***");
373
374
375
                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
            }
            else {
376
                log("*** " & testcasename() & ": FAIL: BTP was not transmitted to upper layer***");
377
378
                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
            }
filatov's avatar
filatov committed
379
380
381
382
383
384
385
386
387
388
389
390

            // Postamble
            f_poDefault();
            f_cfDown();
                  
        }// end TC_BTP_PP_BV_02
          
        } // end btpValid
        
    } // end btpPacketProcessing
    
} // end ItsBtp_TestCases