Module parameters in Eclipse Titan [message #1732796] |
Fri, 20 May 2016 02:56 |
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.02943 seconds