6 SCR_DIR=`readlink -f $(dirname $0)`
7 PROJECT_ROOT=$(readlink -f ../../..)
8 SETUPS_DIR=$PROJECT_ROOT/source/diameter/stack/setups
9 MSGDTD=$PROJECT_ROOT/include/anna/diameter/codec/message.dtd
10 DCTDTD=$PROJECT_ROOT/include/anna/diameter/stack/dictionary.dtd
11 SERVICES=$SCR_DIR/resources/services_examples
12 STACK_EXAMPLES=$SCR_DIR/resources/stack_examples
13 SRVDTD=$SERVICES/services.dtd
25 echo "Usage: $0 [deployment_type: a|b|f|s] [deployment_path]"
27 echo " deployment_type:"
30 echo " f=function test client"
31 echo " s=system test client"
32 echo " deployment_path:"
33 echo " non-existent path directory."
36 echo " $0 b $HOME/ADML-basicServer"
37 echo " $0 b $HOME/ADML-MMSbalancer"
38 echo " $0 f $HOME/ADML-tester"
39 echo " $0 s $HOME/ADML-stress-client"
46 # Basic launcher 'run.sh' will be created at deployment configuration:
47 [ "$1" = "b" ] && return
50 [ "$1" = "a" ] && other="--httpServer \`grep -v ^# .httpServer\`"
51 [ "$1" = "f" ] && ln -s ADML-launcher $EXE
52 [ "$1" = "s" ] && { other="--disableLogs"; ln -s ADML-launcher $EXE ; }
54 echo "Creating 'run.sh' script ..."
60 STARTED=\`pgrep \$EXE$ 2>/dev/null\`
61 [ \$? -eq 0 ] && { echo "Already started!"; echo "\$STARTED" ; exit 1 ; }
64 rm -f counters/* test-reports/*
66 export LD_LIBRARY_PATH=\$PWD/dynlibs
67 ./\$EXE --services services.xml --cntDir counters --tmDir test-reports $other &
80 echo "---------------------------------------"
81 echo "Anna Diameter Launcher (ADML) deployment"
82 echo "---------------------------------------"
83 [ "$1" = "--help" -o "$1" = "-h" ] && usage
84 echo " (--help or -h for more info)"
86 echo "Basic checkings ..."
88 # Get variant and main executables:
89 [ -f $SCR_DIR/release/example_diameter_launcher ] && VARIANT=release
90 [ -f $SCR_DIR/debug/example_diameter_launcher ] && VARIANT=debug
91 [ -z "$VARIANT" ] && _exit "Cannot locate neither 'release' nor 'debug' variant !"
92 echo "Variant: $VARIANT"
93 ADML_EXEC=$SCR_DIR/$VARIANT/example_diameter_launcher
94 STACKMGMT_EXEC=$(readlink -f $SCR_DIR/../stackManagement/$VARIANT/example_diameter_stackManagement)
96 [ ! -d $SETUPS_DIR ] && _exit "Diameter stacks not found ($SETUPS_DIR)."
102 echo "Deploy one of these versions:"
104 echo " (a)dvanced version: includes burst management script and templates for different scenarios. Automatic configuration during start."
105 echo " (b)asic version: 4 types of launcher (client, server, balancer, dummy), lightly configured and managed through SIGURS2 method."
106 echo " (f)unction test client: special client with regexp scheduler script based on splitted traffic logs. Requires a server to perform the tests."
107 echo " (s)ystem test client: special client for stress testing. Requires a server/s to perform the tests."
109 echo "Input option [b]:"
111 [ "$option" = "" ] && option=b
118 echo "Advanced deployment"
119 DEPLOYMENTS_DIR=deployments/advanced
120 DPATH_dflt=$HOME/ADML-advanced
124 echo "Basic deployment"
125 DEPLOYMENTS_DIR=deployments/basic
126 DPATH_dflt=$HOME/ADML-basic
131 DEPLOYMENTS_DIR=deployments/ft-client
132 DPATH_dflt=$HOME/ADML-ft-client
137 DEPLOYMENTS_DIR=deployments/st-client
138 DPATH_dflt=$HOME/ADML-st-client
142 _exit "Invalid deployment type '$option' !!"
149 echo "Input deployment path [$DPATH_dflt]:"
151 [ "$DPATH" = "" ] && DPATH=$DPATH_dflt
156 [ -d $DPATH ] && _exit "The installation path '$DPATH' must not exists."
157 EXE=`basename $DPATH`
159 echo "Copying to '$DPATH' ..."
161 mkdir -p $DPATH/stacks
163 mkdir -p $DPATH/counters
164 mkdir -p $DPATH/test-reports
167 mkdir -p $DPATH/dynlibs
168 DYNLIBS=( $(find $PROJECT_ROOT -name "*.so" | grep -w $VARIANT) )
170 for dynlib in ${DYNLIBS[@]}
172 dynlib_bn=$(basename $dynlib)
173 if [ "$dynlib_bn" != "libanna_dynamicLauncherProcedure.so" ]
175 cp $dynlib $DPATH/dynlibs
177 ########## ADML Dynamic libs system ##########
178 # Create structure from $PROJECT_ROOT/dynamic/launcher
179 suffix_path=$(echo $dynlib | awk -F"$PROJECT_ROOT/dynamic/launcher/" '{ print $2 }')
180 target=$(dirname $DPATH/dynlibs/$(dirname $suffix_path))
184 # Additional resources
185 dynlib_dn=$(dirname $dynlib)
186 dynlib_dn_dn=$(dirname $dynlib_dn)
187 cp $dynlib_dn_dn/*.xml $target 2>/dev/null
188 cp $dynlib_dn_dn/dynamic.suffix $target 2>/dev/null
189 cp -r $dynlib_dn_dn/services $target 2>/dev/null
193 # ADML dynamic libs selection script:
194 cp $SCR_DIR/resources/scripts/select_dynlib.sh $DPATH/dynlibs/select.sh
196 # Default dynamic library:
198 ln -s default/libanna_dynamicLauncherProcedure.so
202 [ "$option" = "b" ] && mkdir -p $DPATH/services
205 cp $ADML_EXEC $DPATH/ADML-launcher
206 [ ! -f $DPATH/stacks/stack-mgmt ] && cp $STACKMGMT_EXEC $DPATH/stacks/stack-mgmt
209 cp -rL $DEPLOYMENTS_DIR/* $DPATH
210 cp $SETUPS_DIR/*xml $DPATH/stacks
211 cp $SETUPS_DIR/*sh $DPATH/stacks
212 cp $SETUPS_DIR/readme.txt $DPATH/stacks
213 mkdir $DPATH/stacks/other_examples
214 cp $STACK_EXAMPLES/* $DPATH/stacks/other_examples
215 cp $MSGDTD $DPATH/DTDs
216 cp $DCTDTD $DPATH/DTDs
217 cp $SRVDTD $DPATH/DTDs
218 [ "$option" = "b" ] && cp $SERVICES/* $DPATH/services
222 createRunScript $option
223 stacks/makeAutonomous.sh commands_qosControl.xml stacks/stack-mgmt >/dev/null
224 ln -s stacks/autonomous.commands_qosControl.xml dictionary.xml
227 if [ "$option" = "s" ]
230 ln -s services_example services
231 mv run.sh .run-one.sh
233 mv operation.sh .operation-one.sh
234 mv operation_all.sh operation.sh
241 echo "(see README at '$DPATH')"