From 70c7ab32e59de5a941cbf251df0905ff6cab4063 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Thu, 27 Oct 2016 18:51:14 +0200 Subject: [PATCH] improvs --- .../deployments/st-client/configure.sh | 1 + .../deployments/st-client/operation_all.sh | 19 +++--- .../launcher/deployments/st-client/program.sh | 62 ++++++++++++++++--- .../launcher/deployments/st-client/run_all.sh | 31 ++++++---- 4 files changed, 81 insertions(+), 32 deletions(-) diff --git a/example/diameter/launcher/deployments/st-client/configure.sh b/example/diameter/launcher/deployments/st-client/configure.sh index 1897ce3..aac19ab 100755 --- a/example/diameter/launcher/deployments/st-client/configure.sh +++ b/example/diameter/launcher/deployments/st-client/configure.sh @@ -254,6 +254,7 @@ done echo echo "Now you can run all the instances deployed: ./run.sh" +echo "To configure another layout you should execute this script again." echo echo "Done!" diff --git a/example/diameter/launcher/deployments/st-client/operation_all.sh b/example/diameter/launcher/deployments/st-client/operation_all.sh index 1304dfd..2dcb900 100755 --- a/example/diameter/launcher/deployments/st-client/operation_all.sh +++ b/example/diameter/launcher/deployments/st-client/operation_all.sh @@ -1,5 +1,4 @@ #!/bin/bash -# touch .operation_background to force background execution of every ADML instances operations "broadcasted" cd `dirname $0` if [ ! -d "ADMLS" ] then @@ -9,8 +8,12 @@ then exit 1 fi -BGROUND= -[ -f .operation_background ] && BGROUND=yes +if [ "$1" = "-h" -o "$1" = "--help" ] +then + first_adml=$(ls -d ADMLS/* | head -n +1) + $first_adml/operation.sh help + exit 0 +fi for op in `ls ADMLS/*/operation.sh` do @@ -18,14 +21,8 @@ do cd $dn_op echo -n "Instance `basename $dn_op`: " 0>launcher.trace - if [ -n "$BGROUND" ] - then - ./operation.sh $@ & - sleep 0.01 - else - ./operation.sh $@ - [ $? -ne 0 ] && { echo ; exit 1 ; } - fi + ./operation.sh $@ & + #[ $? -ne 0 ] && { echo ; exit 1 ; } cd - >/dev/null done diff --git a/example/diameter/launcher/deployments/st-client/program.sh b/example/diameter/launcher/deployments/st-client/program.sh index e470e80..6d0dbb1 100755 --- a/example/diameter/launcher/deployments/st-client/program.sh +++ b/example/diameter/launcher/deployments/st-client/program.sh @@ -210,6 +210,10 @@ else echo -n "${xml}|" done | sed 's/'\|'$//') + # If still idle CPU, you could increase chunks number of background jobs + CHUNKS=10 + echo "Dynamic programming ..." + echo while read -r line do instance=$(echo $line | awk '{ print $1 }') @@ -217,9 +221,11 @@ else fin_seq=$(echo $line | awk '{ print $3 }') ADML_DIR=`readlink -f ADMLS/ADML-$instance` - cd $ADML_DIR - ./operation.sh -t 60 "dynamic|$ini_seq|$fin_seq|$dynamic_suffix" - cd - >/dev/null + cd $ADML_DIR + ./operation.sh -t 60 "dynamic|$ini_seq|$fin_seq|$dynamic_suffix" & + count=$((count+1)) + [ $count -eq $CHUNKS ] && { wait $(jobs -p) ; count=1 ; } + cd - >/dev/null done < $PROGRAM_LAYOUT_FILE @@ -240,11 +246,51 @@ else [ $rate_per_instance -lt 1 ] && rate_per_instance=1 ./operation.sh "test|ttps|$rate_per_instance" else - echo "Remember that you could start traffic using:" - echo " ./operation.sh \"test|ttps|\"" - echo - echo "For example, to reach $DESIRED_RATE test cases per second:" - echo " ./operation.sh \"test|ttps|$RATE_PER_INSTANCE\"" + cat << EOF + +To start testing, you must use the './operation.sh' script. Use '-h' + to get detailed help. The most common commands used for testing are: + + * Enable reports dump for failed tests: + ./operation.sh "test|report|failed" + + * Launch traffic: + ./operation.sh "test|ttps|" + + (*) note: ttps value is related to a single instance: you should" + divide the desired CPS by the number of instances. For" + exampl, if you need $DESIRED_RATE test cases per second: + + ./operation.sh "test|ttps|$RATE_PER_INSTANCE" + + * Stop traffic: + ./operation.sh "test|ttps|0" + + * Reset already classified (Success/Failed) test cases: + ./operation.sh "test|reset[|soft]" + + * Reset also 'in-progress' state test cases: + ./operation.sh "test|reset|hard" + +Remember that './operation.sh' broadcasts the operation scripts along + the ADML instances, then some operations should better be used within + a specific 'ADMLS/ADML-' directory to avoid console spam, + for example: + + * Check a testcase in runtime: + ADMLS/ADML-001/operation.sh "test|look|" + + * Execute the next programmed test case: + ADMLS/ADML-001/operation.sh "test|next" + + * Interactive-step execution: + ADMLS/ADML-001/operation.sh "test|interact||" + + * Summary: + ADMLS/ADML-001/operation.sh "test|summary" + +EOF + fi fi diff --git a/example/diameter/launcher/deployments/st-client/run_all.sh b/example/diameter/launcher/deployments/st-client/run_all.sh index 036a42a..7849166 100755 --- a/example/diameter/launcher/deployments/st-client/run_all.sh +++ b/example/diameter/launcher/deployments/st-client/run_all.sh @@ -20,18 +20,23 @@ do done echo wait $(jobs -p) -echo "$(pgrep ADML- | wc -l) instances alive !" -echo -echo -echo "To enable reports dump for failed tests, execute:" -echo " ./operation.sh \"test|report|failed\"" -echo -echo "To stop the processes, you could execute:" -echo " pgrep ADML-[0-9] | xargs kill" -echo -echo "When running, use script './program.sh' to configure the test cases." -echo "To configure another layout you should execute './configure.sh'." -echo -echo "Done!" + +cat << EOF + $(pgrep ADML- | wc -l) instances alive ! + $(netstat -a | grep :diameter | grep ESTABLISHED | wc -l) connections established ! + + To stop the processes, you could execute: pgrep ADML-[0-9] | xargs kill + Anyway, executing './run.sh' again you will restart the ADML instances. + + Now it's time to './program.sh' the started instances with the desired + scenary. There are two programming variants: + + ./program.sh + ./program.sh dynamic + + + Done! +EOF + echo -- 2.20.1