Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Dual-faced IPL4 test port in UDP mode(Another SNMP over UDP example)
Dual-faced IPL4 test port in UDP mode [message #1716133] Tue, 01 December 2015 15:47 Go to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
In https://www.eclipse.org/forums/index.php/t/1070600/, we have shown how the IPL4 test port can be used in TCP mode;
In the earlier topic https://www.eclipse.org/forums/index.php/t/1068184/ an example of SNMP over UDP was given;
This topic can be considered a hybrid of the two: it's an SNMP example over an IPL4 test port used in UDP mode.

Functionally the code is equivalent to the one in the earlier SNMP example. The IPL4 test port is used in dual-faced mode, that is it accepts SNMP in-out messages on the northern interface,
and UDP structures on the southern interface.

The corresponding declaration is:

type port SNMP_IPL4_PT message  //DualFace port
{
 out 
     SNMPv1_Message,
     SNMPv2_Message,
     SNMPv3_Message       
 in      
     SNMPv1_Message,
     SNMPv2_Message,
     SNMPv3_Message,
     ASP_Event          
}with 
{ extension 
   "user IPL4asp_PT
      out(
        SNMPv1_Message -> ASP_Send: function(f_enc_SNMPv1_DualFace);
        SNMPv2_Message -> ASP_Send: function(f_enc_SNMPv2_DualFace);
        SNMPv3_Message -> ASP_Send: function(f_enc_SNMPv3_DualFace)	
    )    
      in(
        ASP_RecvFrom -> SNMPv1_Message : function(f_dec_SNMPv1_DualFace),
	                SNMPv2_Message : function(f_dec_SNMPv2_DualFace),
	                SNMPv3_Message : function(f_dec_SNMPv3_DualFace);
        ASP_Event -> ASP_Event : simple
    )
   " 
}


The initialization of the test port in UDP mode is done with:

// pl_conn_Id should be -1 when used initially and later the connId returned in vl_result.connId
function f_Test_openConnection(in ConnectionParams pl_connectionParams, integer pl_connId)
runs on Test_SNMP_CT return integer
{
   var Socket_API_Definitions.Result vl_result;
   vl_result := IPL4asp_User_CtrlFunct.f_IPL4_connect(IPL4_PCO_DualFace,
     pl_connectionParams.remHost,
     pl_connectionParams.remPort,
     pl_connectionParams.locHost,
     pl_connectionParams.locPort,
     pl_connId, //pl_connectionParams.connId,
     {udp := {}}    
  );
  log(vl_result)
  return(vl_result.connId)
}



This function is called at the very beginning of the test case:



testcase tc_SNMP_1()runs on Test_SNMP_CT
{

:
 
  map(self:IPL4_PCO_DualFace, system:IPL4_PCO_DualFace);
  var integer v_connId := f_Test_openConnection(tsp_connectionParams,-1);  
  


and the initialization parameters are given as module parameters:

  modulepar {    
    ConnectionParams tsp_connectionParams := {"127.0.0.1", 25000, "127.0.0.1", 35000};   
  }
    


After unpacking the attached code, we can build
  
cd bin
make

and execute it with :

ttcn3_start ./SNMP SNMP_demo.cfg



The generated log will contain details of message sending and receiving over UDP.

Important to remember is that the IPL4 test port can be configured to be used in TCP, UDP or SCTP mode so in some cases can be a useful alternative to using dedicated TCP or UDP ports.


Best regards

Elemer

  • Attachment: SNMP_IPL4.tgz
    (Size: 268.46KB, Downloaded 153 times)
Re: Dual-faced IPL4 test port in UDP mode [message #1716829 is a reply to message #1716133] Tue, 08 December 2015 12:43 Go to previous messageGo to next message
Gustavo Gonnet is currently offline Gustavo GonnetFriend
Messages: 36
Registered: October 2015
Location: Montreal, Quebec, Canada
Member
interesting article, Elemer!
Re: Dual-faced IPL4 test port in UDP mode [message #1716891 is a reply to message #1716829] Tue, 08 December 2015 21:37 Go to previous message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Smile

Thanks, Gustavo!
Previous Topic:Port for WinPcap
Next Topic:Error in encvalue while compiling TTCN
Goto Forum:
  


Current Time: Thu Apr 25 17:24:58 GMT 2024

Powered by FUDForum. Page generated in 0.03760 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top