Commit 459b9b62 authored by garciay's avatar garciay
Browse files

Implement termination test cases

parent 300fed64
Loading
Loading
Loading
Loading
+151 −0
Original line number Diff line number Diff line
@@ -418,8 +418,159 @@ module ItsIvim_TestCases {
        
        group iviEventTermination {
            
            /**
             * @desc Check that the IUT terminates IVM genration on validity duration expery
             * <pre>
             * Pics Selection: PICS_IVIM_UPDATE
             * Initial conditions: 
             *   with {
             *        the IUT being in the "initial state"
             *        and the IUT having generated several IVIM
             *            containing ivi
             *                containing mandatory
             *                    containing iviIdentificationNumber 
             *                        indicating IVIM_ID_1
             *                and containing validTo
             *                    indicating CLT + 10 seconds
             *                and containing iviStatus
             *                    indicating 'new'
             *    }
             * Expected behaviour:
             *    ensure that {
             *        when { 
             *            the IUT is alerted of expiration of the time associated with validTo
             *        }
             *        then {
             *            the IUT stops ending IVIM associated with IVIM_ID_1
             *        }
             *    }
             * </pre>
             * 
             * @version   1.0.4
             * @see       ETSI TS 103 191-2 v0.0.1 TP_IS_IVIM_EVTR_BV_01
             * @reference ETSI TS 103 301 V1.0.4 Clause 7.4.2
             */
            testcase TC_IS_IVIM_EVTR_BV_01 () runs on ItsIvim system ItsIvimSystem {
                
                f_IS_IVIM_EVTR_BV_01();
                
            } // End of testcase TC_IS_IVIM_EVTR_BV_01
            
            /**
             * @desc Check that the IUT terminates IVM genration on termination request
             * <pre>
             * Pics Selection: PICS_IVIM_UPDATE
             * Initial conditions: 
             *   with {
             *        the IUT being in the "initial state"
             *        and the IUT having generated several IVIM
             *            containing ivi
             *                containing mandatory
             *                    containing iviIdentificationNumber 
             *                        indicating IVIM_ID_1
             *                and not containing validTo
             *                and containing iviStatus
             *                    indicating 'new'
             *    }
             * Expected behaviour:
             *    ensure that {
             *        when { 
             *            the IUT receives an AppIVIM_termination request associated with IVIM_ID_1
             *        }
             *        then {
             *            the IUT stops ending IVIM associated with IVIM_ID_1
             *        }
             *    }
             * </pre>
             * 
             * @version   1.0.4
             * @see       ETSI TS 103 191-2 v0.0.1 TP_IS_IVIM_EVTR_BV_02
             * @reference ETSI TS 103 301 V1.0.4 Clause 7.4.2
             */
            testcase TC_IS_IVIM_EVTR_BV_02 () runs on ItsIvim system ItsIvimSystem {
                
                f_IS_IVIM_EVTR_BV_02();
                
            } // End of testcase TC_IS_IVIM_EVTR_BV_02
            
        } // End of group iviEventTermination
        
        group iviMessageRepetition {
            
            /**
             * @desc Check that the IUT activates repetition on reception of a valid AppIVIM_Update request
             * <pre>
             * Pics Selection: PICS_IVIM_UPDATE
             * Initial conditions: 
             *   with {
             *        the IUT being in the "initial state"
             *        and the IUT having generated several IVIM
             *            containing ivi
             *                containing mandatory
             *                    containing iviIdentificationNumber 
             *                        indicating IVIM_ID_1
             *    }
             * Expected behaviour:
             *    ensure that {
             *        when { 
             *            the IUT receives an AppIVIM_Update indicating 'repetition interval' RI_1
             *        }
             *        then {
             *            the IUT sends IVIM with respect to the 'repetition interval' RI_1
             *                containing ivi
             *                    containing mandatory
             *                        containing iviIdentificationNumber 
             *                            indicating IVIM_ID_1
             *        }
             *    }
             * </pre>
             * 
             * @version   1.0.4
             * @see       ETSI TS 103 191-2 v0.0.1 TP_IS_IVIM_EVRP_BV_01
             * @reference ETSI TS 103 301 V1.0.4 Clause 7.4.2
             */
            testcase TC_IS_IVIM_EVRP_BV_01 () runs on ItsIvim system ItsIvimSystem {
                
                f_IS_IVIM_EVRP_BV_01();
                
            } // End of testcase TC_IS_IVIM_EVRP_BV_01
            
            /**
             * @desc Check that the IUT activates repetition on reception of a valid AppIVIM_Update request
             * <pre>
             * Pics Selection: PICS_IVIM_UPDATE
             * Initial conditions: 
             *   with {
             *        the IUT being in the "initial state"
             *        and the IUT having generated several IVIM
             *            containing ivi
             *                containing mandatory
             *                    containing iviIdentificationNumber 
             *                        indicating IVIM_ID_1
             *    }
             * Expected behaviour:
             *    ensure that {
             *        when { 
             *            the IUT receives an AppIVIM_Update indicating 'repetition interval' 0
             *        }
             *        then {
             *            the IUT stops sending IVIM associated with IVIM_ID_1
             *        }
             *    }
             * </pre>
             * 
             * @version   1.0.4
             * @see       ETSI TS 103 191-2 v0.0.1 TP_IS_IVIM_EVRP_BV_02
             * @reference ETSI TS 103 301 V1.0.4 Clause 7.4.2
             */
            testcase TC_IS_IVIM_EVRP_BV_02 () runs on ItsIvim system ItsIvimSystem {
                
                f_IS_IVIM_EVRP_BV_02();
                
            } // End of testcase TC_IS_IVIM_EVRP_BV_02
            
        } // End of group iviMessageRepetition
        
        group iviGenerationFrequency {
            
            /**
+303 −3
Original line number Diff line number Diff line
@@ -117,8 +117,10 @@ module ItsIvim_TpFunctions {
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer
                    )))) {
                                    mw_iviManagementContainer(
                                        -, 
                                        v_iviIdentificationNumber
                    ))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Successfully received IVIM. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
@@ -253,7 +255,8 @@ module ItsIvim_TpFunctions {
                                mw_ivimStructure(
                                    mw_iviManagementContainer(
                                        -, 
                                        v_iviIdentificationNumber + 1
                                        v_iviIdentificationNumber + 1,
                                        IviStatus_new_
                    ))))) -> value v_ivimInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Successfully received expected IVIM. ***");
@@ -825,8 +828,305 @@ module ItsIvim_TpFunctions {
            
        } // End of group iviEventUpdate
        
        group iviMessageRepetition {
            
            function f_IS_IVIM_EVRP_BV_01() runs on ItsIvim {
                
                // Local variables
                const integer c_maxLoopValue := 10;
                const TimestampIts c_repetitionInterval := c_duration_4sec;
                var integer v_counter := 0;
                var boolean v_ivimReceived := false;
                timer t_minTransInterval := int2float(c_repetitionInterval) * 0.90;
                timer t_maxTransInterval := int2float(c_repetitionInterval) * 1.10;
                var IviIdentificationNumber v_iviIdentificationNumber;
                var IvimInd v_rcvdMsg;
                
                // Test control
                if (not PICS_IVIM_UPDATE) {
                    log("*** " & testcasename() & ": PICS_IVIM_UPDATE required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState();
                v_iviIdentificationNumber := f_utTriggerEvent(m_utTriggerEvent(c_repetition_interval_deactivated));
                f_awaitIviMessage(
                    mw_ivimInd(
                        mw_anyIvimPdu(
                            mw_itsPduHeader,
                            mw_ivimStructure(
                                mw_iviManagementContainer(
                                    -, 
                                    v_iviIdentificationNumber, 
                                    IviStatus_new_
                    )))),
                    v_rcvdMsg
                );
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                f_utUpdateEvent(m_utUpdateEvent(v_iviIdentificationNumber, c_duration_4sec));
                
                tc_ac.start;
                ivimPort.clear;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer(
                                        -, 
                                        v_iviIdentificationNumber, 
                                        IviStatus_update_
                    ))))) {
                        tc_ac.stop;
                        v_ivimReceived := true;
                        tc_ac.start;
                    }
                    [] t_minTransInterval.timeout {
                        if (v_ivimReceived == true) {
                            log("*** " & testcasename() & ": FAIL: IVIM received BEFORE expiry of the minimum generation timer interval. ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        } else {
                            repeat;
                        }
                    }
                    [] t_maxTransInterval.timeout {
                        if (v_ivimReceived == false) {
                            log("*** " & testcasename() & ": FAIL: IVIM received AFTER expiry of the maximum generation timer interval. ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        } else {
                            v_counter := v_counter + 1;
                            if (v_counter < c_maxLoopValue) {
                                v_ivimReceived := false;
                                t_minTransInterval.start;
                                t_maxTransInterval.start;
                                repeat;
                            } else {
                                log("*** " & testcasename() & ": PASS: Generation of IVIMs was successful ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                        }
                    }
                    [] 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_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVIM_EVRP_BV_01
            
            function f_IS_IVIM_EVRP_BV_02() runs on ItsIvim {
                
                // Local variables
                var IviIdentificationNumber v_iviIdentificationNumber;
                var IvimInd v_rcvdMsg;
                
                // Test control
                if (not PICS_IVIM_UPDATE) {
                    log("*** " & testcasename() & ": PICS_IVIM_UPDATE required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState();
                v_iviIdentificationNumber := f_utTriggerEvent(m_utTriggerEvent());
                f_awaitIviMessage(
                    mw_ivimInd(
                        mw_anyIvimPdu(
                            mw_itsPduHeader,
                            mw_ivimStructure(
                                mw_iviManagementContainer(
                                    -, 
                                    v_iviIdentificationNumber, 
                                    IviStatus_new_
                    )))),
                    v_rcvdMsg
                );
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                f_utUpdateEvent(m_utUpdateEvent(v_iviIdentificationNumber, c_repetition_interval_deactivated));
                
                ivimPort.clear;
                tc_noac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer(
                                        -, 
                                        v_iviIdentificationNumber, 
                                        IviStatus_update_
                    ))))) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: No more IVIM shall be sent. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No more IVIM was sent. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                }
                
                // Postamble
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVIM_EVRP_BV_02
            
        } // End of group iviMessageRepetition
        
        group iviEventTermination {
            
            function f_IS_IVIM_EVTR_BV_01() runs on ItsIvim {
                
                // Local variables
                var IviIdentificationNumber v_iviIdentificationNumber;
                var IvimInd v_rcvdMsg;
                
                // Test control
                if (not PICS_IVIM_GENERATION) {
                    log("*** " & testcasename() & ": PICS_IVIM_GENERATION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState();
                v_iviIdentificationNumber := f_utTriggerEvent(m_utTriggerEvent(c_repetition_interval_deactivated, -, f_getCurrentTime() + 1000 * c_duration_4sec));
                f_awaitIviMessage(
                    mw_ivimInd(
                        mw_anyIvimPdu(
                            mw_itsPduHeader,
                            mw_ivimStructure(
                                mw_iviManagementContainer(
                                    -, 
                                    v_iviIdentificationNumber, 
                                    IviStatus_new_
                    )))),
                    v_rcvdMsg
                );
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                f_sleep(int2float(f_getCurrentTime() + 1000 * c_duration_4sec));
                
                tc_noac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer(
                                        -, 
                                        v_iviIdentificationNumber,
                                        IviStatus_new_
                    ))))) {
                        log("*** " & testcasename() & ": INFO: No more IVIM shall be set. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No more IVIM was sent. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                }
                
                // Postamble
                f_cfDown();
                
            } // End of function f_IS_IVIM_EVTR_BV_01
            
            function f_IS_IVIM_EVTR_BV_02() runs on ItsIvim {
                
                // Local variables
                var IviIdentificationNumber v_iviIdentificationNumber;
                var IvimInd v_rcvdMsg;
                
                // Test control
                if (not PICS_IVIM_GENERATION) {
                    log("*** " & testcasename() & ": PICS_IVIM_GENERATION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState();
                v_iviIdentificationNumber := f_utTriggerEvent(m_utTriggerEvent());
                f_awaitIviMessage(
                    mw_ivimInd(
                        mw_anyIvimPdu(
                            mw_itsPduHeader,
                            mw_ivimStructure(
                                mw_iviManagementContainer(
                                    -, 
                                    v_iviIdentificationNumber, 
                                    IviStatus_new_
                    )))),
                    v_rcvdMsg
                );
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                f_utTerminateEvent(m_utEventCancellation(v_iviIdentificationNumber));
                
                tc_ac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer(
                                        -, 
                                        v_iviIdentificationNumber,
                                        IviStatus_new_
                    ))))) {
                        log("*** " & testcasename() & ": INFO: No more IVIM shall be set. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No more IVIM was sent. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                }
                
                // Postamble
                f_cfDown();
                
            } // End of function f_IS_IVIM_EVTR_BV_02
            
        } // End of group iviEventTermination
        
        group iviGenerationFrequency {