ItsIvim_TpFunctions.ttcn 68.3 KB
Newer Older
garciay's avatar
garciay committed
            } // End of function f_IS_IVI_EVRP_BV_02
garciay's avatar
garciay committed
        } // End of group iviEventRepetition
garciay's avatar
garciay committed
        group iviEventTermination {
garciay's avatar
garciay committed
            function f_IS_IVI_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();
                
garciay's avatar
garciay committed
            } // End of function f_IS_IVI_EVTR_BV_01
garciay's avatar
garciay committed
            function f_IS_IVI_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();
                
garciay's avatar
garciay committed
            } // End of function f_IS_IVI_EVTR_BV_02
garciay's avatar
garciay committed
        } // End of group iviEventTermination
        
        group iviGenerationFrequency {
garciay's avatar
garciay committed
            function f_IS_IVI_GFQ_TI_01() runs on ItsIvim {
garciay's avatar
garciay committed
                
                // 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;
                tc_ac.start;
                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) {
                                t_minTransInterval.start;
                                repeat;
                            } else {
                                log("*** " & testcasename() & ": PASS: Generation of IVIMs was successful ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                        }
                    }
                    [] t_minTransInterval.timeout {
                        repeat;
                    }
                    [] 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();
                
garciay's avatar
garciay committed
            } // End of function f_IS_IVI_GFQ_TI_01
garciay's avatar
garciay committed
            function f_IS_IVI_GFQ_TI_02() runs on ItsIvim {
garciay's avatar
garciay committed
                
                // 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;
                tc_ac.start;
                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();
                
garciay's avatar
garciay committed
            } // End of function f_IS_IVI_GFQ_TI_02
garciay's avatar
garciay committed
        } // End of group iviGenerationFrequency
garciay's avatar
garciay committed
            function f_IS_IVI_COMM_BV_01_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();
                
garciay's avatar
garciay committed
            } // End of function f_IS_IVI_COMM_BV_01_01
garciay's avatar
garciay committed
            function f_IS_IVI_COMM_BV_01_02() runs on ItsIvim {
garciay's avatar
garciay committed
                const UInt16 c_gnNhBtpBPort := 2006;
                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_ivimIndWithBtpParameters(
                            mw_anyIvimPdu(
                                mw_itsPduHeader,
                                mw_ivimStructure(
                                    mw_iviManagementContainer
                            )),
                            c_gnNhBtpBPort,
                            0
                    )) {
                        tc_ac.stop;
garciay's avatar
garciay committed
                        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;
garciay's avatar
garciay committed
                        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();
                
garciay's avatar
garciay committed
            } // End of function f_IS_IVI_COMM_BV_01_02
garciay's avatar
garciay committed
            function f_IS_IVI_COMM_BV_02 () runs on ItsIvim {
garciay's avatar
garciay committed
                
                // Local variables
                const UInt8 c_gnHtUnc := 2;
                var IviIdentificationNumber v_iviIdentificationNumber;
                
                // Test control
                if (PICS_IVIM_GENERATION) {
                    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();
                
garciay's avatar
garciay committed
            } // End of function f_IS_IVI_COMM_BV_02
            
        } // End of group iviCommunication
        
    } // End of group iviMessageTransmission
    
    group iviMessageReception {
        
        /**
         * @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(
                    )
                )
            );
            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