| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // 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_MemLoadgenFunctions |
| // |
| // 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_MemLoadgenFunctions |
| {
|
| import from EPTF_CLL_LGenBase_Definitions all; |
| import from EPTF_CLL_LGenBase_Functions all; |
| import from EPTF_CLL_LGenBaseStats_Functions all; |
| |
| import from EPTF_CLL_Base_Functions all; |
| import from TCCSystem_Functions all |
| #ifdef R3 |
| import from EPTF_CLL_LGenBase_ConfigDefinitions all; |
| import from EPTF_CLL_LGenBase_ConfigFunctions all; |
| import from EPTF_CLL_LGenBase_PhaseDefinitions all; |
| import from EPTF_CLL_LGenBase_PhaseFunctions all; |
| import from EPTF_CLL_LGenBase_PhaseConfigFunctions all; |
| import from EPTF_CLL_LGenBase_TemplateDefinitions all; |
| import from EPTF_CLL_LGenBase_TemplateFunctions all; |
| import from EPTF_CLL_LGenBase_TrafficFunctions all; |
| import from EPTF_CLL_LGenBase_StepFunctions all; |
| import from EPTF_CLL_LGenBase_EventHandlingFunctions all; |
| #endif |
| #ifdef R2 |
| import from EPTF_CLL_Definitions all |
| import from EPTF_CLL_Scheduler_Definitions all; |
| import from EPTF_CLL_RBTScheduler_Functions all; |
| import from EPTF_CLL_Base_Definitions all; |
| #endif |
| |
| import from EPTF_LGenBasePerformTest_MemLoadgenDefinitions all |
| import from EPTF_LGenBasePerformTest_MemMessages all |
| |
| //import from LOADMEASasp_PortType all; |
| //import from LOADMEASasp_Types all; |
| |
| |
| function f_EPTF_LGenBasePerformTest_init(in charstring pl_lgenName) |
| runs on EPTF_LGenBasePerformTest_CT{ |
| f_EPTF_LGenBaseStats_init(pl_lgenName,pl_lgenName); |
| log(%definitionId&"____Init done") |
| f_EPTF_Base_RegisterCleanup(refers(f_EPTF_LGenBasePerformTest_cleanup_CT)) |
| v_LGenBasePerformTest_pID := int2str(f_SYS_getpid()) |
| v_LGenBasePerformTest_receiveControlMsg := activate(as_receiveControlMsg()) |
| //f_EPTF_Base_wait4Shutdown() |
| } |
| |
| function f_EPTF_LGenBasePerformTest_start(in charstring pl_lgenName) |
| runs on EPTF_LGenBasePerformTest_CT{ |
| f_EPTF_LGenBasePerformTest_init(pl_lgenName); |
| T_EPTF_componentClock.timeout; |
| } |
| |
| function f_EPTF_LGenBasePerformTest_cleanup_CT() |
| runs on EPTF_LGenBasePerformTest_CT{ |
| if(null != v_LGenBasePerformTest_receiveControlMsg){ |
| deactivate(v_LGenBasePerformTest_receiveControlMsg) |
| } |
| } |
| |
| function f_handleControlMessage (in MeasureControl_MgmtMsg pl_incControlMsg) |
| runs on EPTF_LGenBasePerformTest_CT |
| { |
| if (ischosen(pl_incControlMsg.v_MeasureControl_exit)) { |
| log("Exit message received") |
| setverdict ( pass ); |
| f_EPTF_Base_cleanup_CT() |
| stop |
| return |
| } |
| v_controlPort.send( {v_MeasureControl_started := {T_EPTF_componentClock.read}} ); |
| select(true){ |
| case (ischosen(pl_incControlMsg.v_MeasureControl_pID)){ |
| v_controlPort.send( {v_MeasureControl_pID := {v_LGenBasePerformTest_pID}}) |
| } |
| case (ischosen(pl_incControlMsg.v_MeasureControl_createEntityGroup)) { |
| f_createEntityGroup( |
| pl_incControlMsg.v_MeasureControl_createEntityGroup.entityGroupName, |
| pl_incControlMsg.v_MeasureControl_createEntityGroup.entityTypeName, |
| pl_incControlMsg.v_MeasureControl_createEntityGroup.numOfEntities); |
| } |
| case (ischosen(pl_incControlMsg.v_MeasureControl_declareEntityType)) { |
| f_declareEntityType(pl_incControlMsg.v_MeasureControl_declareEntityType.entityTypeName, |
| pl_incControlMsg.v_MeasureControl_declareEntityType.behaviorName); |
| } |
| case (ischosen(pl_incControlMsg.v_MeasureControl_declareFsms)) { |
| f_declareFsm(pl_incControlMsg.v_MeasureControl_declareFsms); |
| } |
| case (ischosen(pl_incControlMsg.v_MeasureControl_declareScenarios)) { |
| f_declareScenario(pl_incControlMsg.v_MeasureControl_declareScenarios.scenario); |
| } |
| case (ischosen(pl_incControlMsg.v_MeasureControl_declareTrafficCases)) { |
| f_declareTrafficCase(pl_incControlMsg.v_MeasureControl_declareTrafficCases.tcType); |
| } |
| case (ischosen(pl_incControlMsg.v_MeasureControl_initLGenBase)) { |
| f_initLGenBase(pl_incControlMsg.v_MeasureControl_initLGenBase.v_behavName, |
| pl_incControlMsg.v_MeasureControl_initLGenBase.v_maxCount); |
| } |
| case (ischosen(pl_incControlMsg.v_MeasureControl_startTraffic)) { |
| f_startTraffic(pl_incControlMsg.v_MeasureControl_startTraffic.eGrpName, |
| pl_incControlMsg.v_MeasureControl_startTraffic.scName); |
| } |
| case (ischosen(pl_incControlMsg.v_MeasureControl_startTc)) { |
| f_EPTF_LGenBase_startTrafficCase( |
| pl_incControlMsg.v_MeasureControl_startTc.eGrpName, |
| pl_incControlMsg.v_MeasureControl_startTc.scName, |
| pl_incControlMsg.v_MeasureControl_startTc.tcName); |
| } |
| case (ischosen(pl_incControlMsg.v_MeasureControl_stopTraffic)) { |
| f_stopTraffic(pl_incControlMsg.v_MeasureControl_stopTraffic.eGrpName, |
| pl_incControlMsg.v_MeasureControl_stopTraffic.scName, |
| pl_incControlMsg.v_MeasureControl_stopTraffic.tcName); |
| } |
| case (ischosen(pl_incControlMsg.v_MeasureControl_activateFsm)) { |
| f_activateFsm(); |
| } |
| case (ischosen(pl_incControlMsg.v_MeasureControl_setCPS)) { |
| f_setCPS(pl_incControlMsg.v_MeasureControl_setCPS.eGrpName, |
| pl_incControlMsg.v_MeasureControl_setCPS.scName, |
| pl_incControlMsg.v_MeasureControl_setCPS.tcName, |
| pl_incControlMsg.v_MeasureControl_setCPS.newCps); |
| } |
| case else { |
| log("Error: Invalid message received") |
| f_EPTF_Base_stop() |
| } |
| } |
| v_controlPort.send( {v_MeasureControl_finished := {T_EPTF_componentClock.read}} ); |
| } |
| |
| function f_createEntityGroup( |
| in charstring pl_entityGroupName, |
| in charstring pl_entityTypeName, |
| in integer pl_numOfEntities := 10) |
| runs on EPTF_LGenBasePerformTest_CT |
| { |
| v_numberOfEntities := pl_numOfEntities; |
| f_EPTF_LGenBase_createEntityGroup({name := pl_entityGroupName, eType := pl_entityTypeName, eCount := pl_numOfEntities}); |
| } |
| |
| function f_declareEntityType( |
| in charstring pl_entityTypeName, |
| in charstring pl_behaviorName) |
| runs on EPTF_LGenBasePerformTest_CT |
| { |
| f_EPTF_LGenBase_declareEntityType(pl_entityTypeName, {pl_behaviorName}); |
| } |
| |
| function f_declareFsm(in EPTF_LGenBase_TcMgmt_CompactFsmTableDeclaratorList pl_decl) |
| runs on EPTF_LGenBasePerformTest_CT |
| { |
| if(0 == sizeof(pl_decl)){ |
| f_EPTF_LGenBase_declareCompactFsmTable(valueof(t_LGenBasePerformTest_simpleResponse( |
| c_LGenBasePerformTest_fsmNameSimpleResponseSucc, |
| refers(f_EPTF_LGenBase_step_trafficSuccess)))); |
| v_LGenBasePerformTest_declaredFSMTables := v_LGenBasePerformTest_declaredFSMTables + 1 |
| }else{ |
| for ( var integer vl_i := 0; vl_i < sizeof(pl_decl) ; vl_i := vl_i+1 ){ |
| f_EPTF_LGenBase_declareParamedFsmTable(pl_decl[vl_i], compact) |
| } |
| v_LGenBasePerformTest_declaredFSMTables := v_LGenBasePerformTest_declaredFSMTables + sizeof(pl_decl) |
| } |
| } |
| |
| function f_activateFsm() |
| runs on EPTF_LGenBasePerformTest_CT |
| { |
| for ( var integer vl_t := 0; vl_t < v_LGenBasePerformTest_declaredFSMTables ; vl_t := vl_t+1 ){ |
| for (var integer i := 0; i<v_numberOfEntities ; i := i + 1) { |
| f_EPTF_LGenBase_activateFsm(pl_eIdx:= i, pl_tIdx:= vl_t, pl_sIdx:=0, pl_tcIdx:= -1); |
| } |
| } |
| } |
| |
| function f_declareScenario( |
| in EPTF_LGenBase_TcMgmt_ScenarioDeclarator2 pl_scenario) |
| runs on EPTF_LGenBasePerformTest_CT |
| { |
| f_EPTF_LGenBase_declareScenarioType2(pl_scenario); |
| } |
| |
| function f_declareTrafficCase( |
| in EPTF_LGenBase_TcMgmt_tcTypeDeclarator2 pl_tcType) |
| runs on EPTF_LGenBasePerformTest_CT |
| { |
| f_EPTF_LGenBase_declareTcType2(pl_tcType); |
| } |
| |
| function f_initLGenBase( |
| in charstring pl_behaviorName, |
| in integer pl_maxCount) |
| runs on EPTF_LGenBasePerformTest_CT |
| { |
| f_EPTF_LGenBaseStats_init("LGenBasePerformanceTest", "LGenBasePerformanceTest#"); |
| |
| /*f_EPTF_LGenBaseStats_init( |
| "Test", |
| 0, |
| "Test", |
| tsp_LGenBase_BustCalcMethod, |
| tsp_LGenBase_extTemplLoadList, |
| null);*/ |
| |
| f_EPTF_LGenBase_declareBehaviorType(pl_behaviorName, pl_maxCount, null, null, null); |
| |
| // f_EPTF_LGenBase_registerSetTransactionTimeFn(refers(f_entitySpeed)); |
| } |
| |
| function f_entitySpeed(in integer pl_tcAbsIdx, in integer pl_eRelIdx, in float pl_transactionTime) |
| runs on EPTF_LGenBasePerformTest_CT |
| { |
| /*if () { |
| log("Transaction time is: ",f_EPTF_LGenBase_getCPSByNames("g1","Sc1","TC_Succ"); |
| }*/ |
| } |
| |
| function f_startTraffic( |
| in charstring pl_eGrpName, |
| in charstring pl_scName) |
| runs on EPTF_LGenBasePerformTest_CT |
| { |
| f_EPTF_LGenBase_createScenario2EntityGroup( { pl_eGrpName, pl_scName } ); |
| |
| |
| } |
| |
| function f_setCPS( |
| in charstring pl_eGrpName, |
| in charstring pl_scName, |
| in charstring pl_tcName, |
| in float pl_newCps) |
| runs on EPTF_LGenBasePerformTest_CT |
| { |
| f_EPTF_LGenBase_setCPSByNames(pl_eGrpName, pl_scName, pl_tcName, pl_newCps); |
| |
| |
| } |
| |
| function f_stopTraffic( |
| in charstring pl_eGrpName, |
| in charstring pl_scName, |
| in charstring pl_tcName) |
| runs on EPTF_LGenBasePerformTest_CT |
| { |
| f_EPTF_LGenBase_stopTrafficCase( pl_eGrpName, pl_scName, pl_tcName); |
| } |
| |
| altstep as_receiveControlMsg( ) |
| runs on EPTF_LGenBasePerformTest_CT |
| { |
| [] v_controlPort.receive(MeasureControl_MgmtMsg:?) -> value v_incControlMsg |
| { |
| f_handleControlMessage(v_incControlMsg); |
| repeat; |
| } |
| } |
| } // end of module
|