Commit 88eb3ec6 authored by pintar's avatar pintar
Browse files

functions are defined:

-receiveDiameter
-sendDiameter
-preambleServer
-preambleClient
parent d218ff0b
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -24,8 +24,15 @@ module LibDiameter_Interface
      port 	DiameterPort DIAMP;
      
	  //TODO global variables have to be defined
	  var charstring vc_ETS_address := ""; //TODO define PIXIT
      var integer vc_ETS_port		:= 0;  //TODO define PIXIT
      var charstring vc_SUT_address := ""; //TODO define PIXIT
      var integer vc_SUT_port 		:= 0;  //TODO define PIXIT
      var integer vc_ETS_conn		:= 0;  //TODO make check if this global variable is zero than connection not available
      var DIAMETER_MSG vc_pdu ;
	    
      //TODO general timers have to be defined
      timer tc_wait  := 5.0;  //TODO define PIXIT if needed
  		
      //TODO  indicators set/used parameter status or state handling in default have to be defined

+127 −0
Original line number Diff line number Diff line
/**
 *	@author 	STF 434
 *  @version    $Id:$
 *	@desc		This module provides functions used in DIAMETER
 */

module LibDiameter_Steps
{	
	//LibCommon 
	import from LibCommon_Sync all ;
	import from LibCommon_VerdictControl all ;
	//LibSip
	import from LibDiameter_TypesAndValues all;
	import from LibDiameter_Templates all;
	import from LibDiameter_Interface all;
	
group AwaitingMessage {
 
	/**
	* 
	* @desc receive DIAMETER MESSAGE message
	* @param p_diameterMSG template of the message to be received
	*/
	function f_receive(in template DIAMETER_MSG p_diameterMSG) runs on DiameterComponent
	{
		var Lower_Layer_Primitive v_MSG;
     
		tc_wait.start;
		alt
		{
        	[]DIAMP.receive	(mw_llp_dataIndication(vc_ETS_conn, p_diameterMSG)) -> value v_MSG
        	  {
        		tc_wait.stop;
        		//TODO store received params
        		vc_pdu := v_MSG.pdu;
        	  }
		}		
	} // end f_receive
	
} // end AwaitingMessage

group SendMessage {
	
	/**
	* 
	* @desc  send DIAMETER MESSAGE message
	* @param p_diameterMSG template of the message to be sent
	*/	
	function f_send(template DIAMETER_MSG p_diameterMSG) runs on DiameterComponent
	{
	    
		DIAMP.send(m_llp_dataRequest(vc_ETS_conn, p_diameterMSG));	  
	}
		

} // end SendMessage

group GlobalSteps {
//TODO
}// end group GlobalSteps


group Preambles {
	
    /**
    * 
    * @desc  preamble for Client(AS - IMS) side
    * @param 
    */	
    function f_preambleClient() runs on DiameterComponent
    {
        DIAMP.send(m_llp_connect(vc_ETS_address, vc_ETS_port, vc_SUT_address, vc_SUT_port, vc_ETS_conn));
        tc_wait.start;
        alt
        {
            [] DIAMP.receive	(mw_llp_disconnectIndication(vc_ETS_conn))
              {
                tc_wait.stop;
                log("Connection NOT established");
                setverdict (fail);
              };
            [] tc_wait.timeout
              {
                log("Connection established");
              }
        }   
    }
	
    /**
    * 
    * @desc  preamble for Server (PCRF) side
    * @param 
    */	
    function f_preambleServer() runs on DiameterComponent
    {
        DIAMP.send(m_llp_listen(vc_ETS_address, vc_ETS_port, vc_SUT_address, vc_SUT_port));
        tc_wait.start;
        alt
        {
            [] DIAMP.receive	(mw_llp_connectIndication(*,*,*,*,*))
              {
                tc_wait.stop;
                log("Connection established");
              };
            [] tc_wait.timeout
              {
                log("Connection NOT established");
                setverdict (fail);
              }
        }  	  
    }
    	
}// end group Preambles

group Postambles {
//TODO
} // end group Postambles

group DiameterChecks
{
}//end group DiameterChecks

group DefaultsTestStep
{
 //TODO   	
} // end of group DefaultsTestStep
} // end module LibSip_Steps
 No newline at end of file
+20 −20
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@ module LibDiameter_Templates {
    
    group LowerLayerPrimitives {
        
        template Lower_Layer_Primitive m_llp_listen(template charstring p_ETS_address, template integer p_ETS_port, template charstring p_SUT_address, template integer p_SUT_port, template integer p_ETS_conn) := {
          ll_header := m_llh_listen(p_ETS_address, p_ETS_port, p_SUT_address, p_SUT_port, p_ETS_conn),
        template Lower_Layer_Primitive m_llp_listen(template charstring p_ETS_address, template integer p_ETS_port, template charstring p_SUT_address, template integer p_SUT_port) := {
          ll_header := m_llh_listen(p_ETS_address, p_ETS_port, p_SUT_address, p_SUT_port),
          pdu := omit
        }
        
@@ -37,34 +37,34 @@ module LibDiameter_Templates {
          pdu := *
        }
        
        template Lower_Layer_Primitive m_llp_disconnect(template charstring p_ETS_address, template integer p_ETS_port, template charstring p_SUT_address, template integer p_SUT_port, template integer p_ETS_conn) := {
          ll_header := m_llh_disconnect(p_ETS_address, p_ETS_port, p_SUT_address, p_SUT_port, p_ETS_conn),
        template Lower_Layer_Primitive m_llp_disconnect(template integer p_ETS_conn) := {
          ll_header := m_llh_disconnect(p_ETS_conn),
          pdu := omit
        }
        
        template Lower_Layer_Primitive mw_llp_disconnectIndication(template charstring p_ETS_address,  template integer p_ETS_port, template charstring p_SUT_address, template integer p_SUT_port, template integer p_ETS_conn) := {
          ll_header := mw_llh_disconnectIndication(p_ETS_address, p_ETS_port, p_SUT_address, p_SUT_port, p_ETS_conn),
        template Lower_Layer_Primitive mw_llp_disconnectIndication(template integer p_ETS_conn) := {
          ll_header := mw_llh_disconnectIndication(p_ETS_conn),
          pdu := *
        }
                
        template Lower_Layer_Primitive m_llp_dataRequest( template integer p_ETS_conn, template DIAMETER_MSG p_pdu) := {
          ll_header := m_llh_dataRequest(p_ETS_conn),  //TODO: p_ETS_conn shall be declared as vc_ETS_conn with value 1
          ll_header := m_llh_dataRequest(p_ETS_conn),
          pdu := p_pdu
        }
                
        template Lower_Layer_Primitive m_llp_dataIndication(template integer p_ETS_conn, template DIAMETER_MSG p_pdu) := {
        template Lower_Layer_Primitive mw_llp_dataIndication(template integer p_ETS_conn, template DIAMETER_MSG p_pdu) := {
          ll_header := mw_llh_dataIndication(p_ETS_conn),
          pdu := p_pdu
        }
        
        template Lower_Layer_Header m_llh_listen(template charstring p_ETS_address, template integer p_ETS_port, template charstring p_SUT_address, template integer p_SUT_port, template integer p_ETS_conn) := {
        template Lower_Layer_Header m_llh_listen(template charstring p_ETS_address, template integer p_ETS_port, template charstring p_SUT_address, template integer p_SUT_port) := {
          primitive := LISTEN_REQUEST_E,
          transport_used := c_defaultTransportProtocol,
          ETS_address := p_ETS_address,
          ETS_port := p_ETS_port,
          SUT_address := p_SUT_address,
          SUT_port := p_SUT_port,
          ETS_conn := p_ETS_conn
          ETS_conn := omit
        }
        
        template Lower_Layer_Header m_llh_connect(template charstring p_ETS_address, template integer p_ETS_port, template charstring p_SUT_address, template integer p_SUT_port, template integer p_ETS_conn) := {
@@ -87,23 +87,23 @@ module LibDiameter_Templates {
          ETS_conn := p_ETS_conn
        }
        
        template Lower_Layer_Header m_llh_disconnect(template charstring p_ETS_address, template integer p_ETS_port, template charstring p_SUT_address, template integer p_SUT_port, template integer p_ETS_conn) := {
        template Lower_Layer_Header m_llh_disconnect(template integer p_ETS_conn) := {
          primitive := DISCONNECT_REQUEST_E,
          transport_used := c_defaultTransportProtocol,
          ETS_address := p_ETS_address,
          ETS_port := p_ETS_port,
          SUT_address := p_SUT_address,
          SUT_port := p_SUT_port,
          ETS_address := omit,
          ETS_port := omit,
          SUT_address := omit,
          SUT_port := omit,
          ETS_conn := p_ETS_conn
        }
        
        template Lower_Layer_Header mw_llh_disconnectIndication(template charstring p_ETS_address, template integer p_ETS_port, template charstring p_SUT_address, template integer p_SUT_port, template  integer p_ETS_conn) := {
        template Lower_Layer_Header mw_llh_disconnectIndication(template integer p_ETS_conn) := {
          primitive := DISCONNECT_INDICATION_E,
          transport_used := c_defaultTransportProtocol,
          ETS_address := p_ETS_address,
          ETS_port := p_ETS_port,
          SUT_address := p_SUT_address,
          SUT_port := p_SUT_port,
          ETS_address := *,
          ETS_port := *,
          SUT_address := *,
          SUT_port := *,
          ETS_conn := p_ETS_conn
        }