ItsDenm_TestCases.ttcn 216 KB
Newer Older
                  [] 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    Check that DEN Basic Sercive repeats DENM transmission according to repetitionInterval parameter provided by application
           * <pre>        
           * PICS Selection: none 
           * Initial conditions:
           *  with {
           *      the IUT being in the "initial state"
           *      and the IUT having received an AppDENM_trigger request from the application layer
           *          containing repetitionInterval
           *              indicating INTERVAL_1
           *          and containing repetitionDuration
           *              indicating DURATION_1
           *          and containing validityDuration
           *              indicating DURATION_2 > DURATION_1
           *      and the IUT having generated an the corresponding event
           *          containing management container
           *              containing actionID
           *                  indicating ACTION_ID1
           *              and containing validityDuration
           *                  indicating DURATION_1
           *              and containing transmissionInterval
           *                  indicating INTERVAL_1
           *  }
           * Expected behaviour:
           *  ensure that {
           *      when { 
           *          the IUT is alerted of expiration of the time associated with INTERVAL_1
           *      }
           *      then {
           *          the IUT repeats the transmission of the valid DENM associated with ACTION_ID1
           *      }
           *  }
           * </pre>
           * 
           * @version 1.2.1
           * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/EVRP/BV-01, ETSI EN 302 637-3, clause 6.1.2.3 and 8.2.2
           */
          testcase TC_DEN_EVRP_BV_01() runs on ItsDenm system ItsDenmSystem {
              
              // Local constants
              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
              const float c_lowerRepetitionInterval := int2float(c_repetitionInterval)*0.95;
              const float c_upperRepetitionInterval := int2float(c_repetitionInterval)*1.05;
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
              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;
              // Local timers
              timer t_repetition;
              
              // Test control
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent ( m_utTriggerEvent ( v_situation, m_denmLocation_zeroDelta, c_validityDuration, c_repetitionDuration, c_repetitionInterval ) );
              f_awaitDenMessage(v_expectedDenmInd, v_denmInd);
              t_repetition.start(2.0 * int2float(c_repetitionInterval/1000));
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
filatov's avatar
filatov committed
              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))) {
filatov's avatar
filatov committed
                          t_repetition.stop;
                          log("*** " & testcasename() & ": PASS: Successfully received expected DENM in the expected interval. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                      }
                      else {
                          t_repetition.stop;
                          log("*** " & testcasename() & ": FAIL: Received expected DENM, interval was not correct. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                      }
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      t_repetition.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                  }
                  [] t_repetition.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVRP_BV_01
          
          /**
           * @desc    Check that the repeated DENM is always the most up-to-date message
           * <pre>        
           * PICS Selection: none 
           * Initial conditions:
           *  with {
           *      the IUT being in the "initial state"
           *      and the IUT having received an AppDENM_trigger request from the application layer
           *          containing repetitionInterval
           *              indicating INTERVAL_1
           *          and containing repetitionDuration
           *              indicating DURATION_1
           *          and containing validityDuration
           *              indicating DURATION_2 > DURATION_1
           *      and the IUT having generated an the corresponding event
filatov's avatar
filatov committed
           *          containing management container
           *              containing actionID
           *                  indicating ACTION_ID1
           *      and the IUT having generated an update of the event associated with ACTION_ID1 modifying partly the event
           *  }
           * Expected behaviour:
           *  ensure that {
           *      when { 
           *          the IUT is alerted of expiration of the time associated with INTERVAL_1
           *      }
           *      then {
           *          the IUT repeats the transmission of the valid DENM associated with ACTION_ID1
           *      }
           *  }
           * </pre>
           * 
           * @version 1.2.1
           * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/EVRP/BV-02, ETSI EN 302 637-3, clause 6.1.2.3 and 8.2.2
filatov's avatar
filatov committed
           */
          testcase TC_DEN_EVRP_BV_02() runs on ItsDenm system ItsDenmSystem {
              
              // Local constants
              const ValidityDuration c_validityDuration := c_duration_10sec;
              const TransmissionInterval c_repetitionInterval := c_interval_5sec;
filatov's avatar
filatov committed
              const ValidityDuration c_repetitionDuration := c_validityDuration;
              const float c_lowerRepetitionInterval := int2float(c_repetitionInterval)*0.95;
              const float c_upperRepetitionInterval := int2float(c_repetitionInterval)*1.05;
filatov's avatar
filatov committed
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
              var template (present) DenmInd v_expectedDenmInd :=
              									mw_denmInd(mw_denmPdu(mw_denm( mw_denmMgmtCon( mw_actionId, -, -, c_validityDuration)))); 
filatov's avatar
filatov committed
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              // Local timers
              timer t_repetition;
              
              // Test control
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent( m_utTriggerEvent( v_situation, m_denmLocation_zeroDelta, c_validityDuration, c_repetitionDuration, c_repetitionInterval ) );
filatov's avatar
filatov committed
              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;
              v_situation.eventType.subCauseCode := c_vehicleBreakDownSubCauseCode_engineProblem;
              f_utUpdateEvent(m_utUpdateEvent(v_actionId, v_situation));
              v_expectedDenmInd.msgIn.denm.situation := v_situation;
              f_awaitDenMessage(v_expectedDenmInd, v_denmInd);
              t_repetition.start(2.0 * int2float(c_repetitionInterval/1000));
filatov's avatar
filatov committed
              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))) {
filatov's avatar
filatov committed
                          t_repetition.stop;
                          log("*** " & testcasename() & ": PASS: Successfully received expected DENM in the expected interval. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                      }
                      else {
                          t_repetition.stop;
                          log("*** " & testcasename() & ": FAIL: Received expected DENM, interval was not correct. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                      }
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      t_repetition.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                  }
                  [] t_repetition.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVRP_BV_02
          
          /**
           * @desc    Check that DEN Basic Service stops retransmitting DENM after event’s validityDuration 
           *          expiration
           * <pre>        
           * PICS Selection: none 
           * Initial conditions:
           *  with {
           *      the IUT being in the "initial state"
           *      and the IUT having received an AppDENM_trigger request from application layer
           *          containing repetitionInterval
           *              indicating INTERVAL_1
           *          and containing repetitionDuration
           *              indicating DURATION_1
           *          and containing validityDuration
           *              indicating DURATION_2 > DURATION_1
           *      and the IUT having generated the corresponding event
filatov's avatar
filatov committed
           *          containing management container
           *              containing actionID
           *                  indicating ACTION_ID1
           *              and containing validityDuration
           *                  indicating DURATION_1
           *      and the IUT having repeated (one or more times) the transmission of the valid DENM associated with ACTION_ID1
filatov's avatar
filatov committed
           *  }
           * Expected behaviour:
           *  ensure that {
           *      when { 
           *          the IUT is alerted of expiration of the time associated with DURATION_2
filatov's avatar
filatov committed
           *      }
           *      then {
           *          the IUT stops the retransmission of the DENM associated with ACTION_ID1
filatov's avatar
filatov committed
           *      }
           *  }
           * </pre>
           * 
           * @version 1.2.1
           * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/EVRP/BV-03, ETSI EN 302 637-3, clauses 6.1.2.4 and 8.2.2
filatov's avatar
filatov committed
           */
          testcase TC_DEN_EVRP_BV_03() runs on ItsDenm system ItsDenmSystem {
              
              // Local constants
              const ValidityDuration c_validityDuration := c_duration_10sec;
              const TransmissionInterval c_repetitionInterval := c_interval_4sec;
filatov's avatar
filatov committed
              const ValidityDuration c_repetitionDuration := c_validityDuration;
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
              var template (present) DenmInd v_expectedDenmInd :=
              									mw_denmInd(mw_denmPdu(mw_denm(mw_denmMgmtCon(mw_actionId, -, -, c_validityDuration)))); 
filatov's avatar
filatov committed
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              var integer i;
              // Local timers
              timer t_validity;
              
              // Test control
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent(m_utTriggerEvent( v_situation,  m_denmLocation_zeroDelta, c_validityDuration, c_repetitionDuration, c_repetitionInterval ));
filatov's avatar
filatov committed
              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
              for (i:=0; i<(c_validityDuration/(c_repetitionInterval/1000)); i:=i+1) {
filatov's avatar
filatov committed
                  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) {
filatov's avatar
filatov committed
                      t_validity.stop;
                      log("*** " & testcasename() & ": FAIL: Retransmission of DENM was not stopped. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      t_validity.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVRP_BV_03
          
          /**
           * @desc    Check that DEN Basic Service stops retransmitting DENM after event’s repetitionDuration 
           *          expiration
           * <pre>        
           * PICS Selection: none 
           * Initial conditions:
           *  with {
           *      the IUT being in the "initial state"
           *      and the IUT having received an AppDENM_trigger request from application layer
           *          containing repetitionInterval
           *              indicating INTERVAL_1
           *          and containing repetitionDuration
           *              indicating DURATION_1
           *          and containing validityDuration
           *              indicating DURATION_2 > DURATION_1
           *      and the IUT having generated the corresponding event
filatov's avatar
filatov committed
           *          containing management container
           *              containing actionID
           *                  indicating ACTION_ID1
           *              and containing validityDuration
           *                  indicating DURATION_2
           *      and the IUT having repeated (one or more times) the transmission of the valid DENM associated with ACTION_ID1
filatov's avatar
filatov committed
           *  }
           * Expected behaviour:
           *  ensure that {
           *      when { 
           *          the IUT is alerted of expiration of the time associated with DURATION_2
           *      }
           *      then {
           *          the IUT stops the retransmission of the most up-to-date valid DENM associated with ACTION_ID1
           *      }
           *  }
           * </pre>
           * 
           * @version 1.2.1
           * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/EVRP/BV-04, ETSI EN 302 637-3, clause 8.2.2
filatov's avatar
filatov committed
           */
          testcase TC_DEN_EVRP_BV_04() runs on ItsDenm system ItsDenmSystem {
              
              // 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
              var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
              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
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent(m_utTriggerEvent(v_situation, m_denmLocation_zeroDelta, c_validityDuration, c_repetitionDuration, c_repetitionInterval ));
              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
              for (i:=0; i<(c_repetitionDuration/(c_repetitionInterval/1000)); i:=i+1) {
                  f_awaitDenMessage(v_expectedDenmInd, v_denmInd);
              }
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              alt {
                  [] t_repetition.timeout {
                      log("*** " & testcasename() & ": PASS: Retransmission of DENM stopped successfully. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(v_expectedDenmInd) -> value v_denmInd {
                      t_repetition.stop;
                      log("*** " & testcasename() & ": FAIL: Retransmission of DENM was not stopped. ***");
                      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);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVRP_BV_04
          
          /**
           * @desc    Check that DEN Basic Service does not repeat transmission of DENM if repetitionInterval is 
           *          not provided by application
           * <pre>        
           * PICS Selection: none 
           * Initial conditions:
           *  with {
           *      the IUT being in the "initial state"
           *      and the IUT having received an AppDENM_trigger request from application layer
           *          not containing repetitionInterval
           *      and the IUT having generated an the corresponding event
           *          containing management container
           *              containing actionID
           *                  indicating ACTION_ID1
           *  }
           * Expected behaviour:
           *  ensure that {
           *      when { 
           *          the IUT has detected that repetitionInterval is not provided for the event associated with ACTION_ID1
           *      }
           *      then {
           *          the IUT does not repeat the transmission of the valid DENM associated with ACTION_ID1
           *      }
           *  }
           * </pre>
           * 
           * @version 1.2.1
           * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/EVRP/BV-05, ETSI EN 302 637-3, clause 8.1.2
           */
          testcase TC_DEN_EVRP_BV_05() runs on ItsDenm system ItsDenmSystem {
              
              // Local constants
              const ValidityDuration c_validityDuration := c_duration_10sec;
              const ValidityDuration c_repetitionDuration := c_validityDuration;
filatov's avatar
filatov committed
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
              var template (present) DenmInd v_expectedDenmInd := mw_denmInd(
                                                                      mw_denmPdu(
                                                                          mw_denm(
                                                                              mw_denmMgmtCon(
                                                                                  mw_actionId,
                                                                                  -,
                                                                                  -,
                                                                                  -,
filatov's avatar
filatov committed
                                                                              )
                                                                          )
                                                                      )
                                                                  ); 
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              var integer i;
              // Local timers
filatov's avatar
filatov committed
              
              // Test control
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent(
                  m_utTriggerEvent(
                      v_situation, 
                      m_denmLocation_zeroDelta, 
                      c_validityDuration, 
              		  c_repetitionDuration,
                      omit //no repetitionInterval
filatov's avatar
filatov committed
                  )
              );
              f_awaitDenMessage(v_expectedDenmInd, v_denmInd);
              t_validity.start(1.5 * int2float(c_validityDuration));
filatov's avatar
filatov committed
              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 {
                  [] t_validity.timeout {
                      log("*** " & testcasename() & ": PASS: No retransmission of DENM occured as expected. ***");
filatov's avatar
filatov committed
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(v_expectedDenmInd) -> value v_denmInd {
                      t_validity.stop;
                      log("*** " & testcasename() & ": FAIL: Unexpected retransmission of DENM occured. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
filatov's avatar
filatov committed
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVRP_BV_05
           * @desc    Check that DEN Basic Service does not repeat transmission of DENM if repetitionDuration is 
filatov's avatar
filatov committed
           *          not provided by application
           * <pre>        
           * PICS Selection: none 
           * Initial conditions:
           *  with {
           *      the IUT being in the "initial state"
           *      and the IUT having received an AppDENM_trigger request from application layer
           *          not containing repetitionDuration
           *      and the IUT having generated an the corresponding event
filatov's avatar
filatov committed
           *          containing management container
           *              containing actionID
           *                  indicating ACTION_ID1
           *  }
           * Expected behaviour:
           *  ensure that {
           *      when { 
           *          the IUT has detected that repetitionDuration is not provided for the event associated with ACTION_ID1
filatov's avatar
filatov committed
           *      }
           *      then {
           *          the IUT does not repeat the transmission of the valid DENM associated with ACTION_ID1
           *      }
           *  }
           * </pre>
           * 
           * @version 1.2.1
           * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/EVRP/BV-06, ETSI EN 302 637-3, clause 8.1.2
          testcase TC_DEN_EVRP_BV_06() runs on ItsDenm system ItsDenmSystem {
filatov's avatar
filatov committed
              
              // Local constants
              const ValidityDuration c_validityDuration := c_duration_10sec;
              const TransmissionInterval c_repetitionInterval := c_interval_2sec;
filatov's avatar
filatov committed
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
              var template (present) DenmInd v_expectedDenmInd := mw_denmInd(
                                                                      mw_denmPdu(
                                                                          mw_denm(
                                                                              mw_denmMgmtCon(
                                                                                  mw_actionId,
                                                                                  -,
                                                                                  -,
filatov's avatar
filatov committed
                                                                              )
                                                                          )
                                                                      )
                                                                  ); 
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              var integer i;
              // Local timers
              timer t_validity;
              
              // Test control
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883
              f_utTriggerEvent(
                  m_utTriggerEvent(
                      v_situation, 
                      m_denmLocation_zeroDelta, 
                      c_validityDuration, 
                      omit, //no repetitionDuration 
                      c_repetitionInterval                      
                  )
              );
              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;
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              alt {
                  [] t_validity.timeout {
                      log("*** " & testcasename() & ": PASS: No retransmission of DENM occured as expected. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(v_expectedDenmInd) -> value v_denmInd {
                      t_validity.stop;
                      log("*** " & testcasename() & ": FAIL: Unexpected retransmission of DENM occured. ***");
                      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_06
          
          /**
           * @desc    Check that existing actionID in originating ITS-S are updated when stationID is modified
           *
           * <pre>        
           * PICS Selection: none 
           * Initial conditions:
           *  with {
           *      the IUT being in the "initial state"
           *      and the IUT having received an AppDENM_trigger request from application layer
           *      	containing repetitionInterval
           *      		indicating INTERVAL_1
           *      	and containing repetitionDuration
           *      		indicating DURATION_1
           *      	and containing validityDuration
           *      		indicating DURATION_2 > DURATION_1
           *      and the IUT having generated the corresponding event
           *      	containing management container
           *      		containing actionID
           *      			containing originatororiginatingStationID
           *      				indicating STATION_ID_1
           *      		and containing validityDuration
           *      			indicating DURATION_1
           *     and the IUT having changed its StationID
           *  }
           * Expected behaviour:
           *  ensure that {
           *      when { 
           *          the IUT changes its StationID and is alerted of expiration of the time associated with INTERVAL_1
           *      }
           *      then {
           *      		the IUT repeats the transmission of the valid DENM
           *      			containing management container
           *      				containing actionID
           *      					containing originatingStationID
           *      						indicating its new StationID
           *      }
           *  }
           * </pre>
           * 
           * @version 1.2.1
           * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/EVRP/BV-08, ETSI EN 302 637-3, clause 6.1.1.2
           */
          testcase TC_DEN_EVRP_BV_08() runs on ItsDenm system ItsDenmSystem {
              
              // Local constants
              const ValidityDuration c_duration1 := 3 * c_duration_2sec;
              const ValidityDuration c_duration2 := c_duration_10sec;
              const TransmissionInterval c_interval1 := c_interval_1sec;
              // Local variables
              var template (value) SituationContainer v_situation := m_situation ( c_causeVehicleBreakdown, c_subCauseCode_Unavailable );
              var template (present) DenmInd v_expectedDenmInd :=
              									mw_denmInd ( mw_denmPdu ( mw_denm ( mw_denmMgmtCon ( mw_actionId, -, -, c_duration2 ) ) ) ); 
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent ( m_utTriggerEvent ( v_situation, m_denmLocation_zeroDelta, c_duration2, c_duration1, c_interval1 ) );
              f_awaitDenMessage ( v_expectedDenmInd, v_denmInd );
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              v_expectedDenmInd.msgIn.denm.management.actionID := v_actionId;
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);

              // Test Body
              f_utChangePseudonym ( m_utChangePseudonym );
              
              tc_ac.start;
              alt {
                  [] denmPort.receive ( v_expectedDenmInd ) -> value v_denmInd {
                      tc_ac.stop;
                      if ( v_denmInd.msgIn.denm.management.actionID.originatingStationID != v_actionId.originatingStationID ) {
                      	log("*** " & testcasename() & ": PASS: Successfully received expected DENM - Pseudonym changed. ***");
                      	f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                      }
                      else {
                      	log("*** " & testcasename() & ": FAIL: received expected DENM - Pseudonym not changed. ***");
                      	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_EVRP_BV_08
           
          /**
           * @desc		Check that actionID is not modified in repetitions of DENM if stationID is not modified
           *
           * <pre>        
           * PICS Selection: none 
           * Initial conditions:
           *  with {
           *      the IUT being in the "initial state"
           *      and the IUT having received an AppDENM_trigger request from application layer
           *      	containing repetitionInterval
           *      		indicating INTERVAL_1
           *      	and containing repetitionDuration
           *      		indicating DURATION_1
           *      	and containing validityDuration
           *      		indicating DURATION_2 > DURATION_1
           *      and the IUT having generated the corresponding event
           *      	containing management container
           *      		containing actionID
           *      			indicating ACTION_ID_1
           *      		and containing validityDuration
           *      			indicating DURATION_1
           *     and the IUT not having changed its StationID
           *  }
           * Expected behaviour:
           *  ensure that {
           *      when { 
           *          the IUT is alerted of expiration of the time associated with INTERVAL_1
           *      }
           *      then {
           *      		the IUT repeats the transmission of the valid DENM
           *      			containing management container
           *      				containing actionID
           *      					indicating its ACTION_ID_1
           *      }
           *  }
           * </pre>
           * 
           * @version 1.2.1
           * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/EVRP/BV-09, ETSI EN 302 637-3, clause 8.2.1.2
           */
          testcase TC_DEN_EVRP_BV_09() runs on ItsDenm system ItsDenmSystem {
              // Local constants
              const ValidityDuration c_duration1 := 3 * c_duration_2sec;
              const ValidityDuration c_duration2 := c_duration_10sec;
              const TransmissionInterval c_interval1 := c_interval_1sec;
              const float c_lowerTransmissionInterval := int2float(c_interval1)*0.95;
              const float c_upperTransmissionInterval := int2float(c_interval1)*1.05;
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
              var template (present) DenmInd v_expectedDenmInd :=
              									mw_denmInd(mw_denmPdu(mw_denm( mw_denmMgmtCon( mw_actionId, -, -, c_duration2)))); 
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              // Local timers
              timer t_repetition;
              
              // Test component configuration
              f_cfUp();
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent( m_utTriggerEvent( v_situation, m_denmLocation_zeroDelta, c_duration2, c_duration1, c_interval1 ) );
              f_awaitDenMessage(v_expectedDenmInd, v_denmInd);
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              v_expectedDenmInd.msgIn.denm.management.actionID := v_actionId;
              t_repetition.start(2.0 * int2float(c_interval1/1000));
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              alt { //FIXME rewrite TC
                  [] denmPort.receive(v_expectedDenmInd) -> value v_denmInd {
                      if (match(t_repetition.read*1000.0, (c_lowerTransmissionInterval..c_upperTransmissionInterval))) {
                          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_09
           
          /**
           * @desc		Check that actionID is not modified in repetitions of DENM if stationID is not modified
           *
           * <pre>        
           * PICS Selection: none 
           * Initial conditions:
           *  with {
           *      the IUT being in the "initial state"
           *      and the IUT having received an AppDENM_trigger request from application layer
           *      	containing repetitionInterval
           *      		indicating INTERVAL_1
           *      	and containing repetitionDuration
           *      		indicating DURATION_1
           *      	and containing validityDuration
           *      		indicating DURATION_2 > DURATION_1
           *      and the IUT having generated the corresponding event
           *      	containing management container
           *      		containing actionID
           *      			indicating ACTION_ID_1
           *      		and containing validityDuration
           *      			indicating DURATION_2
           *      		and containing referenceTime
           *      			indicating REFERENCE_TIME_1
           *  }
           * Expected behaviour:
           *  ensure that {
           *      when { 
           *          the IUT is alerted of expiration of the time associated with INTERVAL_1
           *      }
           *      then {
           *      		the IUT repeats the transmission of the valid DENM
           *      			containing management container
           *      				containing actionID
           *      					indicating its ACTION_ID_1
           *      				and containing referenceTime
           *      					indicating REFERENCE_TIME_1
           *      }
           *  }
           * </pre>
           * 
           * @version 1.2.1
           * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/EVRP/BV-10, ETSI EN 302 637-3, clause 8.2.1.2
           */
          testcase TC_DEN_EVRP_BV_10() runs on ItsDenm system ItsDenmSystem {
              // Local constants
              const ValidityDuration c_duration1 := 3 * c_duration_2sec;
              const ValidityDuration c_duration2 := c_duration_10sec;
              const TransmissionInterval c_interval1 := c_interval_1sec;
              const float c_lowerTransmissionInterval := int2float(c_interval1)*0.95;
              const float c_upperTransmissionInterval := int2float(c_interval1)*1.05;
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
              var template (present) DenmInd v_expected := mw_denmInd(mw_denmPdu(mw_denm( mw_denmMgmtCon( mw_actionId, -, -, c_duration2 )))); 
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              var TimestampIts v_referenceTime;
              // Local timers
              timer t_repetition;
              
              // Test component configuration
              f_cfUp();
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent( m_utTriggerEvent( v_situation, m_denmLocation_zeroDelta, c_duration2, c_duration1, c_interval1 ) );
              f_awaitDenMessage ( v_expected, v_denmInd );
              t_repetition.start(2.0 * int2float(c_interval1/1000));
filatov's avatar
filatov committed
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              v_referenceTime := v_denmInd.msgIn.denm.management.referenceTime;
              v_expected.msgIn.denm.management.actionID := v_actionId;
              v_expected.msgIn.denm.management.referenceTime := v_referenceTime;
filatov's avatar
filatov committed
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              alt { //FIXME rewrite TC
                  [] denmPort.receive ( v_expected ) -> value v_denmInd {
                      if (match(t_repetition.read*1000.0, (c_lowerTransmissionInterval..c_upperTransmissionInterval))) {
                          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);
                      }
filatov's avatar
filatov committed
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
filatov's avatar
filatov committed
                      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);
filatov's avatar
filatov committed
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
           * @desc		Check that DEN Basic Service stops retransmitting DENM after event's validityDuration expiration
           *
filatov's avatar
filatov committed
           * <pre>        
           * PICS Selection: none 
           * Initial conditions:
           *  with {
           *      the IUT being in the "initial state"
           *      and the IUT having received an AppDENM_trigger request from application layer
           *      	containing repetitionInterval
           *      		indicating INTERVAL_1
           *      	and containing repetitionDuration
           *      		indicating DURATION_1 > defaultValidityDuration
           *      	and not containing validityDuration
           *      and the IUT having generated the corresponding event
           *      	containing management container
           *      		containing actionID
           *      			indicating ACTION_ID_1
filatov's avatar
filatov committed
           *  }
           * Expected behaviour:
           *  ensure that {
           *      when {
           *          the IUT is alerted of expiration of the defaultValidityDuration
filatov's avatar
filatov committed
           *      }
           *      then {
           *      		the IUT stops the retransmission of the DENM associated with ACTION_ID1
filatov's avatar
filatov committed
           *      }
           *  }
           * </pre>
           * 
           * @version 1.2.1
           * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/EVRP/BV-11, ETSI EN 302 637-3, clause 8.2.1.5
          testcase TC_DEN_EVRP_BV_11() runs on ItsDenm system ItsDenmSystem {
filatov's avatar
filatov committed
              // Local constants
              const ValidityDuration c_duration1 := c_defaultValidity + 100;
              const ValidityDuration c_duration2 := c_defaultValidity;
              const TransmissionInterval c_interval1 := c_interval_10sec;
              const float c_diffValidity := int2float ( ( c_duration1 - c_duration2 ) );
filatov's avatar
filatov committed
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
              var template (present) DenmInd v_expected := mw_denmInd(mw_denmPdu(mw_denm( mw_denmMgmtCon( mw_actionId, -, -, c_duration2)))); 
filatov's avatar
filatov committed
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              var TimestampIts v_referenceTime;
filatov's avatar
filatov committed
              // Local timers
              timer t_repetition;
              timer t_default;
filatov's avatar
filatov committed
              
              // Test component configuration
              f_cfUp();
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent( m_utTriggerEvent( v_situation, m_denmLocation_zeroDelta, omit, c_duration1, c_interval1 ) );
              f_awaitDenMessage ( v_expected, v_denmInd );
              t_repetition.start(2.0 * int2float(c_interval1/1000));
              t_default.start ( int2float( c_duration1/1000 ) );
filatov's avatar
filatov committed
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              v_expected.msgIn.denm.management.actionID := v_actionId;
filatov's avatar
filatov committed
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              alt {
                  [] denmPort.receive ( v_expected ) -> value v_denmInd {
                      t_repetition.stop;
                      if ( t_default.read*1000.0 < c_diffValidity ) {
                          log("*** " & testcasename() & ": FAIL: DENM received after validity duration. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                      }
                      else {
                          log("*** " & testcasename() & ": INFO: DENM retransmission. ***");
              			  t_repetition.start(2.0 * int2float(c_interval1/1000));
              			  repeat;
                      }
filatov's avatar
filatov committed
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
filatov's avatar
filatov committed
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);