X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2FDEPLOY.sh;h=906a0b2de2bfcc684af66da913b156998a0c36f8;hb=8b3eb3637cbe90fbabe70ec5667cce58cb7e368b;hp=d3725d351e339688f384b8fa9fd8fd9e0e4e74e8;hpb=2ddc4abd3627f5f5b4df32de199f364aa3844491;p=anna.git diff --git a/example/diameter/launcher/DEPLOY.sh b/example/diameter/launcher/DEPLOY.sh index d3725d3..906a0b2 100755 --- a/example/diameter/launcher/DEPLOY.sh +++ b/example/diameter/launcher/DEPLOY.sh @@ -6,9 +6,21 @@ SETUPS_DIR=../../../source/diameter/stack/setups MSGDTD=../../../include/anna/diameter/codec/message.dtd DCTDTD=../../../include/anna/diameter/stack/dictionary.dtd -BASE_PROT=commands_baseProtocol.xml -EXEC=./debug/example_diameter_launcher -DPATH_dflt=$HOME/ADL +SERVICES=./resources/services_examples +STACK_EXAMPLES=./resources/stack_examples +SRVDTD=$SERVICES/services.dtd + +# Executables in priority order: +EXEC_installed=/opt/bin/anna/example_diameter_launcher +EXECS=( $EXEC_installed ./release/example_diameter_launcher ./debug/example_diameter_launcher ) + +# Stack management +STACKMGMT_EXEC_installed=/opt/bin/anna/example_diameter_stackManagement +STACKMGMT_EXECS=( $STACKMGMT_EXEC_installed ../stackManagement/release/example_diameter_stackManagement ../stackManagement/debug/example_diameter_stackManagement ) + +# Dynamic library: +DYNLIB_installed=/usr/local/lib/libanna_dynamicLauncherProcedure.so +DYNLIBS=( $DYNLIB_installed ../../../dynamic/launcher/default/release/libanna_dynamicLauncherProcedure.so ../../../dynamic/launcher/default/debug/libanna_dynamicLauncherProcedure.so ) ############# # FUNCTIONS # @@ -17,55 +29,57 @@ _exit () { echo echo $1 echo - exit + exit 1 } +usage () { + echo "Usage: $0 [deployment_type: a|b|f|s] [deployment_path]" + echo + echo " deployment_type:" + echo " a=advanced" + echo " b=basic" + echo " f=function test client" + echo " s=system test client" + echo " deployment_path:" + echo " non-existent path directory." + echo + echo " For example:" + echo " $0 b $HOME/ADML-basicServer" + echo " $0 b $HOME/ADML-MMSbalancer" + echo " $0 f $HOME/ADML-tester" + echo " $0 s $HOME/ADML-stress-client" + echo + exit 0 +} + # $1: deployment type createRunScript () { - # Basic launcher 'run.sh' will be created at deployment configuration: [ "$1" = "b" ] && return - [ "$1" = "a" ] && exe=ADL-launcher - [ "$1" = "f" ] && { exe=ADL-ftclient ; ln -s ADL-launcher $exe ; } + + local other= + [ "$1" = "a" ] && other="--httpServer \`grep -v ^# .httpServer\`" + [ "$1" = "f" ] && ln -s ADML-launcher $EXE + [ "$1" = "s" ] && { other="--disableLogs"; ln -s ADML-launcher $EXE ; } + + echo "Creating 'run.sh' script ..." cat << EOF > run.sh #!/bin/bash cd \`dirname \$0\` -EXE=$exe -STARTED=\`pgrep \$EXE 2>/dev/null\` +EXE=$EXE +STARTED=\`pgrep \$EXE$ 2>/dev/null\` [ \$? -eq 0 ] && { echo "Already started!"; echo "\$STARTED" ; exit 1 ; } ./pre-start.sh -0> launcher.traces +0> launcher.trace +rm -f counters/* test-reports/* # Execution line: -./\$EXE -cntDir counters $(for i in `cat args.txt | grep -v "^#"`; do echo -n "$i "; done)& +export LD_LIBRARY_PATH=\$PWD +./\$EXE --services services.xml --cntDir counters --tmDir test-reports $other & echo \$! > .pid EOF 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 -n "${j}," >> .dictionary__${stack} - done - echo "stacks/$BASE_PROT,stacks/${stack}" >> .dictionary__${stack} - fi - done - - # Default: - ln -s .dictionary__commands_qosControl.xml .dictionary - - # Remove deps: - rm -f stacks/*.dep } ############# @@ -74,63 +88,146 @@ createDictionaryPaths () { cd `dirname $0` echo echo "---------------------------------------" -echo "Anna Diameter Launcher (ADL) deployment" +echo "Anna Diameter Launcher (ADML) deployment" echo "---------------------------------------" +[ "$1" = "--help" -o "$1" = "-h" ] && usage +echo " (--help or -h for more info)" 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..." - 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." + +# Launcher executable: +available= +for EXEC in ${EXECS[@]}; do + echo -n "Looking executable at '$EXEC' ... " + [ -x $EXEC ] && { available=yes ; echo "available !" ; break ; } + echo "not found" +done +[ -z "$available" ] && _exit "Anna Diameter Launcher (ADML) is not installed neither linked. See README.md (Install section)." + +# Dictionary creation: +available= +for STACKMGMT_EXEC in ${STACKMGMT_EXECS[@]}; do + echo -n "Looking stack management executable at '$STACKMGMT_EXEC' ... " + [ -x $STACKMGMT_EXEC ] && { available=yes ; echo "available !" ; break ; } + echo "not found" +done +[ -z "$available" ] && _exit "Anna Diameter Stack Management Tool is not installed neither linked. See README.md (Install section)." +STACKMGMT_EXEC=`readlink -f $STACKMGMT_EXEC` + +# Dynamic library: +available= +for DYNLIB in ${DYNLIBS[@]}; do + echo -n "Looking dynamic library at '$DYNLIB' ... " + [ -x $DYNLIB ] && { available=yes ; echo "available !" ; break ; } + echo "not found" +done +[ -z "$available" ] && _exit "Anna Diameter Launcher Dynamic Procedure Library (ADML) is not installed neither linked. See README.md (Install section)." + +[ ! -d $SETUPS_DIR ] && _exit "Diameter stacks not found ($SETUPS_DIR)." echo -echo "Deploy one of these versions:" -echo -echo " (a)dvanced version: includes burst management script and templates for different scenarios. Automatic configuration during start." -echo " (b)asic version: 4 types of launcher (client, server, balancer, dummy), lightly configured and managed through SIGURS2 method." -echo " (f)unction test client: special client with regexp scheduler script based on splitted traffic logs." -echo -echo "Input option [b]:" -read option -[ "$option" = "" ] && option=b +if [ "$1" = "" ] +then + echo + echo "Deploy one of these versions:" + echo + echo " (a)dvanced version: includes burst management script and templates for different scenarios. Automatic configuration during start." + echo " (b)asic version: 4 types of launcher (client, server, balancer, dummy), lightly configured and managed through SIGURS2 method." + echo " (f)unction test client: special client with regexp scheduler script based on splitted traffic logs. Requires a server to perform the tests." + echo " (s)ystem test client: special client for stress testing. Requires a server/s to perform the tests." + echo + echo "Input option [b]:" + read option + [ "$option" = "" ] && option=b +else + option=$1 +fi + case $option in a) - RESOURCES_DIR=resources/advanced + echo "Advanced deployment" + DEPLOYMENTS_DIR=deployments/advanced + DPATH_dflt=$HOME/ADML-advanced ;; b) - RESOURCES_DIR=resources/basic + echo "Basic deployment" + DEPLOYMENTS_DIR=deployments/basic + DPATH_dflt=$HOME/ADML-basic ;; f) - RESOURCES_DIR=resources/ft-client + echo "FT deployment" + DEPLOYMENTS_DIR=deployments/ft-client + DPATH_dflt=$HOME/ADML-ft-client + ;; + + s) + echo "ST deployment" + DEPLOYMENTS_DIR=deployments/st-client + DPATH_dflt=$HOME/ADML-st-client ;; *) - _exit "Unknown option !!" + _exit "Invalid deployment type '$option' !!" ;; esac -echo "Copying ..." +echo +if [ "$2" = "" ] +then + echo "Input deployment path [$DPATH_dflt]:" + read DPATH + [ "$DPATH" = "" ] && DPATH=$DPATH_dflt +else + DPATH=$2 +fi + +[ -d $DPATH ] && _exit "The installation path '$DPATH' must not exists." +EXE=`basename $DPATH` + +echo "Copying to '$DPATH' ..." mkdir -p $DPATH mkdir -p $DPATH/stacks mkdir -p $DPATH/DTDs mkdir -p $DPATH/counters -cp $EXEC $DPATH/ADL-launcher -cp -rL $RESOURCES_DIR/* $DPATH +mkdir -p $DPATH/test-reports +cp $DYNLIB $DPATH + +[ "$option" = "b" ] && mkdir -p $DPATH/services + +# ADML executable: +if [ "$EXEC" = "$EXEC_installed" ] +then + ln -s $EXEC_installed $DPATH/ADML-launcher +else + cp $EXEC $DPATH/ADML-launcher +fi + +# Stack management tool: +if [ "$STACKMGMT_EXEC" = "$STACKMGMT_EXEC_installed" ] +then + ln -s $STACKMGMT_EXEC_installed $DPATH/stacks/stack-mgmt +fi +# Copy binary just in case: +[ ! -f $DPATH/stacks/stack-mgmt ] && cp $STACKMGMT_EXEC $DPATH/stacks/stack-mgmt + +cp -rL $DEPLOYMENTS_DIR/* $DPATH cp $SETUPS_DIR/*xml $DPATH/stacks cp $SETUPS_DIR/*sh $DPATH/stacks cp $SETUPS_DIR/readme.txt $DPATH/stacks +mkdir $DPATH/stacks/other_examples +cp $STACK_EXAMPLES/* $DPATH/stacks/other_examples cp $MSGDTD $DPATH/DTDs cp $DCTDTD $DPATH/DTDs +cp $SRVDTD $DPATH/DTDs +[ "$option" = "b" ] && cp $SERVICES/* $DPATH/services echo "Preparing ..." cd $DPATH createRunScript $option -createDictionaryPaths +stacks/makeAutonomous.sh commands_qosControl.xml stacks/stack-mgmt >/dev/null +ln -s stacks/autonomous.commands_qosControl.xml dictionary.xml cd - >/dev/null # Help: