6 MAXIMUM_ADML_ASYNC_RATE=50
7 MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE=10
8 ADML_INSTANCES__ST_CONF_FILE=.st_conf_adml_instances
9 ADML_CONNECTIONS__ST_CONF_FILE=.st_conf_adml_connections
10 CYCLE_REPEATS__ST_CONF_FILE=.st_conf_cycle_repeats
11 N_TESTCASES__ST_CONF_FILE=.st_conf_n_testcases
23 # ceil of division $1/$2
25 echo "$1 $2" | awk '{print int( ($1/$2) + 1 )}'
28 # Calculates the number of ADML instances and their client connections
29 calculate_deployment_layout() {
30 echo "Input the maximum client connections accepted by the server to be tested [5000]:"
31 read max_server_accepted_connections
32 [ "$max_server_accepted_connections" = "" ] && max_server_accepted_connections=5000
34 echo "Input the maximum test case rate per second:"
36 while [ -z "$desired_rate" ]; do read desired_rate; done
38 max_connections=$((desired_rate/MAXIMUM_ADML_ASYNC_RATE))
39 if [ $max_connections -eq 0 ]
45 max_adml_instances=$((max_server_accepted_connections/MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE))
46 if [ $max_connections -gt $max_server_accepted_connections ]
49 echo "Maximum rate reached for $max_server_accepted_connections server connections:"
50 G_ADML_CONNECTIONS=$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE
51 G_ADML_INSTANCES=$max_adml_instances
56 echo "==========================================================================================================="
57 echo "Orientative table"
58 echo "-----------------------------------------------------------------------------------------------------------"
59 echo -e "Connects per instance:\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10"
60 echo -n "Number of instances: "
61 for conn in `seq 1 $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE`
63 instances=$(ceil $max_connections $conn)
64 echo -n -e "\t$instances"
67 echo "==========================================================================================================="
69 echo "Input selection (connections per instance 1..$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE) [1]:"
70 read G_ADML_CONNECTIONS
71 [ -z "$G_ADML_CONNECTIONS" ] && G_ADML_CONNECTIONS=1
72 [ $G_ADML_CONNECTIONS -lt 1 ] && G_ADML_CONNECTIONS=1
73 [ $G_ADML_CONNECTIONS -gt $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE ] && G_ADML_CONNECTIONS=$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE
75 G_ADML_INSTANCES=$((max_connections/G_ADML_CONNECTIONS))
85 echo "====================================="
86 echo "ADML SYSTEM TEST CONFIGURATION WIZARD"
87 echo "====================================="
90 calculate_deployment_layout
93 echo $G_ADML_INSTANCES > $ADML_INSTANCES__ST_CONF_FILE
94 echo $G_ADML_CONNECTIONS > $ADML_CONNECTIONS__ST_CONF_FILE
97 echo "Suggested layout:"
98 echo " - $G_ADML_INSTANCES ADML instances"
99 echo " - $G_ADML_CONNECTIONS client connections per ADML instance"
100 maximum_rate=$((G_ADML_INSTANCES*G_ADML_CONNECTIONS*MAXIMUM_ADML_ASYNC_RATE))
101 echo " - Maximum rate: $maximum_rate test cases per second"
103 echo "Usually, you will program a test case per subscriber. Input the number of test cases to program:"
105 while [ -z "$N_TESTCASES" ]; do read N_TESTCASES; done
106 echo $N_TESTCASES > $N_TESTCASES__ST_CONF_FILE
108 time_covered_1=$(ceil $N_TESTCASES $maximum_rate)
109 time_covered=$(ceil $N_TESTCASES $((maximum_rate*G_ADML_INSTANCES)))
110 echo "That amount covers $time_covered_1 seconds for one running ADML instance."
111 if [ $G_ADML_INSTANCES -gt 1 ]
113 echo "But you will have $G_ADML_INSTANCES instances running in parallel, then the total covered time is: $time_covered seconds"
114 testcase_per_adml_instance=$(ceil $N_TESTCASES $G_ADML_INSTANCES)
115 echo "(aproximately, $testcase_per_adml_instance test cases will be programmed on each ADML instance)"
119 if [ $time_covered -lt 300 ]
121 echo "$time_covered seconds is under 5 minutes, you should add more test cases to the pool except if you are sure"
122 echo " they will take less time that cycle completion. You could ensure that with a first timeout step."
123 echo "Configuring such timeout slightly under $((1000*time_covered)) milliseconds, you could repeat the cycle safely to"
124 echo " obtain a greater total time of testing."
127 echo "How many total time do you want to cover (in minutes):"
129 while [ -z "$minutes" ]; do read minutes; done
130 seconds=$((minutes*60))
131 repeats=$(ceil $seconds $time_covered)
132 echo $repeats > $CYCLE_REPEATS__ST_CONF_FILE
133 [ $repeats -gt 0 ] && echo "Configured $repeats cycle repeats ($repeats x $time_covered seconds = $seconds seconds (desired $minutes minutes)"
135 echo "System test configuration completed."
137 echo "Ready to clone/start the ADML instances: press ENTER to continue, CTRL+C to abort ..."
139 [ ! -d realms ] && _exit "Missing realms configuration (expecting '$PWD/realms' directory). Try with 'realms.example' and see README inside it !"
141 # Update services.xml regarding the number of client connections:
142 cp realms/services.msk realms/services.xml
143 sed -i 's/__CLIENT_CONNECTIONS__/'$G_ADML_CONNECTIONS'/g' realms/services.xml
146 for instance in `seq 1 $G_ADML_INSTANCES`
148 mkdir -p ADMLS/$instance
151 ln -s ../../ADML-launcher
152 ln -s ../../operation.sh
153 ln -s ../../realms/services.xml
154 for cer in `ls ../../realms/cer*xml`; do ln -s $cer; done