blob: 799e339063617ff5d50c5f72cf4886d6c5cd2df4 [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_DsRestAPI_PerfTest_Functions
//
// Purpose:
// This module contains functions for testing EPTF DsRestAPI.
//
// Module Parameters:
// -
// Module depends on:
// <EPTF_DsRestAPI_PerfTest_Definitions>
// <EPTF_CLL_DsRestAPI_Definitions>
// <EPTF_CLL_DsRestAPI_Functions>
// <EPTF_CLL_Base_Functions>
// <EPTF_CLL_Common_Definitions>
//
// Current Owner:
// Daniel Gobor (ednigbo)
//
// Last Review Date:
// -
//
// Detailed Comments:
// -
///////////////////////////////////////////////////////////
module EPTF_DsRestAPI_PerfTest_Functions {
//=========================================================================
// Import Part
//=========================================================================
import from EPTF_CLL_Base_Functions all;
import from EPTF_CLL_DataSource_Definitions all;
import from EPTF_CLL_DataSource_Functions all;
import from EPTF_CLL_ExecCtrlClient_Functions all;
import from EPTF_CLL_ExecCtrl_Definitions all;
import from EPTF_CLL_ExecCtrl_Functions all;
import from EPTF_CLL_HostAdminServer_Definitions all;
import from EPTF_CLL_HostAdminServer_Definitions all;
import from EPTF_CLL_HostAdminServer_Functions all;
import from EPTF_CLL_HostAdmin_Functions all;
import from EPTF_CLL_LGenBase_ConfigFunctions all;
import from EPTF_CLL_LGenBase_Functions all;
import from EPTF_CLL_DsRestAPI_DSServer_Functions all;
import from EPTF_CLL_DsRestAPI_Functions all;
import from EPTF_DsRestAPI_PerfTest_Definitions all;
//=========================================================================
// Functions
//=========================================================================
function f_EPTF_DsRestAPI_PerfTest_init_CT(in charstring pl_selfName) runs on DsRestAPI_PerfTest_CT {
f_EPTF_Base_init_CT(pl_selfName);
f_EPTF_Base_registerCleanup(refers(f_EPTF_DsRestAPI_PerfTest_cleanup_CT));
f_EPTF_DsRestAPI_PerfTest_DS_init_CT(pl_selfName, self);
var EPTF_HostAdminServer_CT vl_hostAdminServer_compRef := EPTF_HostAdminServer_CT.create;
vl_hostAdminServer_compRef.start(f_EPTF_HostDminServerBehaviour());
f_EPTF_HostAdmin_init_CT(f_EPTF_Base_selfName(), pl_dataSource_compRef := self);
}
function f_EPTF_DsRestAPI_PerfTest_DS_init_CT(
in charstring pl_selfName,
in EPTF_DataSource_CT pl_dataSource_compRef := null
) runs on DsRestAPI_PerfTest_CT{
f_EPTF_DsRestAPI_DSServer_init_CT(pl_selfName);
if(pl_dataSource_compRef != null) {
v_ready := false;
f_EPTF_DataSource_registerReadyCallback(refers(f_EPTF_ExecCtrl_Test_DataSourceClientReady ));
f_EPTF_ExecCtrl_setManualControl(true);
f_EPTF_ExecCtrl_loadConfig(
pl_EPTF_LGenBase_ScenarioDeclaratorList := {},
pl_EPTF_LGenBase_tcTypeDeclaratorList := {},
pl_EPTF_LGenBase_TcMgmt_ScenarioDeclaratorList := {},
pl_EPTF_LGenBase_TcMgmt_WeightedScenarioDeclaratorList:= {},
pl_EPTF_ExecCtrl_TimeProfileDescrList:={},
pl_EPTF_ExecCtrl_TimeProfileList:={},
pl_EPTF_ExecCtrl_TimeProfile2TcList:={},
pl_EPTF_ExecCtrl_ScenarioInstanceTypeList:={},
pl_EPTF_ExecCtrl_LGenFunction_Entry_List:={{
name := omit,
fn := refers(f_ExecCtrl_Test_createDefaultLGen)
}},
pl_EPTF_ExecCtrl_PhaseList_Declarators:={},
pl_EPTF_ExecCtrl_ScenarioGroup_Declarators:={},
pl_EPTF_ExecCtrl_RegulatorNames:={"LimitMaxRegulator"}
);
f_EPTF_ExecCtrl_init_CT(f_EPTF_Base_selfName(), 0, pl_dataSource_compRef := self);
timer T_guard, T_alt;
T_guard.start( 10.0 );
T_alt.start( 0.0 );
alt{
[] T_guard.timeout{
setverdict(fail,"Timeout during config");
}
[v_ready] T_alt.timeout{}
};
}
}
private function f_EPTF_DsRestAPI_PerfTest_cleanup_CT() runs on DsRestAPI_PerfTest_CT {
}
private function f_EPTF_ExecCtrl_Test_DataSourceClientReady(
in charstring pl_source,
in charstring pl_ptcName)
runs on DsRestAPI_PerfTest_CT{
if (pl_source==c_ExecCtrl_DataSource_sourceId) {
v_ready := true;
}
}
function f_EPTF_ExecCtrl_CLITest_defaultLGenBehaviour(in charstring pl_name, in EPTF_ExecCtrl_CT pl_execCtrlCompRef) runs on EPTF_ExecCtrlClient_CT {
f_EPTF_LGenBase_init(pl_name);
var integer vl_Ret := f_EPTF_LGenBase_declareBehaviorType(cg_EPTF_ExecCtrl_Test_defaultBehaviorName, -1, null, null, null);
vl_Ret := f_EPTF_LGenBase_declareEntityType(cg_EPTF_ExecCtrl_Test_defaultETypeName, {cg_EPTF_ExecCtrl_Test_defaultBehaviorName});
vl_Ret := f_EPTF_LGenBase_declareFSMTable(cg_EPTF_ExecCtrl_Test_defaultFSM);
f_EPTF_ExecCtrlClient_init_CT(pl_name, pl_execCtrlCompRef);
f_EPTF_Base_wait4Shutdown();
}
private function f_ExecCtrl_Test_createDefaultLGen(in charstring pl_hostname, in charstring pl_componentName) runs on EPTF_ExecCtrl_CT return EPTF_ExecCtrlClient_CT {
pl_hostname := pl_componentName;
var EPTF_ExecCtrlClient_CT vl_lgen := EPTF_ExecCtrlClient_CT.create;
vl_lgen.start( f_EPTF_ExecCtrl_CLITest_defaultLGenBehaviour("ExecCtrl_DefaultLGen_"&log2str(vl_lgen),self) );
return vl_lgen;
}
function f_EPTF_HostDminServerBehaviour() runs on EPTF_HostAdminServer_CT {
f_EPTF_HostAdminServer_init_CT("MTC", mtc);
f_EPTF_Base_wait4Shutdown();
}
} //module