LibItsCam_Functions.ttcn 4.13 KB
Newer Older
/**
 *	@author 	ETSI / STF405
berge's avatar
berge committed
 *  @version 	$URL$
 *				$Id$
berge's avatar
berge committed
 *	@desc		Module containing common functions for ITS
module LibItsCam_Functions {
    // LibIts
    import from LibIts_TestSystem all;
    import from LibIts_Interface all; 
fischer's avatar
fischer committed
	import from LibItsCam_Templates all;
fischer's avatar
fischer committed
	import from CAM_PDU_Descriptions language "ASN.1:1997" all;
fischer's avatar
fischer committed
 
fischer's avatar
fischer committed
    // LibCommon
    import from LibCommon_VerdictControl all;

fischer's avatar
fischer committed
 group defaults {

    /**
     * @desc 	basic default behaviour handling
     * @remark	none
     * @param	none
     */    
	altstep a_basicDefault() runs on ItsFa {

        [] camPort.receive(mw_camInd ( mw_camMsg_any )){ 
			setverdict(fail, "*** a_basicDefault: FAIL: CAM message received in default ***");
fischer's avatar
fischer committed
			stop;
		}
		[] camPort.receive {
			setverdict(fail, "*** a_basicDefault: FAIL: event received on CAM port in default ***");
fischer's avatar
fischer committed
			stop;
		}
       [] any timer.timeout { 
			setverdict(fail, "*** a_basicDefault: FAIL: a timer expired in default ***");
fischer's avatar
fischer committed
			stop;
		}
	}//end altstep a_basicDefault
     
     
     
 } // end of defaults  
 
 group preambles {
        
fischer's avatar
fischer committed
    /**
     * @desc 	Initialize the IUT
     * @remark	No specific actions specified in the base standard
     * @param	none
     */    
fischer's avatar
fischer committed
    function f_initialState() runs on ItsFa {
fischer's avatar
fischer committed
        
fischer's avatar
fischer committed
        // basic default altstep
        activate(a_basicDefault());
                  
fischer's avatar
fischer committed
    } // end f_ptcCamUp
fischer's avatar
fischer committed
 
 } // end of preambles
fischer's avatar
fischer committed

fischer's avatar
fischer committed
group postambles {
    
    /**
     * @desc 	Global postamble - stops the MTC
     * @remark	No specific actions required so far
     * @param	none
     */    
    function f_postamble()  runs on ItsFa {
        
 	log("*** f_postamble: INFO: postamble ***");
        
    } // end of function
    
} // end of upperTester

fischer's avatar
fischer committed
group upperTester {
    
    function f_upperTester () {
        
        // crash signal activated
        
        // crash signal deactivated
        
    } // end of function
fischer's avatar
fischer committed
    
fischer's avatar
fischer committed
} // end of upperTester

    
fischer's avatar
fischer committed
group configuration {
fischer's avatar
fischer committed
    
berge's avatar
berge committed
     * @desc 	Create Facility component and map CAM port
berge's avatar
berge committed
     * @remark	Only used when ItsFa is a PTC
     * @param	p_camPtc returned Facility component variable
     */    
berge's avatar
berge committed
    function f_ptcCamUp(out ItsFa p_ptcCam) {
        
        // Create Facility component
        p_ptcCam := ItsFa.create("CAM Tester");
berge's avatar
berge committed
        map(p_ptcCam:camPort, system:camPort);
        
berge's avatar
berge committed
    } // end f_ptcCamUp
berge's avatar
berge committed
    
    /**
     * @desc 	Wait for component to finish and unmap CAM ports
berge's avatar
berge committed
     * @remark	Only used when ItsFa is a PTC
berge's avatar
berge committed
     * @param	p_camPtc Facility component variable
     */    
berge's avatar
berge committed
    function f_ptcCamDown(in ItsFa p_ptcCam) runs on ItsMtc {
berge's avatar
berge committed
            
    	tc_guard.start;
        alt {
        	[] p_ptcCam.done {
            	tc_guard.stop;
            }
            
            [] tc_guard.timeout {
berge's avatar
berge committed
             	log("*** f_ptcCamDown: ERROR: Timeout while waiting for component ***");
berge's avatar
berge committed
             	setverdict(inconc);   
            }
        }
        unmap(p_ptcCam:camPort);
berge's avatar
berge committed
    } // end f_ptcCamDown
fischer's avatar
fischer committed
} // end of configuration
fischer's avatar
fischer committed

group externalFunctions {
    
	/**
	*	@desc 	Generate a timestamp of the cureent time to be used in a generationTime field
	* @return 	TimeStamp<br>
	*/
	external function fx_generateTime()
	return TimeStamp;

	/* @desc	Wrapper function for fx_generateTime
	 *			If external function returns FncRetCode "e_error" Test execution stops
	 *			
	 * @see		xf_generateTime
	 * @see		FncRetCode
	 *
	*/
	function f_generateTime()
	return TimeStamp {
		//Variables
		var TimeStamp v_generationTime:=0;
		
        v_generationTime := fx_generateTime();
        if (v_generationTime!=0)
        {
            return v_generationTime ;
			log("**** f_generateTime: INFO: OK - generationTime = " & int2str(v_generationTime) & " ****");
		}
		else {
			log("**** f_generateTime: ERROR: timestamp could not be generated ****");
			setverdict( inconc ) ;
			stop;
			f_postamble();
		} 

	} // end function f_triggerMsDsaReq_sf


} // end of externalFunctions

} // end LibItsCam_Functions