From b8a974c5eaba39f0891dfd17b64f7dd6411688dc Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Sat, 22 Oct 2016 20:59:44 +0200 Subject: [PATCH] Improvements and new scenaries --- .../deployments/st-client/configure.sh | 63 ++++++++++++++++--- .../launcher/deployments/st-client/program.sh | 43 ++++++++----- .../launcher/deployments/st-client/run_all.sh | 3 +- .../launcher/resources/scripts/clone.sh | 43 ++++++------- .../st_examples/Gx_CCR-I/ccr-i.xml.msk | 48 ++++++++++++++ .../st_examples/Gx_CCR-I/testcase.txt.msk | 3 + .../st_examples/Gx_CCR-I_CCR-T/ccr-i.xml.msk | 48 ++++++++++++++ .../st_examples/Gx_CCR-I_CCR-T/ccr-t.xml.msk | 13 ++++ .../Gx_CCR-I_CCR-T/testcase.txt.msk | 5 ++ 9 files changed, 220 insertions(+), 49 deletions(-) create mode 100644 example/diameter/launcher/resources/st_examples/Gx_CCR-I/ccr-i.xml.msk create mode 100644 example/diameter/launcher/resources/st_examples/Gx_CCR-I/testcase.txt.msk create mode 100644 example/diameter/launcher/resources/st_examples/Gx_CCR-I_CCR-T/ccr-i.xml.msk create mode 100644 example/diameter/launcher/resources/st_examples/Gx_CCR-I_CCR-T/ccr-t.xml.msk create mode 100644 example/diameter/launcher/resources/st_examples/Gx_CCR-I_CCR-T/testcase.txt.msk diff --git a/example/diameter/launcher/deployments/st-client/configure.sh b/example/diameter/launcher/deployments/st-client/configure.sh index ef733a8..5c4e8aa 100755 --- a/example/diameter/launcher/deployments/st-client/configure.sh +++ b/example/diameter/launcher/deployments/st-client/configure.sh @@ -69,6 +69,7 @@ calculate_deployment_layout() { #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]:" + echo " (more than $instances instances, implies 1 single connection/instance)" read G_ADML_INSTANCES [ -z "$G_ADML_INSTANCES" ] && G_ADML_INSTANCES=$instances__dflt [ $G_ADML_INSTANCES -lt 1 ] && G_ADML_INSTANCES=1 @@ -102,7 +103,34 @@ echo "=====================================" echo "ADML SYSTEM TEST CONFIGURATION WIZARD" echo "=====================================" echo -[ -d ADMLS ] && _exit "ADMLS directory still exists. Please move/remove it to continue (you may have to 'pkill ADML' before) !" +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) !" calculate_deployment_layout @@ -119,13 +147,25 @@ echo $rate_per_instance > $ADML_RATE_PER_INSTANCE__ST_CONF_FILE echo $desired_rate > $ADML_DESIRED_RATE__ST_CONF_FILE echo -echo "Suggested layout:" +echo "Layout:" +echo echo " - $G_ADML_INSTANCES ADML instances" echo " - $G_ADML_CONNECTIONS client connections per ADML instance" +#maximum_rate_1c=$((G_ADML_INSTANCES*MAXIMUM_ADML_ASYNC_RATE)) 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" +overcommit_rate_per_instance=$((G_ADML_CONNECTIONS*MAXIMUM_ADML_ASYNC_RATE)) +echo +echo " - Desired rate: $desired_rate test cases per second:" +echo " Remember the command to send the needed rate per instance ($rate_per_instance TCs/sec):" +echo " ./operation.sh \"test|ttps|$rate_per_instance\"" echo +if [ $maximum_rate -ne $desired_rate ] +then + echo " - Maximum bunch rate ($G_ADML_CONNECTIONS connections per instance): $maximum_rate testcases/second" + echo " For this, configure instances rate to $overcommit_rate_per_instance test cases per second:" + echo " ./operation.sh \"test|ttps|$overcommit_rate_per_instance\"" + echo +fi echo "Usually, you will program a test case per subscriber." echo "Input the number of test cases to program:" read N_TESTCASES @@ -165,13 +205,22 @@ then echo " obtain a greater total time of testing." fi echo -echo "How many total time do you want to cover (in minutes):" +echo "How many total time you need to cover (in minutes):" read minutes while [ -z "$minutes" ]; do read minutes; done seconds=$((minutes*60)) repeats=$(ceil $seconds $time_covered) -echo $repeats > $CYCLE_REPEATS__ST_CONF_FILE -[ $repeats -gt 0 ] && echo "Configured $repeats cycle repeats ($repeats x $time_covered seconds ~ $seconds seconds (desired $minutes minutes)" +if [ $repeats -gt 0 ] +then + echo "You will need $repeats cycles to cover $minutes minutes." + echo "Input the number of cyles [$repeats]: " + echo " (providing 0, you will cover $time_covered seconds)" + echo + read wanted_repeats + [ -z "$wanted_repeats" ] && wanted_repeats=$repeats + echo $wanted_repeats > $CYCLE_REPEATS__ST_CONF_FILE + [ $wanted_repeats -gt 0 ] && echo "Configured $wanted_repeats cycle repeats ($((wanted_repeats+1)) x $time_covered seconds ~ $(((wanted_repeats+1)*time_covered)) seconds of testing)." +fi echo echo "System test configuration completed." echo diff --git a/example/diameter/launcher/deployments/st-client/program.sh b/example/diameter/launcher/deployments/st-client/program.sh index 0308771..07e7616 100755 --- a/example/diameter/launcher/deployments/st-client/program.sh +++ b/example/diameter/launcher/deployments/st-client/program.sh @@ -40,13 +40,6 @@ usage() { _exit } -children () { - bash_pid=$$ - children=`ps -eo ppid | grep -w $bash_pid` - echo $children | wc -w -} - - ############# # EXECUTION # ############# @@ -60,7 +53,10 @@ miss_conf= echo [ -z "$1" ] && usage -./operation.sh --ping +echo "Starting testcases programming ..." +echo + +./operation.sh --ping >/dev/null [ $? -ne 0 ] && _exit "Programming aborted (some ADML client process is not running) !" TESTCASE_DIR=$1 AUTOSTART=$2 @@ -76,25 +72,39 @@ CLONE_GROUPS=$((MAX_NUMBER_GROUPS/ADML_INSTANCES)) specific= [ -f $TESTCASE_DIR/specific ] && specific=specific -children_before=$(children) +[ -z "$ADML_CONCURRENT_PROVISION_JOBS" ] && ADML_CONCURRENT_PROVISION_JOBS=5 + +count=0 while read -r line do instance=$(echo $line | awk '{ print $1 }') ini_seq=$(echo $line | awk '{ print $2 }') fin_seq=$(echo $line | awk '{ print $3 }') ADML_DIR=`readlink -f ADMLS/ADML-$instance` + echo -e "\rCloning interval [$ini_seq,$fin_seq] for $(basename $ADML_DIR) ..." ./clone.sh $ADML_DIR $TESTCASE $ini_seq $fin_seq $CLONE_GROUPS $specific & + sleep 0.1 + count=$((count+1)) + if [ $count -eq $ADML_CONCURRENT_PROVISION_JOBS ] + then + idle_cpu=$(top -b -d 0.1 -n 2 | grep 'Cpu(s):'| tail -1 |awk '{print $8}') + echo + echo "Idle cpu = $idle_cpu%" + echo "if cpu is not overcommited, consider increase ADML_CONCURRENT_PROVISION_JOBS environment variable (now $ADML_CONCURRENT_PROVISION_JOBS)" + echo + wait $(jobs -p) + count=0 + fi done < $PROGRAM_LAYOUT_FILE # Wait background jobs to finish: -sleep 1 +sleep 5 echo "Waiting for clone completion ..." -while true -do - [ $(children) -eq $children_before ] && break - sleep 1 -done +echo "(please be patient, this may take a while)" +echo +echo "Background Jobs: $(jobs -p | wc -l)" +wait $(jobs -p) echo echo "Programming has finished !" @@ -129,6 +139,9 @@ else 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\"" 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 796fe2d..3d1c33b 100755 --- a/example/diameter/launcher/deployments/st-client/run_all.sh +++ b/example/diameter/launcher/deployments/st-client/run_all.sh @@ -26,8 +26,7 @@ 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 program again, you should execute './configure.sh' script to" -echo " change the current testing setup." +echo "To configure another layout you should execute './configure.sh'." echo echo "Done!" echo diff --git a/example/diameter/launcher/resources/scripts/clone.sh b/example/diameter/launcher/resources/scripts/clone.sh index 84a9479..bb4c468 100755 --- a/example/diameter/launcher/resources/scripts/clone.sh +++ b/example/diameter/launcher/resources/scripts/clone.sh @@ -25,7 +25,6 @@ _exit (){ echo # Background jobs: - #remaining_jobs=$(jobs -p) (kill -9 $(jobs -p) 2>&1) >/dev/null # Cleanup: @@ -50,6 +49,7 @@ usage() { echo " Currently, 4 variables are supported to be replaced:" echo echo " * __TESTID__ : sequence number. For example if you provide 1 to 20 for this script, it will be 1 .. 20" + echo " * __SEQ7__ : 7-digit number corresponding to the sequence number (0000001 for 1, and so on)" echo " * __SEQ8__ : 8-digit number corresponding to the sequence number (00000001 for 1, and so on)" echo " * __IPV4HEX__ : hexadecimal IPv4 address, for example: 00000001" echo " * __IPV4__ : IPv4 address, for example: 0.0.0.1" @@ -77,12 +77,6 @@ usage() { _exit } -children () { - bash_pid=$$ - children=`ps -eo ppid | grep -w $bash_pid` - echo $children | wc -w -} - # $1: sequence number; $2: file to parse(will be updated); $3: result file parse_file() { local vars=$(egrep -o '__((_*[A-Z]*[0-9]*)*)__' $2 | cut -d: -f2 | sort -u) @@ -103,22 +97,26 @@ clone() { mkdir -p $wkdir ############################################# VARIABLES SECTION ############################################# - testid=$sequence - seq8=$(printf "%08d" $testid) - ipv4hex=$seq8 + local testid=$sequence + local seq7=$(printf "%07d" $testid) + local seq8=$(printf "%08d" $testid) + local ipv4hex=$seq8 # Numbers beginning with "0" are treated as octal (i.e. base-8): we would have 'invalid octal number with 08 and 09' # Solution: convert to base-10 in this way: $((10#$i)) - ipv4=$(for i in $(echo $seq8 | sed 's/\(..\)/ \1 /g'); do printf "%d." $((10#$i)); done | sed 's/\.$/\n/') + local ipv4=$(for i in $(echo $seq8 | sed 's/\(..\)/ \1 /g'); do printf "%d." $((10#$i)); done | sed 's/\.$/\n/') - __TESTID__=$testid - __SEQ8__=$seq8 - __IPV4HEX__=$ipv4hex - __IPV4__=$ipv4 + local __TESTID__=$testid + local __SEQ7__=$seq7 + local __SEQ8__=$seq8 + local __IPV4HEX__=$ipv4hex + local __IPV4__=$ipv4 [ -n "$extra_vars" ] && source $CLONE_EXTRA_VARS_SCR_FILE $sequence ######################################### END VARIABLES SECTION ######################################### # Parse template files: parse_file $sequence $TESTCASE_TEMPLATE $wkdir/testcase.txt.$sequence + local xml= + local new_file= for file in $(grep sendxml $TESTCASE_TEMPLATE | cut -d\| -f4 | sed 's/\.xml$/.xml.msk/') do xml=`basename $file .msk` @@ -142,8 +140,8 @@ clone_group() { for i in `seq $2 $3` do clone $i $CLONE_WKDIR/$1 - sleep 0.01 done + echo " - Completed range [$2,$3] for $(basename $ADML_DIR)" } ############# @@ -200,11 +198,10 @@ fi # Start cloning: timestamp_begin=$(echo "scale=3 ; $(date '+%s') + $(date '+%N') / 1000000000" | bc) -children_before=$(children) offset=0 -$OPERATION "test|clear" +$OPERATION "test|clear" >/dev/null [ $? -ne 0 ] && _exit "Clone aborted: failed to clean tests !" -echo "Please be patient, this may take a while ..." +#echo "Please be patient, this may take a while ..." #echo "Temporary directory: $CLONE_WKDIR" for group in `seq 1 $((N_GROUPS+1))` do @@ -213,15 +210,11 @@ do [ $n_end -gt $CLONE_SEQ_END ] && n_end=$CLONE_SEQ_END [ $n_end -lt $n_begin ] && break clone_group $group $n_begin $n_end & + sleep 0.05 offset=$((group * GROUPS_SIZE)) done -# Wait background jobs to finish: -while true -do - sleep 1 - [ $(children) -eq $children_before ] && break -done +wait $(jobs -p) # Programming: echo -n "Programming .." diff --git a/example/diameter/launcher/resources/st_examples/Gx_CCR-I/ccr-i.xml.msk b/example/diameter/launcher/resources/st_examples/Gx_CCR-I/ccr-i.xml.msk new file mode 100644 index 0000000..40c5d70 --- /dev/null +++ b/example/diameter/launcher/resources/st_examples/Gx_CCR-I/ccr-i.xml.msk @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/diameter/launcher/resources/st_examples/Gx_CCR-I/testcase.txt.msk b/example/diameter/launcher/resources/st_examples/Gx_CCR-I/testcase.txt.msk new file mode 100644 index 0000000..dfdb03b --- /dev/null +++ b/example/diameter/launcher/resources/st_examples/Gx_CCR-I/testcase.txt.msk @@ -0,0 +1,3 @@ +test|__TESTID__|timeout|6000 +test|__TESTID__|sendxml2e|ccr-i.xml +test|__TESTID__|waitfe|272|0|||11111__SEQ8__;BAT004;esmdx0900.gxrel10plusrealm.com;90__SEQ8__|2001 diff --git a/example/diameter/launcher/resources/st_examples/Gx_CCR-I_CCR-T/ccr-i.xml.msk b/example/diameter/launcher/resources/st_examples/Gx_CCR-I_CCR-T/ccr-i.xml.msk new file mode 100644 index 0000000..40c5d70 --- /dev/null +++ b/example/diameter/launcher/resources/st_examples/Gx_CCR-I_CCR-T/ccr-i.xml.msk @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/diameter/launcher/resources/st_examples/Gx_CCR-I_CCR-T/ccr-t.xml.msk b/example/diameter/launcher/resources/st_examples/Gx_CCR-I_CCR-T/ccr-t.xml.msk new file mode 100644 index 0000000..345977c --- /dev/null +++ b/example/diameter/launcher/resources/st_examples/Gx_CCR-I_CCR-T/ccr-t.xml.msk @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/example/diameter/launcher/resources/st_examples/Gx_CCR-I_CCR-T/testcase.txt.msk b/example/diameter/launcher/resources/st_examples/Gx_CCR-I_CCR-T/testcase.txt.msk new file mode 100644 index 0000000..ecc4608 --- /dev/null +++ b/example/diameter/launcher/resources/st_examples/Gx_CCR-I_CCR-T/testcase.txt.msk @@ -0,0 +1,5 @@ +test|__TESTID__|timeout|6000 +test|__TESTID__|sendxml2e|ccr-i.xml +test|__TESTID__|waitfe|272|0|||11111__SEQ8__;BAT004;esmdx0900.gxrel10plusrealm.com;90__SEQ8__|2001 +test|__TESTID__|sendxml2e|ccr-t.xml +test|__TESTID__|waitfe|272|0|||11111__SEQ8__;BAT004;esmdx0900.gxrel10plusrealm.com;90__SEQ8__|2001 -- 2.20.1