Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
oai
openairinterface5G
Commits
3e3bdd9e
Commit
3e3bdd9e
authored
Dec 15, 2015
by
gauthier
Browse files
Removed from this repo epc xsl files, commiting for sync
parent
0b5e364b
Changes
12
Hide whitespace changes
Inline
Side-by-side
cmake_targets/tools/build_helper
View file @
3e3bdd9e
...
...
@@ -30,7 +30,7 @@
################################################################################
# file build_helper
# brief
# author Laurent Thomas
# author
s
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
}
...
...
cmake_targets/tools/build_test_epc_tools
View file @
3e3bdd9e
...
...
@@ -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
}
...
...
openair3/TEST/EPC_TEST/generate_scenario.c
View file @
3e3bdd9e
...
...
@@ -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
...
...
openair3/TEST/EPC_TEST/generic_scenario.xsl
deleted
100644 → 0
View file @
0b5e364b
<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>
openair3/TEST/EPC_TEST/mme_test_s1_pcap2pdml
deleted
100755 → 0
View file @
0b5e364b
#!/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
)