| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // 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 // |
| /////////////////////////////////////////////////////////////////////////////// |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Purpose: |
| // This module provides functions for testing R13 functionalities and bugfixes |
| // of LGenBase |
| // |
| // Module depends on: |
| // - |
| // |
| // Current Owner: |
| // Jozsef Gyurusi (ethjgi) |
| // |
| // Last Review Date: |
| // - |
| // |
| /////////////////////////////////////////////////////////////// |
| module EPTF_LGenBase_Test_TestcasesR13 |
| // [.objid{ itu_t(0) identified_organization(4) etsi(0) |
| // identified_organization(127) ericsson(5) testing(0) |
| // <put further nodes here if needed>}] |
| { |
| import from EPTF_CLL_LGenBaseStats_Definitions all; |
| import from EPTF_LGenBase_Test_Functions all; |
| import from EPTF_CLL_Variable_Functions all; |
| import from EPTF_CLL_LGenBase_Functions all; |
| import from EPTF_CLL_LGenBase_TrafficFunctions all; |
| import from EPTF_CLL_LGenBase_ConfigFunctions all; |
| import from EPTF_LGenBase_Test_TestcasesR3 all; |
| import from EPTF_CLL_Base_Functions all; |
| import from EPTF_CLL_LGenBase_Definitions all; |
| |
| group Poisson_Test { |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Poisson_initialBurst_test |
| // |
| // Purpose: Tests if an initial burst is present (erroneous operation) when the StartTC function is slow due to lots of entities. |
| // this slowness generates an initial time delay of the traffic generation event, which causes it to generate |
| // lots of traffic in order to catch up. The poisson burst calculation function is corrected so this behavour should not occur, |
| // the verdict of the test case should be pass. |
| // Checks the correction of TR HP40156. |
| // |
| // Action: After the test case is started, its lenght is measured. Half of this time (T/2) is used |
| // to detect the initial burst: |
| // The Nth number of calls is calculated as it is generated with the given CPS during this time. |
| // Then the time difference is measure between the first and the Nth call. |
| // If the time difference is smaller than the 10th of the T/2 time a burst is detected, |
| // otherwise the traffic is considered to be without initial burst. |
| // If be some reason the time difference cannot be measured, but the first call was detected |
| // it is considered also as a burstless case. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Poisson_initialBurst_test() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| const integer c_nofEntities := 2000000; // this should be large enough to make the startTC slower than c_minStartTime |
| const float c_targetCPS := 10.0; |
| const float c_minStartTime := 2.0; // large enough to be able to measure the time difference between the first calls. |
| // scenario params: |
| const float c_scExecTime := 10.0; |
| const integer c_nofStarts := float2int(c_scExecTime*c_targetCPS*2.0); |
| |
| |
| f_EPTF_LGenBase_init("PoissonTest"); |
| f_LGenBase_Test_fsmVariables_init(c_nofEntities) |
| v_dummyInt := f_EPTF_LGenBase_declareFunction("Finished",{customFinishFunction := refers(f_EPTF_LGenBase_TestFinished)}); |
| v_dummyInt := f_EPTF_LGenBase_declareFSMTable({ |
| name := "EPTF_FSM_Tc_Succ", |
| fsmParams := { |
| {stateList := {"idle"}} |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm}, |
| cellRow := {{ |
| { |
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit} |
| }, |
| omit, omit |
| }} |
| } |
| } |
| } |
| }); |
| v_dummyInt := f_EPTF_LGenBase_declareTcType2( |
| { |
| name := "TC_Succ", |
| fsmName := "EPTF_FSM_Tc_Succ", |
| entityType := "et1", |
| customEntitySucc := "" |
| } |
| ) |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { |
| name := "SC_Succ", |
| tcList := { |
| { |
| tcName := "TC1_Succ", |
| tcParamsList := { |
| {tcTypeName := "TC_Succ"}, |
| {target := { cpsToReach := c_targetCPS }}, |
| {scheduler := {preDefinedName := poisson}}, |
| {enableEntitiesAtStart := true}, |
| {enabledAtStart := false}, |
| {trafficStartFinish := { |
| {nrOfExecStart := {count := c_nofStarts,actions := {}}}, |
| //{execTime := {time := (c_scExecTime+2.0*c_minStartTime)*2.0,actions := {}}}, |
| {nrOfSuccesses := {count := c_nofStarts,actions := {}}}, |
| //nrOfGrpLoop := 1, |
| {anythingFinished := {actions := { |
| {customFinishFunction := "Finished"} |
| }}} |
| }} |
| } |
| } |
| }, |
| scParamsList := { |
| {enabled := true} } |
| }) |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC_Succ"}); |
| |
| var charstring vl_nofStarts := f_EPTF_LGenBase_getNamePrefix("eg1","SC_Succ","TC1_Succ") & c_EPTF_LGenBaseStats_nameOfTcNrOfStarts; |
| var integer vl_nofStartsVarIdx := f_EPTF_Var_getId(vl_nofStarts); |
| if (vl_nofStartsVarIdx==-1) { |
| setverdict(inconc,"The number of starts variable does not exist"); |
| f_EPTF_Base_stop(none); |
| } |
| |
| timer t_startTest := 0.5; |
| t_startTest.start; t_startTest.timeout; |
| var float vl_startTime := f_EPTF_Base_getRelTimeInSecs(); |
| //action("-----------Test started----------"); |
| f_EPTF_LGenBase_startTrafficCase("eg1","SC_Succ","TC1_Succ"); |
| //action("-----------Test case launched----------"); |
| var float vl_lengthOfStart := f_EPTF_Base_getRelTimeInSecs() - vl_startTime; |
| if (vl_lengthOfStart<c_minStartTime) { |
| setverdict(inconc, "The number of entities is too small. Start time (",vl_lengthOfStart,") should be longer than ",c_minStartTime," secs to be able to check initial burst.", |
| " Adjust number of entities to at least ",float2int(2.0*int2float(c_nofEntities)*c_minStartTime/vl_lengthOfStart)); |
| f_EPTF_Base_stop(none); |
| } |
| |
| t_startTest.start(vl_lengthOfStart+c_scExecTime*1.5); |
| timer t_check := 0.0; |
| t_check.start; |
| vl_startTime := -1.0; |
| alt { |
| [vl_startTime<0.0 and 0<f_EPTF_Var_getIntValue(vl_nofStartsVarIdx)] t_check.timeout { |
| vl_startTime := f_EPTF_Base_getRelTimeInSecs(); |
| t_check.start; |
| repeat; |
| } |
| [vl_startTime>0.0 and float2int(c_targetCPS*(vl_lengthOfStart/2.0))<f_EPTF_Var_getIntValue(vl_nofStartsVarIdx)] t_check.timeout { |
| // time to generate targetCPS*(lenghtOfStart/2) number of calls: |
| var float vl_timeToGenerate := f_EPTF_Base_getRelTimeInSecs()-vl_startTime; |
| //action("vl_timeToGenerate: ", vl_timeToGenerate, " minimal time limit: ", vl_lengthOfStart/20.0) |
| if (vl_timeToGenerate < vl_lengthOfStart/20.0) { // average CPS is higher than 10*targetCPS <=> time to generate is smaller than the time necessary/10 |
| setverdict(fail,"Initial burst of ",f_EPTF_Var_getIntValue(vl_nofStartsVarIdx)," starts is detected for poisson traffic") |
| f_EPTF_Base_stop(none); |
| } else { |
| setverdict(pass,"No initial burst is detected for poisson traffic"); |
| f_EPTF_Base_stop(none); |
| } |
| } |
| [] t_startTest.timeout { |
| if (vl_startTime>0.0) { |
| // first call is detected, but the last is not (= actual CPS is too low by some reason) |
| setverdict(pass,"No initial burst is detected for poisson traffic. Actual CPS (",int2float(f_EPTF_Var_getIntValue(vl_nofStartsVarIdx))/(vl_lengthOfStart+c_scExecTime*1.5),") is much less than target: ", c_targetCPS); |
| } else { |
| // not even the first call was detected : measurment is not possible |
| setverdict(inconc,"Not able to measure if there is an initial burst or not"); |
| } |
| f_EPTF_Base_stop(none); |
| } |
| } |
| |
| if(f_EPTF_LGenBase_wait4TestFinished(c_scExecTime*1.5)){ |
| setverdict(none) |
| } |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| } // group Poisson_Test |
| |
| control{ |
| execute(tc_LGenBase_Poisson_initialBurst_test()); |
| |
| } |
| |
| } // end of module |