Module parameters in Eclipse Titan [message #1732796] |
Thu, 19 May 2016 22:56  |
Eclipse User |
|
|
|
Dear all,
according to the standard:
"Module parameters define a set of values that are supplied by the test environment at runtime. Module parameters do
not change their value during test execution."
So module parameters can be used to define the dataset with which the system is initialized; in a way they act as constants, but , unlike constants, they receive their values during runtime.
They can be declared group-style:
module A
{
modulepar {
charstring tsp_RemoteHostName := "www.somehost.com";
integer tsp_HttpPort := 80;
charstring tsp_LocalHostName := "10.10.10.157";
integer tsp_LocalHttpPort := 9998;
}
:
:
:
}//endmodule
or individually:
module A
{
modulepar charstring tsp_HostName:="www.somehost.com";
modulepar integer tsp_HttpPort := 80;
modulepar charstring tsp_LocalHostName:="10.10.10.157";
modulepar integer tsp_LocalHttpPort := 9998;
:
:
:
}//endmodule
and they can have default values (as above) but this is not mandatory:
module A
{
modulepar {
charstring tsp_RemoteHostName;
integer tsp_HttpPort;
charstring tsp_LocalHostName;
integer tsp_LocalHttpPort;
}
:
:
:
}//endmodule
The requirement that they receive their values runtime means that at compile-time their value is not necessarily known; in Titan, at the start of execution,
the [MODULE_PARAMETERS] section of the referred configuation file is read and the module parameters are initialized with the values in the config file.
If a declared module parameter is absent in the config file , the original declarations will be used; if a default value was declared, that one will take effect;
if no default value was declared , the parameter will become unbound, which is usually not a good idea, and will likely cause problems during execution.
If a parameter is present in the config file , its' default value will be overwritten. If no default value was declared, the new value from the config file will be used.
This mechanism permits quickly changing the module parameter values without the need of recompiling.
A possible config file section for the above declarations is shown below:
A.cfg
:
:
[MODULE_PARAMETERS]
A.tsp_RemoteHostName := "www.somehost.com";
A.tsp_HttpPort := 80;
A.tsp_LocalHostName := "10.10.10.157";
A.tsp_LocalHttpPort := 9998;
:
:
So what should be declared as a module parameter and not a constant?
Typically environment and protocol related parameters that should be easily adaptable
( PICS and PIXITs for example in conformance tests) without recompiling the test suite.
Best regards
Elemer
|
|
|
Re: Module parameters in Eclipse Titan [message #1732802 is a reply to message #1732796] |
Fri, 20 May 2016 06:27  |
Eclipse User |
|
|
|
A useful addition to the Titan runtime parameterization topic. Parameter values need not be only literal values.
It is worth to read clause 7.4 of Titan's Programmers' Technical Reference Guide(referenceguide.pdf) about the [DEFINE] section. It allows using system environment variables in runtime configuration files (thus allowing some level of automation of the configuration) and to define local macros.
The latter is especially useful if a parameter value has to be used at several places, e.g. a remote IP address and/or port number shall be used as module parameter and test port parameter at the same time. Using local macros makes runtime configuration more convenient and maintainable, as the concrete value need to be entered only once.
|
|
|
Powered by
FUDForum. Page generated in 0.03794 seconds