Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » ASN.1 messsage send/recv through UDP test port(ASN.1 recv problem)
ASN.1 messsage send/recv through UDP test port [message #1751353] Mon, 09 January 2017 10:22 Go to next message
Dae-young Kim is currently offline Dae-young KimFriend
Messages: 7
Registered: December 2016
Junior Member
Embarrassed
Hi all!~
These days, I am trying to send/recv ASN.1 message using UDP test port but it seems that there is problem in receiving ASN.1 message, especially in matching procedure.
( ASN.1 example code from ttcn-3.org was used)

You can find the attachment including code and log.
It is difficult to debug and find the cause....Is there anyone who can help me?



Re: ASN.1 messsage send/recv through UDP test port [message #1751483 is a reply to message #1751353] Tue, 10 January 2017 17:06 Go to previous messageGo to next message
Gyorgy Rethy is currently offline Gyorgy RethyFriend
Messages: 23
Registered: April 2015
Junior Member
Hi Dae-young,

It doesn't seem to do with matching. Your modifications in the test port fails, the event handler doesn't seem to put the received message to the receiving port's queue. In the log file @19:05:19.182518 I can see the last log from the Event Handler is "The remote address: ...", but I cannot see "leaving UDPasp__PT::Event_Handler()" (line 231 in UDPasp_PT.cc).

The problem seems to be that you are sending a message without encoding it. In the original UDPasp_Types.ttcn you can see that the data field of ASP_UDP_message is octetstring. I.e. the test port originally expects an encoded message in the data field of the outgoing_send(const UDPasp__Types::ASP__UDP__message& send_par) test port function's parameter. This is not a must, you can encode the data field of your ASP_UDP_ASN1message type in the test port as well, e.g. by calling Titan's built-in BER codec. And in the Event Handler you need to decode the data field into the Types::Message type before putting it into the port queue. You can find more information about using built-in codecs in Titan's API guide (apiguide.pdf).

As a hint, you should also check using dual-faced ports for message encoding and decoding with automatic generation of encoder/decoder functions (see clause 4.22 of the Titan Ref. guide referenceguide.pdf); this feature has been developed exactly for this purpose: you can pass your ASP_UDP_ASN1message to a dual-faced port, it will call the identified function implicitly (which should encode the data field and leave the other fields untouched) and pass on the value returned by the function to the test port; in the receiving direction the opposite process shall be done, i.e. a function decoding the data field need to be identified. This way the original UDP test port, carrying an octetstring payload can be used without changing it. You can find useful examples in clauses 4.22.4.2 and in clause 4.22.9 (following the BNF syntax).
Re: ASN.1 messsage send/recv through UDP test port [message #1751502 is a reply to message #1751483] Tue, 10 January 2017 20:19 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 807
Registered: January 2015
Senior Member
Hi Dae-young,

as Gyorgy said, the problem is that your messages , as usual, should be encoded in binary form before they are fed to the port.

  type octetstring PDU_UDP;
 type record ASP_UDP_message{
	  PDU_UDP           data,
	  AddressType       remote_addr optional,
	  PortType          remote_port optional,
	  integer           id optional
  }


the payload is of type PDU_UDP which is an octetstring, a representation for binary data.


You have tried to hack the above by adding your ASN.1 message:

type record ASP_UDP_ASN1message{
	  Message			data,
	  AddressType       remote_addr optional,
	  PortType          remote_port optional,
	  integer           id optional
  }


but this is not permitted; the test port itself is still expecting an octetstring, hence the problems you have seen.

Before sending it to the UDP port , you need to encode it into binary, e.g. with a BER encoder autogenerated by Titan.

Attached you can see a working example, together with the generated logs.

The messages are enc/decoded with the below functions:

 external function encMessage(in Message pdu) return octetstring
   with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" };
  external function decMessage(in octetstring stream) return Message
  with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" };






Best regards

Elemer

[Updated on: Tue, 10 January 2017 20:23]

Report message to a moderator

Re: ASN.1 messsage send/recv through UDP test port [message #1751522 is a reply to message #1751483] Wed, 11 January 2017 07:01 Go to previous messageGo to next message
Dae-young Kim is currently offline Dae-young KimFriend
Messages: 7
Registered: December 2016
Junior Member
Hi György Réthy,
Thank you for your kind explanation. I came to know that UDP test port itself just send/recv octet string data. That data should have been enc/decoded with external function or built-in codec.
Regarding Dual-faced port, It will be very useful for automated enc/dec message.

Best regards,
Dae-young Kim
Re: ASN.1 messsage send/recv through UDP test port [message #1751523 is a reply to message #1751502] Wed, 11 January 2017 07:11 Go to previous messageGo to next message
Dae-young Kim is currently offline Dae-young KimFriend
Messages: 7
Registered: December 2016
Junior Member
Hi Elemer Lelik
I found that the example "Example of SNMP over UDP" have similar case which is sending ASN.1 over UDP.
Now, using this, I am struggling to make my own Dual-faced port but it currently does not work.

If I need to ask help, I will get back to here.
Thank you.
Re: ASN.1 messsage send/recv through UDP test port [message #1751527 is a reply to message #1751523] Wed, 11 January 2017 07:52 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 807
Registered: January 2015
Senior Member
Hi DAe-young,

dual-faced test ports are explained here : https://www.eclipse.org/forums/index.php/m/1736527/?srch=dual-faced#msg_1736527
also several examples posted in this forum are using dual-faced ports.

Best regards

Elemer


Re: ASN.1 messsage send/recv through UDP test port [message #1751547 is a reply to message #1751527] Wed, 11 January 2017 10:46 Go to previous messageGo to next message
Dae-young Kim is currently offline Dae-young KimFriend
Messages: 7
Registered: December 2016
Junior Member
Hi Elemer,

I have modified your "myUDPadv.ttcn" to add dual-faced port but it does not work...
it is difficult to understand ports configuration between components and system.

Could you check the the code and log. Also image what I understand about dual-faced port? What did I do wrong?

Best regards,
Dae-young Kim


Re: ASN.1 messsage send/recv through UDP test port [message #1751553 is a reply to message #1751547] Wed, 11 January 2017 12:11 Go to previous messageGo to next message
Gyorgy Rethy is currently offline Gyorgy RethyFriend
Messages: 23
Registered: April 2015
Junior Member
Hi Dae-young,

replace myUDPadv.ttcn in Elemér's PREVIUOS package with the attached file. It changed to use a dual-faced port; after correcting a few inconsistencies in my previous version of the file, the server returns the received message, the client matches it and the test cases passes.

Best Regards, Gyorgy

[Updated on: Wed, 11 January 2017 15:34]

Report message to a moderator

Re: ASN.1 messsage send/recv through UDP test port [message #1751554 is a reply to message #1751547] Wed, 11 January 2017 12:15 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 807
Registered: January 2015
Senior Member
Hi Dae-young,

You did not attach the log file;

I'm guessing you did not change in the config file
from

*.pt.mode := "advanced"
*.pt.debugging := "no"


to

*.pt2.mode := "advanced"
*.pt2.debugging := "no"


which means pt2 was started with default , which is "basic" mode;

I have attached the working example; only client side uses the dual-faced port;




Best regards
Elemer













Re: ASN.1 messsage send/recv through UDP test port [message #1751627 is a reply to message #1751553] Thu, 12 January 2017 03:32 Go to previous messageGo to next message
Dae-young Kim is currently offline Dae-young KimFriend
Messages: 7
Registered: December 2016
Junior Member
Hi György,
Thank you for your check.
I am getting used to dual-faced port but I wonder how the component port act with system port by map().
Seeing your code, there is no declaration of system port - DevUDPPort, ServUDPPort.
How could it work? it is mysterious.
Re: ASN.1 messsage send/recv through UDP test port [message #1751629 is a reply to message #1751554] Thu, 12 January 2017 05:43 Go to previous messageGo to next message
Dae-young Kim is currently offline Dae-young KimFriend
Messages: 7
Registered: December 2016
Junior Member
Hi Elemer,
I am sorry I have missed log file.
Compared to György's code, you explicitly declared two types of system ports.
One is 'UDPasp_PT' and the other one is 'Dual_faced_internal_pt'. Also, client and server component have both. As I understand, these have mapping like below.

client((pt2)) ---> system((pt1)) --->((pt1))server
client((pt2)) <--- system((pt2)) <---((pt1))server
( let's call 'UDPasp_PT' as 'pt1' and 'Dual_faced_internal_pt' as 'pt2')

When client send something via (pt2) , it implicitly uses (pt1). System (pt1) will forward it to server.
After server received something via (pt1), server will send it to system (pt2).
At sytem (pt2) , 'ASP_UDP_message' will be converted to 'Message" and then sent to client(pt2).

I wonder whether this is right. Regarding role of system port, this is ambiguous point. Several reference documents explains that Test System communicate with SUT via system ports. How does system port work in my test scenario? Is it possible to check at C/C++ code level?




Re: ASN.1 messsage send/recv through UDP test port [message #1751646 is a reply to message #1751629] Thu, 12 January 2017 08:34 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 807
Registered: January 2015
Senior Member
Hi Dae-young,

sorry , I have created the confusion myself; what I intended to write was:


type component UDPDeviceTesterInterface
{

	port UDPasp_PT ServUDPPort;
        port Dual_faced_internal_pt DevUDPPort;

}


to express that client side uses dual-faced, while server side the simple UDP port.

Truth is, the system declaration does not affect the functionality (at least in Titan implementation ) and as such, is optional. It works equally well without it, or if it's messed up, like I did.

The reason I personally prefer to have it is that it offers a quick overview
of the SUT ports used (well, if it's done correctly). It may not matter much
for two ports, but when you have a complex set-up, with many components and ports/port arrays, it can get confusing.


The components in this case have two ports declared, but only one is used.

So mapping is like: client(pt2) ------dual faced port upper part ---dual faced port lower part ----server (pt1)

I hope this will clear the confusion


Best regards
Elemer

Re: ASN.1 messsage send/recv through UDP test port [message #1751734 is a reply to message #1751646] Fri, 13 January 2017 09:18 Go to previous message
Dae-young Kim is currently offline Dae-young KimFriend
Messages: 7
Registered: December 2016
Junior Member
Hi Elemer,
You make me clear Smile Thank you for the answer.

Best regards,
Daeyoung Kim

Previous Topic:Architecture and speed
Next Topic:New products published in the Titan toolbox
Goto Forum:
  


Current Time: Wed Sep 26 14:14:53 GMT 2018

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

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

Back to the top