blob: 9ef97a79bf450eae95a4536c9d636841938db17b [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2019 Ericsson Telecom AB //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v2.0 //
// which accompanies this distribution, and is available at //
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// Module: EPTF_CLL_LGenBase_ConfigFunctions
//
// Purpose:
// This module provides functions for configuration management in TitanSim
// load generators
//
// Module Parameters:
// -
//
// Module depends on:
// <EPTF_CLL_Base_Functions>
// <EPTF_CLL_Common_Definitions>
// <EPTF_CLL_HashMapStr2Int_Functions>
// <EPTF_CLL_HashMapInt2Int_Functions>
// <EPTF_CLL_LGenBase_ConfigDefinitions>
// <EPTF_CLL_LGenBase_Definitions>
// <EPTF_CLL_LGenBase_TemplateDefinitions>
// <EPTF_CLL_LGenBase_TemplateFunctions>
// <EPTF_CLL_LGenBaseTrafficMixer_Definitions>
// <EPTF_CLL_RBTScheduler_Functions>
// <EPTF_CLL_FBQ_Definitions all>
// <EPTF_CLL_FBQ_Functions all>
//
// Current Owner:
// ELSZSKU
//
// Last Review Date:
// 2008-
//
// Detailed Comments:
///////////////////////////////////////////////////////////
module EPTF_CLL_LGenBase_ConfigFunctions
{
import from EPTF_CLL_LGenBase_EventHandlingFunctions all;
//import from EPTF_CLL_LGenBase_TrafficFunctions all;
import from EPTF_CLL_Base_Functions all;
import from EPTF_CLL_Base_Definitions all;
import from EPTF_CLL_Common_Definitions all;
import from EPTF_CLL_HashMapStr2Int_Functions all;
import from EPTF_CLL_HashMapInt2Int_Functions all;
import from EPTF_CLL_LGenBase_ConfigDefinitions all;
import from EPTF_CLL_LGenBase_PhaseDefinitions all;
import from EPTF_CLL_LGenBase_PhaseConfigFunctions all
import from EPTF_CLL_LGenBase_Definitions all;
import from EPTF_CLL_LGenBase_LoggingFunctions all;
import from EPTF_CLL_LGenBaseTrafficMixer_Definitions all;
import from EPTF_CLL_RBTScheduler_Functions all;
import from EPTF_CLL_FBQ_Functions all;
import from EPTF_CLL_Variable_Definitions all;
import from EPTF_CLL_Variable_Functions all;
import from EPTF_CLL_StatHandlerClient_Functions all;
import from EPTF_CLL_Common_Functions all;
import from TCCFileIO_Functions all;
import from TCCConversion_Functions all;
friend module EPTF_CLL_LGenBase_EventHandlingFunctions; // f_EPTF_LGenBase_fsmTimerIdx
friend module EPTF_CLL_LGenBase_TrafficFunctions; // f_EPTF_LGenBase_getScNamePrefix, f_EPTF_LGenBase_areETypesCompatible, f_EPTF_LGenBaseStats_getTCName, f_EPTF_LGenBase_convertTrafficStartFinishConditionsInternalDeclarator2Desc, f_EPTF_LGenBase_convertEntityFinishConditionsInternalDeclarator2Desc, f_EPTF_LGenBase_convertTcEntityFinishActions2Desc, f_EPTF_LGenBase_convertGroupActionsList2GroupActionsDescList, f_EPTF_LGenBase_BurstFuncName2Char,
friend module EPTF_CLL_LGenBaseStats_Functions; // f_EPTF_LGenBase_getScNamePrefix
friend module EPTF_CLL_LGenBase_Functions; // f_EPTF_LGenBase_BurstFuncName2Char, f_EPTF_LGenBase_initEntityCtxs
friend module EPTF_CLL_ExecCtrl_ScenarioFunctions; // f_EPTF_LGenBase_convertScenarioTypeDeclarator2Internal
friend module EPTF_CLL_ExecCtrlClient_Functions; // f_EPTF_LGenBase_declareTrafficCaseTypeInternal, f_EPTF_LGenBase_declareScenarioTypeInternal
///////////////////////////////////////////////////////////
// Group: DeclaringMetadata
//
// Purpose:
// Functions to declare metadata for <EPTF_LGenBase_CT>
//
///////////////////////////////////////////////////////////
group DeclaringMetadata {
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_declareBehaviorType
//
// Purpose:
// EPTF_LGenBase behavior type declaration
//
// Parameters:
// pl_name - *in charstring * - behavior name
// pl_maxCount - *in integer * - number of bound-able behavior contexts
// pl_resetFn - *in EPTF_LGenBase_BehaviorContextHandler_FT * - behavior context reset function
// pl_bindFn - *in EPTF_LGenBase_BehaviorContextHandler_FT * - behavior context bind function
// pl_unbindFn - *in EPTF_LGenBase_BehaviorContextHandler_FT * - behavior context unbind function
//
// Return Value:
// *integer* - the resulted index of the just declared behavior type in the
// behavior type database
//
// Errors:
// -
//
// Detailed Comments:
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_declareBehaviorType(
in charstring pl_name,
in integer pl_maxCount,
in EPTF_LGenBase_BehaviorContextHandler_FT pl_resetFn,
in EPTF_LGenBase_BehaviorContextBinder_FT pl_bindFn,
in EPTF_LGenBase_BehaviorContextHandler_FT pl_unbindFn,
in EPTF_LGenBase_BehaviorContextBinder_FT pl_bindWithAbsIdxFn := null
)
runs on EPTF_LGenBase_Private_CT return integer{
if(-1 < f_EPTF_LGenBase_behaviorTypeNameIndex(pl_name)){
f_EPTF_LGenBase_loggingError(%definitionId&": The behavior type already exists : "&pl_name)
}
var integer vl_newIdx := sizeof(v_LGenBase_behaviorTypes);
v_LGenBase_behaviorTypes[vl_newIdx] := valueof(
t_LGenBase_BehaviorDeclaration(pl_name,pl_maxCount,pl_bindFn, pl_resetFn,pl_unbindFn,pl_bindWithAbsIdxFn));
f_EPTF_FBQ_initFreeBusyQueue(v_LGenBase_behaviorTypes[vl_newIdx].listeners);
v_LGenBase_testSteps[vl_newIdx]:={}
v_LGenBase_fsmEvents[vl_newIdx]:={}
v_LGenBase_behaviorTypes[vl_newIdx].behaviorOfEntityHashMap :=
f_EPTF_int2int_HashMap_New(c_EPTF_LGenBase_behaviorOfEntityListenerHashMapPrefix &pl_name);
v_LGenBase_behaviorTypes[vl_newIdx].behaviorOfSourceHashMap :=
f_EPTF_int2int_HashMap_New(c_EPTF_LGenBase_behaviorOfSourceListenerHashMapPrefix &pl_name);
f_EPTF_str2int_HashMap_Insert(v_LGenBase_behaviorHashMap, pl_name, vl_newIdx);
//Initialize the new behavior context of all the entities
var integer vl_iECount := sizeof(v_LGenBase_entities);
for ( var integer vl_i := 0; vl_i < vl_iECount ; vl_i := vl_i+1 )
{
v_LGenBase_entities[vl_i].bCtxList[vl_newIdx] := {};
}
return vl_newIdx;
}//f_EPTF_LGenBase_declareBehaviorType
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_declareStep
//
// Purpose:
// EPTF_LGenBase test step declaration
//
// Parameters:
// pl_bName - *in* *charstring* - name of the behavior
// pl_step - *in* <EPTF_LGenBase_TestStepDescriptor> - test step data
//
// Return Value:
// *integer* - the selected index of the just declared test step in the
// test step database
//
// Errors:
// -
//
// Detailed Comments:
// This function can be used tu declare test steps for the FSMs.
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_declareStep(
in charstring pl_bName,
in EPTF_LGenBase_TestStepDescriptor pl_step)
runs on EPTF_LGenBase_Private_CT return integer{
var integer vl_bIdx := f_EPTF_LGenBase_behaviorTypeNameIndex(pl_bName);
f_EPTF_Base_assert(%definitionId&": Invalid behavior type: "&pl_bName,-1!=vl_bIdx);
var integer vl_stepIdx := -1;
var integer vl_functionIdx := f_EPTF_LGenBase_declareFunction(pl_step.name, {testStepFunction := pl_step.step});
vl_stepIdx := sizeof(v_LGenBase_testSteps[vl_bIdx]);
v_LGenBase_testSteps[vl_bIdx][vl_stepIdx] := vl_functionIdx;//pl_step;
return vl_stepIdx;
}//f_EPTF_LGenBase_declareStep
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_declareFsmEvent
//
// Purpose:
// EPTF_LGenBase FSM input (event) declaration
//
// Parameters:
// pl_bName - *charstring* - registered behavior name. See <f_EPTF_LGenBase_declareBehaviorType>
// pl_input - *in* <EPTF_LGenBase_FsmEvent> - FSM input data
//
// Return Value:
// *integer* - the selected index of the FSM input in the
// FSM input database
//
// Errors:
// -
//
// Detailed Comments:
//
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_declareFsmEvent(
in charstring pl_bName,
in charstring pl_input,
in EPTF_LGenBase_LogEvent_FT pl_logFn := null
)
runs on EPTF_LGenBase_Private_CT return integer{
var integer vl_bIdx := f_EPTF_LGenBase_behaviorTypeNameIndex(pl_bName);
if(0 > vl_bIdx){
f_EPTF_LGenBase_loggingError(%definitionId&": Invalid behavior type: "&pl_bName);
}
var integer vl_i:= sizeof(v_LGenBase_fsmEvents[vl_bIdx]);
v_LGenBase_fsmEvents[vl_bIdx][vl_i] := {pl_input, pl_logFn};
if(-1 < f_EPTF_LGenBase_inputNameIndex(pl_bName, pl_input)){
f_EPTF_LGenBase_loggingError(%definitionId&": The event "&pl_input&" of behavior "&pl_bName&" has already been defined!")
}
f_EPTF_str2int_HashMap_Insert(v_LGenBase_fsmEventsBehaviorHashMap, pl_bName&tsp_LGenBase_nameSeparator&pl_input, vl_bIdx);
f_EPTF_str2int_HashMap_Insert(v_LGenBase_fsmEventsInputHashMap, pl_bName&tsp_LGenBase_nameSeparator&pl_input, vl_i);
v_LGenBase_genericEventListeners[vl_bIdx][vl_i] := c_EPTF_LGenBase_emptyListenerList;
f_EPTF_FBQ_initFreeBusyQueue(v_LGenBase_genericEventListeners[vl_bIdx][vl_i]);
v_LGenBase_genericTcListeners[vl_bIdx][vl_i] := c_EPTF_LGenBase_emptyListenerList;
f_EPTF_FBQ_initFreeBusyQueue(v_LGenBase_genericTcListeners[vl_bIdx][vl_i]);
v_LGenBase_entityTcListeners[vl_bIdx][vl_i] := c_EPTF_LGenBase_emptyListenerList;
f_EPTF_FBQ_initFreeBusyQueue(v_LGenBase_entityTcListeners[vl_bIdx][vl_i]);
v_LGenBase_behaviorTypes[vl_bIdx].entityListenerHashmapRefs[vl_i] := f_EPTF_int2int_HashMap_New(c_EPTF_LGenBase_entityListenerHashMapPrefix &pl_bName&tsp_LGenBase_nameSeparator&pl_input);
v_LGenBase_behaviorTypes[vl_bIdx].generalSourceListenerHashmapRefs[vl_i] := f_EPTF_int2int_HashMap_New(c_EPTF_LGenBase_generalSourceListenerHashMapPrefix &pl_bName&tsp_LGenBase_nameSeparator&pl_input);
return vl_i;
}//f_EPTF_LGenBase_declareFsmEvent
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_declareFsmEventList
//
// Purpose:
// EPTF_LGenBase FSM input (event) list declaration
//
// Parameters:
// pl_eventArray - list of event data (event constant, event name)
// pl_bName - *charstring* - registered behavior name. See <f_EPTF_LGenBase_declareBehaviorType>
//
//
// Errors:
// -
//
// Detailed Comments:
//
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_declareFsmEventList(
in EPTF_LGenBase_EventArrayDeclaratorList pl_eventArray,
in charstring pl_bName
)
runs on EPTF_LGenBase_Private_CT {
var integer vl_ret := 0;
for(var integer vl_i := 0; vl_i < sizeof(pl_eventArray); vl_i := vl_i+1){
vl_ret := f_EPTF_LGenBase_declareFsmEvent(pl_bName,pl_eventArray[vl_i].eventName);
f_EPTF_Base_assert(%definitionId&": "&pl_eventArray[vl_i].eventName&" must be "&int2str(pl_eventArray[vl_i].eventConstant),vl_ret == pl_eventArray[vl_i].eventConstant);
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_declareCompactFsmTable
//
// Purpose:
// FSM table declaration using direct fn. references to test steps.
//
// Parameters:
// pl_table - *in* <EPTF_LGenBase_CompactFsmTable> - FSM table data
//
// Return Value:
// *integer* - the selected index of the FSM table in the
// FSM table database
//
// Errors:
// -
//
// Detailed Comments:
//
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_declareCompactFsmTable(
in EPTF_LGenBase_CompactFsmTable pl_table)
runs on EPTF_LGenBase_Private_CT return integer{
if(-1 != f_EPTF_LGenBase_fsmNameIndex(pl_table.name)){
f_EPTF_LGenBase_loggingError(%definitionId&": The FSM table with name "&pl_table.name&" already exists.")
}
var integer t:= sizeof(v_LGenBase_fsmTables);
v_LGenBase_fsmTables[t] := c_EPTF_LGenBase_emptyInternalFsmTable;
v_LGenBase_fsmTables[t].name := pl_table.name;
f_EPTF_LGenBase_createFSMHashMaps(pl_table.name,v_LGenBase_fsmTables[t],false)
v_LGenBase_fsmTables[t].stateList := pl_table.stateList;
f_EPTF_LGenBase_appendTimerList(pl_table.timerList,v_LGenBase_fsmTables[t].timerList)
//Initialize the column index list
var EPTF_IntegerList vl_colIdxList := {}
for ( var integer vl_state := 0; vl_state < sizeof(pl_table.stateList) ; vl_state := vl_state+1 ){
vl_colIdxList[vl_state] := vl_state
}
for ( var integer vl_i := 0; vl_i < sizeof(pl_table.table) ; vl_i := vl_i+1 )
{
v_LGenBase_fsmTables[t].rows[vl_i].colIdxListByStates := vl_colIdxList
v_LGenBase_fsmTables[t].rows[vl_i].cellList := pl_table.table[vl_i].cellRow
v_LGenBase_fsmTables[t].eventXref[vl_i] := c_EPTF_LGenBase_emptyInternalFSMEvent2RowXref;
v_LGenBase_fsmTables[t].eventXref[vl_i].event2Listen := pl_table.table[vl_i].eventToListen
v_LGenBase_fsmTables[t].eventXref[vl_i].rowIdx := vl_i
}
//v_LGenBase_fsmTables[t].table := pl_table.table;
f_EPTF_LGenBase_CompactFsmTable_checkDuplicatedEventToListen(v_LGenBase_fsmTables[t]);
f_EPTF_LGenBase_fillEventsHasmaps(t,v_LGenBase_fsmTables[t].eventXref,-1,-1);
return t;
}//f_EPTF_LGenBase_declareCompactFsmTable
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_fillEventsHasmaps
//
// Purpose:
// Function for filling events hashmap
//
// Parameters:
// pl_t - *in* *integer* - index of the FSM table in the tables database
// pl_table - *in* <EPTF_LGenBase_InternalFsmTable> - FSM table data
//
// Return Value:
// -
// Errors:
// -
//
// Detailed Comments:
// -
///////////////////////////////////////////////////////////
friend function f_EPTF_LGenBase_fillEventsHasmaps(
in integer pl_tableIdx,
in EPTF_LGenBase_InternalFSMEvent2RowXrefList pl_eventXref,
in integer pl_tcIdx,
in integer pl_siblingIdx)
runs on EPTF_LGenBase_Private_CT{
//Do not build reftable if not FSM event
for (var integer vl_event:=0;vl_event<sizeof(pl_eventXref); vl_event:=vl_event+1) {
//Check whether the event type is FSM
if(fsm == pl_eventXref[vl_event].event2Listen.eventType)
{
var integer bIdx:=pl_eventXref[vl_event].event2Listen.bIdx;
var integer iIdx:=pl_eventXref[vl_event].event2Listen.iIdx;
if(bIdx < 0){
var integer vl_spbIdx := bIdx*-1
var integer vl_idx := 0
if(isbound(v_LGenBase_spEventFSMXrefs[vl_spbIdx][iIdx].singleFsm[pl_tableIdx])){
vl_idx := sizeof(v_LGenBase_spEventFSMXrefs[vl_spbIdx][iIdx].singleFsm[pl_tableIdx])
}else{
v_LGenBase_spEventFSMXrefs[vl_spbIdx][iIdx].fsmOfTc := {};
}
v_LGenBase_spEventFSMXrefs[vl_spbIdx][iIdx].singleFsm[pl_tableIdx][vl_idx]:= c_EPTF_LGenBase_emptyFsmTableXRefItem
v_LGenBase_spEventFSMXrefs[vl_spbIdx][iIdx].singleFsm[pl_tableIdx][vl_idx].rowIdx := pl_eventXref[vl_event].rowIdx
}else{
if (pl_tcIdx==-1) {
var integer vl_rowPos := 0
if(isbound(v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].singleFsm[pl_tableIdx])){
vl_rowPos := sizeof(v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].singleFsm[pl_tableIdx])
}
if (not isbound(v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].fsmOfTc)) {
v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].fsmOfTc := {}
}
v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].singleFsm[pl_tableIdx][vl_rowPos]:= c_EPTF_LGenBase_emptyFsmTableXRefItem
v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].singleFsm[pl_tableIdx][vl_rowPos].rowIdx := pl_eventXref[vl_event].rowIdx;
v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].singleFsm[pl_tableIdx][vl_rowPos].siblingRef := pl_eventXref[vl_event].siblingRef;
if (c_EPTF_Common_debugSwitch){
f_EPTF_LGenBase_loggingDebugConfig(log2str(%definitionId,": Adding to table listeners: ",
"\n",v_LGenBase_fsmTables[pl_tableIdx].name,
"\n",f_EPTF_LGenBase_bIdx2Str(bIdx),
"\n",f_EPTF_LGenBase_iIdx2Str(bIdx,iIdx),
"\n",v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].singleFsm[pl_tableIdx][vl_rowPos]))
}
} else {
var integer vl_rowPos := 0
if(isbound(v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].fsmOfTc[pl_tcIdx][pl_siblingIdx])){
vl_rowPos := sizeof(v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].fsmOfTc[pl_tcIdx][pl_siblingIdx])
}
if (not isbound(v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].singleFsm)) {
v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].singleFsm := {}
}
v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].fsmOfTc[pl_tcIdx][pl_siblingIdx][vl_rowPos]:= c_EPTF_LGenBase_emptyFsmTableXRefItem
v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].fsmOfTc[pl_tcIdx][pl_siblingIdx][vl_rowPos].rowIdx := pl_eventXref[vl_event].rowIdx;
v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].fsmOfTc[pl_tcIdx][pl_siblingIdx][vl_rowPos].siblingRef := pl_eventXref[vl_event].siblingRef;
if (c_EPTF_Common_debugSwitch){
f_EPTF_LGenBase_loggingDebugConfig(log2str(%definitionId,": Adding to table listeners: ",
"\n",v_LGenBase_fsmTables[pl_tableIdx].name,
"\n",f_EPTF_LGenBase_bIdx2Str(bIdx),
"\n",f_EPTF_LGenBase_iIdx2Str(bIdx,iIdx),
"\n",v_LGenBase_behaviorTypes[bIdx].fsmTableXRefDB[iIdx].fsmOfTc[pl_tcIdx][pl_siblingIdx][vl_rowPos]))
}
}
}
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_CompactFsmTable_checkDuplicatedEventToListen
//
// Purpose:
// Function for checking if there is a duplicated listener to be registered for an event
//
// Parameters:
// pl_table - *in* <EPTF_LGenBase_CompactFsmTable> - FSM table data
//
// Return Value:
// -
// Errors:
// -
//
// Detailed Comments:
// Sends a warning log if listener is duplicated
///////////////////////////////////////////////////////////
private function f_EPTF_LGenBase_CompactFsmTable_checkDuplicatedEventToListen(
in EPTF_LGenBase_InternalFsmTable pl_table)
runs on EPTF_LGenBase_Private_CT{
for(var integer i := 1; i < sizeof(pl_table.eventXref); i := i + 1) {
for(var integer j := 0; j < i; j := j + 1) {
if(pl_table.eventXref[i].event2Listen.bIdx == pl_table.eventXref[j].event2Listen.bIdx and
pl_table.eventXref[i].event2Listen.iIdx == pl_table.eventXref[j].event2Listen.iIdx) {
f_EPTF_LGenBase_loggingWarning(%definitionId&": compact FSM table "&pl_table.name&" has duplicated listener for event ("&
int2str(pl_table.eventXref[i].event2Listen.bIdx)& ", "& int2str(pl_table.eventXref[j].event2Listen.iIdx)& ").");
}
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_fsmTimerIdx
//
// Purpose:
// Finds the specified timer in the given list of local timers ad
// retrieves its index.
//
///////////////////////////////////////////////////////////
friend function f_EPTF_LGenBase_fsmTimerIdx(
in EPTF_LGenBase_FsmTimerInternalList pl_timerList,
in charstring pl_timerName)
runs on EPTF_LGenBase_Private_CT return integer{
//There won't be so much timers to use hashmap, and it isn't called during load generation
for ( var integer vl_timer := 0; vl_timer < sizeof(pl_timerList); vl_timer := vl_timer+1 )
{
if(pl_timerList[vl_timer].name == pl_timerName){
return vl_timer;
}
}
return -1
}//f_EPTF_LGenBase_fsmTimerIdx
type enumerated EPTF_LGenBase_FsmDeclaratorType {compact, indexed}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_declareParamedFsmTable
//
// Purpose:
// FSM table declaration using EPTF_LGenBase_CompactFsmTableDeclarator with
// names of registered functions to test steps.
//
// Parameters:
// pl_tableDeclarator - *in* <EPTF_LGenBase_CompactFsmTableDeclarator> - FSM table declarator
// pl_type - *in* <EPTF_LGenBase_FsmDeclaratorType> - FSM table type (compact, indexed)
//
// Return Value:
// *integer* - the selected index of the FSM table in the
// FSM table database
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_declareParamedFsmTable(
in EPTF_LGenBase_CompactFsmTableDeclarator pl_tableDeclarator,
in EPTF_LGenBase_FsmDeclaratorType pl_type := compact) //For backward compatibility only
runs on EPTF_LGenBase_Private_CT return integer{
var EPTF_LGenBase_FSMInternalDeclarator vl_internal
f_EPTF_LGenBase_convertParamedFsm2Internal(pl_tableDeclarator, vl_internal)
return f_EPTF_LGenBase_declareFSMTableFromInternal(vl_internal)
}//EPTF_LGenBase_FsmDeclaratorType
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_declareFSMTable
//
// Purpose:
//
//
// Parameters:
// pl_fsm - *in* <EPTF_LGenBase_FsmTableDeclarator> - FSM table data
//
// Return Value:
// *integer* - index of the new FSM table
//
// Errors:
// -
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_declareFSMTable(in EPTF_LGenBase_FsmTableDeclarator pl_fsm)
runs on EPTF_LGenBase_Private_CT
return integer{
var EPTF_LGenBase_FSMInternalDeclarator vl_fsmInt
f_EPTF_LGenBase_convertFlexFsmDeclaration2Internal(pl_fsm,vl_fsmInt)
if (v_LGenBase_FSMdumpPath != "") {
f_EPTF_LGenBase_dumpFSM(pl_fsm);
}
return f_EPTF_LGenBase_declareFSMTableFromInternal(vl_fsmInt)
}//f_EPTF_LGenBase_declareFSMTable
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_declareFSMTables
//
// Purpose:
//
//
// Parameters:
// pl_fsmList - *in* <EPTF_LGenBase_FsmTableDeclaratorList> - a list of FSM tables
//
// Return Value:
// <EPTF_IntegerList> - list of the indexes of the new FSM tables
//
// Errors:
// -
//
// Detailed Comments:
//
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_declareFSMTables(in EPTF_LGenBase_FsmTableDeclaratorList pl_fsmList)
runs on EPTF_LGenBase_Private_CT
return EPTF_IntegerList{
var EPTF_IntegerList vl_ret := {};
for ( var integer vl_i := 0; vl_i < sizeof(pl_fsmList) ; vl_i := vl_i+1 )
{
vl_ret[vl_i] := f_EPTF_LGenBase_declareFSMTable(pl_fsmList[vl_i]);
}
return vl_ret;
}//f_EPTF_LGenBase_declareFSMTables
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_dumpFSM
//
// Purpose:
// Dump FSM table to file in the format of cfg files
//
// Parameters:
// pl_fsm - *in* <EPTF_LGenBase_FsmTableDeclarator> - an FSM table
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
// The file name will be: fsmdump_<fsmName>.cfg
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_dumpFSM(in EPTF_LGenBase_FsmTableDeclarator pl_fsm)
runs on EPTF_LGenBase_Private_CT {
// replace some characters so the FSM name will be valid as filename
var charstring vl_fsmName := f_replaceEveryOccurenceOfSubstring(pl_fsm.name,"/","_");
vl_fsmName := f_replaceEveryOccurenceOfSubstring(pl_fsm.name," ","_");
var charstring vl_filePath := v_LGenBase_FSMdumpPath&"/fsmdump_"&vl_fsmName&".cfg";
f_EPTF_LGenBase_loggingDebugConfig(%definitionId&"Dumping FSM to file: "&vl_filePath);
var integer vl_fileDesc := f_FIO_open_trunc_wronly(vl_filePath);
if(vl_fileDesc == -1){
f_EPTF_LGenBase_loggingWarning(%definitionId&"Failed to open the file: " & vl_filePath);
return;
}
if(f_FIO_write_text_flush(vl_fileDesc, "[MODULE_PARAMETERS]\ntsp_dumped_fsm := "&ttcn2string(pl_fsm)&"\n") == -1)
{
f_EPTF_LGenBase_loggingWarning(%definitionId&"Failed to write to file: " & vl_filePath);
}
if(f_FIO_close(vl_fileDesc) == -1)
{
f_EPTF_LGenBase_loggingWarning(%definitionId&"Failed to close the file: " & vl_filePath);
}
}//f_EPTF_LGenBase_dumpFSM
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_TcMgmt_declareEntityTypes
//
// Purpose:
// Registeres the entity types in the database.
// Calls the <f_EPTF_LGenBase_declareEntityType>
// See also:<EPTF_LGenBase_TcMgmt_EntityTypeDeclaratorList>
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_TcMgmt_declareEntityTypes(
in EPTF_LGenBase_TcMgmt_EntityTypeDeclaratorList pl_typeList)
runs on EPTF_LGenBase_Private_CT
return EPTF_IntegerList{
var EPTF_IntegerList vl_ret := {};
for ( var integer vl_i := 0; vl_i < sizeof(pl_typeList) ; vl_i := vl_i+1 )
{
vl_ret[vl_i] := f_EPTF_LGenBase_declareEntityType(pl_typeList[vl_i].name, pl_typeList[vl_i].behaviorTypeIdxList);
}
return vl_ret;
}//f_EPTF_LGenBase_TcMgmt_declareEntityTypes
///////////////////////////////////////////////////////////
// Group: TCMgmt
//
// Purpose:
// Traffic management-related declarators
///////////////////////////////////////////////////////////
group TCMgmt{
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_declareCompactFsmTables
//
// Purpose:
// A detailed FSM table declaration using EPTF_LGenBase_CompactFsmTableDeclaratorList with
// names of registered functions to test steps.
//
// Parameters:
// pl_tableList - *in* <EPTF_LGenBase_TcMgmt_CompactFsmTableDeclaratorList> - a list of FSM tables
//
// Return Value:
// <EPTF_IntegerList> - the selected indices of the FSM table in the FSM table database
//
// Errors:
// -
//
// Detailed Comments:
// The FSM tables can be described even in config files.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables(
in EPTF_LGenBase_TcMgmt_CompactFsmTableDeclaratorList pl_tableList)
runs on EPTF_LGenBase_Private_CT
return EPTF_IntegerList{
var EPTF_IntegerList vl_ret := {};
for ( var integer vl_i := 0; vl_i < sizeof(pl_tableList) ; vl_i := vl_i+1 )
{
vl_ret[vl_i] := f_EPTF_LGenBase_declareParamedFsmTable(pl_tableList[vl_i]);
}
return vl_ret;
}//f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_TcMgmt_declareIndexedFsmTables
//
// Purpose:
// FSM table declaration using EPTF_LGenBase_TcMgmt_IndexedFsmTableDeclaratorList with
// names of registered functions to test steps.
// See also:<EPTF_LGenBase_TcMgmt_IndexedFsmTableDeclaratorList>
//
// Parameters:
// pl_tableList - *in* <EPTF_LGenBase_TcMgmt_IndexedFsmTableDeclaratorList> - FSM table data
//
// Return Value:
// *integer* - the selected index of the FSM table in the
// FSM table database
//
// Errors:
// -
//
// Detailed Comments:
// The FSM tables can be described even in config files.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_TcMgmt_declareIndexedFsmTables(
in EPTF_LGenBase_TcMgmt_IndexedFsmTableDeclaratorList pl_tableList)
runs on EPTF_LGenBase_Private_CT
return EPTF_IntegerList{
var EPTF_IntegerList vl_ret := {};
for ( var integer vl_i := 0; vl_i < sizeof(pl_tableList) ; vl_i := vl_i+1 )
{
vl_ret[vl_i] := f_EPTF_LGenBase_declareParamedFsmTable(pl_tableList[vl_i]);
}
return vl_ret;
}//f_EPTF_LGenBase_TcMgmt_declareIndexedFsmTables
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_TcMgmt_declareEntityGroups
//
// Purpose:
// Creates the entity groups. Calls the <f_EPTF_LGenBase_createEntityGroup>.
// See also:<EPTF_LGenBase_TcMgmt_EntityGrpDeclaratorList>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_TcMgmt_declareEntityGroups(in EPTF_LGenBase_TcMgmt_EntityGrpDeclaratorList pl_grpTypeList)
runs on EPTF_LGenBase_Private_CT
return EPTF_IntegerList{
var EPTF_IntegerList vl_ret := {};
for ( var integer vl_i := 0; vl_i < sizeof(pl_grpTypeList) ; vl_i := vl_i+1 )
{
vl_ret[vl_i] := f_EPTF_LGenBase_createEntityGroup(pl_grpTypeList[vl_i]);
}
return vl_ret;
}//f_EPTF_LGenBase_TcMgmt_declareEntityGroups
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_TcMgmt_declareScenariosTypes
//
// Purpose:
// Registers a list of scenarios. Calls the <f_EPTF_LGenBase_declareScenarioType3>.
// See also:<EPTF_LGenBase_ScenarioTypeInternalDeclaratorList>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_TcMgmt_declareScenarioTypes(in EPTF_LGenBase_ScenarioTypeDeclaratorList pl_scTypeList)
runs on EPTF_LGenBase_Private_CT
return EPTF_IntegerList{
var EPTF_IntegerList vl_ret := {};
for ( var integer vl_i := 0; vl_i < sizeof(pl_scTypeList) ; vl_i := vl_i+1 )
{
vl_ret[vl_i] := f_EPTF_LGenBase_declareScenarioType3(pl_scTypeList[vl_i]);
}
return vl_ret;
}//f_EPTF_LGenBase_TcMgmt_declareScenarios2
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_declareIndexedCompactFsmTable
//
// Purpose:
// Declare an FSM table using (behaviorTypeIdx,testIdx) tuples instead of
// direct fn. references.
//
// Parameters:
// pl_table - *in* <EPTF_LGenBase_IndexedCompactFsmTable> - indexedFSM table data
//
// Return Value:
// *integer* - the selected index of the FSM table in the
// FSM table database
//
// Errors:
// -
//
// Detailed Comments:
// It converts the <EPTF_LGenBase_IndexedCompactFsmTable> argument to
// <EPTF_LGenBase_CompactFsmTable> on-the-fly and stores as such. Nextstate
// declarations are asserted if present.
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_declareIndexedCompactFsmTable(
in EPTF_LGenBase_IndexedCompactFsmTable pl_table)
runs on EPTF_LGenBase_Private_CT return integer{
var integer t:= sizeof(v_LGenBase_fsmTables);
v_LGenBase_fsmTables[t] := c_EPTF_LGenBase_emptyInternalFsmTable
v_LGenBase_fsmTables[t].name := pl_table.name;
f_EPTF_LGenBase_createFSMHashMaps(pl_table.name,v_LGenBase_fsmTables[t],false)
v_LGenBase_fsmTables[t].stateList := pl_table.stateList;
f_EPTF_LGenBase_appendTimerList(pl_table.timerList, v_LGenBase_fsmTables[t].timerList)
//Initialize the column index list
var EPTF_IntegerList vl_colIdxList := {}
for ( var integer vl_state := 0; vl_state < sizeof(pl_table.stateList) ; vl_state := vl_state+1 ){
vl_colIdxList[vl_state] := vl_state
}
for (var integer r:=0; r<sizeof(pl_table.table); r:=r+1){
v_LGenBase_fsmTables[t].eventXref[r] := c_EPTF_LGenBase_emptyInternalFSMEvent2RowXref;
v_LGenBase_fsmTables[t].eventXref[r].event2Listen := pl_table.table[r].eventToListen
v_LGenBase_fsmTables[t].eventXref[r].rowIdx := r
for (var integer c:=0; c<sizeof(pl_table.table[r].cellRow); c:=c+1) {
if(ispresent(pl_table.table[r].cellRow[c].actionList)) {
for (var integer a:=0;a<sizeof(pl_table.table[r].cellRow[c].actionList); a:=a+1){
var integer aBIdx:=pl_table.table[r].cellRow[c].actionList[a].step.bIdx,
aSidx:=pl_table.table[r].cellRow[c].actionList[a].step.sIdx;
v_LGenBase_fsmTables[t].rows[r].cellList[c].actionList[a].step :=
v_LGenBase_functions[v_LGenBase_testSteps[aBIdx][aSidx]].testStepFunction;
//v_LGenBase_testSteps[aBIdx][aSidx].step;
v_LGenBase_fsmTables[t].rows[r].cellList[c].actionList[a].stepContextArgs :=
pl_table.table[r].cellRow[c].actionList[a].stepContextArgs;
}//actionList
} else {
v_LGenBase_fsmTables[t].rows[r].cellList[c].actionList := omit
}
v_LGenBase_fsmTables[t].rows[r].colIdxListByStates := vl_colIdxList
v_LGenBase_fsmTables[t].rows[r].cellList[c].nextState :=
pl_table.table[r].cellRow[c].nextState
v_LGenBase_fsmTables[t].rows[r].cellList[c].nextStateCalculation :=
pl_table.table[r].cellRow[c].nextStateCalculation
f_EPTF_Base_assert(%definitionId&": Declared nextstate must be valid",
not ispresent(pl_table.table[r].cellRow[c].nextState)
or (ispresent(pl_table.table[r].cellRow[c].nextState)
and (pl_table.table[r].cellRow[c].nextState>=0
or pl_table.table[r].cellRow[c].nextState<sizeof(pl_table.stateList)))
)
}//columns
}//rows
f_EPTF_LGenBase_fillEventsHasmaps(t,v_LGenBase_fsmTables[t].eventXref,-1,-1);
v_LGenBase_temporaryHashMaps := {}
return t;
}//f_EPTF_LGenBase_declareIndexedCompactFsmTable
} // group TCMgmt
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_declareEntityType
//
// Purpose:
// Initializes an entity type
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_declareEntityType(
in charstring pl_name, //name of the entity type
in EPTF_CharstringList pl_behaviorTypeList //references to the behavior types it exhibits
)
runs on EPTF_LGenBase_Private_CT
return integer{
if (c_EPTF_Common_debugSwitch){
f_EPTF_Base_assert(%definitionId&": The name of the entity type mustn't be empty.","" != pl_name);
f_EPTF_Base_assert(%definitionId&": The entity type "&pl_name&" already exists.",-1 == f_EPTF_LGenBase_entityTypeNameIndex(pl_name));
}
var integer vl_ret := sizeof(v_LGenBase_entityTypes);
var EPTF_LGenBase_EntityType vl_eType := {
name := pl_name,
behaviorTypeIdxList := {},
currCount := 0
};
var integer vl_bMax := sizeof(pl_behaviorTypeList);
for ( var integer vl_i := 0; vl_i < vl_bMax ; vl_i := vl_i+1 )
{
vl_eType.behaviorTypeIdxList[vl_i] := f_EPTF_LGenBase_behaviorTypeNameIndex(pl_behaviorTypeList[vl_i]);
f_EPTF_Base_assert(%definitionId&": Invalid behavior type:"&pl_behaviorTypeList[vl_i],-1 != vl_eType.behaviorTypeIdxList[vl_i]);
}
v_LGenBase_entityTypes[vl_ret] := vl_eType;
return vl_ret;
}//f_EPTF_LGenBase_declareEntityType
///////////////////////////////////////////////////////////
// Group: trafficDeclarators
//
// Purpose:
// Traffic case and scenario declarators
///////////////////////////////////////////////////////////
group trafficDeclarators{
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_convertScenarioTypeDeclarator2Internal
//
// Purpose:
// Processes a <EPTF_LGenBase_ScenarioTypeDeclarator> and
// converts it to an internal <EPTF_LGenBase_ScenarioTypeInternalDeclarator>
///////////////////////////////////////////////////////////
friend function f_EPTF_LGenBase_convertScenarioTypeDeclarator2Internal(
in EPTF_LGenBase_ScenarioTypeDeclarator pl_scDecl,
out EPTF_LGenBase_ScenarioTypeInternalDeclarator pl_dest)
//TODO in EPTF_LGenBase_Error_FT pl_errorFn := refers()
runs on EPTF_Base_CT{
pl_dest := c_EPTF_LGenBase_emptyScenarioTypeInternalDeclarator;
pl_dest.name := pl_scDecl.name;
//parameters
for ( var integer vl_i := 0; vl_i < sizeof(pl_scDecl.scParamsList) ; vl_i := vl_i+1 ){
if( ischosen(pl_scDecl.scParamsList[vl_i].enabled) ){
pl_dest.enabled := pl_scDecl.scParamsList[vl_i].enabled
}
else if( ischosen(pl_scDecl.scParamsList[vl_i].phaseListName) ){
pl_dest.phaseListName := pl_scDecl.scParamsList[vl_i].phaseListName
}
else if( ischosen(pl_scDecl.scParamsList[vl_i].phaseFinishConditions) ){
pl_dest.phaseFinishConditions := pl_scDecl.scParamsList[vl_i].phaseFinishConditions
}
else if( ischosen(pl_scDecl.scParamsList[vl_i].phaseStateChangeActions) ){
pl_dest.phaseStateChangeActions := pl_scDecl.scParamsList[vl_i].phaseStateChangeActions
}
else if( ischosen(pl_scDecl.scParamsList[vl_i].weightedScData) ){
pl_dest.weightedScData := pl_scDecl.scParamsList[vl_i].weightedScData
}
else if( ischosen(pl_scDecl.scParamsList[vl_i].trafficType) ){
pl_dest.trafficType := pl_scDecl.scParamsList[vl_i].trafficType
} else {
f_EPTF_Base_assert(%definitionId&": Invalid scenario type parameter:"&log2str(pl_scDecl.scParamsList[vl_i]),false)
}
}
//traffic cases
for ( var integer vl_i := 0; vl_i < sizeof(pl_scDecl.tcList) ; vl_i := vl_i+1 )
{
pl_dest.tcList[vl_i].enable := false; //take place only
f_EPTF_LGenBase_convertTcOfScenarioTypeDeclarator2Internal(
pl_scDecl.tcList[vl_i],
pl_scDecl.name,
pl_dest.tcList[vl_i])
}
f_EPTF_LGenBase_checkScenarioType(pl_dest);
}
///////////////////////////////////////////////////////////
// PrivateFunction: f_EPTF_LGenBase_convertTcOfScenarioTypeDeclarator2Internal
//
// Purpose:
// Processes a <EPTF_LGenBase_TcOfScenarioDeclarator> and
// converts it to an internal <EPTF_LGenBase_TcOfScenarioInternalDeclarator>
///////////////////////////////////////////////////////////
private function f_EPTF_LGenBase_convertTcOfScenarioTypeDeclarator2Internal(
in EPTF_LGenBase_TcOfScenarioDeclarator pl_tcDecl,
in charstring pl_scName,
out EPTF_LGenBase_TcOfScenarioInternalDeclarator pl_dest)
//TODO in EPTF_LGenBase_Error_FT pl_errorFn := refers()
runs on EPTF_Base_CT{
pl_dest := c_EPTF_LGenBase_emptyTcOfScenarioInternalDeclarator;
pl_dest.tcPrivateName := pl_tcDecl.tcName;
var boolean vl_tcTypeName := false
var boolean vl_startDelay := false
var boolean vl_enableEntitiesAtStart := false
var boolean vl_enabledAtStart := false
var boolean vl_target := false
var boolean vl_scheduler := false
var boolean vl_entitySelection := false
var boolean vl_ranges := false
var boolean vl_params := false
var boolean vl_entityFinishConditions := false
var boolean vl_entityFinishActions := false
var boolean vl_trafficStartFinish := false
var boolean vl_trafficFinishedActions := false
var boolean vl_templateSet := false
var boolean vl_fsmList := false
var boolean vl_siblingFsmList := false;
var boolean vl_customEntitySucc := false;
var boolean vl_restoreTCAtStartTC := false;
//f_EPTF_Base_assert(%definitionId&": Invalid traffic case name: "&pl_tcDecl.tcName, -1 != pl_dest.tcTypeIdx);
for ( var integer vl_i := 0; vl_i < sizeof(pl_tcDecl.tcParamsList) ; vl_i := vl_i+1 ){
if(ischosen(pl_tcDecl.tcParamsList[vl_i].tcTypeName)){
if(vl_tcTypeName){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"tcTypeName",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].tcTypeName),
log2str( pl_dest.tcTypeName))
}
pl_dest.tcTypeName := pl_tcDecl.tcParamsList[vl_i].tcTypeName
vl_tcTypeName := true;
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].startDelay)){
if(vl_startDelay){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"startDelay",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].startDelay),
log2str( pl_dest.startDelay))
}
pl_dest.startDelay := pl_tcDecl.tcParamsList[vl_i].startDelay
vl_startDelay := true;
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].enableEntitiesAtStart)){
if(vl_enableEntitiesAtStart){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"enableEntitiesAtStart",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].enableEntitiesAtStart),
log2str( pl_dest.enableEntities))
}
pl_dest.enableEntities := pl_tcDecl.tcParamsList[vl_i].enableEntitiesAtStart
vl_enableEntitiesAtStart := true
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].enabledAtStart)){
if(vl_enabledAtStart){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"enabledAtStart",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].enabledAtStart),
log2str( pl_dest.enable))
}
pl_dest.enable := pl_tcDecl.tcParamsList[vl_i].enabledAtStart
vl_enabledAtStart := true
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].target)){
if(vl_target){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"target",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].target),
log2str( pl_dest.target))
}
pl_dest.target := pl_tcDecl.tcParamsList[vl_i].target
vl_target := true
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].scheduler)){
if(vl_scheduler){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"scheduler",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].scheduler),
log2str( pl_dest.scheduler))
}
if(ischosen(pl_tcDecl.tcParamsList[vl_i].scheduler.preDefinedName)){
pl_dest.scheduler := f_EPTF_LGenBase_BurstFuncName2Char(pl_tcDecl.tcParamsList[vl_i].scheduler.preDefinedName);
} else {
pl_dest.scheduler := pl_tcDecl.tcParamsList[vl_i].scheduler.userDefinedName;
}
vl_scheduler := true
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].entitySelection)){
if(vl_entitySelection){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"entitySelection",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].entitySelection),
log2str( pl_dest.entitySelection))
}
pl_dest.entitySelection := pl_tcDecl.tcParamsList[vl_i].entitySelection
vl_entitySelection := true
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].ranges)){
if(vl_ranges){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"ranges",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].ranges),
log2str( pl_dest.ranges))
}
pl_dest.ranges := pl_tcDecl.tcParamsList[vl_i].ranges
vl_ranges := true
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].params)){
if(vl_params){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"params",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].params),
log2str( pl_dest.params))
}
pl_dest.params := pl_tcDecl.tcParamsList[vl_i].params
vl_params := true
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].entityFinishConditions)){
if(vl_entityFinishConditions){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"entityFinishConditions",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].entityFinishConditions),
log2str( pl_dest.entityFinishConditions))
}
vl_entityFinishConditions := true
for ( var integer vl_eCond := 0; vl_eCond < sizeof(pl_tcDecl.tcParamsList[vl_i].entityFinishConditions) ; vl_eCond := vl_eCond+1 ){
if ( ischosen(pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].nrOfExecStart)){
if(not ispresent( pl_dest.entityFinishConditions.nrOfExecStart)){
pl_dest.entityFinishConditions.nrOfExecStart := pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].nrOfExecStart
}else{
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"nrOfExecStart",
"entity finish condition",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].nrOfExecStart),
log2str( pl_dest.entityFinishConditions.nrOfExecStart))
}
}
else if ( ischosen(pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].nrOfFails)){
if(ispresent(pl_dest.entityFinishConditions.nrOfFails)){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"nrOfFails",
"entity finish condition",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].nrOfFails),
log2str( pl_dest.entityFinishConditions.nrOfFails))
}
pl_dest.entityFinishConditions.nrOfFails := pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].nrOfFails
}
else if ( ischosen(pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].nrOfErrors)){
if(ispresent(pl_dest.entityFinishConditions.nrOfErrors)){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"nrOfErrors",
"entity finish condition",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].nrOfErrors),
log2str( pl_dest.entityFinishConditions.nrOfErrors))
}
pl_dest.entityFinishConditions.nrOfErrors := pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].nrOfErrors
}
else if ( ischosen(pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].nrOfTimeouts)){
if(ispresent(pl_dest.entityFinishConditions.nrOfTimeouts)){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"nrOfTimeouts",
"entity finish condition",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].nrOfTimeouts),
log2str( pl_dest.entityFinishConditions.nrOfTimeouts))
}
pl_dest.entityFinishConditions.nrOfTimeouts := pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].nrOfTimeouts
}
else if ( ischosen(pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].nrOfSuccesses)){
if(ispresent(pl_dest.entityFinishConditions.nrOfSuccesses)){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"nrOfSuccesses",
"entity finish condition",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].nrOfSuccesses),
log2str( pl_dest.entityFinishConditions.nrOfSuccesses))
}
pl_dest.entityFinishConditions.nrOfSuccesses := pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].nrOfSuccesses
}
else if ( ischosen(pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].customFinishCondition)){
if(ispresent(pl_dest.entityFinishConditions.customFinishCondition) and
"" != pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].customFinishCondition){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"customFinishCondition",
"entity finish condition",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].customFinishCondition),
log2str( pl_dest.entityFinishConditions.customFinishCondition))
}else{
pl_dest.entityFinishConditions.customFinishCondition := pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond].customFinishCondition
}
} else {
if (c_EPTF_Common_debugSwitch){
f_EPTF_Base_assert(%definitionId&": Invalid entity finish condition type: "&
log2str( pl_tcDecl.tcParamsList[vl_i].entityFinishConditions[vl_eCond]),false);
}
}
}
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].entityFinishActions)){
if(vl_entityFinishActions){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"entityFinishActions",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].entityFinishActions),
log2str( pl_dest.entityFinishActions))
}
pl_dest.entityFinishActions := pl_tcDecl.tcParamsList[vl_i].entityFinishActions
vl_entityFinishActions := true
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].trafficStartFinish)){
if(vl_trafficStartFinish){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"trafficStartFinish",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].trafficStartFinish),
log2str( pl_dest.trafficStartFinishConditionsAndActions))
}
for ( var integer vl_tf := 0; vl_tf < sizeof(pl_tcDecl.tcParamsList[vl_i].trafficStartFinish); vl_tf := vl_tf+1 ){
if ( ischosen(pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].customFinish) ){
if(ispresent(pl_dest.trafficStartFinishConditionsAndActions.customFinish)){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"customFinish",
"trafficStartFinish",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].customFinish),
log2str( pl_dest.trafficStartFinishConditionsAndActions.customFinish))
}
pl_dest.trafficStartFinishConditionsAndActions.customFinish := pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].customFinish
}
else if ( ischosen(pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].entitiesFinished) ){
if(ispresent(pl_dest.trafficStartFinishConditionsAndActions.entitiesFinished)){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"entitiesFinished",
"trafficStartFinish",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].entitiesFinished),
log2str( pl_dest.trafficStartFinishConditionsAndActions.entitiesFinished))
}
pl_dest.trafficStartFinishConditionsAndActions.entitiesFinished := pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].entitiesFinished
}
else if ( ischosen(pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].availableEntitiesFinished) ){
if(ispresent(pl_dest.trafficStartFinishConditionsAndActions.availableEntitiesFinished)){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"availableEntitiesFinished",
"trafficStartFinish",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].availableEntitiesFinished),
log2str( pl_dest.trafficStartFinishConditionsAndActions.availableEntitiesFinished))
}
pl_dest.trafficStartFinishConditionsAndActions.availableEntitiesFinished := pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].availableEntitiesFinished
}
else if ( ischosen(pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].execTime) ){
if(ispresent(pl_dest.trafficStartFinishConditionsAndActions.execTime)){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"execTime",
"trafficStartFinish",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].execTime),
log2str( pl_dest.trafficStartFinishConditionsAndActions.execTime))
}
pl_dest.trafficStartFinishConditionsAndActions.execTime := pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].execTime
}
else if ( ischosen(pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfExecStart) ){
if(ispresent(pl_dest.trafficStartFinishConditionsAndActions.nrOfExecStart)){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"nrOfExecStart",
"trafficStartFinish",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfExecStart),
log2str( pl_dest.trafficStartFinishConditionsAndActions.nrOfExecStart))
}
pl_dest.trafficStartFinishConditionsAndActions.nrOfExecStart := pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfExecStart
}
else if ( ischosen(pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfFails) ){
if(ispresent(pl_dest.trafficStartFinishConditionsAndActions.nrOfFails)){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"nrOfFails",
"trafficStartFinish",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfFails),
log2str( pl_dest.trafficStartFinishConditionsAndActions.nrOfFails))
}
pl_dest.trafficStartFinishConditionsAndActions.nrOfFails := pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfFails
}
else if ( ischosen(pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfErrors) ){
if(ispresent(pl_dest.trafficStartFinishConditionsAndActions.nrOfErrors)){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"nrOfErrors",
"trafficStartFinish",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfErrors),
log2str( pl_dest.trafficStartFinishConditionsAndActions.nrOfErrors))
}
pl_dest.trafficStartFinishConditionsAndActions.nrOfErrors := pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfErrors
}
else if ( ischosen(pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfTimeouts) ){
if(ispresent(pl_dest.trafficStartFinishConditionsAndActions.nrOfTimeouts)){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"nrOfTimeouts",
"trafficStartFinish",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfTimeouts),
log2str( pl_dest.trafficStartFinishConditionsAndActions.nrOfTimeouts))
}
pl_dest.trafficStartFinishConditionsAndActions.nrOfTimeouts := pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfTimeouts
}
else if ( ischosen(pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfRangeLoop) ){
if(ispresent(pl_dest.trafficStartFinishConditionsAndActions.nrOfRangeLoop)){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"nrOfRangeLoop",
"trafficStartFinish",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfRangeLoop),
log2str( pl_dest.trafficStartFinishConditionsAndActions.nrOfRangeLoop))
}
pl_dest.trafficStartFinishConditionsAndActions.nrOfRangeLoop := pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfRangeLoop
}
else if ( ischosen(pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfSuccesses) ){
if(ispresent(pl_dest.trafficStartFinishConditionsAndActions.nrOfSuccesses)){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"nrOfSuccesses",
"trafficStartFinish",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfSuccesses),
log2str( pl_dest.trafficStartFinishConditionsAndActions.nrOfSuccesses))
}
pl_dest.trafficStartFinishConditionsAndActions.nrOfSuccesses := pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].nrOfSuccesses
}
else if ( ischosen(pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].anythingFinished) ){
if(ispresent(pl_dest.trafficStartFinishConditionsAndActions.anythingFinished)){
f_EPTF_LGenBase_logDuplicatedDef2ndLevel(
%definitionId,
"anythingFinished",
"trafficStartFinish",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].anythingFinished),
log2str( pl_dest.trafficStartFinishConditionsAndActions.anythingFinished))
}
pl_dest.trafficStartFinishConditionsAndActions.anythingFinished := pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf].anythingFinished
} else {
if (c_EPTF_Common_debugSwitch){
f_EPTF_Base_assert(%definitionId&": Invalid trafficStartFinish condition type: "&
log2str( pl_tcDecl.tcParamsList[vl_i].trafficStartFinish[vl_tf]),false);
}
}
}
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].trafficFinishedActions)){
if(vl_trafficFinishedActions){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"trafficFinishedActions",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].trafficFinishedActions),
log2str( pl_dest.trafficFinishedActions))
}
pl_dest.trafficFinishedActions := pl_tcDecl.tcParamsList[vl_i].trafficFinishedActions
vl_trafficFinishedActions := true
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].templateSet)){
if(vl_templateSet){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"templateSet",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].templateSet),
log2str( pl_dest.templateSet))
}
pl_dest.templateSet := pl_tcDecl.tcParamsList[vl_i].templateSet
vl_templateSet := true
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].fsmList)){
if(vl_fsmList){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"fsmList",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].fsmList),
log2str( pl_dest.fsmList))
}
var integer vl_initialSize := sizeof(pl_dest.fsmList);
for ( var integer vl_fsm := 0; vl_fsm < sizeof(pl_tcDecl.tcParamsList[vl_i].fsmList) ; vl_fsm := vl_fsm+1 ){
pl_dest.fsmList[vl_fsm+vl_initialSize] := c_EPTF_LGenBase_emptyTcTypeFSM;
pl_dest.fsmList[vl_fsm+vl_initialSize].fsmName := pl_tcDecl.tcParamsList[vl_i].fsmList[vl_fsm]
pl_dest.fsmList[vl_fsm+vl_initialSize].siblingName := pl_tcDecl.tcParamsList[vl_i].fsmList[vl_fsm]
}
vl_fsmList := true;
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].siblingFsmList)){
if(vl_siblingFsmList){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"siblingFsmList",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].siblingFsmList),
log2str( pl_dest.fsmList))
}
var integer vl_initialSize := sizeof(pl_dest.fsmList);
for ( var integer vl_fsm := 0; vl_fsm < sizeof(pl_tcDecl.tcParamsList[vl_i].siblingFsmList) ; vl_fsm := vl_fsm+1 ){
pl_dest.fsmList[vl_fsm+vl_initialSize] := c_EPTF_LGenBase_emptyTcTypeFSM;
pl_dest.fsmList[vl_fsm+vl_initialSize].fsmName := pl_tcDecl.tcParamsList[vl_i].siblingFsmList[vl_fsm].fsmType
pl_dest.fsmList[vl_fsm+vl_initialSize].siblingName := pl_tcDecl.tcParamsList[vl_i].siblingFsmList[vl_fsm].siblingName
}
vl_siblingFsmList := true;
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].customEntitySucc)){
if(vl_customEntitySucc){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"customEntitySucc",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].customEntitySucc),
log2str( pl_dest.customEntitySucc))
}
pl_dest.customEntitySucc := pl_tcDecl.tcParamsList[vl_i].customEntitySucc
vl_customEntitySucc := true;
}
else if(ischosen(pl_tcDecl.tcParamsList[vl_i].restoreTCAtStartTC)){
if(vl_restoreTCAtStartTC){
f_EPTF_LGenBase_logDuplicatedDef(
%definitionId,
"restoreTCAtStartTC",
pl_tcDecl.tcName,
pl_scName,
log2str( pl_tcDecl.tcParamsList[vl_i].restoreTCAtStartTC),
log2str( pl_dest.restoreTCAtStartTC))
}
pl_dest.restoreTCAtStartTC := pl_tcDecl.tcParamsList[vl_i].restoreTCAtStartTC
vl_restoreTCAtStartTC := true;
} else {
f_EPTF_Base_assert(%definitionId&": Invalid TC of scenario parameter type: "&log2str(pl_tcDecl.tcParamsList[vl_i]),false)
}
}
if("" == pl_dest.tcTypeName and 0 == sizeof(pl_dest.fsmList)){
pl_dest.tcTypeName := pl_tcDecl.tcName
}
}
} // group trafficDeclarators
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getCustomFinishConditionFunctionRef
//
// Purpose:
// Finds the function reference of the specified
// <EPTF_LGenBase_customFinishCondition_FT>-type function, and
// retrieves it if found.
///////////////////////////////////////////////////////////
private function f_EPTF_LGenBase_getCustomFinishConditionFunctionRef(
in charstring pl_fnName,
inout EPTF_LGenBase_customFinishCondition_FT pl_ret)
runs on EPTF_LGenBase_Private_CT{
if("" != pl_fnName){
var integer vl_fnIdx := f_EPTF_LGenBase_functionNameIndex(pl_fnName)
if(-1 == vl_fnIdx){
f_EPTF_LGenBase_loggingError(%definitionId&": Invalid custom entity finish condition funcion name: "&pl_fnName)
}
if(ischosen(v_LGenBase_functions[vl_fnIdx].customFinishCondition)){
pl_ret := v_LGenBase_functions[vl_fnIdx].customFinishCondition
}else{
f_EPTF_LGenBase_loggingError(%definitionId&": Invalid funcion type for custom entity finish condition "&pl_fnName)
}
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_declareTrafficCaseType
//
// Purpose:
// Processes a <EPTF_LGenBase_TrafficCaseTypeDeclarator> pl_tcType and
// declares the traffic case type
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_declareTrafficCaseType(in EPTF_LGenBase_TrafficCaseTypeDeclarator pl_tcType)
runs on EPTF_LGenBase_Private_CT
return integer{
var EPTF_LGenBase_TrafficCaseTypeInternalDeclarator vl_tcType := c_EPTF_LGenBase_emptyTrafficCaseTypeInternalDeclarator;
vl_tcType.name := pl_tcType.name;
vl_tcType.fsmName := pl_tcType.fsmName;
vl_tcType.entityType := pl_tcType.entityType;
for ( var integer vl_i := 0; vl_i < sizeof(pl_tcType.tcParams) ; vl_i := vl_i+1 ){
if(ischosen(pl_tcType.tcParams[vl_i].customEntitySucc)){
vl_tcType.customEntitySucc := pl_tcType.tcParams[vl_i].customEntitySucc
}
}
return f_EPTF_LGenBase_declareTrafficCaseTypeInternal(vl_tcType)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_declareScenarioType3
//
// Purpose:
// Creates a traffic case scenario for TitanSim R3.
//
// Detailed Comments:
// This is a TitanSim R3 scenario declaration function. It registers one scenario. The scenario can be normal or weighted.
// A scenario is a collection of traffic cases.
// See <f_EPTF_LGenBase_validateScenarioType>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_declareScenarioType3(in EPTF_LGenBase_ScenarioTypeDeclarator pl_scenario)
runs on EPTF_LGenBase_Private_CT
return integer{
var EPTF_LGenBase_ScenarioTypeInternalDeclarator vl_scInternalType;
f_EPTF_LGenBase_convertScenarioTypeDeclarator2Internal(pl_scenario, vl_scInternalType)
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugConfig)){
f_EPTF_LGenBase_loggingDebugConfig(%definitionId&": The converted scenario declarator: "&log2str(vl_scInternalType))
for ( var integer vl_tc := 0; vl_tc < sizeof(vl_scInternalType.tcList) ; vl_tc := vl_tc+1 ){
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugConfig)){
f_EPTF_LGenBase_loggingDebugConfig(%definitionId&": The converted traffic case declarator: "&log2str(vl_scInternalType.tcList[vl_tc]))
}
}
}
return f_EPTF_LGenBase_declareScenarioTypeInternal(vl_scInternalType);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_createEntityGroup
//
// Purpose:
// Initializes an entity group
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_createEntityGroup( EPTF_LGenBase_EntityGrpDeclarator pl_grpDesc )
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": The entity group name mustn't be empty.","" != pl_grpDesc.name);
f_EPTF_Base_assert(%definitionId&": The entity type name mustn't be empty.","" != pl_grpDesc.eType);
f_EPTF_Base_assert(%definitionId&": The entity group "&pl_grpDesc.name&" already exists.",-1 == f_EPTF_LGenBase_entityGrpNameIndex(pl_grpDesc.name));
var integer vl_eTypeIdx := f_EPTF_LGenBase_entityTypeNameIndex(pl_grpDesc.eType);
f_EPTF_Base_assert(%definitionId&": Invalid entity type "&pl_grpDesc.eType, -1 != vl_eTypeIdx);
f_EPTF_Base_assert(%definitionId&": Invalid count of entities: "&int2str(pl_grpDesc.eCount),0 <= pl_grpDesc.eCount);
//Create entities --
var integer vl_eOffset := sizeof(v_LGenBase_entities); //entity index of first member
//Check maximal capacity of behaviors
var integer vl_maxCount := f_EPTF_LGenBase_getETypeAvailableByIdx(vl_eTypeIdx);
if(0 > vl_maxCount or vl_maxCount > pl_grpDesc.eCount){
vl_maxCount := pl_grpDesc.eCount;
}
var integer vl_ret := sizeof(v_LGenBase_entityGroups);
//Create entities in the list of LGenBase
f_EPTF_LGenBase_initEntityCtxs(vl_eOffset, vl_maxCount, /*v_LGenBase_entityNamePrefix,*/vl_ret);
//Call behavior context binding for all the entities
var integer vl_behavCount := sizeof(v_LGenBase_entityTypes[vl_eTypeIdx].behaviorTypeIdxList);
for(var integer vl_behav := 0; vl_behav < vl_behavCount; vl_behav := vl_behav + 1){
for(var integer vl_entityRelIdx := 0; vl_entityRelIdx < vl_maxCount; vl_entityRelIdx := vl_entityRelIdx + 1){
var EPTF_IntegerList vl_bCtx := {};
if(null != v_LGenBase_behaviorTypes[v_LGenBase_entityTypes[vl_eTypeIdx].behaviorTypeIdxList[vl_behav]].contextBindFn){
vl_bCtx := v_LGenBase_behaviorTypes[v_LGenBase_entityTypes[vl_eTypeIdx].behaviorTypeIdxList[vl_behav]].contextBindFn.apply( vl_entityRelIdx );
}
if(null != v_LGenBase_behaviorTypes[v_LGenBase_entityTypes[vl_eTypeIdx].behaviorTypeIdxList[vl_behav]].contextBindWithAbsIdxFn){
vl_bCtx := v_LGenBase_behaviorTypes[v_LGenBase_entityTypes[vl_eTypeIdx].behaviorTypeIdxList[vl_behav]].contextBindWithAbsIdxFn.apply( vl_entityRelIdx+vl_eOffset );
}
v_LGenBase_entities[vl_entityRelIdx+vl_eOffset].bCtxList[v_LGenBase_entityTypes[vl_eTypeIdx].behaviorTypeIdxList[vl_behav]]:=vl_bCtx;
}
v_LGenBase_behaviorTypes[v_LGenBase_entityTypes[vl_eTypeIdx].behaviorTypeIdxList[vl_behav]].bCurrCount :=
v_LGenBase_behaviorTypes[v_LGenBase_entityTypes[vl_eTypeIdx].behaviorTypeIdxList[vl_behav]].bCurrCount + vl_maxCount;
}
v_LGenBase_entityTypes[vl_eTypeIdx].currCount := v_LGenBase_entityTypes[vl_eTypeIdx].currCount + vl_maxCount;
//Create entity group
v_LGenBase_entityGroups[vl_ret] := c_EPTF_LGenBase_emptyEntityGroup
v_LGenBase_entityGroups[vl_ret].name := pl_grpDesc.name
v_LGenBase_entityGroups[vl_ret].eTypeIdx := vl_eTypeIdx
v_LGenBase_entityGroups[vl_ret].eOffset := vl_eOffset
v_LGenBase_entityGroups[vl_ret].eCount := vl_maxCount
for (var integer x:= 0; x<sizeof(v_LGenBase_entityGroupCreated); x:= x+1)
{
v_LGenBase_entityGroupCreated[x].apply( vl_ret );
}
return vl_maxCount;
}//f_EPTF_LGenBase_createEntityGroup
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_setTrafficCorrigationForEGrp
//
// Purpose:
// Sets the traffic corrigation factor of an entity group
// This is used to delay traffic generation
// event on different LGens differently
// Also the initial burst error is set differently on
// different LGens.
// Traffic start event is delayed with pl_trafficCorrigation/targetCPS seconds.
// The initial burst error is set to pl_trafficCorrigation.
// This function is used by ExecCtrl only.
///////////////////////////////////////////////////////////
friend function f_EPTF_LGenBase_setTrafficCorrigationForEGrp(
in charstring pl_grpName,
in float pl_trafficCorrigation // this is the corrigation factor for traffic start and initial burst error
)
runs on EPTF_LGenBase_Private_CT {
var integer vl_grpIdx := f_EPTF_LGenBase_entityGrpNameIndex(pl_grpName);
f_EPTF_Base_assert(%definitionId&": The entity group "&pl_grpName&" does not exists.",-1 != vl_grpIdx);
f_EPTF_Base_assert(%definitionId&": Invalid traffic corrigation factor "&float2str(pl_trafficCorrigation)& " for entity group "&pl_grpName,
0.0 <= pl_trafficCorrigation and pl_trafficCorrigation < 1.0);
v_LGenBase_entityGroups[vl_grpIdx].trafficCorrigation := pl_trafficCorrigation
}//f_EPTF_LGenBase_createEntityGroup
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeEntityGroup
//
// Purpose:
// Removes an entity group and cleans it up
//
// Detailed Comments:
// Calls the <f_EPTF_LGenBase_removeEntityGroupByIdx> function
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeEntityGroup(
in charstring pl_name //name of the group
)
runs on EPTF_LGenBase_Private_CT{
var integer vl_grpIdx := f_EPTF_LGenBase_entityGrpNameIndex(pl_name);
f_EPTF_Base_assert(%definitionId&": Invalid entity group name: "&pl_name,-1 != vl_grpIdx);
f_EPTF_LGenBase_removeEntityGroupByIdx(vl_grpIdx);
}//f_EPTF_LGenBase_removeEntityGroup
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeEntityGroupByIdx
//
// Purpose:
// Removes an entity group and cleans it up
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeEntityGroupByIdx(
in integer pl_grpIdx //name of the group
)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_LGenBase_clearEntityGroup(pl_grpIdx, v_LGenBase_entityGroups[pl_grpIdx])
v_LGenBase_entityGroups[pl_grpIdx] := cEPTF_LGenBase_emptyEntityGroup
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeEntityGroupByIdx
//
// Purpose:
// Removes an entity group and cleans it up
///////////////////////////////////////////////////////////
private function f_EPTF_LGenBase_clearEntityGroup(
in integer pl_eGrpIdx,
in EPTF_LGenBase_EntityGroup pl_eGrp
)
runs on EPTF_LGenBase_Private_CT{
for(var integer vl_sc := 0; vl_sc < sizeof(pl_eGrp.scenarios); vl_sc := vl_sc + 1){
f_EPTF_LGenBase_removeScenario(pl_eGrpIdx, vl_sc)
}
//Call behavior context unbind for all the entities
var integer vl_eTypeIdx := pl_eGrp.eTypeIdx;
var integer vl_behavCount := sizeof(v_LGenBase_entityTypes[vl_eTypeIdx].behaviorTypeIdxList);
var integer vl_eCount := pl_eGrp.eCount;
var integer vl_eOffset := pl_eGrp.eOffset;
for(var integer vl_behav := 0; vl_behav < vl_behavCount; vl_behav := vl_behav + 1){
for(var integer vl_entity := vl_eOffset; vl_entity < vl_eOffset + vl_eCount; vl_entity := vl_entity + 1){
if(null != v_LGenBase_behaviorTypes[v_LGenBase_entityTypes[vl_eTypeIdx].behaviorTypeIdxList[vl_behav]].contextUnbindFn){
v_LGenBase_behaviorTypes[v_LGenBase_entityTypes[vl_eTypeIdx].behaviorTypeIdxList[vl_behav]].contextUnbindFn.apply( vl_entity );
}
//v_LGenBase_entities[vl_entity].bCtxList[vl_behav] := {};
}
v_LGenBase_behaviorTypes[v_LGenBase_entityTypes[vl_eTypeIdx].behaviorTypeIdxList[vl_behav]].bCurrCount :=
v_LGenBase_behaviorTypes[v_LGenBase_entityTypes[vl_eTypeIdx].behaviorTypeIdxList[vl_behav]].bCurrCount - vl_eCount;
}
//Remove entities
for (var integer vl_i := vl_eOffset + vl_eCount - 1; vl_i>=vl_eOffset; vl_i:=vl_i-1) {
//Deactivate pending FSMs
for ( var integer vl_fsm := 0; vl_fsm < sizeof(v_LGenBase_entities[vl_i].fsmCtxList) ; vl_fsm := vl_fsm+1 ){
if (-1 < v_LGenBase_entities[vl_i].fsmCtxList[vl_fsm].tableIdx){
f_EPTF_LGenBase_deactivateFsm(vl_i, vl_fsm)
}
}
// TODO: the v_LGenBase_entities[vl_i].fsmCtxQueue FBQ should be removed also
v_LGenBase_entities[vl_i] := c_empty_LGenBase_EntityCtx;
}
v_LGenBase_entityTypes[pl_eGrp.eTypeIdx].currCount :=
v_LGenBase_entityTypes[pl_eGrp.eTypeIdx].currCount - vl_eCount;
}//f_EPTF_LGenBase_removeEntityGroupByIdx
private function f_EPTF_LGenBase_removeTC(
in integer pl_tcIdx)
runs on EPTF_LGenBase_Private_CT{
var integer vl_eGrpIdx := v_LGenBase_trafficCases[pl_tcIdx].eGroupBackref
var integer vl_scIdx := v_LGenBase_trafficCases[pl_tcIdx].eScenarioBackRef
var integer vl_tcRelIdx := v_LGenBase_trafficCases[pl_tcIdx].eTcRelIdx
v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdx].tcIdxList[vl_tcRelIdx] := -1
if ( -1 < v_LGenBase_trafficCases[pl_tcIdx].stopTimeoutTimer )
{
if(not f_EPTF_SchedulerComp_CancelEvent(v_LGenBase_trafficCases[pl_tcIdx].stopTimeoutTimer)) {
f_EPTF_LGenBase_loggingWarning(%definitionId&": Cancelling stop timeout timer of TC "&
v_LGenBase_trafficCases[pl_tcIdx].uniqueName&" failed.");
}
v_LGenBase_trafficCases[pl_tcIdx].stopTimeoutTimer := -1;
f_EPTF_LGenBase_logNotRespondedEntities(pl_tcIdx, "stop or abort")
}
if(-1 != v_LGenBase_trafficCases[pl_tcIdx].schedulingTimer){
if(not f_EPTF_SchedulerComp_CancelEvent(v_LGenBase_trafficCases[pl_tcIdx].schedulingTimer)) {
f_EPTF_LGenBase_loggingWarning(%definitionId&": Cancelling scheduled timer of running TC "&
v_LGenBase_trafficCases[pl_tcIdx].uniqueName&" failed.");
}
v_LGenBase_trafficCases[pl_tcIdx].schedulingTimer := -1;
}
if ( -1 != v_LGenBase_trafficCases[pl_tcIdx].execTimeTimer )
{
if(not f_EPTF_SchedulerComp_CancelEvent(v_LGenBase_trafficCases[pl_tcIdx].execTimeTimer)) {
f_EPTF_LGenBase_loggingWarning(%definitionId&": Cancelling exec time expiration timer of TC "&
v_LGenBase_trafficCases[pl_tcIdx].uniqueName&" failed.");
}
v_LGenBase_trafficCases[pl_tcIdx].execTimeTimer := -1;
}
f_EPTF_str2int_HashMap_Delete(v_LGenBase_trafficCases[pl_tcIdx].uniqueName&c_EPTF_LGenBase_tcParamsHasmapPostfix);
//??EPTF_LGenBase_SchedulerData schedulerData, //burst calc functions, lastBurstSize, burstSizeCumulativeError
//If the creation of objects with TC scope moved to createTC
//EPTF_IntegerList varList,
//EPTF_IntegerList statisticList,
//EPTF_IntegerList statMeasStatList
//TODO Log running entities? EPTF_LGenBase_EntityInfo entityInfo, // if entity is free then ready for TC start
//TODO ??integer templateSetIdx, // -1 if doesn't exist
/*
for ( var integer vl_stat := 0; vl_stat < sizeof(v_LGenBase_trafficCases[pl_tcIdx].statHandlerStatList) ; vl_stat := vl_stat+1 )
{
var charstring vl_statName := f_EPTF_LGenBase_varNameOfTCVar(pl_tcIdx, v_LGenBase_trafficCases[pl_tcIdx].statHandlerStatList[vl_stat].statName)
f_EPTF_StatHandlerClient_deregisterStat(
pl_statName := vl_statName,
pl_sourceCompRef := self,
pl_statHandler := self
)
}
for ( var integer vl_stat := 0; vl_stat < sizeof(v_LGenBase_trafficCases[pl_tcIdx].siblingStatHandlerStatList) ; vl_stat := vl_stat+1 ){
for ( var integer vl_e := 0; vl_e < sizeof(v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList) ; vl_e := vl_e+1 ){
var charstring vl_statName := f_EPTF_LGenBase_varNameOfSiblingFSMsVar(
pl_tcIdx,
vl_e,
v_LGenBase_trafficCases[pl_tcIdx].siblingStatHandlerStatList[vl_stat].statName)
f_EPTF_StatHandlerClient_deregisterStat(
pl_statName := vl_statName,
pl_sourceCompRef := self,
pl_statHandler := self
)
}
}
*/
// if not in cleanup:
if (f_EPTF_Base_cleanupIsInProgress()==true) {
//TC Variables
for ( var integer vl_i := 0; vl_i < sizeof(v_LGenBase_trafficCases[pl_tcIdx].varList) ; vl_i := vl_i+1 ){
f_EPTF_Var_removeVar(v_LGenBase_trafficCases[pl_tcIdx].varList[vl_i].varId)
}
}
//v_LGenBase_trafficCases[pl_tcIdx].statMeasStatList
//
//Deactivate FSMs
for ( var integer vl_e := 0; vl_e < v_LGenBase_entityGroups[vl_eGrpIdx].eCount ; vl_e := vl_e+1 ){
for ( var integer vl_fsm := 0; vl_fsm < sizeof(v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList[vl_e].siblingFsmCtxList) ; vl_fsm := vl_fsm+1 ){
var integer vl_fsmCtxIdx := v_LGenBase_trafficCases[pl_tcIdx].entityInfo.itemList[vl_e].siblingFsmCtxList[vl_fsm]
f_EPTF_LGenBase_deactivateFsm(v_LGenBase_entityGroups[vl_eGrpIdx].eOffset+vl_e, vl_fsmCtxIdx);
}
}
v_LGenBase_trafficCases[pl_tcIdx] := c_EPTF_LGenBase_TcMgmt_emptytcDescriptor
}
private function f_EPTF_LGenBase_removeScenario(
in integer pl_eGrpIdx,
in integer pl_scReldx)
runs on EPTF_LGenBase_Private_CT{
if(ispresent(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scReldx].schedulerData) and
-1 < v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scReldx].schedulerData.schedulingTimer){
if(not f_EPTF_SchedulerComp_CancelEvent(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scReldx].schedulerData.schedulingTimer)){
f_EPTF_LGenBase_loggingWarning(%definitionId&": Cancelling sceduled timer of scenario "&
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scReldx].uniqueName&
" failed.");
}
v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scReldx].schedulerData.schedulingTimer := -1;
}
for ( var integer vl_tc := 0; vl_tc < sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scReldx].tcIdxList) ; vl_tc := vl_tc+1 ){
var integer vl_tcAbsIdx := v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scReldx].tcIdxList[vl_tc]
f_EPTF_LGenBase_removeTC(vl_tcAbsIdx)
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_logNotRespondedEntities
//
// Purpose:
// Logs the entities which didn't respond to the stop event.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_logNotRespondedEntities(
in integer pl_tcIdx,
in charstring pl_stopOrAbort)
runs on EPTF_LGenBase_Private_CT{
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugTraffic)){
var charstring vl_entityList := %definitionId&": There are entities not responded to the "&pl_stopOrAbort&" event:"
var integer vl_e := -1
var boolean vl_found := f_EPTF_FBQ_getBusyHeadIdx(vl_e, v_LGenBase_trafficCases[pl_tcIdx].stoppingEntityInfo)
while(vl_found){
vl_entityList := vl_entityList&"\n" & f_EPTF_LGenBase_getEntityName(vl_e)
vl_found := f_EPTF_FBQ_getFwdBusyItemIdx(vl_e, v_LGenBase_trafficCases[pl_tcIdx].stoppingEntityInfo)
}
f_EPTF_LGenBase_loggingDebugTraffic(vl_entityList)
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_addFsmDebugPostproc
//
// Purpose:
// Registers a postproc function to attach when an FSM debug variable created
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_addFsmDebugPostproc(in EPTF_Var_GenericFn pl_postproc)
runs on EPTF_LGenBase_Private_CT return integer
{
var integer i:= sizeof(v_LGenBase_fsmDebugPostprocList);
v_LGenBase_fsmDebugPostprocList[i] := pl_postproc
return i;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeFsmDebugPostproc
//
// Purpose:
// Removes a postproc function added by the <f_EPTF_LGenBase_addFsmDebugPostproc>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeFsmDebugPostproc(in integer pl_idx) runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&": Error: attempting to delete FSM debug postproc at invalid idx:" & int2str(pl_idx), pl_idx>-1 and pl_idx<sizeof(v_LGenBase_fsmDebugPostprocList));
var EPTF_Var_GenericFns vl_list := v_LGenBase_fsmDebugPostprocList;
var integer i := 0;
v_LGenBase_fsmDebugPostprocList:= {};
while ( i<pl_idx ) {
v_LGenBase_fsmDebugPostprocList[i] := vl_list[i];
i:= i+1;
}
for (i:=pl_idx; i<sizeof(vl_list)-1; i:= i+1) {
v_LGenBase_fsmDebugPostprocList[i] := vl_list[i+1];
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_addSingleShotDebugPostproc
//
// Purpose:
// Registers a postproc function to attach when an FSM debug variable created
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_addSingleShotDebugPostproc(in EPTF_Var_GenericFn pl_postproc)
runs on EPTF_LGenBase_Private_CT return integer
{
var integer i:= sizeof(v_LGenBase_singleShotDebugPostprocList);
v_LGenBase_singleShotDebugPostprocList[i] := pl_postproc
return i;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeSingleShotDebugPostproc
//
// Purpose:
// Removes a postproc function added by the <f_EPTF_LGenBase_addSingleShotDebugPostproc>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeSingleShotDebugPostproc(in integer pl_idx) runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&": Error: attempting to delete SingleShot debug postproc at invalid idx:" & int2str(pl_idx), pl_idx>-1 and pl_idx<sizeof(v_LGenBase_singleShotDebugPostprocList));
var EPTF_Var_GenericFns vl_list := v_LGenBase_singleShotDebugPostprocList;
var integer i := 0;
v_LGenBase_singleShotDebugPostprocList:= {};
while ( i<pl_idx ) {
v_LGenBase_singleShotDebugPostprocList[i] := vl_list[i];
i:= i+1;
}
for (i:=pl_idx; i<sizeof(vl_list)-1; i:= i+1) {
v_LGenBase_singleShotDebugPostprocList[i] := vl_list[i+1];
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_addFsmDefaultDebugPostproc
//
// Purpose:
// Adds a postproc function to the default FSM debug variable
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_addFsmDefaultDebugPostproc(in EPTF_Var_GenericFn pl_postproc)
runs on EPTF_LGenBase_Private_CT
{
f_EPTF_Var_addPostProcFn(v_LGenBase_defaultLogBuffer, pl_postproc)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeFsmDefaultDebugPostproc
//
// Purpose:
// Removes a postproc function added by the <f_EPTF_LGenBase_addFsmDefaultDebugPostproc>
// from the default FSM debug variable
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeFsmDefaultDebugPostproc(in EPTF_Var_GenericFn pl_postproc)
runs on EPTF_LGenBase_Private_CT
{
f_EPTF_Var_removePostProcFn(v_LGenBase_defaultLogBuffer, pl_postproc)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_declareFunction
//
// Purpose:
// Registers the reference of the function with the specified name
//
// Parameters:
// pl_name - *in* *charstring* - the name of the newly registered function
// pl_fn - *in* <EPTF_LGenBase_RegisteredFunctions> - the type and function reference
//
// Return Value:
// *integer* - The index of the registered function
//
// Detailed Comments:
// The custom finish condition and action functions of
// <EPTF_LGenBase_TcMgmt_GroupFinishConditions>,
// <EPTF_LGenBase_TcMgmt_EntityFinishConditions>,
// <EPTF_LGenBase_TcMgmt_GroupActions>,
// <EPTF_LGenBase_TcMgmt_EntityActions> and the
// customEntitySucc of the <EPTF_LGenBase_tcTypeDeclarator>
// can refer to these functions.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_declareFunction(
in charstring pl_name,
in EPTF_LGenBase_RegisteredFunctions pl_fn
)
runs on EPTF_LGenBase_Private_CT
return integer{
var integer vl_ret;
if(ischosen(pl_fn.testStepFunction)) { // if a testStepFunction is declared
if(f_EPTF_str2int_HashMap_Find(v_LGenBase_functionHashMap, pl_name, vl_ret)) {
f_EPTF_LGenBase_loggingWarning(%definitionId&": This test step name is already registered:" & pl_name & ". It should only be declared with f_EPTF_LGenBase_declareStep().");
return vl_ret;
}
}
f_EPTF_Base_assert(%definitionId&": The function name "&pl_name&" already exists.",-1 == f_EPTF_LGenBase_functionNameIndex(pl_name));
vl_ret := sizeof(v_LGenBase_functions);
v_LGenBase_functions[vl_ret] := pl_fn;
f_EPTF_str2int_HashMap_Insert(v_LGenBase_functionHashMap,pl_name,vl_ret);
return vl_ret;
}//f_EPTF_LGenBase_declareFunction
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_declareReferredTcList
//
// Purpose:
// Appends traffic case references to the referred traffic case list
// of the specified traffic case.
//
// Detailed Comments:
// The referred traffic cases must be in the same scenario
// of the same entity group, of course
///////////////////////////////////////////////////////////
private function f_EPTF_LGenBase_declareReferredTcList(
in charstring pl_eGrpName,
in charstring pl_scName,
in charstring pl_tcName,
in EPTF_CharstringList pl_referredTcList
)
runs on EPTF_LGenBase_Private_CT{
var integer vl_tcIdx := f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_tcName);
var integer vl_base := sizeof(v_LGenBase_trafficCases[vl_tcIdx].referredTrafficCases);
for ( var integer vl_i := 0; vl_i < sizeof(pl_referredTcList) ; vl_i := vl_i+1 )
{
v_LGenBase_trafficCases[vl_tcIdx].referredTrafficCases[vl_base+vl_i] :=
f_EPTF_LGenBase_trafficCaseId(pl_eGrpName, pl_scName, pl_referredTcList[vl_i]);
}
}//f_EPTF_LGenBase_declareReferredTcList
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_insertFsmSteps
//
// Purpose:
// Inserts the actions described in the pl_actions
// argument into the FSM hookpoints having the name
// given in the pl_hookpointName argument
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_insertFsmSteps(
inout EPTF_LGenBase_FsmTableDeclarator pl_table,
in charstring pl_hookpointName,
in EPTF_LGenBase_FsmActionDeclaratorList pl_actions)
runs on EPTF_LGenBase_Private_CT{
//classicTable
if ( ischosen(pl_table.table.classicTable )){
for ( var integer vl_i := 0; vl_i < sizeof(pl_table.table.classicTable); vl_i := vl_i+1 ) {
if(isbound(pl_table.table.classicTable[vl_i].cellRow)) {
for ( var integer vl_j := 0; vl_j < sizeof(pl_table.table.classicTable[vl_i].cellRow); vl_j := vl_j+1 ) {
if(ispresent(pl_table.table.classicTable[vl_i].cellRow[vl_j].actionList)) {
f_EPTF_LGenBase_insertActionList(pl_table.table.classicTable[vl_i].cellRow[vl_j].actionList, pl_actions, pl_hookpointName);
}
}
}
}
}
//extendedTable
else if(ischosen(pl_table.table.extendedTable)) {
for ( var integer vl_i := 0; vl_i < sizeof(pl_table.table.extendedTable); vl_i := vl_i+1 ) {
//classicCellRow
if(ischosen(pl_table.table.extendedTable[vl_i].cellRow.classicCellRow)) {
for ( var integer vl_j := 0; vl_j < sizeof(pl_table.table.extendedTable[vl_i].cellRow.classicCellRow); vl_j := vl_j+1 ) {
if(ispresent(pl_table.table.extendedTable[vl_i].cellRow.classicCellRow[vl_j].actionList)) {
f_EPTF_LGenBase_insertActionList(pl_table.table.extendedTable[vl_i].cellRow.classicCellRow[vl_j].actionList, pl_actions, pl_hookpointName);
}
}
}
//statedCellRow
else if(ischosen(pl_table.table.extendedTable[vl_i].cellRow.statedCellRow)) {
for ( var integer vl_j := 0; vl_j < sizeof(pl_table.table.extendedTable[vl_i].cellRow.statedCellRow); vl_j := vl_j+1 ) {
if(ispresent(pl_table.table.extendedTable[vl_i].cellRow.statedCellRow[vl_j].cell.actionList)) {
f_EPTF_LGenBase_insertActionList(pl_table.table.extendedTable[vl_i].cellRow.statedCellRow[vl_j].cell.actionList, pl_actions, pl_hookpointName);
}
}
}
//extstatedCellRow
else if(ischosen(pl_table.table.extendedTable[vl_i].cellRow.extStatedCellRow)) {
for ( var integer vl_j := 0; vl_j < sizeof(pl_table.table.extendedTable[vl_i].cellRow.extStatedCellRow); vl_j := vl_j+1 ) {
if(ispresent(pl_table.table.extendedTable[vl_i].cellRow.extStatedCellRow[vl_j].cell.actionList)) {
f_EPTF_LGenBase_insertActionList(pl_table.table.extendedTable[vl_i].cellRow.extStatedCellRow[vl_j].cell.actionList, pl_actions, pl_hookpointName);
}
}
} else {
//Program code inconsitency
f_EPTF_Base_assert("Error, unknown row type: "&log2str(pl_table.table.extendedTable[vl_i].cellRow),false);
}
}
} else {
//Program code inconsitency
f_EPTF_Base_assert("Error, unknown table type: "&log2str(pl_table.table),false);
}
}
//Move the actions after the hookpoint to the end
//Overwrite the actions from the hookpoint position with the new ones
private function f_EPTF_LGenBase_insertActionList(
inout EPTF_LGenBase_FsmActionDeclaratorList pl_orig_actions,
in EPTF_LGenBase_FsmActionDeclaratorList pl_actions,
in charstring pl_hookpointName
)
runs on EPTF_LGenBase_Private_CT{
for ( var integer vl_k := 0; vl_k < sizeof(pl_orig_actions); vl_k := vl_k+1 ) {
if(pl_orig_actions[vl_k].stepOrFunctionName == c_EPTF_LGenBase_stepName_hookpoint and
pl_orig_actions[vl_k].contextArgs.charstringValue == pl_hookpointName) {
var integer vl_hookSize := sizeof(pl_actions);
var integer vl_actionListSize := sizeof(pl_orig_actions);
for(var integer vl_l := 0; vl_l < vl_hookSize; vl_l := vl_l+1) {
pl_orig_actions[vl_actionListSize+vl_l] := pl_actions[vl_l];
}
//size changed
vl_actionListSize := sizeof(pl_orig_actions);
for(var integer vl_l := vl_actionListSize-1; vl_l-vl_hookSize >= vl_k; vl_l := vl_l-1) {
pl_orig_actions[vl_l] := pl_orig_actions[vl_l-vl_hookSize];
}
var integer vl_hookpointIdx := vl_k + vl_hookSize;
for(var integer vl_l := 0; vl_l < vl_hookSize; vl_l := vl_l+1) {
pl_orig_actions[vl_hookpointIdx - vl_hookSize + vl_l] := pl_actions[vl_l];
}
vl_k := vl_k + vl_hookSize;
}
}
}
}//DeclaringMetadata
///////////////////////////////////////////////////////////
// Group: GetSet
//
// Purpose:
// Functions to manipulate background data
//
///////////////////////////////////////////////////////////
group GetSet{
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_BurstFuncName2Char
//
// Purpose:
// Convert the predefined burst function names to a charstring value
//
// Parameters:
// pl_EPTF_LGenBase_burstFunc - *in* <EPTF_LGenBase_burstFunc> - The type of method of burst calculation
//
// Return Value:
// *charstring* - The charstring value
//
// Errors & assertions:
// - The method must not be "userDefined".
//
// Detailed Comments:
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_BurstFuncName2Char(
in EPTF_LGenBase_burstFunc pl_EPTF_LGenBase_burstFunc)
runs on EPTF_Base_CT
return charstring{
var charstring vl_name := "";
select( pl_EPTF_LGenBase_burstFunc )
{
case (terminating)
{
vl_name := c_EPTF_LGenBase_BurstCalc_terminating;
}
case (orig)
{
vl_name := c_EPTF_LGenBase_BurstCalc_orig;
}
case (imst)
{
vl_name := c_EPTF_LGenBase_BurstCalc_imst;
}
case (imst2)
{
vl_name := c_EPTF_LGenBase_BurstCalc_imst2;
}
case (cs)
{
vl_name := c_EPTF_LGenBase_BurstCalc_cs;
}
case (poisson)
{
vl_name := c_EPTF_LGenBase_BurstCalc_poisson;
}
case (userDefined)
{
vl_name := c_EPTF_LGenBase_BurstCalc_userDefined;
}
case else
{
//A bit paranoia.
f_EPTF_Base_assert(%definitionId&"Unhandled burst management type.",false);
}
}//select
return vl_name;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_behaviorTypeNameIndex
//
// Purpose:
// Retrieves the index of the behavior type with the specified name.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_behaviorTypeNameIndex(
in charstring pl_name)
runs on EPTF_LGenBase_Private_CT
return integer{
if(""==pl_name){return -1;}
var integer vl_ret := -1;
if(f_EPTF_str2int_HashMap_Find(v_LGenBase_behaviorHashMap,pl_name,vl_ret)){
return vl_ret;
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_inputNameIndex
//
// Purpose:
// Retrieves the index of the input with the specified names.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_inputNameIndex(
in charstring pl_behaviorName,
in charstring pl_inputName)
runs on EPTF_LGenBase_Private_CT
return integer{
if(""==pl_behaviorName or ""==pl_inputName){return -1;}
var integer vl_ret := -1;
if(f_EPTF_str2int_HashMap_Find(v_LGenBase_fsmEventsInputHashMap, pl_behaviorName&tsp_LGenBase_nameSeparator&pl_inputName,vl_ret)){
return vl_ret;
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_functionNameIndex
//
// Purpose:
// Retrieves the index of the function with the specified name.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_functionNameIndex(
in charstring pl_name)
runs on EPTF_LGenBase_Private_CT
return integer{
if(""==pl_name){return -1;}
var integer vl_ret := -1;
if(f_EPTF_str2int_HashMap_Find(v_LGenBase_functionHashMap,pl_name,vl_ret)){
return vl_ret;
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_functionReferenceByName
//
// Purpose:
// Retrieves the reference of the function with the specified name.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_functionReferenceByName(
in charstring pl_name,
out EPTF_LGenBase_RegisteredFunctions pl_fn)
runs on EPTF_LGenBase_Private_CT
return boolean{
var integer vl_ret := f_EPTF_LGenBase_functionNameIndex(pl_name);
if (vl_ret == -1){
return false;
}
else
{
pl_fn := v_LGenBase_functions[vl_ret];
return true;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getETypeIdxOfTcType
//
// Purpose:
// Retrieves the entity type index of a traffic case type
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getETypeIdxOfTcType(
in integer pl_eTypeIdx)
runs on EPTF_LGenBase_Private_CT
return integer
{
return v_LGenBase_trafficCaseTypes[pl_eTypeIdx].entityTypeIdx;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getETypeNameOfTcType
//
// Purpose:
// Retrieves the entity type name of a traffic case type
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getETypeNameOfTcType(
in integer pl_eTypeIdx)
runs on EPTF_LGenBase_Private_CT
return charstring
{
return v_LGenBase_entityTypes[v_LGenBase_trafficCaseTypes[pl_eTypeIdx].entityTypeIdx].name;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcTypeCount
//
// Purpose:
// Retrieves the number of traffic case types
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getTcTypeCount()
runs on EPTF_LGenBase_Private_CT
return integer
{
return sizeof(v_LGenBase_trafficCaseTypes);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcTypeName
//
// Purpose:
// Retrieves the name of a traffic case type
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getTcTypeName(
in integer pl_tcTypeIdx)
runs on EPTF_LGenBase_Private_CT
return charstring
{
if(0 <= pl_tcTypeIdx and pl_tcTypeIdx < sizeof(v_LGenBase_trafficCaseTypes)){
return v_LGenBase_trafficCaseTypes[pl_tcTypeIdx].name;
}else{
return ""
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_tcTypeNameIndex
//
// Purpose:
// Retrieves the index of the traffic case type with the specified name.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_tcTypeNameIndex(
in charstring pl_name)
runs on EPTF_LGenBase_Private_CT
return integer{
if(""==pl_name){return -1;}
var integer vl_size := sizeof(v_LGenBase_trafficCaseTypes);
for(var integer vl_i := 0; vl_i < vl_size; vl_i := vl_i + 1){
if(v_LGenBase_trafficCaseTypes[vl_i].name == pl_name){
return vl_i;
}
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_tcDescNameIndex
//
// Purpose:
// Retrieves the index of the traffic case descriptor with the specified name.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_tcDescNameIndex(
in charstring pl_name)
runs on EPTF_LGenBase_Private_CT
return integer{
if(""==pl_name){return -1;}
var integer vl_size := sizeof(v_LGenBase_trafficCases);
for(var integer vl_i := 0; vl_i < vl_size; vl_i := vl_i + 1){
if(v_LGenBase_trafficCases[vl_i].privateName == pl_name){
return vl_i;
}
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_tcTypeNameOfTcOfSc
//
// Purpose:
// Retrieves the type name of the traffic case of scenario declarator.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_tcTypeNameOfTcOfSc(
in EPTF_LGenBase_ScenarioTypeInternalDeclarator pl_sc,
in integer pl_tcRelIdx)
runs on EPTF_Base_CT
return charstring{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index: "&int2str(pl_tcRelIdx),-1 < pl_tcRelIdx and pl_tcRelIdx < sizeof(pl_sc.tcList));
return pl_sc.tcList[pl_tcRelIdx].tcTypeName;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_tcNameOfTcOfSc
//
// Purpose:
// Retrieves the name of the traffic case of scenario declarator.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_tcNameOfTcOfSc(
in EPTF_LGenBase_ScenarioTypeInternalDeclarator pl_sc,
in integer pl_tcRelIdx)
runs on EPTF_Base_CT
return charstring{
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index: "&int2str(pl_tcRelIdx),-1 < pl_tcRelIdx and pl_tcRelIdx < sizeof(pl_sc.tcList));
return pl_sc.tcList[pl_tcRelIdx].tcPrivateName;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_fsmNameIndex
//
// Purpose:
// Retrieves the index of the fsm with the specified name.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_fsmNameIndex(
in charstring pl_name)
runs on EPTF_LGenBase_Private_CT
return integer{
if(""==pl_name){return -1;}
var integer vl_size := sizeof(v_LGenBase_fsmTables);
for(var integer vl_i := 0; vl_i < vl_size; vl_i := vl_i + 1){
if(v_LGenBase_fsmTables[vl_i].name == pl_name){
return vl_i;
}
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_entityGrpNameIndex
//
// Purpose:
// Retrieves the index of the entity group with the specified name.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_entityGrpNameIndex(
in charstring pl_name)
runs on EPTF_LGenBase_Private_CT
return integer{
if(""==pl_name){return -1;}
var integer vl_size := sizeof(v_LGenBase_entityGroups);
for(var integer vl_i := 0; vl_i < vl_size; vl_i := vl_i + 1){
if(v_LGenBase_entityGroups[vl_i].name == pl_name){
return vl_i;
}
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_entityTypeNameIndex
//
// Purpose:
// Retrieves the index of the entity type with the specified name.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_entityTypeNameIndex(
in charstring pl_name)
runs on EPTF_LGenBase_Private_CT
return integer{
if(""==pl_name){return -1;}
var integer vl_size := sizeof(v_LGenBase_entityTypes);
for(var integer vl_i := 0; vl_i < vl_size; vl_i := vl_i + 1){
if(v_LGenBase_entityTypes[vl_i].name == pl_name){
return vl_i;
}
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_scenarioNameIndex
//
// Purpose:
// Retrieves the index of the scenario type with the specified name.
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_scenarioNameIndex(
in charstring pl_name)
runs on EPTF_LGenBase_Private_CT
return integer{
if(""==pl_name){return -1;}
var integer vl_size := sizeof(v_LGenBase_scenarioTypes);
for(var integer vl_i := 0; vl_i < vl_size; vl_i := vl_i + 1){
if(v_LGenBase_scenarioTypes[vl_i].name == pl_name){
return vl_i;
}
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_scNameIndexInEG
//
// Purpose:
// Gets the index of the scenario in an entity group
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_scNameIndexInEG(in integer pl_eGrpIdx, in charstring pl_name)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&": Invalid entity group index: "&int2str(pl_eGrpIdx),-1 < pl_eGrpIdx and pl_eGrpIdx < sizeof(v_LGenBase_entityGroups));
var integer vl_max := sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios);
for(var integer vl_i := 0; vl_i < vl_max; vl_i := vl_i + 1){
if(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[vl_i].name == pl_name){
return vl_i;
}
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_scNameInEG
//
// Purpose:
// Gets the name of the scenario in an entity group
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_scNameInEG(in integer pl_eGrpIdx, in integer pl_scIdx)
runs on EPTF_LGenBase_Private_CT
return charstring {
f_EPTF_Base_assert(%definitionId&": Invalid entity group index: "&int2str(pl_eGrpIdx),-1 < pl_eGrpIdx and pl_eGrpIdx < sizeof(v_LGenBase_entityGroups));
f_EPTF_Base_assert(%definitionId&": Invalid scenario index within the group: "&int2str(pl_scIdx),-1 < pl_scIdx and pl_scIdx < sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios));
return v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].name;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_entityTypeIdxOfEG
//
// Purpose:
// Gets the index of the entity type of an entity group
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_entityTypeIdxOfEG(in integer pl_eGrpIdx)
runs on EPTF_LGenBase_Private_CT
return integer {
f_EPTF_Base_assert(%definitionId&": Invalid entity group index: "&int2str(pl_eGrpIdx),-1 < pl_eGrpIdx and pl_eGrpIdx < sizeof(v_LGenBase_entityGroups));
return v_LGenBase_entityGroups[pl_eGrpIdx].eTypeIdx;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_entityTypeNameOfEG
//
// Purpose:
// Gets the name of the entity type of an entity group
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_entityTypeNameOfEG(in integer pl_eGrpIdx)
runs on EPTF_LGenBase_Private_CT
return charstring {
f_EPTF_Base_assert(%definitionId&": Invalid entity group index: "&int2str(pl_eGrpIdx),-1 < pl_eGrpIdx and pl_eGrpIdx < sizeof(v_LGenBase_entityGroups));
return v_LGenBase_entityTypes[v_LGenBase_entityGroups[pl_eGrpIdx].eTypeIdx].name;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_tcRelIdx
//
// Purpose:
// Gets the relative index of the traffic case in the scenario
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_tcRelIdx(in integer pl_tcAbsIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
var integer vl_eGrpIdx := v_LGenBase_trafficCases[pl_tcAbsIdx].eGroupBackref
var integer vl_scIdx := v_LGenBase_trafficCases[pl_tcAbsIdx].eScenarioBackRef
var integer vl_max := sizeof(v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdx].tcIdxList);
for(var integer vl_i := 0; vl_i < vl_max; vl_i := vl_i + 1){
if(pl_tcAbsIdx == v_LGenBase_entityGroups[vl_eGrpIdx].scenarios[vl_scIdx].tcIdxList[vl_i])
{
return vl_i;
}
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_tcOfScenario
//
// Purpose:
// Gets the index of the traffic case in the scenario
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_tcOfScenario(in EPTF_LGenBase_ScenarioOfGrp pl_sc, in charstring pl_name)
runs on EPTF_LGenBase_Private_CT
return integer{
var integer vl_max := sizeof(pl_sc.tcIdxList);
for(var integer vl_i := 0; vl_i < vl_max; vl_i := vl_i + 1){
if(v_LGenBase_trafficCases[pl_sc.tcIdxList[vl_i]].privateName == pl_name)
{
return vl_i;
}
}
return -1;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_tcNamesOfScenario
//
// Purpose:
// Retrieves the list of the names of the traffic cases of a scenario
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_tcNamesOfScenario(
in integer pl_eGrpIdx,
in integer pl_scIdx,
out EPTF_CharstringList pl_tcNames)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&": Invalid entity group index: "&int2str(pl_eGrpIdx),-1 < pl_eGrpIdx and pl_eGrpIdx < sizeof(v_LGenBase_entityGroups));
f_EPTF_Base_assert(%definitionId&": Invalid scenario index within the group: "&int2str(pl_scIdx),-1 < pl_scIdx and pl_scIdx < sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios));
pl_tcNames := {}
for ( var integer vl_tc := 0; vl_tc < sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].tcIdxList) ; vl_tc := vl_tc+1 )
{
pl_tcNames[vl_tc] := v_LGenBase_trafficCases[v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].tcIdxList[vl_tc]].privateName
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_tcUniqueNamesOfScenario
//
// Purpose:
// Retrieves the list of the unique names of the traffic cases of a scenario
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_tcUniqueNamesOfScenario(
in integer pl_eGrpIdx,
in integer pl_scIdx,
out EPTF_CharstringList pl_tcNames)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&": Invalid entity group index: "&int2str(pl_eGrpIdx),-1 < pl_eGrpIdx and pl_eGrpIdx < sizeof(v_LGenBase_entityGroups));
f_EPTF_Base_assert(%definitionId&": Invalid scenario index within the group: "&int2str(pl_scIdx),-1 < pl_scIdx and pl_scIdx < sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios));
pl_tcNames := {}
for ( var integer vl_tc := 0; vl_tc < sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].tcIdxList) ; vl_tc := vl_tc+1 )
{
pl_tcNames[vl_tc] := v_LGenBase_trafficCases[v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].tcIdxList[vl_tc]].privateName
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_tcIdxListOfScenario
//
// Purpose:
// Retrieves the list of the indexes of the traffic cases of a scenario
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_tcIdxListOfScenario(
in integer pl_eGrpIdx,
in integer pl_scIdx,
out EPTF_IntegerList pl_tcIdxList)
runs on EPTF_LGenBase_Private_CT{
if (c_EPTF_Common_debugSwitch){
f_EPTF_Base_assert(%definitionId&": Invalid entity group index: "&int2str(pl_eGrpIdx),-1 < pl_eGrpIdx and pl_eGrpIdx < sizeof(v_LGenBase_entityGroups));
f_EPTF_Base_assert(%definitionId&": Invalid scenario index within the group: "&int2str(pl_scIdx),-1 < pl_scIdx and pl_scIdx < sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios));
}
pl_tcIdxList := v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].tcIdxList
}
//////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getEGrpIdxOfTc
//
// Purpose:
// Returns the entity group index that the traffic case belongs to
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getEGrpIdxOfTc(
in integer pl_tcAbsIdx
)
runs on EPTF_LGenBase_Private_CT
return integer {
if (c_EPTF_Common_debugSwitch){
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index.",pl_tcAbsIdx > -1 and pl_tcAbsIdx < sizeof(v_LGenBase_trafficCases));
}
return v_LGenBase_trafficCases[pl_tcAbsIdx].eGroupBackref
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getScIdxOfTc
//
// Purpose:
// Returns the scenario index that the traffic case belongs to
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getScIdxOfTc(
in integer pl_tcAbsIdx
)
runs on EPTF_LGenBase_Private_CT
return integer {
if (c_EPTF_Common_debugSwitch){
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index.",pl_tcAbsIdx > -1 and pl_tcAbsIdx < sizeof(v_LGenBase_trafficCases));
}
return v_LGenBase_trafficCases[pl_tcAbsIdx].eScenarioBackRef
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcNameByTcIdx
//
// Purpose:
// Returns the name of the traffic case
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getTcNameByTcIdx(
in integer pl_tcAbsIdx
)
runs on EPTF_LGenBase_Private_CT
return charstring {
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index.",pl_tcAbsIdx > -1 and pl_tcAbsIdx < sizeof(v_LGenBase_trafficCases));
return v_LGenBase_trafficCases[pl_tcAbsIdx].privateName
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getTcUniqueNameByTcIdx
//
// Purpose:
// Returns the unique name of the traffic case (entity group name+scenario name+tc name)
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getTcUniqueNameByTcIdx(
in integer pl_tcAbsIdx
)
runs on EPTF_LGenBase_Private_CT
return charstring {
f_EPTF_Base_assert(%definitionId&": Invalid traffic case index.",pl_tcAbsIdx > -1 and pl_tcAbsIdx < sizeof(v_LGenBase_trafficCases));
return v_LGenBase_trafficCases[pl_tcAbsIdx].uniqueName
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_getEnabledWeightListFromScenario
//
// Purpose:
// Function to copy traffic weights from TCs of a scenario in to
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_getEnabledWeightListFromScenario(
in integer pl_eGrpIdx,
in integer pl_scIdx)
runs on EPTF_LGenBase_Private_CT return EPTF_ProbabilityList {
var integer vl_tcCount :=sizeof(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].tcIdxList)
var integer vl_tcIdx;
var EPTF_ProbabilityList vl_wList
//v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].
if (c_EPTF_Common_debugSwitch){
f_EPTF_Base_assert(%definitionId&": Not weighted scenario!:"
&v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].name,
ispresent(v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].weightedScData));
}
for (var integer i:=0; i<vl_tcCount; i:=i+1) {
vl_tcIdx := v_LGenBase_entityGroups[pl_eGrpIdx].scenarios[pl_scIdx].tcIdxList[i]
if (not (v_LGenBase_trafficCases[vl_tcIdx].groupFinishConditionDetected.anythingFinished or
v_LGenBase_trafficCases[vl_tcIdx].groupFinishConditionProcessed.anythingFinished) and
v_LGenBase_trafficCases[vl_tcIdx].enabled and
originating == v_LGenBase_trafficCases[vl_tcIdx].trafficType)
{
vl_wList[i] := v_LGenBase_trafficCases[vl_tcIdx].schedulerData.target.trafficWeight;
} else {
vl_wList[i] := 0.0
}
}
return vl_wList;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_registerTcStartedCallback
//
// Purpose:
// Registers a callback function to notify users about stopping or starting a tc
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_registerTcStartedCallback(in EPTF_LGenBase_tcStartedOrStopped_FT pl_fn)
runs on EPTF_LGenBase_Private_CT{
v_LGenBase_tcStartedOrStoppedCallbacks[sizeof(v_LGenBase_tcStartedOrStoppedCallbacks)] := pl_fn;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeTrafficStartedFn
//
// Purpose:
// Removes the callback function registered by the <f_EPTF_LGenBase_registerTcStartedCallback>
///////////////////////////////////////////////////////////
private function f_EPTF_LGenBase_removeTcStartedCallback(in EPTF_LGenBase_tcStartedOrStopped_FT pl_fn)
runs on EPTF_LGenBase_Private_CT
{
var integer vl_count := sizeof(v_LGenBase_tcStartedOrStoppedCallbacks);
var integer vl_found := 0;
while ( vl_found < vl_count and v_LGenBase_tcStartedOrStoppedCallbacks[vl_found] != pl_fn )
{
vl_found := vl_found + 1;
}
f_EPTF_Base_assert(%definitionId&": Invalid trafficStarted function!",vl_found < vl_count);
var EPTF_LGenBase_tcStartedOrStopped_FTList vl_newList := {};
for ( var integer vl_i := 0; vl_i < vl_found ; vl_i := vl_i+1 )
{
vl_newList[vl_i] := v_LGenBase_tcStartedOrStoppedCallbacks[vl_i];
}
for ( var integer vl_i := vl_found; vl_i < vl_count-1 ; vl_i := vl_i+1 )
{
vl_newList[vl_i] := v_LGenBase_tcStartedOrStoppedCallbacks[vl_i+1];
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_registerScenarioStateChangedCallback
//
// Purpose:
// Registers a callback function to notify users about changing the state of a scenario
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_registerScenarioStateChangedCallback(in EPTF_LGenBase_scenarioStateChanged_FT pl_fn)
runs on EPTF_LGenBase_Private_CT{
v_LGenBase_scenarioStateChangedCallbacks[sizeof(v_LGenBase_scenarioStateChangedCallbacks)] := pl_fn;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_registerTcStateChangedCallback
//
// Purpose:
// Registers a callback function to notify users about the change of a tc
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_registerTcStateChangedCallback(in EPTF_LGenBase_tcStateChanged_FT pl_fn)
runs on EPTF_LGenBase_Private_CT{
v_LGenBase_tcStateChangedCallbacks[sizeof(v_LGenBase_tcStateChangedCallbacks)] := pl_fn;
}
group statisticalCalbbacks{
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_registerTrafficStartedFn
//
// Purpose:
// Registers a callback function to notify users about starting a traffic on an entity
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_registerTrafficStartedFn(in EPTF_LGenBase_trafficStarted_FT pl_fn)
runs on EPTF_LGenBase_Private_CT
{
v_LGenBase_trafficStarted_FTList[sizeof(v_LGenBase_trafficStarted_FTList)] := pl_fn;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeTrafficStartedFn
//
// Purpose:
// Removes the callback function registered by the <f_EPTF_LGenBase_registerTrafficStartedFn>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeTrafficStartedFn(in EPTF_LGenBase_trafficStarted_FT pl_fn)
runs on EPTF_LGenBase_Private_CT
{
var integer vl_count := sizeof(v_LGenBase_trafficStarted_FTList);
var integer vl_found := 0;
while ( vl_found < vl_count and v_LGenBase_trafficStarted_FTList[vl_found] != pl_fn )
{
vl_found := vl_found + 1;
}
f_EPTF_Base_assert(%definitionId&": Invalid trafficStarted function!",vl_found < vl_count);
var EPTF_LGenBase_trafficStarted_FTList vl_newList := {};
for ( var integer vl_i := 0; vl_i < vl_found ; vl_i := vl_i+1 )
{
vl_newList[vl_i] := v_LGenBase_trafficStarted_FTList[vl_i];
}
for ( var integer vl_i := vl_found; vl_i < vl_count-1 ; vl_i := vl_i+1 )
{
vl_newList[vl_i] := v_LGenBase_trafficStarted_FTList[vl_i+1];
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_registerTrafficSuccessFn
//
// Purpose:
// Registers a callback function to notify users about starting a traffic on an entity
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_registerTrafficSuccessFn(in EPTF_LGenBase_tcStatChangedCallback_FT pl_fn)
runs on EPTF_LGenBase_Private_CT
{
v_LGenBase_refreshSuccFnList[sizeof(v_LGenBase_refreshSuccFnList)] := pl_fn;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeTrafficSuccessFn
//
// Purpose:
// Removes the callback function registered by the <f_EPTF_LGenBase_registerTrafficSuccessFn>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeTrafficSuccessFn(in EPTF_LGenBase_tcStatChangedCallback_FT pl_fn)
runs on EPTF_LGenBase_Private_CT
{
var integer vl_count := sizeof(v_LGenBase_refreshSuccFnList);
var integer vl_found := 0;
while ( vl_found < vl_count and v_LGenBase_refreshSuccFnList[vl_found] != pl_fn )
{
vl_found := vl_found + 1;
}
f_EPTF_Base_assert(%definitionId&": Invalid traffic success function to deregister!",vl_found < vl_count);
var EPTF_LGenBase_tcStatChangedCallback_FTList vl_newList := {};
for ( var integer vl_i := 0; vl_i < vl_found ; vl_i := vl_i+1 )
{
vl_newList[vl_i] := v_LGenBase_refreshSuccFnList[vl_i];
}
for ( var integer vl_i := vl_found; vl_i < vl_count-1 ; vl_i := vl_i+1 )
{
vl_newList[vl_i] := v_LGenBase_refreshSuccFnList[vl_i+1];
}
v_LGenBase_refreshSuccFnList := vl_newList;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_registerTrafficFailedFn
//
// Purpose:
// Registers a callback function to notify users about starting a traffic on an entity
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_registerTrafficFailedFn(in EPTF_LGenBase_tcStatChangedCallback_FT pl_fn)
runs on EPTF_LGenBase_Private_CT
{
v_LGenBase_refreshFailFnList[sizeof(v_LGenBase_refreshFailFnList)] := pl_fn;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeTrafficFailedFn
//
// Purpose:
// Removes the callback function registered by the <f_EPTF_LGenBase_registerTrafficFailedFn>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeTrafficFailedFn(in EPTF_LGenBase_tcStatChangedCallback_FT pl_fn)
runs on EPTF_LGenBase_Private_CT
{
var integer vl_count := sizeof(v_LGenBase_refreshFailFnList);
var integer vl_found := 0;
while ( vl_found < vl_count and v_LGenBase_refreshFailFnList[vl_found] != pl_fn )
{
vl_found := vl_found + 1;
}
f_EPTF_Base_assert(%definitionId&": Invalid traffic failed function to deregister!",vl_found < vl_count);
var EPTF_LGenBase_tcStatChangedCallback_FTList vl_newList := {};
for ( var integer vl_i := 0; vl_i < vl_found ; vl_i := vl_i+1 )
{
vl_newList[vl_i] := v_LGenBase_refreshFailFnList[vl_i];
}
for ( var integer vl_i := vl_found; vl_i < vl_count-1 ; vl_i := vl_i+1 )
{
vl_newList[vl_i] := v_LGenBase_refreshFailFnList[vl_i+1];
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_registerTrafficErrorFn
//
// Purpose:
// Registers a callback function to notify users about starting a traffic on an entity
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_registerTrafficErrorFn(in EPTF_LGenBase_tcStatChangedCallback_FT pl_fn)
runs on EPTF_LGenBase_Private_CT
{
v_LGenBase_refreshErrorFnList[sizeof(v_LGenBase_refreshErrorFnList)] := pl_fn;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeTrafficErrorFn
//
// Purpose:
// Removes the callback function registered by the <f_EPTF_LGenBase_registerTrafficErrorFn>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeTrafficErrorFn(in EPTF_LGenBase_tcStatChangedCallback_FT pl_fn)
runs on EPTF_LGenBase_Private_CT
{
var integer vl_count := sizeof(v_LGenBase_refreshErrorFnList);
var integer vl_found := 0;
while ( vl_found < vl_count and v_LGenBase_refreshErrorFnList[vl_found] != pl_fn )
{