| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // 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_PTCDeployment_test{ |
| |
| import from EPTF_CLL_PTCDeployment_Definitions all; |
| import from EPTF_CLL_PTCDeployment_Functions all; |
| |
| testcase tc() runs on EPTF_PTCD_CT{ |
| f_EPTF_PTCD_init_CT("myPTCD"); |
| |
| var charstring host; |
| log("Start testing PTC Deployment") |
| |
| log(v_roledatabase); |
| f_EPTF_PTCD_AddHosts("roleB",{{"hostB",10},{"hostX",5},{"hostC",1}}); |
| log(v_roledatabase); |
| f_EPTF_PTCD_AddHosts("roleA",{{"hostC",534}}); |
| log(v_roledatabase); |
| f_EPTF_PTCD_AddHosts("roleA",{{"hostA",10},{"hostB",42}}); |
| log(v_roledatabase); |
| f_EPTF_PTCD_RemoveHosts("roleA",{"hostB","hostA"}); |
| log(v_roledatabase); |
| f_EPTF_PTCD_AddHosts("roleA",{{"hostA",10},{"hostB",42}, {"hostB",34}}); |
| log(v_roledatabase); |
| |
| log("1. Success of f_EPTF_PTCD_GetHost: ",f_EPTF_PTCD_GetHost("role")); // We have no rule like this in the database |
| for(var integer k:=0;k<10;k:=k+1){ |
| var charstring r; |
| var integer b:=0,x:=0,c:=0; |
| for(var integer i:=0;i<33;i:=i+1){ |
| r := f_EPTF_PTCD_GetHost("roleB") |
| if (r=="hostB"){b:=b+1} |
| if (r=="hostX"){x:=x+1} |
| if (r=="hostC"){c:=c+1} |
| log("2.",i,". Success of f_EPTF_PTCD_GetHost: ",r); |
| } |
| log("*****************************************",b,"|",x,"|",c); |
| } |
| f_EPTF_PTCD_AddHosts("roleC",{{"hostA", 0}, {"", 420},{"hostC",1},{"hostD",-450}}); |
| log("3. Success of f_EPTF_PTCD_GetHost: ",f_EPTF_PTCD_GetHost("roleC")); |
| |
| v_roledatabase := {}; |
| log("4. Success of f_EPTF_PTCD_GetHost: ",f_EPTF_PTCD_GetHost("roleA")); //empty database |
| |
| f_EPTF_PTCD_AddHosts("roleC",{ {"hostA", -10}, {"hostB", -42}}); |
| log("5. Success of f_EPTF_PTCD_GetHost: ",f_EPTF_PTCD_GetHost("roleC")); |
| |
| f_EPTF_PTCD_RemoveHosts("roleC",{"hostB","hostA"}); |
| log(v_roledatabase); |
| log("6. Success of f_EPTF_PTCD_GetHost: ",f_EPTF_PTCD_GetHost("roleA")); |
| |
| } |
| |
| control{ |
| execute(tc()); |
| } |
| } |