Improvements and new scenaries
[anna.git] / example / diameter / launcher / deployments / st-client / configure.sh
index ef733a8..5c4e8aa 100755 (executable)
@@ -69,6 +69,7 @@ calculate_deployment_layout() {
   #echo "Input selection (connections per instance 1..$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE) [1]:"
   instances__dflt=$(ceil $max_connections $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE)
   echo "Input the desired number of ADML instances [$instances__dflt]:"
+  echo " (more than $instances instances, implies 1 single connection/instance)"
   read G_ADML_INSTANCES
   [ -z "$G_ADML_INSTANCES" ] && G_ADML_INSTANCES=$instances__dflt
   [ $G_ADML_INSTANCES -lt 1 ] && G_ADML_INSTANCES=1
@@ -102,7 +103,34 @@ echo "====================================="
 echo "ADML SYSTEM TEST CONFIGURATION WIZARD"
 echo "====================================="
 echo
-[ -d ADMLS ] && _exit "ADMLS directory still exists. Please move/remove it to continue (you may have to 'pkill ADML' before) !"
+if [ -d ADMLS ]
+then
+  echo
+  echo "Detected configured layout (*):"
+  echo
+  ADML_INSTANCES=`cat $ADML_INSTANCES__ST_CONF_FILE 2>/dev/null`
+  ADML_CONNECTIONS=`cat $ADML_CONNECTIONS__ST_CONF_FILE 2>/dev/null`
+  RATE_PER_INSTANCE=`cat $ADML_RATE_PER_INSTANCE__ST_CONF_FILE 2>/dev/null`
+  DESIRED_RATE=`cat $ADML_DESIRED_RATE__ST_CONF_FILE 2>/dev/null`
+  REPEATS=`cat $CYCLE_REPEATS__ST_CONF_FILE 2>/dev/null`
+  N_TESTCASES=`cat $N_TESTCASES__ST_CONF_FILE 2>/dev/null`
+
+  [ -n "$ADML_INSTANCES" ] && echo "  $ADML_INSTANCES ADML instances."
+  [ -n "$ADML_CONNECTIONS" ] && echo "  $ADML_CONNECTIONS connections per ADML instance."
+  [ -n "$RATE_PER_INSTANCE" ] && echo "  Rate of $RATE_PER_INSTANCE TCs/second and instance."
+  [ -n "$DESIRED_RATE" ] && echo "  Desired rate was: $DESIRED_RATE TCs/second and instance."
+  [ -n "$REPEATS" ] && echo "  Number of cycles: $((REPEATS + 1))."
+  [ -n "$N_TESTCASES" ] && echo "  $N_TESTCASES test cases programmed."
+  echo
+  operation_result=$(echo "scale=3 ; (1 + $REPEATS) * $N_TESTCASES / $ADML_INSTANCES / $RATE_PER_INSTANCE" | bc)
+  echo "  Time covered: $((REPEATS + 1)) cycles x ($N_TESTCASES/(${ADML_INSTANCES}x${RATE_PER_INSTANCE})) = $operation_result seconds"
+  echo
+
+  echo "  (*) As ADMLS directory still exists you should move/remove it to continue."
+  echo "      You may have to 'pkill ADML' before (resources busy)."
+  _exit
+fi
+
 [ ! -d services ] && _exit "Missing services configuration (expecting '$PWD/services' directory) !"
 
 calculate_deployment_layout
@@ -119,13 +147,25 @@ echo $rate_per_instance > $ADML_RATE_PER_INSTANCE__ST_CONF_FILE
 echo $desired_rate > $ADML_DESIRED_RATE__ST_CONF_FILE
 
 echo
-echo "Suggested layout:"
+echo "Layout:"
+echo
 echo " - $G_ADML_INSTANCES ADML instances"
 echo " - $G_ADML_CONNECTIONS client connections per ADML instance"
+#maximum_rate_1c=$((G_ADML_INSTANCES*MAXIMUM_ADML_ASYNC_RATE))
 maximum_rate=$((G_ADML_INSTANCES*G_ADML_CONNECTIONS*MAXIMUM_ADML_ASYNC_RATE))
-echo " - Maximum rate: $maximum_rate test cases per second"
-echo " - Desired rate: $desired_rate test cases per second"
+overcommit_rate_per_instance=$((G_ADML_CONNECTIONS*MAXIMUM_ADML_ASYNC_RATE))
+echo
+echo " - Desired rate: $desired_rate test cases per second:"
+echo "   Remember the command to send the needed rate per instance ($rate_per_instance TCs/sec):"
+echo "       ./operation.sh \"test|ttps|$rate_per_instance\""
 echo
+if [ $maximum_rate -ne $desired_rate ]
+then
+  echo " - Maximum bunch rate ($G_ADML_CONNECTIONS connections per instance): $maximum_rate testcases/second"
+  echo "   For this, configure instances rate to $overcommit_rate_per_instance test cases per second:"
+  echo "       ./operation.sh \"test|ttps|$overcommit_rate_per_instance\""
+  echo
+fi
 echo "Usually, you will program a test case per subscriber."
 echo "Input the number of test cases to program:"
 read N_TESTCASES
@@ -165,13 +205,22 @@ then
   echo " obtain a greater total time of testing."
 fi
 echo
-echo "How many total time do you want to cover (in minutes):"
+echo "How many total time you need to cover (in minutes):"
 read minutes
 while [ -z "$minutes" ]; do read minutes; done
 seconds=$((minutes*60))
 repeats=$(ceil $seconds $time_covered)
-echo $repeats > $CYCLE_REPEATS__ST_CONF_FILE
-[ $repeats -gt 0 ] && echo "Configured $repeats cycle repeats ($repeats x $time_covered seconds ~ $seconds seconds (desired $minutes minutes)"
+if [ $repeats -gt 0 ]
+then
+  echo "You will need $repeats cycles to cover $minutes minutes."
+  echo "Input the number of cyles [$repeats]: "
+  echo " (providing 0, you will cover $time_covered seconds)"
+  echo
+  read wanted_repeats
+  [ -z "$wanted_repeats" ] && wanted_repeats=$repeats
+  echo $wanted_repeats > $CYCLE_REPEATS__ST_CONF_FILE
+  [ $wanted_repeats -gt 0 ] && echo "Configured $wanted_repeats cycle repeats ($((wanted_repeats+1)) x $time_covered seconds ~ $(((wanted_repeats+1)*time_covered)) seconds of testing)."
+fi
 echo
 echo "System test configuration completed."
 echo