From 09f74ebd57cd733b52ad48ba482bc406b1ce91f6 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Fri, 15 Jan 2016 13:42:22 +0100 Subject: [PATCH] Improvs. Initial version for tinyTestcase creation --- .../resources/scripts/tinyTestcase.sh | 72 +++++++++++++++++++ .../tsharkDecoder.sh} | 6 ++ 2 files changed, 78 insertions(+) create mode 100755 example/diameter/launcher/resources/scripts/tinyTestcase.sh rename example/diameter/{launcher/resources/scripts/pcap2diameterHex.sh => pcapDecoder/tsharkDecoder.sh} (98%) diff --git a/example/diameter/launcher/resources/scripts/tinyTestcase.sh b/example/diameter/launcher/resources/scripts/tinyTestcase.sh new file mode 100755 index 0000000..e08120f --- /dev/null +++ b/example/diameter/launcher/resources/scripts/tinyTestcase.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +############# +# VARIABLES # +############# +SCR_DIR=`readlink -f $0 | xargs dirname` + +############# +# FUNCTIONS # +############# +_exit() { + echo + echo -e $1 + echo + exit 1 +} + +usage() { + echo "Usage: $0 " + echo + echo " The source directory may contain .xml and .metadata files grouped by pairs and alphabetically classified:" + echo + echo " 11.hex.as.xml 15.hex.as.xml 19.hex.as.xml ..." + echo " 11.metadata 15.metadata 19.metadata ..." + echo " 13.hex.as.xml 17.hex.as.xml 21.hex.as.xml ..." + echo " 13.metadata 17.metadata 21.metadata ..." + echo + echo " Normally the order comes from first dot-separated part, which is the decoded frame from pcap:" + echo + echo " 11.hex.as.xml: would be the ANNA-Diameter decoded message from hexadecimal sniffed one." + echo " 11.metadata: would contain parsed metadata from tshark or another fulfilling this information:" + echo + echo " date=Sat Dec 19 11:50:55 CET 2015" + echo " timestamp=1450522255.205673000" + echo " src=gentraf" + echo " dst=testbed" + echo " code=257" + echo " isrequest=1" + echo " applicationid=0" + echo + echo " Presented example has been achieved using the 'example/diameter/pcapDecoder/tsharkDecoder.sh' script" + echo " and then decoding with 'example/diameter/batchConverter' tool with appropiate diameter dictionaries." + echo + echo " This script will create a basic testcase based on frames timeline (11, 13, 15, etc.), from the desired" + echo " end-point. For example, from the 'gentraf' point of view, outgoing requests will be translated as send" + echo " operations with corresponding waits for answers and successful result code (2001). CER/A are detected" + echo " creating a symbolic link to better reference them, and DPR/A are ignored." + echo + echo " The resulting 'testcase.txt' will have all the operations needed to program the test case and will be" + echo " written on same source directory referencing xml files as local-relative ones. Probably, 'change-dir'" + echo " operation will be used before programming to ease the procedure without having to copy the stuff into" + echo " installed ADML execution directory." + echo + echo " Connection issues (CER/A), disconnect procedures (DPR/A), database populations and sanity checks are" + echo " not responsability for this script. Such operations shall be externally performed to guarantee that" + echo " programming this testcase is going to be valid in context of test execution." + _exit +} + +############# +# EXECUTION # +############# +cd $SCR_DIR +source ../../configure.sh +echo +SOURCE_DIR=$1 +[ -z "$SOURCE_DIR" ] && usage +SOURCE_DIR=`readlink -f $SOURCE_DIR` +[ ! -d "$SOURCE_DIR" ] && _exit "Can't found provided directory '$SOURCE_DIR'" + +# UNDER CONSTRUCTION +# ......... diff --git a/example/diameter/launcher/resources/scripts/pcap2diameterHex.sh b/example/diameter/pcapDecoder/tsharkDecoder.sh similarity index 98% rename from example/diameter/launcher/resources/scripts/pcap2diameterHex.sh rename to example/diameter/pcapDecoder/tsharkDecoder.sh index 355b70f..64fd44b 100755 --- a/example/diameter/launcher/resources/scripts/pcap2diameterHex.sh +++ b/example/diameter/pcapDecoder/tsharkDecoder.sh @@ -36,6 +36,8 @@ # cisco.tierra@gmail.com +# Decoder version using tshark tool + ############# # VARIABLES # ############# @@ -92,6 +94,10 @@ echo PCAP_FILE=$1 [ ! -f $PCAP_FILE ] && _exit "Cannot found provided pcap file '$1' !!" +# Tshark available: +which tshark >/dev/null +[ $? -ne 0 ] && _exit "Missing 'tshark' tool !!" + # Optional result dir: RESULTS_DIR=`dirname $PCAP_FILE` [ "$2" != "" ] && RESULTS_DIR=$2 -- 2.20.1