Skip to content
ItsCam_TpFunctions.ttcn 149 KiB
Newer Older
ASN.1 Documenter's avatar
ASN.1 Documenter committed
/**
 *    @author   ETSI / STF405 / STF449 / STF484 / STF517
 *    @version  $Url: https://oldforge.etsi.org/svn/ITS/tags/20170222_STF527_Final/ttcn/AtsCAM/ItsCam_TpFunctions.ttcn $
 *              $Id: ItsCam_TpFunctions.ttcn 2655 2017-01-26 10:46:08Z filatov $
 *    @desc     CAM TP functions
 *    @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 ItsCam_TpFunctions {
    
    import from LibItsCommon_Pixits all;

    // LibCommon
    import from LibCommon_Sync all;
    import from LibCommon_VerdictControl all;
    import from LibCommon_Time all;
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    
    // LibIts
    import from ITS_Container language "ASN.1:1997" all;
    import from CAM_PDU_Descriptions language "ASN.1:1997" all;
    
    // LibItsCommon
    import from LibItsCommon_TypesAndValues all;
    import from LibItsCommon_Functions all;
    import from LibItsCommon_Pixits all;
    import from LibItsCommon_ASN1_NamedNumbers all;
    
    // LibItsCam
    import from LibItsCam_TestSystem all;
    import from LibItsCam_Functions all;
    import from LibItsCam_Templates all;
    import from LibItsCam_TypesAndValues all;
    import from LibItsCam_Pics all;
    
    import from LibItsSecurity_Functions all;

    // 5.2.1
    group camMessageDissemination { 
        
        group camMessageFormat {
            
            /**
             * @desc    TP Function for TC_CAM_MSD_FMT_BV_01
             */
            function f_CAM_MSD_FMT_BV_01() runs on ItsCam {
                
                // Local variables
                
                // Test control
                if (not PICS_CAM_GENERATION or PICS_RSU) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU 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
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_any )){ 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Expected CAM message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_FMT_BV_01
            
            /**
             * @desc    TP Function for TC_CAM_MSD_FMT_BV_02
             */
            function f_CAM_MSD_FMT_BV_02() runs on ItsCam {
                
                // Local variables
                
                // Test control
                if (not PICS_CAM_GENERATION or PICS_RSU) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION AND NOT PICS_RSU 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
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd ( mw_camMsg_LF_any )){ 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Expected CAM message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);  
                    }
                    [] camPort.receive(mw_camInd ( mw_camMsg_any )){ 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Expected CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);  
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_FMT_BV_02
            
            /**
             * @desc    TP Function for TC_CAM_MSD_FMT_BV_03
             */
            function f_CAM_MSD_FMT_BV_03() runs on ItsCam {
                
                // Local variables
                timer t_minTransInterval := c_lowFrequencyGenerationTime * 1.10;
                var SpeedValue v_speedValues[5] := { 1000, 2000, 3000, 4000, 5000 } //cm/s
                var integer v_cntSpeed, v_cntTime;
                var CamInd v_camInd;
                var boolean v_nextCamWithLF := false;
                const integer c_cntTimeLimit := 10;
                
                // Test control
                if (not PICS_CAM_GENERATION or PICS_RSU) {
                    log("*** " & testcasename() & ": PICS_CAM_GENERATION AND NOT PICS_RSU required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                f_prInitialState(e_dynamicPosition1500m);
                camPort.clear;
                tc_ac.start;
                alt {
                     [] camPort.receive(mw_camInd ( mw_camMsg_LF_any )){ 
                        tc_ac.stop;
                        t_minTransInterval.start;
                        log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message not received ***");
                        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_timeout);
                    }
                }
                
                // Test Body
                for (v_cntSpeed:=0; v_cntSpeed<lengthof(v_speedValues); v_cntSpeed:=v_cntSpeed + 1) {
                    f_changeSpeed(v_speedValues[v_cntSpeed]);
                    v_cntTime := 0;
                    tc_ac.start;
                    alt {
                        [] camPort.receive(mw_camInd ( mw_camMsg_LF_any )) {
                            tc_ac.stop; 
                            v_cntTime := v_cntTime + 1;
                            if (v_cntTime == c_cntTimeLimit) { // Exit message loop
                                log("*** " & testcasename() & ": INFO: The subset of CAM messages including lowFrequencyContainer was received ***");
                                t_minTransInterval.start;
                                v_nextCamWithLF := false;                                
                            }
                            else {
                                log("*** " & testcasename() & ": INFO: CAM retransmission with LowFrequency container ***"); 
                                tc_ac.start;
                                t_minTransInterval.start;
                                v_nextCamWithLF := false;
                                repeat;
                            }
Loading full blame...