ItsDenm_TestCases.ttcn 222 KB
Newer Older
filatov's avatar
filatov committed
              // Test Body
              alt { //FIXME rewrite TC
                  [] denmPort.receive ( v_expected ) -> value v_denmInd {
                      if (match(t_repetition.read*1000.0, (c_lowerTransmissionInterval..c_upperTransmissionInterval))) {
                          t_repetition.stop;
                          log("*** " & testcasename() & ": PASS: Successfully received expected DENM in the expected interval. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                      }
                      else {
                          t_repetition.stop;
                          log("*** " & testcasename() & ": FAIL: Received expected DENM, interval was not correct. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                      }
filatov's avatar
filatov committed
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
filatov's avatar
filatov committed
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] t_repetition.timeout {
                      log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                  }
              }
              
              // Postamble
              f_poCancelEvent(e_iut, v_actionId);
              f_cfDown();
           * @desc		Check that DEN Basic Service stops retransmitting DENM after event's validityDuration expiration
           *
filatov's avatar
filatov committed
           * <pre>        
           * PICS Selection: none 
           * Initial conditions:
           *  with {
           *      the IUT being in the "initial state"
           *      and the IUT having received an AppDENM_trigger request from application layer
           *      	containing repetitionInterval
           *      		indicating INTERVAL_1
           *      	and containing repetitionDuration
           *      		indicating DURATION_1 > defaultValidityDuration
           *      	and not containing validityDuration
           *      and the IUT having generated the corresponding event
           *      	containing management container
           *      		containing actionID
           *      			indicating ACTION_ID_1
filatov's avatar
filatov committed
           *  }
           * Expected behaviour:
           *  ensure that {
           *      when {
           *          the IUT is alerted of expiration of the defaultValidityDuration
filatov's avatar
filatov committed
           *      }
           *      then {
           *      		the IUT stops the retransmission of the DENM associated with ACTION_ID1
filatov's avatar
filatov committed
           *      }
           *  }
           * </pre>
           * 
           * @version 1.2.1
           * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/EVRP/BV-11, ETSI EN 302 637-3, clause 8.2.1.5
          testcase TC_DEN_EVRP_BV_11() runs on ItsDenm system ItsDenmSystem {
filatov's avatar
filatov committed
              // Local constants
              const ValidityDuration c_duration1 := c_defaultValidity + 100;
              const ValidityDuration c_duration2 := c_defaultValidity;
              const TransmissionInterval c_interval1 := c_interval_10sec;
              const float c_diffValidity := int2float ( ( c_duration1 - c_duration2 ) );
filatov's avatar
filatov committed
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
              var template (present) DenmInd v_expected := mw_denmInd(mw_denmPdu(mw_denm( mw_denmMgmtCon( mw_actionId, -, -, c_duration2)))); 
filatov's avatar
filatov committed
              var ActionID v_actionId;
              var DenmInd v_denmInd;
              var TimestampIts v_referenceTime;
filatov's avatar
filatov committed
              // Local timers
              timer t_repetition;
              timer t_default;
filatov's avatar
filatov committed
              
              // Test component configuration
              f_cfUp();
              
              // Preamble
              f_prInitialState();
              f_utTriggerEvent( m_utTriggerEvent( v_situation, m_denmLocation_zeroDelta, omit, c_duration1, c_interval1 ) );
              f_awaitDenMessage ( v_expected, v_denmInd );
              t_repetition.start(2.0 * int2float(c_interval1/1000));
              t_default.start ( int2float( c_duration1/1000 ) );
filatov's avatar
filatov committed
              v_actionId := v_denmInd.msgIn.denm.management.actionID;
              v_expected.msgIn.denm.management.actionID := v_actionId;
filatov's avatar
filatov committed
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              alt {
                  [] denmPort.receive ( v_expected ) -> value v_denmInd {
                      t_repetition.stop;
                      if ( t_default.read*1000.0 < c_diffValidity ) {
                          log("*** " & testcasename() & ": FAIL: DENM received after validity duration. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                      }
                      else {
                          log("*** " & testcasename() & ": INFO: DENM retransmission. ***");
              			  t_repetition.start(2.0 * int2float(c_interval1/1000));
              			  repeat;
                      }
filatov's avatar
filatov committed
                  }
                  [] denmPort.receive(mw_denmInd(mw_anyDenmPdu)) {
filatov's avatar
filatov committed
                      log("*** " & testcasename() & ": FAIL: Received an unexpected DENM. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                  }
                  [] t_repetition.timeout {
                      if ( t_default.read*1000.0 < c_diffValidity ) {
                          t_default.stop;
                          log("*** " & testcasename() & ": PASS: Retransmission of DENM stopped. ***");
                          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                      }
                      else {
                          t_default.stop;
                      	  log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                      	  f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                      }
                  }
                  [] t_default.timeout {
                      t_repetition.stop;
                      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();
filatov's avatar
filatov committed
          
      } // end denMessageRepetition
      
    } // end denMessageTransmission
    
    // 5.2.2
    group denMessageReception {
        
        /**
         * @desc    Check that receiving ITS-S transmits DENM to application if it concerns an unknown ActionID and if it is not a termination DENM
         *         
filatov's avatar
filatov committed
         * <pre>
         * PICS Selection: none
         * Initial conditions:
         *  with {
         *      the IUT being in the "initial state"
         *      and the IUT not having received DENM
         *          containing management container
         *              containing actionID
         *                  indicating ACTION_ID1
         *  }
         * Expected behaviour:
         *  ensure that {
         *      when { 
         *          the IUT receives a DENM that is not a termination
         *              containing management container
         *                  containing actionID
         *                      indicating ACTION_ID1
         *      }
         *      then {
         *          the IUT transmits the DENM content to upper layer
         *      }
         *  }
         * </pre>
         * 
         * @version 1.2.1
         * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/MSRV/BV-01, ETSI EN 302 637-3, clause 8.4.2
filatov's avatar
filatov committed
         */
        testcase TC_DEN_MSRV_BV_01() runs on ItsDenm system ItsDenmSystem {
            
            // Local variables
            var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
            var ActionID v_actionId;
            var integer i;
            
            // Test control
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )
            );
            
            f_sleep(PX_TAC);
            for(i:=0; i < lengthof(vc_utEvents) and not match(v_actionId, vc_utEvents[i].denMsg.denm.management.actionID); i:=i+1) {
                // empty on purpose 
            }
            if(i < lengthof(vc_utEvents)) {
                log("*** " & testcasename() & ": PASS: DENM was transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_success);
            }
            else {
                log("*** " & testcasename() & ": FAIL: DENM was not transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_error);
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_MSRV_BV_01
        
        /**
         * @desc    Check that receiving ITS-S transmits DENM to application if it concerns a known ActionID 
filatov's avatar
filatov committed
         *          and referenceTime is greater than highest value received for this ActionID
         * <pre>
         * PICS Selection: none
         * Initial conditions:
         *  with {
         *      the IUT being in the "initial state"
         *      and the IUT having received DENM
         *          containing management container
         *              containing actionID
         *                  indicating ACTION_ID1
         *              and containing referenceTime
         *                  indicating  REFERENCETIME_1
         *  }
         * Expected behaviour:
         *  ensure that {
         *      when { 
         *          the IUT receives a DENM
         *              containing management container
         *                  containing actionID
         *                      indicating ACTION_ID1
         *                  and containing referenceTime
         *                      indicating REFERENCETIME_2 greater than REFERENCETIME_1

         *      }
         *      then {
         *          the IUT transmits the DENM content to upper layer
         *      }
         *  }
         * </pre>
         * 
         * @version 1.2.1
         * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/MSRV/BV-02, ETSI EN 302 637-3, clause 8.4.2
filatov's avatar
filatov committed
         */
        testcase TC_DEN_MSRV_BV_02() runs on ItsDenm system ItsDenmSystem {
            
            // Local variables
            var template (value) SituationContainer v_situation1 := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
            var template (value) SituationContainer v_situation2 := m_situation(c_causeVehicleBreakdown, c_vehicleBreakDownSubCauseCode_engineProblem);
            var TimestampIts v_referenceTime2;
            var ActionID v_actionId;
            var integer i;
            
            // Test control
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId
                    ),
                    v_situation1,
                    m_denmLocation_zeroDelta
                )
            );
            
            f_sleep(1.0);
            v_referenceTime2 := f_getCurrentTime();
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        v_actionId,
                        -, -, -, 
                        v_referenceTime2
filatov's avatar
filatov committed
                    ),
                    v_situation2,
                    m_denmLocation_zeroDelta
                )
            );
            
            f_sleep(PX_TAC);
            for(i:=0; i < lengthof(vc_utEvents) 
                      and not match(v_actionId, vc_utEvents[i].denMsg.denm.management.actionID)
                      and vc_utEvents[i].denMsg.denm.management.referenceTime != v_referenceTime2; i:=i+1) {
                // empty on purpose 
            }
            if(i < lengthof(vc_utEvents)) {
                log("*** " & testcasename() & ": PASS: DENM was transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_success);
            }
            else {
                log("*** " & testcasename() & ": FAIL: DENM was not transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_error);
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_MSRV_BV_02
                
        /**
         * @desc    Check that receiving ITS-S discards termination DENM if it concerns an unknown ActionID (own actionID)
filatov's avatar
filatov committed
         * <pre>
         * PICS Selection: none 
         * Initial conditions:
         *  with {
         *      the IUT being in the "initial state"
         *      and the IUT having received several events
         *      and the IUT not having received DENM
         *          containing actionID
         *              indicating ACTION_ID1
         *  }
         * Expected behaviour:
         *  ensure that {
         *      when { 
         *          the IUT receives a termination DENM
         *              containing actionID
         *                  indicating ACTION_ID1
         *      }
         *      then {
         *          the IUT discards the DENM
         *          and the IUT does not forward the DENM content to upper layer
         *      }
         *  }
         * </pre>
         * 
         * @version 1.2.1
         * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/MSRV/BV-03, ETSI EN 302 637-3, clause 8.3.2
         */
        testcase TC_DEN_MSRV_BV_03() runs on ItsDenm system ItsDenmSystem {
            
            // Local variables
            var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
            var ActionID v_actionId;
            var integer i;
            
            // Test control
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
filatov's avatar
filatov committed
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )
            );
            
            f_sleep(PX_TNOAC);
            for(i:=0; i < lengthof(vc_utEvents) and not match(v_actionId, vc_utEvents[i].denMsg.denm.management.actionID); i:=i+1) {
                // empty on purpose 
            }
            if(i < lengthof(vc_utEvents)) {
                log("*** " & testcasename() & ": FAIL: DENM was transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_error);
            }
            else {
                log("*** " & testcasename() & ": PASS: DENM was not transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_success);
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_MSRV_BV_03
        
        /**
         * @desc    Check that receiving ITS-S discards termination DENM if it concerns an unknown ActionID (other actionID)
filatov's avatar
filatov committed
         * <pre>
         * PICS Selection: none 
         * Initial conditions:
         *  with {
         *      and the IUT having received several events
         *      and the IUT not having received DENM
         *          containing actionID
         *              indicating ACTION_ID1
         *  }
         * Expected behaviour:
         *  ensure that {
         *      when { 
         *          the IUT receives a termination DENM
         *              containing actionID
         *                  indicating ACTION_ID1
         *      }
         *      then {
         *          the IUT discards the DENM
         *          and the IUT does not forward the DENM content to upper layer
         *      }
         *  }
         * </pre>
         * 
         * @version 1.2.1
         * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/MSRV/BV-04, ETSI EN 302 637-3, clause 8.3.2
         */
        testcase TC_DEN_MSRV_BV_04() runs on ItsDenm system ItsDenmSystem {
            
            // Local variables
            var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
            var ActionID v_actionId, v_actionIdIut;
            var integer i;
            
            // Test control
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            v_actionId := f_utTriggerEvent(m_utTriggerEvent(v_situation, m_denmLocation_zeroDelta));
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionIdIut := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_actionId(
                            f_increaseSequenceNumber(v_actionId.sequenceNumber)
filatov's avatar
filatov committed
                        ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )
            );
            
            f_sleep(PX_TNOAC);
            for(i:=0; i < lengthof(vc_utEvents) and not match(v_actionId, vc_utEvents[i].denMsg.denm.management.actionID); i:=i+1) {
                // empty on purpose 
            }
            if(i < lengthof(vc_utEvents)) {
                log("*** " & testcasename() & ": FAIL: DENM was transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_error);
            }
            else {
                log("*** " & testcasename() & ": PASS: DENM was not transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_success);
            }
            
            // Postamble
            f_poCancelEvent(e_iut, v_actionIdIut);
            f_cfDown();
            
        } // end TC_DEN_MSRV_BV_04
        
        /**
         * @desc    Check that receiving ITS-S discards DENM if referenceTime is lower than highest value received for this ActionID
filatov's avatar
filatov committed
         * <pre>
         * PICS Selection: none
         * Initial conditions:
         *  with {
         *      the IUT being in the "initial state"
         *      and the IUT having received DENM
         *          containing management container
         *              containing actionID
         *                  indicating ACTION_ID1
         *              and containing referenceTime
         *                  indicating REFERENCETIME_1
         *  }
         * Expected behaviour:
         *  ensure that {
         *      when { 
         *          the IUT receives a DENM
         *              containing management container
         *                  containing actionID
         *                      indicating ACTION_ID1
         *                  and containing referenceTime
         *                      indicating REFERENCETIME_2 lower than REFERENCETIME_1
         *      }
         *      then {
         *          the IUT discards the DENM
         *          and the IUT does not forward the DENM content to upper layer
         *      }
         *  }
         * </pre>
         * 
         * @version 1.2.1
         * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/MSRV/BV-05, ETSI EN 302 637-3, clause 8.3.2
         */
        testcase TC_DEN_MSRV_BV_05() runs on ItsDenm system ItsDenmSystem {
            
            // Local variables
            var template (value) SituationContainer v_situation1 := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
            var template (value) SituationContainer v_situation2 := m_situation(c_causeVehicleBreakdown, c_vehicleBreakDownSubCauseCode_engineProblem);
            var TimestampIts v_referenceTime1 := f_getCurrentTime();
            var TimestampIts v_referenceTime2 := v_referenceTime1 - 1000;
            var ActionID v_actionId;
            var integer i;
            
            // Test control
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
                        -, -, -, v_referenceTime1
filatov's avatar
filatov committed
                    ),
                    v_situation1,
                    m_denmLocation_zeroDelta
                )
            );
            
            f_sleep(1.0);
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        v_actionId,
                        -, -, -, 
                        v_referenceTime2
                    ),
                    v_situation2,
                    m_denmLocation_zeroDelta
                )
            );
filatov's avatar
filatov committed
            
            f_sleep(PX_TNOAC);
            for(i:=0; i < lengthof(vc_utEvents) 
                      and not match(v_actionId, vc_utEvents[i].denMsg.denm.management.actionID)
                      and vc_utEvents[i].denMsg.denm.management.referenceTime != v_referenceTime2; i:=i+1) {
                // empty on purpose 
            }
            if(i < lengthof(vc_utEvents)) {
                log("*** " & testcasename() & ": FAIL: DENM was transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_error);
            }
            else {
                log("*** " & testcasename() & ": PASS: DENM was not transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_success);
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_MSRV_BV_05
        
        /**
         * @desc    Check that receiving ITS-S discards DENM if detectionTime is smaller than highest value received for this ActionID
         *          
filatov's avatar
filatov committed
         * <pre>
         * PICS Selection: none
         * Initial conditions:
         *  with {
         *      the IUT being in the "initial state"
         *      and the IUT having received DENM
         *          containing management container
         *              containing actionID
         *                  indicating ACTION_ID1
         *              and containing referenceTime
         *                  indicating REFERENCETIME_1
         *              and containing detectionTime
         *                  indicating TIME_1
         *  }
         * Expected behaviour:
         *  ensure that {
         *      when { 
         *          the IUT receives a DENM
         *              containing management container
         *                  containing actionID
         *                      indicating ACTION_ID1
         *                  and containing referenceTime
         *                      indicating REFERENCETIME_1
         *                  and containing detectionTime
         *                      indicating TIME_2 not more recent than TIME_1
         *      }
         *      then {
         *          the IUT discards the DENM
         *          and the IUT does not forward the DENM content to upper layer
         *      }
         *  }
         * </pre>
         * 
         * @version 1.2.1
         * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/MSRV/BV-06, ETSI EN 302 637-3, clause 8.3.2
         */
        testcase TC_DEN_MSRV_BV_06() runs on ItsDenm system ItsDenmSystem {
            
            // Local variables
            var template (value) SituationContainer v_situation1 := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
            var template (value) SituationContainer v_situation2 := m_situation(c_causeVehicleBreakdown, c_vehicleBreakDownSubCauseCode_engineProblem);
            var template (value) DecentralizedEnvironmentalNotificationMessage v_denm;
            var TimestampIts v_detectionTime1 := f_getCurrentTime();
            var TimestampIts v_detectionTime2 := v_detectionTime1 - 1000;
            var TimestampIts v_referenceTime1 := v_detectionTime1;
            var ActionID v_actionId;
            var integer i;
            
            // Test control
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_denm := m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
filatov's avatar
filatov committed
                        v_detectionTime1,
                        v_referenceTime1
                    ),
                    v_situation1,
                    m_denmLocation_zeroDelta
                );
            v_actionId := f_sendDenMessage(v_denm);
            
            f_sleep(1.0);
            v_detectionTime2 := valueof(v_denm.management.detectionTime) - 1000;
filatov's avatar
filatov committed
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        v_actionId,
                        -, - ,-, 
                        v_detectionTime2, 
                        v_referenceTime1
                    ),
                    v_situation2,
                    m_denmLocation_zeroDelta
                )
            );
            
filatov's avatar
filatov committed
            f_sleep(PX_TNOAC);
            for(i:=0; i < lengthof(vc_utEvents) 
                      and not match(v_actionId, vc_utEvents[i].denMsg.denm.management.actionID)
                      and vc_utEvents[i].denMsg.denm.management.detectionTime != v_detectionTime2; i:=i+1) {
                // empty on purpose 
            }
            if(i < lengthof(vc_utEvents)) {
                log("*** " & testcasename() & ": FAIL: DENM was transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_error);
            }
            else {
                log("*** " & testcasename() & ": PASS: DENM was not transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_success);
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_MSRV_BV_06
        
        /**
         * @desc    Check that receiving ITS-S transmits DENM to application if it concerns a known ActionID and referenceTime 
filatov's avatar
filatov committed
         *          is equal to highest received value and detectionTime is more recent
         * <pre>
         * PICS Selection: none
         * Initial conditions:
         *  with {
         *      the IUT being in the "initial state"
         *      and the IUT having received DENM
         *          containing management container
         *              containing actionID
         *                  indicating ACTION_ID1
         *              and containing referenceTime
         *                  indicating REFERENCETIME_1
         *              and containing detectionTime
         *                  indicating TIME_1
         *  }
         * Expected behaviour:
         *  ensure that {
         *      when { 
         *          the IUT receives a DENM
         *              containing management container
         *                  containing actionID
         *                      indicating ACTION_ID1
         *                  and containing referenceTime
         *                      indicating REFERENCETIME_1
         *                  and containing detectionTime
         *                      indicating TIME_2 more recent than TIME_1
         *      }
         *      then {
         *          the IUT transmits the DENM content to upper layer
         *      }
         *  }
         * </pre>
         * 
         * @version 1.2.1
         * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/MSRV/BV-07, ETSI EN 302 637-3, clause 8.3.2
         */
        testcase TC_DEN_MSRV_BV_07() runs on ItsDenm system ItsDenmSystem {
            
            // Local variables
            var template (value) SituationContainer v_situation1 := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
            var template (value) SituationContainer v_situation2 := m_situation(c_causeVehicleBreakdown, c_vehicleBreakDownSubCauseCode_engineProblem);
            var template (value) DecentralizedEnvironmentalNotificationMessage v_denm;
            var TimestampIts v_detectionTime2 := f_getCurrentTime();
            var TimestampIts v_detectionTime1 :=v_detectionTime2 - 1000;
            var TimestampIts v_referenceTime1 := v_detectionTime2;
            var ActionID v_actionId;
            var integer i;
            
            // Test control
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_denm := m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
filatov's avatar
filatov committed
                        v_detectionTime1,
                        v_referenceTime1
                    ),
                    v_situation1,
                    m_denmLocation_zeroDelta
                );            
            v_actionId := f_sendDenMessage(v_denm);
            
            f_sleep(1.0);
            v_detectionTime2 := valueof(v_denm.management.detectionTime) + 1000;
filatov's avatar
filatov committed
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        v_actionId,
filatov's avatar
filatov committed
                        v_detectionTime2,
                        v_referenceTime1
                    ),
                    v_situation2,
                    m_denmLocation_zeroDelta
                )
            );
            
            f_sleep(PX_TAC);
            for(i:=0; i < lengthof(vc_utEvents) 
                      and not match(v_actionId, vc_utEvents[i].denMsg.denm.management.actionID)
                      and vc_utEvents[i].denMsg.denm.management.detectionTime != v_detectionTime2; i:=i+1) {
                // empty on purpose 
            }
            if(i < lengthof(vc_utEvents)) {
                log("*** " & testcasename() & ": PASS: DENM was transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_success);
            }
            else {
                log("*** " & testcasename() & ": FAIL: DENM was not transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_error);
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_MSRV_BV_07
        
        /**
         * @desc    Check that receiving ITS-S replies to requestResponseIndication
         *          
         * <pre>
         * PICS Selection: none
         * Initial conditions:
         *  with {
         *      the IUT being in the "initial state"
         *  }
         * Expected behaviour:
         *  ensure that {
         *      when { 
         *          the IUT receives a DENM
         *              containing management container
         *                  containing actionID
         *                      indicating ACTION_ID1
         *              and containing alacarte container
         *                  containing ImpactReductionContainer
         *                  	containing requestResponseIndication
         *                      	indicating request(0)
         *      }
         *      then {
         *          the IUT sends a DENM
         *              containing management container
         *                  containing actionID
         *                      indicating ACTION_ID2
         *              and containing alacarte container
         *                  containing ImpactReductionContainer
         *                  	containing requestResponseIndication
         *                      	indicating response(1)
         *      }
         *  }
         * </pre>
         * 
         * @version 1.2.1
         * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/MSRV/BV-10, ETSI EN 302 637-3, clause B.40
         */
        testcase TC_DEN_MSRV_BV_10() runs on ItsDenm system ItsDenmSystem {

            //Local constants

            // Local variables
            var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
            var ActionID v_actionId;
            
            // Test component configuration
            f_cfUp();
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage (
                m_denm ( m_denmMgmtCon ( m_tsActionId), v_situation, m_denmLocation_zeroDelta, m_alacarteConImpactReduction ) );
            
            tc_ac.start;
            alt {
                [] denmPort.receive ( mw_denmInd ( mw_denmPdu ( mw_denm ( mw_denmMgmtCon ( mw_actionId ( f_getTsStationId() ) ), v_situation, mw_anyDenmLocation, 
                																						 mw_alacarteConImpactReduction ) ) ) ) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": PASS: DENM with correct alacarte container ***");
                    f_clientSyncAndVerdict(c_tbDone, e_success);
                }
                [] denmPort.receive ( mw_denmInd ( mw_denmPdu ( mw_denm ( mw_denmMgmtCon ( mw_actionId ( f_getTsStationId() ) ) ) ) ) ) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": FAIL: DENM with incorrect containers ***");
                    f_clientSyncAndVerdict(c_tbDone, e_error);
                }
                [] tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: DENM not rreceived ***");
                    f_clientSyncAndVerdict(c_tbDone, e_timeout);
                }
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();

        } // end TC_DEN_MSRV_BV_10
        
filatov's avatar
filatov committed
    } // end denMessageReception
    
    // 5.2.3
    group denKeepAliveForwarding {

        /**
         * @desc    Check that forwarding ITS-S forwards DENM if no DENM with same ActionId has been received during forwarding delay
filatov's avatar
filatov committed
         * <pre>
         * PICS Selection: PICS_KAF 
         * Initial conditions:
         *  with {
         *      the IUT being in the "initial state"
         *          and the IUT having received a DENM
         *              containing actionID
         *                  indicating ACTION_ID1
         *              and containing transmissionInterval
         *                  indicating TRANS_INTERVAL1
         *              and containing validityDuration
         *                  indicating value more than 3 times greater than TRANS_INTERVAL1
         *          and the IUT having starting timer T_Forwarding for this DENM
         *          and the IUT not having received further DENM 
         *              containing actionID
         *                  indicating ACTION_ID1
         *  }
         * Expected behaviour:
         *  ensure that {
         *      when { 
         *          the timer T_Forwarding expires
         *      }
         *      then {
         *          the IUT reconstructs and sends the DENM associated to ACTION_ID1
         *      }
         *  }
         * </pre>
         * 
         * @version 1.2.1
         * @see     ETSI TS 102 869-2 v1.2.1 TP/DEN/KAFW/BV-01, ETSI EN 302 637-3, clause 8.2.2
         */
        testcase TC_DEN_KAFW_BV_01() runs on ItsDenm system ItsDenmSystem {
            
            //Local constants
            const TransmissionInterval c_transmissionInterval := c_interval_10sec;
filatov's avatar
filatov committed
            // Local variables
            var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
            var ActionID v_actionId;
            // Local timers
            timer t_forwarding := 2.0 * int2float(c_transmissionInterval) / 1000.0;
            
            // Test control
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 3,
                        c_transmissionInterval
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )
            );
            
            t_forwarding.start;
            alt {
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon(v_actionId)
                            )
                        )
                    ) 
                ) {
                    if(t_forwarding.running) {
                        t_forwarding.stop;
                        log("*** " & testcasename() & ": FAIL: IUT re-forwarded the packet too early ***");
                        f_clientSyncAndVerdict(c_tbDone, e_error);
                    }
                    else {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: DENM re-forwarded ***");
                        f_clientSyncAndVerdict(c_tbDone, e_success);
                    }
                }
                [] t_forwarding.timeout {
                    tc_ac.start;
                    log("*** " & testcasename() & ": INFO: Ready for receiving re-forwarded DENM ***");
                    repeat;
                }
                [] tc_ac.timeout {
                    log("*** " & testcasename() & ": FAIL: DENM was not forwarded ***");
                    f_clientSyncAndVerdict(c_tbDone, e_error);
                }
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_KAFW_BV_01
        
        /**
         * @desc    Check that forwarding ITS-S forwards DENM if no DENM with same ActionId and referenceTime greater 
filatov's avatar
filatov committed
         *          or equal to the last received DENM has been received during forwarding delay
         * <pre>
         * PICS Selection: PICS_KAF