Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zzha zzha
OpenXG-RAN
Commits
8a001c57
Commit
8a001c57
authored
Dec 02, 2015
by
gauthier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backup, need to feed with packets, still patch for asn1c to be comited
parent
44355e1a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
29 deletions
+96
-29
openair3/TEST/EPC_TEST/play_scenario.h
openair3/TEST/EPC_TEST/play_scenario.h
+11
-8
openair3/TEST/EPC_TEST/play_scenario_fsm.c
openair3/TEST/EPC_TEST/play_scenario_fsm.c
+61
-11
openair3/TEST/EPC_TEST/play_scenario_s1ap.c
openair3/TEST/EPC_TEST/play_scenario_s1ap.c
+19
-5
openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c
openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c
+3
-3
openair3/TEST/EPC_TEST/play_scenario_sctp.c
openair3/TEST/EPC_TEST/play_scenario_sctp.c
+2
-2
No files found.
openair3/TEST/EPC_TEST/play_scenario.h
View file @
8a001c57
...
...
@@ -173,7 +173,8 @@ typedef enum {
ET_FSM_STATE_START
=
0
,
ET_FSM_STATE_NULL
=
ET_FSM_STATE_START
,
ET_FSM_STATE_CONNECTING_S1C
,
ET_FSM_STATE_WAITING_EVENT
,
ET_FSM_STATE_WAITING_RX_EVENT
,
ET_FSM_STATE_WAITING_TX_EVENT
,
ET_FSM_STATE_RUNNING
,
ET_FSM_STATE_END
}
et_fsm_state_t
;
...
...
@@ -359,6 +360,7 @@ typedef enum {
ET_EVENT_RX_S1AP
,
ET_EVENT_RX_PACKET_TIME_OUT
,
ET_EVENT_TX_TIMED_PACKET
,
ET_EVENT_TICK
,
ET_EVENT_END
}
et_event_code_t
;
...
...
@@ -413,10 +415,10 @@ 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_s1ap_is_matching
(
et_s1ap_t
*
const
s1ap1
,
et_s1ap_t
*
const
s1ap2
,
const
uint32_t
constraints
);
long
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
);
void
et_scenario_set_packet_received
(
et_packet_t
*
const
packet
);
void
et_s1ap_process_rx_packet
(
et_event_s1ap_data_ind_t
*
const
sctp_data_ind
);
int
et_scenario_set_packet_received
(
et_packet_t
*
const
packet
);
int
et_s1ap_process_rx_packet
(
et_event_s1ap_data_ind_t
*
const
sctp_data_ind
);
void
et_s1ap_eNB_handle_sctp_data_ind
(
sctp_data_ind_t
*
const
sctp_data_ind
);
void
et_s1ap_eNB_register_mme
(
s1ap_eNB_instance_t
*
instance_p
,
net_ip_address_t
*
mme_ip_address
,
...
...
@@ -435,7 +437,8 @@ int et_generate_xml_scenario(
char
const
*
tsml_out_scenario_filename
);
//-------------------------
et_fsm_state_t
et_scenario_fsm_notify_event_state_running
(
et_event_t
event
);
et_fsm_state_t
et_scenario_fsm_notify_event_state_waiting
(
et_event_t
event
);
et_fsm_state_t
et_scenario_fsm_notify_event_state_waiting_tx
(
et_event_t
event
);
et_fsm_state_t
et_scenario_fsm_notify_event_state_waiting_rx
(
et_event_t
event
);
et_fsm_state_t
et_scenario_fsm_notify_event_state_connecting_s1c
(
et_event_t
event
);
et_fsm_state_t
et_scenario_fsm_notify_event_state_null
(
et_event_t
event
);
et_fsm_state_t
et_scenario_fsm_notify_event
(
et_event_t
event
);
...
...
@@ -448,10 +451,10 @@ void et_parse_sctp(xmlDocPtr doc, const xmlNode const *sctp_node, et_sctp_hdr_t
et_packet_t
*
et_parse_xml_packet
(
xmlDocPtr
doc
,
xmlNodePtr
node
);
et_scenario_t
*
et_generate_scenario
(
const
char
*
const
et_scenario_filename
);
//-------------------------
int
et_s1ap_ies_is_matching
(
const
S1AP_PDU_PR
present
,
s1ap_message
*
const
m1
,
s1ap_message
*
const
m2
,
const
uint32_t
constraints
);
long
et_s1ap_ies_is_matching
(
const
S1AP_PDU_PR
present
,
s1ap_message
*
const
m1
,
s1ap_message
*
const
m2
,
const
uint32_t
constraints
);
//-------------------------
int
et_sctp_data_is_matching
(
sctp_datahdr_t
*
const
sctp1
,
sctp_datahdr_t
*
const
sctp2
,
const
uint32_t
constraints
);
int
et_sctp_is_matching
(
et_sctp_hdr_t
*
const
sctp1
,
et_sctp_hdr_t
*
const
sctp2
,
const
uint32_t
constraints
);
long
et_sctp_data_is_matching
(
sctp_datahdr_t
*
const
sctp1
,
sctp_datahdr_t
*
const
sctp2
,
const
uint32_t
constraints
);
long
et_sctp_is_matching
(
et_sctp_hdr_t
*
const
sctp1
,
et_sctp_hdr_t
*
const
sctp2
,
const
uint32_t
constraints
);
//------------------------------------------------------------------------------
void
et_print_hex_octets
(
const
unsigned
char
*
const
byte_stream
,
const
unsigned
long
int
num
);
int
et_is_file_exists
(
const
char
const
*
file_nameP
,
const
char
const
*
file_roleP
);
...
...
openair3/TEST/EPC_TEST/play_scenario_fsm.c
View file @
8a001c57
...
...
@@ -87,7 +87,7 @@ void et_scenario_wait_rx_packet(et_packet_t * const packet)
NULL
,
&
packet
->
timer_id
)
<
0
)
{
AssertFatal
(
0
,
" Can not start waiting RX event timer
\n
"
);
}
g_fsm_state
=
ET_FSM_STATE_WAITING_EVENT
;
g_fsm_state
=
ET_FSM_STATE_WAITING_
RX_
EVENT
;
packet
->
status
=
ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING
;
}
//------------------------------------------------------------------------------
...
...
@@ -107,7 +107,7 @@ void et_scenario_schedule_tx_packet(et_packet_t * const packet)
AssertFatal
(
NULL
!=
s1ap_eNB_instance
,
"Cannot get s1ap_eNB_instance_t for eNB instance %d"
,
packet
->
enb_instance
);
LOG_D
(
ENB_APP
,
"%s
\n
"
,
__FUNCTION__
);
g_fsm_state
=
ET_FSM_STATE_WAITING_EVENT
;
g_fsm_state
=
ET_FSM_STATE_WAITING_
TX_
EVENT
;
switch
(
packet
->
sctp_hdr
.
chunk_type
)
{
case
SCTP_CID_DATA
:
...
...
@@ -160,6 +160,10 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
{
switch
(
event
.
code
){
case
ET_EVENT_TICK
:
//TODO
break
;
case
ET_EVENT_RX_PACKET_TIME_OUT
:
AssertFatal
(
0
,
"Event ET_EVENT_RX_PACKET_TIME_OUT not handled in FSM state ET_FSM_STATE_RUNNING"
);
break
;
...
...
@@ -177,18 +181,17 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
}
//------------------------------------------------------------------------------
et_fsm_state_t
et_scenario_fsm_notify_event_state_waiting
(
et_event_t
event
)
et_fsm_state_t
et_scenario_fsm_notify_event_state_waiting
_tx
(
et_event_t
event
)
{
int
rv
=
0
;
switch
(
event
.
code
){
case
ET_EVENT_RX_PACKET_TIME_OUT
:
fprintf
(
stderr
,
"Error The following packet is not received:
\n
"
);
et_display_packet
(
event
.
u
.
rx_packet_time_out
);
AssertFatal
(
0
,
"Waited packet not received"
);
case
ET_EVENT_TICK
:
break
;
case
ET_EVENT_RX_S1AP
:
et_s1ap_process_rx_packet
(
&
event
.
u
.
s1ap_data_ind
);
rv
=
et_s1ap_process_rx_packet
(
&
event
.
u
.
s1ap_data_ind
);
break
;
case
ET_EVENT_TX_TIMED_PACKET
:
// send immediately
AssertFatal
(
0
==
gettimeofday
(
&
event
.
u
.
tx_timed_packet
->
timestamp_packet
,
NULL
),
"gettimeofday() Failed"
);
...
...
@@ -202,9 +205,39 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting(et_event_t event)
g_fsm_state
=
ET_FSM_STATE_RUNNING
;
break
;
case
ET_EVENT_RX_PACKET_TIME_OUT
:
default:
AssertFatal
(
0
,
"Case event %d not handled in ET_FSM_STATE_WAITING_TX"
,
event
.
code
);
}
pthread_mutex_unlock
(
&
g_fsm_lock
);
return
0
;
}
//------------------------------------------------------------------------------
et_fsm_state_t
et_scenario_fsm_notify_event_state_waiting_rx
(
et_event_t
event
)
{
int
rv
=
0
;
switch
(
event
.
code
){
case
ET_EVENT_TICK
:
break
;
case
ET_EVENT_RX_PACKET_TIME_OUT
:
fprintf
(
stderr
,
"Error The following packet is not received:
\n
"
);
et_display_packet
(
event
.
u
.
rx_packet_time_out
);
AssertFatal
(
0
,
"Waited packet not received"
);
break
;
case
ET_EVENT_RX_S1AP
:
rv
=
et_s1ap_process_rx_packet
(
&
event
.
u
.
s1ap_data_ind
);
// waited packet
if
(
rv
==
0
)
{
g_fsm_state
=
ET_FSM_STATE_RUNNING
;
}
break
;
case
ET_EVENT_TX_TIMED_PACKET
:
default:
AssertFatal
(
0
,
"Case event %d not handled in ET_FSM_STATE_WAITING"
,
event
.
code
);
AssertFatal
(
0
,
"Case event %d not handled in ET_FSM_STATE_WAITING
_RX
"
,
event
.
code
);
}
pthread_mutex_unlock
(
&
g_fsm_lock
);
return
0
;
...
...
@@ -215,6 +248,9 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
{
switch
(
event
.
code
){
case
ET_EVENT_TICK
:
break
;
case
ET_EVENT_S1C_CONNECTED
:
// hack simulate we have been able to get the right timing values
AssertFatal
(
gettimeofday
(
&
g_scenario
->
time_last_tx_packet
,
NULL
)
==
0
,
"gettimeofday failed"
);
...
...
@@ -227,6 +263,11 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
if
(
g_scenario
->
next_packet
->
action
==
ET_PACKET_ACTION_S1C_SEND
)
{
et_scenario_schedule_tx_packet
(
g_scenario
->
next_packet
);
pthread_mutex_unlock
(
&
g_fsm_lock
);
et_event_t
continue_event
;
continue_event
.
code
=
ET_EVENT_TICK
;
et_scenario_fsm_notify_event
(
continue_event
);
return
g_fsm_state
;
}
else
if
(
g_scenario
->
next_packet
->
action
==
ET_PACKET_ACTION_S1C_RECEIVE
)
{
if
(
g_scenario
->
next_packet
->
status
==
ET_PACKET_STATUS_RECEIVED
)
{
...
...
@@ -289,6 +330,9 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
et_fsm_state_t
et_scenario_fsm_notify_event_state_null
(
et_event_t
event
)
{
switch
(
event
.
code
){
case
ET_EVENT_TICK
:
break
;
case
ET_EVENT_INIT
:
AssertFatal
(
NULL
==
g_scenario
,
"Current scenario not ended"
);
g_scenario
=
event
.
u
.
init
.
scenario
;
...
...
@@ -304,6 +348,11 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
if
(
g_scenario
->
next_packet
->
action
==
ET_PACKET_ACTION_S1C_SEND
)
{
et_scenario_schedule_tx_packet
(
g_scenario
->
next_packet
);
pthread_mutex_unlock
(
&
g_fsm_lock
);
et_event_t
continue_event
;
continue_event
.
code
=
ET_EVENT_TICK
;
et_scenario_fsm_notify_event
(
continue_event
);
return
g_fsm_state
;
}
else
if
(
g_scenario
->
next_packet
->
action
==
ET_PACKET_ACTION_S1C_RECEIVE
)
{
if
(
g_scenario
->
next_packet
->
status
==
ET_PACKET_STATUS_RECEIVED
)
{
...
...
@@ -382,7 +431,8 @@ et_fsm_state_t et_scenario_fsm_notify_event(et_event_t event)
switch
(
g_fsm_state
){
case
ET_FSM_STATE_NULL
:
return
et_scenario_fsm_notify_event_state_null
(
event
);
break
;
case
ET_FSM_STATE_CONNECTING_S1C
:
return
et_scenario_fsm_notify_event_state_connecting_s1c
(
event
);
break
;
case
ET_FSM_STATE_WAITING_EVENT
:
return
et_scenario_fsm_notify_event_state_waiting
(
event
);
break
;
case
ET_FSM_STATE_WAITING_TX_EVENT
:
return
et_scenario_fsm_notify_event_state_waiting_tx
(
event
);
break
;
case
ET_FSM_STATE_WAITING_RX_EVENT
:
return
et_scenario_fsm_notify_event_state_waiting_rx
(
event
);
break
;
case
ET_FSM_STATE_RUNNING
:
return
et_scenario_fsm_notify_event_state_running
(
event
);
break
;
default:
AssertFatal
(
0
,
"Case fsm_state %d not handled"
,
g_fsm_state
);
...
...
openair3/TEST/EPC_TEST/play_scenario_s1ap.c
View file @
8a001c57
...
...
@@ -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_s1ap_is_matching
(
et_s1ap_t
*
const
s1ap1
,
et_s1ap_t
*
const
s1ap2
,
const
uint32_t
constraints
)
long
et_s1ap_is_matching
(
et_s1ap_t
*
const
s1ap1
,
et_s1ap_t
*
const
s1ap2
,
const
uint32_t
constraints
)
{
if
(
s1ap1
->
pdu
.
present
!=
s1ap2
->
pdu
.
present
)
return
-
ET_ERROR_MATCH_PACKET_S1AP_PRESENT
;
switch
(
s1ap1
->
pdu
.
present
)
{
...
...
@@ -247,19 +247,22 @@ et_packet_t* et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t * const
//------------------------------------------------------------------------------
void
et_scenario_set_packet_received
(
et_packet_t
*
const
packet
)
// return 0 if packet was waited
int
et_scenario_set_packet_received
(
et_packet_t
*
const
packet
)
{
int
rc
=
0
;
packet
->
status
=
ET_PACKET_STATUS_RECEIVED
;
S1AP_DEBUG
(
"Packet num %d received
\n
"
,
packet
->
packet_number
);
if
(
packet
->
timer_id
!=
0
)
{
rc
=
timer_remove
(
packet
->
timer_id
);
AssertFatal
(
rc
==
0
,
"Timer on Rx packet num %d unknown"
,
packet
->
packet_number
);
AssertFatal
(
rc
==
0
,
"TODO: Debug Timer on Rx packet num %d unknown"
,
packet
->
packet_number
);
return
rc
;
}
return
1
;
}
//------------------------------------------------------------------------------
void
et_s1ap_process_rx_packet
(
et_event_s1ap_data_ind_t
*
const
s1ap_data_ind
)
int
et_s1ap_process_rx_packet
(
et_event_s1ap_data_ind_t
*
const
s1ap_data_ind
)
{
et_packet_t
*
packet
=
NULL
;
et_packet_t
*
rx_packet
=
NULL
;
...
...
@@ -291,9 +294,15 @@ void et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const s1ap_data_ind)
rv
=
et_sctp_is_matching
(
&
packet
->
sctp_hdr
,
&
rx_packet
->
sctp_hdr
,
g_constraints
);
if
(
0
==
rv
)
{
S1AP_DEBUG
(
"Compare RX packet with packet num %d succeeded
\n
"
,
packet
->
packet_number
);
et_scenario_set_packet_received
(
packet
);
return
et_scenario_set_packet_received
(
packet
);
}
else
{
S1AP_DEBUG
(
"Compare RX packet with packet num %d failed %s
\n
"
,
packet
->
packet_number
,
et_error_match2str
(
rv
));
// asn1 compare no match return code, may not collide with non asn1 error return codes
// (each asn1 rc <= 166 (enum e_S1ap_ProtocolIE_ID, in generated file S1ap_ProtocolIE_ID.h))
if
((
rv
>
0
)
||
(
rv
<=
-
ET_ERROR_MATCH_END
))
{
//TODO MME_UE_S1AP_ID, etc.
AssertFatal
(
0
,
"Some work needed there"
);
}
}
}
not_found
+=
1
;
...
...
@@ -301,6 +310,7 @@ void et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const s1ap_data_ind)
}
S1AP_DEBUG
(
"Rx packet not found in scenario:
\n
"
);
et_display_packet_sctp
(
&
rx_packet
->
sctp_hdr
);
return
-
1
;
}
//------------------------------------------------------------------------------
...
...
@@ -344,6 +354,10 @@ void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t * const sctp_data_ind)
et_scenario_fsm_notify_event
(
event
);
memset
((
void
*
)
&
event
,
0
,
sizeof
(
event
));
event
.
code
=
ET_EVENT_TICK
;
et_scenario_fsm_notify_event
(
event
);
}
//------------------------------------------------------------------------------
void
et_s1ap_eNB_register_mme
(
s1ap_eNB_instance_t
*
instance_p
,
...
...
openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c
View file @
8a001c57
...
...
@@ -58,15 +58,15 @@ extern et_scenario_t *g_scenario;
extern
uint32_t
g_constraints
;
//------------------------------------------------------------------------------
int
et_s1ap_ies_is_matching
(
const
S1AP_PDU_PR
present
,
s1ap_message
*
const
m1
,
s1ap_message
*
const
m2
,
const
uint32_t
constraints
)
long
et_s1ap_ies_is_matching
(
const
S1AP_PDU_PR
present
,
s1ap_message
*
const
m1
,
s1ap_message
*
const
m2
,
const
uint32_t
constraints
)
{
long
ret
=
0
;
AssertFatal
(
m1
!=
NULL
,
"bad parameter m1"
);
AssertFatal
(
m2
!=
NULL
,
"bad parameter m2"
);
AssertFatal
((
present
==
S1AP_PDU_PR_initiatingMessage
)
||
(
present
==
S1AP_PDU_PR_successfulOutcome
)
||
(
present
==
S1AP_PDU_PR_unsuccessfulOutcome
)
,
"
b
ad parameter S1AP_PDU_PR present "
);
if
(
m1
->
procedureCode
!=
m2
->
procedureCode
)
return
-
ET_ERROR_MATCH_PACKET_S1AP_PROCEDURE_CODE
;
(
present
==
S1AP_PDU_PR_unsuccessfulOutcome
)
,
"
B
ad parameter S1AP_PDU_PR present "
);
AssertFatal
(
m1
->
procedureCode
==
m2
->
procedureCode
,
"Bad parameters: no matching procedure codes"
)
;
// some cases can never occur since uplink only.
...
...
openair3/TEST/EPC_TEST/play_scenario_sctp.c
View file @
8a001c57
...
...
@@ -44,7 +44,7 @@
#include "play_scenario.h"
//------------------------------------------------------------------------------
int
et_sctp_data_is_matching
(
sctp_datahdr_t
*
const
sctp1
,
sctp_datahdr_t
*
const
sctp2
,
const
uint32_t
constraints
)
long
et_sctp_data_is_matching
(
sctp_datahdr_t
*
const
sctp1
,
sctp_datahdr_t
*
const
sctp2
,
const
uint32_t
constraints
)
{
// no comparison for ports
if
(
sctp1
->
ppid
!=
sctp2
->
ppid
)
{
...
...
@@ -73,7 +73,7 @@ int et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * cons
}
//------------------------------------------------------------------------------
int
et_sctp_is_matching
(
et_sctp_hdr_t
*
const
sctp1
,
et_sctp_hdr_t
*
const
sctp2
,
const
uint32_t
constraints
)
long
et_sctp_is_matching
(
et_sctp_hdr_t
*
const
sctp1
,
et_sctp_hdr_t
*
const
sctp2
,
const
uint32_t
constraints
)
{
// no comparison for ports
if
(
sctp1
->
chunk_type
!=
sctp2
->
chunk_type
)
return
-
ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment