Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Module parameters in Eclipse Titan
Module parameters in Eclipse Titan [message #1732796] Fri, 20 May 2016 02:56 Go to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
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	:= "";
  integer     tsp_HttpPort    		:= 80;
  charstring  tsp_LocalHostName		:= "";
  integer     tsp_LocalHttpPort    	:= 9998;



or individually:
module A


  modulepar charstring  tsp_HostName:="";
  modulepar integer     tsp_HttpPort    := 80;

  modulepar charstring  tsp_LocalHostName:="";
  modulepar integer     tsp_LocalHttpPort    := 9998;



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;



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.tsp_RemoteHostName	:= "";
A.tsp_HttpPort    		:= 80;
A.tsp_LocalHostName		:= "";
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


Re: Module parameters in Eclipse Titan [message #1732802 is a reply to message #1732796] Fri, 20 May 2016 10:27 Go to previous message
Gyorgy Rethy is currently offline Gyorgy RethyFriend
Messages: 30
Registered: April 2015
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.
Previous Topic:XML encoding in TTCN-3 and Titan part II: example
Next Topic:Test and Validation
Goto Forum:

Current Time: Fri May 27 22:42:32 GMT 2022

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

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

Back to the top