echo "Preparing ..."
cd $DPATH
createRunScript $option
-stacks/makeAutonomous.sh commands_qosControl.xml ./stack-mgmt >/dev/null
+stacks/makeAutonomous.sh commands_qosControl.xml stacks/stack-mgmt >/dev/null
ln -s stacks/autonomous.commands_qosControl.xml dictionary.xml
cd - >/dev/null
const anna::xml::Attribute *vm_attr = (*it)->getAttribute("validationMode", false /* no exception */);
const anna::xml::Attribute *vd_attr = (*it)->getAttribute("validationDepth", false /* no exception */);
const anna::xml::Attribute *fm_attr = (*it)->getAttribute("fixMode", false /* no exception */);
- const anna::xml::Attribute *if_attr = (*it)->getAttribute("ignoreFlags", false /* no exception */);
+ const anna::xml::Attribute *if_attr = (*it)->getAttribute("ignoreFlagsOnValidation", false /* no exception */);
std::string vm_value = vm_attr ? vm_attr->getValue() : "AfterDecoding";
std::string vd_value = vd_attr ? vd_attr->getValue() : "FirstError";
it->second->asXML(result);
}
+ // Registered codec engines:
+ anna::diameter::codec::EngineManager &em = anna::diameter::codec::EngineManager::instantiate();
+ em.asXML(result);
+
// OAM & statistics:
oamAsXML(result);
statsAsXML(result);
echo "ADML SYSTEM TEST CONFIGURATION WIZARD"
echo "====================================="
echo
-[ -d ADMLS ] && _exit "ADMLS directory still exists. Please remove it to continue (perhaps you have to 'pkill ADML' before) !"
+[ -d ADMLS ] && _exit "ADMLS directory still exists. Please remove it to continue (you may have to 'pkill ADML' before) !"
[ ! -d services ] && _exit "Missing services configuration (expecting '$PWD/services' directory) !"
calculate_deployment_layout
echo "Creating ADML instance $instance ..."
mkdir -p ADMLS/ADML-$instance
cd ADMLS/ADML-$instance
+ mkdir counters
+ mkdir test-reports
# Create resources:
ln -s ../../.operation-one.sh operation.sh
ln -s ../../pre-start.sh
echo -n "Instance `basename $dn_op`: "
0>launcher.trace
./operation.sh $@
+ [ $? -ne 0 ] && { echo ; exit 1 ; }
cd - >/dev/null
done
+echo
+exit 0
+
usage() {
echo "Usage: $0 <test stuff directory> [-s]"
echo
+ echo " Performs test case programming from scratch (current test cases will be dropped from ADML involved instances)."
+ echo
echo " test stuff directory: contains msk files, specially a testcase description with xml files referenced."
echo " Those files, adding .msk extension, shall exists in the same directory. For example:"
+ echo
echo " $0 st_examples/DynamicQualification"
echo
echo " -s: start testing just after programming, using desired rate: $DESIRED_RATE test cases per second."
echo
[ -z "$1" ] && usage
+./operation.sh --ping
+[ $? -ne 0 ] && _exit "Programming aborted (some ADML client process is not running) !"
TESTCASE_DIR=$1
AUTOSTART=$2
done
sleep 1
-echo "Now you could program the tests by mean script 'program.sh'. For example:"
-echo " ./program.sh st_examples/DynamicQualification"
+echo
echo
echo "To enable reports dump for failed tests, execute:"
echo " ./operation.sh \"test|report|failed\""
echo "To stop the processes, you could execute:"
echo " pgrep ADML-[0-9] | xargs kill"
echo
+echo "When running, use script 'program.sh' to configure the test cases."
+echo "To program again, you should execute './configure.sh' script to"
+echo " change the current testing setup."
+echo
echo "Done!"
+echo
<services>
<!-- Stacks -->
- <stack id="16777238" dictionary="dictionaryGx.xml"/>
- <stack id="16777236" dictionary="dictionaryRx.xml"/>
+ <stack id="16777238" dictionary="dictionaryGx.xml" ignoreFlagsOnValidation="yes"/>
+ <stack id="16777236" dictionary="dictionaryRx.xml" ignoreFlagsOnValidation="yes"/>
<stack id="0" dictionary="dictionaryBase.xml"/>
<!-- Nodes -->
#!/bin/bash
+#####################################################
+#### ####
+## ##
+# THIS SCRIPT IS NORMALLY INTENDED FOR INTERNAL USE #
+## ##
+#### ####
+#####################################################
#############
# VARIABLES #
#MAX_NUMBER_GROUPS=400
MAX_NUMBER_GROUPS=200
# (depends on the machine)
+CLONE_EXTRA_VARS_SCR_BN=clone-extra-vars.sh
#############
# FUNCTIONS #
echo " testcase variable file: path to the testcase file with parseable variables, for example '<directory>/testcase.txt.msk'."
echo " xml files within this test case, must exist with aditional .msk extension in the same directory."
echo
- echo " Currently, 9 variables are supported to be replaced:"
+ echo " Currently, 4 variables are supported to be replaced:"
echo
echo " * __TESTID__ : sequence number. For example if you provide 1 to 20 for this script, it will be 1 .. 20"
echo " * __SEQ8__ : 8-digit number corresponding to the sequence number (00000001 for 1, and so on)"
echo " * __IPV4HEX__ : hexadecimal IPv4 address, for example: 00000001"
echo " * __IPV4__ : IPv4 address, for example: 0.0.0.1"
echo
- #echo " One variant (former ones plus 1):"
- #echo " __SEQ8P1__ : 8-digit number corresponding to the sequence number (00000002 for 1, and so on)"
- #echo " __IPV4HEXP1__: hexadecimal IPv4 address, for example: 00000002"
- #echo " __IPV4P1__ : IPv4 address, for example: 0.0.0.2"
- #echo
- echo " Edit the variables section to add more special values if you need them."
+ echo " Optionally (when exists), a user defined file '$CLONE_EXTRA_VARS_SCR_BN' is sourced to extend the parseable"
+ echo " variables used within the test case stuff (this script must be placed on that directory). The script"
+ echo " will be called with the sequence number as argument during clone procedure, and shall define the needed"
+ echo " variable values referenced in the parsed files. The variables must be named as '__<name>__' which ensures"
+ echo " that main clone script environment is not contaminated."
echo
echo " initial sequence: initial sequence number to parse over variables."
echo " final sequence: final sequence number to parse over variables."
local wkdir=$2
mkdir -p $wkdir
- ############################################# SPECIAL VARIABLES SECTION #############################################
- ################################ EDIT THIS SECTION IF YOU NEED NEW SPECIAL VARIABLES ################################
+ ############################################# VARIABLES SECTION #############################################
testid=$sequence
seq8=$(printf "%08d" $testid)
- #seq8_p1=$((seq8+1))
ipv4hex=$seq8
- #ipv4hex_p1=$seq8_p1
- #ipv4=$(for i in $(echo $seq8 | sed 's/\(..\)/0x\1 /g'); do printf "%d." $i; done | sed 's/\.$/\n/')
# Numbers beginning with "0" are treated as octal (i.e. base-8): we would have 'invalid octal number with 08 and 09'
# Solution: convert to base-10 in this way: $((10#$i))
ipv4=$(for i in $(echo $seq8 | sed 's/\(..\)/ \1 /g'); do printf "%d." $((10#$i)); done | sed 's/\.$/\n/')
- #ipv4_p1=$(for i in $(echo $seq8_p1 | sed 's/\(..\)/ \1 /g'); do printf "%d." $((10#$i)); done | sed 's/\.$/\n/')
-
- local target=$wkdir/values.${1}
- echo "__TESTID__=$testid" > $target
- echo "__SEQ8__=$seq8" >> $target
- echo "__IPV4HEX__=$ipv4hex" >> $target
- echo "__IPV4__=$ipv4" >> $target
- ## First variant:
- #echo "__SEQ8P1__=$seq8_p1" >> $target
- #echo "__IPV4HEXP1__=$ipv4hex_p1" >> $target
- #echo "__IPV4P1__=$ipv4_p1" >> $target
- source $target
- #rm $target
- ######################################### END SPECIAL VARIABLES SECTION #########################################
+ __TESTID__=$testid
+ __SEQ8__=$seq8
+ __IPV4HEX__=$ipv4hex
+ __IPV4__=$ipv4
+ [ -n "$extra_vars" ] && source $CLONE_EXTRA_VARS_SCR_FILE $sequence
+ ######################################### END VARIABLES SECTION #########################################
# Parse template files:
parse_file $sequence $TESTCASE_TEMPLATE $wkdir/testcase.txt.$sequence
POPULATION=$6
POPULATION_FILE=$TESTCASE_TEMPLATE_DIR/$POPULATION
POPULATION_ALL=$TESTCASE_TEMPLATE_DIR/${POPULATION}.all
+CLONE_EXTRA_VARS_SCR_FILE=$TESTCASE_TEMPLATE_DIR/$CLONE_EXTRA_VARS_SCR_BN
+extra_vars=
+[ -f $CLONE_EXTRA_VARS_SCR_FILE ] && extra_vars=yes
[ "$4" = "" ] && usage
children_before=$(children)
offset=0
$OPERATION "test|clear"
+[ $? -ne 0 ] && _exit "Clone aborted: failed to clean tests !"
echo "Please be patient, this may take a while ..."
#echo "Temporary directory: $CLONE_WKDIR"
for group in `seq 1 $((N_GROUPS+1))`
usage() {
echo
- echo "Usage: $0 [-h|--help] [-t|--timeout <value>] [-f|--file] <data>"
+ echo "Usage: $0 [-h|--help] [-t|--timeout <value>] [-f|--file] [-p|--ping] <data>"
echo
echo " -h|--help: this usage help."
echo " -t|--timeout: timeout for operation in seconds."
echo " with one operation per line. If missing, it will be"
echo " a single operation string."
echo
+ echo " -p|--ping: Check the target process id."
+ echo " Returns 1 (dead) or 0 (alive)."
+ echo
echo " data: operation string or file with several operations."
echo
echo " For example:"
is_file=
timeout=$TIMEOUT__dflt
data=
+ ping=
while [ $# -gt 0 ]; do
case $1 in
shift
;;
+ -p|--ping)
+ ping=yes
+ ;;
+
*)
first=$(echo $1 | cut -c1)
[ "$first" = "-" ] && _exit "Unsupported script option: $1. Type '$SCR_BN -h' (or --help) to print the available options."
shift
done
- [ -z "$data" ] && _exit "Missing data value"
+ [ -z "$ping" -a -z "$data" ] && _exit "Missing data value"
}
# $1: pid to check
check_pid() {
kill -0 $1 2>/dev/null
- [ $? -ne 0 ] && _exit "Operation error: missing process with pid $1"
+ return $?
}
#############
[ "$1" = "" -o "$1" = "--help" -o "$1" = "-h" ] && usage
parse_arguments $@
+# Check pid:
+check_pid $PID
+res=$?
+[ -n "$ping" ] && exit $res
+[ $res -ne 0 ] && _exit "Operation error: missing process with pid $PID"
+
# Send operation:
if [ -n "$is_file" ]
then
xmlmsg += a_messageCodec->asXMLString();
xmlmsg += "\n";
}
+ else {
+ xmlmsg = "<unable to decode, check traces>";
+ }
if (msg != "") result->createAttribute("Message", msg);
if (xmlmsg != "") result->createAttribute("XMLMessage", xmlmsg);
xmlmsg += a_messageCodec->asXMLString();
xmlmsg += "\n";
}
+ else {
+ xmlmsg = "<unable to decode, check traces>";
+ }
if (msg != "") result->createAttribute("MatchedMessage", msg);
if (xmlmsg != "") result->createAttribute("MatchedXMLMessage", xmlmsg);
namespace anna {
+namespace xml {
+ class Node;
+
+}
namespace diameter {
namespace codec {
*/
bool selectFromApplicationId (void) throw() { return a_autoSelectFromApplicationId; }
+ /**
+ Class XML representation.
+ \param parent XML node over which we will put instance information.
+ \return XML documentcon with class content.
+ */
+ virtual anna::xml::Node* asXML(anna::xml::Node* parent) const throw();
+
friend class anna::Singleton <EngineManager>;
};
// Project
#include <anna/diameter/codec/EngineManager.hpp>
+#include <anna/diameter/codec/Engine.hpp>
#include <anna/diameter/stack/Engine.hpp>
#include <anna/diameter/stack/Dictionary.hpp>
#include <anna/core/tracing/Logger.hpp>
+#include <anna/xml/Node.hpp>
+
using namespace anna::diameter::codec;
if (!engine) return; // nothing done
a_appid_codec_engines[appid] = engine;
}
+
+anna::xml::Node* EngineManager::asXML(anna::xml::Node* parent) const
+throw() {
+ anna::xml::Node* result = parent->createChild("EngineManager");
+ appid_codec_engines_it it_min(a_appid_codec_engines.begin());
+ appid_codec_engines_it it_max(a_appid_codec_engines.end());
+ for (appid_codec_engines_it it = it_min; it != it_max; it++)
+ it->second->asXML(result);
+
+ return result;
+}