Question regarding mapping of components and parameters [message #1831224] |
Fri, 14 August 2020 03:48  |
Eclipse User |
|
|
|
Hello all,
I have the following problem implementing my test cases:
I want to map my communication port in some sub function called by the test case, but I do not find the correct way to do it. The structure looks like this:
30 testcase TC_SECC_ATB_001() runs on SEC_Tester system SystemSEC {
31
32 var verdicttype preConVerdict;
33
34 // -------------- Pre Conditions-------------------------------------------------------
35 preConVerdict := f_SEC_CMN_Setup_001();
36
37 //-------------- Test behavior---------------------------------------------------------
38 if(preConVerdict == pass) {
39 f_SEC_CMN_001();
40 }
41 else {
42 log("PreCondition was unsuccessful.");
43 }
44
45 //------------- Post Conditions--------------------------------------------------------
46 tc_CommunicationSetup_Timer.stop;
47 }
I want to map the port inside the function f_SEC_CMN_Setup_001(). When I try to do it with the system keyword, the compiler alerts "Cannot determine system component in `map' operation with `param' clause".
My workaround for that was to add the "systemSEC" clause and to provide system as parameter of type SystemSEC to the function and then map the port to that. This works, but the map parameters never make it to the port. user_map gets called, but without params. If I map the port directly to system in the testcase, everything works as intended.
I would be glad to receive some hints on how to do that. Maybe I'm also misunderstanding something fundamental about components and ports since TTCN is new to me.
Thank you and best regards,
Moritz
|
|
|
|
|
|
|
|
Re: Question regarding mapping of components and parameters [message #1831282 is a reply to message #1831279] |
Sun, 16 August 2020 09:17   |
Eclipse User |
|
|
|
I tried to test it, but the map param works from function for me.
See the small attached example. Can you try it?
You can check the generated code also.
Code generated for map without param:
Map_Params tmp_4(0);
TTCN_Runtime::map_port(self, CT_component_p1.get_name(), SYSTEM_COMPREF, "p2", tmp_4);
Code generated for map with param, see the set_param call:
Map_Params tmp_2(1);
tmp_2.set_param(0, ttcn_to_string(INTEGER(23)));
TTCN_Runtime::map_port(self, CT_component_p1.get_name(), SYSTEM_COMPREF, CTS_component_p2.get_name(), tmp_2);
|
|
|
|
|
|
|
|
|
|
|
|
Re: Question regarding mapping of components and parameters [message #1838676 is a reply to message #1831322] |
Wed, 03 March 2021 08:21   |
Eclipse User |
|
|
|
Hey all, sorry, to reopen this issue. I am now returning to this project.
In the referenced bug ticket the two bugs are reported as closed. My ttcn_compiler version is 7.2.pl0 and the bug seems to be still there (and extended).
I am now using the parallel runtime. The TTCN code is the following:
log("Going to pass ", vc_tcp_tls_parameter);
map(self:pt_TCP_TLS_SEC_Port, system:pt_TCP_TLS_SEC_Port)
param (vc_tcp_tls_parameter);
and the generated C code is the following:
Map_Params tmp_6(0);
TTCN_Runtime::map_port(self, ComponentsAndPorts::SEC__Tester_component_pt__TCP__TLS__SEC__Port.get_name(), SYSTEM_COMPREF, ComponentsAndPorts::SystemSEC_component_pt__TCP__TLS__SEC__Port.get_name(), tmp_6);
I am not able to receive the parameter in the port, despite using the self (or the mtc, too) component.
BR,
Moritz
[Updated on: Wed, 03 March 2021 08:23] by Moderator
|
|
|
|
|
Re: Question regarding mapping of components and parameters [message #1838894 is a reply to message #1838893] |
Mon, 08 March 2021 07:09  |
Eclipse User |
|
|
|
Yes, according to the standard:
"The map operation provides an optional parameter list for configuration purposes. This allows to pass values needed for dynamic runtime configuration. If a parameter list is present, the actual parameters shall conform to the map param clause of the port type declaration of the system port used."
|
|
|
Powered by
FUDForum. Page generated in 0.06309 seconds