blob: f0dbc79fe846575c783b8cfdde1e57514df60bdf [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2018 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_ILog_Application_Functions
//
// Purpose:
// This module contains function definitions for demo of EPTF ILog
// Applictaion layer
//
// Module Parameters:
// -
//
// Module depends on:
// <EPTF_CLL_Base_Functions>
// <EPTF_CLL_Common_Definitions>
// <EPTF_CLL_LGenBase_Definitions>
// <EPTF_CLL_LGenBase_ConfigDefinitions>
// <EPTF_CLL_LGenBase_ConfigFunctions>
// <EPTF_CLL_LGenBase_Functions>
// <EPTF_CLL_LGenBase_TrafficFunctions>
// <EPTF_CLL_ILogBase_Functions>
// <EPTF_CLL_ILog_Functions>
// <EPTF_ILog_Application_Definitions>
// <EPTF_ILog_Applib_Functions>
// <EPTF_ILog_Transport_Functions>
//
// Current Owner:
// Jozsef Gyurusi (ethjgi)
//
// Last Review Date:
// -
//
// Detailed Comments:
// -
///////////////////////////////////////////////////////////
module EPTF_ILog_Application_Functions {
import from EPTF_CLL_Base_Functions all;
import from EPTF_CLL_Common_Definitions all;
import from EPTF_CLL_LGenBase_Definitions all;
import from EPTF_CLL_LGenBase_ConfigDefinitions all;
import from EPTF_CLL_LGenBase_ConfigFunctions all;
import from EPTF_CLL_LGenBase_Functions all;
import from EPTF_CLL_LGenBase_TrafficFunctions all;
import from EPTF_CLL_ILog_Functions all;
import from EPTF_CLL_LGenBase_ILog_Functions all;
import from EPTF_ILog_Application_Definitions all;
import from EPTF_ILog_Applib_Functions all;
import from EPTF_ILog_Transport_Functions all;
///////////////////////////////////////////////////////////
// Function: f_EPTF_ILog_Application_init_CT
//
// Purpose:
// This function initializes the EPTF_ILog_Test_CT component and declares an entity, fsm event, step and fsm table.
//
// Parameters:
// pl_selfName - *in* *charstring* - component self name
//
///////////////////////////////////////////////////////////
public function f_EPTF_ILog_Application_init_CT(in charstring pl_selfName)
runs on EPTF_ILog_Test_CT{
if(v_EPTF_ILog_Application_initialized){
return;
}
f_EPTF_Base_init_CT(pl_selfName);
f_EPTF_LGenBase_init(pl_selfName,20);
f_EPTF_ILog_Applib_init_CT(pl_selfName);
f_EPTF_ILog_Transport_setResponseWeights(tsp_EPTF_ILog_Test_responseWeights);
var integer v_dummyInt;
v_EPTF_ILogTest_behaviorIdx := f_EPTF_LGenBase_declareBehaviorType(c_EPTF_ILogTest_behavior, -1, null, null, null);
v_dummyInt := f_EPTF_LGenBase_declareEntityType("et1", {c_EPTF_ILogTest_behavior});
v_dummyInt := f_EPTF_LGenBase_declareFsmEvent(c_EPTF_ILogTest_behavior, "input1")
v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", 20})
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_ILogTest_behavior, {c_EPTF_ILogTest_stepName_newChains,refers( f_EPTF_ILogTest_step_newChains)});
v_dummyInt := f_EPTF_LGenBase_declareFunction("Finished",{customFinishFunction := refers(f_EPTF_LGenBase_TestFinished)});
v_EPTF_ILog_Application_successFooterDB := f_EPTF_ILog_register_DB(refers(f_EPTF_ILogTest_logSuccessFooter), {});
v_EPTF_ILog_Application_failFooterDB := f_EPTF_ILog_register_DB(refers(f_EPTF_ILogTest_logFailFooter), {});
v_EPTF_ILog_Application_timeoutFooterDB := f_EPTF_ILog_register_DB(refers(f_EPTF_ILogTest_logTimeoutFooter), {});
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_ILogTest_behavior, {c_EPTF_ILogTest_stepName_logSuccessFooter,refers( f_EPTF_ILogTest_step_logSuccessFooter)});
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_ILogTest_behavior, {c_EPTF_ILogTest_stepName_logFailFooter,refers( f_EPTF_ILogTest_step_logFailFooter)});
v_dummyInt := f_EPTF_LGenBase_declareStep(c_EPTF_ILogTest_behavior, {c_EPTF_ILogTest_stepName_logTimeoutFooter,refers( f_EPTF_ILogTest_step_logTimeoutFooter)});
v_dummyInt := f_EPTF_LGenBase_declareFSMTable(tsp_EPTF_ILogDemo_fsm);
// v_dummyInt := f_EPTF_LGenBase_declareTrafficCaseType(
// {
// "TC1",
// "MAIN_FSM",
// "et1",
// {}
// });
v_dummyInt := f_EPTF_LGenBase_declareScenarioType3(
{ "SC1",
{
{"TC1",{
{target := {cpsToReach := 5.0}},
{enableEntitiesAtStart := true},
{enabledAtStart := true},
{trafficStartFinish := { { nrOfSuccesses := {5, {{testFinished := {}}}}}}},
{trafficFinishedActions := {{customFinishFunction := "Finished" }}},
{fsmList := {"MAIN_FSM"}}
}
}
},
{{enabled := true}}
} )
f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},true)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_ILogTest_step_newChains
//
// Purpose:
// This function creates a new detailed and short chain and stores the chain Ids in the application data
// assigned to the FSM context given in the input parameter.
//
// Parameters:
// pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step arguments for storing the event index,
// fsm context and the chain Ids
//
///////////////////////////////////////////////////////////
public function f_EPTF_ILogTest_step_newChains(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_ILog_Test_CT{
f_EPTF_LGenBase_ILog_newChains( pl_ptr.eIdx, pl_ptr.refContext.fCtxIdx,
refers(f_EPTF_ILogTest_logHeaderDetailed), {pl_ptr.eIdx, pl_ptr.refContext.fCtxIdx},
refers(f_EPTF_ILogTest_logHeaderShort), {pl_ptr.eIdx, pl_ptr.refContext.fCtxIdx} );
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_ILogTest_logHeaderDetailed
//
// Purpose:
// Callback function for creating log header for the detailed log chains.
//
// Parameters:
// pl_chainId - *in* *integer* - chain Id of the logged chain
// pl_param - *in* <EPTF_IntegerList> - parameter list for the logged chain
//
///////////////////////////////////////////////////////////
private function f_EPTF_ILogTest_logHeaderDetailed( in integer pl_chainId, in EPTF_IntegerList pl_param)
runs on EPTF_ILog_Test_CT {
// action("-------------------------- Detailed Log : chain#",pl_chainId," ",f_EPTF_ILogBase_getName(pl_chainId)," of Traffic Case: ", f_EPTF_LGenBase_getTcUniqueNameByTcIdx(f_EPTF_LGenBase_tcIdxOfFSM(pl_param[0], pl_param[1])), ", of Entity#", pl_param[0], " --------------------------");
action("-------------------------- Details ---------------------------");
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_ILogTest_logHeaderShort
//
// Purpose:
// Callback function for creating log header for the short log chains.
//
// Parameters:
// pl_chainId - *in* *integer* - chain Id of the logged chain
// pl_param - *in* <EPTF_IntegerList> - parameter list for the logged chain
//
///////////////////////////////////////////////////////////
private function f_EPTF_ILogTest_logHeaderShort( in integer pl_chainId, in EPTF_IntegerList pl_param)
runs on EPTF_ILog_Test_CT {
action("---------------------------------------------------------------------------------------------");
action("-------------------------- TC: ", f_EPTF_LGenBase_getTcUniqueNameByTcIdx(f_EPTF_LGenBase_tcIdxOfFSM(pl_param[0], pl_param[1])), ", Entity#", pl_param[0], " --------------------------");
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_TestFinished
//
// Purpose:
// This function sets the v_EPTF_ILog_Application_testFinished flag to false.
//
// Parameters:
// pl_idx - *in* *integer* -
//
///////////////////////////////////////////////////////////
function f_EPTF_LGenBase_TestFinished(in integer pl_idx)
runs on EPTF_ILog_Test_CT{
v_EPTF_ILog_Application_testFinished := true;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_ILogTest_logSuccessFooter
//
// Purpose:
// Callback function to create a footer line at the end of the successful traffic.
//
// Parameters:
// pl_elementIdx - *in* *integer* - element index in user db
// pl_dbId - *in* *integer* - user db Id
// pl_chainId - *in* *integer* - chain Id
// pl_param - *in* <EPTF_IntegerList> - user defined parameter list
//
///////////////////////////////////////////////////////////
private function f_EPTF_ILogTest_logSuccessFooter( in integer pl_elementIdx, in integer pl_dbId, in integer pl_chainId, in EPTF_IntegerList pl_param )
runs on EPTF_ILog_Test_CT{
// action("-------------------------- End of successful traffic in chain#",pl_chainId," ",f_EPTF_ILogBase_getName(pl_chainId),"---------------------------------");
action("EPTF_ILog_Application: Verdict: SUCCESS -----------------------------------------------------------");
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_ILogTest_logFailFooter
//
// Purpose:
// Callback function to create a footer line at the end of the failed traffic.
//
// Parameters:
// pl_elementIdx - *in* *integer* - element index in user db
// pl_dbId - *in* *integer* - user db Id
// pl_chainId - *in* *integer* - chain Id
// pl_param - *in* <EPTF_IntegerList> - user defined parameter list
//
///////////////////////////////////////////////////////////
private function f_EPTF_ILogTest_logFailFooter( in integer pl_elementIdx, in integer pl_dbId, in integer pl_chainId, in EPTF_IntegerList pl_param )
runs on EPTF_ILog_Test_CT{
// action("-------------------------- End of failed traffic in chain#",pl_chainId," ",f_EPTF_ILogBase_getName(pl_chainId),"---------------------------------");
action("EPTF_ILog_Application: Verdict: FAIL, NOK received -----------------------------------------------------------");
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_ILogTest_logTimeoutFooter
//
// Purpose:
// Callback function to create a footer line at the end of the timed out traffic.
//
// Parameters:
// pl_elementIdx - *in* *integer* - element index in user db
// pl_dbId - *in* *integer* - user db Id
// pl_chainId - *in* *integer* - chain Id
// pl_param - *in* <EPTF_IntegerList> - user defined parameter list
//
///////////////////////////////////////////////////////////
private function f_EPTF_ILogTest_logTimeoutFooter( in integer pl_elementIdx, in integer pl_dbId, in integer pl_chainId, in EPTF_IntegerList pl_param )
runs on EPTF_ILog_Test_CT{
// action("-------------------------- End of timed out traffic in chain#",pl_chainId," ",f_EPTF_ILogBase_getName(pl_chainId),"---------------------------------");
action("EPTF_ILog_Application: Verdict: FAIL, TIMEOUT -----------------------------------------------------------");
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_ILogTest_step_logSuccessFooter
//
// Purpose:
// Step function to register the log footer at the and of a successful chain.
//
// Parameters:
// pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step arguments for storing the event index,
// fsm context and the chain Ids
//
///////////////////////////////////////////////////////////
public function f_EPTF_ILogTest_step_logSuccessFooter(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_ILog_Test_CT{
var integer vl_addRet;
vl_addRet := f_EPTF_LGenBase_ILog_addToChains(pl_ptr, v_EPTF_ILog_Application_successFooterDB);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_ILogTest_step_logFailFooter
//
// Purpose:
// Step function to register the log footer at the and of a failed chain.
//
// Parameters:
// pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step arguments for storing the event index,
// fsm context and the chain Ids
//
///////////////////////////////////////////////////////////
public function f_EPTF_ILogTest_step_logFailFooter(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_ILog_Test_CT{
var integer vl_addRet;
vl_addRet := f_EPTF_LGenBase_ILog_addToChains(pl_ptr, v_EPTF_ILog_Application_failFooterDB);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_ILogTest_step_logTimeoutFooter
//
// Purpose:
// Step function to register the log footer at the and of a timed out chain.
//
// Parameters:
// pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - test step arguments for storing the event index,
// fsm context and the chain Ids
//
///////////////////////////////////////////////////////////
public function f_EPTF_ILogTest_step_logTimeoutFooter(in EPTF_LGenBase_TestStepArgs pl_ptr)
runs on EPTF_ILog_Test_CT{
var integer vl_addRet;
vl_addRet := f_EPTF_LGenBase_ILog_addToChains(pl_ptr, v_EPTF_ILog_Application_timeoutFooterDB);
}
} // module EPTF_ILog_Application_Functions