Commit 612d5878 authored by gauthier's avatar gauthier

Removed from this repo epc xsl files, commiting for sync

parent 0397ba15
......@@ -30,7 +30,7 @@
################################################################################
# file build_helper
# brief
# author Laurent Thomas
# authors Laurent Thomas, Lionel GAUTHIER
#
#######################################
SUDO='sudo -E'
......@@ -301,6 +301,183 @@ install_nas_tools() {
fi
}
#################################################
# 3. Network interfaces utilities
################################################
cidr2mask(){
local i mask=""
local full_octets=$(($1/8))
local partial_octet=$(($1%8))
for ((i=0;i<4;i+=1)); do
if [ $i -lt $full_octets ]; then
mask+=255
elif [ $i -eq $full_octets ]; then
mask+=$((256 - 2**(8-$partial_octet)))
else
mask+=0
fi
test $i -lt 3 && mask+=.
done
echo $mask
}
# example: netcalc 192.168.12.100 255.255.255.0
netcalc(){
local IFS='.' ip i
local -a oct msk
read -ra oct <<<"$1"
read -ra msk <<<"$2"
for i in ${!oct[@]}; do
ip+=( "$(( oct[i] & msk[i] ))" )
done
echo "${ip[*]}"
}
# example:
bcastcalc(){
local IFS='.' ip i
local -a oct msk
read -ra oct <<<"$1"
read -ra msk <<<"$2"
for i in ${!oct[@]}; do
ip+=( "$(( oct[i] + ( 255 - ( oct[i] | msk[i] ) ) ))" )
done
echo "${ip[*]}"
}
is_real_interface(){
my_bool=1
for var in "$@"
do
if [ "a$var" == "a" ]; then
return 0
fi
if [ "a$var" == "anone" ]; then
return 0
fi
IF=`cat /etc/udev/rules.d/70-persistent-net.rules | grep $var | sed 's/^.*NAME=//' | tr -d '"'`
if [ "$IF" == "$var" ]; then
if [ "a${var:0:3}" != "aeth" ]; then
if [ "a${var:0:4}" != "awlan" ]; then
if [ "a${var:0:4}" != "awifi" ]; then
my_bool=0;
fi
fi
fi
fi
done
return $my_bool
}
is_virtual_interface(){
my_bool=1
for var in "$@"
do
if [ "a$var" == "a" ]; then
return 0
fi
if [ "a$var" == "anone" ]; then
return 0
fi
num=`expr index "$var" :`
if [ $num -eq 0 ]; then
my_bool=0;
fi
done
return $my_bool
}
# arg1 = interface name
# arg2 = ipv4 addr cidr
set_interface_up(){
interface=$1
address=${2%/*} #part before '/'
cidr_netmask=${2#*/} # part after '/'
if [ "a${interface:0:4}" == "anone" ]; then
return;
fi
echo "ifconfig $interface up"
$SUDO ifconfig $interface up
sync
netmask=`cidr2mask $cidr_netmask`
broadcast=`bcastcalc $address $netmask`
echo "ip -4 addr add $address/$cidr_netmask broadcast $broadcast dev $interface"
$SUDO ip -4 addr add $address/$cidr_netmask broadcast $broadcast dev $interface
sync
}
# arg1 = interface name
# arg2 = ipv4 addr cidr
set_virtual_interface_up(){
interface=$1
address=${2%/*} #part before '/'
cidr_netmask=${2#*/} # part after '/'
if [ "a${interface:0:4}" == "anone" ]; then
return;
fi
$SUDO ifconfig $interface down > /dev/null 2>&1
sync
echo "ifconfig $interface $address up"
$SUDO ifconfig $interface $address up
sync
}
#arg1 is interface name
#arg2 is IP address (CIDR)
set_network_interface(){
local interface_name=$1
local ip_cidr=$2
is_virtual_interface $interface_name
if [ $? -eq 1 ]; then
echo "$interface_name is virtual interface"
set_virtual_interface_up $interface_name $ip_cidr
else
is_real_interface $interface_name
if [ $? -eq 1 ]; then
echo "$interface_name is real interface"
set_interface_up $interface_name $ip_cidr
else
echo_warning "$interface_name not handled, not configuring it"
return
fi
fi
}
# arg1 is a 'libconfig-like' config file
set_epc_network_interfaces(){
value="`cat $1 | cut -d "#" -f1 | grep 'ADDRESS\|INTERFACE' | tr -d " " | grep "="`"
eval $value
# check all var names are correct
list_var_name="\
ENB_INTERFACE_NAME_FOR_S1_MME ENB_IPV4_ADDRESS_FOR_S1_MME \
ENB_INTERFACE_NAME_FOR_S1U ENB_IPV4_ADDRESS_FOR_S1U "
for var_name in $list_var_name
do
if [ -n "$${var_name}" ]; then
echo_success "Found ${var_name} = ${!var_name}"
else
echo_fatal "${var_name} does does not exist in your config file $1"
fi
done
# configure interfaces
set_network_interface $ENB_INTERFACE_NAME_FOR_S1_MME $ENB_IPV4_ADDRESS_FOR_S1_MME
set_network_interface $ENB_INTERFACE_NAME_FOR_S1U $ENB_IPV4_ADDRESS_FOR_S1U
}
......
......@@ -148,7 +148,6 @@ function main()
$SUDO cp -upv test_epc_generate_scenario /usr/local/bin
$SUDO cp -upv test_epc_play_scenario /usr/local/bin
$SUDO cp -upv $OPENAIR_DIR/openair3/TEST/EPC_TEST/mme_test_s1_pcap2pdml /usr/local/bin
}
......
......@@ -97,7 +97,6 @@
#define ENB_CONFIG_MAX_XSLT_PARAMS 32
Enb_properties_array_t g_enb_properties;
char *g_openair_dir = NULL;
char *g_test_dir = NULL;
char *g_pdml_in_origin = NULL;
extern int xmlLoadExtDtdDefaultValue;
......@@ -195,17 +194,13 @@ int generate_test_scenario(const char const * test_nameP, const char const * pdm
exit(1);
}
memset(astring, 0, sizeof(astring));
strcat(astring, g_openair_dir);
strcat(astring, "/openair3/TEST/EPC_TEST/generic_scenario.xsl");
xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = 1;
cur = xsltParseStylesheetFile(astring);
cur = xsltParseStylesheetFile("/usr/share/oai/xsl/generic_scenario.xsl");
if (NULL == cur) {
AssertFatal (0, "Could not parse stylesheet file %s (check OPENAIR_DIR env variable)!\n", astring);
AssertFatal (0, "Could not parse stylesheet file /usr/share/oai/xsl/generic_scenario.xsl!\n");
} else {
fprintf(stdout, "XSLT style sheet: %s\n", astring);
fprintf(stdout, "XSLT style sheet: /usr/share/oai/xsl/generic_scenario.xsl\n");
}
doc = xmlParseFile(pdml_in_basenameP);
......@@ -686,12 +681,6 @@ int main( int argc, char **argv )
{
int actions = 0;
g_openair_dir = getenv("OPENAIR_DIR");
if (NULL == g_openair_dir) {
fprintf(stderr, "Error: Could not get OPENAIR_DIR environment variable\n");
exit(1);
}
memset((char*) &g_enb_properties, 0 , sizeof(g_enb_properties));
actions = config_parse_opt_line (argc, argv); //Command-line options
......
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<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="enb0_s1c" select="'0.0.0.0'"/>
<xsl:param name="enb1_s1c" select="'0.0.0.0'"/>
<xsl:param name="enb2_s1c" select="'0.0.0.0'"/>
<xsl:param name="enb3_s1c" select="'0.0.0.0'"/>
<xsl:param name="enb4_s1c" select="'0.0.0.0'"/>
<xsl:param name="enb5_s1c" select="'0.0.0.0'"/>
<xsl:param name="enb6_s1c" select="'0.0.0.0'"/>
<xsl:param name="enb7_s1c" select="'0.0.0.0'"/>
<xsl:param name="mme0_s1c_0" select="'0.0.0.0'"/>
<xsl:param name="mme0_s1c_1" select="'0.0.0.0'"/>
<xsl:param name="mme0_s1c_2" select="'0.0.0.0'"/>
<xsl:param name="mme0_s1c_3" select="'0.0.0.0'"/>
<xsl:param name="mme1_s1c_0" select="'0.0.0.0'"/>
<xsl:param name="mme1_s1c_1" select="'0.0.0.0'"/>
<xsl:param name="mme1_s1c_2" select="'0.0.0.0'"/>
<xsl:param name="mme1_s1c_3" select="'0.0.0.0'"/>
<xsl:param name="mme2_s1c_0" select="'0.0.0.0'"/>
<xsl:param name="mme2_s1c_1" select="'0.0.0.0'"/>
<xsl:param name="mme2_s1c_2" select="'0.0.0.0'"/>
<xsl:param name="mme2_s1c_3" select="'0.0.0.0'"/>
<xsl:param name="mme3_s1c_0" select="'0.0.0.0'"/>
<xsl:param name="mme3_s1c_1" select="'0.0.0.0'"/>
<xsl:param name="mme3_s1c_2" select="'0.0.0.0'"/>
<xsl:param name="mme3_s1c_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:when test="$ip_address=$enb0_s1c">enb0_s1c</xsl:when>
<xsl:when test="$ip_address=$enb1_s1c">enb1_s1c</xsl:when>
<xsl:when test="$ip_address=$enb2_s1c">enb2_s1c</xsl:when>
<xsl:when test="$ip_address=$enb3_s1c">enb3_s1c</xsl:when>
<xsl:when test="$ip_address=$enb4_s1c">enb4_s1c</xsl:when>
<xsl:when test="$ip_address=$enb5_s1c">enb5_s1c</xsl:when>
<xsl:when test="$ip_address=$enb6_s1c">enb6_s1c</xsl:when>
<xsl:when test="$ip_address=$enb7_s1c">enb7_s1c</xsl:when>
<xsl:when test="$ip_address=$mme0_s1c_0">mme0_s1c_0</xsl:when>
<xsl:when test="$ip_address=$mme0_s1c_1">mme0_s1c_1</xsl:when>
<xsl:when test="$ip_address=$mme0_s1c_2">mme0_s1c_2</xsl:when>
<xsl:when test="$ip_address=$mme0_s1c_3">mme0_s1c_3</xsl:when>
<xsl:when test="$ip_address=$mme1_s1c_0">mme1_s1c_0</xsl:when>
<xsl:when test="$ip_address=$mme1_s1c_1">mme1_s1c_1</xsl:when>
<xsl:when test="$ip_address=$mme1_s1c_2">mme1_s1c_2</xsl:when>
<xsl:when test="$ip_address=$mme1_s1c_3">mme1_s1c_3</xsl:when>
<xsl:when test="$ip_address=$mme2_s1c_0">mme2_s1c_0</xsl:when>
<xsl:when test="$ip_address=$mme2_s1c_1">mme2_s1c_1</xsl:when>
<xsl:when test="$ip_address=$mme2_s1c_2">mme2_s1c_2</xsl:when>
<xsl:when test="$ip_address=$mme2_s1c_3">mme2_s1c_3</xsl:when>
<xsl:when test="$ip_address=$mme3_s1c_0">mme3_s1c_0</xsl:when>
<xsl:when test="$ip_address=$mme3_s1c_1">mme3_s1c_1</xsl:when>
<xsl:when test="$ip_address=$mme3_s1c_2">mme3_s1c_2</xsl:when>
<xsl:when test="$ip_address=$mme3_s1c_3">mme3_s1c_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="enb_ip_2_enb_instance">
<xsl:param name="ip_address"/>
<xsl:choose>
<xsl:when test="$ip_address=$enb0_s1c">0</xsl:when>
<xsl:when test="$ip_address=$enb1_s1c">1</xsl:when>
<xsl:when test="$ip_address=$enb2_s1c">2</xsl:when>
<xsl:when test="$ip_address=$enb3_s1c">3</xsl:when>
<xsl:when test="$ip_address=$enb4_s1c">4</xsl:when>
<xsl:when test="$ip_address=$enb5_s1c">5</xsl:when>
<xsl:when test="$ip_address=$enb6_s1c">6</xsl:when>
<xsl:when test="$ip_address=$enb7_s1c">7</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">ERROR: Cannot set eNB instance <xsl:value-of select="."/> !
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<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>
<xsl:message terminate="yes">ERROR: UNKNOWN CHUNK TYPE <xsl:value-of select="."/> !
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:strip-space elements="pdml packet proto field"/>
<xsl:template match="/">
<scenario name="{$test_name}">
<xsl:apply-templates/>
</scenario>
</xsl:template>
<xsl:template match="proto[@name='frame']">
<xsl:variable name="time_relative" select="field[@name='frame.time_relative']/@show"/>
<xsl:variable name="frame_number" select="field[@name='frame.number']/@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>
<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')">SEND</xsl:when>
<xsl:when test="starts-with($ip_src,'mme')">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:variable name="enb_instance">
<xsl:choose>
<xsl:when test="starts-with($ip_src,'enb')">
<xsl:call-template name="enb_ip_2_enb_instance">
<xsl:with-param name="ip_address" select="$ip/field[@name='ip.src']/@show"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="starts-with($ip_dst,'enb')">
<xsl:call-template name="enb_ip_2_enb_instance">
<xsl:with-param name="ip_address" select="$ip/field[@name='ip.dst']/@show"/>
</xsl:call-template>
</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/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:variable name="sctp_node" select="."/>
<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"/>
<packet name="{$sctp_chunk_type_str}" action="{$action}">
<frame.time_relative value="{$time_relative}"/>
<frame.number value="{$frame_number}"/>
<!-- 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}"/>
<eNB.instance value="{$enb_instance}"/>
<!--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="$sctp_node"/>
</packet>
</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"/-->
<packet name="{$sctp_chunk_type_str}" action="{$action}">
<frame.time_relative value="{$time_relative}"/>
<frame.number value="{$frame_number}"/>
<!-- 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}"/>
<eNB.instance value="{$enb_instance}"/>
<!--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="$sctp_node"/>
</packet>
</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"/-->
<packet name="{$sctp_chunk_type_str}" action="{$action}">
<frame.time_relative value="{$time_relative}"/>
<frame.number value="{$frame_number}"/>
<!-- 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}"/>
<eNB.instance value="{$enb_instance}"/>
<!--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="$sctp_node"/>
</packet>
</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'">
<packet name="{$sctp_chunk_type_str}" action="{$action}">
<frame.time_relative value="{$time_relative}"/>
<frame.number value="{$frame_number}"/>
<!-- 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}"/>
<eNB.instance value="{$enb_instance}"/>
<!--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="$sctp_node"/>
</packet>
</xsl:when>
<xsl:when test="$sctp_chunk_type_str='SHUTDOWN'">
<packet name="{$sctp_chunk_type_str}" action="{$action}">
<frame.time_relative value="{$time_relative}"/>
<frame.number value="{$frame_number}"/>
<!-- 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}"/>
<eNB.instance value="{$enb_instance}"/>
<!--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="$sctp_node"/>
</packet>
</xsl:when>
<!--xsl:when test="$sctp_chunk_type_str='SHUTDOWN_ACK'"></xsl:when-->
<xsl:when test="$sctp_chunk_type_str='ERROR'">
<packet name="{$sctp_chunk_type_str}" action="{$action}">
<frame.time_relative value="{$time_relative}"/>
<frame.number value="{$frame_number}"/>
<!-- 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}"/>
<eNB.instance value="{$enb_instance}"/>
<!--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="$sctp_node"/>
</packet>
</xsl:when>
<!--xsl:when test="$sctp_chunk_type_str='COOKIE_ECHO'"> </xsl:when-->
<!--xsl:when test="$sctp_chunk_type_str='COOKIE_ACK'"> </xsl:when-->
<!--xsl:when test="$sctp_chunk_type_str='ECNE'"> </xsl:when-->
<!--xsl:when test="$sctp_chunk_type_str='CWR'"> </xsl:when-->
<!--xsl:when test="$sctp_chunk_type_str='SHUTDOWN_COMPLETE'"> </xsl:when-->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import subprocess
import re
import socket
import datetime
from datetime import date
import os, errno
import argparse
import tempfile
from lxml import etree
from xml.dom.minidom import parse, parseString
#####################
# program arguments
#####################
parser = argparse.ArgumentParser()
parser.add_argument("--pcap_file", "-p", type=str,help="input pcap file to be translated")
args = parser.parse_args()
#####################
# get xml document from pcap
#####################
orig_pcap_file_name = args.pcap_file.strip()
orig_pdml_string = subprocess.check_output(["tshark", '-T', 'pdml', '-r', orig_pcap_file_name])
orig_dom = parseString(orig_pdml_string)
#####################
# filtering unwanted packets
#####################
#cases = orig_etree.findall(".//proto[@name='sctp']")
packets = orig_dom.getElementsByTagName("packet")
for packet in packets:
found_sctp = False
found_s1ap = False
sctp_node = None
frame_node = None
ip_node = None
protos = packet.getElementsByTagName("proto")
for proto in protos:
attrs = proto.attributes
urlnode = attrs['name']
if urlnode.nodeValue == 'frame':
frame_node = proto
elif urlnode.nodeValue == 'ip':
frame_node.appendChild(proto)
ip_node = proto
elif urlnode.nodeValue == 'sctp':
found_sctp = True
ip_node.appendChild(proto)
sctp_node = proto
elif urlnode.nodeValue == 's1ap':
found_s1ap = True
sctp_node.appendChild(proto)
elif urlnode.nodeValue == 'geninfo':
packet.removeChild(proto)
elif urlnode.nodeValue == 'eth':
packet.removeChild(proto)
if found_sctp == False:
# hopefully it seems to work (remove iterated packet)
packet.parentNode.removeChild(packet)
#####################
# dom to xml string
#####################
filtered_pdml_string = orig_dom.toprettyxml(indent=" ")
cleaned_pdml_string = ""
#####################
# remove blank lines in xml string
#####################
lines = filtered_pdml_string.splitlines()
for line in lines:
if len(line.strip()):
if line[:-1]:
cleaned_pdml_string += line + '\r\n'
#print "'%s'" % cleaned_pdml_string
#####################
# write pdml string to pdml file
#####################
out_pdml_file_name = os.path.dirname(orig_pcap_file_name) + '/' + os.path.splitext(os.path.basename(orig_pcap_file_name))[0] + '.pdml'
out_file = open(out_pdml_file_name, "w")
out_file.write(cleaned_pdml_string)
out_file.close()
############################################################
# DECEIVING HTML BONUS: DO NOT SEEM TO WORK CORRECTLY IN FIREFOX
# DID NOT INVESTIGATE
#####################
# write xml string to html file
#####################
xsl_root = etree.fromstring(open('/usr/share/wireshark/pdml2html.xsl').read())
transform = etree.XSLT(xsl_root)
xml_root = etree.fromstring(cleaned_pdml_string)
trans_root = transform(xml_root)
filtered_html_string = etree.tostring(trans_root)
#####################
# write html string to html file
#####################
out_html_file_name = os.path.dirname(orig_pcap_file_name) + '/' +os.path.splitext(os.path.basename(orig_pcap_file_name))[0] + '.html'
out_file = open(out_html_file_name, "w")
out_file.write(filtered_html_string)
out_file.close()
......@@ -68,7 +68,6 @@
#define GS_IS_FILE 1
#define GS_IS_DIR 2
//------------------------------------------------------------------------------
char *g_openair_dir = NULL;
Enb_properties_array_t g_enb_properties;
//------------------------------------------------------------------------------
extern et_scenario_t *g_scenario;
......@@ -936,11 +935,6 @@ int main( int argc, char **argv )
char play_scenario_filename[NAME_MAX];
memset(play_scenario_filename, 0, sizeof(play_scenario_filename));
g_openair_dir = getenv("OPENAIR_DIR");
if (NULL == g_openair_dir) {
fprintf(stderr, "ERROR: Could not get OPENAIR_DIR environment variable\n");
exit(1);
}
// logging
logInit();
......
......@@ -252,6 +252,7 @@ typedef struct et_s1ap_s {
uint16_t binary_stream_allocated_size;
uint8_t *binary_stream;
s1ap_message message; // decoded message: information elements
xmlNodePtr xml_node; // XML representation of the S1AP PDU
} et_s1ap_t;
......@@ -418,7 +419,7 @@ void et_s1ap_eNB_insert_new_instance(s1ap_eNB_instance_t *new_instance_p);
struct s1ap_eNB_mme_data_s *et_s1ap_eNB_get_MME(s1ap_eNB_instance_t *instance_p,int32_t assoc_id, uint16_t cnx_id);
s1ap_eNB_instance_t *et_s1ap_eNB_get_instance(instance_t instance);
void et_s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,uint32_t buffer_length, uint16_t stream);
int et_handle_s1ap_mismatch(et_packet_t * const spacket, et_packet_t * const rx_packet);
int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t * const spacket, et_packet_t * const rx_packet);
asn_comp_rval_t* et_s1ap_is_matching(et_s1ap_t * const s1ap1, et_s1ap_t * const s1ap2, const uint32_t constraints);
et_packet_t* et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t * const s1ap_data_ind);
int et_scenario_set_packet_received(et_packet_t * const packet);
......
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/xhtml1/strict">
<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="enb0_s1c" select="'0.0.0.0'"/>
<xsl:param name="enb1_s1c" select="'0.0.0.0'"/>
<xsl:param name="enb2_s1c" select="'0.0.0.0'"/>
<xsl:param name="enb3_s1c" select="'0.0.0.0'"/>
<xsl:param name="enb4_s1c" select="'0.0.0.0'"/>
<xsl:param name="enb5_s1c" select="'0.0.0.0'"/>
<xsl:param name="enb6_s1c" select="'0.0.0.0'"/>
<xsl:param name="enb7_s1c" select="'0.0.0.0'"/>
<xsl:param name="mme0_s1c_0" select="'0.0.0.0'"/>
<xsl:param name="mme0_s1c_1" select="'0.0.0.0'"/>
<xsl:param name="mme0_s1c_2" select="'0.0.0.0'"/>
<xsl:param name="mme0_s1c_3" select="'0.0.0.0'"/>
<xsl:param name="mme1_s1c_0" select="'0.0.0.0'"/>
<xsl:param name="mme1_s1c_1" select="'0.0.0.0'"/>
<xsl:param name="mme1_s1c_2" select="'0.0.0.0'"/>
<xsl:param name="mme1_s1c_3" select="'0.0.0.0'"/>
<xsl:param name="mme2_s1c_0" select="'0.0.0.0'"/>
<xsl:param name="mme2_s1c_1" select="'0.0.0.0'"/>
<xsl:param name="mme2_s1c_2" select="'0.0.0.0'"/>
<xsl:param name="mme2_s1c_3" select="'0.0.0.0'"/>
<xsl:param name="mme3_s1c_0" select="'0.0.0.0'"/>
<xsl:param name="mme3_s1c_1" select="'0.0.0.0'"/>
<xsl:param name="mme3_s1c_2" select="'0.0.0.0'"/>
<xsl:param name="mme3_s1c_3" select="'0.0.0.0'"/>
<xsl:template match="ip.src[parent::packet]/@value">
<xsl:choose>
<xsl:when test=".='enb0_s1c'"><xsl:value-of select="$enb0_s1c"/></xsl:when>
<xsl:when test=".='enb1_s1c'"><xsl:value-of select="$enb1_s1c"/></xsl:when>
<xsl:when test=".='enb2_s1c'"><xsl:value-of select="$enb2_s1c"/></xsl:when>
<xsl:when test=".='enb3_s1c'"><xsl:value-of select="$enb3_s1c"/></xsl:when>
<xsl:when test=".='enb4_s1c'"><xsl:value-of select="$enb4_s1c"/></xsl:when>
<xsl:when test=".='enb5_s1c'"><xsl:value-of select="$enb5_s1c"/></xsl:when>
<xsl:when test=".='enb6_s1c'"><xsl:value-of select="$enb6_s1c"/></xsl:when>
<xsl:when test=".='enb7_s1c'"><xsl:value-of select="$enb7_s1c"/></xsl:when>
<xsl:when test=".='mme0_s1c_0'"><xsl:value-of select="$mme0_s1c_0"/></xsl:when>
<xsl:when test=".='mme0_s1c_1'"><xsl:value-of select="$mme0_s1c_1"/></xsl:when>
<xsl:when test=".='mme0_s1c_2'"><xsl:value-of select="$mme0_s1c_2"/></xsl:when>
<xsl:when test=".='mme0_s1c_3'"><xsl:value-of select="$mme0_s1c_3"/></xsl:when>
<xsl:when test=".='mme1_s1c_0'"><xsl:value-of select="$mme1_s1c_0"/></xsl:when>
<xsl:when test=".='mme1_s1c_1'"><xsl:value-of select="$mme1_s1c_1"/></xsl:when>
<xsl:when test=".='mme1_s1c_2'"><xsl:value-of select="$mme1_s1c_2"/></xsl:when>
<xsl:when test=".='mme1_s1c_3'"><xsl:value-of select="$mme1_s1c_3"/></xsl:when>
<xsl:when test=".='mme2_s1c_0'"><xsl:value-of select="$mme2_s1c_0"/></xsl:when>
<xsl:when test=".='mme2_s1c_1'"><xsl:value-of select="$mme2_s1c_1"/></xsl:when>
<xsl:when test=".='mme2_s1c_2'"><xsl:value-of select="$mme2_s1c_2"/></xsl:when>
<xsl:when test=".='mme2_s1c_3'"><xsl:value-of select="$mme2_s1c_3"/></xsl:when>
<xsl:when test=".='mme3_s1c_0'"><xsl:value-of select="$mme3_s1c_0"/></xsl:when>
<xsl:when test=".='mme3_s1c_1'"><xsl:value-of select="$mme3_s1c_1"/></xsl:when>
<xsl:when test=".='mme3_s1c_2'"><xsl:value-of select="$mme3_s1c_2"/></xsl:when>
<xsl:when test=".='mme3_s1c_3'"><xsl:value-of select="$mme3_s1c_3"/></xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">ERROR: Cannot resolv IP <xsl:value-of select="."/> !
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="ip.dst[parent::packet]/@value">
<xsl:choose>
<xsl:when test=".='enb0_s1c'"><xsl:value-of select="$enb0_s1c"/></xsl:when>
<xsl:when test=".='enb1_s1c'"><xsl:value-of select="$enb1_s1c"/></xsl:when>
<xsl:when test=".='enb2_s1c'"><xsl:value-of select="$enb2_s1c"/></xsl:when>
<xsl:when test=".='enb3_s1c'"><xsl:value-of select="$enb3_s1c"/></xsl:when>
<xsl:when test=".='enb4_s1c'"><xsl:value-of select="$enb4_s1c"/></xsl:when>
<xsl:when test=".='enb5_s1c'"><xsl:value-of select="$enb5_s1c"/></xsl:when>
<xsl:when test=".='enb6_s1c'"><xsl:value-of select="$enb6_s1c"/></xsl:when>
<xsl:when test=".='enb7_s1c'"><xsl:value-of select="$enb7_s1c"/></xsl:when>
<xsl:when test=".='mme0_s1c_0'"><xsl:value-of select="$mme0_s1c_0"/></xsl:when>
<xsl:when test=".='mme0_s1c_1'"><xsl:value-of select="$mme0_s1c_1"/></xsl:when>
<xsl:when test=".='mme0_s1c_2'"><xsl:value-of select="$mme0_s1c_2"/></xsl:when>
<xsl:when test=".='mme0_s1c_3'"><xsl:value-of select="$mme0_s1c_3"/></xsl:when>
<xsl:when test=".='mme1_s1c_0'"><xsl:value-of select="$mme1_s1c_0"/></xsl:when>
<xsl:when test=".='mme1_s1c_1'"><xsl:value-of select="$mme1_s1c_1"/></xsl:when>
<xsl:when test=".='mme1_s1c_2'"><xsl:value-of select="$mme1_s1c_2"/></xsl:when>
<xsl:when test=".='mme1_s1c_3'"><xsl:value-of select="$mme1_s1c_3"/></xsl:when>
<xsl:when test=".='mme2_s1c_0'"><xsl:value-of select="$mme2_s1c_0"/></xsl:when>
<xsl:when test=".='mme2_s1c_1'"><xsl:value-of select="$mme2_s1c_1"/></xsl:when>
<xsl:when test=".='mme2_s1c_2'"><xsl:value-of select="$mme2_s1c_2"/></xsl:when>
<xsl:when test=".='mme2_s1c_3'"><xsl:value-of select="$mme2_s1c_3"/></xsl:when>
<xsl:when test=".='mme3_s1c_0'"><xsl:value-of select="$mme3_s1c_0"/></xsl:when>
<xsl:when test=".='mme3_s1c_1'"><xsl:value-of select="$mme3_s1c_1"/></xsl:when>
<xsl:when test=".='mme3_s1c_2'"><xsl:value-of select="$mme3_s1c_2"/></xsl:when>
<xsl:when test=".='mme3_s1c_3'"><xsl:value-of select="$mme3_s1c_3"/></xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">ERROR: Cannot resolv IP <xsl:value-of select="."/> !
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
......@@ -58,7 +58,6 @@
//------------------------------------------------------------------------------
#define ENB_CONFIG_MAX_XSLT_PARAMS 32
//------------------------------------------------------------------------------
extern char *g_openair_dir;
extern Enb_properties_array_t g_enb_properties;
//------------------------------------------------------------------------------
void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t * const s1ap)
......@@ -71,6 +70,9 @@ void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t * co
unsigned int go_deeper_in_tree = 1;
if ((NULL != s1ap_node) && (NULL != s1ap)) {
// seee http://www.xmlsoft.org/html/libxml-tree.html#xmlCopyNode
s1ap->xml_node = xmlCopyNode(s1ap_node, 1);
AssertFatal(NULL != s1ap->xml_node, "xmlCopyNode Failed");
for (cur_node = (xmlNode *)s1ap_node; cur_node; cur_node = cur_node->next) {
go_deeper_in_tree = 1;
if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"field"))) {
......@@ -497,17 +499,14 @@ int et_generate_xml_scenario(
exit(1);
}
memset(astring, 0, sizeof(astring));
strcat(astring, g_openair_dir);
strcat(astring, "/openair3/TEST/EPC_TEST/play_scenario.xsl");
xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = 1;
cur = xsltParseStylesheetFile((const xmlChar *)astring);
cur = xsltParseStylesheetFile((const xmlChar *)"/usr/share/oai/xsl/play_scenario.xsl");
if (NULL == cur) {
AssertFatal (0, "Could not parse stylesheet file %s (check OPENAIR_DIR env variable)!\n", astring);
AssertFatal (0, "Could not parse stylesheet file /usr/share/oai/xsl/play_scenario.xsl!\n");
} else {
fprintf(stdout, "XSLT style sheet: %s\n", astring);
fprintf(stdout, "XSLT style sheet: /usr/share/oai/xsl/play_scenario.xsl\n");
}
doc = xmlParseFile(xml_in_scenario_filename);
......
......@@ -189,7 +189,7 @@ void et_s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id,
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
//------------------------------------------------------------------------------
int et_handle_s1ap_mismatch(et_packet_t * const spacket, et_packet_t * const rx_packet)
int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t * const spacket, et_packet_t * const rx_packet)
{
S1ap_MME_UE_S1AP_ID_t scenario_mme_ue_s1ap_id = 0;
S1ap_MME_UE_S1AP_ID_t rx_mme_ue_s1ap_id = 0;
......@@ -512,7 +512,15 @@ int et_handle_s1ap_mismatch(et_packet_t * const spacket, et_packet_t * const rx_
default:
AssertFatal(0, "Unknown procedure code %ld", rx_packet->sctp_hdr.u.data_hdr.payload.message.procedureCode);
}
return 0;
if (scenario_mme_ue_s1ap_id != rx_mme_ue_s1ap_id) {
et_packet_t * p = spacket;
while (p) {
et_s1ap_update_mme_ue_s1ap_id(p, scenario_mme_ue_s1ap_id, rx_mme_ue_s1ap_id);
p = p->next;
}
return 0;
}
return 1;
}
//------------------------------------------------------------------------------
asn_comp_rval_t * et_s1ap_is_matching(et_s1ap_t * const s1ap1, et_s1ap_t * const s1ap2, const uint32_t constraints)
......@@ -669,7 +677,7 @@ int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const s1ap_data_ind)
//TODO MME_UE_S1AP_ID, etc.
// get latest error code
if (strcmp(comp_results->name, "S1ap-MME-UE-S1AP-ID") == 0) {
if (0 == et_handle_s1ap_mismatch((et_packet_t *const)packet, (et_packet_t *const)rx_packet)) {
if (0 == et_handle_s1ap_mismatch_mme_ue_s1ap_id((et_packet_t *const)packet, (et_packet_t *const)rx_packet)) {
packet->timestamp_packet.tv_sec = rx_packet->timestamp_packet.tv_sec;
packet->timestamp_packet.tv_usec = rx_packet->timestamp_packet.tv_usec;
return et_scenario_set_packet_received(packet);
......
......@@ -451,3 +451,354 @@ asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_messag
}
return ret;
}
//------------------------------------------------------------------------------
int et_s1ap_update_mme_ue_s1ap_id(et_packet_t * const packet, const S1ap_MME_UE_S1AP_ID_t old_id, const S1ap_MME_UE_S1AP_ID_t new_id)
{
S1ap_MME_UE_S1AP_ID_t mme_ue_s1ap_id = 0;
S1AP_PDU_PR present;
ssize_t encoded;
present = packet->sctp_hdr.u.data_hdr.payload.pdu.present;
S1AP_DEBUG("Updating mme_ue_s1ap_id of packet num %d...\n", packet->packet_number);
switch (packet->sctp_hdr.u.data_hdr.payload.message.procedureCode) {
case S1ap_ProcedureCode_id_HandoverPreparation:
if (present == S1AP_PDU_PR_initiatingMessage) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequiredIEs.mme_ue_s1ap_id;
if (old_id == mme_ue_s1ap_id) {
packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequiredIEs.mme_ue_s1ap_id = new_id;
// re-encode
S1ap_HandoverRequired_t msg;
S1ap_HandoverRequired_t *msg_p = &msg;
memset((void *)msg_p, 0, sizeof(msg));
if (s1ap_encode_s1ap_handoverrequiredies(
msg_p, &packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequiredIEs) < 0) {
AssertFatal(0, "Re-encoding handoverrequiredies failed");
}
ANY_fromType_aper(&packet->sctp_hdr.u.data_hdr.payload.pdu.choice.initiatingMessage.value,
&asn_DEF_S1ap_HandoverRequired,
&packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequiredIEs);
packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequiredIEs;
encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &packet->sctp_hdr.u.data_hdr.payload.pdu,
(void **)&packet->sctp_hdr.u.data_hdr.payload.binary_stream);
AssertFatal(encoded < 0, "Re-encoding PDU failed");
}
} else {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverCommandIEs.mme_ue_s1ap_id;
}
break;
case S1ap_ProcedureCode_id_HandoverResourceAllocation:
if (present == S1AP_PDU_PR_initiatingMessage) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequestIEs.mme_ue_s1ap_id;
} else if (present == S1AP_PDU_PR_successfulOutcome) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequestAcknowledgeIEs.mme_ue_s1ap_id;
} else if (present == S1AP_PDU_PR_unsuccessfulOutcome) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverFailureIEs.mme_ue_s1ap_id;
}
break;
case S1ap_ProcedureCode_id_HandoverNotification:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverNotifyIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_PathSwitchRequest:
//mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_PathSwitchRequestIEs.mme_ue_s1ap_id;
//scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_PathSwitchRequestIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_HandoverCancel:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverCancelIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_E_RABSetup:
if (present == S1AP_PDU_PR_initiatingMessage) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABSetupRequestIEs.mme_ue_s1ap_id;
} else {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABSetupResponseIEs.mme_ue_s1ap_id;
}
break;
case S1ap_ProcedureCode_id_E_RABModify:
if (present == S1AP_PDU_PR_initiatingMessage) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABModifyRequestIEs.mme_ue_s1ap_id;
} else {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABModifyResponseIEs.mme_ue_s1ap_id;
}
break;
case S1ap_ProcedureCode_id_E_RABRelease:
if (present == S1AP_PDU_PR_initiatingMessage) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABReleaseCommandIEs.mme_ue_s1ap_id;
} else {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABReleaseResponseIEs.mme_ue_s1ap_id;
}
break;
case S1ap_ProcedureCode_id_E_RABReleaseIndication:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABReleaseIndicationIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_InitialContextSetup:
if (present == S1AP_PDU_PR_initiatingMessage) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialContextSetupRequestIEs.mme_ue_s1ap_id;
} else {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialContextSetupResponseIEs.mme_ue_s1ap_id;
}
break;
case S1ap_ProcedureCode_id_Paging:
//mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_PagingIEs.mme_ue_s1ap_id;
//scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_PagingIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_downlinkNASTransport:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkNASTransportIEs.mme_ue_s1ap_id;
if (old_id == mme_ue_s1ap_id) {
packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkNASTransportIEs.mme_ue_s1ap_id = new_id;
// re-encode
S1ap_DownlinkNASTransport_t msg;
S1ap_DownlinkNASTransport_t *msg_p = &msg;
memset((void *)msg_p, 0, sizeof(msg));
if (s1ap_encode_s1ap_downlinknastransporties(
msg_p, &packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkNASTransportIEs) < 0) {
AssertFatal(0, "Re-encoding downlinknastransporties failed");
}
ANY_fromType_aper(&packet->sctp_hdr.u.data_hdr.payload.pdu.choice.initiatingMessage.value,
&asn_DEF_S1ap_DownlinkNASTransport,
&packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkNASTransportIEs);
encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &packet->sctp_hdr.u.data_hdr.payload.pdu,
(void **)&packet->sctp_hdr.u.data_hdr.payload.binary_stream);
AssertFatal(encoded < 0, "Re-encoding PDU failed");
}
break;
case S1ap_ProcedureCode_id_initialUEMessage:
//mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialUEMessageIEs.mme_ue_s1ap_id;
//scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialUEMessageIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_uplinkNASTransport:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkNASTransportIEs.mme_ue_s1ap_id;
if (old_id == mme_ue_s1ap_id) {
packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkNASTransportIEs.mme_ue_s1ap_id = new_id;
// re-encode
S1ap_UplinkNASTransport_t msg;
S1ap_UplinkNASTransport_t *msg_p = &msg;
memset((void *)msg_p, 0, sizeof(msg));
if (s1ap_encode_s1ap_uplinknastransporties(
msg_p, &packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkNASTransportIEs) < 0) {
AssertFatal(0, "Re-encoding uplinknastransporties failed");
}
ANY_fromType_aper(&packet->sctp_hdr.u.data_hdr.payload.pdu.choice.initiatingMessage.value,
&asn_DEF_S1ap_DownlinkNASTransport,
&packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkNASTransportIEs);
encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &packet->sctp_hdr.u.data_hdr.payload.pdu,
(void **)&packet->sctp_hdr.u.data_hdr.payload.binary_stream);
AssertFatal(encoded < 0, "Re-encoding PDU failed");
}
break;
case S1ap_ProcedureCode_id_Reset:
//mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ResetIEs.mme_ue_s1ap_id;
//scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ResetIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_ErrorIndication:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ErrorIndicationIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_NASNonDeliveryIndication:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_NASNonDeliveryIndication_IEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_S1Setup:
/*if (present == S1AP_PDU_PR_initiatingMessage) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupRequestIEs.mme_ue_s1ap_id;
scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupRequestIEs.mme_ue_s1ap_id;
} else if (present == S1AP_PDU_PR_successfulOutcome) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupResponseIEs.mme_ue_s1ap_id;
scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupResponseIEs.mme_ue_s1ap_id;
} else if (present == S1AP_PDU_PR_unsuccessfulOutcome) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupFailureIEs.mme_ue_s1ap_id;
scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupFailureIEs.mme_ue_s1ap_id;
}*/
break;
case S1ap_ProcedureCode_id_UEContextReleaseRequest:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseRequestIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_DownlinkS1cdma2000tunneling:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkS1cdma2000tunnelingIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_UplinkS1cdma2000tunneling:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkS1cdma2000tunnelingIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_UEContextModification:
if (present == S1AP_PDU_PR_initiatingMessage) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextModificationRequestIEs.mme_ue_s1ap_id;
} else if (present == S1AP_PDU_PR_successfulOutcome) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextModificationResponseIEs.mme_ue_s1ap_id;
} else if (present == S1AP_PDU_PR_unsuccessfulOutcome) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextModificationFailureIEs.mme_ue_s1ap_id;
}
break;
case S1ap_ProcedureCode_id_UECapabilityInfoIndication:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UECapabilityInfoIndicationIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_UEContextRelease:
if (present == S1AP_PDU_PR_initiatingMessage) {
//mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCommandIEs.mme_ue_s1ap_id;
//scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCommandIEs.mme_ue_s1ap_id;
} else {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCompleteIEs.mme_ue_s1ap_id;
}
break;
case S1ap_ProcedureCode_id_eNBStatusTransfer:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBStatusTransferIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_MMEStatusTransfer:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEStatusTransferIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_DeactivateTrace:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DeactivateTraceIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_TraceStart:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_TraceStartIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_TraceFailureIndication:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_TraceFailureIndicationIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_ENBConfigurationUpdate:
/*if (present == S1AP_PDU_PR_initiatingMessage) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateIEs.mme_ue_s1ap_id;
scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateIEs.mme_ue_s1ap_id;
} else if (present == S1AP_PDU_PR_successfulOutcome) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateAcknowledgeIEs.mme_ue_s1ap_id;
scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateAcknowledgeIEs.mme_ue_s1ap_id;
} else {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateFailureIEs.mme_ue_s1ap_id;
scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateFailureIEs.mme_ue_s1ap_id;
}*/
break;
case S1ap_ProcedureCode_id_MMEConfigurationUpdate:
/*if (present == S1AP_PDU_PR_initiatingMessage) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateIEs.mme_ue_s1ap_id;
scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateIEs.mme_ue_s1ap_id;
} else if (present == S1AP_PDU_PR_successfulOutcome) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateAcknowledgeIEs.mme_ue_s1ap_id;
scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateAcknowledgeIEs.mme_ue_s1ap_id;
} else {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateFailureIEs.mme_ue_s1ap_id;
scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateFailureIEs.mme_ue_s1ap_id;
}*/
break;
case S1ap_ProcedureCode_id_LocationReportingControl:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_LocationReportingControlIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_LocationReportingFailureIndication:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_LocationReportingFailureIndicationIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_LocationReport:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_LocationReportIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_OverloadStart:
//mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_OverloadStartIEs.mme_ue_s1ap_id;
//scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_OverloadStartIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_OverloadStop:
//mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_OverloadStopIEs.mme_ue_s1ap_id;
//scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_OverloadStopIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_WriteReplaceWarning:
/*if (present == S1AP_PDU_PR_initiatingMessage) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_WriteReplaceWarningRequestIEs.mme_ue_s1ap_id;
scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_WriteReplaceWarningRequestIEs.mme_ue_s1ap_id;
} else {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_WriteReplaceWarningResponseIEs.mme_ue_s1ap_id;
scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_WriteReplaceWarningResponseIEs.mme_ue_s1ap_id;
}*/
break;
case S1ap_ProcedureCode_id_eNBDirectInformationTransfer:
//mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBDirectInformationTransferIEs.mme_ue_s1ap_id;
//scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBDirectInformationTransferIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_MMEDirectInformationTransfer:
//mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEDirectInformationTransferIEs.mme_ue_s1ap_id;
//scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEDirectInformationTransferIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_PrivateMessage:
case S1ap_ProcedureCode_id_eNBConfigurationTransfer:
case S1ap_ProcedureCode_id_MMEConfigurationTransfer:
AssertFatal(0, "TODO");
break;
case S1ap_ProcedureCode_id_CellTrafficTrace:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_CellTrafficTraceIEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_Kill:
/*if (present == S1AP_PDU_PR_initiatingMessage) {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_KillRequestIEs.mme_ue_s1ap_id;
scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_KillRequestIEs.mme_ue_s1ap_id;
} else {
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_KillResponseIEs.mme_ue_s1ap_id;
scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_KillResponseIEs.mme_ue_s1ap_id;
}*/
break;
case S1ap_ProcedureCode_id_downlinkUEAssociatedLPPaTransport:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_uplinkUEAssociatedLPPaTransport:
mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_downlinkNonUEAssociatedLPPaTransport:
//mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkNonUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id;
//scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkNonUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id;
break;
case S1ap_ProcedureCode_id_uplinkNonUEAssociatedLPPaTransport:
//mme_ue_s1ap_id = packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkNonUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id;
//scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkNonUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id;
break;
default:
AssertFatal(0, "Unknown procedure code %ld", packet->sctp_hdr.u.data_hdr.payload.message.procedureCode);
}
return 0;
}
......@@ -131,7 +131,7 @@ eNBs =
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.188.2.2";
mme_ip_address = ( { ipv4 = "192.170.0.1";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
......@@ -140,12 +140,12 @@ eNBs =
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "tun2";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.188.2.2/24";
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0:3";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.170.0.2/24";
ENB_INTERFACE_NAME_FOR_S1U = "lo";
ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.1/24";
ENB_PORT_FOR_S1U = 2153; # Spec 2152
ENB_INTERFACE_NAME_FOR_S1U = "eth0:4";
ENB_IPV4_ADDRESS_FOR_S1U = "192.170.1.2/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
log_config :
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment