Commit d03f78a4 authored by gauthier's avatar gauthier

Cleaned xml output, now a S1C test scenario is generated, ready to be parsed.

parent 12b87108
......@@ -162,24 +162,47 @@ add_definitions(-DCMAKER)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2")
# Below has been put in comment because does not work with
# SVN authentication.
#
#find_package(Subversion)
#if(SUBVERSION_FOUND)
# Subversion_WC_INFO(${OPENAIR_DIR} openair)
# set (FIRMWARE_VERSION "${openair_WC_REVISION} - ${openair_WC_LAST_CHANGED_DATE}")
# Subversion_WC_LOG(${OPENAIR_DIR} Project)
#else()
# set (FIRMWARE_VERSION "No svn information")
#endif()
#add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"")
set(GIT_BRANCH "UNKNOWN")
set(GIT_COMMIT_HASH "UNKNOWN")
set(GIT_COMMIT_DATE "UNKNOWN")
find_package(Git)
if(GIT_FOUND)
message("git found: ${GIT_EXECUTABLE}")
# Get the current working branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get the latest commit date of the working branch
execute_process(
COMMAND git log -1 --format=%cd
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
# Below is a hard-coded info
set (FIRMWARE_VERSION "No svn information")
add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"")
add_definitions("-DPACKAGE_VERSION=\"${FIRMWARE_VERSION}\"")
add_definitions("-DPACKAGE_BUGREPORT=\"OpenAirInterface web site\"")
add_definitions("-DPACKAGE_VERSION=\"Branch: ${GIT_BRANCH} Abrev. Hash: ${GIT_COMMIT_HASH} Date: ${GIT_COMMIT_DATE}\"")
add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"")
......@@ -1615,6 +1638,7 @@ endforeach(myExe)
add_executable(test_epc_generate_scenario
${OPENAIR3_DIR}/TEST/EPC_TEST/generate_scenario.c
${OPENAIR3_DIR}/TEST/EPC_TEST/generate_scenario.h
${OPENAIR2_DIR}/ENB_APP/enb_config.h
${OPENAIR2_DIR}/COMMON/commonDef.h
${OPENAIR2_DIR}/COMMON/messages_def.h
......@@ -1626,6 +1650,20 @@ target_link_libraries (test_epc_generate_scenario
-Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
)
add_executable(test_epc_play_scenario
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.c
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.h
${OPENAIR2_DIR}/ENB_APP/enb_config.h
${OPENAIR2_DIR}/COMMON/commonDef.h
${OPENAIR2_DIR}/COMMON/messages_def.h
${OPENAIR2_DIR}/COMMON/messages_types.h
${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h
${OPENAIR_BIN_DIR}/messages_xml.h
)
target_link_libraries (test_epc_play_scenario
-Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
)
#unitary tests for Core NEtwork pieces
#################################
......
......@@ -121,6 +121,7 @@ function main()
echo "Cleaning TEST_EPC"
fi
rm -f $OPENAIR_DIR/targets/bin/test_epc_generate_scenario
rm -f $OPENAIR_DIR/targets/bin/test_epc_play_scenario
rm -Rf build 2>&1
mkdir -m 777 -p -v build
fi
......@@ -140,6 +141,9 @@ function main()
compilations \
epc_test test_epc_generate_scenario \
test_epc_generate_scenario $dbin/test_epc_generate_scenario
compilations \
epc_test test_epc_play_scenario \
test_epc_play_scenario $dbin/test_epc_play_scenario
}
......
......@@ -253,7 +253,7 @@ static const eutra_band_t eutra_bands[] = {
Enb_properties_array_t enb_properties;
static void enb_config_display(void)
void enb_config_display(void)
{
int i,j;
......
......@@ -239,6 +239,7 @@ typedef struct Enb_properties_array_s {
Enb_properties_t *properties[MAX_ENB];
} Enb_properties_array_t;
void enb_config_display(void);
const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP);
const Enb_properties_array_t *enb_config_get(void);
......
......@@ -100,11 +100,10 @@ Enb_properties_array_t g_enb_properties;
char *g_openair_dir = NULL;
char *g_test_dir = NULL;
char *g_pdml_in_origin = NULL;
char *g_generic_scenario = NULL;
extern int xmlLoadExtDtdDefaultValue;
#define GENERATE_PDML_FILE 1
#define GENERATE_GENERIC_SCENARIO 2
#define GENERATE_SCENARIO 2
#define GS_IS_FILE 1
#define GS_IS_DIR 2
......@@ -172,14 +171,14 @@ int split_path( char * pathP, char *** resP)
}
//------------------------------------------------------------------------------
int generate_generic_scenario(const char const * test_nameP, const char const * pdml_in_basenameP)
int generate_test_scenario(const char const * test_nameP, const char const * pdml_in_basenameP)
//------------------------------------------------------------------------------
{
//int fd_pdml_in;
xsltStylesheetPtr cur = NULL;
xmlDocPtr doc, res;
FILE *generic_scenario_file = NULL;
const char generic_scenario_filename[NAME_MAX];
FILE *test_scenario_file = NULL;
const char test_scenario_filename[NAME_MAX];
const char *params[2*ENB_CONFIG_MAX_XSLT_PARAMS];
int nb_params = 0;
int i,j;
......@@ -187,7 +186,7 @@ int generate_generic_scenario(const char const * test_nameP, const char const *
char *astring2 = NULL;
struct in_addr addr;
memset(generic_scenario_filename, 0, sizeof(generic_scenario_filename));
memset(test_scenario_filename, 0, sizeof(test_scenario_filename));
memset(astring, 0, sizeof(astring));
if (getcwd(astring, sizeof(astring)) != NULL) {
fprintf(stdout, "working in %s directory\n", astring);
......@@ -249,16 +248,16 @@ int generate_generic_scenario(const char const * test_nameP, const char const *
res = xsltApplyStylesheet(cur, doc, params);
if (NULL != res) {
// since pdml filename is not relative (no path), just filename in current directory we can safely remove
sprintf(generic_scenario_filename,"%s",pdml_in_basenameP);
if (strip_extension(generic_scenario_filename) > 0) {
strcat(generic_scenario_filename, "_generic_scenario.xml");
generic_scenario_file = fopen( generic_scenario_filename, "w+");
if (NULL != generic_scenario_file) {
xsltSaveResultToFile(generic_scenario_file, res, cur);
fclose(generic_scenario_file);
fprintf(stdout, "Wrote generic scenario to %s\n", generic_scenario_filename);
sprintf(test_scenario_filename,"%s",pdml_in_basenameP);
if (strip_extension(test_scenario_filename) > 0) {
strcat(test_scenario_filename, ".xml");
test_scenario_file = fopen( test_scenario_filename, "w+");
if (NULL != test_scenario_file) {
xsltSaveResultToFile(test_scenario_file, res, cur);
fclose(test_scenario_file);
fprintf(stdout, "Wrote test scenario to %s\n", test_scenario_filename);
} else {
fprintf(stderr, "Error in fopen(%s)\n", generic_scenario_filename);
fprintf(stderr, "Error in fopen(%s)\n", test_scenario_filename);
}
} else {
fprintf(stderr, "Error in strip_extension()\n");
......@@ -537,17 +536,17 @@ static void usage (
char *argv[])
//------------------------------------------------------------------------------
{
fprintf (stdout, "Please report any bug to: openair4g-devel@lists.eurecom.fr\n\n");
fprintf (stdout, "Please report any bug to: %s\n",PACKAGE_BUGREPORT);
fprintf (stdout, "Usage: %s [options]\n\n", argv[0]);
fprintf (stdout, "\n");
fprintf (stdout, "Mandatory options:\n");
fprintf (stdout, "\t-t | --test-dir <dir> Directory where a set of files related to a particular test are located\n");
fprintf (stdout, "\t-c | --enb-conf-file <file> Provide the old eNB config file for generating a copy of the original test\n");
fprintf (stdout, "\t-d | --test-dir <dir> Directory where a set of files related to a particular test are located\n");
fprintf (stdout, "\t-p | --pdml <file> File name (with no path) in 'test-dir' directory of an original scenario that has to be reworked (IP addresses) with new testbed\n");
fprintf (stdout, "\n");
fprintf (stdout, "Available options:\n");
fprintf (stdout, "Other options:\n");
fprintf (stdout, "\t-h | --help Print this help and return\n");
fprintf (stdout, "\t-o | --old-enb-conf-file <file> Provide the old eNB config file for generating a copy of the original test\n");
fprintf (stdout, " This option is set as many times as there are some eNB config files in the original test\n");
fprintf (stdout, "\t-p | --pdml <file> File name (with no path) of an original scenario that has to be reworked (IP addresses) with new testbed\n");
fprintf (stdout, "\n");
fprintf (stdout, "\t-v | --version Print informations about the version of this executable\n");
fprintf (stdout, "\n");
fprintf (stdout, "Example of generate_scenario use case: \n");
fprintf (stdout, "\n");
......@@ -558,16 +557,16 @@ static void usage (
fprintf (stdout, " |\n");
fprintf (stdout, " mme_test_s1_pcap2pdml --pcap_file <`captured pcap-ng file`>\n");
fprintf (stdout, " |\n");
fprintf (stdout, " +--------V----------+ +------------------------+\n");
fprintf (stdout, " |'pdml-in-orig' file| |'old-enb-conf-file' file|\n");
fprintf (stdout, " +--------+----------+ +------------+-----------+\n");
fprintf (stdout, " +--------V----------+ +--------------------+\n");
fprintf (stdout, " |'pdml-in-orig' file| |'enb-conf-file' file|\n");
fprintf (stdout, " +--------+----------+ +--------------------+\n");
fprintf (stdout, " | |\n");
fprintf (stdout, " +----------------------------+\n");
fprintf (stdout, " |\n");
fprintf (stdout, " generate_scenario -t <dir> -p <'pdml-in-orig' file> -o <'old-enb-conf-file' file> \n");
fprintf (stdout, " generate_scenario -d <dir> -p <'pdml-in-orig' file> -c <'enb-conf-file' file> \n");
fprintf (stdout, " |\n");
fprintf (stdout, " +------------V--------------+\n");
fprintf (stdout, " +'xml-scenario-generic' file|\n");
fprintf (stdout, " +'xml-test-scenario' file |\n");
fprintf (stdout, " +---------------------------+\n");
fprintf (stdout, "\n");
}
......@@ -581,37 +580,39 @@ config_parse_opt_line (
{
int option;
int rv = 0;
char *old_enb_config_file_name = NULL;
char *enb_config_file_name = NULL;
char *pdml_in_file_name = NULL;
char *test_dir_name = NULL;
enum long_option_e {
LONG_OPTION_START = 0x100, /* Start after regular single char options */
LONG_OPTION_OLD_ENB_CONF_FILE,
LONG_OPTION_ENB_CONF_FILE,
LONG_OPTION_PDML,
LONG_OPTION_TEST_DIR,
LONG_OPTION_HELP,
LONG_OPTION_VERSION,
};
static struct option long_options[] = {
{"old-enb-conf-file", required_argument, 0, LONG_OPTION_OLD_ENB_CONF_FILE},
{"pdml ", required_argument, 0, LONG_OPTION_PDML},
{"test-dir", required_argument, 0, LONG_OPTION_TEST_DIR},
{"help", required_argument, 0, LONG_OPTION_HELP},
{"enb-conf-file", required_argument, 0, LONG_OPTION_ENB_CONF_FILE},
{"pdml ", required_argument, 0, LONG_OPTION_PDML},
{"test-dir", required_argument, 0, LONG_OPTION_TEST_DIR},
{"help", no_argument, 0, LONG_OPTION_HELP},
{"version", no_argument, 0, LONG_OPTION_VERSION},
{NULL, 0, NULL, 0}
};
/*
* Parsing command line
*/
while ((option = getopt_long (argc, argv, "hp:n:o:s:t:", long_options, NULL)) != -1) {
while ((option = getopt_long (argc, argv, "vhp:n:c:s:d:", long_options, NULL)) != -1) {
switch (option) {
case LONG_OPTION_OLD_ENB_CONF_FILE:
case 'o':
case LONG_OPTION_ENB_CONF_FILE:
case 'c':
if (optarg) {
old_enb_config_file_name = optarg;
printf("Old eNB config file name is %s\n", old_enb_config_file_name);
rv |= GENERATE_GENERIC_SCENARIO;
enb_config_file_name = optarg;
printf("eNB config file name is %s\n", enb_config_file_name);
rv |= GENERATE_SCENARIO;
}
break;
......@@ -620,12 +621,12 @@ config_parse_opt_line (
if (optarg) {
pdml_in_file_name = strdup(optarg);
printf("PDML input file name is %s\n", pdml_in_file_name);
rv |= GENERATE_GENERIC_SCENARIO;
rv |= GENERATE_SCENARIO;
}
break;
case LONG_OPTION_TEST_DIR:
case 't':
case 'd':
if (optarg) {
test_dir_name = strdup(optarg);
if (is_file_exists(test_dir_name, "test dirname") != GS_IS_DIR) {
......@@ -636,6 +637,12 @@ config_parse_opt_line (
}
break;
case LONG_OPTION_VERSION:
case 'v':
printf("Version %s\n", PACKAGE_VERSION);
exit (0);
break;
case LONG_OPTION_HELP:
case 'h':
default:
......@@ -652,14 +659,14 @@ config_parse_opt_line (
fprintf(stderr, "Error: chdir %s returned %s\n", g_test_dir, strerror(errno));
exit(1);
}
if (rv & GENERATE_GENERIC_SCENARIO) {
if (NULL == old_enb_config_file_name) {
if (rv & GENERATE_SCENARIO) {
if (NULL == enb_config_file_name) {
fprintf(stderr, "Error: please provide the original eNB config file name that should be in %s\n", g_test_dir);
}
if (is_file_exists(old_enb_config_file_name, "Old eNB config file") != GS_IS_FILE) {
fprintf(stderr, "Error: original eNB config file name %s is not found in dir %s\n", old_enb_config_file_name, g_test_dir);
if (is_file_exists(enb_config_file_name, "ENB config file") != GS_IS_FILE) {
fprintf(stderr, "Error: eNB config file name %s is not found in dir %s\n", enb_config_file_name, g_test_dir);
}
enb_config_init(old_enb_config_file_name);
enb_config_init(enb_config_file_name);
enb_config_display();
if (NULL == pdml_in_file_name) {
......@@ -688,8 +695,8 @@ int main( int argc, char **argv )
memset((char*) &g_enb_properties, 0 , sizeof(g_enb_properties));
actions = config_parse_opt_line (argc, argv); //Command-line options
if (actions & GENERATE_GENERIC_SCENARIO) {
generate_generic_scenario(g_test_dir, g_pdml_in_origin);
if (actions & GENERATE_SCENARIO) {
generate_test_scenario(g_test_dir, g_pdml_in_origin);
}
return 0;
......
File mode changed from 100755 to 100644
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/xhtml1/strict">
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output
method="xml"
indent="yes"
encoding="iso-8859-1"
/>
<xsl:output
method="xml"
indent="yes"
encoding="iso-8859-1"
/>
<!-- Ugly but no time to find a better way in XSLT 1.0 (map/list)-->
<xsl:param name="enb_s1c0" select="'0.0.0.0'"/>
<xsl:param name="enb_s1c1" select="'0.0.0.0'"/>
<xsl:param name="enb_s1c2" select="'0.0.0.0'"/>
<xsl:param name="enb_s1c3" select="'0.0.0.0'"/>
<xsl:param name="enb_s1c4" select="'0.0.0.0'"/>
<xsl:param name="enb_s1c5" select="'0.0.0.0'"/>
<xsl:param name="enb_s1c6" select="'0.0.0.0'"/>
<xsl:param name="enb_s1c7" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c0_0" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c0_1" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c0_2" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c0_3" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c1_0" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c1_1" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c1_2" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c1_3" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c2_0" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c2_1" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c2_2" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c2_3" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c3_0" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c3_1" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c3_2" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c3_3" select="'0.0.0.0'"/>
<xsl:param name="ip_address" select="'0.0.0.0'"/>
<!-- Ugly but no time to find a better way in XSLT 1.0 (map/list)-->
<xsl:param name="enb_s1c0" select="'0.0.0.0'"/>
<xsl:param name="enb_s1c1" select="'0.0.0.0'"/>
<xsl:param name="enb_s1c2" select="'0.0.0.0'"/>
<xsl:param name="enb_s1c3" select="'0.0.0.0'"/>
<xsl:param name="enb_s1c4" select="'0.0.0.0'"/>
<xsl:param name="enb_s1c5" select="'0.0.0.0'"/>
<xsl:param name="enb_s1c6" select="'0.0.0.0'"/>
<xsl:param name="enb_s1c7" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c0_0" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c0_1" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c0_2" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c0_3" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c1_0" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c1_1" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c1_2" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c1_3" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c2_0" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c2_1" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c2_2" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c2_3" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c3_0" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c3_1" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c3_2" select="'0.0.0.0'"/>
<xsl:param name="mme_s1c3_3" select="'0.0.0.0'"/>
<xsl:param name="ip_address" select="'0.0.0.0'"/>
<xsl:template name="reverse_ip">
<xsl:param name="ip_address"/>
<xsl:choose>
<xsl:template name="reverse_ip">
<xsl:param name="ip_address"/>
<xsl:choose>
<xsl:when test="$ip_address=$enb_s1c0">enb_s1c0</xsl:when>
<xsl:when test="$ip_address=$enb_s1c1">enb_s1c1</xsl:when>
<xsl:when test="$ip_address=$enb_s1c2">enb_s1c2</xsl:when>
<xsl:when test="$ip_address=$enb_s1c3">enb_s1c3</xsl:when>
<xsl:when test="$ip_address=$enb_s1c4">enb_s1c4</xsl:when>
<xsl:when test="$ip_address=$enb_s1c5">enb_s1c5</xsl:when>
<xsl:when test="$ip_address=$enb_s1c6">enb_s1c6</xsl:when>
<xsl:when test="$ip_address=$enb_s1c7">enb_s1c7</xsl:when>
<xsl:when test="$ip_address=$mme_s1c0_0">mme_s1c0_0</xsl:when>
<xsl:when test="$ip_address=$mme_s1c0_1">mme_s1c0_1</xsl:when>
<xsl:when test="$ip_address=$mme_s1c0_2">mme_s1c0_2</xsl:when>
<xsl:when test="$ip_address=$mme_s1c0_3">mme_s1c0_3</xsl:when>
<xsl:when test="$ip_address=$mme_s1c1_0">mme_s1c1_0</xsl:when>
<xsl:when test="$ip_address=$mme_s1c1_1">mme_s1c1_1</xsl:when>
<xsl:when test="$ip_address=$mme_s1c1_2">mme_s1c1_2"</xsl:when>
<xsl:when test="$ip_address=$mme_s1c1_2">mme_s1c1_2</xsl:when>
<xsl:when test="$ip_address=$mme_s1c1_3">mme_s1c1_3</xsl:when>
<xsl:otherwise>reverse_ip_yourself</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:when test="$ip_address=$mme_s1c2_0">mme_s1c2_0</xsl:when>
<xsl:when test="$ip_address=$mme_s1c2_1">mme_s1c2_1</xsl:when>
<xsl:when test="$ip_address=$mme_s1c2_2">mme_s1c2_2</xsl:when>
<xsl:when test="$ip_address=$mme_s1c2_3">mme_s1c2_3</xsl:when>
<xsl:when test="$ip_address=$mme_s1c3_0">mme_s1c3_0</xsl:when>
<xsl:when test="$ip_address=$mme_s1c3_1">mme_s1c3_1</xsl:when>
<xsl:when test="$ip_address=$mme_s1c3_2">mme_s1c3_2</xsl:when>
<xsl:when test="$ip_address=$mme_s1c3_3">mme_s1c3_3</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">ERROR: Cannot reverse resolv IP <xsl:value-of select="."/> !
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="chunktype2str">
<xsl:param name="chunk_type"/>
<xsl:template name="chunktype2str">
<xsl:param name="chunk_type"/>
<xsl:choose>
<xsl:when test="$chunk_type='00'">DATA</xsl:when>
<xsl:when test="$chunk_type='01'">INIT</xsl:when>
<xsl:when test="$chunk_type='02'">INIT_ACK</xsl:when>
<xsl:when test="$chunk_type='03'">SACK</xsl:when>
<xsl:when test="$chunk_type='04'">HEARTBEAT</xsl:when>
<xsl:when test="$chunk_type='05'">HEARTBEAT_ACK</xsl:when>
<xsl:when test="$chunk_type='06'">ABORT</xsl:when>
<xsl:when test="$chunk_type='07'">SHUTDOWN</xsl:when>
<xsl:when test="$chunk_type='08'">SHUTDOWN_ACK</xsl:when>
<xsl:when test="$chunk_type='09'">ERROR</xsl:when>
<xsl:when test="$chunk_type='0a'">COOKIE_ECHO</xsl:when>
<xsl:when test="$chunk_type='0b'">COOKIE_ACK</xsl:when>
<xsl:when test="$chunk_type='0c'">ECNE</xsl:when>
<xsl:when test="$chunk_type='0d'">CWR</xsl:when>
<xsl:when test="$chunk_type='0e'">SHUTDOWN_COMPLETE</xsl:when>
<xsl:otherwise>UNKNOWN_CHUNK_TYPE</xsl:otherwise>
<xsl:when test="$chunk_type='00'">DATA</xsl:when>
<xsl:when test="$chunk_type='01'">INIT</xsl:when>
<xsl:when test="$chunk_type='02'">INIT_ACK</xsl:when>
<xsl:when test="$chunk_type='03'">SACK</xsl:when>
<xsl:when test="$chunk_type='04'">HEARTBEAT</xsl:when>
<xsl:when test="$chunk_type='05'">HEARTBEAT_ACK</xsl:when>
<xsl:when test="$chunk_type='06'">ABORT</xsl:when>
<xsl:when test="$chunk_type='07'">SHUTDOWN</xsl:when>
<xsl:when test="$chunk_type='08'">SHUTDOWN_ACK</xsl:when>
<xsl:when test="$chunk_type='09'">ERROR</xsl:when>
<xsl:when test="$chunk_type='0a'">COOKIE_ECHO</xsl:when>
<xsl:when test="$chunk_type='0b'">COOKIE_ACK</xsl:when>
<xsl:when test="$chunk_type='0c'">ECNE</xsl:when>
<xsl:when test="$chunk_type='0d'">CWR</xsl:when>
<xsl:when test="$chunk_type='0e'">SHUTDOWN_COMPLETE</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">ERROR: UNKNOWN CHUNK TYPE <xsl:value-of select="."/> !
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:template>
<xsl:strip-space elements="pdml packet proto field"/>
<xsl:strip-space elements="pdml packet proto field"/>
<xsl:template match="/">
<xsl:template match="/">
<scenario name="{$test_name}">
<xsl:apply-templates/>
<xsl:apply-templates/>
</scenario>
</xsl:template>
</xsl:template>
<xsl:template match="proto[@name='frame']">
<xsl:template match="proto[@name='frame']">
<xsl:variable name="time_relative" select="field[@name='frame.time_relative']/@show"/>
<xsl:variable name="ip" select="proto[@name='ip']"/>
<xsl:variable name="ip.src">
<xsl:call-template name="reverse_ip">
<xsl:with-param name="ip_address" select="$ip/field[@name='ip.src']/@show"/>
</xsl:call-template>
<xsl:variable name="ip_src">
<xsl:call-template name="reverse_ip">
<xsl:with-param name="ip_address" select="$ip/field[@name='ip.src']/@show"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="ip.dst">
<xsl:call-template name="reverse_ip">
<xsl:with-param name="ip_address" select="$ip/field[@name='ip.dst']/@show"/>
</xsl:call-template>
<xsl:variable name="ip_dst">
<xsl:call-template name="reverse_ip">
<xsl:with-param name="ip_address" select="$ip/field[@name='ip.dst']/@show"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="action">
<xsl:choose>
<xsl:when test="starts-with($ip_src,'enb_s1')">SEND</xsl:when>
<xsl:when test="starts-with($ip_src,'mme_s1c')">RECEIVE</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">ERROR: UNKNOWN ACTION <xsl:value-of select="."/> !
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="$ip/proto[@name='sctp']">
<xsl:variable name="sctp.data_sid" select="./field[@name='sctp.data_sid']/@show"/>
<xsl:variable name="sctp.srcport" select="./field[@name='sctp.srcport']/@show"/>
<xsl:variable name="sctp.dstport" select="./field[@name='sctp.dstport']/@show"/>
<xsl:variable name="sctp.data_ssn" select="./field[@name='sctp.data_ssn']/@show"/>
<xsl:variable name="sctp.data_payload_proto_id" select="./field[@name='sctp.data_payload_proto_id']/@show"/>
<xsl:variable name="sctp.chunk_type_str">
<xsl:call-template name="chunktype2str">
<xsl:with-param name="chunk_type" select="./field/field[@name='sctp.chunk_type']/@value"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="sctp_pos_offset" select="./@pos"/>
<xsl:variable name="sctp_data_sid" select="./field/field[@name='sctp.data_sid']/@show"/>
<!-- TODO resolv problem of 2 SCTP packets in 1 IP packet: src and dst ports are not in the 2nd SCTP packet -->
<xsl:variable name="sctp_srcport" select="./field[@name='sctp.srcport']/@show"/>
<xsl:variable name="sctp_dstport" select="./field[@name='sctp.dstport']/@show"/>
<xsl:variable name="sctp_data_ssn" select="./field/field[@name='sctp.data_ssn']/@show"/>
<xsl:variable name="sctp_data_payload_proto_id" select="./field/field[@name='sctp.data_payload_proto_id']/@show"/>
<xsl:variable name="sctp_chunk_type_str">
<xsl:call-template name="chunktype2str">
<xsl:with-param name="chunk_type" select="./field/field[@name='sctp.chunk_type']/@value"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="sctp_pos_offset" select="./@pos"/>
<xsl:choose>
<xsl:when test="$sctp.chunk_type_str='DATA'">
<xsl:for-each select="./proto[@name='s1ap']">
<xsl:choose>
<xsl:when test="$sctp_chunk_type_str='DATA'">
<xsl:for-each select="./proto[@name='s1ap']">
<xsl:variable name="s1ap_pos_offset" select="./@pos"/>
<payload name="{$sctp.chunk_type_str}">
<frame.time_relative value="{$time_relative}"/>
<payload name="{$sctp_chunk_type_str}" action="{$action}">
<frame.time_relative value="{$time_relative}"/>
<!-- TODO: pos_offset(substract it from all pos_offsets in s1ap, may depend on which test scenario protocol target S1AP/NAS or NAS only...)-->
<pos_offset value="{$s1ap_pos_offset}"/>
<ip.src value="{$ip.src}"/>
<ip.dst value="{$ip.dst}"/>
<sctp.data_sid value="{$sctp.data_sid}"/>
<sctp.srcport value="{$sctp.srcport}"/>
<sctp.dstport value="{$sctp.dstport}"/>
<sctp.data_ssn value="{$sctp.data_ssn}"/>
<sctp.data_payload_proto_id value="{$sctp.data_payload_proto_id}"/>
<sctp.chunk_type_str value="{$sctp.chunk_type_str}"/>
<xsl:copy-of select="node()"/>
<!-- TODO: pos_offset(substract it from all pos_offsets in s1ap, may depend on which test scenario protocol target S1AP/NAS or NAS only...)-->
<pos_offset value="{$s1ap_pos_offset}"/>
<ip.src value="{$ip_src}"/>
<ip.dst value="{$ip_dst}"/>
<sctp.data_sid value="{$sctp_data_sid}"/>
<sctp.srcport value="{$sctp_srcport}"/>
<sctp.dstport value="{$sctp_dstport}"/>
<sctp.data_ssn value="{$sctp_data_ssn}"/>
<sctp.data_payload_proto_id value="{$sctp_data_payload_proto_id}"/>
<sctp.chunk_type_str value="{$sctp_chunk_type_str}"/>
<xsl:copy-of select="node()"/>
</payload>
</xsl:for-each>
</xsl:when>
<xsl:when test="$sctp.chunk_type_str='INIT'">
<xsl:variable name="sctp.init_nr_out_streams" select="./field/field[@name='sctp.init_nr_out_streams']/@show"/>
<xsl:variable name="sctp.init_nr_in_streams" select="./field/field[@name='sctp.init_nr_in_streams']/@show"/>
<xsl:variable name="sctp.init_initial_tsn" select="./field/field[@name='sctp.init_initial_tsn']/@show"/>
<payload name="{$sctp.chunk_type_str}">
<frame.time_relative value="{$time_relative}"/>
<!-- TODO: pos_offset(substract it from all pos_offsets in s1ap, may depend on which test scenario protocol target S1AP/NAS or NAS only...)-->
<pos_offset value="{$sctp_pos_offset}"/>
<ip.src value="{$ip.src}"/>
<ip.dst value="{$ip.dst}"/>
<sctp.data_sid value="{$sctp.data_sid}"/>
<sctp.srcport value="{$sctp.srcport}"/>
<sctp.dstport value="{$sctp.dstport}"/>
<sctp.init_nr_in_streams value="{$sctp.init_nr_in_streams}"/>
<sctp.init_nr_out_streams value="{$sctp.init_nr_out_streams}"/>
<sctp.init_initial_tsn value="{$sctp.init_initial_tsn}"/>
<sctp.chunk_type_str value="{$sctp.chunk_type_str}"/>
<!--xsl:copy-of select="node()"/-->
</payload>
</xsl:when>
<xsl:when test="$sctp.chunk_type_str='INIT_ACK'">
<xsl:variable name="sctp.initack_nr_out_streams" select="./field/field[@name='sctp.initack_nr_out_streams']/@show"/>
<xsl:variable name="sctp.initack_nr_in_streams" select="./field/field[@name='sctp.initack_nr_in_streams']/@show"/>
<xsl:variable name="sctp.initack_initial_tsn" select="./field/field[@name='sctp.initack_initial_tsn']/@show"/>
<payload name="{$sctp.chunk_type_str}">
<frame.time_relative value="{$time_relative}"/>
<!-- TODO: pos_offset(substract it from all pos_offsets in s1ap, may depend on which test scenario protocol target S1AP/NAS or NAS only...)-->
<pos_offset value="{$sctp_pos_offset}"/>
<ip.src value="{$ip.src}"/>
<ip.dst value="{$ip.dst}"/>
<sctp.data_sid value="{$sctp.data_sid}"/>
<sctp.srcport value="{$sctp.srcport}"/>
<sctp.dstport value="{$sctp.dstport}"/>
<sctp.initack_nr_in_streams value="{$sctp.initack_nr_in_streams}"/>
<sctp.initack_nr_out_streams value="{$sctp.initack_nr_out_streams}"/>
<sctp.initack_initial_tsn value="{$sctp.initack_initial_tsn}"/>
<sctp.chunk_type_str value="{$sctp.chunk_type_str}"/>
<!--xsl:copy-of select="node()"/-->
</payload>
</xsl:when>
<!--xsl:when test="$sctp.chunk_type_str='SACK'"> </xsl:when-->
<!--xsl:when test="$sctp.chunk_type_str='HEARTBEAT'"></xsl:when-->
<!--xsl:when test="$sctp.chunk_type_str='HEARTBEAT_ACK'"></xsl:when-->
<xsl:when test="$sctp.chunk_type_str='ABORT'">
<payload name="{$sctp.chunk_type_str}">
<frame.time_relative value="{$time_relative}"/>
<!-- TODO: pos_offset(substract it from all pos_offsets in s1ap, may depend on which test scenario protocol target S1AP/NAS or NAS only...)-->
<pos_offset value="{$sctp_pos_offset}"/>
<ip.src value="{$ip.src}"/>
<ip.dst value="{$ip.dst}"/>
<sctp.data_sid value="{$sctp.data_sid}"/>
<sctp.srcport value="{$sctp.srcport}"/>
<sctp.dstport value="{$sctp.dstport}"/>
<sctp.chunk_type_str value="{$sctp.chunk_type_str}"/>
<xsl:copy-of select="node()"/>
</payload>
</xsl:when>
<xsl:when test="$sctp.chunk_type_str='SHUTDOWN'">
<payload name="{$sctp.chunk_type_str}">
<frame.time_relative value="{$time_relative}"/>
<!-- TODO: pos_offset(substract it from all pos_offsets in s1ap, may depend on which test scenario protocol target S1AP/NAS or NAS only...)-->
<pos_offset value="{$sctp_pos_offset}"/>
<ip.src value="{$ip.src}"/>
<ip.dst value="{$ip.dst}"/>
<sctp.data_sid value="{$sctp.data_sid}"/>
<sctp.srcport value="{$sctp.srcport}"/>
<sctp.dstport value="{$sctp.dstport}"/>
<sctp.chunk_type_str value="{$sctp.chunk_type_str}"/>
<xsl:copy-of select="node()"/>
</payload>
</xsl:when>
<!--xsl:when test="$sctp.chunk_type_str='SHUTDOWN_ACK'"></xsl:when-->