new scripts for CPS and check status
authorEduardo Ramos Testillano <eduardo.ramos.testillano@ericsson.com>
Sat, 29 Oct 2016 12:05:26 +0000 (14:05 +0200)
committerEduardo Ramos Testillano <eduardo.ramos.testillano@ericsson.com>
Sat, 29 Oct 2016 12:05:26 +0000 (14:05 +0200)
example/diameter/launcher/deployments/st-client/checkStatus.sh [new file with mode: 0755]
example/diameter/launcher/deployments/st-client/launchCPS.sh [new file with mode: 0755]
example/diameter/launcher/deployments/st-client/program.sh
example/diameter/launcher/deployments/st-client/run_all.sh

diff --git a/example/diameter/launcher/deployments/st-client/checkStatus.sh b/example/diameter/launcher/deployments/st-client/checkStatus.sh
new file mode 100755 (executable)
index 0000000..ca132a8
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+ADML_CONNECTIONS=`cat .st_conf_adml_connections 2>/dev/null`
+ADML_INSTANCES=`cat .st_conf_adml_instances 2>/dev/null`
+RESULT_CODE=0
+
+ADML_INSTANCES_ALIVE=$(pgrep ADML- | wc -l)
+echo -n "$ADML_INSTANCES_ALIVE instances alive"
+if [ $ADML_INSTANCES_ALIVE -ne $ADML_INSTANCES ]
+then
+  echo " ! (expected $ADML_INSTANCES configured)"
+  RESULT_CODE=1
+else
+  echo
+fi
+
+ADML_CONNECTIONS_ALIVE=$(netstat -a | grep :diameter | grep ESTABLISHED | wc -l)
+ADML_TOTAL_CONNECTIONS=$((ADML_CONNECTIONS*ADML_INSTANCES))
+echo -n "$ADML_CONNECTIONS_ALIVE connections established"
+if [ $ADML_CONNECTIONS_ALIVE -ne $ADML_TOTAL_CONNECTIONS ] && RESULT_CODE=1
+then
+  echo " ! (expected $ADML_TOTAL_CONNECTIONS configured)"
+  RESULT_CODE=1
+else
+  echo
+fi
+
+exit $RESULT_CODE
+
diff --git a/example/diameter/launcher/deployments/st-client/launchCPS.sh b/example/diameter/launcher/deployments/st-client/launchCPS.sh
new file mode 100755 (executable)
index 0000000..08bf495
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+#############
+# VARIABLES #
+#############
+ADML_INSTANCES=`cat .st_conf_adml_instances 2>/dev/null`
+
+#############
+# FUNCTIONS #
+#############
+_exit() {
+  echo
+  echo $1
+  echo
+  exit 1
+}
+
+#############
+# EXECUTION #
+#############
+echo
+echo
+cd `dirname $0`
+./checkStatus.sh
+[ $? -ne 0 ] && _exit "Fix status to continue ..."
+echo
+echo "Input desired rate (test cases per second) to start testing [0: stop if active]:"
+read desired_rate
+if [ "$desired_rate" != "" ]
+then
+  rate_per_instance=$((desired_rate/$ADML_INSTANCES))
+fi
+echo "This configures $rate_per_instance test cases per second and instance"
+echo " (there are $ADML_INSTANCES instances available)".
+echo
+echo "Press ENTER to continue, CTRL-C to abort ..."
+read dummy
+
+./operation.sh "test|ttps|$rate_per_instance"
+
index b000f8d..cb550ab 100755 (executable)
@@ -264,15 +264,7 @@ if [ "$AUTOSTART" = "-s" ]
 then
   start_testing=yes
 else
-  echo "Input desired rate (test cases per second) to start testing [0: nothing done]:"
-  read desired_rate
-  if [ "$desired_rate" != "" ]
-  then
-    rate_per_instance=$((desired_rate/$ADML_INSTANCES))
-    [ $rate_per_instance -lt 1 ] && rate_per_instance=1
-    ./operation.sh "test|ttps|$rate_per_instance"
-  else
-    cat << EOF
+  cat << EOF
 
 To start testing, you must use the './operation.sh' script. The most
  common commands used for testing are:
@@ -304,9 +296,10 @@ Remember that './operation.sh' broadcasts the operation scripts inside
 
 For a complete and detailed information, execute: ./operation.sh --help | less
 
+You could also use './launchCPS.sh' script.
+
 EOF
 
-  fi
 fi
 
 if [ -n "$start_testing" ]
index 73d8a16..489855c 100755 (executable)
@@ -22,6 +22,7 @@ echo
 wait $(jobs -p)
 
 sleep 3
+./checkStatus.sh
 
 cat << EOF
      $(pgrep ADML- | wc -l) instances alive !