ItsCam_TestCases.ttcn 182 KB
Newer Older
filatov's avatar
filatov committed
                var float v_genCam_max;
                
                // Test control
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState();
                camPort.clear;
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_any )){ 
                        tc_ac.stop;
                        t_genCam_measure.start;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message received ***");
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message not received ***");
                        f_selfOrClientSyncAndVerdictPreamble("error", e_timeout);
                    }
                }
                f_utTriggerEvent(m_changeSpeed(1000));
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_any )){
                        var float v_measured := t_genCam_measure.read;
                        tc_ac.stop;
                        v_genCam_min := v_measured * 0.9;
                        v_genCam_max := v_measured * 1.1;
                        log("*** " & testcasename() & ": INFO: Initial conditions: Anticipated CAM message received ***");
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: Anticipated CAM message not received ***");
                        f_selfOrClientSyncAndVerdictPreamble("error", e_timeout);
                    }
                }
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                t_genCam_min.start(v_genCam_min);
                t_genCam_max.start(v_genCam_max);
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_any )){
                        if (t_genCam_min.running) {
                            log("*** " & testcasename() & ": FAIL: Anticipated CAM message received BEFORE T_GenCam expired ***");
                            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                        }
                        t_genCam_max.stop;
                        log("*** " & testcasename() & ": PASS: Anticipated CAM message received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    }
                    [] t_genCam_min.timeout {
                        repeat;
                    }
                    [] t_genCam_max.timeout {
                        log("*** " & testcasename() & ": FAIL: Anticipated CAM message not received ***");
                        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end TC_CAM_MSD_GFQ_BV_07
            
        } // end group camGenerationFrequency
        
    } // end group camMessageDissemination
      
    group camMessageProcessing {
        
        /**
         * @desc Check that content of received CAM is transmitted to 
         *       applications and other facilities.
         * <pre>
         * Pics Selection: PICS_CANRECEPTION
         * Initial conditions: 
         *     with {
         *         the IUT being in the "initial state"
         *     }
         * Expected behaviour:
         *     ensure that {
         *         when {
         *             the IUT receives a valid CAM
         *         }
         *         then {
         *             the IUT forwards the CAM content to upper layers
         *             and the IUT forwards the CAM content to other facilities
         *         }
         *     }
         * </pre>
         * 
         * @version   0.0.2
         * @see       ETSI TS 102 868-2 v0.0.2 TP/CAM/MSP/BV-01
         * @reference ETSI EN 302 637-2 , clause 4.2.2
         */
        testcase TC_CAM_MSP_BV_01() runs on ItsCam system ItsCamSystem {
            
            // Local variables
            var CamReq v_camReq;
            
            // Test control
            
            // Test component configuration
            f_cfUp();
            
            // Test adapter configuration
            
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
            
            // Test Body
            v_camReq := valueof(
                            m_camReq(
                                m_camMsg_vehicle(
                                    f_getTsStationId(),
                                    f_getCurrentTime() mod 65536, // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
                                    m_tsPosition
                                )
                            )
                        );
            camPort.send( v_camReq ) ;
            
            f_utCheckEvent(m_checkLdm(v_camReq.msgOut)); 
            log("*** " & testcasename() & ": PASS: CAM message received at LDM ***");
            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
            
            // Postamble
            f_poDefault();
            f_cfDown();
            
        } // end TC_CAM_MSP_BV_01
        
    } // end group camMessageProcessing
    
} // end ItsCam_TestCases