Optimiza deployment time
authorEduardo Ramos Testillano <eduardo.ramos.testillano@ericsson.com>
Sun, 29 Nov 2015 22:19:30 +0000 (23:19 +0100)
committerEduardo Ramos Testillano <eduardo.ramos.testillano@ericsson.com>
Sun, 29 Nov 2015 22:19:30 +0000 (23:19 +0100)
example/diameter/launcher/DEPLOY.sh
example/diameter/launcher/DEPLOY_setups.sh
source/diameter/stack/setups/makeAutonomous.sh [new file with mode: 0755]

index 93754ac..edcb4fc 100755 (executable)
@@ -6,7 +6,6 @@
 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
 SERVICES=./resources/services_examples
 STACK_EXAMPLES=./resources/stack_examples
 SRVDTD=$SERVICES/services.dtd
@@ -78,42 +77,6 @@ EOF
   chmod a+x run.sh
 }
 
-createDictionaryPaths () {
-  echo "Creating dictionaries ..."
-
-  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
-
-  # Create autonomous dictionaries:
-  mkdir stacks/autonomous
-  for i in `ls .dictionary-*`
-  do
-    name=$(echo $i | cut -d\- -f2)
-    $STACKMGMT_EXEC `cat $i` >/dev/null
-    mv result.xml stacks/autonomous/$name
-  done
-
-  # Cleanup:
-  rm -f stacks/*.dep
-  rm -f .dictionary-*
-  rm -f example_diameter_stackManagement.trace*
-
-  # Default:
-  ln -s stacks/autonomous/commands_qosControl.xml dictionary.xml
-}
-
 #############
 # EXECUTION #
 #############
@@ -214,12 +177,23 @@ mkdir -p $DPATH/DTDs
 mkdir -p $DPATH/counters
 mkdir -p $DPATH/test-reports
 [ "$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
+else
+  cp $STACKMGMT_EXEC $DPATH/stack-mgmt
+fi
+
 cp -rL $DEPLOYMENTS_DIR/* $DPATH
 cp $SETUPS_DIR/*xml $DPATH/stacks
 cp $SETUPS_DIR/*sh $DPATH/stacks
@@ -234,7 +208,8 @@ cp $SRVDTD $DPATH/DTDs
 echo "Preparing ..."
 cd $DPATH
 createRunScript $option
-createDictionaryPaths
+stacks/makeAutonomous.sh commands_qosControl.xml ./stack-mgmt
+ln -s stacks/autonomous.commands_qosControl.xml dictionary.xml
 cd - >/dev/null
 
 # Help:
index 3483c9f..42332a6 100755 (executable)
@@ -110,10 +110,12 @@ case $type in
     cd $target/ADML-serverGx
     echo s | ./configure.sh >/dev/null
     sed -i 's/3868/3869/' services.xml
+    # Gx dictionary:
     ln -sf stacks/other_examples/16777238.xml dictionary.xml
     cd - >/dev/null
     cd $target/ADML-serverRx
     echo s | ./configure.sh >/dev/null
+    # Rx dictionary:
     ln -sf stacks/other_examples/16777236.xml dictionary.xml
     cd - >/dev/null
   ;;
diff --git a/source/diameter/stack/setups/makeAutonomous.sh b/source/diameter/stack/setups/makeAutonomous.sh
new file mode 100755 (executable)
index 0000000..92939d7
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+#############
+# VARIABLES #
+#############
+BASE_PROTOCOL_XML=commands_baseProtocol.xml
+
+#############
+# FUNCTIONS #
+#############
+_exit () {
+  echo
+  echo $1
+  echo
+  exit 1
+}
+
+usage () {
+  echo
+  echo
+  echo "Usage: makeAutonomous.sh <incomplete dictionary> <stack management executable>"
+  echo
+  echo "       For example:"
+  echo "          makeAutonomous.sh commands_qosControl.xml ./stack-mgmt"
+  echo
+  echo "       A new dictionary will be created: autonomous.commands_qosControl.xml"
+  _exit
+}
+
+#############
+# EXECUTION #
+#############
+[ -z "$2" ] && usage
+
+COMMAND_XML=$1
+[ "$COMMAND_XML" = "$BASE_PROTOCOL_XML" ] && _exit "$COMMAND_XML skipped !"
+
+STACK_EXE=$2
+target=autonomous.${COMMAND_XML}
+cd `dirname $0`
+
+echo -n "Creating $target ... "
+0>.dict_list
+./dependence.sh $COMMAND_XML >/dev/null
+for i in `cat ${COMMAND_XML}.dep`; do echo -n "$i " >> .dict_list ; done
+echo "$BASE_PROTOCOL_XML $COMMAND_XML" >> .dict_list
+
+# Create autonomous dictionary:
+$STACK_EXE `cat .dict_list` >/dev/null
+mv result.xml $target
+
+# Cleanup:
+rm -f *.dep
+rm -f example_diameter_stackManagement.trace*
+rm .dict_list
+echo "Done!"
+