echo "#!/bin/bash" > 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 "STARTED=\`pgrep \$EXE2>/dev/null\`" >> run.sh
+ echo "[ \$? -eq 0 ] && { echo \"Already started!\"; echo \"\$STARTED\" ; exit 1 ; }" >> run.sh
echo "./pre-start.sh" >> run.sh
echo "> launcher.traces" >> run.sh
echo "EXE=\"./ADL-launcher\"" >> run.sh
echo
echo "Input deployment path [$DPATH_dflt]:"
read DPATH
-[[ "$DPATH" = "" ]] && DPATH=$DPATH_dflt
-[[ -d $DPATH ]] && _exit "The path '$DPATH' already exists. Remove it before continue..."
+[ "$DPATH" = "" ] && DPATH=$DPATH_dflt
+[ -d $DPATH ] && _exit "The path '$DPATH' already exists. Remove it before continue..."
echo "Basic checkings ..."
-[[ ! -f $EXEC ]] && _exit "Anna Diameter Launcher (ADL) is not linked. Execute 'scons' for 'anna' suite."
-[[ ! -d $SETUPS_DIR ]] && _exit "Diameter stacks not found ($SETUPS_DIR). Perhaps you executed this script out of its parent path."
+[ ! -f $EXEC ] && _exit "Anna Diameter Launcher (ADL) is not linked. Execute 'scons' for 'anna' suite."
+[ ! -d $SETUPS_DIR ] && _exit "Diameter stacks not found ($SETUPS_DIR). Perhaps you executed this script out of its parent path."
echo
echo "Deploy (f)ull version or (l)ite version [l]:"
read deploy_type
-[[ "$deploy_type" = "" ]] && deploy_type=l
-[[ "$deploy_type" = "l" ]] && RESOURCES_DIR=resources_lite
+[ "$deploy_type" = "" ] && deploy_type=l
+[ "$deploy_type" = "l" ] && RESOURCES_DIR=resources_lite
echo "Copying ..."
mkdir -p $DPATH
echo "Preparing ..."
cd $DPATH
-[[ "$deploy_type" != "l" ]] && createRunScript
+[ "$deploy_type" != "l" ] && createRunScript
createDictionaryPaths
cd - >/dev/null
-
ABOUT CONTENT
-------------
-Stacks available at './stacks'.
-The launcher uses the configuration given at './run.sh' variable definition section. Edit it
- if you want to adapt your system networking setup.
-
Template for xml messages (message.dtd) and dictionaries (dictionary.dtd) are informative, not
-actually required by process. Located at './DTDs'.
+actually required by process. They are located at './DTDs'. Stacks are available at './stacks'.
+There are also some stuff (hex/xml examples, etc.) which could be useful.
+
+Firstly you have to configure this directory in order to choose the type of launcher which will
+be preconfigured for your basic needs: client, server, balancer (proxy) and dummy process (this
+last is used for code/encode and does not launch any communication interface).
+
+If you are going to launch different processes, we recommend to clone this whole directory into
+another one (call it 'ADL-client', 'ADL-server_2', 'Diameter_proxy', or whatever you want), and
+then configure it again.
+
+Execute './configure.sh' and follow the intructions. You can call this several times, but the
+last configuration will be the one which prevails.
STARTING THE PROCESS
--------------------
-Start with 'run.sh'. You could manually edit such script adding parameters as '-trace debug' to
-get complete 'launcher.traces'. Execute 'ADL-launcher' without arguments to see a complete
-command-line help.
+After configuring the ADL execution context, a new script has been created: 'run.sh'.
+You can manually edit such script adding parameters as '-trace debug' to get complete traces,
+or adapt the communication endpoints for your environment.
+
+Launch the executable process without arguments to see a complete command-line help.
+Don't be scared. There are plenty of possibilities but the 'run.sh' script has been prepared
+for the type of launcher you wanted.
OPERATION
---------
Management interface for lite version is based on SIGUSR2 signal caugh. Use './operation.sh'
-script to send any operation to the process.
+script to send any operation to the process. Ask for help with that script to see all the
+operations supported.
--- /dev/null
+#!/bin/bash
+
+#############
+# VARIABLES #
+#############
+
+# Diameter dictionary:
+STD_DICTIONARY=stacks/avps_etsi.xml,stacks/avps_ietf.xml,stacks/avps_tgpp.xml,stacks/commands_baseProtocol.xml
+APP_DICTIONARY=stacks/commands_pccPS_EricssonSAPC_se.xml
+DICTIONARY=$STD_DICTIONARY,$APP_DICTIONARY
+# Perhaps the stack is not fully defined:
+KINDNESS=-ignoreErrors
+
+# Communication endpoints:
+LOCAL_STANDARD_ENDPOINT=localhost:3868
+EXAMPLE_ENTITY_4_BALANCER=192.168.12.11:3868,192.168.12.21:3868
+CONNS=10
+
+# General
+EXE_BN=ADL-launcher
+
+# Tracing:
+TRACING="-cntDir counters"
+# need detailed traces ?:
+#TRACING="$TRACING -trace debug"
+
+#############
+# FUNCTIONS #
+#############
+
+_exit () {
+ echo
+ echo $1
+ echo
+ exit 1
+}
+
+# $1: process name
+createRunScript () {
+
+ cat << EOF > run.sh
+#!/bin/bash
+cd \`dirname \$0\`
+EXE=\`cat .exe 2>/dev/null\`
+STARTED=\`pgrep $1 2>/dev/null\`
+[ \$? -eq 0 ] && { echo "Already started!"; echo "\$STARTED" ; exit 1 ; }
+echo $1 > .exe
+0> launcher.traces
+# Execution line:
+./$@ &
+echo \$! > .pid
+EOF
+
+ chmod a+x run.sh
+}
+
+# $1: input option (c, s, b, d)
+# Retuns the type of launcher logical name for the input option
+get_tol () {
+ [ "$1" = "c" ] && echo client
+ [ "$1" = "s" ] && echo server
+ [ "$1" = "b" ] && echo balancer
+ [ "$1" = "d" ] && echo dummy
+}
+
+#############
+# EXECUTION #
+#############
+cd `dirname $0`
+SCR_DIR=`pwd`
+echo
+echo
+echo "Configure a (c)lient, (s)erver, (b)alancer or (d)ummy [c]:"
+read option
+[ "$option" = "" ] && option=c
+tol=$(get_tol $option)
+[ "$tol" = "" ] && _exit "Option '$option' not implemented !!"
+
+# Run script:
+EXE_LINK=ADL-$tol
+ln -sf $EXE_BN $EXE_LINK
+
+case $tol in
+
+ client)
+ ENTITY=$LOCAL_STANDARD_ENDPOINT
+ createRunScript $EXE_LINK -dictionary $DICTIONARY -entity $ENTITY -entityServerSessions $CONNS -diameterServerSessions 0 $KINDNESS $TRACING &
+ ;;
+
+ server)
+ SERVER=$LOCAL_STANDARD_ENDPOINT
+ createRunScript $EXE_LINK -dictionary $DICTIONARY -diameterServer $SERVER -diameterServerSessions $CONNS -entityServerSessions 0 $KINDNESS $TRACING &
+ ;;
+
+ balancer)
+ SERVER=$LOCAL_STANDARD_ENDPOINT
+ ENTITY=$EXAMPLE_ENTITY_4_BALANCER
+ createRunScript $EXE_LINK -dictionary $DICTIONARY -entity $ENTITY -entityServerSessions $CONNS -diameterServer $SERVER -diameterServerSessions $CONNS -balance $KINDNESS $TRACING &
+ ;;
+
+ dummy)
+ createRunScript $EXE_LINK -dictionary $DICTIONARY -entityServerSessions 0 -diameterServerSessions 0 $KINDNESS $TRACING &
+ ;;
+
+esac
+
+echo "Created 'run.sh' script !"
+echo
#!/bin/bash
-# General
-EXE=./ADL-launcher
-
+#############
+# FUNCTIONS #
+#############
_exit () {
echo
- echo $1
+ echo -e $1
echo
exit 1
}
+#############
+# EXECUTION #
+#############
+cd `dirname $0`
echo
-echo
-[[ "$1" = "" ]] && _exit "Use: $0 <operation string>; i.e.: $0 help"
-
-PID=$(pgrep `basename $EXE`)
-[[ $? -ne 0 ]] && _exit "Can't found the process '$EXE'. Use './run.sh' to start it."
+# Get the PID:
+[ ! -f .pid ] && _exit "Can't found '`pwd`/.pid'.\nTry to pgrep your process name and dump pid to that file."
+PID=`cat .pid`
# Send operation:
+[ "$1" = "" ] && _exit "Use: $0 <operation string>; i.e.: $0 help"
echo $1 > sigusr2.tasks.input
kill -s SIGUSR2 $PID
sleep 1
echo
echo
-echo "You could see results on './sigusr2.tasks.output' file."
+echo "You could see results on '`pwd`/sigusr2.tasks.output' file."
echo
echo
+++ /dev/null
-#!/bin/bash
-
-# Diameter dictionary and endpoints:
-DICTIONARY=stacks/avps_etsi.xml,stacks/avps_ietf.xml,stacks/avps_tgpp.xml,stacks/commands_baseProtocol.xml,stacks/commands_pccPS_EricssonSAPC_se.xml
-SERVER=localhost:3868
-ENTITY=192.168.12.11:3868,192.168.12.21:3868
-CONNS=10
-
-# Perhaps the stack is not fully defined:
-KINDNESS=-ignoreErrors
-
-# Tracing (comment the second line if you need detailed traces):
-TRACING="-trace debug -cntDir counters"
-TRACING="-cntDir counters"
-
-# General
-EXE=./ADL-launcher
-
-echo
-echo
-PID=$(pgrep `basename $EXE`)
-if [ $? -eq 0 ]
-then
- echo "The process '$EXE' seems to be already started (pid: $PID)."
- echo "Press ENTER to continue, CTRL-C to abort ..."
- read dummy
-fi
-
-echo "Run as a (c)lient, (s)erver, (b)alancer or (d)ummy [c]:"
-read option
-[[ "$option" = "" ]] && option=c
-
-case $option in
- c) $EXE -dictionary $DICTIONARY -entity $ENTITY -entityServerSessions $CONNS -diameterServerSessions 0 $KINDNESS $TRACING &
- ;;
-
- s) $EXE -dictionary $DICTIONARY -diameterServer $SERVER -diameterServerSessions $CONNS -entityServerSessions 0 $KINDNESS $TRACING &
- ;;
-
- b) $EXE -dictionary $DICTIONARY -entity $ENTITY -entityServerSessions $CONNS -diameterServer $SERVER -diameterServerSessions $CONNS -balance $KINDNESS $TRACING &
- ;;
-
- d) $EXE -dictionary $DICTIONARY -entityServerSessions 0 -diameterServerSessions 0 $KINDNESS $TRACING &
- ;;
-
- *) echo "Option '$option' not implemented !!"
- ;;
-esac
-
--- /dev/null
+<message version="1" name="Credit-Control-Request" p-bit="yes" application-id="4" hop-by-hop-id="1" end-by-end-id="1">
+ <avp name="Session-Id" data="module-2.PTS2-BOG.sandvine.com;1287115741;0;0"/>
+ <avp name="Origin-Host" data="module-2.PTS2-BOG.sandvine.com"/>
+ <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="50583211675"/>
+ <avp name="Origin-State-Id" data="1339077627"/>
+ <avp name="Event-Timestamp" data="3548171033"/>
+ <avp name="Subscription-Id">
+ <avp name="Subscription-Id-Type" data="0" alias="END_USER_E164"/>
+ <avp name="Subscription-Id-Data" data="50583211675"/>
+ </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>