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
12 ADML_RATE_PER_INSTANCE__ST_CONF_FILE=.st_conf_rate_per_instance
13 ADML_DESIRED_RATE__ST_CONF_FILE=.st_conf_desired_rate
14 N_TESTCASES_PROGRAM_LAYOUT__ST_CONF_FILE=.st_conf_n_testcases_program_layout
26 # ceil of division $1/$2
28 #echo "$1 $2" | awk '{print int( ($1/$2) + 1 )}'
29 awk -vnumber="$1" -vdiv="$2" '
30 function ceiling(x){return x%1 ? int(x)+1 : x}
31 BEGIN{ print ceiling(number/div) }'
34 # Calculates the number of ADML instances and their client connections
35 calculate_deployment_layout() {
36 echo "Input the maximum client connections accepted by the server to be tested [5000]:"
37 read max_server_accepted_connections
38 [ "$max_server_accepted_connections" = "" ] && max_server_accepted_connections=5000
40 echo "Input the maximum test case rate per second:"
42 while [ -z "$desired_rate" ]; do read desired_rate; done
44 max_connections=$((desired_rate/MAXIMUM_ADML_ASYNC_RATE))
45 if [ $max_connections -eq 0 ]
51 max_adml_instances=$((max_server_accepted_connections/MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE))
52 if [ $max_connections -gt $max_server_accepted_connections ]
55 echo "Maximum rate reached for $max_server_accepted_connections server connections:"
56 G_ADML_CONNECTIONS=$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE
57 G_ADML_INSTANCES=$max_adml_instances
62 echo "==========================================================================================================="
63 echo "Orientative table"
64 echo "-----------------------------------------------------------------------------------------------------------"
65 echo -e "Connects per instance:\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10"
66 echo -n "Number of instances: "
67 for conn in `seq 1 $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE`
69 instances=$(ceil $max_connections $conn)
70 echo -n -e "\t$instances"
73 echo "==========================================================================================================="
75 echo "Input selection (connections per instance 1..$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE) [1]:"
76 read G_ADML_CONNECTIONS
77 [ -z "$G_ADML_CONNECTIONS" ] && G_ADML_CONNECTIONS=1
78 [ $G_ADML_CONNECTIONS -lt 1 ] && G_ADML_CONNECTIONS=1
79 if [ $G_ADML_CONNECTIONS -gt 1 ]
81 echo "Remember to add 'diameterServerSessions="$G_ADML_CONNECTIONS"' on servers services.xml file (node tag)"
82 echo " in case that you are testing against ADML servers."
84 echo "Press ENTER to continue, CTRL-C to abort ..."
87 if [ $G_ADML_CONNECTIONS -gt $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE ]
89 G_ADML_CONNECTIONS=$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE
92 G_ADML_INSTANCES=$(ceil $max_connections $G_ADML_CONNECTIONS)
102 echo "====================================="
103 echo "ADML SYSTEM TEST CONFIGURATION WIZARD"
104 echo "====================================="
106 [ -d ADMLS ] && _exit "ADMLS directory still exists. Please remove it to continue (perhaps you have to 'pkill ADML' before) !"
107 [ ! -d realms ] && _exit "Missing realms configuration (expecting '$PWD/realms' directory). Try with 'realms-example' and see README inside it !"
109 calculate_deployment_layout
112 echo $G_ADML_INSTANCES > $ADML_INSTANCES__ST_CONF_FILE
113 echo $G_ADML_CONNECTIONS > $ADML_CONNECTIONS__ST_CONF_FILE
116 #rate_per_instance=$(ceil $desired_rate $G_ADML_INSTANCES)
117 rate_per_instance=$((desired_rate/$G_ADML_INSTANCES))
118 [ $rate_per_instance -lt 1 ] && rate_per_instance=1
119 echo $rate_per_instance > $ADML_RATE_PER_INSTANCE__ST_CONF_FILE
120 echo $desired_rate > $ADML_DESIRED_RATE__ST_CONF_FILE
123 echo "Suggested layout:"
124 echo " - $G_ADML_INSTANCES ADML instances"
125 echo " - $G_ADML_CONNECTIONS client connections per ADML instance"
126 maximum_rate=$((G_ADML_INSTANCES*G_ADML_CONNECTIONS*MAXIMUM_ADML_ASYNC_RATE))
127 echo " - Maximum rate: $maximum_rate test cases per second"
129 echo "Usually, you will program a test case per subscriber. Input the number of test cases to program:"
131 while [ -z "$N_TESTCASES" ]; do read N_TESTCASES; done
132 echo $N_TESTCASES > $N_TESTCASES__ST_CONF_FILE
133 testcase_per_adml_instance=$N_TESTCASES
135 time_covered_1=$(ceil $N_TESTCASES $maximum_rate)
136 time_covered=$(ceil $N_TESTCASES $((maximum_rate*G_ADML_INSTANCES)))
137 echo "That amount covers $time_covered_1 seconds for one running ADML instance."
138 if [ $G_ADML_INSTANCES -gt 1 ]
140 echo "But you will have $G_ADML_INSTANCES instances running in parallel, then the total covered time is: $time_covered seconds"
141 testcase_per_adml_instance=$((N_TESTCASES/G_ADML_INSTANCES))
142 echo "(aproximately, $testcase_per_adml_instance test cases will be programmed on each ADML instance)"
145 0>$N_TESTCASES_PROGRAM_LAYOUT__ST_CONF_FILE
146 for instance in `seq 1 $G_ADML_INSTANCES`
148 offset=$((testcase_per_adml_instance * (instance-1)))
150 fin=$((offset + testcase_per_adml_instance))
151 echo "$instance $ini $fin" >> $N_TESTCASES_PROGRAM_LAYOUT__ST_CONF_FILE
155 if [ $time_covered -lt 300 ]
157 echo "$time_covered seconds is under 5 minutes, you should add more test cases to the pool except if you are sure"
158 echo " they will take less time that cycle completion. You could ensure that with a first timeout step."
159 echo "Configuring such timeout slightly under $((1000*time_covered)) milliseconds, you could repeat the cycle safely to"
160 echo " obtain a greater total time of testing."
163 echo "How many total time do you want to cover (in minutes):"
165 while [ -z "$minutes" ]; do read minutes; done
166 seconds=$((minutes*60))
167 repeats=$(ceil $seconds $time_covered)
168 echo $repeats > $CYCLE_REPEATS__ST_CONF_FILE
169 [ $repeats -gt 0 ] && echo "Configured $repeats cycle repeats ($repeats x $time_covered seconds ~ $seconds seconds (desired $minutes minutes)"
171 echo "System test configuration completed."
173 echo "Ready to clone/start the ADML instances: press ENTER to continue, CTRL+C to abort ..."
176 # Update services.xml regarding the number of client connections:
178 cp services.msk services.xml
179 sed -i 's/__CLIENT_CONNECTIONS__/'$G_ADML_CONNECTIONS'/g' services.xml
183 for instance in `seq 1 $G_ADML_INSTANCES`
185 echo "Creating ADMLS/$instance ..."
186 mkdir -p ADMLS/$instance
189 ln -s ../../.operation-one.sh operation.sh
190 ln -s ../../pre-start.sh
191 cp ../../.run-one.sh run.sh
192 sed -i 's/^EXE=.*/EXE=ADML-'$instance'/' run.sh
193 ln -s ../../ADML-launcher ADML-$instance
194 for xml in `ls ../../realms/*xml`; do ln -s $xml; done
199 echo "Now you can run all the instances deployed: ./run.sh"