ItsDenm_TestCases.ttcn 222 KB
Newer Older
           *                      indicating ACTION_ID1
		   *	              and containing termination
		   *		              indicating value isCancellation
           *                  and containing referenceTime
           *                      indicating CLT
filatov's avatar
filatov committed
           *      }
           *  }
           * </pre>
           * 
           * @version 1.2.1
           * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/EVTR/BV-08, ETSI EN 302 637-3, clause 8.2.1.3
          testcase TC_DEN_EVTR_BV_08() runs on ItsDenm system ItsDenmSystem {
filatov's avatar
filatov committed
              
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
              var TimestampIts v_referenceTime1 , v_timestampIts , v_msgtimestamp;
              var Int16 v_diff;
filatov's avatar
filatov committed
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent(m_utTriggerEvent(v_situation, m_denmLocation_zeroDelta));
              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;
              v_diff := v_referenceTime1 - v_timestampIts;
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              f_utTerminateEvent ( m_utEventCancellation ( v_actionId ) );
              
              tc_ac.start;
              alt {
                  [] denmPort.receive ( 
                  		mw_denmInd ( mw_denmPdu ( mw_denm ( m_denmMgmtConTermination ( v_actionId, -, -, -, -, -, isCancellation ) ) ) ) ) -> value v_denmInd {
                      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    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();
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 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994
              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);