#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
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
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
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
_exit
}
-children () {
- bash_pid=$$
- children=`ps -eo ppid | grep -w $bash_pid`
- echo $children | wc -w
-}
-
-
#############
# EXECUTION #
#############
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
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 !"
else
echo "Remember that you could start traffic using:"
echo " ./operation.sh \"test|ttps|<test cases per second rate>\""
+ echo
+ echo "For example, to reach $DESIRED_RATE test cases per second:"
+ echo " ./operation.sh \"test|ttps|$RATE_PER_INSTANCE\""
fi
fi
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
echo
# Background jobs:
- #remaining_jobs=$(jobs -p)
(kill -9 $(jobs -p) 2>&1) >/dev/null
# Cleanup:
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"
_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)
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`
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)"
}
#############
# 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
[ $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 .."
--- /dev/null
+<message version="1" name="CC-Request" application-id="16777238" hop-by-hop-id="3" end-by-end-id="120858624">
+ <avp name="Session-Id" data="11111__SEQ8__;BAT004;esmdx0900.gxrel10plusrealm.com;90__SEQ8__"/>
+ <avp name="Origin-Host" data="esmdx0900.gxrel10plusrealm.com"/>
+ <avp name="Origin-Realm" data="gxrel10plusrealm.com"/>
+ <avp name="Destination-Realm" data="operatorRealm.com"/>
+ <avp name="Origin-State-Id" data="1"/>
+ <avp name="CC-Request-Number" data="0"/>
+ <avp name="CC-Request-Type" data="1" alias="INITIAL_REQUEST"/>
+ <avp name="Bearer-Usage" data="0" alias="GENERAL"/>
+ <avp name="Framed-IP-Address" hex-data="__IPV4HEX__"/>
+ <avp name="IP-CAN-Type" data="0" alias="3GPP-GPRS"/>
+ <avp name="Subscription-Id">
+ <avp name="Subscription-Id-Type" data="0" alias="END_USER_E164"/>
+ <avp name="Subscription-Id-Data" data="11111__SEQ8__"/>
+ </avp>
+ <avp name="Subscription-Id">
+ <avp name="Subscription-Id-Type" data="1" alias="END_USER_IMSI"/>
+ <avp name="Subscription-Id-Data" data="__SEQ8__"/>
+ </avp>
+ <avp name="Gx-Capability-List" data="25"/>
+ <avp name="Bearer-Identifier" hex-data="3131313131"/>
+ <avp name="Bearer-Operation" data="1" alias="ESTABLISHMENT"/>
+ <avp name="Supported-Features" flags="192">
+ <avp name="Vendor-Id" data="10415"/>
+ <avp name="Feature-List-ID" data="1"/>
+ <avp name="Feature-List" data="11"/>
+ </avp>
+ <avp name="RAI" data="123456010a00"/>
+ <avp name="RAT-Type" data="1000" alias="UTRAN"/>
+ <avp name="Called-Station-Id" data="10.20.110.25"/>
+ <avp name="QoS-Information">
+ <avp name="QoS-Class-Identifier" data="1" alias="QCI_1"/>
+ <avp name="Max-Requested-Bandwidth-UL" data="504000"/>
+ <avp name="Max-Requested-Bandwidth-DL" data="504000"/>
+ <avp name="Guaranteed-Bitrate-UL" data="104000"/>
+ <avp name="Guaranteed-Bitrate-DL" data="104000"/>
+ <avp name="Allocation-Retention-Priority">
+ <avp name="Priority-Level" data="1"/>
+ </avp>
+ </avp>
+ <avp name="QoS-Negotiation" data="1" alias="QoS_NEGOTIATION_SUPPORTED"/>
+ <avp name="QoS-Upgrade" data="1" alias="QoS_UPGRADE_SUPPORTED"/>
+ <avp name="3GPP-Charging-Characteristics" data="0457"/>
+ <avp name="3GPP-User-Location-Info" hex-data="313233343536373839"/>
+ <avp name="3GPP-SGSN-Address" hex-data="0a011450"/>
+ <avp name="Rule-Space-Suggestion" hex-data="43"/>
+ <avp name="Auth-Application-Id" data="16777238"/>
+</message>
--- /dev/null
+test|__TESTID__|timeout|6000
+test|__TESTID__|sendxml2e|ccr-i.xml
+test|__TESTID__|waitfe|272|0|||11111__SEQ8__;BAT004;esmdx0900.gxrel10plusrealm.com;90__SEQ8__|2001
--- /dev/null
+<message version="1" name="CC-Request" application-id="16777238" hop-by-hop-id="3" end-by-end-id="120858624">
+ <avp name="Session-Id" data="11111__SEQ8__;BAT004;esmdx0900.gxrel10plusrealm.com;90__SEQ8__"/>
+ <avp name="Origin-Host" data="esmdx0900.gxrel10plusrealm.com"/>
+ <avp name="Origin-Realm" data="gxrel10plusrealm.com"/>
+ <avp name="Destination-Realm" data="operatorRealm.com"/>
+ <avp name="Origin-State-Id" data="1"/>
+ <avp name="CC-Request-Number" data="0"/>
+ <avp name="CC-Request-Type" data="1" alias="INITIAL_REQUEST"/>
+ <avp name="Bearer-Usage" data="0" alias="GENERAL"/>
+ <avp name="Framed-IP-Address" hex-data="__IPV4HEX__"/>
+ <avp name="IP-CAN-Type" data="0" alias="3GPP-GPRS"/>
+ <avp name="Subscription-Id">
+ <avp name="Subscription-Id-Type" data="0" alias="END_USER_E164"/>
+ <avp name="Subscription-Id-Data" data="11111__SEQ8__"/>
+ </avp>
+ <avp name="Subscription-Id">
+ <avp name="Subscription-Id-Type" data="1" alias="END_USER_IMSI"/>
+ <avp name="Subscription-Id-Data" data="__SEQ8__"/>
+ </avp>
+ <avp name="Gx-Capability-List" data="25"/>
+ <avp name="Bearer-Identifier" hex-data="3131313131"/>
+ <avp name="Bearer-Operation" data="1" alias="ESTABLISHMENT"/>
+ <avp name="Supported-Features" flags="192">
+ <avp name="Vendor-Id" data="10415"/>
+ <avp name="Feature-List-ID" data="1"/>
+ <avp name="Feature-List" data="11"/>
+ </avp>
+ <avp name="RAI" data="123456010a00"/>
+ <avp name="RAT-Type" data="1000" alias="UTRAN"/>
+ <avp name="Called-Station-Id" data="10.20.110.25"/>
+ <avp name="QoS-Information">
+ <avp name="QoS-Class-Identifier" data="1" alias="QCI_1"/>
+ <avp name="Max-Requested-Bandwidth-UL" data="504000"/>
+ <avp name="Max-Requested-Bandwidth-DL" data="504000"/>
+ <avp name="Guaranteed-Bitrate-UL" data="104000"/>
+ <avp name="Guaranteed-Bitrate-DL" data="104000"/>
+ <avp name="Allocation-Retention-Priority">
+ <avp name="Priority-Level" data="1"/>
+ </avp>
+ </avp>
+ <avp name="QoS-Negotiation" data="1" alias="QoS_NEGOTIATION_SUPPORTED"/>
+ <avp name="QoS-Upgrade" data="1" alias="QoS_UPGRADE_SUPPORTED"/>
+ <avp name="3GPP-Charging-Characteristics" data="0457"/>
+ <avp name="3GPP-User-Location-Info" hex-data="313233343536373839"/>
+ <avp name="3GPP-SGSN-Address" hex-data="0a011450"/>
+ <avp name="Rule-Space-Suggestion" hex-data="43"/>
+ <avp name="Auth-Application-Id" data="16777238"/>
+</message>
--- /dev/null
+<message version="1" name="CC-Request" application-id="16777238" hop-by-hop-id="3" end-by-end-id="920291329">
+ <avp name="Session-Id" data="11111__SEQ8__;BAT004;esmdx0900.gxrel10plusrealm.com;90__SEQ8__"/>
+ <avp name="Origin-Host" data="esmdx0900.gxrel10plusrealm.com"/>
+ <avp name="Origin-Realm" data="gxrel10plusrealm.com"/>
+ <avp name="Destination-Realm" data="operatorRealm.com"/>
+ <avp name="Origin-State-Id" data="1"/>
+ <avp name="CC-Request-Number" data="1"/>
+ <avp name="CC-Request-Type" data="3" alias="TERMINATION_REQUEST"/>
+ <avp name="Bearer-Usage" data="0" alias="GENERAL"/>
+ <avp name="Termination-Cause" data="1" alias="LOGOUT"/>
+ <avp name="Framed-IP-Address" hex-data="__IPV4HEX__"/>
+ <avp name="Auth-Application-Id" data="16777238"/>
+</message>
--- /dev/null
+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