ItsDenm_TpFunctions.ttcn 172 KB
Newer Older
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              v_actionId := f_sendDenMessage ( m_denm ( m_denmMgmtCon ( m_tsActionId ), v_situation, m_denmLocation_zeroDelta ) );
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              f_utTerminateEvent(m_utEventCancellation(v_actionId));
              
              tc_ac.start;
              alt {
                  [] denmPort.receive ( mw_denmInd ( mw_denmPdu (
                  										mw_denm ( mw_denmMgmtConTermination ( v_actionId, f_getIutStationType(), -, -, -, isNegation ))))) -> value v_denmInd {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_cfDown();
             
          } // end TC_DEN_EVTR_BV_02
          
          /**
           * @desc    TP Function for TC_DEN_EVTR_BV_03
           */
          function f_DEN_EVTR_BV_03() runs on ItsDenm {
              
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
              var TimestampIts v_referenceTime1 := f_getCurrentTime();
              var TimestampIts v_referenceTime2;
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_NEGATION) {
                  log("*** " & testcasename() & ": PICS_DENM_NEGATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              v_actionId := f_sendDenMessage ( m_denm ( m_denmMgmtCon ( m_tsActionId, -, -, -, v_referenceTime1, v_referenceTime1 ), v_situation, m_denmLocation_zeroDelta ) );
              
              v_referenceTime2 := f_getCurrentTime();
              v_situation.eventType.subCauseCode := VehicleBreakdownSubCauseCode_engineProblem_;
              v_actionId := f_sendDenMessage ( m_denm ( m_denmMgmtCon ( m_tsActionId, -, -, -, v_referenceTime2, v_referenceTime2 ), v_situation, m_denmLocation_zeroDelta ) );
              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 ( mw_denmMgmtConTermination ( v_actionId, -, v_referenceTime2, -, -, isNegation ))))) -> value v_denmInd {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_cfDown();
             
          } // end TC_DEN_EVTR_BV_03
          
          /**
           * @desc    TP Function for TC_DEN_EVTR_BV_04
           */
          function f_DEN_EVTR_BV_04() runs on ItsDenm {
              
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_CANCELLATION) {
                  log("*** " & testcasename() & ": PICS_DENM_CANCELLATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent(m_utTriggerEvent(v_situation, c_duration_10sec));
              f_awaitDenMessage( mw_denmInd ( mw_denmPdu ( mw_denm ( mw_denmMgmtCon ( mw_anyActionId ) ) ) ), v_denmInd );
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              f_utTerminateEvent(m_utEventCancellation(v_actionId));
              
              tc_ac.start;
              alt {
                  [] denmPort.receive ( 
                  		mw_denmInd ( 
                  			mw_denmPdu ( 
                  				mw_denm ( mw_denmMgmtConTermination ( v_actionId, -, -, -, -, isCancellation ), omit, omit, omit ) ) ) ) -> value v_denmInd {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_cfDown();
             
          } // end TC_DEN_EVTR_BV_04
          
          /**
           * @desc    TP Function for TC_DEN_EVTR_BV_05
           */
          function f_DEN_EVTR_BV_05() runs on ItsDenm {
              
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_NEGATION) {
                  log("*** " & testcasename() & ": PICS_DENM_NEGATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              v_actionId := f_sendDenMessage ( m_denm ( m_denmMgmtCon ( m_tsActionId ), v_situation, m_denmLocation_zeroDelta ) );
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              f_utTerminateEvent(m_utEventCancellation(v_actionId));
              
              tc_ac.start;
              alt {
                  [] denmPort.receive ( 
                  		mw_denmInd ( 
                  			mw_denmPdu ( 
                  				mw_denm ( mw_denmMgmtConTermination ( v_actionId, -, -, -, -, isNegation ), omit, omit, omit ) ) ) ) -> value v_denmInd {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": PASS: Successfully received expected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      tc_ac.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] tc_ac.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_cfDown();
             
          } // end TC_DEN_EVTR_BV_05
          
          /**
           * @desc    TP Function for TC_DEN_EVTR_BO_06
           */
          function f_DEN_EVTR_BO_06() runs on ItsDenm {
              
              // Local variables
              var template (value) SituationContainerList v_situations := {
                  m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_accident_, AccidentSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_roadworks_, RoadworksSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_slowVehicle_, SlowVehicleSubCauseCode_unavailable_)
              };
              var ActionID v_unknownActionId;
              var ActionIDList v_actionIds;
              var DenmInd v_denmInd;
              var integer i;
              
              // Test control
              if (not PICS_DENM_NEGATION and not PICS_DENM_CANCELLATION) {
                  log("*** " & testcasename() & ": PICS_DENM_NEGATION OR PICS_DENM_CANCELLATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              for (i := 0; i < lengthof(v_situations); i := i + 1) {
                  f_utTriggerEvent(m_utTriggerEvent(v_situations[i]));
                  f_awaitDenMessage(mw_denmInd(mw_anyDenmPdu), v_denmInd);
                  v_actionIds[i] := v_denmInd.msgIn.denm.management.actionID;
              }
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              v_unknownActionId := valueof(m_actionId(
                                        f_increaseSequenceNumber(
                                            v_actionIds[lengthof(v_actionIds) - 1].sequenceNumber
                                        v_actionIds[lengthof(v_actionIds) - 1].originatingStationID
                                    ));
              f_utTerminateEvent(m_utEventCancellation(v_unknownActionId));
              
              alt {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_anyDenmPdu(
                              mw_itsPduHeader,
                              mw_denm (
                                  mw_denmMgmtCon(v_unknownActionId)
                              )
                          )
                      )
                  ) -> value v_denmInd {
                      log("*** " & testcasename() & ": FAIL: Received termination DENM for the unknown actionId. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                      log("*** " & testcasename() & ": PASS: No termination DENM was sent. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
              }
              
              // Postamble
              for (i := 0; i < lengthof(v_situations); i := i + 1) {
                  f_poCancelEvent(e_iut, v_actionIds[i]);
              }
              f_cfDown();
             
          } // end TC_DEN_EVTR_BO_06
          
          /**
           * @desc    TP Function for TC_DEN_EVTR_BO_07
           */
          function f_DEN_EVTR_BO_07() runs on ItsDenm {
              
              // Local constants
              const SequenceNumber v_initialSequenceNumber := 0;
              // Local variables
              var template (value) SituationContainerList v_situations := {
                  m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_accident_, AccidentSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_roadworks_, RoadworksSubCauseCode_unavailable_),
                  m_situation(CauseCodeType_slowVehicle_, SlowVehicleSubCauseCode_unavailable_)
              };
              var SequenceNumber v_sequenceNumber := v_initialSequenceNumber;
              var ActionID v_unknownActionId;
              var ActionIDList v_actionIds; 
              var DenmInd v_denmInd;
              var integer i;
              
              // Test control
              if (not PICS_DENM_NEGATION and not PICS_DENM_CANCELLATION) {
                  log("*** " & testcasename() & ": PICS_DENM_NEGATION OR PICS_DENM_CANCELLATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              for (i := 0; i < lengthof(v_situations); i := i + 1) {
                  v_sequenceNumber := f_increaseSequenceNumber(v_sequenceNumber);
                  v_actionIds[i] := f_sendDenMessage( m_denm( m_denmMgmtCon( m_tsActionId(v_sequenceNumber) ), v_situations[i], m_denmLocation_zeroDelta ) );
              }
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              v_unknownActionId := valueof(m_actionId(
                                        f_increaseSequenceNumber(
                                            v_actionIds[lengthof(v_actionIds) - 1].sequenceNumber
              f_utTerminateEvent(m_utEventCancellation(v_unknownActionId));
              
              alt {
                  [] denmPort.receive( mw_denmInd( mw_anyDenmPdu( mw_itsPduHeader, mw_denm ( mw_denmMgmtCon(v_unknownActionId) ) ) ) ) -> value v_denmInd {
                      log("*** " & testcasename() & ": FAIL: Received termination DENM for the unknown actionId. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                      log("*** " & testcasename() & ": PASS: No termination DENM was sent. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
              }
              
              // Postamble
              for (i := 0; i < lengthof(v_situations); i := i + 1) {
                  f_poCancelEvent(e_ets, v_actionIds[i]);
              }
              f_cfDown();
             
          } // end TC_DEN_EVTR_BV_07
          
          /**
           * @desc    TP Function for TC_DEN_EVTR_BV_08
           */
          function f_DEN_EVTR_BV_08() runs on ItsDenm {
              
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
              var TimestampIts v_referenceTime1 , v_timestampIts , v_msgtimestamp;
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              
              // Test control
              if (not PICS_DENM_CANCELLATION) {
                  log("*** " & testcasename() & ": PICS_DENM_CANCELLATION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent(m_utTriggerEvent(v_situation));
              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_timestampIts - v_referenceTime1;
              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 ( mw_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    TP Function for TC_DEN_EVRP_TI_01
           */
          function f_DEN_EVRP_TI_01() runs on ItsDenm {
              
              // 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 (CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_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
              if (not PICS_DENM_REPETITION) {
                  log("*** " & testcasename() & ": PICS_DENM_REPETITION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent ( m_utTriggerEvent ( v_situation, c_validityDuration, c_repetitionDuration, c_repetitionInterval ) );
              f_awaitDenMessage(v_expectedDenmInd, v_denmInd);
              t_repetition.start(2.0 * (int2float(c_repetitionInterval)/1000.0));
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              v_expectedDenmInd.msgIn.denm.management.actionID := v_actionId;
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              alt {
                  [] denmPort.receive(v_expectedDenmInd) -> value v_denmInd {
                      if (match(t_repetition.read*1000.0, (c_lowerRepetitionInterval..c_upperRepetitionInterval))) {
                          t_repetition.stop;
                          log("*** " & testcasename() & ": PASS: Successfully received expected DENM in the expected interval. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                      }
                      else {
                          t_repetition.stop;
                          log("*** " & testcasename() & ": FAIL: Received expected DENM, interval was not correct. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                      }
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      t_repetition.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] t_repetition.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVRP_TI_01
          
          /**
           * @desc    TP Function for TC_DEN_EVRP_BV_02
           */
          function f_DEN_EVRP_BV_02() runs on ItsDenm {
              
              // Local constants
              const ValidityDuration c_validityDuration := c_duration_10sec;
              const TransmissionInterval c_repetitionInterval := c_interval_5sec;
              const ValidityDuration c_repetitionDuration := c_validityDuration;
              const float c_lowerRepetitionInterval := int2float(c_repetitionInterval)*0.95;
              const float c_upperRepetitionInterval := int2float(c_repetitionInterval)*1.05;
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_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
              if (not PICS_DENM_REPETITION) {
                  log("*** " & testcasename() & ": PICS_DENM_REPETITION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent( m_utTriggerEvent( v_situation, c_validityDuration, c_repetitionDuration, c_repetitionInterval ) );
              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 := 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.0));
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              alt {
                  [] denmPort.receive(v_expectedDenmInd) -> value v_denmInd {
                      if (match(t_repetition.read*1000.0, (c_lowerRepetitionInterval..c_upperRepetitionInterval))) {
                          t_repetition.stop;
                          log("*** " & testcasename() & ": PASS: Successfully received expected DENM in the expected interval. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                      }
                      else {
                          t_repetition.stop;
                          log("*** " & testcasename() & ": FAIL: Received expected DENM, interval was not correct. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                      }
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      t_repetition.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] t_repetition.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVRP_BV_02
          
          /**
           * @desc    TP Function for TC_DEN_EVRP_BV_03
           */
          function f_DEN_EVRP_BV_03() runs on ItsDenm {
              
              // Local constants
              const ValidityDuration c_validityDuration := c_duration_10sec;
              const TransmissionInterval c_repetitionInterval := c_interval_4sec;
              const ValidityDuration c_repetitionDuration := c_validityDuration;
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_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_validity;
              
              // Test control
              if (not PICS_DENM_REPETITION) {
                  log("*** " & testcasename() & ": PICS_DENM_REPETITION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent(m_utTriggerEvent( v_situation, c_validityDuration, c_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;
              //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) {
                  f_awaitDenMessage(v_expectedDenmInd, v_denmInd);
              }
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              alt {
                  [] t_validity.timeout {
                      log("*** " & testcasename() & ": PASS: Retransmission of DENM stopped successfully. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                  }
                  [] denmPort.receive(v_expectedDenmInd) {
                      t_validity.stop;
                      log("*** " & testcasename() & ": FAIL: Retransmission of DENM was not stopped. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
                      t_validity.stop;
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
             
          } // end TC_DEN_EVRP_BV_03
          
          /**
           * @desc    TP Function for TC_DEN_EVRP_BV_04
           */
          function f_DEN_EVRP_BV_04() runs on ItsDenm {
              
              // Local constants
              const ValidityDuration c_validityDuration := c_duration_10sec;
              const TransmissionInterval c_repetitionInterval := c_interval_2sec;
              const ValidityDuration c_repetitionDuration := c_duration_5sec;
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_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
              if (not PICS_DENM_REPETITION) {
                  log("*** " & testcasename() & ": PICS_DENM_REPETITION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent(m_utTriggerEvent(v_situation, 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    TP Function for TC_DEN_EVRP_BV_05
           */
          function f_DEN_EVRP_BV_05() runs on ItsDenm {
              
              // Local constants
              const ValidityDuration c_validityDuration := c_duration_10sec;
              const ValidityDuration c_repetitionDuration := c_validityDuration;
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_unavailable_);
              var template (present) DenmInd v_expectedDenmInd := mw_denmInd(
                                                                      mw_denmPdu(
                                                                          mw_denm(
                                                                              mw_denmMgmtCon(
                                                                                  mw_actionId,
                                                                                  -,
                                                                                  -,
                                                                                  -,
                                                                              )
                                                                          )
                                                                      )
                                                                  ); 
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              var integer i;
              // Local timers
              timer t_validity;
              
              // Test control
              if (not PICS_DENM_REPETITION) {
                  log("*** " & testcasename() & ": PICS_DENM_REPETITION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent(
                  m_utTriggerEvent(
                      v_situation, 
                      c_validityDuration, 
                      omit //no 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_05
          
          /**
           * @desc    TP Function for TC_DEN_EVRP_BV_06
           */
          function f_DEN_EVRP_BV_06() runs on ItsDenm {
              
              // Local constants
              const ValidityDuration c_validityDuration := c_duration_10sec;
              const TransmissionInterval c_repetitionInterval := c_interval_2sec;
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_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_validity;
              
              // Test control
              if (not PICS_DENM_REPETITION) {
                  log("*** " & testcasename() & ": PICS_DENM_REPETITION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent(
                  m_utTriggerEvent(
                      v_situation, 
                      c_validityDuration,
                      omit, //no repetitionDuration 
                  )
              );
              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    TP Function for TC_DEN_EVRP_BV_08
           */
          function f_DEN_EVRP_BV_08() runs on ItsDenm {
              
              // 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 (CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_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;
              
              // Test control
              if (not PICS_DENM_REPETITION) {
                  log("*** " & testcasename() & ": PICS_DENM_REPETITION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Test adapter configuration
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent ( m_utTriggerEvent ( v_situation, 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 := ?;
              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    TP Function for TC_DEN_EVRP_BV_09
           */
          function f_DEN_EVRP_BV_09() runs on ItsDenm {
              // 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(CauseCodeType_vehicleBreakdown_, VehicleBreakdownSubCauseCode_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 control
              if (not PICS_DENM_REPETITION) {
                  log("*** " & testcasename() & ": PICS_DENM_REPETITION required for executing the TC ***");
                  setverdict(inconc);
                  stop;
              }
              
              // Test component configuration
              f_cfUp();
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent( m_utTriggerEvent( v_situation, 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.0));
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);