6 SCR_DIR=`readlink -f $(dirname $0)`
7 PROJECT_ROOT=$(readlink -f $SCR_DIR/../../..)
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 SCRIPTS=$SCR_DIR/resources/scripts
13 STACK_EXAMPLES=$SCR_DIR/resources/stack_examples
14 SRVDTD=$SERVICES/services.dtd
26 echo "Usage: $0 [deployment_type: a|b|f|s] [deployment_path]"
28 echo " deployment_type:"
31 echo " f=function test client"
32 echo " s=system test client"
33 echo " deployment_path:"
34 echo " non-existent path directory."
37 echo " $0 b $HOME/ADML-basicServer"
38 echo " $0 b $HOME/ADML-MMSbalancer"
39 echo " $0 f $HOME/ADML-tester"
40 echo " $0 s $HOME/ADML-stress-client"
47 # Basic launcher 'run.sh' will be created at deployment configuration:
48 [ "$1" = "b" ] && return
51 [ "$1" = "a" ] && other="--httpServer \`grep -v ^# .httpServer\`"
52 [ "$1" = "f" ] && ln -s ADML $EXE
53 [ "$1" = "s" ] && { other="--disableLogs"; ln -s ADML $EXE ; }
55 echo "Creating 'run.sh' script ..."
61 STARTED=\`pgrep \$EXE$ 2>/dev/null\`
62 [ \$? -eq 0 ] && { echo "Already started!"; echo "\$STARTED" ; exit 1 ; }
65 rm -f counters/* test-reports/*
67 export LD_LIBRARY_PATH=\$PWD/dynlibs
68 ./\$EXE --services services.xml --cntDir counters --tmDir test-reports $other &
70 renice -n 5 -p \$(cat .pid)
81 echo "---------------------------------------"
82 echo "Anna Diameter Launcher (ADML) deployment"
83 echo "---------------------------------------"
84 [ "$1" = "--help" -o "$1" = "-h" ] && usage
85 echo " (--help or -h for more info)"
87 echo "Basic checkings ..."
89 # Get variant and main executables:
90 [ -d $PROJECT_ROOT/build/Release ] && VARIANT=Release
91 [ -d $PROJECT_ROOT/build/Debug ] && VARIANT=Debug
92 [ -z "$VARIANT" ] && _exit "Cannot locate neither 'Release' nor 'Debug' variant !"
93 echo "Variant: $VARIANT"
94 BIN_DIR=$PROJECT_ROOT/build/$VARIANT/bin
95 LIB_DIR=$PROJECT_ROOT/build/$VARIANT/lib
98 ADML_EXEC=$BIN_DIR/anna_diameter_launcher
99 STACKMGMT_EXEC=$BIN_DIR/anna_diameter_stackManagement
101 [ ! -d $SETUPS_DIR ] && _exit "Diameter stacks not found ($SETUPS_DIR)."
107 echo "Deploy one of these versions:"
109 echo " (a)dvanced version: includes burst management script and templates for different scenarios. Automatic configuration during start."
110 echo " (b)asic version: 4 types of launcher (client, server, balancer, dummy), lightly configured and managed through SIGURS2 method."
111 echo " (f)unction test client: special client with regexp scheduler script based on splitted traffic logs. Requires a server to perform the tests."
112 echo " (s)ystem test client: special client for stress testing. Requires a server/s to perform the tests."
114 echo "Input option [b]:"
116 [ "$option" = "" ] && option=b
123 echo "Advanced deployment"
124 DEPLOYMENTS_DIR=deployments/advanced
125 DPATH_dflt=$HOME/ADML-advanced
129 echo "Basic deployment"
130 DEPLOYMENTS_DIR=deployments/basic
131 DPATH_dflt=$HOME/ADML-basic
136 DEPLOYMENTS_DIR=deployments/ft-client
137 DPATH_dflt=$HOME/ADML-ft-client
142 DEPLOYMENTS_DIR=deployments/st-client
143 DPATH_dflt=$HOME/ADML-st-client
147 _exit "Invalid deployment type '$option' !!"
154 echo "Input deployment path [$DPATH_dflt]:"
156 [ "$DPATH" = "" ] && DPATH=$DPATH_dflt
161 [ -d $DPATH ] && _exit "The installation path '$DPATH' must not exists."
162 EXE=`basename $DPATH`
164 echo "Copying to '$DPATH' ..."
167 mkdir -p $DPATH/counters
168 mkdir -p $DPATH/test-reports
171 cp -r $LIB_DIR/dynamic/launcher $DPATH/dynlibs
172 cp $LIB_DIR/libanna_testing_shared.so $DPATH/dynlibs
174 # Get stuff from leaf directories:
175 cd $LIB_DIR/dynamic/launcher
176 leafs=( $(find . -type d -links 2) )
179 cd $PROJECT_ROOT/dynamic/launcher
180 for dir in ${leafs[@]}
182 cp $dir/*.xml $DPATH/dynlibs/$dir 2>/dev/null
183 cp $dir/dynamic.suffix $DPATH/dynlibs/$dir 2>/dev/null
184 cp -r $dir/services $DPATH/dynlibs/$dir 2>/dev/null
188 # ADML dynamic libs selection script:
189 cp $SCR_DIR/resources/scripts/select_dynlib.sh $DPATH/dynlibs/select.sh
191 # Default dynamic library:
193 ln -s default/libanna_launcher_procedure_default_shared.so
197 [ "$option" = "b" ] && mkdir -p $DPATH/services
200 cp -rL $DEPLOYMENTS_DIR/* $DPATH
201 mkdir -p $DPATH/stack_examples/other
202 cp $STACK_EXAMPLES/* $DPATH/stack_examples/other
203 cp $SETUPS_DIR/*xml $DPATH/stack_examples
204 cp $SETUPS_DIR/*sh $DPATH/stack_examples
205 cp $SETUPS_DIR/readme.txt $DPATH/stack_examples
206 cp $MSGDTD $DPATH/DTDs
207 cp $DCTDTD $DPATH/DTDs
208 cp $SRVDTD $DPATH/DTDs
209 [ "$option" = "b" ] && cp $SERVICES/* $DPATH/services
210 cp $SCRIPTS/clone.sh $DPATH
211 cp $SCRIPTS/tinyTestcase.sh $DPATH
214 cp $ADML_EXEC $DPATH/ADML
215 [ ! -f $DPATH/stack_examples/stack-mgmt ] && cp $STACKMGMT_EXEC $DPATH/stack_examples/stack-mgmt
217 echo "Default stack dynamic generation ..."
219 createRunScript $option
220 stack_examples/makeAutonomous.sh commands_qosControl.xml stack_examples/stack-mgmt >/dev/null
221 ln -s stack_examples/autonomous.commands_qosControl.xml dictionary.xml
224 if [ "$option" = "s" ]
227 #ln -s services_example services
228 mv run.sh .run-one.sh
230 mv operation.sh .operation-one.sh
231 mv operation_all.sh operation.sh
238 echo "(see README at '$DPATH')"