borrado de ficheros
[anna.git] / example / diameter / launcher / scripts / burst.sh
diff --git a/example/diameter/launcher/scripts/burst.sh b/example/diameter/launcher/scripts/burst.sh
deleted file mode 100755 (executable)
index a3b5341..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-#!/bin/ksh
-> curl_log.txt
-TRACE="--trace-ascii curl_log.txt"
-SERVER=`cat .httpServer`
-burstMargin__dflt=1
-
-salir () {
-   echo
-   echo $1
-   echo
-   exit
-}
-
-calc () { echo "$1" | bc -l ; }
-
-entero () {
-   limpio=$(calc "scale=0;${1}/1")
-   [[ $limpio != $1 ]] && salir "Invalid value '$1'. Must be integer"
-}
-
-uso () {
-
-   echo "Load tests configuration script"
-   echo
-   echo "Use: $0 <action: clear | load | start | push | pop | stop | resume | repeat | send | goto | look> [action parameters]"
-   echo
-   echo "     clear:"
-   echo "        Clears all loaded burst messages."
-   echo
-   echo "     load <amount> <traffic type: mms | sms | voice | data | content>:"
-   echo "        Loads 'amount' messages for the provided traffic type. For example:"
-   echo "           $0 load 2000 sms"
-   echo
-   echo "     start [initial launch: default $burstMargin__dflt]:"
-   echo "        Starts the message sending from the begining of the burst list loaded,"
-   echo "        with a certain initial load. For example:"
-   echo "           $0 start 200"
-   echo
-   echo "     push [amount: default $burstMargin__dflt]:"
-   echo "        Launch 'amount' messages as initial load does (non-asynchronous mode)."
-   echo "        It works even if burst launch is stopped. Useful to achieve congestion"
-   echo "        conditions. For example:"
-   echo "           $0 push 300"
-   echo
-   echo "     pop [amount: default $burstMargin__dflt]:"
-   echo "        Skip send burst messages in order to reduce over-the-air requests."
-   echo
-   echo "     stop:"
-   echo "        Stops the burst cycle at the current position. It could affect sessions"
-   echo "        on the air (i.e. data contexts). Totally safe for IEC scenaries as SMS."
-   echo
-   echo "     resume:"
-   echo "        Resume an stopped burst launch from the same point (start will reset"
-   echo "        the work pointer to the first burst list position). This is equivalent" 
-   echo "        to one-message-push operation."
-   echo
-   echo "     repeat [[yes] | no]:"
-   echo "        Restarts the burst launch cycle when finished."
-   echo
-   echo "     send [amount: default 1]:"
-   echo "        send messages from burst list. The main difference with start/push operations"
-   echo "        is that burst won't be awaken. Externally we could control sending time (no"
-   echo "        request will be sent for answers). When reach the last position, starts again."
-   echo
-   echo "     sendXS <requests per second> [amount: default -1 (no limit)]:"
-   echo "        send messages from burst list with the TPS provided. User could hot change"
-   echo "        speed by mean 'echo <TPS> > .tps' at another shell. You can stop the load"
-   echo "        removing that hidden file or using CTRL+C from the shell where you launched"
-   echo "        the burst command. Real tps is dumped on '.real_tps' file during testing."
-   echo "        You could limit the amount of messages sent by mean the second parameter."
-   echo "        No limit is established by default (-1 or negative value)."
-   echo
-   echo "     goto <order>:"
-   echo "        Updates current burst pointer position."
-   echo
-   echo "     look <order>:"
-   echo "        Show programmed burst message for order provided."
-   echo
-   echo
-   salir 
-}
-
-_curl () {
-   curl -m 5 --data "$1" $TRACE ${SERVER}
-}
-
-echo
-echo
-[[ "$1" = "" ]] && uso
-case $1 in
-   clear) _curl "burst|clear"
-   ;;
-   load) [[ "$3" = "" ]] && uso
-         [[ ! -f "${3}.sh" ]] && salir "Burst generation file '${3}.sh' not found!"
-         entero $2
-         if test "$3" = "data"
-         then
-            count=$2
-            RESTO=$((count%4))
-            [[ "$RESTO" != "0" ]] && salir "Data context should load a multiple of 4 (messages generated by data.sh)" 
-         fi
-         count=1
-         while test "$count" -le "$2"
-         do
-            ${3}.sh $count > .${3}.xml
-            echo -n "Loading message ${count}; "
-            _curl "burst|load|.${3}.xml"
-            count=$((count+1))
-         done
-   ;;
-   start) load=$burstMargin__dflt
-          [[ "$2" != "" ]] && load=$2
-          entero $load
-          _curl "burst|start|$load"
-   ;;
-   pop) release=$burstMargin__dflt
-          [[ "$2" != "" ]] && release=$2
-          entero $release
-          _curl "burst|pop|$release"
-   ;;
-   push) [[ "$2" = "" ]] && uso
-         entero $2
-         _curl "burst|push|$2"
-   ;;
-   stop) _curl "burst|stop"
-   ;;
-   resume) _curl "burst|push|1"
-   ;;
-   repeat) repeat=yes
-          [[ "$2" != "" ]] && repeat=$2
-          _curl "burst|repeat|$repeat"
-   ;;
-   send) amount=1
-         [[ "$2" != "" ]] && amount=$2
-         entero $amount
-         _curl "burst|send|$amount"
-   ;;
-   sendXS) [[ "$2" = "" ]] && uso
-         limit=$3
-         [[ "$limit" = "" ]] && limit=-1
-         entero $2
-         entero $limit
-         TPS=0
-         count=0
-         amount=1
-         echo $2 > .tps
-         while test -f .tps
-         do
-            [[ "$count" = "$limit" ]] && break
-            BEFORE_ns=`date +%s%N`
-            READ_TPS=`cat .tps`
-            # Hot change could make .tps still unavailable:
-            [[ "$READ_TPS" = "" ]] && READ_TPS=$TPS
-            # Volvemos a calcular medias (REAL_TPS) cada 10 segundos o cuando cambia el TPS en caliente:
-            [[ "$READ_TPS" != "$TPS" ]] && { BEGIN_ns=$BEFORE_ns ; count=0 ; }
-            [[ $count = $((10*TPS)) ]] && { BEGIN_ns=$BEFORE_ns ; count=0 ; }
-            TPS=$READ_TPS
-            [[ "$TPS" = "0" ]] && salir "Test stopped due to 0-tps value read"
-            # Background:
-            _curl "burst|send|$amount" &
-            count=$((count+amount))
-            AFTER_ns=`date +%s%N`
-            # Real tps:
-            REAL_TPS=$(calc "1000000000 * $count / ($AFTER_ns - $BEGIN_ns)")
-            echo $REAL_TPS > .real_tps
-            
-            COEF=1
-            [[ $(calc "$TPS > $REAL_TPS") = "1" ]] && COEF=$(calc "$REAL_TPS / $TPS")
-            K=$(calc "$COEF ^ 10")
-            amount=$(calc "scale=0;1/$K")
-            usleep $(calc "$K * 1000000/$TPS")
-         done
-   ;;
-   goto) [[ "$2" = "" ]] && uso
-         entero $2
-         _curl "burst|goto|$2"
-   ;;
-   look) [[ "$2" = "" ]] && uso
-         entero $2
-         _curl "burst|look|$2"
-   ;;
-   *) uso
-esac
-