reorganization
authorEduardo Ramos Testillano <eduardo.ramos.testillano@gmail.com>
Tue, 18 Jun 2013 21:35:14 +0000 (14:35 -0700)
committerEduardo Ramos Testillano <eduardo.ramos.testillano@gmail.com>
Tue, 18 Jun 2013 21:35:14 +0000 (14:35 -0700)
50 files changed:
example/diameter/launcher/DEPLOY.sh [new file with mode: 0755]
example/diameter/launcher/README [new file with mode: 0644]
example/diameter/launcher/resources/1.xml [new file with mode: 0644]
example/diameter/launcher/resources/1xml-23.txt [new file with mode: 0644]
example/diameter/launcher/resources/answerXml.sh [new file with mode: 0755]
example/diameter/launcher/resources/args.txt [new file with mode: 0755]
example/diameter/launcher/resources/batch.sh [new file with mode: 0755]
example/diameter/launcher/resources/burst.sh [new file with mode: 0755]
example/diameter/launcher/resources/clientSocketManager.sh [new file with mode: 0755]
example/diameter/launcher/resources/code.sh [new file with mode: 0755]
example/diameter/launcher/resources/collect.sh [new file with mode: 0755]
example/diameter/launcher/resources/data-initial.msk [new file with mode: 0644]
example/diameter/launcher/resources/data-termination.msk [new file with mode: 0644]
example/diameter/launcher/resources/data-update1.msk [new file with mode: 0644]
example/diameter/launcher/resources/data-update2.msk [new file with mode: 0644]
example/diameter/launcher/resources/data.sh [new file with mode: 0755]
example/diameter/launcher/resources/decode.sh [new file with mode: 0755]
example/diameter/launcher/resources/diameterServerSessions.sh [new file with mode: 0755]
example/diameter/launcher/resources/help.sh [new file with mode: 0755]
example/diameter/launcher/resources/loadXml.sh [new file with mode: 0755]
example/diameter/launcher/resources/pre-start.sh [new file with mode: 0755]
example/diameter/launcher/resources/sendXml.sh [new file with mode: 0755]
example/diameter/launcher/resources/sms.msk [new file with mode: 0644]
example/diameter/launcher/resources/sms.sh [new file with mode: 0755]
example/diameter/launcher/scripts/1.xml [new file with mode: 0644]
example/diameter/launcher/scripts/1xml-23.txt [new file with mode: 0644]
example/diameter/launcher/scripts/DEPLOY.sh [new file with mode: 0755]
example/diameter/launcher/scripts/README [new file with mode: 0644]
example/diameter/launcher/scripts/answerXml.sh [new file with mode: 0755]
example/diameter/launcher/scripts/args.txt [new file with mode: 0755]
example/diameter/launcher/scripts/batch.sh [new file with mode: 0755]
example/diameter/launcher/scripts/burst.sh [new file with mode: 0755]
example/diameter/launcher/scripts/clientSocketManager.sh [new file with mode: 0755]
example/diameter/launcher/scripts/code.sh [new file with mode: 0755]
example/diameter/launcher/scripts/collect.sh [new file with mode: 0755]
example/diameter/launcher/scripts/createBatch.sh [new file with mode: 0755]
example/diameter/launcher/scripts/data-initial.msk [new file with mode: 0644]
example/diameter/launcher/scripts/data-termination.msk [new file with mode: 0644]
example/diameter/launcher/scripts/data-update1.msk [new file with mode: 0644]
example/diameter/launcher/scripts/data-update2.msk [new file with mode: 0644]
example/diameter/launcher/scripts/data.sh [new file with mode: 0755]
example/diameter/launcher/scripts/decode.sh [new file with mode: 0755]
example/diameter/launcher/scripts/diameterServerSessions.sh [new file with mode: 0755]
example/diameter/launcher/scripts/help.sh [new file with mode: 0755]
example/diameter/launcher/scripts/loadXml.sh [new file with mode: 0755]
example/diameter/launcher/scripts/pre-start.sh [new file with mode: 0755]
example/diameter/launcher/scripts/sendXml.sh [new file with mode: 0755]
example/diameter/launcher/scripts/sms.msk [new file with mode: 0644]
example/diameter/launcher/scripts/sms.sh [new file with mode: 0755]
example/diameter/launcher/scripts/tests/createPackage.sh [deleted file]

diff --git a/example/diameter/launcher/DEPLOY.sh b/example/diameter/launcher/DEPLOY.sh
new file mode 100755 (executable)
index 0000000..d574860
--- /dev/null
@@ -0,0 +1,109 @@
+#!/bin/ksh
+
+# Functions & variables
+SETUPS_DIR=../../../source/diameter/stack/setups
+MSGDTD_DIR=../../../source/diameter/codec/message.dtd
+BASE_PROT=commands_baseProtocol.xml
+EXEC=/opt/bin/anna/example_diameter_launcher
+DPATH_dflt=$HOME/ADL
+
+_exit () {
+   echo
+   echo $1
+   echo
+   exit
+}
+
+createRunScript () {
+
+echo "#!/bin/ksh" > run.sh
+echo "EXE=\`cat .exe 2>/dev/null\`" >> run.sh
+echo "STARTED=\`ps -fea | grep \"\$EXE\" | grep -v grep\`" >> run.sh
+echo "[ \"\$EXE\" != \"\" -a \"\$STARTED\" != \"\" ] && { echo \"Already started!\"; echo \"\$STARTED\" ; exit ; }" >> run.sh
+echo "pre-start.sh" >> run.sh
+echo "> launcher.traces" >> run.sh
+echo "EXE=\"ndl_\`date '+%Y%m%d%H%M%S'\`\"" >> run.sh
+echo "echo \$EXE > .exe"  >> run.sh
+#echo "rm \$EXE 2>/dev/null" >> run.sh
+echo "echo ; echo \"Executable paths:\" ; echo" >> run.sh
+echo "for i in \`ls execs/.*/*\` ; do echo \$i ; done" >> run.sh
+echo "echo ; echo \"Input the executable path:\" ; read path ; while test \"\$path\" = \"\" ; do read path ; done" >> run.sh
+echo "ln -s \$path \$EXE" >> run.sh
+echo >> run.sh
+echo -n "\$EXE " >> run.sh
+for i in `cat args.txt | grep -v "^#"`
+do
+   echo -n "$i " >> run.sh
+done
+echo "&" >> run.sh
+chmod a+x run.sh
+rm args.txt
+}
+
+createDictionaryPaths () {
+
+
+for i in stacks/*commands*xml
+do
+   stacks/dependence.sh $i >/dev/null
+   stack=`basename $i`
+   if test "$stack" != "$BASE_PROT"
+   then
+      > .dictionary__${stack}
+      for j in `cat ${i}.dep`
+      do
+         echo "${j},\c" >> .dictionary__${stack}
+      done
+      echo "stacks/$BASE_PROT,stacks/${stack}" >> .dictionary__${stack}
+   fi
+done
+
+# Default:
+ln -s .dictionary__commands_qosControl.xml .dictionary
+}
+
+#############
+# EXECUTION #
+#############
+echo
+echo "---------------------------------------"
+echo "Anna Diameter Launcher (ADL) deployment"
+echo "---------------------------------------"
+echo
+echo "Input deployment path [$DPATH_dftl]:"
+read DPATH
+[[ "$DPATH" = "" ]] && DPATH=$DPATH_dflt
+mkdir -p $DPATH
+mkdir $DPATH/stacks
+
+echo "Basic checkings ..."
+[[ ! -f $EXEC ]] && salir "Anna Diameter Launcher (ADL) is not installed in the system. Execute 'sudo scons install' for 'anna' suite."
+[[ ! -d $SETUPS_DIR ]] && salir "Diameter stacks not found ($SETUPS_DIR). Perhaps you executed '$0' out of its parent path."
+
+echo "Copying ..."
+cp $EXEC $DPATH/launcher
+cp resources/* $DPATH
+cp $SETUPS_DIR/*xml $DPATH/stacks
+cp $SETUPS_DIR/*sh $DPATH/stacks
+cp $MSGDTD_DIR $DPATH
+
+echo "Preparing ..."
+cd $DPATH
+createRunScript
+createDictionaryPaths
+cd - >/dev/null
+
+# Help:
+echo "Stacks available at '.dictionary__<stack description>', create a symbolic link from '.dictionary'." >> tmp/README
+echo "Template for xml messages: message.dtd (informative, not actually required by process)" >> tmp/README
+echo "Start with 'run.sh'" >> tmp/README
+
+mv tmp ADL-installer
+tar cvfz ADL-installer.tar.gz ADL-installer
+rm -rf ADL-installer
+
+echo
+echo "Created ADL-installer.tar.gz !"
+echo
+
+
diff --git a/example/diameter/launcher/README b/example/diameter/launcher/README
new file mode 100644 (file)
index 0000000..f7660a6
--- /dev/null
@@ -0,0 +1,10 @@
+
+Use 'DEPLOY.sh', to bundle and install this launcher process.
+The installation will include full configuration resources.
+
+Once installed, you could start the launcher process and perform
+some basic taks, i.e., you could execute 'help.sh' to get help
+information from the process http interface.
+
+See next instructions after deployment.
diff --git a/example/diameter/launcher/resources/1.xml b/example/diameter/launcher/resources/1.xml
new file mode 100644 (file)
index 0000000..dcd18b9
--- /dev/null
@@ -0,0 +1,7 @@
+<message version="1" code="265" flags="0" application-id="0" hop-by-hop-id="1" end-by-end-id="2">
+   <avp name="Session-Id" data="ocs3;1332909618;0;1332909618"/>
+   <avp name="Auth-Application-Id" data="16777236"/>
+   <avp name="Origin-Host" data="OCS3"/>
+   <avp name="Origin-Realm" data="OCS3"/>
+</message>
+
diff --git a/example/diameter/launcher/resources/1xml-23.txt b/example/diameter/launcher/resources/1xml-23.txt
new file mode 100644 (file)
index 0000000..c0d8b4c
--- /dev/null
@@ -0,0 +1,2 @@
+Encode 1.xml to 2.hex|code|1.xml|2.hex
+Decode 2.hex to 3.xml (we will diff 1.xml and 3.xml)|decode|2.hex|3.xml
diff --git a/example/diameter/launcher/resources/answerXml.sh b/example/diameter/launcher/resources/answerXml.sh
new file mode 100755 (executable)
index 0000000..451882c
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+
+echo
+echo
+echo "Use: $0 [xml_file] [2e]"
+echo
+echo "Programm 'xml_file' answer to the diameter client or to the server (entity) when"
+echo "'2e' parameter is provided. If missing xml file, current programmed answers will"
+echo "be shown: '$0' (answers to client), '$0 2e' (answers to server)."
+echo
+if test "$1" != ""
+then
+   if test "$1" = "2e"
+   then
+     operation="answerxml2e"
+   else 
+     [[ ! -f "$1" ]] && { echo "ERROR: file '$1' not found" ; echo; echo; exit ; }
+     operation="answerxml|$1"
+     [[ "$2" = "2e" ]] && operation="answerxml2e|$1"
+   fi
+else
+   operation="answerxml"
+fi
+echo
+curl -m 1 --data "$operation" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/resources/args.txt b/example/diameter/launcher/resources/args.txt
new file mode 100755 (executable)
index 0000000..d5f4afb
--- /dev/null
@@ -0,0 +1,6 @@
+-httpServer `grep -v ^# .httpServer`
+-dictionary `grep -v ^# .dictionary`
+-diameterServer `grep -v ^# .diameterServer`
+-diameterServerSessions `grep -v ^# .diameterServerSessions`
+-entity `grep -v ^# .entity`
+-entityServerSessions `grep -v ^# .entityServerSessions`
diff --git a/example/diameter/launcher/resources/batch.sh b/example/diameter/launcher/resources/batch.sh
new file mode 100755 (executable)
index 0000000..051de1d
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+
+use () {
+
+   echo "Use: $0 <test file> [time between operations: 0 second by default]"
+   echo
+   echo "     Batch launcher script"
+   echo "     ---------------------"
+   echo
+   echo "     Test file must contain a operations with this syntax: <description>|<operation>|<arg1>|..."
+   echo "     Three operations: code, decode and sendxml:"
+   echo
+   echo "       code|<source>|<target>      i.e.: code|1.xml|2.hex"
+   echo "       decode|<source>|<target>    i.e.: decode|2.hex|1.xml-bis"
+   echo "       sendxml|<source>            i.e.: sendxml|1.xml"
+   echo
+   echo "     Test file example:"
+   echo
+   echo "     $0 1xml-23.txt"
+   echo
+   echo "     where 1xml-23.txt contains:"
+   echo "        Encode 1.xml to 2.hex|code|1.xml|2.hex"
+   echo "        Decode 2.hex to 3.xml (we will diff 1.xml and 3.xml)|decode|2.hex|3.xml"
+   echo
+   echo
+   echo "     Test file could contain any number of operations and could include comments (will be ignored)."
+   echo
+   exit
+}
+
+echo
+echo
+[[ "$1" = "" ]] && use
+LAPSE=${2:-0}
+echo
+echo "Test '$1' is going to be launched:"
+echo
+cat $1
+echo
+echo "Pulse ENTER para lanzar, CTRL+C para abortar..."
+read dummy
+
+while read -r line
+do
+   comment=$(echo $line | grep "^#")
+   ok=
+   [[ "$comment" = "" ]] && { [[ "$line" != "" ]] && ok=s ; }
+   if test "$ok" = "s"
+   then
+      echo "Launching $(echo $line | cut -d'|' -f1) ..."
+      sleep $LAPSE
+      operation=$(echo $line | cut -d'|' -f2-)
+      curl -m 1 --data "$operation" $TRACE ${SERVER}
+   fi
+
+done < $1
+
diff --git a/example/diameter/launcher/resources/burst.sh b/example/diameter/launcher/resources/burst.sh
new file mode 100755 (executable)
index 0000000..a3b5341
--- /dev/null
@@ -0,0 +1,184 @@
+#!/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
+
diff --git a/example/diameter/launcher/resources/clientSocketManager.sh b/example/diameter/launcher/resources/clientSocketManager.sh
new file mode 100755 (executable)
index 0000000..225464f
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+ENTITY=`cat .entity 2>/dev/null`
+# If missing following, 1 is assigned (ENTITY_SS_1 is ENTITY_SS - 1)
+ENTITY_SS=`cat .entityServerSessions 2>/dev/null`
+[[ "$ENTITY_SS" = "" ]] && ENTITY_SS=1
+TARGET=$2
+
+use () {
+   echo
+   echo
+   echo "Use: $0 <hide|show|hidden|shown> \"[<address>:<port>]|[socket id]\""
+   echo
+   echo "Hides/shows/query hidden state/query shown state, the socket/s provided."
+   echo "If missing server (first parameter) all applications sockets will be affected by action."
+   echo "If missing socket (second parameter) for specific server, all its sockets will be affected by action."
+   echo
+   exit
+}
+
+states () {
+   echo
+   echo "Select option to switch (0 = quit):"
+   echo
+   option=1 
+   for i in `echo $ENTITY | sed 's/,/ /g'`
+   do
+      for j in `seq 0 $ENTITY_SS_1`
+      do
+         TARGET="${i}|${j}"
+         RES=$(curl -m 1 --data "shown|$TARGET" ${SERVER} 2>&1 | tail -1 | grep "true$")
+         res=hidden
+         [[ "$RES" != "" ]] && res=shown
+         echo "${option}. $TARGET     ($res)"
+         action=show
+         [[ "$RES" != "" ]] && action=hide
+         echo "curl -m 1 --data \"$action|$TARGET\" ${SERVER}" > .switch_${option}
+         chmod a+x .switch_${option}
+         option=$((option+1))
+      done
+   done
+   echo
+}
+
+if test "$ENTITY" != ""
+then
+   ENTITY_SS_1=$((ENTITY_SS-1))
+   while true
+   do
+      states
+      read option
+      [[ "$option" = "0" ]] && break
+      .switch_${option} 
+   done
+   echo
+   echo "Exiting"
+   rm .switch_*
+   exit
+else
+   [[ "$1" = "" ]] && use
+fi
+
+echo
+echo
+operation="$1|$TARGET"
+[[ "$TARGET" = "" ]] && operation="$1"
+curl -m 1 --data "$operation" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/resources/code.sh b/example/diameter/launcher/resources/code.sh
new file mode 100755 (executable)
index 0000000..a202f3a
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+
+use () {
+
+   echo "Use: $0 <xml_file>"
+   echo
+   echo "Creates '<xml_file>.hex' with encoded result."
+   echo
+   exit
+}
+
+echo
+[[ "$1" = "" ]] && use
+[[ ! -f "$1" ]] && { echo "ERROR: file '$1' not found" ; echo; echo; exit ; }
+echo
+operation="code|$1|${1}.hex"
+curl -m 1 --data "$operation" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/resources/collect.sh b/example/diameter/launcher/resources/collect.sh
new file mode 100755 (executable)
index 0000000..9f556fa
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+curl -m 1 --data "collect" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/resources/data-initial.msk b/example/diameter/launcher/resources/data-initial.msk
new file mode 100644 (file)
index 0000000..fa6d324
--- /dev/null
@@ -0,0 +1,44 @@
+<message version="1" name="Credit-Control-Request" p-bit="yes" application-id="4" hop-by-hop-id="__HBH_ETE__" end-by-end-id="__HBH_ETE__">
+   <avp name="Session-Id" data="__SID_DI__;__SID_HIGH__;__SID_LOW__;__SID_SUFFIX__"/>
+   <avp name="Origin-Host" data="__SID_DI__"/>
+   <avp name="Origin-Realm" data="sandvine.com"/>
+   <avp name="Destination-Realm" data="telefonica.com.co"/>
+   <avp name="Auth-Application-Id" data="4"/>
+   <avp name="Service-Context-Id" data="770.32251@3gpp.org"/>
+   <avp name="CC-Request-Type" data="1" alias="INITIAL_REQUEST"/>
+   <avp name="CC-Request-Number" data="0"/>
+   <avp name="User-Name" data="__MSISDN__"/>
+   <avp name="Origin-State-Id" data="1339077627"/>
+   <avp name="Event-Timestamp" data="__NTPTIMESTAMP__"/>
+   <avp name="Subscription-Id">
+      <avp name="Subscription-Id-Type" data="0" alias="END_USER_E164"/>
+      <avp name="Subscription-Id-Data" data="__MSISDN__"/>
+   </avp>
+   <avp name="Multiple-Services-Indicator" data="1" alias="MULTIPLE_SERVICES_SUPPORTED"/>
+   <avp name="User-Equipment-Info">
+      <avp name="User-Equipment-Info-Type" data="0" alias="IMEISV"/>
+      <avp name="User-Equipment-Info-Value" hex-data="33353430343630343130363438333030"/>
+   </avp>
+   <avp name="Service-Information">
+      <avp name="PS-Information">
+         <avp name="3GPP-Charging-Id" data="29"/>
+         <avp name="3GPP-PDP-Type" data="0" alias="IPV4"/>
+         <avp name="PDP-Address" data="10.193.49.133"/>
+         <avp name="3GPP-GPRS-Neg-QoS-Profile" data="05-1b921f7196fefe74fbfefe00"/>
+         <avp name="SGSN-Address" data="190.98.183.240"/>
+         <avp name="GGSN-Address" data="190.98.183.243"/>
+         <avp name="CG-Address" data="10.193.249.1"/>
+         <avp name="3GPP-IMSI-MCC-MNC" data="71204"/>
+         <avp name="3GPP-GGSN-MCC-MNC" data="71204"/>
+         <avp name="3GPP-NSAPI" data="5"/>
+         <avp name="Called-Station-Id" data="internet.movistar.ni"/>
+         <avp name="3GPP-Selection-Mode" data="0"/>
+         <avp name="3GPP-Charging-Characteristics" data="0800"/>
+         <avp name="3GPP-SGSN-MCC-MNC" data="33403"/>
+         <avp name="3GPP-MS-TimeZone" hex-data="4a00"/>
+         <avp name="3GPP-User-Location-Info" hex-data="0117f240a4780218"/>
+         <avp name="3GPP-Rat-Type" hex-data="01"/>
+         <avp name="PDP-Context-Type" data="0"/>
+      </avp>
+   </avp>
+</message>
diff --git a/example/diameter/launcher/resources/data-termination.msk b/example/diameter/launcher/resources/data-termination.msk
new file mode 100644 (file)
index 0000000..f15396f
--- /dev/null
@@ -0,0 +1,55 @@
+<message version="1" name="Credit-Control-Request" p-bit="yes" application-id="4" hop-by-hop-id="__HBH_ETE__" end-by-end-id="__HBH_ETE__">
+   <avp name="Session-Id" data="__SID_DI__;__SID_HIGH__;__SID_LOW__;__SID_SUFFIX__"/>
+   <avp name="Origin-Host" data="__SID_DI__"/>
+   <avp name="Origin-Realm" data="sandvine.com"/>
+   <avp name="Destination-Realm" data="telefonica.com.co"/>
+   <avp name="Auth-Application-Id" data="4"/>
+   <avp name="Service-Context-Id" data="770.32251@3gpp.org"/>
+   <avp name="CC-Request-Type" data="3" alias="TERMINATION_REQUEST"/>
+   <avp name="CC-Request-Number" data="3"/>
+   <avp name="Destination-Host" data="mqmty1besdp1.movistar.pa"/>
+   <avp name="User-Name" data="__MSISDN__"/>
+   <avp name="Origin-State-Id" data="1339077627"/>
+   <avp name="Event-Timestamp" data="__NTPTIMESTAMP__"/>
+   <avp name="Subscription-Id">
+      <avp name="Subscription-Id-Type" data="0" alias="END_USER_E164"/>
+      <avp name="Subscription-Id-Data" data="__MSISDN__"/>
+   </avp>
+   <avp name="Termination-Cause" data="1" alias="DIAMETER_LOGOUT"/>
+   <avp name="Multiple-Services-Indicator" data="1" alias="MULTIPLE_SERVICES_SUPPORTED"/>
+   <avp name="Multiple-Services-Credit-Control">
+      <avp name="Used-Service-Unit">
+         <avp name="CC-Total-Octets" data="524288"/>
+         <avp name="CC-Input-Octets" data="424288"/>
+         <avp name="CC-Output-Octets" data="100000"/>
+         <avp name="Reporting-Reason" data="2" alias="FINAL"/>
+      </avp>
+      <avp name="Rating-Group" data="99"/>
+   </avp>
+   <avp name="User-Equipment-Info">
+      <avp name="User-Equipment-Info-Type" data="0" alias="IMEISV"/>
+      <avp name="User-Equipment-Info-Value" hex-data="33353430343630343130363438333030"/>
+   </avp>
+   <avp name="Service-Information">
+      <avp name="PS-Information">
+         <avp name="3GPP-Charging-Id" data="29"/>
+         <avp name="3GPP-PDP-Type" data="0" alias="IPV4"/>
+         <avp name="PDP-Address" data="10.193.49.133"/>
+         <avp name="3GPP-GPRS-Neg-QoS-Profile" data="05-1b921f7196fefe74fbfefe00"/>
+         <avp name="SGSN-Address" data="190.98.183.240"/>
+         <avp name="GGSN-Address" data="190.98.183.243"/>
+         <avp name="CG-Address" data="10.193.249.1"/>
+         <avp name="3GPP-IMSI-MCC-MNC" data="71204"/>
+         <avp name="3GPP-GGSN-MCC-MNC" data="71204"/>
+         <avp name="3GPP-NSAPI" data="5"/>
+         <avp name="Called-Station-Id" data="internet.movistar.ni"/>
+         <avp name="3GPP-Session-Stop-Indicator" hex-data="ff"/>
+         <avp name="3GPP-Selection-Mode" data="0"/>
+         <avp name="3GPP-Charging-Characteristics" data="0800"/>
+         <avp name="3GPP-SGSN-MCC-MNC" data="33403"/>
+         <avp name="3GPP-MS-TimeZone" hex-data="4a00"/>
+         <avp name="3GPP-User-Location-Info" hex-data="0117f240a4780218"/>
+         <avp name="3GPP-Rat-Type" hex-data="01"/>
+      </avp>
+   </avp>
+</message>
diff --git a/example/diameter/launcher/resources/data-update1.msk b/example/diameter/launcher/resources/data-update1.msk
new file mode 100644 (file)
index 0000000..8883c60
--- /dev/null
@@ -0,0 +1,47 @@
+<message version="1" name="Credit-Control-Request" p-bit="yes" application-id="4" hop-by-hop-id="__HBH_ETE__" end-by-end-id="__HBH_ETE__">
+   <avp name="Session-Id" data="__SID_DI__;__SID_HIGH__;__SID_LOW__;__SID_SUFFIX__"/>
+   <avp name="Origin-Host" data="__SID_DI__"/>
+   <avp name="Origin-Realm" data="sandvine.com"/>
+   <avp name="Destination-Realm" data="telefonica.com.co"/>
+   <avp name="Auth-Application-Id" data="4"/>
+   <avp name="Service-Context-Id" data="770.32251@3gpp.org"/>
+   <avp name="CC-Request-Type" data="2" alias="UPDATE_REQUEST"/>
+   <avp name="CC-Request-Number" data="1"/>
+   <avp name="Destination-Host" data="mqmty1besdp1.movistar.pa"/>
+   <avp name="Origin-State-Id" data="1339077627"/>
+   <avp name="Event-Timestamp" data="__NTPTIMESTAMP__"/>
+   <avp name="Subscription-Id">
+      <avp name="Subscription-Id-Type" data="0" alias="END_USER_E164"/>
+      <avp name="Subscription-Id-Data" data="__MSISDN__"/>
+   </avp>
+   <avp name="Multiple-Services-Indicator" data="1" alias="MULTIPLE_SERVICES_SUPPORTED"/>
+   <avp name="Multiple-Services-Credit-Control">
+      <avp name="Requested-Service-Unit"/>
+      <avp name="Rating-Group" data="99"/>
+   </avp>
+   <avp name="User-Equipment-Info">
+      <avp name="User-Equipment-Info-Type" data="0" alias="IMEISV"/>
+      <avp name="User-Equipment-Info-Value" hex-data="33353430343630343130363438333030"/>
+   </avp>
+   <avp name="Service-Information">
+      <avp name="PS-Information">
+         <avp name="3GPP-Charging-Id" data="29"/>
+         <avp name="3GPP-PDP-Type" data="0" alias="IPV4"/>
+         <avp name="PDP-Address" data="10.193.49.133"/>
+         <avp name="3GPP-GPRS-Neg-QoS-Profile" data="05-1b921f7196fefe74fbfefe00"/>
+         <avp name="SGSN-Address" data="190.98.183.240"/>
+         <avp name="GGSN-Address" data="190.98.183.243"/>
+         <avp name="CG-Address" data="10.193.249.1"/>
+         <avp name="3GPP-IMSI-MCC-MNC" data="71204"/>
+         <avp name="3GPP-GGSN-MCC-MNC" data="71204"/>
+         <avp name="3GPP-NSAPI" data="5"/>
+         <avp name="Called-Station-Id" data="internet.movistar.ni"/>
+         <avp name="3GPP-Selection-Mode" data="0"/>
+         <avp name="3GPP-Charging-Characteristics" data="0800"/>
+         <avp name="3GPP-SGSN-MCC-MNC" data="33403"/>
+         <avp name="3GPP-MS-TimeZone" hex-data="4a00"/>
+         <avp name="3GPP-User-Location-Info" hex-data="0117f240a4780218"/>
+         <avp name="3GPP-Rat-Type" hex-data="01"/>
+      </avp>
+   </avp>
+</message>
diff --git a/example/diameter/launcher/resources/data-update2.msk b/example/diameter/launcher/resources/data-update2.msk
new file mode 100644 (file)
index 0000000..8784172
--- /dev/null
@@ -0,0 +1,53 @@
+<message version="1" name="Credit-Control-Request" p-bit="yes" application-id="4" hop-by-hop-id="__HBH_ETE__" end-by-end-id="__HBH_ETE__">
+   <avp name="Session-Id" data="__SID_DI__;__SID_HIGH__;__SID_LOW__;__SID_SUFFIX__"/>
+   <avp name="Origin-Host" data="__SID_DI__"/>
+   <avp name="Origin-Realm" data="sandvine.com"/>
+   <avp name="Destination-Realm" data="telefonica.com.co"/>
+   <avp name="Auth-Application-Id" data="4"/>
+   <avp name="Service-Context-Id" data="770.32251@3gpp.org"/>
+   <avp name="CC-Request-Type" data="2" alias="UPDATE_REQUEST"/>
+   <avp name="CC-Request-Number" data="2"/>
+   <avp name="Destination-Host" data="mqmty1besdp1.movistar.pa"/>
+   <avp name="User-Name" data="__MSISDN__"/>
+   <avp name="Origin-State-Id" data="1339077627"/>
+   <avp name="Event-Timestamp" data="__NTPTIMESTAMP__"/>
+   <avp name="Subscription-Id">
+      <avp name="Subscription-Id-Type" data="0" alias="END_USER_E164"/>
+      <avp name="Subscription-Id-Data" data="__MSISDN__"/>
+   </avp>
+   <avp name="Multiple-Services-Indicator" data="1" alias="MULTIPLE_SERVICES_SUPPORTED"/>
+   <avp name="Multiple-Services-Credit-Control">
+      <avp name="Requested-Service-Unit"/>
+      <avp name="Used-Service-Unit">
+         <avp name="CC-Total-Octets" data="524288"/>
+         <avp name="CC-Input-Octets" data="224288"/>
+         <avp name="CC-Output-Octets" data="300000"/>
+      </avp>
+      <avp name="Rating-Group" data="99"/>
+   </avp>
+   <avp name="User-Equipment-Info">
+      <avp name="User-Equipment-Info-Type" data="0" alias="IMEISV"/>
+      <avp name="User-Equipment-Info-Value" hex-data="33353430343630343130363438333030"/>
+   </avp>
+   <avp name="Service-Information">
+      <avp name="PS-Information">
+         <avp name="3GPP-Charging-Id" data="29"/>
+         <avp name="3GPP-PDP-Type" data="0" alias="IPV4"/>
+         <avp name="PDP-Address" data="10.193.49.133"/>
+         <avp name="3GPP-GPRS-Neg-QoS-Profile" data="05-1b921f7196fefe74fbfefe00"/>
+         <avp name="SGSN-Address" data="190.98.183.240"/>
+         <avp name="GGSN-Address" data="190.98.183.243"/>
+         <avp name="CG-Address" data="10.193.249.1"/>
+         <avp name="3GPP-IMSI-MCC-MNC" data="71204"/>
+         <avp name="3GPP-GGSN-MCC-MNC" data="71204"/>
+         <avp name="3GPP-NSAPI" data="5"/>
+         <avp name="Called-Station-Id" data="internet.movistar.ni"/>
+         <avp name="3GPP-Selection-Mode" data="0"/>
+         <avp name="3GPP-Charging-Characteristics" data="0800"/>
+         <avp name="3GPP-SGSN-MCC-MNC" data="33403"/>
+         <avp name="3GPP-MS-TimeZone" hex-data="4a00"/>
+         <avp name="3GPP-User-Location-Info" hex-data="0117f240a4780218"/>
+         <avp name="3GPP-Rat-Type" hex-data="01"/>
+      </avp>
+   </avp>
+</message>
diff --git a/example/diameter/launcher/resources/data.sh b/example/diameter/launcher/resources/data.sh
new file mode 100755 (executable)
index 0000000..f253b76
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/ksh
+
+# Generates DATA burst sequence for provided order number (1: first, 2: second, etc.)
+# We will generate a simple scenario with initial, two updates and termination, that is to say: four messages:
+#  1,2,3,4  5,6,7,8  9,10,11,12   etc.
+#
+# Category = ((Number-1) % 4) + 1 = 1 for initial, 2 for first update, 3 for second update and 4 for termination
+SEQN=$1
+OFFSET=$((SEQN-1))
+CAT=$((OFFSET%4 + 1))
+
+salir () {
+   echo
+   echo $1
+   echo
+   exit
+}
+
+check_template () {
+   [[ ! -f $1 ]] && salir "Template file ($1) not found!"
+}
+
+parse () {
+   cat $1 | sed 's/__HBH_ETE__/'$HBH_ETE'/g' | sed 's/__SID_SUFFIX__/'$SID_SUFFIX'/' \
+            | sed 's/__MSISDN__/'$MSISDN'/' | sed 's/__NTPTIMESTAMP__/'$NTP'/' \
+            | sed 's/__SID_DI__/'$SID_DI'/' | sed 's/__SID_HIGH__/'$SID_HIGH'/' | sed 's/__SID_LOW__/'$SI_LOW'/'
+}
+
+
+[[ "$SEQN" = "" ]] && salir "Use: $0 <sequence number: 1..N>"
+check_template data-initial.msk
+check_template data-update1.msk
+check_template data-update2.msk
+check_template data-termination.msk
+
+# Session-Id: '<DiameterIdentity>;<high 32 bits>;<low 32 bits>[;<optional value>="">]'
+#   <avp name="Session-Id" data="module-2.PTS2-BOG.sandvine.com;1287115741;0;49"/>
+# We will sequence the otional value with __SID_SUFFIX__, low and high will be constant.
+
+# Sequence values at templates:
+# __HBH_ETE__:    1, 3, 5, etc. (hop-by-hop and end-to-end)
+# __SID_SUFFIX__: It could be MSISDN, but we put OFFSET (0, 1, 2, 3, etc.). It's the Session-Id optional part.
+# __MSISDN__:     50583211675, 50583211676, 50583211677, etc. Used for User-Name and Subscription-Id-Data 
+# __NTPTIMESTAMP__: Four values for initial, update1, update2 and termination: 3548171033, 3548171136 (103+), 3548171136(idem), 3548171524(388+)
+#                   This initial time (aproximately 8 Jun 2012 at 19:00).
+CUARTO=$((OFFSET/4))
+HBH_ETE=$((1 + 2*OFFSET))
+SID_SUFFIX=$CUARTO
+# Example if you want to fix to two sockets (-sessionIdPartForClientSocketIdSelection must be 'optional'): SID_SUFFIX=$((CUARTO%2))
+MSISDN=$((50583211675+CUARTO))
+NTP=$((3548171033+CUARTO))
+
+# Helpers to guide derivery (fixed at the moment)
+# __SID_DI__:     Session-Id diameter identity
+# __SID_HIGH__:   Session-Id high part
+# __SID_LOW__:    Session-Id low part
+SID_DI=module-2.PTS2-BOG.sandvine.com
+SID_HIGH=1287115741
+SI_LOW=0
+
+case $CAT in
+   1) parse data-initial.msk
+   ;;
+   2) NTP=$((NTP+103))
+      parse data-update1.msk
+   ;;
+   3) NTP=$((NTP+103))
+      parse data-update2.msk
+   ;;
+   4) NTP=$((NTP+491))
+      parse data-termination.msk
+   ;;
+esac
+
diff --git a/example/diameter/launcher/resources/decode.sh b/example/diameter/launcher/resources/decode.sh
new file mode 100755 (executable)
index 0000000..da9681c
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+
+use () {
+
+   echo "Use: $0 <hex_file>"
+   echo
+   echo "Creates '<hex_file>.xml' with decoded result."
+   echo
+   exit
+}
+
+echo
+[[ "$1" = "" ]] && use
+[[ ! -f "$1" ]] && { echo "ERROR: file '$1' not found" ; echo; echo; exit ; }
+echo
+operation="decode|$1|${1}.xml"
+curl -m 1 --data "$operation" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/resources/diameterServerSessions.sh b/example/diameter/launcher/resources/diameterServerSessions.sh
new file mode 100755 (executable)
index 0000000..340b14b
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+
+use () {
+
+   echo "Use: $0 <integer>"
+   echo
+   echo "Updates the maximum number of accepted connections over diameter server socket."
+   echo
+   exit
+}
+
+echo
+[[ "$1" = "" ]] && use
+echo
+operation="diameterServerSessions|$1"
+curl -m 1 --data "$operation" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/resources/help.sh b/example/diameter/launcher/resources/help.sh
new file mode 100755 (executable)
index 0000000..42519ec
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+curl -m 1 --data "help" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/resources/loadXml.sh b/example/diameter/launcher/resources/loadXml.sh
new file mode 100755 (executable)
index 0000000..c589249
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+
+use () {
+
+   echo "Use: $0 <xml_file>"
+   echo
+   echo "Load xml file and show on stdout again."
+   echo "It is useful to test xml loader and xml viewer, but also for show aliases and,"
+   echo "if '-ignoreFlags' commandline option is missing, for flag coherence checking."
+   echo
+   exit
+}
+
+echo
+[[ "$1" = "" ]] && use
+[[ ! -f "$1" ]] && { echo "ERROR: file '$1' not found" ; echo; echo; exit ; }
+echo
+operation="loadxml|$1"
+curl -m 1 --data "$operation" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/resources/pre-start.sh b/example/diameter/launcher/resources/pre-start.sh
new file mode 100755 (executable)
index 0000000..48f9ce3
--- /dev/null
@@ -0,0 +1,77 @@
+#!/bin/ksh
+
+# Remove logs:
+rm *.log* *.csv 2>/dev/null
+
+# Server sockets:
+httpServer_dflt=`cat .httpServer 2>/dev/null`
+diameterServer_dflt=`cat .diameterServer 2>/dev/null`
+diameterServerSessions_dflt=`cat .diameterServerSessions 2>/dev/null`
+
+# Client sockets:
+entity_dflt=`cat .entity 2>/dev/null`
+entityServerSessions_dflt=`cat .entityServerSessions 2>/dev/null`
+
+# Stack:
+dictionary_dflt=`cat .dictionary 2>/dev/null`
+
+echo
+echo
+# Fast start
+quick () {
+   echo "Do you wish to answer wizard commandline configuration ? (y/n) [n]:"
+   read wizard
+   [[ "$wizard" = "" ]] && wizard=n
+   [[ "$wizard" = "n" ]] && exit
+}
+
+[ "$httpServer_dflt" != ""  -a "$diameterServer_dflt" != "" -a "$diameterServerSessions_dflt" != "" -a \
+  "$entity_dflt" != ""  -a "$entityServerSessions_dflt" != "" -a \
+  "$dictionary_dflt" != "" ] && quick
+
+# Wizard
+[[ "$httpServer_dflt" = "" ]] && httpServer_dflt="localhost:9000"
+echo "HTTP Management interface address (using i.e. curl tool) as <ip|hostname>:<port> socket literal [$httpServer_dflt]:"
+read httpServer
+[[ "$httpServer" = "" ]] && httpServer=$httpServer_dflt
+
+echo "Diameter dictionary: you could use NexusPL 'stackManagement' tool in order to build an autonomous dictionary"
+echo " for any kind of application. See '<NEXUSPL>/test.ss/diameter.ss/stackManagement.p/self_ruling_setups.sh'."
+echo
+[[ "$dictionary_dflt" = "" ]] && dictionary_dflt=dictionary.xml
+echo "Diameter stack pathfiles [$dictionary_dflt]:"
+read dictionary
+[[ "$dictionary" = "" ]] && dictionary=$dictionary_dflt
+
+[[ "$diameterServer_dflt" = "" ]] && diameterServer_dflt="ocs2dfed1:3868"
+echo "Diameter own server address as <ip|hostname>:<port> socket literal [$diameterServer_dflt]:"
+read diameterServer
+[[ "$diameterServer" = "" ]] && diameterServer=$diameterServer_dflt
+
+[[ "$diameterServerSessions_dflt" = "" ]] && diameterServerSessions_dflt=0
+echo "Diameter own server available connections (0: diameter server disabled) [$diameterServerSessions_dflt]:"
+read diameterServerSessions
+[[ "$diameterServerSessions" = "" ]] && diameterServerSessions=$diameterServerSessions_dflt
+
+
+[[ "$entity_dflt" = "" ]] && entity_dflt="ocs2dfed1:4000,ocs2dfed1:4001"
+echo "Target diameter entity (pipe-separated <ip|hostname>:<port> socket literal list) ["$entity_dflt"]:"
+read entity
+[[ "$entity" = "" ]] && entity="$entity_dflt"
+
+[[ "$entityServerSessions_dflt" = "" ]] && entityServerSessions_dflt=1
+echo "Diameter entity server sessions (0: diameter entity disabled) [$entityServerSessions_dflt]:"
+read entityServerSessions
+[[ "$entityServerSessions" = "" ]] && entityServerSessions=$entityServerSessions_dflt
+
+
+echo $httpServer > .httpServer
+echo $dictionary > .dictionary
+echo $diameterServer > .diameterServer
+echo $diameterServerSessions > .diameterServerSessions
+echo $entity > .entity
+echo $entityServerSessions > .entityServerSessions
+
+echo
+echo
+
diff --git a/example/diameter/launcher/resources/sendXml.sh b/example/diameter/launcher/resources/sendXml.sh
new file mode 100755 (executable)
index 0000000..d9d58e2
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+
+use () {
+
+   echo "Use: $0 <xml_file> [2c]"
+   echo
+   echo "Sends 'xml_file' to the diameter server or to the client when '2c' parameter is provided."
+   echo
+   exit
+}
+
+echo
+[[ "$1" = "" ]] && use
+[[ ! -f "$1" ]] && { echo "ERROR: file '$1' not found" ; echo; echo; exit ; }
+echo
+operation="sendxml|$1"
+[[ "$2" = "2c" ]] && operation="sendxml2c|$1"
+
+curl -m 1 --data "$operation" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/resources/sms.msk b/example/diameter/launcher/resources/sms.msk
new file mode 100644 (file)
index 0000000..7bec3c8
--- /dev/null
@@ -0,0 +1,90 @@
+<message version="1" name="Credit-Control-Request" p-bit="yes" application-id="4" hop-by-hop-id="__HBH_ETE__" end-by-end-id="__HBH_ETE__">
+   <avp name="Session-Id" data="gbg.acision.com;421411;__SID_LOW__"/>
+   <avp name="Origin-Host" data="gbg.acision.com"/>
+   <avp name="Origin-Realm" data="SMSC.orig.OCS2.o2online.de"/>
+   <avp name="Destination-Realm" data="SMSC.dest.OCS1.o2online.de"/>
+   <avp name="Auth-Application-Id" data="4"/>
+   <avp name="Service-Context-Id" data="8.6.0.07.262.8.32274@3gpp.org"/>
+   <avp name="CC-Request-Type" data="4" alias="EVENT_REQUEST"/>
+   <avp name="CC-Request-Number" data="1"/>
+   <avp name="Destination-Host" data="OCS1"/>
+   <avp name="Event-Timestamp" data="1"/>
+   <avp name="Subscription-Id">
+      <avp name="Subscription-Id-Type" data="0" alias="END_USER_E164"/>
+      <avp name="Subscription-Id-Data" data="__MSISDN__"/>
+   </avp>
+   <avp name="Requested-Action" data="0" alias="DIRECT_DEBITING"/>
+   <avp name="Multiple-Services-Indicator" data="0" alias="MULTIPLE_SERVICES_NOT_SUPPORTED"/>
+   <avp name="Multiple-Services-Credit-Control">
+      <avp name="Requested-Service-Unit">
+         <avp name="CC-Service-Specific-Units" data="1"/>
+      </avp>
+      <avp name="Service-Identifier" data="1"/>
+   </avp>
+   <avp name="Service-Information">
+      <avp name="MMS-Information">
+         <avp name="Originator-Address">
+            <avp name="Address-Type" data="1" alias="MSISDN"/>
+            <avp name="Address-Data" data="__MSISDN__"/>
+            <avp name="Address-Domain">
+               <avp name="3GPP-IMSI-MCC-MNC" data="26207"/>
+            </avp>
+         </avp>
+         <avp name="Originator-Address">
+            <avp name="Address-Type" data="6" alias="Other"/>
+            <avp name="Address-Data" data="__IMSI__"/>
+         </avp>
+         <avp name="Submission-Time" data="3486294858"/>
+         <avp name="Message-Size" data="4"/>
+      </avp>
+      <avp name="SMS-Information">
+         <avp name="SMS-Node" data="3" alias="SMS-SC"/>
+         <avp name="Client-Address" data="8|541760000405"/>
+         <avp name="Originator-SCCP-Address" data="8|541760000005"/>
+         <avp name="Originator-Received-Address">
+            <avp name="Address-Type" data="1" alias="MSISDN"/>
+            <avp name="Address-Data" data="__MSISDN__"/>
+            <avp name="Address-Domain">
+               <avp name="3GPP-IMSI-MCC-MNC" data="26207"/>
+            </avp>
+         </avp>
+         <avp name="Recipient-Info">
+            <avp name="Destination-Interface">
+               <avp name="Interface-Id" data="5417607020601"/>
+               <avp name="Interface-Type" data="2" alias="MOBILE_TERMINATING"/>
+            </avp>
+            <avp name="Recipient-Address">
+               <avp name="Address-Type" data="1" alias="MSISDN"/>
+               <avp name="Address-Data" data="5417607020601"/>
+               <avp name="Address-Domain">
+                  <avp name="3GPP-IMSI-MCC-MNC" data="26207"/>
+               </avp>
+            </avp>
+            <avp name="Recipient-Address">
+               <avp name="Address-Type" data="6" alias="Other"/>
+               <avp name="Address-Data" data="262074900005771"/>
+            </avp>
+            <avp name="Recipient-Received-Address">
+               <avp name="Address-Type" data="1" alias="MSISDN"/>
+               <avp name="Address-Data" data="5417607020601"/>
+               <avp name="Address-Domain">
+                  <avp name="3GPP-IMSI-MCC-MNC" data="26207"/>
+               </avp>
+            </avp>
+            <avp name="Recipient-SCCP-Address" data="8|541760000005"/>
+         </avp>
+         <avp name="SMSC-Address" data="8|541760000405"/>
+         <avp name="Data-Coding-Scheme" data="0"/>
+         <avp name="SM-Message-Type" data="0" alias="SUBMISSION"/>
+         <avp name="Originator-Interface">
+            <avp name="Interface-Id" data="262074900005771"/>
+            <avp name="Interface-Type" data="1" alias="MOBILE_ORIGINATING"/>
+         </avp>
+         <avp name="Number-Of-Messages-Sent" data="1"/>
+      </avp>
+   </avp>
+<!--
+   El Correlation Id no se usa en el Sertamsjt
+   <avp name="CC-Correlation-Id" data="gbg.acision.com;421411;__SID_LOW__"/>
+-->
+</message>
diff --git a/example/diameter/launcher/resources/sms.sh b/example/diameter/launcher/resources/sms.sh
new file mode 100755 (executable)
index 0000000..c77b398
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/ksh
+
+# Generates SMS burst sequence for provided order number (1: first, 2: second, etc.)
+SEQN=$1
+
+salir () {
+   echo
+   echo $1
+   echo
+   exit
+}
+
+[[ "$SEQN" = "" ]] && salir "Use: $0 <sequence number: 1..N>"
+[[ ! -f sms.msk ]] && salir "Template file (sms.msk) not found!"
+
+# Sequence values at template sms.msk:
+# __HBH_ETE__: 1, 3, 5, etc. (hop-by-hop and end-to-end)
+# __SID_LOW__: 1000, 1001, 1002, etc. (Session-Id sequence append)
+# __MSISDN__:  5555100000, 5555100001, 5555100002, etc. (First and Third Address-Data)
+# __IMSI__:    262075555100000, 262075555100001, 262075555100002, etc. (Second Address-Data)
+
+OFFSET=$((SEQN-1))
+
+HBH_ETE=$((1 + 2*OFFSET))
+SID_LOW=$((1000+OFFSET))
+MSISDN=$((5555100000+OFFSET))
+IMSI=$((262075555100000+OFFSET))
+
+cat sms.msk | sed 's/__HBH_ETE__/'$HBH_ETE'/g' | sed 's/__SID_LOW__/'$SID_LOW'/' \
+            | sed 's/__MSISDN__/'$MSISDN'/' | sed 's/__IMSI__/'$IMSI'/'
diff --git a/example/diameter/launcher/scripts/1.xml b/example/diameter/launcher/scripts/1.xml
new file mode 100644 (file)
index 0000000..dcd18b9
--- /dev/null
@@ -0,0 +1,7 @@
+<message version="1" code="265" flags="0" application-id="0" hop-by-hop-id="1" end-by-end-id="2">
+   <avp name="Session-Id" data="ocs3;1332909618;0;1332909618"/>
+   <avp name="Auth-Application-Id" data="16777236"/>
+   <avp name="Origin-Host" data="OCS3"/>
+   <avp name="Origin-Realm" data="OCS3"/>
+</message>
+
diff --git a/example/diameter/launcher/scripts/1xml-23.txt b/example/diameter/launcher/scripts/1xml-23.txt
new file mode 100644 (file)
index 0000000..c0d8b4c
--- /dev/null
@@ -0,0 +1,2 @@
+Encode 1.xml to 2.hex|code|1.xml|2.hex
+Decode 2.hex to 3.xml (we will diff 1.xml and 3.xml)|decode|2.hex|3.xml
diff --git a/example/diameter/launcher/scripts/DEPLOY.sh b/example/diameter/launcher/scripts/DEPLOY.sh
new file mode 100755 (executable)
index 0000000..484ba7b
--- /dev/null
@@ -0,0 +1,111 @@
+#!/bin/ksh
+
+# Functions & variables
+
+_exit () {
+   echo
+   echo $1
+   echo
+   exit
+}
+
+createRunScript () {
+
+echo "#!/bin/ksh" > run.sh
+echo "EXE=\`cat .exe 2>/dev/null\`" >> run.sh
+echo "STARTED=\`ps -fea | grep \"\$EXE\" | grep -v grep\`" >> run.sh
+echo "[ \"\$EXE\" != \"\" -a \"\$STARTED\" != \"\" ] && { echo \"Already started!\"; echo \"\$STARTED\" ; exit ; }" >> run.sh
+echo "pre-start.sh" >> run.sh
+echo "> launcher.traces" >> run.sh
+echo "EXE=\"ndl_\`date '+%Y%m%d%H%M%S'\`\"" >> run.sh
+echo "echo \$EXE > .exe"  >> run.sh
+#echo "rm \$EXE 2>/dev/null" >> run.sh
+echo "echo ; echo \"Executable paths:\" ; echo" >> run.sh
+echo "for i in \`ls execs/.*/*\` ; do echo \$i ; done" >> run.sh
+echo "echo ; echo \"Input the executable path:\" ; read path ; while test \"\$path\" = \"\" ; do read path ; done" >> run.sh
+echo "ln -s \$path \$EXE" >> run.sh
+echo >> run.sh
+echo -n "\$EXE " >> run.sh
+for i in `cat args.txt | grep -v "^#"`
+do
+   echo -n "$i " >> run.sh
+done
+echo "&" >> run.sh
+chmod a+x run.sh
+rm args.txt
+}
+
+createDictionaryPaths () {
+
+BASE_PROT=commands_baseProtocol.xml
+
+for i in stacks/*commands*xml
+do
+   stacks/dependence.sh $i >/dev/null
+   stack=`basename $i`
+   if test "$stack" != "$BASE_PROT"
+   then
+      > .dictionary__${stack}
+      for j in `cat ${i}.dep`
+      do
+         echo "${j},\c" >> .dictionary__${stack}
+      done
+      echo "stacks/$BASE_PROT,stacks/${stack}" >> .dictionary__${stack}
+   fi
+done
+
+# Default:
+ln -s .dictionary__commands_qosControl.xml .dictionary
+}
+
+#############
+# EXECUTION #
+#############
+echo
+echo "------------------"
+echo "ADL Patch Creation"
+echo "------------------"
+echo
+# Check BASEPJ:
+[[ "$BASEPJ" = "" ]] && _exit "Run 'configure' before continue (BASEPJ must be defined)"
+
+echo "BASEPJ=$BASEPJ"
+echo "Correct ? (y/n) [y]"
+read correct
+[[ "$correct" = "" ]] && correct=y
+[[ "$correct" != "y" ]] && _exit "Load the correct 'configure'"
+
+# Copy staff:
+rm -rf tmp
+mkdir -p tmp
+echo "Packaging ..."
+cp /opt/bin/anna/example_diameter_launcher tmp/exec/launcher 
+cp ../../*sh tmp
+rm tmp/batch.sh
+cp ../../*msk tmp
+cp ../../args.txt tmp
+mkdir tmp/stacks
+SETUPS_DIR=../../../../../source/diameter/stack/setups/
+cp $SETUPS_DIR/*xml tmp/stacks
+cp $SETUPS_DIR/*sh tmp/stacks
+cp ../../../../../source/diameter/codec/message.dtd tmp
+# Prepare:
+cd tmp
+createRunScript
+createDictionaryPaths
+cd ..
+
+# Help:
+echo "Stacks available at '.dictionary__<stack description>', create a symbolic link from '.dictionary'." >> tmp/README
+echo "Template for xml messages: message.dtd (informative, not actually required by process)" >> tmp/README
+echo "Start with 'run.sh'" >> tmp/README
+
+mv tmp ADL-installer
+tar cvfz ADL-installer.tar.gz ADL-installer
+rm -rf ADL-installer
+
+echo
+echo "Created ADL-installer.tar.gz !"
+echo
+
+
diff --git a/example/diameter/launcher/scripts/README b/example/diameter/launcher/scripts/README
new file mode 100644 (file)
index 0000000..c87d1d4
--- /dev/null
@@ -0,0 +1,7 @@
+Use 'DEPLOY.sh', to bundle and install this launcher process.
+The installation will include full configuration and resources.
+
+Start the launcher process and perform some basic taks, i.e.,
+once deployed and started, you could execute 'help.sh' to get
+a complete help information from the process http interface.
diff --git a/example/diameter/launcher/scripts/answerXml.sh b/example/diameter/launcher/scripts/answerXml.sh
new file mode 100755 (executable)
index 0000000..451882c
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+
+echo
+echo
+echo "Use: $0 [xml_file] [2e]"
+echo
+echo "Programm 'xml_file' answer to the diameter client or to the server (entity) when"
+echo "'2e' parameter is provided. If missing xml file, current programmed answers will"
+echo "be shown: '$0' (answers to client), '$0 2e' (answers to server)."
+echo
+if test "$1" != ""
+then
+   if test "$1" = "2e"
+   then
+     operation="answerxml2e"
+   else 
+     [[ ! -f "$1" ]] && { echo "ERROR: file '$1' not found" ; echo; echo; exit ; }
+     operation="answerxml|$1"
+     [[ "$2" = "2e" ]] && operation="answerxml2e|$1"
+   fi
+else
+   operation="answerxml"
+fi
+echo
+curl -m 1 --data "$operation" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/scripts/args.txt b/example/diameter/launcher/scripts/args.txt
new file mode 100755 (executable)
index 0000000..d5f4afb
--- /dev/null
@@ -0,0 +1,6 @@
+-httpServer `grep -v ^# .httpServer`
+-dictionary `grep -v ^# .dictionary`
+-diameterServer `grep -v ^# .diameterServer`
+-diameterServerSessions `grep -v ^# .diameterServerSessions`
+-entity `grep -v ^# .entity`
+-entityServerSessions `grep -v ^# .entityServerSessions`
diff --git a/example/diameter/launcher/scripts/batch.sh b/example/diameter/launcher/scripts/batch.sh
new file mode 100755 (executable)
index 0000000..051de1d
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+
+use () {
+
+   echo "Use: $0 <test file> [time between operations: 0 second by default]"
+   echo
+   echo "     Batch launcher script"
+   echo "     ---------------------"
+   echo
+   echo "     Test file must contain a operations with this syntax: <description>|<operation>|<arg1>|..."
+   echo "     Three operations: code, decode and sendxml:"
+   echo
+   echo "       code|<source>|<target>      i.e.: code|1.xml|2.hex"
+   echo "       decode|<source>|<target>    i.e.: decode|2.hex|1.xml-bis"
+   echo "       sendxml|<source>            i.e.: sendxml|1.xml"
+   echo
+   echo "     Test file example:"
+   echo
+   echo "     $0 1xml-23.txt"
+   echo
+   echo "     where 1xml-23.txt contains:"
+   echo "        Encode 1.xml to 2.hex|code|1.xml|2.hex"
+   echo "        Decode 2.hex to 3.xml (we will diff 1.xml and 3.xml)|decode|2.hex|3.xml"
+   echo
+   echo
+   echo "     Test file could contain any number of operations and could include comments (will be ignored)."
+   echo
+   exit
+}
+
+echo
+echo
+[[ "$1" = "" ]] && use
+LAPSE=${2:-0}
+echo
+echo "Test '$1' is going to be launched:"
+echo
+cat $1
+echo
+echo "Pulse ENTER para lanzar, CTRL+C para abortar..."
+read dummy
+
+while read -r line
+do
+   comment=$(echo $line | grep "^#")
+   ok=
+   [[ "$comment" = "" ]] && { [[ "$line" != "" ]] && ok=s ; }
+   if test "$ok" = "s"
+   then
+      echo "Launching $(echo $line | cut -d'|' -f1) ..."
+      sleep $LAPSE
+      operation=$(echo $line | cut -d'|' -f2-)
+      curl -m 1 --data "$operation" $TRACE ${SERVER}
+   fi
+
+done < $1
+
diff --git a/example/diameter/launcher/scripts/burst.sh b/example/diameter/launcher/scripts/burst.sh
new file mode 100755 (executable)
index 0000000..a3b5341
--- /dev/null
@@ -0,0 +1,184 @@
+#!/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
+
diff --git a/example/diameter/launcher/scripts/clientSocketManager.sh b/example/diameter/launcher/scripts/clientSocketManager.sh
new file mode 100755 (executable)
index 0000000..225464f
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+ENTITY=`cat .entity 2>/dev/null`
+# If missing following, 1 is assigned (ENTITY_SS_1 is ENTITY_SS - 1)
+ENTITY_SS=`cat .entityServerSessions 2>/dev/null`
+[[ "$ENTITY_SS" = "" ]] && ENTITY_SS=1
+TARGET=$2
+
+use () {
+   echo
+   echo
+   echo "Use: $0 <hide|show|hidden|shown> \"[<address>:<port>]|[socket id]\""
+   echo
+   echo "Hides/shows/query hidden state/query shown state, the socket/s provided."
+   echo "If missing server (first parameter) all applications sockets will be affected by action."
+   echo "If missing socket (second parameter) for specific server, all its sockets will be affected by action."
+   echo
+   exit
+}
+
+states () {
+   echo
+   echo "Select option to switch (0 = quit):"
+   echo
+   option=1 
+   for i in `echo $ENTITY | sed 's/,/ /g'`
+   do
+      for j in `seq 0 $ENTITY_SS_1`
+      do
+         TARGET="${i}|${j}"
+         RES=$(curl -m 1 --data "shown|$TARGET" ${SERVER} 2>&1 | tail -1 | grep "true$")
+         res=hidden
+         [[ "$RES" != "" ]] && res=shown
+         echo "${option}. $TARGET     ($res)"
+         action=show
+         [[ "$RES" != "" ]] && action=hide
+         echo "curl -m 1 --data \"$action|$TARGET\" ${SERVER}" > .switch_${option}
+         chmod a+x .switch_${option}
+         option=$((option+1))
+      done
+   done
+   echo
+}
+
+if test "$ENTITY" != ""
+then
+   ENTITY_SS_1=$((ENTITY_SS-1))
+   while true
+   do
+      states
+      read option
+      [[ "$option" = "0" ]] && break
+      .switch_${option} 
+   done
+   echo
+   echo "Exiting"
+   rm .switch_*
+   exit
+else
+   [[ "$1" = "" ]] && use
+fi
+
+echo
+echo
+operation="$1|$TARGET"
+[[ "$TARGET" = "" ]] && operation="$1"
+curl -m 1 --data "$operation" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/scripts/code.sh b/example/diameter/launcher/scripts/code.sh
new file mode 100755 (executable)
index 0000000..a202f3a
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+
+use () {
+
+   echo "Use: $0 <xml_file>"
+   echo
+   echo "Creates '<xml_file>.hex' with encoded result."
+   echo
+   exit
+}
+
+echo
+[[ "$1" = "" ]] && use
+[[ ! -f "$1" ]] && { echo "ERROR: file '$1' not found" ; echo; echo; exit ; }
+echo
+operation="code|$1|${1}.hex"
+curl -m 1 --data "$operation" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/scripts/collect.sh b/example/diameter/launcher/scripts/collect.sh
new file mode 100755 (executable)
index 0000000..9f556fa
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+curl -m 1 --data "collect" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/scripts/createBatch.sh b/example/diameter/launcher/scripts/createBatch.sh
new file mode 100755 (executable)
index 0000000..5599d52
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/ksh
+
+salir () {
+   echo
+   echo $1
+   echo
+   exit
+}
+
+uso () {
+   echo "Use: $0 <directory with .hex/.xml files> [operation]"
+   echo
+   echo "     operation: code|[decode]"
+   echo
+   echo "     Example: $0 Pending/NOKIA"
+   echo
+   salir
+}
+
+#############
+# EJECUCION #
+#############
+[[ "$1" = "" ]] && uso
+DIR=$1
+OP=$2
+[[ "$OP" = "" ]] && OP=decode
+[[ "$OP" != "decode" ]] && OP=code
+[[ ! -d $DIR ]] && salir "Directory $DIR not found"
+
+> batch.txt
+
+[[ "$OP" = "decode" ]] && { EXT1=hex ; EXT2=xml ; }
+[[ "$OP" = "code" ]] && { EXT1=xml ; EXT2=hex ; }
+
+for i in `find $DIR/ -name "*.${EXT1}"`
+do
+   echo ".\c"
+   echo "$OP|$OP|$i|${i}.${EXT2}" >> batch.txt
+done
+
+echo
+echo "Created batch.txt"
+echo
+
diff --git a/example/diameter/launcher/scripts/data-initial.msk b/example/diameter/launcher/scripts/data-initial.msk
new file mode 100644 (file)
index 0000000..fa6d324
--- /dev/null
@@ -0,0 +1,44 @@
+<message version="1" name="Credit-Control-Request" p-bit="yes" application-id="4" hop-by-hop-id="__HBH_ETE__" end-by-end-id="__HBH_ETE__">
+   <avp name="Session-Id" data="__SID_DI__;__SID_HIGH__;__SID_LOW__;__SID_SUFFIX__"/>
+   <avp name="Origin-Host" data="__SID_DI__"/>
+   <avp name="Origin-Realm" data="sandvine.com"/>
+   <avp name="Destination-Realm" data="telefonica.com.co"/>
+   <avp name="Auth-Application-Id" data="4"/>
+   <avp name="Service-Context-Id" data="770.32251@3gpp.org"/>
+   <avp name="CC-Request-Type" data="1" alias="INITIAL_REQUEST"/>
+   <avp name="CC-Request-Number" data="0"/>
+   <avp name="User-Name" data="__MSISDN__"/>
+   <avp name="Origin-State-Id" data="1339077627"/>
+   <avp name="Event-Timestamp" data="__NTPTIMESTAMP__"/>
+   <avp name="Subscription-Id">
+      <avp name="Subscription-Id-Type" data="0" alias="END_USER_E164"/>
+      <avp name="Subscription-Id-Data" data="__MSISDN__"/>
+   </avp>
+   <avp name="Multiple-Services-Indicator" data="1" alias="MULTIPLE_SERVICES_SUPPORTED"/>
+   <avp name="User-Equipment-Info">
+      <avp name="User-Equipment-Info-Type" data="0" alias="IMEISV"/>
+      <avp name="User-Equipment-Info-Value" hex-data="33353430343630343130363438333030"/>
+   </avp>
+   <avp name="Service-Information">
+      <avp name="PS-Information">
+         <avp name="3GPP-Charging-Id" data="29"/>
+         <avp name="3GPP-PDP-Type" data="0" alias="IPV4"/>
+         <avp name="PDP-Address" data="10.193.49.133"/>
+         <avp name="3GPP-GPRS-Neg-QoS-Profile" data="05-1b921f7196fefe74fbfefe00"/>
+         <avp name="SGSN-Address" data="190.98.183.240"/>
+         <avp name="GGSN-Address" data="190.98.183.243"/>
+         <avp name="CG-Address" data="10.193.249.1"/>
+         <avp name="3GPP-IMSI-MCC-MNC" data="71204"/>
+         <avp name="3GPP-GGSN-MCC-MNC" data="71204"/>
+         <avp name="3GPP-NSAPI" data="5"/>
+         <avp name="Called-Station-Id" data="internet.movistar.ni"/>
+         <avp name="3GPP-Selection-Mode" data="0"/>
+         <avp name="3GPP-Charging-Characteristics" data="0800"/>
+         <avp name="3GPP-SGSN-MCC-MNC" data="33403"/>
+         <avp name="3GPP-MS-TimeZone" hex-data="4a00"/>
+         <avp name="3GPP-User-Location-Info" hex-data="0117f240a4780218"/>
+         <avp name="3GPP-Rat-Type" hex-data="01"/>
+         <avp name="PDP-Context-Type" data="0"/>
+      </avp>
+   </avp>
+</message>
diff --git a/example/diameter/launcher/scripts/data-termination.msk b/example/diameter/launcher/scripts/data-termination.msk
new file mode 100644 (file)
index 0000000..f15396f
--- /dev/null
@@ -0,0 +1,55 @@
+<message version="1" name="Credit-Control-Request" p-bit="yes" application-id="4" hop-by-hop-id="__HBH_ETE__" end-by-end-id="__HBH_ETE__">
+   <avp name="Session-Id" data="__SID_DI__;__SID_HIGH__;__SID_LOW__;__SID_SUFFIX__"/>
+   <avp name="Origin-Host" data="__SID_DI__"/>
+   <avp name="Origin-Realm" data="sandvine.com"/>
+   <avp name="Destination-Realm" data="telefonica.com.co"/>
+   <avp name="Auth-Application-Id" data="4"/>
+   <avp name="Service-Context-Id" data="770.32251@3gpp.org"/>
+   <avp name="CC-Request-Type" data="3" alias="TERMINATION_REQUEST"/>
+   <avp name="CC-Request-Number" data="3"/>
+   <avp name="Destination-Host" data="mqmty1besdp1.movistar.pa"/>
+   <avp name="User-Name" data="__MSISDN__"/>
+   <avp name="Origin-State-Id" data="1339077627"/>
+   <avp name="Event-Timestamp" data="__NTPTIMESTAMP__"/>
+   <avp name="Subscription-Id">
+      <avp name="Subscription-Id-Type" data="0" alias="END_USER_E164"/>
+      <avp name="Subscription-Id-Data" data="__MSISDN__"/>
+   </avp>
+   <avp name="Termination-Cause" data="1" alias="DIAMETER_LOGOUT"/>
+   <avp name="Multiple-Services-Indicator" data="1" alias="MULTIPLE_SERVICES_SUPPORTED"/>
+   <avp name="Multiple-Services-Credit-Control">
+      <avp name="Used-Service-Unit">
+         <avp name="CC-Total-Octets" data="524288"/>
+         <avp name="CC-Input-Octets" data="424288"/>
+         <avp name="CC-Output-Octets" data="100000"/>
+         <avp name="Reporting-Reason" data="2" alias="FINAL"/>
+      </avp>
+      <avp name="Rating-Group" data="99"/>
+   </avp>
+   <avp name="User-Equipment-Info">
+      <avp name="User-Equipment-Info-Type" data="0" alias="IMEISV"/>
+      <avp name="User-Equipment-Info-Value" hex-data="33353430343630343130363438333030"/>
+   </avp>
+   <avp name="Service-Information">
+      <avp name="PS-Information">
+         <avp name="3GPP-Charging-Id" data="29"/>
+         <avp name="3GPP-PDP-Type" data="0" alias="IPV4"/>
+         <avp name="PDP-Address" data="10.193.49.133"/>
+         <avp name="3GPP-GPRS-Neg-QoS-Profile" data="05-1b921f7196fefe74fbfefe00"/>
+         <avp name="SGSN-Address" data="190.98.183.240"/>
+         <avp name="GGSN-Address" data="190.98.183.243"/>
+         <avp name="CG-Address" data="10.193.249.1"/>
+         <avp name="3GPP-IMSI-MCC-MNC" data="71204"/>
+         <avp name="3GPP-GGSN-MCC-MNC" data="71204"/>
+         <avp name="3GPP-NSAPI" data="5"/>
+         <avp name="Called-Station-Id" data="internet.movistar.ni"/>
+         <avp name="3GPP-Session-Stop-Indicator" hex-data="ff"/>
+         <avp name="3GPP-Selection-Mode" data="0"/>
+         <avp name="3GPP-Charging-Characteristics" data="0800"/>
+         <avp name="3GPP-SGSN-MCC-MNC" data="33403"/>
+         <avp name="3GPP-MS-TimeZone" hex-data="4a00"/>
+         <avp name="3GPP-User-Location-Info" hex-data="0117f240a4780218"/>
+         <avp name="3GPP-Rat-Type" hex-data="01"/>
+      </avp>
+   </avp>
+</message>
diff --git a/example/diameter/launcher/scripts/data-update1.msk b/example/diameter/launcher/scripts/data-update1.msk
new file mode 100644 (file)
index 0000000..8883c60
--- /dev/null
@@ -0,0 +1,47 @@
+<message version="1" name="Credit-Control-Request" p-bit="yes" application-id="4" hop-by-hop-id="__HBH_ETE__" end-by-end-id="__HBH_ETE__">
+   <avp name="Session-Id" data="__SID_DI__;__SID_HIGH__;__SID_LOW__;__SID_SUFFIX__"/>
+   <avp name="Origin-Host" data="__SID_DI__"/>
+   <avp name="Origin-Realm" data="sandvine.com"/>
+   <avp name="Destination-Realm" data="telefonica.com.co"/>
+   <avp name="Auth-Application-Id" data="4"/>
+   <avp name="Service-Context-Id" data="770.32251@3gpp.org"/>
+   <avp name="CC-Request-Type" data="2" alias="UPDATE_REQUEST"/>
+   <avp name="CC-Request-Number" data="1"/>
+   <avp name="Destination-Host" data="mqmty1besdp1.movistar.pa"/>
+   <avp name="Origin-State-Id" data="1339077627"/>
+   <avp name="Event-Timestamp" data="__NTPTIMESTAMP__"/>
+   <avp name="Subscription-Id">
+      <avp name="Subscription-Id-Type" data="0" alias="END_USER_E164"/>
+      <avp name="Subscription-Id-Data" data="__MSISDN__"/>
+   </avp>
+   <avp name="Multiple-Services-Indicator" data="1" alias="MULTIPLE_SERVICES_SUPPORTED"/>
+   <avp name="Multiple-Services-Credit-Control">
+      <avp name="Requested-Service-Unit"/>
+      <avp name="Rating-Group" data="99"/>
+   </avp>
+   <avp name="User-Equipment-Info">
+      <avp name="User-Equipment-Info-Type" data="0" alias="IMEISV"/>
+      <avp name="User-Equipment-Info-Value" hex-data="33353430343630343130363438333030"/>
+   </avp>
+   <avp name="Service-Information">
+      <avp name="PS-Information">
+         <avp name="3GPP-Charging-Id" data="29"/>
+         <avp name="3GPP-PDP-Type" data="0" alias="IPV4"/>
+         <avp name="PDP-Address" data="10.193.49.133"/>
+         <avp name="3GPP-GPRS-Neg-QoS-Profile" data="05-1b921f7196fefe74fbfefe00"/>
+         <avp name="SGSN-Address" data="190.98.183.240"/>
+         <avp name="GGSN-Address" data="190.98.183.243"/>
+         <avp name="CG-Address" data="10.193.249.1"/>
+         <avp name="3GPP-IMSI-MCC-MNC" data="71204"/>
+         <avp name="3GPP-GGSN-MCC-MNC" data="71204"/>
+         <avp name="3GPP-NSAPI" data="5"/>
+         <avp name="Called-Station-Id" data="internet.movistar.ni"/>
+         <avp name="3GPP-Selection-Mode" data="0"/>
+         <avp name="3GPP-Charging-Characteristics" data="0800"/>
+         <avp name="3GPP-SGSN-MCC-MNC" data="33403"/>
+         <avp name="3GPP-MS-TimeZone" hex-data="4a00"/>
+         <avp name="3GPP-User-Location-Info" hex-data="0117f240a4780218"/>
+         <avp name="3GPP-Rat-Type" hex-data="01"/>
+      </avp>
+   </avp>
+</message>
diff --git a/example/diameter/launcher/scripts/data-update2.msk b/example/diameter/launcher/scripts/data-update2.msk
new file mode 100644 (file)
index 0000000..8784172
--- /dev/null
@@ -0,0 +1,53 @@
+<message version="1" name="Credit-Control-Request" p-bit="yes" application-id="4" hop-by-hop-id="__HBH_ETE__" end-by-end-id="__HBH_ETE__">
+   <avp name="Session-Id" data="__SID_DI__;__SID_HIGH__;__SID_LOW__;__SID_SUFFIX__"/>
+   <avp name="Origin-Host" data="__SID_DI__"/>
+   <avp name="Origin-Realm" data="sandvine.com"/>
+   <avp name="Destination-Realm" data="telefonica.com.co"/>
+   <avp name="Auth-Application-Id" data="4"/>
+   <avp name="Service-Context-Id" data="770.32251@3gpp.org"/>
+   <avp name="CC-Request-Type" data="2" alias="UPDATE_REQUEST"/>
+   <avp name="CC-Request-Number" data="2"/>
+   <avp name="Destination-Host" data="mqmty1besdp1.movistar.pa"/>
+   <avp name="User-Name" data="__MSISDN__"/>
+   <avp name="Origin-State-Id" data="1339077627"/>
+   <avp name="Event-Timestamp" data="__NTPTIMESTAMP__"/>
+   <avp name="Subscription-Id">
+      <avp name="Subscription-Id-Type" data="0" alias="END_USER_E164"/>
+      <avp name="Subscription-Id-Data" data="__MSISDN__"/>
+   </avp>
+   <avp name="Multiple-Services-Indicator" data="1" alias="MULTIPLE_SERVICES_SUPPORTED"/>
+   <avp name="Multiple-Services-Credit-Control">
+      <avp name="Requested-Service-Unit"/>
+      <avp name="Used-Service-Unit">
+         <avp name="CC-Total-Octets" data="524288"/>
+         <avp name="CC-Input-Octets" data="224288"/>
+         <avp name="CC-Output-Octets" data="300000"/>
+      </avp>
+      <avp name="Rating-Group" data="99"/>
+   </avp>
+   <avp name="User-Equipment-Info">
+      <avp name="User-Equipment-Info-Type" data="0" alias="IMEISV"/>
+      <avp name="User-Equipment-Info-Value" hex-data="33353430343630343130363438333030"/>
+   </avp>
+   <avp name="Service-Information">
+      <avp name="PS-Information">
+         <avp name="3GPP-Charging-Id" data="29"/>
+         <avp name="3GPP-PDP-Type" data="0" alias="IPV4"/>
+         <avp name="PDP-Address" data="10.193.49.133"/>
+         <avp name="3GPP-GPRS-Neg-QoS-Profile" data="05-1b921f7196fefe74fbfefe00"/>
+         <avp name="SGSN-Address" data="190.98.183.240"/>
+         <avp name="GGSN-Address" data="190.98.183.243"/>
+         <avp name="CG-Address" data="10.193.249.1"/>
+         <avp name="3GPP-IMSI-MCC-MNC" data="71204"/>
+         <avp name="3GPP-GGSN-MCC-MNC" data="71204"/>
+         <avp name="3GPP-NSAPI" data="5"/>
+         <avp name="Called-Station-Id" data="internet.movistar.ni"/>
+         <avp name="3GPP-Selection-Mode" data="0"/>
+         <avp name="3GPP-Charging-Characteristics" data="0800"/>
+         <avp name="3GPP-SGSN-MCC-MNC" data="33403"/>
+         <avp name="3GPP-MS-TimeZone" hex-data="4a00"/>
+         <avp name="3GPP-User-Location-Info" hex-data="0117f240a4780218"/>
+         <avp name="3GPP-Rat-Type" hex-data="01"/>
+      </avp>
+   </avp>
+</message>
diff --git a/example/diameter/launcher/scripts/data.sh b/example/diameter/launcher/scripts/data.sh
new file mode 100755 (executable)
index 0000000..f253b76
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/ksh
+
+# Generates DATA burst sequence for provided order number (1: first, 2: second, etc.)
+# We will generate a simple scenario with initial, two updates and termination, that is to say: four messages:
+#  1,2,3,4  5,6,7,8  9,10,11,12   etc.
+#
+# Category = ((Number-1) % 4) + 1 = 1 for initial, 2 for first update, 3 for second update and 4 for termination
+SEQN=$1
+OFFSET=$((SEQN-1))
+CAT=$((OFFSET%4 + 1))
+
+salir () {
+   echo
+   echo $1
+   echo
+   exit
+}
+
+check_template () {
+   [[ ! -f $1 ]] && salir "Template file ($1) not found!"
+}
+
+parse () {
+   cat $1 | sed 's/__HBH_ETE__/'$HBH_ETE'/g' | sed 's/__SID_SUFFIX__/'$SID_SUFFIX'/' \
+            | sed 's/__MSISDN__/'$MSISDN'/' | sed 's/__NTPTIMESTAMP__/'$NTP'/' \
+            | sed 's/__SID_DI__/'$SID_DI'/' | sed 's/__SID_HIGH__/'$SID_HIGH'/' | sed 's/__SID_LOW__/'$SI_LOW'/'
+}
+
+
+[[ "$SEQN" = "" ]] && salir "Use: $0 <sequence number: 1..N>"
+check_template data-initial.msk
+check_template data-update1.msk
+check_template data-update2.msk
+check_template data-termination.msk
+
+# Session-Id: '<DiameterIdentity>;<high 32 bits>;<low 32 bits>[;<optional value>="">]'
+#   <avp name="Session-Id" data="module-2.PTS2-BOG.sandvine.com;1287115741;0;49"/>
+# We will sequence the otional value with __SID_SUFFIX__, low and high will be constant.
+
+# Sequence values at templates:
+# __HBH_ETE__:    1, 3, 5, etc. (hop-by-hop and end-to-end)
+# __SID_SUFFIX__: It could be MSISDN, but we put OFFSET (0, 1, 2, 3, etc.). It's the Session-Id optional part.
+# __MSISDN__:     50583211675, 50583211676, 50583211677, etc. Used for User-Name and Subscription-Id-Data 
+# __NTPTIMESTAMP__: Four values for initial, update1, update2 and termination: 3548171033, 3548171136 (103+), 3548171136(idem), 3548171524(388+)
+#                   This initial time (aproximately 8 Jun 2012 at 19:00).
+CUARTO=$((OFFSET/4))
+HBH_ETE=$((1 + 2*OFFSET))
+SID_SUFFIX=$CUARTO
+# Example if you want to fix to two sockets (-sessionIdPartForClientSocketIdSelection must be 'optional'): SID_SUFFIX=$((CUARTO%2))
+MSISDN=$((50583211675+CUARTO))
+NTP=$((3548171033+CUARTO))
+
+# Helpers to guide derivery (fixed at the moment)
+# __SID_DI__:     Session-Id diameter identity
+# __SID_HIGH__:   Session-Id high part
+# __SID_LOW__:    Session-Id low part
+SID_DI=module-2.PTS2-BOG.sandvine.com
+SID_HIGH=1287115741
+SI_LOW=0
+
+case $CAT in
+   1) parse data-initial.msk
+   ;;
+   2) NTP=$((NTP+103))
+      parse data-update1.msk
+   ;;
+   3) NTP=$((NTP+103))
+      parse data-update2.msk
+   ;;
+   4) NTP=$((NTP+491))
+      parse data-termination.msk
+   ;;
+esac
+
diff --git a/example/diameter/launcher/scripts/decode.sh b/example/diameter/launcher/scripts/decode.sh
new file mode 100755 (executable)
index 0000000..da9681c
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+
+use () {
+
+   echo "Use: $0 <hex_file>"
+   echo
+   echo "Creates '<hex_file>.xml' with decoded result."
+   echo
+   exit
+}
+
+echo
+[[ "$1" = "" ]] && use
+[[ ! -f "$1" ]] && { echo "ERROR: file '$1' not found" ; echo; echo; exit ; }
+echo
+operation="decode|$1|${1}.xml"
+curl -m 1 --data "$operation" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/scripts/diameterServerSessions.sh b/example/diameter/launcher/scripts/diameterServerSessions.sh
new file mode 100755 (executable)
index 0000000..340b14b
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+
+use () {
+
+   echo "Use: $0 <integer>"
+   echo
+   echo "Updates the maximum number of accepted connections over diameter server socket."
+   echo
+   exit
+}
+
+echo
+[[ "$1" = "" ]] && use
+echo
+operation="diameterServerSessions|$1"
+curl -m 1 --data "$operation" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/scripts/help.sh b/example/diameter/launcher/scripts/help.sh
new file mode 100755 (executable)
index 0000000..42519ec
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+curl -m 1 --data "help" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/scripts/loadXml.sh b/example/diameter/launcher/scripts/loadXml.sh
new file mode 100755 (executable)
index 0000000..c589249
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+
+use () {
+
+   echo "Use: $0 <xml_file>"
+   echo
+   echo "Load xml file and show on stdout again."
+   echo "It is useful to test xml loader and xml viewer, but also for show aliases and,"
+   echo "if '-ignoreFlags' commandline option is missing, for flag coherence checking."
+   echo
+   exit
+}
+
+echo
+[[ "$1" = "" ]] && use
+[[ ! -f "$1" ]] && { echo "ERROR: file '$1' not found" ; echo; echo; exit ; }
+echo
+operation="loadxml|$1"
+curl -m 1 --data "$operation" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/scripts/pre-start.sh b/example/diameter/launcher/scripts/pre-start.sh
new file mode 100755 (executable)
index 0000000..48f9ce3
--- /dev/null
@@ -0,0 +1,77 @@
+#!/bin/ksh
+
+# Remove logs:
+rm *.log* *.csv 2>/dev/null
+
+# Server sockets:
+httpServer_dflt=`cat .httpServer 2>/dev/null`
+diameterServer_dflt=`cat .diameterServer 2>/dev/null`
+diameterServerSessions_dflt=`cat .diameterServerSessions 2>/dev/null`
+
+# Client sockets:
+entity_dflt=`cat .entity 2>/dev/null`
+entityServerSessions_dflt=`cat .entityServerSessions 2>/dev/null`
+
+# Stack:
+dictionary_dflt=`cat .dictionary 2>/dev/null`
+
+echo
+echo
+# Fast start
+quick () {
+   echo "Do you wish to answer wizard commandline configuration ? (y/n) [n]:"
+   read wizard
+   [[ "$wizard" = "" ]] && wizard=n
+   [[ "$wizard" = "n" ]] && exit
+}
+
+[ "$httpServer_dflt" != ""  -a "$diameterServer_dflt" != "" -a "$diameterServerSessions_dflt" != "" -a \
+  "$entity_dflt" != ""  -a "$entityServerSessions_dflt" != "" -a \
+  "$dictionary_dflt" != "" ] && quick
+
+# Wizard
+[[ "$httpServer_dflt" = "" ]] && httpServer_dflt="localhost:9000"
+echo "HTTP Management interface address (using i.e. curl tool) as <ip|hostname>:<port> socket literal [$httpServer_dflt]:"
+read httpServer
+[[ "$httpServer" = "" ]] && httpServer=$httpServer_dflt
+
+echo "Diameter dictionary: you could use NexusPL 'stackManagement' tool in order to build an autonomous dictionary"
+echo " for any kind of application. See '<NEXUSPL>/test.ss/diameter.ss/stackManagement.p/self_ruling_setups.sh'."
+echo
+[[ "$dictionary_dflt" = "" ]] && dictionary_dflt=dictionary.xml
+echo "Diameter stack pathfiles [$dictionary_dflt]:"
+read dictionary
+[[ "$dictionary" = "" ]] && dictionary=$dictionary_dflt
+
+[[ "$diameterServer_dflt" = "" ]] && diameterServer_dflt="ocs2dfed1:3868"
+echo "Diameter own server address as <ip|hostname>:<port> socket literal [$diameterServer_dflt]:"
+read diameterServer
+[[ "$diameterServer" = "" ]] && diameterServer=$diameterServer_dflt
+
+[[ "$diameterServerSessions_dflt" = "" ]] && diameterServerSessions_dflt=0
+echo "Diameter own server available connections (0: diameter server disabled) [$diameterServerSessions_dflt]:"
+read diameterServerSessions
+[[ "$diameterServerSessions" = "" ]] && diameterServerSessions=$diameterServerSessions_dflt
+
+
+[[ "$entity_dflt" = "" ]] && entity_dflt="ocs2dfed1:4000,ocs2dfed1:4001"
+echo "Target diameter entity (pipe-separated <ip|hostname>:<port> socket literal list) ["$entity_dflt"]:"
+read entity
+[[ "$entity" = "" ]] && entity="$entity_dflt"
+
+[[ "$entityServerSessions_dflt" = "" ]] && entityServerSessions_dflt=1
+echo "Diameter entity server sessions (0: diameter entity disabled) [$entityServerSessions_dflt]:"
+read entityServerSessions
+[[ "$entityServerSessions" = "" ]] && entityServerSessions=$entityServerSessions_dflt
+
+
+echo $httpServer > .httpServer
+echo $dictionary > .dictionary
+echo $diameterServer > .diameterServer
+echo $diameterServerSessions > .diameterServerSessions
+echo $entity > .entity
+echo $entityServerSessions > .entityServerSessions
+
+echo
+echo
+
diff --git a/example/diameter/launcher/scripts/sendXml.sh b/example/diameter/launcher/scripts/sendXml.sh
new file mode 100755 (executable)
index 0000000..d9d58e2
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/ksh
+> curl_log.txt
+TRACE="--trace-ascii curl_log.txt"
+SERVER=`cat .httpServer`
+
+use () {
+
+   echo "Use: $0 <xml_file> [2c]"
+   echo
+   echo "Sends 'xml_file' to the diameter server or to the client when '2c' parameter is provided."
+   echo
+   exit
+}
+
+echo
+[[ "$1" = "" ]] && use
+[[ ! -f "$1" ]] && { echo "ERROR: file '$1' not found" ; echo; echo; exit ; }
+echo
+operation="sendxml|$1"
+[[ "$2" = "2c" ]] && operation="sendxml2c|$1"
+
+curl -m 1 --data "$operation" $TRACE ${SERVER}
+
diff --git a/example/diameter/launcher/scripts/sms.msk b/example/diameter/launcher/scripts/sms.msk
new file mode 100644 (file)
index 0000000..7bec3c8
--- /dev/null
@@ -0,0 +1,90 @@
+<message version="1" name="Credit-Control-Request" p-bit="yes" application-id="4" hop-by-hop-id="__HBH_ETE__" end-by-end-id="__HBH_ETE__">
+   <avp name="Session-Id" data="gbg.acision.com;421411;__SID_LOW__"/>
+   <avp name="Origin-Host" data="gbg.acision.com"/>
+   <avp name="Origin-Realm" data="SMSC.orig.OCS2.o2online.de"/>
+   <avp name="Destination-Realm" data="SMSC.dest.OCS1.o2online.de"/>
+   <avp name="Auth-Application-Id" data="4"/>
+   <avp name="Service-Context-Id" data="8.6.0.07.262.8.32274@3gpp.org"/>
+   <avp name="CC-Request-Type" data="4" alias="EVENT_REQUEST"/>
+   <avp name="CC-Request-Number" data="1"/>
+   <avp name="Destination-Host" data="OCS1"/>
+   <avp name="Event-Timestamp" data="1"/>
+   <avp name="Subscription-Id">
+      <avp name="Subscription-Id-Type" data="0" alias="END_USER_E164"/>
+      <avp name="Subscription-Id-Data" data="__MSISDN__"/>
+   </avp>
+   <avp name="Requested-Action" data="0" alias="DIRECT_DEBITING"/>
+   <avp name="Multiple-Services-Indicator" data="0" alias="MULTIPLE_SERVICES_NOT_SUPPORTED"/>
+   <avp name="Multiple-Services-Credit-Control">
+      <avp name="Requested-Service-Unit">
+         <avp name="CC-Service-Specific-Units" data="1"/>
+      </avp>
+      <avp name="Service-Identifier" data="1"/>
+   </avp>
+   <avp name="Service-Information">
+      <avp name="MMS-Information">
+         <avp name="Originator-Address">
+            <avp name="Address-Type" data="1" alias="MSISDN"/>
+            <avp name="Address-Data" data="__MSISDN__"/>
+            <avp name="Address-Domain">
+               <avp name="3GPP-IMSI-MCC-MNC" data="26207"/>
+            </avp>
+         </avp>
+         <avp name="Originator-Address">
+            <avp name="Address-Type" data="6" alias="Other"/>
+            <avp name="Address-Data" data="__IMSI__"/>
+         </avp>
+         <avp name="Submission-Time" data="3486294858"/>
+         <avp name="Message-Size" data="4"/>
+      </avp>
+      <avp name="SMS-Information">
+         <avp name="SMS-Node" data="3" alias="SMS-SC"/>
+         <avp name="Client-Address" data="8|541760000405"/>
+         <avp name="Originator-SCCP-Address" data="8|541760000005"/>
+         <avp name="Originator-Received-Address">
+            <avp name="Address-Type" data="1" alias="MSISDN"/>
+            <avp name="Address-Data" data="__MSISDN__"/>
+            <avp name="Address-Domain">
+               <avp name="3GPP-IMSI-MCC-MNC" data="26207"/>
+            </avp>
+         </avp>
+         <avp name="Recipient-Info">
+            <avp name="Destination-Interface">
+               <avp name="Interface-Id" data="5417607020601"/>
+               <avp name="Interface-Type" data="2" alias="MOBILE_TERMINATING"/>
+            </avp>
+            <avp name="Recipient-Address">
+               <avp name="Address-Type" data="1" alias="MSISDN"/>
+               <avp name="Address-Data" data="5417607020601"/>
+               <avp name="Address-Domain">
+                  <avp name="3GPP-IMSI-MCC-MNC" data="26207"/>
+               </avp>
+            </avp>
+            <avp name="Recipient-Address">
+               <avp name="Address-Type" data="6" alias="Other"/>
+               <avp name="Address-Data" data="262074900005771"/>
+            </avp>
+            <avp name="Recipient-Received-Address">
+               <avp name="Address-Type" data="1" alias="MSISDN"/>
+               <avp name="Address-Data" data="5417607020601"/>
+               <avp name="Address-Domain">
+                  <avp name="3GPP-IMSI-MCC-MNC" data="26207"/>
+               </avp>
+            </avp>
+            <avp name="Recipient-SCCP-Address" data="8|541760000005"/>
+         </avp>
+         <avp name="SMSC-Address" data="8|541760000405"/>
+         <avp name="Data-Coding-Scheme" data="0"/>
+         <avp name="SM-Message-Type" data="0" alias="SUBMISSION"/>
+         <avp name="Originator-Interface">
+            <avp name="Interface-Id" data="262074900005771"/>
+            <avp name="Interface-Type" data="1" alias="MOBILE_ORIGINATING"/>
+         </avp>
+         <avp name="Number-Of-Messages-Sent" data="1"/>
+      </avp>
+   </avp>
+<!--
+   El Correlation Id no se usa en el Sertamsjt
+   <avp name="CC-Correlation-Id" data="gbg.acision.com;421411;__SID_LOW__"/>
+-->
+</message>
diff --git a/example/diameter/launcher/scripts/sms.sh b/example/diameter/launcher/scripts/sms.sh
new file mode 100755 (executable)
index 0000000..c77b398
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/ksh
+
+# Generates SMS burst sequence for provided order number (1: first, 2: second, etc.)
+SEQN=$1
+
+salir () {
+   echo
+   echo $1
+   echo
+   exit
+}
+
+[[ "$SEQN" = "" ]] && salir "Use: $0 <sequence number: 1..N>"
+[[ ! -f sms.msk ]] && salir "Template file (sms.msk) not found!"
+
+# Sequence values at template sms.msk:
+# __HBH_ETE__: 1, 3, 5, etc. (hop-by-hop and end-to-end)
+# __SID_LOW__: 1000, 1001, 1002, etc. (Session-Id sequence append)
+# __MSISDN__:  5555100000, 5555100001, 5555100002, etc. (First and Third Address-Data)
+# __IMSI__:    262075555100000, 262075555100001, 262075555100002, etc. (Second Address-Data)
+
+OFFSET=$((SEQN-1))
+
+HBH_ETE=$((1 + 2*OFFSET))
+SID_LOW=$((1000+OFFSET))
+MSISDN=$((5555100000+OFFSET))
+IMSI=$((262075555100000+OFFSET))
+
+cat sms.msk | sed 's/__HBH_ETE__/'$HBH_ETE'/g' | sed 's/__SID_LOW__/'$SID_LOW'/' \
+            | sed 's/__MSISDN__/'$MSISDN'/' | sed 's/__IMSI__/'$IMSI'/'
diff --git a/example/diameter/launcher/scripts/tests/createPackage.sh b/example/diameter/launcher/scripts/tests/createPackage.sh
deleted file mode 100755 (executable)
index 484ba7b..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/bin/ksh
-
-# Functions & variables
-
-_exit () {
-   echo
-   echo $1
-   echo
-   exit
-}
-
-createRunScript () {
-
-echo "#!/bin/ksh" > run.sh
-echo "EXE=\`cat .exe 2>/dev/null\`" >> run.sh
-echo "STARTED=\`ps -fea | grep \"\$EXE\" | grep -v grep\`" >> run.sh
-echo "[ \"\$EXE\" != \"\" -a \"\$STARTED\" != \"\" ] && { echo \"Already started!\"; echo \"\$STARTED\" ; exit ; }" >> run.sh
-echo "pre-start.sh" >> run.sh
-echo "> launcher.traces" >> run.sh
-echo "EXE=\"ndl_\`date '+%Y%m%d%H%M%S'\`\"" >> run.sh
-echo "echo \$EXE > .exe"  >> run.sh
-#echo "rm \$EXE 2>/dev/null" >> run.sh
-echo "echo ; echo \"Executable paths:\" ; echo" >> run.sh
-echo "for i in \`ls execs/.*/*\` ; do echo \$i ; done" >> run.sh
-echo "echo ; echo \"Input the executable path:\" ; read path ; while test \"\$path\" = \"\" ; do read path ; done" >> run.sh
-echo "ln -s \$path \$EXE" >> run.sh
-echo >> run.sh
-echo -n "\$EXE " >> run.sh
-for i in `cat args.txt | grep -v "^#"`
-do
-   echo -n "$i " >> run.sh
-done
-echo "&" >> run.sh
-chmod a+x run.sh
-rm args.txt
-}
-
-createDictionaryPaths () {
-
-BASE_PROT=commands_baseProtocol.xml
-
-for i in stacks/*commands*xml
-do
-   stacks/dependence.sh $i >/dev/null
-   stack=`basename $i`
-   if test "$stack" != "$BASE_PROT"
-   then
-      > .dictionary__${stack}
-      for j in `cat ${i}.dep`
-      do
-         echo "${j},\c" >> .dictionary__${stack}
-      done
-      echo "stacks/$BASE_PROT,stacks/${stack}" >> .dictionary__${stack}
-   fi
-done
-
-# Default:
-ln -s .dictionary__commands_qosControl.xml .dictionary
-}
-
-#############
-# EXECUTION #
-#############
-echo
-echo "------------------"
-echo "ADL Patch Creation"
-echo "------------------"
-echo
-# Check BASEPJ:
-[[ "$BASEPJ" = "" ]] && _exit "Run 'configure' before continue (BASEPJ must be defined)"
-
-echo "BASEPJ=$BASEPJ"
-echo "Correct ? (y/n) [y]"
-read correct
-[[ "$correct" = "" ]] && correct=y
-[[ "$correct" != "y" ]] && _exit "Load the correct 'configure'"
-
-# Copy staff:
-rm -rf tmp
-mkdir -p tmp
-echo "Packaging ..."
-cp /opt/bin/anna/example_diameter_launcher tmp/exec/launcher 
-cp ../../*sh tmp
-rm tmp/batch.sh
-cp ../../*msk tmp
-cp ../../args.txt tmp
-mkdir tmp/stacks
-SETUPS_DIR=../../../../../source/diameter/stack/setups/
-cp $SETUPS_DIR/*xml tmp/stacks
-cp $SETUPS_DIR/*sh tmp/stacks
-cp ../../../../../source/diameter/codec/message.dtd tmp
-# Prepare:
-cd tmp
-createRunScript
-createDictionaryPaths
-cd ..
-
-# Help:
-echo "Stacks available at '.dictionary__<stack description>', create a symbolic link from '.dictionary'." >> tmp/README
-echo "Template for xml messages: message.dtd (informative, not actually required by process)" >> tmp/README
-echo "Start with 'run.sh'" >> tmp/README
-
-mv tmp ADL-installer
-tar cvfz ADL-installer.tar.gz ADL-installer
-rm -rf ADL-installer
-
-echo
-echo "Created ADL-installer.tar.gz !"
-echo
-
-