ItsDenm_TpFunctions.ttcn 180 KB
Newer Older
                vc_utEvents := {};
                
                // instruct adapter to use p_certName to sign message
                if(e_success != f_acTriggerSecEvent(m_acEnableSecurity(p_certName))) { 
                    log("*** INFO: TEST CASE NOW STOPPING ITSELF! ***");
                    stop;
                }
                
                f_sleep(1.0);
                
                v_referenceTime2 := f_getCurrentTime();
                v_actionId := f_sendDenMessage(
                    m_denm(
                        m_denmMgmtCon(
                            v_actionId,
                            -, -, -, v_referenceTime2
                        ),
                        p_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() & ": FAIL: DENM was treated as valid and was transmitted to upper layer***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": FAIL: DENM was treated as invalid and was not transmitted to upper layer***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                
                // Postamble
                f_poCancelEvent(e_ets, v_actionId);
                f_cfDown();
                
            } // end TC_DEN_MSRV_BV_09_XX

            function f_DEN_MSRV_BO_09_01 () runs on ItsDenm {
                
                f_DEN_MSRV_BO_09_XX(
                    "CERT_TS_DENM_BO_01_AT",
garciay's avatar
garciay committed
                    m_situation(LibItsCommon_ASN1_NamedNumbers.CauseCodeType_trafficCondition_, LibItsCommon_ASN1_NamedNumbers.TrafficConditionSubCauseCode_unavailable_),
                    m_situation(LibItsCommon_ASN1_NamedNumbers.CauseCodeType_trafficCondition_, LibItsCommon_ASN1_NamedNumbers.TrafficConditionSubCauseCode_trafficJamIncreasing_)

            function f_DEN_MSRV_BO_09_02 () runs on ItsDenm {
                    "CERT_TS_DENM_BO_02_AT",
garciay's avatar
garciay committed
                    m_situation(LibItsCommon_ASN1_NamedNumbers.CauseCodeType_accident_, LibItsCommon_ASN1_NamedNumbers.AccidentSubCauseCode_unavailable_),
                    m_situation(LibItsCommon_ASN1_NamedNumbers.CauseCodeType_accident_, LibItsCommon_ASN1_NamedNumbers.AccidentSubCauseCode_multiVehicleAccident_)
        /**
         * @desc    TP Function for TC_DEN_MSRV_BV_10
         */
        function f_DEN_MSRV_BV_10() runs on ItsDenm {

            //Local constants

            // Local variables
garciay's avatar
garciay committed
            var template (value) SituationContainer v_situation := m_situation(LibItsCommon_ASN1_NamedNumbers.CauseCodeType_vehicleBreakdown_, LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_);
            var ActionID v_actionId;

            // Test control
                log("*** " & testcasename() & ": PICS_DENM_RECEPTION required for executing the TC ***");
                setverdict(inconc);
                stop;
            
            // 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_selfOrClientSyncAndVerdict(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_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                [] tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: DENM not rreceived ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();

        } // end TC_DEN_MSRV_BV_10
        
    } // end denMessageReception
    
    // 5.2.3
    group denKeepAliveForwarding {

        /**
         * @desc    TP Function for TC_DEN_KAFW_BV_01
         */
        function f_DEN_KAFW_BV_01() runs on ItsDenm {
            
            //Local constants
            const TransmissionInterval c_transmissionInterval := c_interval_10sec;
            // Local variables
garciay's avatar
garciay committed
            var template (value) SituationContainer v_situation := m_situation(LibItsCommon_ASN1_NamedNumbers.CauseCodeType_vehicleBreakdown_, LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_);
            var ActionID v_actionId;
            // Local timers
            timer t_forwarding := 2.0 * int2float(c_transmissionInterval) / 1000.0;
            
            // Test control
                log("*** " & testcasename() & ": PICS_DENM_KAF required for executing the TC ***");
                setverdict(inconc);
                stop;
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 4 / 1000,
                        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_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    else {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: DENM re-forwarded ***");
                        f_selfOrClientSyncAndVerdict(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_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_KAFW_BV_01
        
        /**
         * @desc    TP Function for TC_DEN_KAFW_BV_02
         */
        function f_DEN_KAFW_BV_02() runs on ItsDenm {
            
            //Local constants
            const TransmissionInterval c_transmissionInterval := c_interval_10sec;
            // Local variables
garciay's avatar
garciay committed
            var template (value) SituationContainer v_situation := m_situation(LibItsCommon_ASN1_NamedNumbers.CauseCodeType_vehicleBreakdown_, LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_);
            var TimestampIts v_referenceTime1 := f_getCurrentTime();
            var TimestampIts v_referenceTime2 := v_referenceTime1 - 1000;
            var ActionID v_actionId;
            // Local timers
            timer t_forwarding := 2.0 * int2float(c_transmissionInterval) /1000.0;
            
            // Test control
                log("*** " & testcasename() & ": PICS_DENM_KAF required for executing the TC ***");
                setverdict(inconc);
                stop;
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 4 / 1000,
                        c_transmissionInterval,
                        v_referenceTime1
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )
            );
    
            // start KAF timer here, as 2nd DENM shall be ignored
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 4 / 1000,
                        c_transmissionInterval,
                        v_referenceTime2
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )
            );
            
            alt {
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon(v_actionId, -, v_referenceTime1)
                            )
                        )
                    ) 
                ) {
                    if(t_forwarding.running) {
                        t_forwarding.stop;
                        log("*** TC_DEN_KAFW_BV_02: INFO: IUT re-forwarded the packet too early ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    else {
                        tc_ac.stop;
                        log("*** TC_DEN_KAFW_BV_02: PASS: DENM re-forwarded ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }  
                }
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon(v_actionId)
                            )
                        )
                    ) 
                ) {
                    tc_ac.stop;
                    t_forwarding.stop;
                    log("*** " & testcasename() & ": FAIL: IUT re-forwarded wrong version of DENM ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                [] 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_selfOrClientSyncAndVerdict(c_tbDone, e_error);  
                }
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_KAFW_BV_02
                
        /**
         * @desc    TP Function for TC_DEN_KAFW_TI_03
         */
        function f_DEN_KAFW_TI_03() runs on ItsDenm {
            
            //Local constants
            const TransmissionInterval c_transmissionInterval := c_interval_10sec;
            // Local variables
garciay's avatar
garciay committed
            var template (value) SituationContainer v_situation := m_situation(LibItsCommon_ASN1_NamedNumbers.CauseCodeType_vehicleBreakdown_, LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_);
            var ActionID v_actionId;
            // Local timers
            timer t_forwardingMin := 2.0 * int2float(c_transmissionInterval) / 1000.0;
            timer t_forwardingMax := 2.0 * int2float(c_transmissionInterval) / 1000.0 + 0.15 /* from the spec */ + 0.1 /* processing time */;
                log("*** " & testcasename() & ": PICS_DENM_KAF required for executing the TC ***");
                setverdict(inconc);
                stop;
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 4 / 1000,
                        c_transmissionInterval
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )
            );
            
            t_forwardingMin.start;
            t_forwardingMax.start;
            alt {
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon(v_actionId)
                            )
                        )
                    ) 
                ) { 
                    t_forwardingMax.stop;
                    if(t_forwardingMin.running) {
                        t_forwardingMin.stop;
                        log("*** " & testcasename() & ": FAIL: IUT re-forwarded the packet too early ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    else {
                        log("*** " & testcasename() & ": PASS: DENM re-forwarded correctly ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }  
                }
                [] t_forwardingMin.timeout {
                    log("*** " & testcasename() & ": INFO: Ready for receiving re-forwarded DENM ***");
                    repeat;   
                }
                [] t_forwardingMax.timeout {
                    log("*** " & testcasename() & ": FAIL: DENM was not forwarded on time ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);  
                }
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_KAFW_TI_03

        /**
         * @desc    TP Function for TC_DEN_KAFW_BV_04
         */
        function f_DEN_KAFW_BV_04() runs on ItsDenm {
            
            //Local constants
            const TransmissionInterval c_transmissionInterval := c_interval_10sec;
            // Local variables
garciay's avatar
garciay committed
            var template (value) SituationContainer v_situation := m_situation(LibItsCommon_ASN1_NamedNumbers.CauseCodeType_vehicleBreakdown_, LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_);
            var ActionID v_actionId;
            
            // Test control
                log("*** " & testcasename() & ": PICS_DENM_KAF required for executing the TC ***");
                setverdict(inconc);
                stop;
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 4 / 1000,
                        c_transmissionInterval
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )
            );
            
            tc_ac.start((int2float(c_interval_10sec) * 2.0 / 1000.0) + 0.5);
            alt {
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon(v_actionId)
                            ),
                            f_getIutStationId()
                        )
                    ) 
                ) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": PASS: DENM re-forwarded with correct stationID ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon(v_actionId)
                            ),
                            mw_anyStationId
                        )
                    ) 
                ) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": FAIL: DENM re-forwarded with incorrect stationID ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                [] tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: DENM was not forwarded ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_KAFW_BV_04

        /**
         * @desc    TP Function for TC_DEN_KAFW_BV_05
         */
        function f_DEN_KAFW_BV_05() runs on ItsDenm {
            
            //Local constants
            const TransmissionInterval c_transmissionInterval := c_interval_10sec;
            // Local variables
garciay's avatar
garciay committed
            var template (value) SituationContainer v_situation := m_situation(LibItsCommon_ASN1_NamedNumbers.CauseCodeType_vehicleBreakdown_, LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_);
            var ActionID v_actionId;
            
            // Test control
                log("*** " & testcasename() & ": PICS_DENM_KAF required for executing the TC ***");
                setverdict(inconc);
                stop;
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 4 / 1000,
                        c_transmissionInterval
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )
            );
            
            tc_ac.start((int2float(c_interval_10sec) * 2.0 / 1000.0) + 0.5);
            alt {
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon(v_actionId)
                            )
                        )
                    ) 
                ) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": PASS: DENM re-forwarded with correct actionID ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon(mw_anyActionId)
                            )
                        )
                    ) 
                ) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": FAIL: DENM re-forwarded with incorrect actionID ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                [] tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: DENM was not forwarded ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_KAFW_BV_05
        
        /**
         * @desc    TP Function for TC_DEN_KAFW_BV_06
         */
        function f_DEN_KAFW_BV_06() runs on ItsDenm {
            
            //Local constants
            const TransmissionInterval c_transmissionInterval := c_interval_10sec;
            // Local variables
garciay's avatar
garciay committed
            var template (value) SituationContainer v_situation := m_situation(LibItsCommon_ASN1_NamedNumbers.CauseCodeType_vehicleBreakdown_, LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_);
            var TimestampIts v_referenceTime1 := f_getCurrentTime();
            var ActionID v_actionId;
            
            // Test control
                log("*** " & testcasename() & ": PICS_DENM_KAF required for executing the TC ***");
                setverdict(inconc);
                stop;
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 4 / 1000,
                        c_transmissionInterval,
                        v_referenceTime1
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )
            );
            
            tc_ac.start((int2float(c_interval_10sec) * 2.0 / 1000.0) + 0.5);
            alt {
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon(v_actionId, -, v_referenceTime1)
                            )
                        )
                    ) 
                ) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": PASS: DENM re-forwarded with correct referenceTime ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon(v_actionId)
                            )
                        )
                    ) 
                ) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": FAIL: DENM re-forwarded with incorrect referenceTime ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                [] tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: DENM was not forwarded ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_KAFW_BV_06

        /**
         * @desc    TP Function for TC_DEN_KAFW_BV_07
         */
        function f_DEN_KAFW_BV_07() runs on ItsDenm {
            
            //Local constants
            const TransmissionInterval c_transmissionInterval := c_interval_10sec;
            // Local variables
garciay's avatar
garciay committed
            var template (value) SituationContainer v_situation := m_situation(LibItsCommon_ASN1_NamedNumbers.CauseCodeType_vehicleBreakdown_, LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_);
            var ActionID v_actionId;
            
            // Test control
                log("*** " & testcasename() & ": PICS_DENM_KAF required for executing the TC ***");
                setverdict(inconc);
                stop;
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 4 / 1000,
                        c_transmissionInterval
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )
            );
            
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtConTermination(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 4 / 1000,
                        c_transmissionInterval,
                        -,
                        -,
                        isNegation
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )
            );
            
            tc_ac.start((int2float(c_interval_10sec) * 2.0 / 1000.0) + 0.5);
            alt {
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon ( v_actionId, - )
                            )
                        )
                    ) 
                ) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": PASS: DENM re-forwarded with correct isNegation ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon ( v_actionId, - )
                            )
                        )
                    ) 
                ) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": FAIL: DENM re-forwarded with incorrect isNegation ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                [] tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: DENM was not forwarded ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_KAFW_BV_07

        /**
         * @desc    TP Function for TC_DEN_KAFW_BV_08
         */
        function f_DEN_KAFW_BV_08() runs on ItsDenm {
            
            //Local constants
            const TransmissionInterval c_transmissionInterval := c_interval_10sec;
            // Local variables
garciay's avatar
garciay committed
            var template (value) SituationContainer v_situation := m_situation(LibItsCommon_ASN1_NamedNumbers.CauseCodeType_vehicleBreakdown_, LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_);
            var ActionID v_actionId;
            
            // Test control
                log("*** " & testcasename() & ": PICS_DENM_KAF required for executing the TC ***");
                setverdict(inconc);
                stop;
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 3 / 1000,
                        c_transmissionInterval
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta,
                    m_alacarteConLaneCount
                )
            );
            
            tc_ac.start((int2float(c_interval_10sec) * 2.0 / 1000.0) + 0.5);
            alt {
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon(v_actionId),
                                v_situation,
                                m_denmLocation_zeroDelta,
                                m_alacarteConLaneCount
                            )
                        )
                    ) 
                ) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": PASS: DENM re-forwarded with correct containers ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon(v_actionId)
                            )
                        )
                    ) 
                ) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": FAIL: DENM re-forwarded with incorrect containers ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                [] tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: DENM was not forwarded ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_KAFW_BV_08

        /**
         * @desc    TP Function for TC_DEN_KAFW_BV_09
         */
        function f_DEN_KAFW_BV_09() runs on ItsDenm {
            
            //Local constants
            const TransmissionInterval c_transmissionInterval := c_interval_10sec;
            // Local variables
garciay's avatar
garciay committed
            var template (value) SituationContainer v_situation := m_situation(LibItsCommon_ASN1_NamedNumbers.CauseCodeType_vehicleBreakdown_, LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_);
            var ActionID v_actionId;
            // Local timers
            timer t_validity := int2float(c_transmissionInterval * 3) / 1000.0;
            
            // Test control
                log("*** " & testcasename() & ": PICS_DENM_KAF required for executing the TC ***");
                setverdict(inconc);
                stop;
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 3 / 1000,
                        c_transmissionInterval
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )
            );
            
            t_validity.start;
            tc_ac.start((int2float(c_interval_10sec) * 2.0 / 1000.0) + 0.5);
            alt {
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon(v_actionId)
                            )
                        )
                    ) 
                ) {
                    tc_ac.stop;
                    if(t_validity.running) {
                        log("*** " & testcasename() & ": INFO: DENM re-forwarded during validity period ***");
                        tc_ac.start((int2float(c_interval_10sec) * 2.0 / 1000.0) + 0.5);
                        repeat;
                    }
                    else {
                        log("*** " & testcasename() & ": FAIL: DENM re-forwarded after validity expiration ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                }
                [] tc_ac.timeout {
                    if(t_validity.running) {
                        log("*** " & testcasename() & ": INCONC: DENM was not forwarded ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    else {
                        log("*** " & testcasename() & ": PASS: DENM not reforwarded after validity expiration ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                }
                
                [] t_validity.timeout {
                    log("*** " & testcasename() & ": INFO: End of validity period ***");
                    repeat;
                }
            }
            
            // Postamble
            f_poCancelEvent(e_ets, v_actionId);
            f_cfDown();
            
        } // end TC_DEN_KAFW_BV_09
                                  
        /**
         * @desc    TP Function for TC_DEN_KAFW_BV_10
         */
        function f_DEN_KAFW_BV_10() runs on ItsDenm {
            
            //Local constants
            const TransmissionInterval c_transmissionInterval := c_interval_10sec;
            // Local variables
garciay's avatar
garciay committed
            var template (value) SituationContainer v_situation := m_situation(LibItsCommon_ASN1_NamedNumbers.CauseCodeType_vehicleBreakdown_, LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_);
            var ActionID v_actionId;
            var boolean v_positionChanged := false;
            
            // Test control
                log("*** " & testcasename() & ": PICS_DENM_KAF required for executing the TC ***");
                setverdict(inconc);
                stop;
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_actionId := f_sendDenMessage(
                m_denm(
                    m_denmMgmtCon(
                        m_tsActionId,
                        -,
                        c_transmissionInterval * 5 / 1000,
                        c_transmissionInterval
                    ),
                    v_situation,
                    m_denmLocation_zeroDelta
                )
            );
            
            tc_ac.start((int2float(c_interval_10sec) * 2.0 / 1000.0) + 0.5);
            alt {
                [] denmPort.receive(
                    mw_denmInd(
                        mw_denmPdu(
                            mw_denm(
                                mw_denmMgmtCon(v_actionId)
                            )
                        )
                    ) 
                ) {
                    tc_ac.stop;
                    if(v_positionChanged == false) {
                        log("*** " & testcasename() & ": INFO: DENM re-forwarded. Changing position ***");
garciay's avatar
garciay committed
                        f_utChangePosition(m_utDenmChangePosition(1000, 0));
                        v_positionChanged := true;
                        tc_ac.start;
                        repeat;
                    }
                    else {
                        log("*** " & testcasename() & ": FAIL: DENM was re-forwarded ***");
garciay's avatar
garciay committed
                        f_utChangePosition(m_utDenmChangePosition(-1000, 0));
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                }
                [] tc_ac.timeout {
                    if(v_positionChanged == false) {
                        log("*** " & testcasename() & ": INCONC: DENM was not forwarded ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);