From: Eduardo Ramos Testillano Date: Sat, 29 Oct 2016 12:05:26 +0000 (+0200) Subject: new scripts for CPS and check status X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=commitdiff_plain;h=f4ef9557eb5277500882a2ba8b11622cdfef52c6 new scripts for CPS and check status --- diff --git a/example/diameter/launcher/deployments/st-client/checkStatus.sh b/example/diameter/launcher/deployments/st-client/checkStatus.sh new file mode 100755 index 0000000..ca132a8 --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/checkStatus.sh @@ -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 index 0000000..08bf495 --- /dev/null +++ b/example/diameter/launcher/deployments/st-client/launchCPS.sh @@ -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" + diff --git a/example/diameter/launcher/deployments/st-client/program.sh b/example/diameter/launcher/deployments/st-client/program.sh index b000f8d..cb550ab 100755 --- a/example/diameter/launcher/deployments/st-client/program.sh +++ b/example/diameter/launcher/deployments/st-client/program.sh @@ -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" ] diff --git a/example/diameter/launcher/deployments/st-client/run_all.sh b/example/diameter/launcher/deployments/st-client/run_all.sh index 73d8a16..489855c 100755 --- a/example/diameter/launcher/deployments/st-client/run_all.sh +++ b/example/diameter/launcher/deployments/st-client/run_all.sh @@ -22,6 +22,7 @@ echo wait $(jobs -p) sleep 3 +./checkStatus.sh cat << EOF $(pgrep ADML- | wc -l) instances alive !