Commit 7f078dd8 authored by juvancic's avatar juvancic
Browse files

updated due to functions definitions

parent f9614239
Loading
Loading
Loading
Loading
+225 −25
Original line number Diff line number Diff line
@@ -9,33 +9,109 @@ module LibDiameter_Steps
	//LibCommon 
	import from LibCommon_Sync all ;
	import from LibCommon_VerdictControl all ;
	//LibSip
	//LibDiameter
	import from LibDiameter_TypesAndValues all;
	import from LibDiameter_Templates all;
	import from LibDiameter_Interface all;
	import from LibDiameter_PIXITS all;

group CommonFunctions{

    /**
    * 
    * @desc  f_gtZero, return true if value of p_int greater than 0
    * @param p_int - integer value
    */	
    function f_gtZero(integer p_int)
    return boolean
    {
        if (p_int > 0){
            return true;
        }
        else{
            return false;
        }
    }

}//end group CommonFunctions
	
group AwaitingMessage {
 
	/**
	* 
	* @desc receive DIAMETER MESSAGE message
	* @desc receive DIAMETER message
	* @param p_diameterMSG template of the message to be received
	*/
	function f_receive(in template DIAMETER_MSG p_diameterMSG) runs on DiameterComponent
	function f_awaitingDiameterMsg(in template DIAMETER_MSG p_diameterMSG) runs on DiameterComponent
	{
		var Lower_Layer_Primitive v_MSG;
		//var Lower_Layer_Primitive v_MSG;
        var DIAMETER_MSG v_MSG;
		
        if (PX_DIAM_LLP_ENABLED and f_gtZero(vc_ETS_conn))
        {
    		tc_wait.start;
    		alt
    		{
            	[]DIAMP.receive	(p_diameterMSG) -> value v_MSG
            	  {
            		tc_wait.stop;
            		//TODO store received params
                    vc_recvDiamMsg := v_MSG;
            	  }
    		}
        }
        else
        {
            tc_wait.start;
            alt
            {
        	[]LLPP.receive	(mw_llp_dataIndication(vc_ETS_conn, p_diameterMSG)) -> value v_MSG
                []DIAMP.receive	(p_diameterMSG) -> value v_MSG
                  {
                    tc_wait.stop;
                    //TODO store received params
        		vc_pdu := v_MSG.pdu;
                    vc_recvDiamMsg := v_MSG;
                  }
            }
        }			
	} // end f_receive
	} // end f_awaitingDiameterMsg
	
    function f_awaiting_CER(template (present)CER_MSG p_CER) runs on DiameterComponent
    {
        f_awaitingDiameterMsg({cER_MSG:=p_CER});
		//store specific parameter for CER if needed
    }
    
    function f_awaiting_CEA(template (present)CEA_MSG p_CEA) runs on DiameterComponent
    {
        f_awaitingDiameterMsg({cEA_MSG:=p_CEA});
        //store specific parameter for CER if needed
    }
    
    function f_awaiting_DWR(template (present)DWR_MSG p_DWR) runs on DiameterComponent
    {
        f_awaitingDiameterMsg({dWR_MSG:=p_DWR});
        //store specific parameter for DWR if needed
    }
    
    function f_awaiting_DWA(template (present)DWA_MSG p_DWA) runs on DiameterComponent
    {
        f_awaitingDiameterMsg({dWA_MSG:=p_DWA});
        //store specific parameter for DWA if needed
    }
 
    function f_awaiting_DPR(template (present)DPR_MSG p_DPR) runs on DiameterComponent
    {
        f_awaitingDiameterMsg({dPR_MSG:=p_DPR});
        //store specific parameter for DPR if needed
    }
    
    function f_awaiting_DPA(template (present)DPA_MSG p_DPA) runs on DiameterComponent
    {
        f_awaitingDiameterMsg({dPA_MSG:=p_DPA});
        //store specific parameter for DPA if needed
    }
     
	//TODO define await functions for other messages
	
} // end AwaitingMessage

@@ -43,20 +119,74 @@ group SendMessage {
	
	/**
	* 
	* @desc  send DIAMETER MESSAGE message
	* @desc  send DIAMETER message
	* @param p_diameterMSG template of the message to be sent
	*/	
	function f_send(template DIAMETER_MSG p_diameterMSG) runs on DiameterComponent
	function f_sendDiameterMsg(template DIAMETER_MSG p_diameterMSG) runs on DiameterComponent
	{
        if (PX_DIAM_LLP_ENABLED)
        {
            if(f_gtZero(vc_ETS_conn))
            {
		        DIAMP.send( p_diameterMSG);
		    }
		    else
		    {
                log("Please check configuration!!! Send of DIAMETER message unsucessfull!");
                setverdict (inconc);
		    }
        }
        else 
        {
            DIAMP.send( p_diameterMSG);
        }	
    }//end f_sendDiameterMsg  
        
    function f_send_CER(template CER_MSG p_CER) runs on DiameterComponent
    {
        //set specific parameter for CER if needed
        f_sendDiameterMsg({cER_MSG:=p_CER});
    }  
    
    function f_send_CEA(template CEA_MSG p_CEA) runs on DiameterComponent
    {
        //set specific parameter for CEA if needed
        f_sendDiameterMsg({cEA_MSG:=p_CEA});
    }
    
    function f_send_DWR(template DWR_MSG p_DWR) runs on DiameterComponent
    {
        //set specific parameter for DWR if needed
        f_sendDiameterMsg({dWR_MSG:=p_DWR});
    }
    
    function f_send_DWA(template DWA_MSG p_DWA) runs on DiameterComponent
    {
        //set specific parameter for DWA if needed
        f_sendDiameterMsg({dWA_MSG:=p_DWA});
    }
    
		LLPP.send(m_llp_dataRequest(vc_ETS_conn, p_diameterMSG));	  
    function f_send_DPR(template DPR_MSG p_DPR) runs on DiameterComponent
    {
        //set specific parameter for DPR if needed
        f_sendDiameterMsg({dPR_MSG:=p_DPR});
    }
    
    function f_send_DPA(template DPA_MSG p_DPA) runs on DiameterComponent
    {
        //set specific parameter for DPA if needed
        f_sendDiameterMsg({dPA_MSG:=p_DPA});
    }
    
        
	//TODO define send functions for other messages
		

} // end SendMessage

group GlobalSteps {
//TODO
    

}// end group GlobalSteps


@@ -71,7 +201,7 @@ group Preambles {
    {
        var Lower_Layer_Primitive v_MSG;
        
        vc_ETS_conn:=1; // init connection ID, or even better random for each component
        //vc_ETS_conn:=1; // init connection ID, or even better random for each component
        
        LLPP.send(m_llp_connect(vc_ETS_address, vc_ETS_port, vc_SUT_address, vc_SUT_port,vc_ETS_conn));
        tc_wait.start;
@@ -81,6 +211,7 @@ group Preambles {
            [] LLPP.receive	(mw_llp_connectConfirm(vc_ETS_address, vc_ETS_port, vc_SUT_address, vc_SUT_port,vc_ETS_conn)) -> value v_MSG
              {
                tc_wait.stop;
                vc_ETS_conn:=v_MSG.ll_header.ETS_conn;
                log("Connection established");
              };
            
@@ -127,6 +258,40 @@ group Preambles {
        }  	  
    }
    
    group preamble_Diameter{
        
        function f_preamble_AF() runs on DiameterComponent
        {
            if(PX_DIAM_LLP_ENABLED)
            {
                f_preambleClient();
            }
    
            f_preambleDiameterBase();
        }
       
        function f_preamble_PCRF() runs on DiameterComponent
        {
            if(PX_DIAM_LLP_ENABLED)
            {
                f_preambleServer();
            }
            
            f_preambleDiameterBase();
        }
        
        function f_preambleDiameterBase()runs on DiameterComponent
        {
            //TODO define templates
 /*           f_send_CER(m_CER);
            f_awaiting_CEA(mw_CEA);
            f_send_DWR(m_DWR);
            f_awaiting_DWA(mw_DWA);*/
        }
    
    }//end group preamble_Diameter
					
    	
}// end group Preambles

group Postambles {
@@ -146,6 +311,41 @@ group Postambles {
        //stop;
        
    }
    group postamble_Diameter{
        
        
        function f_postamble_AF() runs on DiameterComponent
        {
            
            f_postambleDiameterBase();
            
            if(PX_DIAM_LLP_ENABLED)
            {
                f_postambleDisconnect();
            }
                        
        }
        
        function f_postamble_PCRF() runs on DiameterComponent
        {
            
            f_postambleDiameterBase();
            
            if(PX_DIAM_LLP_ENABLED)
            {
                f_postambleDisconnect();
            }
                        
        }
                
        function f_postambleDiameterBase()runs on DiameterComponent
        {
            //TODO define templates
            /*f_send_DPR(m_DPR);
            f_awaiting_DPA(mw_DPA);*/
        }
        
    }//end group postamble_Diameter
      
} // end group Postambles