From 8b36323514f862e950cb54ff5c4ff4c6b2c78746 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Fri, 29 Sep 2017 18:55:13 +0200 Subject: [PATCH] Support for Multiple Peer deployments. Support for coexisting several ADMLS instances directories. Fix division by 0. --- .../00001/services/{cerGx.xml => cerGx.msk} | 4 +- .../launcher/deployments/st-client/README | 12 +- .../deployments/st-client/configure.sh | 131 +++++++++++++----- .../launcher/deployments/st-client/run_all.sh | 12 +- .../services_example/{cerGx.xml => cerGx.msk} | 2 +- .../services_example/{cerRx.xml => cerRx.msk} | 2 +- .../st-client/services_example/services.msk | 4 +- 7 files changed, 117 insertions(+), 50 deletions(-) rename dynamic/launcher/gx/00001/services/{cerGx.xml => cerGx.msk} (80%) rename example/diameter/launcher/deployments/st-client/services_example/{cerGx.xml => cerGx.msk} (84%) rename example/diameter/launcher/deployments/st-client/services_example/{cerRx.xml => cerRx.msk} (84%) diff --git a/dynamic/launcher/gx/00001/services/cerGx.xml b/dynamic/launcher/gx/00001/services/cerGx.msk similarity index 80% rename from dynamic/launcher/gx/00001/services/cerGx.xml rename to dynamic/launcher/gx/00001/services/cerGx.msk index 308154a..2206ab1 100644 --- a/dynamic/launcher/gx/00001/services/cerGx.xml +++ b/dynamic/launcher/gx/00001/services/cerGx.msk @@ -1,8 +1,8 @@ - + diff --git a/example/diameter/launcher/deployments/st-client/README b/example/diameter/launcher/deployments/st-client/README index d6f4f5b..fd3860a 100644 --- a/example/diameter/launcher/deployments/st-client/README +++ b/example/diameter/launcher/deployments/st-client/README @@ -13,7 +13,9 @@ not, dynamic programming will fail because the appropiate service is not configured before starting ADML instances. Execute './configure.sh' and follow the intructions to clone the ADML -instance into the needed amount for system testing. +instance into the needed amount for system testing. Every time you run +this, a new 'ADMLS#' directory is created and symlinked +to 'ADMLS'. STARTING THE PROCESS -------------------- @@ -24,6 +26,8 @@ the operation provided through every cloned instance. For example, if you provide 'test|ttps|5', the speed of 5 test cases per second will be set on every ADML instance. Imagine you have N instances, and then you actually are establishing a total 5*N speed rate over the servers. +You could run another 'ADMLS#' directory just providing +it as argument. TESTING PROCEDURE ----------------- @@ -37,6 +41,9 @@ desired rate selected on configuration stage. Don't forget to populate whatever data you need on the tested system, because this work is not done here. +Program script acts over ADMLS symlink. You must update it if want to +program another ADMLS instances directory. + OPERATION --------- Management interface for lite version is based on SIGUSR2 signal caugh. @@ -44,3 +51,6 @@ Use './operation.sh' script within a specific instance directory to send any operation to the process. Ask for help with that script to see all the operations supported. +Operation script acts over ADMLS symlink. You must update it if want to +operate another ADMLS instances directory. + diff --git a/example/diameter/launcher/deployments/st-client/configure.sh b/example/diameter/launcher/deployments/st-client/configure.sh index 4b231ee..ac5432f 100755 --- a/example/diameter/launcher/deployments/st-client/configure.sh +++ b/example/diameter/launcher/deployments/st-client/configure.sh @@ -3,6 +3,7 @@ ############# # VARIABLES # ############# +CWD=$(dirname $0) MAXIMUM_ADML_ASYNC_RATE=50 MAXIMUM_SUGGESTED_CLIENT_CONNECTION_PER_ADML_INSTANCE=10 ADML_INSTANCES__ST_CONF_FILE=.st_conf_adml_instances @@ -18,7 +19,20 @@ N_TESTCASES_PROGRAM_LAYOUT__ST_CONF_FILE=.st_conf_n_testcases_program_layout ############# _exit () { echo -e "\n$1\n" - exit 1 + + # Cleanup: + cd $CWD + rm -rf ADMLS.tmp + cd services + rm -f cer*.xml services.xml *.msk2 + + rc=1 + [ -n "$2" ] && rc=$2 + exit $rc +} + +sig_handler () { + _exit "Script interrupted. Cleanup & exit ..." } # ceil of division $1/$2 @@ -95,40 +109,15 @@ calculate_deployment_layout() { # EXECUTION # ############# -cd `dirname $0` +trap sig_handler INT QUIT TERM + +cd $CWD echo echo "=====================================" echo "ADML SYSTEM TEST CONFIGURATION WIZARD" echo "=====================================" echo -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).\nTake a look to 'services_example' and './dynlibs' scenaries stuff to complete your services.\n\nFor example:\n ln -s services_example services\n cp dynlibs/gx/00001/services/* services\n Edit CER files and 'services.msk' there, to fit your needs." @@ -196,7 +185,7 @@ read minutes while [ -z "$minutes" ]; do read minutes; done seconds=$((minutes*60)) repeats=0 -[ $seconds -gt $time_covered ] && { repeats=$(ceil $seconds $time_covered) ; repeats=$((repeats-1)) ; } +[ $seconds -gt $time_covered -a $time_covered -gt 0 ] && { repeats=$(ceil $seconds $time_covered) ; repeats=$((repeats-1)) ; } if [ $repeats -gt 0 ] then cycles=$((repeats+1)) @@ -212,6 +201,15 @@ then else echo 0 > $CYCLE_REPEATS__ST_CONF_FILE fi + +# Single vs multiple peer: +echo +echo "Select [s]ingle peer or (m)ultiple peer [s]:" +read opt +peer_seq= +[ -z "$opt" ] && opt=s +[ "$opt" = "m" ] && { peer_seq=1 ; echo "Origin-Host will be sequenced for each ADML instance." ; } + echo echo "System test configuration completed." echo @@ -220,9 +218,11 @@ read dummy # Update services.xml regarding the number of client connections: cd services -cp services.msk services.xml -sed -i 's/__CLIENT_CONNECTIONS__/'$G_ADML_CONNECTIONS'/g' services.xml -cd - >/dev/null +cp services.msk services.msk2 +for cer in $(ls cer*.msk 2>/dev/null); do cp $cer ${cer}2; done +cd .. + +sed -i 's/__CLIENT_CONNECTIONS__/'$G_ADML_CONNECTIONS'/g' services/services.msk2 # Create instances and layout: 0>$N_TESTCASES_PROGRAM_LAYOUT__ST_CONF_FILE @@ -234,9 +234,18 @@ do fin=$((offset + first_value + testcase_per_adml_instance - 1)) echo "$instance $ini $fin" >> $N_TESTCASES_PROGRAM_LAYOUT__ST_CONF_FILE + # Case of multiple peer: + sed 's/__PEER_SEQ__/'$peer_seq'/g' services/services.msk2 > services/services.xml + for cer in $(ls services/cer*.msk2 2>/dev/null) + do + cer_xml="${cer%.*}.xml" + sed 's/__PEER_SEQ__/'$peer_seq'/g' $cer > $cer_xml + done + [ -n "$peer_seq" ] && peer_seq=$((peer_seq+1)) + echo "Creating ADML instance $instance ..." - mkdir -p ADMLS/ADML-$instance - cd ADMLS/ADML-$instance + mkdir -p ADMLS.tmp/ADML-$instance + cd ADMLS.tmp/ADML-$instance mkdir counters mkdir test-reports ln -s ../../dynlibs @@ -246,13 +255,61 @@ do cp ../../.run-one.sh run.sh sed -i 's/^EXE=.*/EXE=ADML-'$instance'/' run.sh ln -s ../../ADML ADML-$instance - for xml in `ls ../../services/*xml`; do ln -s $xml; done + for xml in `ls ../../services/*xml`; do cp $xml .; done cd - >/dev/null done +cd $CWD + +# Default ADMLS name: +echo +echo "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 +ADMLS__dflt="ADMLS#${ADML_INSTANCES}instances.${ADML_CONNECTIONS}connectionsPerInstance" +if [ -n "$peer_seq" ] +then + ADMLS__dflt="${ADMLS__dflt}.MultiplePeer" +else + ADMLS__dflt="${ADMLS__dflt}.SinglePeer" +fi + +echo +echo "Input a name for the ADMLS instances directory [$ADMLS__dflt]:" +read ADMLS_NAME +[ "$ADMLS_NAME" = "" ] && ADMLS_NAME=$ADMLS__dflt +while [ -e "$ADMLS_NAME" ] +do + ADMLS_NAME= + echo "Some file/directory already exists with that name ! Please, input another one:" + while [ -z "$ADMLS_NAME" ]; do read ADMLS_NAME; done +done + +mv ADMLS.tmp $ADMLS_NAME +rm -rf ADMLS +ln -s $ADMLS_NAME ADMLS + echo echo "Now you can run all the instances deployed: ./run.sh" +echo "You could provide optional target: 'run.sh '." +echo echo "To configure another layout you should execute this script again." echo -echo "Done!" +_exit "Done!" 0 diff --git a/example/diameter/launcher/deployments/st-client/run_all.sh b/example/diameter/launcher/deployments/st-client/run_all.sh index 8287beb..58a68bf 100755 --- a/example/diameter/launcher/deployments/st-client/run_all.sh +++ b/example/diameter/launcher/deployments/st-client/run_all.sh @@ -1,18 +1,18 @@ #!/bin/bash - -# Core generation: -ulimit -c unlimited +target=$1 +[ -z "$target" ] && target=ADMLS cd `dirname $0` -if [ ! -d "ADMLS" ] +if [ ! -d $target ] then echo - echo "Run './configure.sh' first !" + echo "Directory '$target' missing. Run './configure.sh' first !" + echo "(remember that you could provide another target as argument)" echo exit 1 fi -for run in `ls ADMLS/*/run.sh` +for run in `ls $target/*/run.sh` do cd `dirname $run` instance_name=$(basename $PWD) diff --git a/example/diameter/launcher/deployments/st-client/services_example/cerGx.xml b/example/diameter/launcher/deployments/st-client/services_example/cerGx.msk similarity index 84% rename from example/diameter/launcher/deployments/st-client/services_example/cerGx.xml rename to example/diameter/launcher/deployments/st-client/services_example/cerGx.msk index 0132179..67ad15e 100644 --- a/example/diameter/launcher/deployments/st-client/services_example/cerGx.xml +++ b/example/diameter/launcher/deployments/st-client/services_example/cerGx.msk @@ -1,5 +1,5 @@ - + diff --git a/example/diameter/launcher/deployments/st-client/services_example/cerRx.xml b/example/diameter/launcher/deployments/st-client/services_example/cerRx.msk similarity index 84% rename from example/diameter/launcher/deployments/st-client/services_example/cerRx.xml rename to example/diameter/launcher/deployments/st-client/services_example/cerRx.msk index bb1e0df..0c270c0 100644 --- a/example/diameter/launcher/deployments/st-client/services_example/cerRx.xml +++ b/example/diameter/launcher/deployments/st-client/services_example/cerRx.msk @@ -1,5 +1,5 @@ - + diff --git a/example/diameter/launcher/deployments/st-client/services_example/services.msk b/example/diameter/launcher/deployments/st-client/services_example/services.msk index 56ae019..cc98824 100644 --- a/example/diameter/launcher/deployments/st-client/services_example/services.msk +++ b/example/diameter/launcher/deployments/st-client/services_example/services.msk @@ -5,7 +5,7 @@ - - + + -- 2.20.1