Separate dumps by state: enable/disable Success and Failed tests
[anna.git] / example / diameter / launcher / deployments / st-client / configure.sh
index 9030c46..728440d 100755 (executable)
@@ -37,7 +37,7 @@ calculate_deployment_layout() {
   read max_server_accepted_connections
   [ "$max_server_accepted_connections" = "" ] && max_server_accepted_connections=5000
 
-  echo "Input the maximum test case rate per second:"
+  echo "Input the maximum desired test case rate per second:"
   read desired_rate
   while [ -z "$desired_rate" ]; do read desired_rate; done
 
@@ -47,49 +47,48 @@ calculate_deployment_layout() {
     G_ADML_CONNECTIONS=1
     G_ADML_INSTANCES=1
     return
-  fi
-  max_adml_instances=$((max_server_accepted_connections/MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE))
-  if [ $max_connections -gt $max_server_accepted_connections ]
+  elif [ $max_connections -gt $max_server_accepted_connections ]
   then
-    echo
-    echo "Maximum rate reached for $max_server_accepted_connections server connections:"
-    G_ADML_CONNECTIONS=$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE
-    G_ADML_INSTANCES=$max_adml_instances
-    return
+    _exit "Not enough server connections to fit the desired rate (requires $max_connections connections)."
   fi
 
   echo
   echo "==========================================================================================================="
   echo "Orientative table"
   echo "-----------------------------------------------------------------------------------------------------------"
-  echo -e "Connects per instance:\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10"
   echo -n "Number of instances:  "
-  for conn in `seq 1 $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE`
+  for conn in `seq 1 $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE | tac`
   do
     instances=$(ceil $max_connections $conn)
     echo -n -e "\t$instances"
   done
   echo
+  echo -e "Connects per instance:\t10\t9\t8\t7\t6\t5\t4\t3\t2\t1"
   echo "==========================================================================================================="
   echo
-  echo "Input selection (connections per instance 1..$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE) [1]:"
-  read G_ADML_CONNECTIONS
-  [ -z "$G_ADML_CONNECTIONS" ] && G_ADML_CONNECTIONS=1
-  [ $G_ADML_CONNECTIONS -lt 1 ] && G_ADML_CONNECTIONS=1
-#  if [ $G_ADML_CONNECTIONS -gt 1 ]
-#  then
-#    echo "Remember to add 'diameterServerSessions="$G_ADML_CONNECTIONS"' on servers services.xml file (node tag)"
-#    echo " in case that you are testing against ADML servers."
-#    echo
-#    echo "Press ENTER to continue, CTRL-C to abort ..."
-#    read dummy
-#  fi
+  #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]:"
+  read G_ADML_INSTANCES
+  [ -z "$G_ADML_INSTANCES" ] && G_ADML_INSTANCES=$instances__dflt
+  [ $G_ADML_INSTANCES -lt 1 ] && G_ADML_INSTANCES=1
+  G_ADML_CONNECTIONS=$(ceil $max_connections $G_ADML_INSTANCES)
   if [ $G_ADML_CONNECTIONS -gt $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE ]
   then
-    G_ADML_CONNECTIONS=$MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE
+    echo "Warning: the number of connections per ADML instance ($G_ADML_CONNECTIONS) is greater"
+    echo "         than the maximum suggested: $MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE"
+    echo
+    echo "Press ENTER to continue, CTRL-C to abort ..."
+    read dummy
+  fi
+  client_connections=$((G_ADML_INSTANCES*G_ADML_CONNECTIONS))
+  if [ $client_connections -gt $max_server_accepted_connections ]
+  then
+    echo
+    echo "Insufficient server connections available ($max_server_accepted_connections) to accept"
+    echo " launcher client connections: $G_ADML_INSTANCES x $G_ADML_CONNECTIONS = $client_connections."
+    _exit "Configuration error"
   fi
-  
-  G_ADML_INSTANCES=$(ceil $max_connections $G_ADML_CONNECTIONS)
 }
 
 #############
@@ -104,7 +103,7 @@ echo "ADML SYSTEM TEST CONFIGURATION WIZARD"
 echo "====================================="
 echo
 [ -d ADMLS ] && _exit "ADMLS directory still exists. Please remove it to continue (perhaps you have to 'pkill ADML' before) !"
-[ ! -d realms ] && _exit "Missing realms configuration (expecting '$PWD/realms' directory). Try with 'realms-example' and see README inside it !"
+[ ! -d realms ] && _exit "Missing realms configuration (expecting '$PWD/realms' directory) !"
 
 calculate_deployment_layout
 
@@ -125,6 +124,7 @@ echo " - $G_ADML_INSTANCES ADML instances"
 echo " - $G_ADML_CONNECTIONS client connections per ADML instance"
 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"
 echo
 echo "Usually, you will program a test case per subscriber. Input the number of test cases to program:"
 read N_TESTCASES
@@ -132,8 +132,8 @@ while [ -z "$N_TESTCASES" ]; do read N_TESTCASES; done
 echo $N_TESTCASES > $N_TESTCASES__ST_CONF_FILE
 testcase_per_adml_instance=$N_TESTCASES
 echo
-time_covered_1=$(ceil $N_TESTCASES $maximum_rate)
-time_covered=$(ceil $N_TESTCASES $((maximum_rate*G_ADML_INSTANCES)))
+time_covered_1=$(ceil $N_TESTCASES $desired_rate)
+time_covered=$(ceil $N_TESTCASES $((desired_rate*G_ADML_INSTANCES)))
 echo "That amount covers $time_covered_1 seconds for one running ADML instance."
 if [ $G_ADML_INSTANCES -gt 1 ]
 then
@@ -182,9 +182,9 @@ cd - >/dev/null
 
 for instance in `seq 1 $G_ADML_INSTANCES`
 do
-  echo "Creating ADMLS/$instance ..."
-  mkdir -p ADMLS/$instance
-  cd ADMLS/$instance
+  echo "Creating ADML instance $instance ..."
+  mkdir -p ADMLS/ADML-$instance
+  cd ADMLS/ADML-$instance
   # Create resources:
   ln -s ../../.operation-one.sh operation.sh
   ln -s ../../pre-start.sh