blob: 97356ffbef2149db65884976aff88d5ef0011f80 [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2017 Ericsson Telecom AB //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v1.0 //
// which accompanies this distribution, and is available at //
// http://www.eclipse.org/legal/epl-v10.html //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// Module: EPTF_LGenBasePerformTest_LoadLGenFunctions
//
// Purpose:
// This module provides functions for testing LGenBase
//
// Module depends on:
// -
//
// Current Owner:
// Laszlo Skumat (ELSZSKU)
//
// Last Review Date:
// 2008-09-11
//
// Detailed Comments:
// Provide functions to test LGenBase
//
//
///////////////////////////////////////////////////////////////
module EPTF_LGenBasePerformTest_LoadLGenFunctions
{
import from EPTF_LGenBasePerformTest_LoadLGenDefinitions all
import from EPTF_CLL_LGenBase_Definitions all;
import from EPTF_CLL_LGenBaseStats_Functions all;
import from EPTF_CLL_LGenBaseStats_Definitions all;
import from EPTF_LGenBasePerformTest_MTASDefinitions all
import from EPTF_LGenBasePerformTest_MTASFunctions all
import from EPTF_CLL_Base_Functions all;
import from EPTF_CLL_Variable_Functions all
import from EPTF_CLL_Variable_Definitions all
import from EPTF_LGenBasePerformTest_LoadMessages all
import from EPTF_CLL_RBTScheduler_Functions all;
import from EPTF_CLL_Base_Definitions all;
import from TCCSystem_Functions all
import from TCCFileIO_Functions all
#ifdef R3
import from EPTF_CLL_Common_Definitions all
import from EPTF_CLL_LGenBase_ConfigDefinitions all;
import from EPTF_CLL_LGenBase_ConfigFunctions all;
import from EPTF_CLL_LGenBase_TrafficFunctions all;
import from EPTF_CLL_LGenBase_EventHandlingFunctions all;
#endif
#ifdef R2
import from EPTF_CLL_Definitions all
import from EPTF_CLL_LGenBase_Functions all;
#endif
import from ttcn_ericsson_se_TitanSim_Perftest all;
import from TestResultGen all;
const EPTF_LGenBase_TcMgmt_TcOfScenario2 c_EPTF_LGenBase_TcMgmt_emptyTcOfScenario2 := {
"", // charstring tcName,
0.0,// float startDelay optional,
0.0,// float cpsToReach,
true,// boolean enableEntities,
false,// boolean enable,
omit,// EPTF_LGenBase_TcMgmt_ParamRangeDeclaratorList ranges optional,
omit,// EPTF_LGenBase_TcMgmt_tcCustomParamDeclaratorList params optional,
omit,// EPTF_LGenBase_TcMgmt_GroupFinishConditions2 groupFinishConditions optional,
omit,// EPTF_LGenBase_TcMgmt_EntityFinishConditions entityFinishConditions optional,
omit,// EPTF_LGenBase_TcMgmt_EntityActionsList entityFinishActions optional,
omit// EPTF_LGenBase_TcMgmt_GroupActions2List tcFinishActions optional
}
modulepar float tsp_LGenBasePerformTest_LoadLGenGuard := 50.0
function f_EPTF_LGenBasePerformTest_LoadLGen_initTrafficMeas(
in charstring pl_lgenName,
in integer pl_eCount,
in integer pl_lgenId,
in float pl_cps2reach,
in boolean pl_tc)
runs on EPTF_LGenBasePerformTest_LoadLGen_CT{
v_LGenBasePerformTest_LoadLGen_lgenId := pl_lgenId
v_LGenBasePerformTest_LoadLGen_pID := int2str(f_SYS_getpid())
f_EPTF_LGenBaseStats_init(pl_lgenName,pl_lgenName);
f_EPTF_LGenBasePerformTest_MTAS_initEvents()
f_EPTF_LGenBase_declareFunction("dummyStepFn",{testStepFunction := refers(f_EPTF_LGenBasePerformTest_dummyStep)})
v_dummyInt := f_EPTF_LGenBase_declareStep(c_LGen_H248_Behaviour_name, {"dummyStep", refers(f_EPTF_LGenBasePerformTest_dummyStep)})
v_dummyInt := f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null);
v_dummyInt := f_EPTF_LGenBase_declareEntityType("e1",{"b1"});
v_dummyInt := f_EPTF_LGenBase_createEntityGroup({"g1","e1",pl_eCount});
//FSM
f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables({
{
name := "simpleResponse",
// [0]
stateList := {"idle"},
timerList := {},
table := {
{eventToListen := {c_LGen_H248_Behaviour_name, c_EPTF_H248_LGen_inputName_sendEventNotify,entity},
cellRow := {
{{
{stepOrFunctionName := "dummyStepFn",contextArgs := omit}
}, omit, omit}
}
},
{eventToListen := {c_EPTF_XCAP_myBName,c_EPTF_XCAP_inputName_responseError,general},
cellRow := {
//state[0]==idle
{{
{stepOrFunctionName := "dummyStepFn",contextArgs := omit}
}, omit, omit}
}
},
{eventToListen := {c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
//state[0]==idle
{{
{stepOrFunctionName := c_EPTF_LGenBase_StepFunction_trafficSuccess,contextArgs := omit}
}, omit, omit}
}
},
{eventToListen := {c_EPTF_XCAP_myBName,c_EPTF_XCAP_inputName_retryAfter,fsm},
cellRow := {
//state[0]==idle
{{
{stepOrFunctionName := "dummyStepFn",contextArgs := omit}
}, omit, omit}
}
}
}
},
{
name := "timer",
// [0]
stateList := {"idle","busy"},
timerList := {{"t1",0.2}},
table := {
{eventToListen := {c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm},
cellRow := {
{{
{stepOrFunctionName := c_EPTF_LGenBase_StepFunction_timerStart,contextArgs := {timerName := "t1"}}
}, omit, "busy"},
{omit, omit, omit}
}
},
{eventToListen := {c_EPTF_LGenBase_behavior, c_EPTF_LGenBase_inputName_testMgmt_stopTC,fsm},
cellRow := {
{omit, omit, omit},
{{
{stepOrFunctionName := c_EPTF_LGenBase_StepFunction_timerCancel,contextArgs := {timerName := "t1"}}
}, omit, "idle"}
}
},
{eventToListen := {c_EPTF_LGenBase_specialBName_timerTimeout, "t1",fsm},
cellRow := {
{omit, omit, omit},
{{
{stepOrFunctionName := c_EPTF_LGenBase_StepFunction_trafficSuccess,contextArgs := omit}
}, omit, "idle"}
}
}
}
}
})
//TC types
var EPTF_LGenBase_TcMgmt_tcTypeDeclaratorList vl_tcTypes := {
}
for ( var integer vl_i := 0; vl_i < sizeof(c_FSMNames) ; vl_i := vl_i+1 ){
vl_tcTypes[vl_i] := {
name := c_FSMNames[vl_i],
fsmName := c_FSMNames[vl_i],
entityType := "e1",
customEntitySucc := ""
}
v_dummyInt := f_EPTF_LGenBase_declareTcType2(vl_tcTypes[vl_i])
}
vl_tcTypes := {}
vl_tcTypes[0] := {
name := "simpleResponse",
fsmName := "simpleResponse",
entityType := "e1",
customEntitySucc := ""
}
v_dummyInt := f_EPTF_LGenBase_declareTcType2(vl_tcTypes[0])
vl_tcTypes[0] := {
name := "timer",
fsmName := "timer",
entityType := "e1",
customEntitySucc := ""
}
v_dummyInt := f_EPTF_LGenBase_declareTcType2(vl_tcTypes[0])
var EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 vl_sc := {
name:="Sc1",
tcList := {}
}
for ( var integer vl_i := 0; vl_i < sizeof(c_FSMNames) ; vl_i := vl_i+1 ){
vl_sc.tcList[vl_i] := c_EPTF_LGenBase_TcMgmt_emptyTcOfScenario2
vl_sc.tcList[vl_i].tcName := c_FSMNames[vl_i]
}
vl_sc.tcList[sizeof(vl_sc.tcList)] := c_EPTF_LGenBase_TcMgmt_emptyTcOfScenario2
vl_sc.tcList[sizeof(vl_sc.tcList)-1].tcName := "simpleResponse"
vl_sc.tcList[sizeof(vl_sc.tcList)-1].cpsToReach := pl_cps2reach
vl_sc.tcList[sizeof(vl_sc.tcList)] := c_EPTF_LGenBase_TcMgmt_emptyTcOfScenario2
vl_sc.tcList[sizeof(vl_sc.tcList)-1].tcName := "timer"
vl_sc.tcList[sizeof(vl_sc.tcList)-1].cpsToReach := pl_cps2reach
log("---sc:")
log(vl_sc)
v_dummyInt := f_EPTF_LGenBase_declareScenarioType2(vl_sc);
if(pl_tc){
f_EPTF_LGenBase_createScenario2EntityGroup({"g1","Sc1"},false)
}else{
for ( var integer vl_i := 0; vl_i < sizeof(c_FSMNames)+2 ; vl_i := vl_i+1 ){
for ( var integer vl_e := 0; vl_e < pl_eCount ; vl_e := vl_e+1 ){
f_EPTF_LGenBase_activateFsm(vl_e, vl_i, 0, -1)
}
}
}
}
function f_EPTF_LGenBase_varIdOfTcStat(
in integer pl_tcIdx,
in charstring pl_statName)
runs on EPTF_LGenBase_CT
return integer{
var charstring vl_eGrpName, vl_scName, vl_tcName
f_EPTF_LGenBase_trafficCaseIdNames(pl_tcIdx, vl_eGrpName, vl_scName, vl_tcName)
return f_EPTF_Var_getId(f_EPTF_LGenBase_getNamePrefix(vl_eGrpName, vl_scName, vl_tcName)&pl_statName)
}
function f_EPTF_LGenBasePerformTest_LoadLGen_startTrafficMeasCPU(
in charstring pl_lgenName,
in integer pl_eCount,
in integer pl_lgenId,
in float pl_cps2reach,
in charstring pl_tc2start)
runs on EPTF_LGenBasePerformTest_LoadLGen_CT{
f_EPTF_LGenBasePerformTest_LoadLGen_initTrafficMeas(
pl_lgenName,
pl_eCount,
pl_lgenId,
pl_cps2reach,
true)
timer t_cpsMeas
var integer vl_sent := 0
var integer vl_tc := f_EPTF_LGenBase_trafficCaseId("g1", "Sc1", "simpleResponse")
var LGenBasePerformTest_LoadMessage vl_msg
var float vl_lastTime := 0.0
timer t_guard
t_guard.start( tsp_LGenBasePerformTest_LoadLGenGuard )
f_EPTF_LGenBase_startTrafficCase("g1", "Sc1", "simpleResponse")
f_EPTF_LGenBasePerformTest_LoadLGen_createMessage("", vl_msg)
v_LGenBasePerformTest_MTCLoadMessagesPort.send(vl_msg);
t_cpsMeas.start( 1.0 )
alt
{
[] v_LGenBasePerformTest_MTCLoadMessagesPort.receive(LGenBasePerformTest_LoadMessage:?){
var float vl_duration := t_guard.read
var integer vl_sentMsgs := f_EPTF_LGenBase_getTcStarts(vl_tc)
vl_msg.measuredCPS.cps := int2float(vl_sentMsgs)/vl_duration
v_LGenBasePerformTest_MTCLoadMessagesPort.send(vl_msg)
//action("Measured overall CPS:",vl_msg.measuredCPS.cps)
var integer vl_availId := f_EPTF_LGenBase_varIdOfTcStat(
vl_tc,
c_EPTF_LGenBaseStats_nameOfTcNrOfAvailableEntities)
var integer vl_allId := f_EPTF_LGenBase_varIdOfTcStat(
vl_tc,
c_EPTF_LGenBaseStats_nameOfTcNrOfAllEntities)
var EPTF_Var_DirectContent vl_content
f_EPTF_Var_getContent(vl_availId, vl_content)
var integer vl_availEntities := vl_content.intVal
f_EPTF_Var_getContent(vl_allId, vl_content)
var integer vl_allEntities := vl_content.intVal
if(vl_allEntities == vl_availEntities){
setverdict(pass)
}else{
setverdict(fail)
}
}
[] t_cpsMeas.timeout{
var integer vl_sentMsgs := f_EPTF_LGenBase_getTcStarts(vl_tc)
action("Measured CPS:",int2float(vl_sentMsgs-vl_sent)/(t_guard.read-vl_lastTime))
vl_lastTime:= t_guard.read
vl_sent := vl_sentMsgs
t_cpsMeas.start( 1.0 )
repeat
}
[] t_guard.timeout{ setverdict(fail) }
}
f_EPTF_Base_cleanup_CT()
}
function f_EPTF_LGenBasePerformTest_LoadLGen_createMessage(
in charstring pl_varId,
out LGenBasePerformTest_LoadMessage vl_msg)
runs on EPTF_LGenBasePerformTest_LoadLGen_CT{
vl_msg.varId.lgenId := v_LGenBasePerformTest_LoadLGen_lgenId
vl_msg.varId.pID := v_LGenBasePerformTest_LoadLGen_pID
vl_msg.varId.when := T_EPTF_componentClock.read
vl_msg.varId.varId := pl_varId
}
function f_EPTF_LGenBasePerformTest_LoadLGen_startTrafficMeasCPS(
in charstring pl_lgenName,
in integer pl_eCount,
in integer pl_lgenId,
in integer pl_dispatchCount,
in boolean pl_tc)
runs on EPTF_LGenBasePerformTest_LoadLGen_CT{
var charstring vl_log := ""
if(pl_tc){
vl_log := "Traffic case"
}else{
vl_log := "Unique"
}
var Testresult vl_testResult;
vl_testResult.name := "LGenBase Load CPS";
vl_testResult.purpose := "To measure the maximum CPS...";
f_TestResultGen_getEnvironment(vl_testResult.environment);
vl_testResult.parameter_list := {
{name := "eCount", unit := "-", base := int2str(pl_eCount) },
{name := "dispatchCount", unit := "-", base := int2str(pl_dispatchCount)},
{name := "tc", unit := "-", base := vl_log}
};
// var charstring vl_startTime := f_getTimeFormatted(f_time(), "%c");
var charstring vl_start_time := f_TestResultGen_getCurrentTime();
vl_testResult.start_time := vl_start_time;
vl_log := ", " & vl_log & "\n"
var EPTF_FloatList vl_FloatList := {}
f_EPTF_LGenBasePerformTest_LoadLGen_initTrafficMeas(
pl_lgenName,
pl_eCount,
pl_lgenId,
0.0,
pl_tc)
//FSM event
var EPTF_LGenBase_ReportedEventDescriptor vl_event
vl_event.event.bIdx:= v_EPTF_XCAP_myBIdx
vl_event.event.iIdx:= c_EPTF_XCAP_inputIdx_retryAfter
if(pl_tc){
vl_event.event.target:={ pl_eCount-1,f_EPTF_LGenBase_getFSMCtxIdx(pl_eCount-1, f_EPTF_LGenBase_trafficCaseId("g1","Sc1", "simpleResponse"))}
}else{
vl_event.event.target:={ pl_eCount-1,sizeof(c_FSMNames)}//Yes, the first FSM after the last one in c_FSMNames
}
#ifdef R3
vl_event.event.source := omit
#endif
vl_event.reportedArgs:= {}
var float vl_start := T_EPTF_componentClock.read
for ( var integer vl_i := 0; vl_i < pl_dispatchCount*10 ; vl_i := vl_i+1 ){
f_EPTF_LGenBase_dispatchEvent(vl_event)
}
var float vl_duration := T_EPTF_componentClock.read - vl_start
vl_FloatList[0] := int2float(pl_dispatchCount*10)/vl_duration
log("FSM: dispatch count == ",pl_dispatchCount," duration == ",vl_duration)
vl_testResult.result_list := {{
name := "FSM dispatch rate",
unit := "dispatch/sec",
base := float2str(vl_FloatList[0])
}};
//Entity
vl_event.event.bIdx:= v_H248_LGen_myBIdx
vl_event.event.iIdx:= c_EPTF_H248_LGen_inputIdx_sendEventNotify
vl_start := T_EPTF_componentClock.read
for ( var integer vl_i := 0; vl_i < pl_dispatchCount ; vl_i := vl_i+1 ){
f_EPTF_LGenBase_dispatchEvent(vl_event)
}
vl_duration := T_EPTF_componentClock.read - vl_start
vl_FloatList[1] := int2float(pl_dispatchCount)/vl_duration
log("Entity: dispatch count == ",pl_dispatchCount," duration == ",vl_duration)
vl_testResult.result_list[sizeof(vl_testResult.result_list)] := {
name := "Entity dispatch rate",
unit := "dispatch/sec",
base := float2str(vl_FloatList[1])
};
//General
vl_event.event.bIdx:= v_EPTF_XCAP_myBIdx
vl_event.event.iIdx:= c_EPTF_XCAP_inputIdx_responseError
vl_start := T_EPTF_componentClock.read
for ( var integer vl_i := 0; vl_i < pl_dispatchCount ; vl_i := vl_i+1 ){
f_EPTF_LGenBase_dispatchEvent(vl_event)
}
vl_duration := T_EPTF_componentClock.read - vl_start
vl_FloatList[2] := int2float(pl_dispatchCount)/vl_duration
log("General: dispatch count == ",pl_dispatchCount," duration == ",vl_duration)
vl_testResult.result_list[sizeof(vl_testResult.result_list)] := {
name := "General dispatch rate",
unit := "dispatch/sec",
base := float2str(vl_FloatList[2])
};
log("-----CPSTestResult----")
const EPTF_CharstringList vl_titles := {"FSM\t","\nEntity\t","\nGeneral\t"}
for ( var integer vl_j := 0; vl_j < 3 ; vl_j := vl_j+1 ){
vl_log := vl_log & vl_titles[vl_j]&log2str(vl_FloatList[vl_j])
}
action(vl_log)
var integer vl_f := f_FIO_open_append_wronly(tsp_resultFile)
f_FIO_write_text_flush(vl_f,vl_log&"\n")
f_FIO_close(vl_f)
vl_testResult.end_time := f_TestResultGen_getCurrentTime();
f_TestResultGen_appendResult("LGenBase_LoadCPS"&vl_start_time&".xml", vl_testResult);
f_EPTF_Base_cleanup_CT()
}
} // end of module