Launcher resources refactoring. New type included: FT testing client.
[anna.git] / example / diameter / launcher / resources / ft-client / pre-start.sh
diff --git a/example/diameter/launcher/resources/ft-client/pre-start.sh b/example/diameter/launcher/resources/ft-client/pre-start.sh
new file mode 100755 (executable)
index 0000000..b1863af
--- /dev/null
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+# Remove logs:
+rm *.log* *.csv 2>/dev/null
+
+# Client sockets:
+entity_dflt=`cat .entity 2>/dev/null`
+entityServerSessions_dflt=`cat .entityServerSessions 2>/dev/null`
+
+# Stack:
+dictionary_dflt=`cat .dictionary 2>/dev/null`
+
+echo
+echo
+# If all have values:
+if [ "$entity_dflt" != ""  -a "$entityServerSessions_dflt" != "" -a "$dictionary_dflt" != "" ]
+then
+  echo "Do you wish to answer wizard commandline configuration ? (y/n) [n]:"
+  read wizard
+  [ "$wizard" = "" ] && wizard=n
+  [ "$wizard" = "n" ] && exit
+fi
+
+# DEFAULTS
+#[ "$entity_dflt" = "" ] && entity_dflt="192.168.12.11:3868,192.168.12.21:3868"
+[ "$entity_dflt" = "" ] && entity_dflt="localhost:3868"
+[ "$entityServerSessions_dflt" = "" ] && entityServerSessions_dflt=10
+[ "$dictionary_dflt" = "" ] && dictionary_dflt=dictionary.xml
+
+
+# Wizard
+echo "Diameter dictionary: you could use '/opt/bin/anna/example_diameter_stackManagement' tool in order to build"
+echo " autonomous dictionaries for any kind of application. The key is to concatenate xml contents (ietf, 3gpp,"
+echo " vendor-specific, etc.). See 'example/diameter/stackManagement/self_ruling_setups.sh' for this."
+echo
+echo "This launcher can also join them providing a comma-separated list (dictionaries available on ./stack)."
+echo "By default, a QoS Application setup is suggested. Input the desired configuration instead, or press ENTER:"
+echo
+echo " [$dictionary_dflt]:"
+read dictionary
+[ "$dictionary" = "" ] && dictionary=$dictionary_dflt
+
+# As client:
+echo "Diameter entity server sessions (0: diameter entity disabled) [$entityServerSessions_dflt]:"
+read entityServerSessions
+[ "$entityServerSessions" = "" ] && entityServerSessions=$entityServerSessions_dflt
+
+entity=
+if test "$entityServerSessions" != "0"
+then
+  echo "Target diameter entity (pipe-separated <ip|hostname>:<port> socket literal list) ["$entity_dflt"]:"
+  read entity
+fi
+[ "$entity" = "" ] && entity="$entity_dflt"
+
+# Configure:
+echo $dictionary > .dictionary
+echo $entity > .entity
+echo $entityServerSessions > .entityServerSessions
+
+echo
+echo
+