ItsIvim_TpFunctions.ttcn 82.1 KB
Newer Older
 *    @author   ETSI STF517 / STF525 / TTF002
Yann Garcia's avatar
Yann Garcia committed
 *    @version  $Url: https://oldforge.etsi.org/svn/ITS/tags/20170222_STF527_Final/ttcn/AtsIVIM/ItsIvim_TpFunctions.ttcn $
 *              $Id: ItsIvim_TpFunctions.ttcn,v 1.7 2019/01/07 08:56:01 dte Exp $
garciay's avatar
garciay committed
 *    @copyright   ETSI Copyright Notification
 *                 No part may be reproduced except as authorized by written permission.
 *                 The copyright and the foregoing restriction extend to reproduction in all media.
 *                 All rights reserved.
 *
 */

module ItsIvim_TpFunctions {
    
    // LibCommon
    import from LibCommon_Sync all;
    import from LibCommon_VerdictControl all;
    import from LibCommon_Time all;
    import from LibCommon_BasicTypesAndValues all;
    
    // LibItsCommon
    import from LibItsCommon_Pixits all;
    import from LibItsCommon_Functions all;
    import from LibItsCommon_TypesAndValues all;
    import from LibItsCommon_ASN1_NamedNumbers all;
    
    // LibIts
    import from ITS_Container language "ASN.1:1997" all;
    import from IVIM_PDU_Descriptions language "ASN.1:1997" all;
    import from IVI language "ASN.1:1997" all;
    
    // LibItsIVIM
    import from LibItsIvim_TypesAndValues all;
    import from LibItsIvim_Templates all;
    import from LibItsIvim_TestSystem all;
    import from LibItsIvim_Functions all;
    import from LibItsIvim_Pics all;
    import from LibItsIvim_ASN1_IVInamedNumbers all;
    
    group iviMessageTransmission { 
        
        group iviMessageFormat {
            
            /**
             * @desc    TP Function for TC_IS_IVI_MSGF_BV_01
             */
            function f_IS_IVI_GEN_MSGF_BV_01() runs on ItsIvim {
Yann Garcia's avatar
Yann Garcia committed
                var IviIdentificationNumber v_iviIdentificationNumber;
                
                // 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();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
Yann Garcia's avatar
Yann Garcia committed
                v_iviIdentificationNumber := f_utTriggerEvent(valueof(m_utTriggerEvent()));
                tc_ac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader
                    ))) { 
                        tc_ac.stop;
garciay's avatar
garciay committed
                        log("*** " & testcasename() & ": PASS: Expected IVIM received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                    }
                    [] tc_ac.timeout {
garciay's avatar
garciay committed
                        log("*** " & testcasename() & ": INCONC: IVIM not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
Yann Garcia's avatar
Yann Garcia committed
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
            } // End of function f_IS_IVI_GEN_MSGF_BV_01
        group iviLoactionContainer{
            
            /**
             * @desc    TP Function for IS_IVI_GEN_LOC_BV_01
             */
            function f_IS_IVI_GEN_LOC_BV_01() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_LOC_BV_01
            
            /**
             * @desc    TP Function for IS_IVI_GEN_LOC_BV_02
             */
            function f_IS_IVI_GEN_LOC_BV_02() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_LOC_BV_02
            
            /**
             * @desc    TP Function for IS_IVI_GEN_LOC_BV_03
             */
            function f_IS_IVI_GEN_LOC_BV_03() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_LOC_BV_03
            
            /**
             * @desc    TP Function for IS_IVI_GEN_LOC_BV_04
             */
            function f_IS_IVI_GEN_LOC_BV_04() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_LOC_BV_04
            
            /**
             * @desc    TP Function for IS_IVI_GEN_LOC_BV_05
             */
            function f_IS_IVI_GEN_LOC_BV_05() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_LOC_BV_05
            
            /**
             * @desc    TP Function for IS_IVI_GEN_LOC_BV_06
             */
            function f_IS_IVI_GEN_LOC_BV_06() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_LOC_BV_06
        
        } // End of group iviLoactionContainer
        
        group iviManagamentContainer{
            
            /**
             * @desc    TP Function for IS_IVI_GEN_MANC_BV_01
             */
            function f_IS_IVI_GEN_MANC_BV_01() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_MANC_BV_01
            
            /**
             * @desc    TP Function for IS_IVI_GEN_MANC_BV_02
             */
            function f_IS_IVI_GEN_MANC_BV_02() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_MANC_BV_02
        
        } // End of group iviManagamentContainer
        
            function f_IS_IVI_GEN_EVGN_BV_01() runs on ItsIvim {
                
                // Local variables
                var IviIdentificationNumber v_iviIdentificationNumber;
                
garciay's avatar
garciay committed
                // 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();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_iviIdentificationNumber := f_utTriggerEvent(m_utTriggerEvent());
                        
                tc_ac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer(
                                        -, 
                                        v_iviIdentificationNumber
                    ))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Successfully received IVIM. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu
                    )) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Received a IVIM with incorrect information. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_EVGN_BV_01
            function f_IS_IVI_GEN_EVGN_BV_02() runs on ItsIvim {
                
                // Local variables
                var template (value) UtIvimTriggerList v_utTriggers := {
garciay's avatar
garciay committed
                    m_utTriggerEvent(c_duration_2sec, f_getCurrentTime() - 1000 * c_duration_2sec, -/*, -, -*/),
                    m_utTriggerEvent(c_duration_4sec, f_getCurrentTime() - 1000 * c_duration_4sec, -/*, -, -*/),
                    m_utTriggerEvent(c_duration_6sec, f_getCurrentTime() - 1000 * c_duration_6sec, -/*, -, -*/)
                }
                var boolean v_success := true;
                var IviIdentificationNumberList v_iviIdentificationNumbers;
                var IvimInd v_ivimInd;
                var integer i;
                
garciay's avatar
garciay committed
                // 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();
                for (i := 0; i < lengthof(v_utTriggers) - 1; i := i + 1) {
                    f_utTriggerEvent(valueof(v_utTriggers[i]));
                    f_awaitIviMessage(mw_ivimInd(mw_anyIvimPdu), v_ivimInd);
                    v_iviIdentificationNumbers[i] := v_ivimInd.msgIn.ivi.mandatory.iviIdentificationNumber;
                }
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                f_utTriggerEvent(valueof(v_utTriggers[lengthof(v_utTriggers) - 1]));
                f_awaitIviMessage(mw_ivimInd(mw_anyIvimPdu), v_ivimInd);
                v_iviIdentificationNumbers[lengthof(v_iviIdentificationNumbers) - 1] := v_ivimInd.msgIn.ivi.mandatory.iviIdentificationNumber;
                
                //check the action id
                for (i := 0; i < lengthof(v_iviIdentificationNumbers) - 1; i := i + 1) {
                    if (v_iviIdentificationNumbers[lengthof(v_iviIdentificationNumbers) - 1] == v_iviIdentificationNumbers[i]) {
                        v_success := false;
                    }
                }
                if (v_success==true) {
                    log("*** " & testcasename() & ": PASS: IviIdentificationNumber field indicating unused value. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                else {
                    log("*** " & testcasename() & ": FAIL: IviIdentificationNumber field indicating used value. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                
                // Postamble
                for (i := 0; i < lengthof(v_iviIdentificationNumbers); i := i + 1) {
                    f_poCancelEvent(e_iut, v_iviIdentificationNumbers[i]);
                }
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_EVGN_BV_02
            function f_IS_IVI_GEN_EVGN_BV_03() runs on ItsIvim {
                
                // Local variables
                var template (value) UtIvimTriggerList v_utTriggers := {
garciay's avatar
garciay committed
                    m_utTriggerEvent(c_duration_2sec, f_getCurrentTime() - 1000 * c_duration_2sec, -/*, -, -*/),
                    m_utTriggerEvent(c_duration_4sec, f_getCurrentTime() - 1000 * c_duration_4sec, -/*, -, -*/),
                    m_utTriggerEvent(c_duration_6sec, f_getCurrentTime() - 1000 * c_duration_6sec, -/*, -, -*/)
                }
                var IviIdentificationNumber v_iviIdentificationNumber;
                var boolean v_success := true;
                var IvimInd v_ivimInd;
                var integer i;
                
garciay's avatar
garciay committed
                // 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();
                for (i := 0; i < lengthof(v_utTriggers) - 1; i := i + 1) {
                    f_utTriggerEvent(valueof(v_utTriggers[i]));
                    f_awaitIviMessage(mw_ivimInd(mw_anyIvimPdu), v_ivimInd);
                    f_poCancelEvent(e_iut, v_ivimInd.msgIn.ivi.mandatory.iviIdentificationNumber);
                }
                //save the last IVI identification number
                v_iviIdentificationNumber := v_ivimInd.msgIn.ivi.mandatory.iviIdentificationNumber;
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                f_utTriggerEvent(valueof(v_utTriggers[lengthof(v_utTriggers) - 1]));
                
                tc_ac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer(
                                        -, 
                                        v_iviIdentificationNumber + 1,
                                        IviStatus_new_
                    ))))) -> value v_ivimInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Successfully received expected IVIM. ***");
                        v_iviIdentificationNumber := v_ivimInd.msgIn.ivi.mandatory.iviIdentificationNumber;
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu
                    )) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Received a IVIM with incorrect information. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_EVGN_BV_03
            function f_IS_IVI_GEN_EVGN_BV_04() runs on ItsIvim {
                
                // Local variables
                var IviIdentificationNumber v_iviIdentificationNumber;
                
garciay's avatar
garciay committed
                // 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();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_iviIdentificationNumber := f_utTriggerEvent(m_utTriggerEvent());
                
                tc_ac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer(
                                        -, 
                                        v_iviIdentificationNumber, 
garciay's avatar
garciay committed
                                        IviStatus_new_
                    ))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Successfully received expected IVIM. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu
                    )) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Received a IVIM with incorrect information. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_EVGN_BV_04
            function f_IS_IVI_GEN_EVGN_BV_05() runs on ItsIvim {
garciay's avatar
garciay committed
                
                // Local variables
                const integer c_epsilon := 500; // maximum c_epsilon cannot exceed 500ms 
                var IviIdentificationNumber v_iviIdentificationNumber;
                var TimestampIts v_timestamp;
                var IvimInd v_iviMsg;
                
                // 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();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_timestamp := f_getCurrentTime();
                v_iviIdentificationNumber := f_utTriggerEvent(m_utTriggerEvent());
                
                tc_ac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer_timestamp(
                                        -, 
                                        v_iviIdentificationNumber, 
                                        IviStatus_new_
                    ))))) -> value v_iviMsg {
                        tc_ac.stop;
                        if (f_abs(v_iviMsg.msgIn.ivi.mandatory.timeStamp - v_timestamp) < c_epsilon) {
                            log("*** " & testcasename() & ": PASS: Successfully received expected IVIM. ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        } else {
                            log("*** " & testcasename() & ": FAIL: TimeStamp value is out of range (" & int2str(c_epsilon) & "). ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu
                    )) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Received a IVIM with incorrect information. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_EVGN_BV_05
        } // End of group iviEventGeneration
        
        group iviEventUpdate {
            
            function f_IS_IVI_GEN_EVUP_BV_01() runs on ItsIvim {
                
                // Local variables
                var IviIdentificationNumber v_iviIdentificationNumber;
                var IvimInd v_rcvdMsg;
                
garciay's avatar
garciay committed
                // 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(
                                    -, 
garciay's avatar
garciay committed
                                    -, 
                                    IviStatus_new_
                    )))),
                    v_rcvdMsg
                );
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
filatov's avatar
filatov committed
                f_utUpdateEvent(m_utIvimUpdateEvent(v_iviIdentificationNumber));
                
                tc_ac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer(
                                        -, 
garciay's avatar
garciay committed
                                        -, 
                                        IviStatus_update_
                    ))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Successfully received expected IVIM. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu
                    )) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Received a IVIM with incorrect information. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_EVUP_BV_01
            function f_IS_IVI_GEN_EVUP_BV_02() runs on ItsIvim {
                
                // Local variables
                var IviIdentificationNumber v_iviIdentificationNumber;
                var IvimInd v_rcvdMsg;
                var TimestampIts v_validTo;
                
garciay's avatar
garciay committed
                // 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, 
garciay's avatar
garciay committed
                                    IviStatus_new_
filatov's avatar
filatov committed
                f_utUpdateEvent(m_utIvimUpdateEvent(v_iviIdentificationNumber));
                f_awaitIviMessage(
                    mw_ivimInd(
                        mw_anyIvimPdu(
                            mw_itsPduHeader,
                            mw_ivimStructure(
                                mw_iviManagementContainer(
                                    -, 
                                    v_iviIdentificationNumber, 
garciay's avatar
garciay committed
                                    IviStatus_update_
                    )))),
                    v_rcvdMsg
                );
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_validTo := f_getCurrentTime() + 1000 * 3600; // Current ITS time + one hour
Yann Garcia's avatar
Yann Garcia committed
                f_utUpdateEvent(m_utIvimUpdateEvent(v_iviIdentificationNumber, -, -, v_validTo));
                
                tc_ac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer_validTo(
                                        -, 
                                        v_iviIdentificationNumber, 
garciay's avatar
garciay committed
                                        IviStatus_update_,
                                        v_validTo
                    ))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Successfully received expected IVIM. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu
                    )) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Received a IVIM with incorrect information. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_EVUP_BV_02
            function f_IS_IVI_GEN_EVUP_BV_03() runs on ItsIvim {
                
                // Local variables
                var IviIdentificationNumber v_iviIdentificationNumber;
                var IvimInd v_rcvdMsg;
                var TimestampIts v_validFrom;
                
garciay's avatar
garciay committed
                // 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, 
garciay's avatar
garciay committed
                                    IviStatus_new_
filatov's avatar
filatov committed
                f_utUpdateEvent(m_utIvimUpdateEvent(v_iviIdentificationNumber));
                f_awaitIviMessage(
                    mw_ivimInd(
                        mw_anyIvimPdu(
                            mw_itsPduHeader,
                            mw_ivimStructure(
                                mw_iviManagementContainer(
                                    -, 
                                    v_iviIdentificationNumber, 
garciay's avatar
garciay committed
                                    IviStatus_update_
                    )))),
                    v_rcvdMsg
                );
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_validFrom := f_getCurrentTime() + 1000 * 3600; // Current ITS time + one hour
filatov's avatar
filatov committed
                f_utUpdateEvent(m_utIvimUpdateEvent(v_iviIdentificationNumber, -, v_validFrom));
                
                tc_ac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer_validFrom(
                                        -, 
                                        v_iviIdentificationNumber, 
garciay's avatar
garciay committed
                                        IviStatus_update_,
                                        v_validFrom
                    ))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Successfully received expected IVIM. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu
                    )) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Received a IVIM with incorrect information. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_EVUP_BV_03
            function f_IS_IVI_GEN_EVUP_BV_04() runs on ItsIvim {
garciay's avatar
garciay committed
                
                // Local variables
                const integer c_epsilon := 500; // maximum c_epsilon cannot exceed 500ms 
                var IviIdentificationNumber v_iviIdentificationNumber;
                var TimestampIts v_timestamp;
                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
                v_timestamp := f_getCurrentTime();
filatov's avatar
filatov committed
                f_utUpdateEvent(m_utIvimUpdateEvent(v_iviIdentificationNumber));
garciay's avatar
garciay committed
                
                tc_ac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer_timestamp(
                                        -, 
                                        v_iviIdentificationNumber, 
                                        IviStatus_update_
                    ))))) -> value v_rcvdMsg {
                        tc_ac.stop;
                        if (f_abs(v_rcvdMsg.msgIn.ivi.mandatory.timeStamp - v_timestamp) < c_epsilon) {
                            log("*** " & testcasename() & ": PASS: Successfully received expected IVIM. ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        } else {
                            log("*** " & testcasename() & ": FAIL: TimeStamp value is out of range (" & int2str(c_epsilon) & "). ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu
                    )) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Received a IVIM with incorrect information. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_EVUP_BV_04
            function f_IS_IVI_GEN_EVUP_BV_05() runs on ItsIvim {
garciay's avatar
garciay committed
                
                // 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
filatov's avatar
filatov committed
                f_utUpdateEvent(m_utIvimUpdateEvent(v_iviIdentificationNumber));
garciay's avatar
garciay committed
                
                tc_ac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer(
                                        -, 
                                        v_iviIdentificationNumber, 
                                        IviStatus_update_
                    ))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Successfully received expected IVIM. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu
                    )) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Received a IVIM with incorrect information. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_EVUP_BV_05
garciay's avatar
garciay committed
        } // End of group iviEventUpdate
        
        group iviGeneralApplicationContainer{
            
            function f_IS_IVI_GEN_GENAPP_BV_01() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_GENAPP_BV_01
            
            function f_IS_IVI_GEN_GENAPP_BV_02() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_GENAPP_BV_02
            
            function f_IS_IVI_GEN_GENAPP_BV_03() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_GENAPP_BV_03
            
            function f_IS_IVI_GEN_GENAPP_BV_04() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_GENAPP_BV_04
            
            function f_IS_IVI_GEN_GENAPP_BV_05() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_GENAPP_BV_05
            
            function f_IS_IVI_GEN_GENAPP_BV_06() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_GENAPP_BV_06
        
        } // End of group iviGeneralApplicationContainer
        
        group iviRoadConfigurationContainer{
            
            function f_IS_IVI_GEN_RCC_BV_01() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_RCC_BV_01
            
            function f_IS_IVI_GEN_RCC_BV_02() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_RCC_BV_02
            
            function f_IS_IVI_GEN_RCC_BV_03() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_RCC_BV_03
        
        } // End of group iviRoadConfigurationContainer
        
        group iviTextContainer{
            
            function f_IS_IVI_GEN_TEXT_BV_01() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_TEXT_BV_01
            
            function f_IS_IVI_GEN_TEXT_BV_02() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_TEXT_BV_02
            
            function f_IS_IVI_GEN_TEXT_BV_03() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_TEXT_BV_03
            
            function f_IS_IVI_GEN_TEXT_BV_04() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_TEXT_BV_04
        
        } // End of group iviTextContainer
        
        group iviGenerationFrequency {
            function f_IS_IVI_GEN_GFQ_TI_01() runs on ItsIvim {
                
                // Local variables
                const integer c_maxLoopValue := 10;
                timer t_minTransInterval := PICS_T_GENIVIMMIN * 0.90;
                var integer v_counter := 0;
                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(float2int(PICS_T_GENIVIMMIN)));
                ivimPort.clear;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer(
                                        -, 
                                        -, 
                                        IviStatus_new_
                    ))))) { 
                        tc_ac.stop;
                        t_minTransInterval.start;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First IVIM received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: IVIM not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                }
                
                // Test Body
                tc_ac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer
                    )))) {
                        tc_ac.stop;
                        if (t_minTransInterval.running) {
                            log("*** " & testcasename() & ": FAIL: IVIM received BEFORE expiry of the minimum generation timer interval ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        } else {
                            v_counter := v_counter + 1;
                            if (v_counter < c_maxLoopValue) {
                                repeat;
                            } else {
                                log("*** " & testcasename() & ": PASS: Generation of IVIMs was successful ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                        }
                    }
                    [] tc_ac.timeout {
                        t_minTransInterval.stop;
                        log("*** " & testcasename() & ": INCONC: IVIM not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_GFQ_TI_01
            function f_IS_IVI_GEN_GFQ_TI_02() runs on ItsIvim {
                
                // Local variables
                const integer c_maxLoopValue := 10;
                timer t_maxTransInterval := PICS_T_GENIVIMMAX * 1.10;
                var integer v_counter := 0;
                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(float2int(PICS_T_GENIVIMMIN)));
                ivimPort.clear;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer(
                                        -, 
                                        -, 
                                        IviStatus_new_
                    ))))) { 
                        tc_ac.stop;
                        t_maxTransInterval.start;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First IVIM received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: IVIM not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                // Test Body
                tc_ac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer
                    )))) {
                        tc_ac.stop;
                        t_maxTransInterval.stop;
                        t_maxTransInterval.start;
                        v_counter := v_counter + 1;
                        if (v_counter < c_maxLoopValue) {
                            t_maxTransInterval.start;
                            repeat;
                        } else {
                                log("*** " & testcasename() & ": PASS: Generation of IVIMs was successful ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    [] t_maxTransInterval.timeout {
                        log("*** " & testcasename() & ": FAIL:  No IVIM received BEFORE expiry of the maximum generation timer interval ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        t_maxTransInterval.stop;
                        log("*** " & testcasename() & ": INCONC: IVIM not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_GFQ_TI_02
            
        } // End of group iviGenerationFrequency
        
        group iviEventRepetition {
            
            function f_IS_IVI_GEN_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;
                const float c_minTransInterval := int2float(c_repetitionInterval) * 0.90;
                const float c_maxTransInterval := int2float(c_repetitionInterval) * 1.10;
                var Times v_times := {};
                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_utIvimUpdateEvent(v_iviIdentificationNumber, c_duration_4sec));
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer(
                                        -, 
                                        v_iviIdentificationNumber, 
                                        IviStatus_update_
                    ))))) {
                        v_times[v_counter] := tc_ac.read;
                            v_counter := v_counter + 1;
                            if (v_counter < c_maxLoopValue) {
                                repeat;
                        }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": FAIL: Timeout while awaiting the reception of a message. ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                        }
                
                if (v_counter==c_maxLoopValue) {
                    for (v_counter:=1; v_counter<c_maxLoopValue; v_counter:=v_counter + 1) {
                        var float v_timeDiff := v_times[v_counter]-v_times[v_counter-1];
                        if (not match(v_timeDiff, (c_minTransInterval..c_maxTransInterval))) {
                            log("*** " & testcasename() & ": FAIL: IUT did NOT send IVIM with respect to the 'repetition interval' RI_1. ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            break;
                    }
                    }
                    if (v_counter==c_maxLoopValue) {
                        log("*** " & testcasename() & ": FAIL: IUT sends IVIM with respect to the 'repetition interval' RI_1. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                }
                
                // Postamble
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_EVRP_BV_01
            function f_IS_IVI_GEN_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_utIvimUpdateEvent(v_iviIdentificationNumber, c_repetition_interval_deactivated));
Yann Garcia's avatar
Yann Garcia committed
                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_IVI_GEN_EVRP_BV_02
        } // End of group iviEventRepetition
            function f_IS_IVI_GEN_EVTR_BV_01() runs on ItsIvim {
garciay's avatar
garciay committed
                
                // Local variables
                var IviIdentificationNumber v_iviIdentificationNumber;
                var IvimInd v_rcvdMsg;
                var integer v_timeOffset := 4 * c_duration_4sec; //at most 4 repetitions
garciay's avatar
garciay committed
                
                // 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_duration_4sec, -, f_getCurrentTime() + 1000 /* to milliseconds */ * v_timeOffset));
                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(v_timeOffset));
                ivimPort.clear; //remove repeated events
                
                tc_noac.start;
garciay's avatar
garciay committed
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer(
                                        -, 
garciay's avatar
garciay committed
                                        IviStatus_new_
                    ))))) {
                        log("*** " & testcasename() & ": INFO: 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);
garciay's avatar
garciay committed
                    }
                }
                
                // Postamble
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_EVTR_BV_01
            function f_IS_IVI_GEN_EVTR_BV_02() runs on ItsIvim {
garciay's avatar
garciay committed
                
                // 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_noac.start;
garciay's avatar
garciay committed
                alt {
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer(
                                        -, 
garciay's avatar
garciay committed
                                        IviStatus_new_
                    ))))) {
                        log("*** " & testcasename() & ": INFO: No more IVIM shall be sent. ***");
garciay's avatar
garciay committed
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: No more IVIM was sent. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
garciay's avatar
garciay committed
                    }
                }
                
                // Postamble
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_EVTR_BV_02
            function f_IS_IVI_GEN_EVTR_BV_03() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_EVTR_BV_03
            
            function f_IS_IVI_GEN_EVTR_BV_04() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_EVTR_BV_04
            
        } // End of group iviEventTermination
            function f_IS_IVI_GEN_COM_BV_01() runs on ItsIvim {
                
                // Local variables
                const UInt8 c_gnNhBtpB := 2;
garciay's avatar
garciay committed
                var IviIdentificationNumber v_iviIdentificationNumber;
garciay's avatar
garciay committed
                // 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();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_iviIdentificationNumber := f_utTriggerEvent(m_utTriggerEvent());
                        
                tc_ac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimIndWithGnParameters(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer
                            )),
                            c_gnNhBtpB
                    )) {
                        tc_ac.stop;
garciay's avatar
garciay committed
                        log("*** " & testcasename() & ": PASS: Expected IVIM encapsultated in BTP-B packet received. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] ivimPort.receive(
                        mw_ivimIndWithGnParameters(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer
                            )),
                            omit
                    )) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: no GN NH information in IvimInd. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu
                    )) {
                        tc_ac.stop;
garciay's avatar
garciay committed
                        log("*** " & testcasename() & ": FAIL: Expected IVIM received, but not encapsulated in BTP-B packet. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_COM_BV_01
//            function f_IS_IVI_COMM_BV_01_02() runs on ItsIvim {
//                
//                // Local variables
//                const UInt16 c_gnNhBtpBPort := 2006;
//                var IviIdentificationNumber v_iviIdentificationNumber;
//                
//                // 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();
//                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                
//                // Test Body
//                v_iviIdentificationNumber := f_utTriggerEvent(m_utTriggerEvent());
//                        
//                tc_ac.start;
//                alt {
//                    [] ivimPort.receive(
//                        mw_ivimIndWithBtpParameters(
//                            mw_anyIvimPdu(
//                                mw_itsPduHeader,
//                                mw_ivimStructure(
//                                    mw_iviManagementContainer
//                            )),
//                            c_gnNhBtpBPort,
//                            0
//                    )) {
//                        tc_ac.stop;
//                        log("*** " & testcasename() & ": Expected IVIM encapsultated in BTP packet with port value 2006 received. ***");
//                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
//                    }
//                    [] ivimPort.receive(
//                        mw_ivimInd(
//                            mw_anyIvimPdu(
//                                mw_itsPduHeader,
//                                mw_ivimStructure(
//                                    mw_iviManagementContainer
//                    )))) {
//                        tc_ac.stop;
//                        log("*** " & testcasename() & ": FAIL: Expected IVIM received, but not addressed to the correct destination port. ***");
//                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
//                    }
//                    [] ivimPort.receive(
//                        mw_ivimInd(
//                            mw_anyIvimPdu
//                    )) {
//                        tc_ac.stop;
//                        log("*** " & testcasename() & ": FAIL: Expected IVIM received, but not encapsulated in BTP-B packet. ***");
//                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
//                    }
//                    [] tc_ac.timeout {
//                        log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
//                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
//                    }
//                }
//                
//                // Postamble
//                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
//                f_cfDown();
//                
//            } // End of function f_IS_IVI_COMM_BV_01_02
            function f_IS_IVI_GEN_COM_BV_02 () runs on ItsIvim {
garciay's avatar
garciay committed
                
                // Local variables
                const UInt8 c_gnHtUnc := 2;
                var IviIdentificationNumber v_iviIdentificationNumber;
                
                // Test control
Yann Garcia's avatar
Yann Garcia committed
                if (not PICS_IVIM_GENERATION) {
garciay's avatar
garciay committed
                    log("*** " & testcasename() & ": PICS_IVIM_GENERATION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cfUp();
                    
                // Preamble
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    
                // Test Body
                v_iviIdentificationNumber := f_utTriggerEvent(m_utTriggerEvent());
                
                tc_ac.start;
                alt {
                    [] ivimPort.receive(
                        mw_ivimIndWithGnParameters(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer
                            )),
                            c_gnHtUnc
                    )) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Expected IVIM encapsulated in GBC packet received. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] ivimPort.receive(
                        mw_ivimIndWithGnParameters(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer
                            )),
                            omit
                    )) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: no GN NH information in IvimInd. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] ivimPort.receive(
                        mw_ivimInd(
                            mw_anyIvimPdu
                    )) {
                        tc_ac.stop;
garciay's avatar
garciay committed
                        log("*** " & testcasename() & ": FAIL: Expected IVIM received, but not encapsulated in BTP-B packet. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poCancelEvent(e_iut, v_iviIdentificationNumber);
                f_cfDown();
                
            } // End of function f_IS_IVI_GEN_COM_BV_02
        group iviSecurityParameters{
            
            function f_IS_IVI_GEN_SEC_BV_01() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_SEC_BV_01
            
            function f_IS_IVI_GEN_SEC_BV_02() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_SEC_BV_02
            
            function f_IS_IVI_GEN_SSP_BV_01() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_SSP_BV_01
            
            function f_IS_IVI_GEN_SSP_BV_02() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_SSP_BV_02
            
            function f_IS_IVI_GEN_SSP_BV_03() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_SSP_BV_03
            
            function f_IS_IVI_GEN_SSP_BV_04() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_SSP_BV_04
            
            function f_IS_IVI_GEN_SSP_BV_05() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_SSP_BV_05
            
            function f_IS_IVI_GEN_SSP_BV_06() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_SSP_BV_06
            
            function f_IS_IVI_GEN_SSP_BO_01() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_SSP_BO_01
            
            function f_IS_IVI_GEN_SSP_BO_02() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_SSP_BO_02
            
            function f_IS_IVI_GEN_SSP_BO_03() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_SSP_BO_03
            
            function f_IS_IVI_GEN_SSP_BO_04() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_SSP_BO_04
            
            function f_IS_IVI_GEN_SSP_BO_05() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_SSP_BO_05
            
            function f_IS_IVI_GEN_SSP_BO_06() runs on ItsIvim {
                
                // TODO
                
            } // End of function f_IS_IVI_GEN_SSP_BO_06
        
        } // End of group iviSecurityParameters
        
    } // End of group iviMessageTransmission
    
    group iviMessageReception {
        
         * @desc    TP Function for TC_IS_IVI_RCV_MSGF_BV_01
         */
        function f_IS_IVI_RCV_MSGF_BV_01() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_MSGF_BV_01
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_DATA_BV_01
         */
        function f_IS_IVI_RCV_DATA_BV_01() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_DATA_BV_01
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_DATA_BV_02
         */
        function f_IS_IVI_RCV_DATA_BV_02() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_DATA_BV_02
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_DATA_BV_03
         */
        function f_IS_IVI_RCV_DATA_BV_03() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_DATA_BV_03
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_DATA_BV_04
         */
        function f_IS_IVI_RCV_DATA_BV_04() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_DATA_BV_04
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_DATA_BV_05
         */
        function f_IS_IVI_RCV_DATA_BV_05() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_DATA_BV_05
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_EVUP_BV_01
         */
        function f_IS_IVI_RCV_EVUP_BV_01() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_EVUP_BV_01
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_EVUP_BV_02
         */
        function f_IS_IVI_RCV_EVUP_BV_02() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_EVUP_BV_02
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_EVUP_BV_03
         */
        function f_IS_IVI_RCV_EVUP_BV_03() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_EVUP_BV_03
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_EVUP_BV_04
         */
        function f_IS_IVI_RCV_EVUP_BV_04() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_EVUP_BV_04
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_EVUP_BV_05
        function f_IS_IVI_RCV_EVUP_BV_05() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_EVUP_BV_05
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_EVUP_BV_06
         */
        function f_IS_IVI_RCV_EVUP_BV_06() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_EVUP_BV_06
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_SSP_BV_01
         */
        function f_IS_IVI_RCV_SSP_BV_01() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_SSP_BV_01
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_SSP_BO_01
         */
        function f_IS_IVI_RCV_SSP_BO_01() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_SSP_BO_01
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_SSP_BO_02
         */
        function f_IS_IVI_RCV_SSP_BO_02() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_SSP_BO_02
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_SSP_BO_03
         */
        function f_IS_IVI_RCV_SSP_BO_03() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_SSP_BO_03
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_SSP_BO_04
         */
        function f_IS_IVI_RCV_SSP_BO_04() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_SSP_BO_04
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_SSP_BO_05
         */
        function f_IS_IVI_RCV_SSP_BO_05() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_SSP_BO_05
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_SSP_BO_06
         */
        function f_IS_IVI_RCV_SSP_BO_06() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_SSP_BO_06
        
        /**
         * @desc    TP Function for TC_IS_IVI_RCV_SSP_BO_07
         */
        function f_IS_IVI_RCV_SSP_BO_07() runs on ItsIvim {
            
            // TODO
            
        } // End of function f_IS_IVI_RCV_SSP_BO_07
//        
//        /**
//         * @desc    TP Function for TC_IS_IVI_MSGF_BV_02
//         */
//        function f_IS_IVI_MSGF_BV_02() runs on ItsIvim {
//            
//            // Local variables
//            var IvimReq v_ivimReq;
//            var integer i;
//            
//            // Test control
//            if (not PICS_IVIM_RECEPTION) {
//                log("*** " & testcasename() & ": PICS_IVIM_RECEPTION 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_ivimReq := valueof(
//                m_ivimReq(
//                    m_ivimStructurePdu(
//                        valueof(m_ivimStructure(
//                            valueof(m_iviManagementContainer(
//                                f_getProvider(),
//                                1,
//                                IviStatus_new_
//                            ))
//                        ))
//                    )
//                )
//            );
//            ivimPort.send(v_ivimReq);
//            
//            f_sleep(PX_TNOAC);
//            for(i:=0; i < lengthof(vc_utEvents) and not match(v_ivimReq.msgOut, vc_utEvents[i].iviMsg); i:=i+1) {
//                // empty on purpose 
//            }
//            if(i < lengthof(vc_utEvents)) {
//                log("*** " & testcasename() & ": PASS: IVIM was transmitted to upper layer***");
//                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
//            }
//            else {
//                log("*** " & testcasename() & ": FAIL: IVIM was not transmitted to upper layer***");
//                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
//            }
//            
//            // Postamble
//            f_poDefault();
//            f_cfDown();
//            
//        } // End of function f_IS_IVI_MSGF_BV_02
    } // End of group iviMessageReception
    
} // End of module ItsIvim_TpFunctions