X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2Fresources_lite%2Fconfigure.sh;fp=example%2Fdiameter%2Flauncher%2Fresources_lite%2Fconfigure.sh;h=335e4fff27d3c68329bb37f43f135342ebc93c4e;hb=6b3c0d5e652726b5034fa595bc020476862c948f;hp=0000000000000000000000000000000000000000;hpb=c68d53c4623b63ee20014a7eae0b9759a490c90e;p=anna.git diff --git a/example/diameter/launcher/resources_lite/configure.sh b/example/diameter/launcher/resources_lite/configure.sh new file mode 100755 index 0000000..335e4ff --- /dev/null +++ b/example/diameter/launcher/resources_lite/configure.sh @@ -0,0 +1,108 @@ +#!/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