ItsDenm_TpFunctions.ttcn 174 KB
Newer Older
1
/**
garciay's avatar
garciay committed
2
 *    @author   ETSI / STF484 / STF517
3
4
5
6
7
8
9
10
11
12
13
14
 *    @version  $URL$
 *              $Id$
 *    @desc     DENM TP functions
 *
 */
module ItsDenm_TpFunctions {
    
    // LibCommon
    import from LibCommon_Sync all;
    import from LibCommon_Time all;
    import from LibCommon_VerdictControl all;
    import from LibCommon_BasicTypesAndValues all;  
15
    import from LibCommon_DataStrings all;
16
    
17
    // LibItsCommon
18
    import from LibItsCommon_TypesAndValues all;
19
20
21
22
23
24
25
26
    import from LibItsCommon_Templates all;
    import from LibItsCommon_Functions all;
    
    // LibIts
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;
    import from ITS_Container language "ASN.1:1997" all;
    
    // LibItsDenm
27
28
29
30
    import from LibItsDenm_TestSystem all;
    import from LibItsDenm_Functions all;
    import from LibItsDenm_Templates all;
    import from LibItsDenm_TypesAndValues all;
31
    import from LibItsDenm_Pics all;
32
    import from LibItsDenm_Pixits all;
33
34

    import from LibItsSecurity_Functions all;
35
36
37
38
39
40
41
42
43
44
45
46
47
    
    // 5.2.1
    group denMessageTransmission {
        
      // 5.2.1.1
      group denMessageFormat {
          
          /**
           * @desc    TP Function for TC_DEN_MSGF_BV_01
           */
          function f_DEN_MSGF_BV_01() runs on ItsDenm {
              
              // Local variables
48
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
              var ActionID v_actionId;
              
              // Test control
              if (not PICS_DENM_GENERATION) {
                  log("*** " & testcasename() & ": PICS_DENM_GENERATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
68
              v_actionId := f_utTriggerEvent(m_utTriggerEvent(v_situation));
69
70
71
72
73
74
75
76
              
              tc_ac.start;
              alt {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_denmPdu(
                              mw_denm,
                              mw_anyStationId, 
77
78
                              ItsPduHeader_protocolVersion_currentVersion_, 
                              ItsPduHeader_messageID_denm_
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
                          )
                      ) 
                  ) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received a DENM with incorrect header information. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_MSGF_BV_01
          
          /**
           * @desc    TP Function for TC_DEN_MSGF_BV_02
           */
          function f_DEN_MSGF_BV_02() runs on ItsDenm {
              
              // Local variables
109
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
              var ActionID v_actionId;
              
              // Test control
              if (not PICS_DENM_GENERATION) {
                  log("*** " & testcasename() & ": PICS_DENM_GENERATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
129
              v_actionId := f_utTriggerEvent(m_utTriggerEvent(v_situation));
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
              
              tc_ac.start;
              alt {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_denmPdu(
                              mw_denm(
                                  mw_anyDenmMgmtCon,
                                  -,
                                  mw_denmLocationWithTrace({ ?, * })
                              )
                          )
                      ) 
                  ) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received a DENM with incorrect location container information. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_MSGF_BV_02
          
      } // end denMessageFormat
      
      // 5.2.1.2
      group denEventGeneration {
        
          /**
           * @desc    TP Function for TC_DEN_EVGN_BV_01
           */
          function f_DEN_EVGN_BV_01() runs on ItsDenm {
              
              // Local variables
176
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
              var ActionID v_actionId;
              
              // Test control
              if (not PICS_DENM_GENERATION) {
                  log("*** " & testcasename() & ": PICS_DENM_GENERATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
196
              v_actionId := f_utTriggerEvent(m_utTriggerEvent(v_situation));
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
              
              tc_ac.start;
              alt {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_anyDenmPdu(
                              mw_itsPduHeader,
                              mw_denm (mw_anyDenmMgmtCon)
                          )
                      ) 
                  ) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received a DENM with incorrect header and management information. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVGN_BV_01
          
          /**
           * @desc    TP Function for TC_DEN_EVGN_BV_02
           */
          function f_DEN_EVGN_BV_02() runs on ItsDenm {
              
              // Local variables
              var template (value) SituationContainerList v_situations := {
236
237
238
239
                  m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_accident_, AccidentSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_roadworks_, RoadworksSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_slowVehicle_, SlowVehicleSubCauseCode_unavailable_)
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
              };
              var boolean v_success := true;
              var ActionIDList v_actionIds;
              var DenmInd v_denmInd;
              var integer i;
              
              // Test control
              if (not PICS_DENM_GENERATION) {
                  log("*** " & testcasename() & ": PICS_DENM_GENERATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
260
261
              for (i := 0; i < lengthof(v_situations) - 1; i := i + 1) {
                  f_utTriggerEvent(m_utTriggerEvent(v_situations[i]));
262
263
264
265
266
267
                  f_awaitDenMessage(mw_denmInd(mw_anyDenmPdu), v_denmInd);
                  v_actionIds[i] := v_denmInd.msgIn.denm.management.actionID;
              }
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
268
              f_utTriggerEvent(m_utTriggerEvent(v_situations[lengthof(v_situations) - 1]));
269
270
271
272
              f_awaitDenMessage(mw_denmInd(mw_anyDenmPdu), v_denmInd);
              v_actionIds[lengthof(v_actionIds) - 1] := v_denmInd.msgIn.denm.management.actionID;
              
              //check the action id
273
              for (i := 0; i < lengthof(v_actionIds) - 1; i := i + 1) {
274
275
276
277
278
279
280
281
282
283
284
285
286
287
                  if (v_actionIds[lengthof(v_actionIds) - 1].sequenceNumber == v_actionIds[i].sequenceNumber) {
                      v_success := false;
                  }
              }
              if (v_success==true) {
                  log("*** " & testcasename() & ": PASS: actionID field indicating unused value. ***");
                  f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
              }
              else {
                  log("*** " & testcasename() & ": FAIL: actionID field indicating used value. ***");
                  f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
              }
              
              // Postamble
288
              for (i := 0; i < lengthof(v_actionIds); i := i + 1) {
289
290
291
292
293
294
295
296
297
298
299
300
                  f_poCancelEvent(e_iut, v_actionIds[i]);
              }
              f_cfDown();
             
          } // end TC_DEN_EVGN_BV_02
          
          /**
           * @desc    TP Function for TC_DEN_EVGN_BV_03
           */
          function f_DEN_EVGN_BV_03() runs on ItsDenm {
              
              // Local variables
301
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_GENERATION) {
                  log("*** " & testcasename() & ": PICS_DENM_GENERATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
322
              v_actionId := f_utTriggerEvent(m_utTriggerEvent(v_situation));
323
324
325
326
327
328
329
330
              
              tc_ac.start;
              alt {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_denmPdu(
                              mw_denm(
                                  mw_denmMgmtConWithActionID(
331
                                      v_actionId
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
361
362
363
                                  )
                              )
                          )
                      )
                  ) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVGN_BV_03
          
          /**
           * @desc    TP Function for TC_DEN_EVGN_BV_04
           */
          function f_DEN_EVGN_BV_04() runs on ItsDenm {
              
              // Local variables
364
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_GENERATION) {
                  log("*** " & testcasename() & ": PICS_DENM_GENERATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
385
              v_actionId := f_utTriggerEvent(m_utTriggerEvent(v_situation));
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
              
              tc_ac.start;
              alt {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_denmPdu(
                              mw_denm(
                                  mw_anyDenmMgmtCon,
                                  v_situation
                              )
                          )
                      )
                  ) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVGN_BV_04
          
          /**
           * @desc    TP Function for TC_DEN_EVGN_BV_05
           */
          function f_DEN_EVGN_BV_05() runs on ItsDenm {
              
              // Local variables
              var template (value) SituationContainerList v_situations := {
427
428
429
430
                  m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_accident_, AccidentSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_roadworks_, RoadworksSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_slowVehicle_, SlowVehicleSubCauseCode_unavailable_)
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
              };
              var ActionIDList v_actionIds;
              var DenmInd v_denmInd;
              var integer i;
              var TimestampIts v_timestampIts;
              
              // Test control
              if (not PICS_DENM_GENERATION) {
                  log("*** " & testcasename() & ": PICS_DENM_GENERATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
451
452
              for (i := 0; i < lengthof(v_situations) - 1; i := i + 1) {
                  f_utTriggerEvent(m_utTriggerEvent(v_situations[i]));
453
454
                  f_awaitDenMessage(mw_denmInd(mw_anyDenmPdu), v_denmInd);
                  v_actionIds[i] := v_denmInd.msgIn.denm.management.actionID;
455
                  v_timestampIts := v_denmInd.msgIn.denm.management.referenceTime;
456
457
458
459
              }
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
460
              f_utTriggerEvent(m_utTriggerEvent(v_situations[lengthof(v_situations) - 1]));
461
462
463
464
465
466
467
              
              tc_ac.start;
              alt {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_denmPdu(
                              mw_denm(
468
                                  mw_denmMgmtConWithReferenceTime(?)
469
470
471
472
473
474
                              )
                          )
                      )
                  ) -> value v_denmInd {
                      tc_ac.stop;
                      v_actionIds[lengthof(v_actionIds)] := v_denmInd.msgIn.denm.management.actionID;
475
476
477
478
479
480
481
482
                      if (v_timestampIts<v_denmInd.msgIn.denm.management.referenceTime) {
                          log("*** " & testcasename() & ": PASS: Reference Time has increased since last received DENM. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                      }
                      else {
                          log("*** " & testcasename() & ": FAIL: Reference Time has not increased since last received DENM. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                      }
483
484
485
486
487
488
489
490
491
492
493
494
495
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
496
              for (i := 0; i < lengthof(v_actionIds); i := i + 1) {
497
498
499
500
501
502
503
504
505
506
507
508
509
                  f_poCancelEvent(e_iut, v_actionIds[i]);
              }
              f_cfDown();
             
          } // end TC_DEN_EVGN_BV_05
          
          /**
           * @desc    TP Function for TC_DEN_EVGN_BV_07
           */
          function f_DEN_EVGN_BV_07() runs on ItsDenm {
              
              // Local variables
              var template (value) SituationContainerList v_situations := {
510
511
512
513
                  m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_accident_, AccidentSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_roadworks_, RoadworksSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_slowVehicle_, SlowVehicleSubCauseCode_unavailable_)
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
              };
              var SequenceNumber v_sequenceNumber;
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              var integer i;
              
              // Test control
              if (not PICS_DENM_GENERATION) {
                  log("*** " & testcasename() & ": PICS_DENM_GENERATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
534
535
              for (i := 0; i < lengthof(v_situations) - 1; i := i + 1) {
                  f_utTriggerEvent(m_utTriggerEvent(v_situations[i]));
536
537
538
539
540
541
542
543
                  f_awaitDenMessage(mw_denmInd(mw_anyDenmPdu), v_denmInd);
                  f_poCancelEvent(e_iut, v_denmInd.msgIn.denm.management.actionID);
              }
              //save the last sequence number
              v_sequenceNumber := v_denmInd.msgIn.denm.management.actionID.sequenceNumber;
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
544
              f_utTriggerEvent(m_utTriggerEvent(v_situations[lengthof(v_situations) - 1]));
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
              
              tc_ac.start;
              alt {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_denmPdu(
                              mw_denm(
                                  mw_denmMgmtConWithActionID(
                                      mw_actionId(-, f_increaseSequenceNumber(v_sequenceNumber))
                                  )
                              )
                          )
                      )
                  ) -> value v_denmInd {
                      tc_ac.stop;
                      v_actionId := v_denmInd.msgIn.denm.management.actionID;
                      log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVGN_BV_07
          
          /**
           * @desc    TP Function for TC_DEN_EVGN_BV_10
           */
          function f_DEN_EVGN_BV_10() runs on ItsDenm {
              
              // Local variables
587
              var template (value) SituationContainer v_situation := m_situation (CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_ );
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
              var StationID v_stationId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_GENERATION) {
                  log("*** " & testcasename() & ": PICS_DENM_GENERATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              v_stationId := f_getIutStationId ( );
              f_utChangePseudonym ( m_utChangePseudonym );
610
              f_utTriggerEvent ( m_utTriggerEvent ( v_situation) );
611
612
613
614
615
616
              
              tc_ac.start;
              alt {
                  [] denmPort.receive ( mw_denmInd ( mw_denmPdu ( mw_denm ( mw_anyDenmMgmtCon ) ) ) ) -> value v_denmInd {
                      tc_ac.stop;
                      if ( v_denmInd.msgIn.denm.management.actionID.originatingStationID != v_stationId ) {
617
618
                          log("*** " & testcasename() & ": PASS: Successfully received expected DENM - Pseudonym changed. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
619
620
                      }
                      else {
621
622
                          log("*** " & testcasename() & ": FAIL: received expected DENM - Pseudonym not changed. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
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
                      }
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_cfDown();
             
          } // end TC_DEN_EVGN_BV_10
          
      } // end denEventGeneration
      
      // 5.2.1.3
      group denEventUpdate {
          
          /**
           * @desc    TP Function for TC_DEN_EVUP_BV_02
           */
          function f_DEN_EVUP_BV_01() runs on ItsDenm {
              
              // Local variables
652
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_UPDATE) {
                  log("*** " & testcasename() & ": PICS_DENM_UPDATE required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
670
              f_utTriggerEvent(m_utTriggerEvent(v_situation));
671
672
673
674
675
              f_awaitDenMessage(mw_denmInd(mw_anyDenmPdu), v_denmInd);
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
676
              v_situation.eventType.subCauseCode := VehicleBreakdownSubCauseCode_engineProblem_;
677
678
679
680
681
682
683
684
685
686
687
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
              f_utUpdateEvent(m_utUpdateEvent(v_actionId, v_situation));
              
              tc_ac.start;
              alt {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_anyDenmPdu(
                              mw_itsPduHeader,
                              mw_denm (mw_anyDenmMgmtCon)
                          )
                      )
                  ) -> value v_denmInd {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVUP_BV_01
          
          /**
           * @desc    TP Function for TC_DEN_EVUP_BV_02
           */
          function f_DEN_EVUP_BV_02() runs on ItsDenm {
              
              // Local variables
716
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_UPDATE) {
                  log("*** " & testcasename() & ": PICS_DENM_UPDATE required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
734
              f_utTriggerEvent(m_utTriggerEvent(v_situation));
735
736
737
738
739
              f_awaitDenMessage(mw_denmInd(mw_anyDenmPdu), v_denmInd);
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
740
              v_situation.eventType.subCauseCode := VehicleBreakdownSubCauseCode_engineProblem_;
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
              f_utUpdateEvent(m_utUpdateEvent(v_actionId, v_situation));
              
              tc_ac.start;
              alt {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_anyDenmPdu(
                              mw_itsPduHeader,
                              mw_denm (
                                  mw_denmMgmtConWithActionID(
                                      v_actionId
                                  )
                              )
                          )
                      )
                  ) -> value v_denmInd {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVUP_BV_02
          
          /**
           * @desc    TP Function for TC_DEN_EVUP_BV_03
           */
          function f_DEN_EVUP_BV_03() runs on ItsDenm {
              
              // Local variables
784
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
785
              var TimestampIts v_referenceTime1 , v_timestampIts , v_msgtimestamp;
786
              var integer v_diff;
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_UPDATE) {
                  log("*** " & testcasename() & ": PICS_DENM_UPDATE required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
804
              f_utTriggerEvent(m_utTriggerEvent(v_situation));
805
              f_awaitDenMessage(mw_denmInd(mw_anyDenmPdu), v_denmInd);
806
              v_timestampIts := f_getCurrentTime();
807
              //log("v_timestampIts: ", v_timestampIts);
808
809
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              v_referenceTime1 := v_denmInd.msgIn.denm.management.referenceTime;
810
              //log("v_referenceTime1: ", v_referenceTime1);
811
              v_diff := v_timestampIts - v_referenceTime1;
812
              //log("v_diff: ", v_diff);
813
814
815
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
816
              v_situation.eventType.subCauseCode := VehicleBreakdownSubCauseCode_engineProblem_;
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
              f_utUpdateEvent(m_utUpdateEvent(v_actionId, v_situation));
              
              tc_ac.start;
              alt {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_anyDenmPdu(
                              mw_itsPduHeader,
                              mw_denm (
                                  mw_denmMgmtCon(
                                      v_actionId
                                  )
                              )
                          )
                      )
                  ) -> value v_denmInd {
                      tc_ac.stop;
                      v_timestampIts := f_getCurrentTime();
835
                      //log("v_timestampIts: ", v_timestampIts);
836
                      v_msgtimestamp := v_denmInd.msgIn.denm.management.referenceTime;
837
                      //log("v_msgtimestamp: ", v_msgtimestamp);
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
868
869
                      if ( ( ( v_timestampIts + v_diff ) > v_msgtimestamp ) and ( v_msgtimestamp > v_referenceTime1 ) ) {
                          log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                      }
                      else {
                          log("*** " & testcasename() & ": FAIL: ReferenceTime not updated correctly ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                      }
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVUP_BV_03
          
          /**
           * @desc    TP Function for TC_DEN_EVUP_BO_04
           */
          function f_DEN_EVUP_BO_04() runs on ItsDenm {
              
              // Local variables
870
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_UPDATE) {
                  log("*** " & testcasename() & ": PICS_DENM_UPDATE required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
888
              f_utTriggerEvent(m_utTriggerEvent(v_situation));
889
890
891
892
893
              f_awaitDenMessage(mw_denmInd(mw_anyDenmPdu), v_denmInd);
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
894
              v_situation.eventType.subCauseCode := VehicleBreakdownSubCauseCode_engineProblem_;
895
896
              f_utUpdateEvent(m_utUpdateEvent(m_actionId(f_increaseSequenceNumber(v_actionId.sequenceNumber), f_getIutStationId()), v_situation));
              
897
              tc_noac.start;
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
              alt {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_anyDenmPdu(
                              mw_itsPduHeader,
                              mw_denm (
                                  mw_denmMgmtCon(
                                      m_actionId(
                                          f_increaseSequenceNumber(v_actionId.sequenceNumber),
                                          f_getIutStationId()
                                      )
                                  )
                              )
                          )
                      )
                  ) -> value v_denmInd {
914
                      tc_noac.stop;
915
916
917
918
                      log("*** " & testcasename() & ": FAIL: Received updated DENM for the actionId which is not in originator ITS-S message table. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
919
                      tc_noac.stop;
920
921
922
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
923
                  [] tc_noac.timeout {
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
                      log("*** " & testcasename() & ": PASS: No DENM was sent. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVUP_BO_04
          
      } // end denEventUpdate
      
      // 5.2.1.4
      group denEventTermination {
          
          /**
           * @desc    TP Function for TC_DEN_EVTR_BV_01
           */
          function f_DEN_EVTR_BV_01() runs on ItsDenm {
              
              // Local variables
946
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_CANCELLATION) {
                  log("*** " & testcasename() & ": PICS_DENM_CANCELLATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
964
965
              f_utTriggerEvent(m_utTriggerEvent(v_situation, c_duration_10sec));
              f_awaitDenMessage ( mw_denmInd ( mw_denmPdu ( mw_denm (  mw_denmMgmtCon ( mw_anyActionId, -, -, c_duration_10sec ) ) ) ) , v_denmInd );
966
967
968
969
970
971
972
973
974
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              f_utTerminateEvent(m_utEventCancellation(v_actionId));
              
              tc_ac.start;
              alt {
                  [] denmPort.receive ( mw_denmInd ( mw_denmPdu (
975
                                                          mw_denm ( mw_denmMgmtConTermination ( v_actionId, -, -, -, -, isCancellation ))))) -> value v_denmInd {
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_cfDown();
             
          } // end TC_DEN_EVTR_BV_01
          
          /**
           * @desc    TP Function for TC_DEN_EVTR_BV_02
           */
          function f_DEN_EVTR_BV_02() runs on ItsDenm {
              
              // Local variables
1002
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_NEGATION) {
                  log("*** " & testcasename() & ": PICS_DENM_NEGATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              v_actionId := f_sendDenMessage ( m_denm ( m_denmMgmtCon ( m_tsActionId ), v_situation, m_denmLocation_zeroDelta ) );
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
1024
              f_sleep(0.5);
1025
1026
1027
1028
1029
              f_utTerminateEvent(m_utEventCancellation(v_actionId));
              
              tc_ac.start;
              alt {
                  [] denmPort.receive ( mw_denmInd ( mw_denmPdu (
1030
                                                          mw_denm ( mw_denmMgmtConTermination ( v_actionId, f_getIutStationType(), -, -, -, isNegation ))))) -> value v_denmInd {
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_cfDown();
             
          } // end TC_DEN_EVTR_BV_02
          
          /**
           * @desc    TP Function for TC_DEN_EVTR_BV_03
           */
          function f_DEN_EVTR_BV_03() runs on ItsDenm {
              
              // Local variables
1057
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
              var TimestampIts v_referenceTime1 := f_getCurrentTime();
              var TimestampIts v_referenceTime2;
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_NEGATION) {
                  log("*** " & testcasename() & ": PICS_DENM_NEGATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
1077
              v_actionId := f_sendDenMessage ( m_denm ( m_denmMgmtCon ( m_tsActionId, -, -, -, v_referenceTime1, v_referenceTime1 ), v_situation, m_denmLocation_zeroDelta ) );
1078
1079
              
              v_referenceTime2 := f_getCurrentTime();
1080
1081
              v_situation.eventType.subCauseCode := VehicleBreakdownSubCauseCode_engineProblem_;
              v_actionId := f_sendDenMessage ( m_denm ( m_denmMgmtCon ( m_tsActionId, -, -, -, v_referenceTime2, v_referenceTime2 ), v_situation, m_denmLocation_zeroDelta ) );
1082
1083
1084
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
1085
              f_sleep(0.5);
1086
1087
1088
1089
1090
              f_utTerminateEvent(m_utEventCancellation(v_actionId));
              
              tc_ac.start;
              alt {
                  [] denmPort.receive ( mw_denmInd ( mw_denmPdu (
1091
                                            mw_denm ( mw_denmMgmtConTermination ( v_actionId, -, v_referenceTime2, -, -, isNegation ))))) -> value v_denmInd {
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_cfDown();
             
          } // end TC_DEN_EVTR_BV_03
          
          /**
           * @desc    TP Function for TC_DEN_EVTR_BV_04
           */
          function f_DEN_EVTR_BV_04() runs on ItsDenm {
              
              // Local variables
1118
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_CANCELLATION) {
                  log("*** " & testcasename() & ": PICS_DENM_CANCELLATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
1136
              f_utTriggerEvent(m_utTriggerEvent(v_situation, c_duration_10sec));
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
              f_awaitDenMessage( mw_denmInd ( mw_denmPdu ( mw_denm ( mw_denmMgmtCon ( mw_anyActionId ) ) ) ), v_denmInd );
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              f_utTerminateEvent(m_utEventCancellation(v_actionId));
              
              tc_ac.start;
              alt {
                  [] denmPort.receive ( 
1147
1148
1149
                          mw_denmInd ( 
                              mw_denmPdu ( 
                                  mw_denm ( mw_denmMgmtConTermination ( v_actionId, -, -, -, -, isCancellation ), omit, omit, omit ) ) ) ) -> value v_denmInd {
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_cfDown();
             
          } // end TC_DEN_EVTR_BV_04
          
          /**
           * @desc    TP Function for TC_DEN_EVTR_BV_05
           */
          function f_DEN_EVTR_BV_05() runs on ItsDenm {
              
              // Local variables
1176
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_NEGATION) {
                  log("*** " & testcasename() & ": PICS_DENM_NEGATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              v_actionId := f_sendDenMessage ( m_denm ( m_denmMgmtCon ( m_tsActionId ), v_situation, m_denmLocation_zeroDelta ) );
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
1198
              f_sleep(0.5);
1199
1200
1201
1202
1203
              f_utTerminateEvent(m_utEventCancellation(v_actionId));
              
              tc_ac.start;
              alt {
                  [] denmPort.receive ( 
1204
1205
1206
                          mw_denmInd ( 
                              mw_denmPdu ( 
                                  mw_denm ( mw_denmMgmtConTermination ( v_actionId, -, -, -, -, isNegation ), omit, omit, omit ) ) ) ) -> value v_denmInd {
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_cfDown();
             
          } // end TC_DEN_EVTR_BV_05
          
          /**
           * @desc    TP Function for TC_DEN_EVTR_BO_06
           */
          function f_DEN_EVTR_BO_06() runs on ItsDenm {
              
              // Local variables
              var template (value) SituationContainerList v_situations := {
1234
1235
1236
1237
                  m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_accident_, AccidentSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_roadworks_, RoadworksSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_slowVehicle_, SlowVehicleSubCauseCode_unavailable_)
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
              };
              var ActionID v_unknownActionId;
              var ActionIDList v_actionIds;
              var DenmInd v_denmInd;
              var integer i;
              
              // Test control
              if (not PICS_DENM_NEGATION and not PICS_DENM_CANCELLATION) {
                  log("*** " & testcasename() & ": PICS_DENM_NEGATION OR PICS_DENM_CANCELLATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
1258
1259
              for (i := 0; i < lengthof(v_situations); i := i + 1) {
                  f_utTriggerEvent(m_utTriggerEvent(v_situations[i]));
1260
1261
1262
1263
1264
1265
1266
1267
                  f_awaitDenMessage(mw_denmInd(mw_anyDenmPdu), v_denmInd);
                  v_actionIds[i] := v_denmInd.msgIn.denm.management.actionID;
              }
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              v_unknownActionId := valueof(m_actionId(
                                        f_increaseSequenceNumber(
1268
                                            v_actionIds[lengthof(v_actionIds) - 1].sequenceNumber
1269
                                        ),
1270
                                        v_actionIds[lengthof(v_actionIds) - 1].originatingStationID
1271
1272
1273
                                    ));
              f_utTerminateEvent(m_utEventCancellation(v_unknownActionId));
              
1274
              tc_noac.start;
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
              alt {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_anyDenmPdu(
                              mw_itsPduHeader,
                              mw_denm (
                                  mw_denmMgmtCon(v_unknownActionId)
                              )
                          )
                      )
                  ) -> value v_denmInd {
1286
                      tc_noac.stop;
1287
1288
1289
1290
                      log("*** " & testcasename() & ": FAIL: Received termination DENM for the unknown actionId. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
1291
                      tc_noac.stop;
1292
1293
1294
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
1295
                  [] tc_noac.timeout {
1296
1297
1298
1299
1300
1301
                      log("*** " & testcasename() & ": PASS: No termination DENM was sent. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
              }
              
              // Postamble
1302
              for (i := 0; i < lengthof(v_situations); i := i + 1) {
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
                  f_poCancelEvent(e_iut, v_actionIds[i]);
              }
              f_cfDown();
             
          } // end TC_DEN_EVTR_BO_06
          
          /**
           * @desc    TP Function for TC_DEN_EVTR_BO_07
           */
          function f_DEN_EVTR_BO_07() runs on ItsDenm {
              
              // Local constants
              const SequenceNumber v_initialSequenceNumber := 0;
              // Local variables
              var template (value) SituationContainerList v_situations := {
1318
1319
1320
1321
                  m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_accident_, AccidentSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_roadworks_, RoadworksSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_slowVehicle_, SlowVehicleSubCauseCode_unavailable_)
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
              };
              var SequenceNumber v_sequenceNumber := v_initialSequenceNumber;
              var ActionID v_unknownActionId;
              var ActionIDList v_actionIds; 
              var DenmInd v_denmInd;
              var integer i;
              
              // Test control
              if (not PICS_DENM_NEGATION and not PICS_DENM_CANCELLATION) {
                  log("*** " & testcasename() & ": PICS_DENM_NEGATION OR PICS_DENM_CANCELLATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
1343
              for (i := 0; i < lengthof(v_situations); i := i + 1) {
1344
1345
1346
1347
1348
1349
1350
1351
                  v_sequenceNumber := f_increaseSequenceNumber(v_sequenceNumber);
                  v_actionIds[i] := f_sendDenMessage( m_denm( m_denmMgmtCon( m_tsActionId(v_sequenceNumber) ), v_situations[i], m_denmLocation_zeroDelta ) );
              }
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              v_unknownActionId := valueof(m_actionId(
                                        f_increaseSequenceNumber(
1352
                                            v_actionIds[lengthof(v_actionIds) - 1].sequenceNumber
1353
1354
1355
                                        ),
                                        f_getTsStationId()
                                    ));
1356
              f_sleep(0.5);
1357
1358
              f_utTerminateEvent(m_utEventCancellation(v_unknownActionId));
              
1359
              tc_noac.start;
1360
1361
              alt {
                  [] denmPort.receive( mw_denmInd( mw_anyDenmPdu( mw_itsPduHeader, mw_denm ( mw_denmMgmtCon(v_unknownActionId) ) ) ) ) -> value v_denmInd {
1362
                      tc_noac.stop;
1363
1364
1365
1366
                      log("*** " & testcasename() & ": FAIL: Received termination DENM for the unknown actionId. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
1367
                      tc_noac.stop;
1368
1369
1370
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
1371
                  [] tc_noac.timeout {
1372
1373
1374
1375
1376
1377
                      log("*** " & testcasename() & ": PASS: No termination DENM was sent. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
              }
              
              // Postamble
1378
              for (i := 0; i < lengthof(v_situations); i := i + 1) {
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
                  f_poCancelEvent(e_ets, v_actionIds[i]);
              }
              f_cfDown();
             
          } // end TC_DEN_EVTR_BV_07
          
          /**
           * @desc    TP Function for TC_DEN_EVTR_BV_08
           */
          function f_DEN_EVTR_BV_08() runs on ItsDenm {
              
              // Local variables
1391
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
1392
              var TimestampIts v_referenceTime1 , v_timestampIts , v_msgtimestamp;
1393
              var integer v_diff;
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_CANCELLATION) {
                  log("*** " & testcasename() & ": PICS_DENM_CANCELLATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
1411
              f_utTriggerEvent(m_utTriggerEvent(v_situation));
1412
1413
1414
1415
              f_awaitDenMessage(mw_denmInd(mw_anyDenmPdu), v_denmInd);
              v_timestampIts := f_getCurrentTime();
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              v_referenceTime1 := v_denmInd.msgIn.denm.management.referenceTime;
1416
              v_diff := v_timestampIts - v_referenceTime1;
1417
1418
1419
1420
1421
1422
1423
1424
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              f_utTerminateEvent ( m_utEventCancellation ( v_actionId ) );
              
              tc_ac.start;
              alt {
                  [] denmPort.receive ( 
1425
                          mw_denmInd ( mw_denmPdu ( mw_denm ( mw_denmMgmtConTermination ( v_actionId, -, -, -, -, isCancellation ) ) ) ) ) -> value v_denmInd {
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
                      tc_ac.stop;
                      v_timestampIts := f_getCurrentTime();
                      v_msgtimestamp := v_denmInd.msgIn.denm.management.referenceTime;
                      if ( ( ( v_timestampIts + v_diff ) > v_msgtimestamp ) and ( v_msgtimestamp > v_referenceTime1 ) ) {
                          log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                      }
                      else {
                          log("*** " & testcasename() & ": FAIL: ReferenceTime not updated correctly ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                      }
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVTR_BV_08
          
      } // end denEventTermination
      
      // 5.2.1.5
      group denMessageRepetition {
          
          /**
           * @desc    TP Function for TC_DEN_EVRP_TI_01
           */
          function f_DEN_EVRP_TI_01() runs on ItsDenm {
              
              // Local constants
1466
1467
1468
              const TransmissionInterval    c_repetitionInterval    := c_interval_1sec;        // INTERVAL_1
              const ValidityDuration        c_validityDuration        := c_duration_10sec;        // DURATION_2
              const ValidityDuration        c_repetitionDuration    := c_validityDuration;                // DURATION_1
1469
1470
1471
              const float c_lowerRepetitionInterval := int2float(c_repetitionInterval)*0.95;
              const float c_upperRepetitionInterval := int2float(c_repetitionInterval)*1.05;
              // Local variables
1472
              var template (value)    SituationContainer v_situation := m_situation (CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_ );
1473
              var template (present) DenmInd v_expectedDenmInd := 
1474
                                          mw_denmInd ( mw_denmPdu ( mw_denm ( mw_denmMgmtCon ( mw_actionId, -, -, c_validityDuration ) ) ) ); 
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              // Local timers
              timer t_repetition;
              
              // Test control
              if (not PICS_DENM_REPETITION) {
                  log("*** " & testcasename() & ": PICS_DENM_REPETITION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
1494
              f_utTriggerEvent ( m_utTriggerEvent ( v_situation, c_validityDuration, c_repetitionDuration, c_repetitionInterval ) );
1495
              f_awaitDenMessage(v_expectedDenmInd, v_denmInd);
1496
              t_repetition.start(2.0 * (int2float(c_repetitionInterval)/1000.0));
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              v_expectedDenmInd.msgIn.denm.management.actionID := v_actionId;
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              alt {
                  [] denmPort.receive(v_expectedDenmInd) -> value v_denmInd {
                      if (match(t_repetition.read*1000.0, (c_lowerRepetitionInterval..c_upperRepetitionInterval))) {
                          t_repetition.stop;
                          log("*** " & testcasename() & ": PASS: Successfully received expected DENM in the expected interval. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                      }
                      else {
                          t_repetition.stop;
                          log("*** " & testcasename() & ": FAIL: Received expected DENM, interval was not correct. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                      }
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      t_repetition.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] t_repetition.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
1522
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVRP_TI_01
          
          /**
           * @desc    TP Function for TC_DEN_EVRP_BV_02
           */
          function f_DEN_EVRP_BV_02() runs on ItsDenm {
              
              // Local constants
              const ValidityDuration c_validityDuration := c_duration_10sec;
              const TransmissionInterval c_repetitionInterval := c_interval_5sec;
              const ValidityDuration c_repetitionDuration := c_validityDuration;
              const float c_lowerRepetitionInterval := int2float(c_repetitionInterval)*0.95;
              const float c_upperRepetitionInterval := int2float(c_repetitionInterval)*1.05;
              // Local variables
1544
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
1545
              var template (present) DenmInd v_expectedDenmInd := mw_denmInd(mw_denmPdu(mw_denm( mw_denmMgmtCon( mw_actionId, -, -, c_validityDuration)))); 
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              // Local timers
              timer t_repetition;
              
              // Test control
              if (not PICS_DENM_REPETITION) {
                  log("*** " & testcasename() & ": PICS_DENM_REPETITION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
1565
              f_utTriggerEvent( m_utTriggerEvent( v_situation, c_validityDuration, c_repetitionDuration, c_repetitionInterval ) );
1566
1567
1568
1569
1570
1571
              f_awaitDenMessage(v_expectedDenmInd, v_denmInd);
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              v_expectedDenmInd.msgIn.denm.management.actionID := v_actionId;
              //update event after 1 second
              tc_noac.start(1.0);
              tc_noac.timeout;
1572
              v_situation.eventType.subCauseCode := VehicleBreakdownSubCauseCode_engineProblem_;
1573
1574
1575
              f_utUpdateEvent(m_utUpdateEvent(v_actionId, v_situation));
              v_expectedDenmInd.msgIn.denm.situation := v_situation;
              f_awaitDenMessage(v_expectedDenmInd, v_denmInd);
1576
              t_repetition.start(2.0 * (int2float(c_repetitionInterval)/1000.0));
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              alt {
                  [] denmPort.receive(v_expectedDenmInd) -> value v_denmInd {
                      if (match(t_repetition.read*1000.0, (c_lowerRepetitionInterval..c_upperRepetitionInterval))) {
                          t_repetition.stop;
                          log("*** " & testcasename() & ": PASS: Successfully received expected DENM in the expected interval. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                      }
                      else {
                          t_repetition.stop;
                          log("*** " & testcasename() & ": FAIL: Received expected DENM, interval was not correct. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                      }
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      t_repetition.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] t_repetition.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVRP_BV_02
          
          /**
           * @desc    TP Function for TC_DEN_EVRP_BV_03
           */
          function f_DEN_EVRP_BV_03() runs on ItsDenm {
              
              // Local constants
              const ValidityDuration c_validityDuration := c_duration_10sec;
              const TransmissionInterval c_repetitionInterval := c_interval_4sec;
              const ValidityDuration c_repetitionDuration := c_validityDuration;
              // Local variables
1620
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
1621
              var template (present) DenmInd v_expectedDenmInd :=
1622
                                                  mw_denmInd(mw_denmPdu(mw_denm(mw_denmMgmtCon(mw_actionId, -, -, c_validityDuration)))); 
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              var integer i;
              // Local timers
              timer t_validity;
              
              // Test control
              if (not PICS_DENM_REPETITION) {
                  log("*** " & testcasename() & ": PICS_DENM_REPETITION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
1643
              f_utTriggerEvent(m_utTriggerEvent( v_situation, c_validityDuration, c_repetitionDuration, c_repetitionInterval ));
1644
1645
1646
1647
1648
              f_awaitDenMessage(v_expectedDenmInd, v_denmInd);
              t_validity.start(1.5 * int2float(c_validityDuration));
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              v_expectedDenmInd.msgIn.denm.management.actionID := v_actionId;
              //await retransmitted DENM message based on the repetition interval in between the validity duration
1649
              for (i:=0; i<(c_validityDuration/(c_repetitionInterval/1000)); i := i + 1) {
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
                  f_awaitDenMessage(v_expectedDenmInd, v_denmInd);
              }
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              alt {
                  [] t_validity.timeout {
                      log("*** " & testcasename() & ": PASS: Retransmission of DENM stopped successfully. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(v_expectedDenmInd) {
                      t_validity.stop;
                      log("*** " & testcasename() & ": FAIL: Retransmission of DENM was not stopped. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      t_validity.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVRP_BV_03
          
          /**
           * @desc    TP Function for TC_DEN_EVRP_BV_04
           */
          function f_DEN_EVRP_BV_04() runs on ItsDenm {
              
              // Local constants
              const ValidityDuration c_validityDuration := c_duration_10sec;
              const TransmissionInterval c_repetitionInterval := c_interval_2sec;
              const ValidityDuration c_repetitionDuration := c_duration_5sec;
              // Local variables
1688
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
              var template (present) DenmInd v_expectedDenmInd := mw_denmInd(mw_denmPdu(mw_denm(mw_denmMgmtCon(mw_actionId, -, -, c_validityDuration)))); 
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              var integer i;
              // Local timers
              timer t_repetition;
              
              // Test control
              if (not PICS_DENM_REPETITION) {
                  log("*** " & testcasename() & ": PICS_DENM_REPETITION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
1710
              f_utTriggerEvent(m_utTriggerEvent(v_situation, c_validityDuration, c_repetitionDuration, c_repetitionInterval ));
1711
1712
1713
1714
1715
              f_awaitDenMessage(v_expectedDenmInd, v_denmInd);
              t_repetition.start(1.5 * int2float(c_repetitionDuration));
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              v_expectedDenmInd.msgIn.denm.management.actionID := v_actionId;
              //await retransmitted DENM message based on the repetition interval in between the repetition duration