Commit e547fa87 authored by gauthier's avatar gauthier

Able to begin replay a scenario...debug needed

parent 8a001c57
......@@ -274,6 +274,7 @@ install_asn1c_from_source(){
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch.p0 >> /tmp/log_compile_asn1c
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_2.p0 >> /tmp/log_compile_asn1c
patch -p0 < $OPENAIR_DIR/openair2/RRC/LITE/MESSAGES/asn1c/asn1cpatch.p0 >> /tmp/log_compile_asn1c
patch -p0 < $OPENAIR_DIR/openair3/S1AP/MESSAGES/ASN1/asn1cpatch_3.p0 >> /tmp/log_compile_asn1c
./configure
make > /tmp/log_compile_asn1c 2>&1
$SUDO make install
......
......@@ -141,9 +141,14 @@ 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
$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
}
......
This diff is collapsed.
......@@ -331,18 +331,18 @@ int et_compare_et_ip_to_net_ip_address(const et_ip_t * const ip, const net_ip_ad
switch (ip->address_family) {
case AF_INET:
if (net_ip->ipv4) {
S1AP_DEBUG("%s(%s,%s)=%d\n",__FUNCTION__,ip->str, net_ip->ipv4_address, strcmp(ip->str, net_ip->ipv4_address));
//S1AP_DEBUG("%s(%s,%s)=%d\n",__FUNCTION__,ip->str, net_ip->ipv4_address, strcmp(ip->str, net_ip->ipv4_address));
return strcmp(ip->str, net_ip->ipv4_address);
}
S1AP_DEBUG("%s(%s,%s)=-1 (IP version (4) not matching)\n",__FUNCTION__,ip->str, net_ip->ipv4_address);
//S1AP_DEBUG("%s(%s,%s)=-1 (IP version (4) not matching)\n",__FUNCTION__,ip->str, net_ip->ipv4_address);
return -1;
break;
case AF_INET6:
if (net_ip->ipv6) {
S1AP_DEBUG("%s(%s,%s)=%d\n",__FUNCTION__,ip->str, net_ip->ipv4_address, strcmp(ip->str, net_ip->ipv6_address));
//S1AP_DEBUG("%s(%s,%s)=%d\n",__FUNCTION__,ip->str, net_ip->ipv4_address, strcmp(ip->str, net_ip->ipv6_address));
return strcmp(ip->str, net_ip->ipv6_address);
}
S1AP_DEBUG("%s(%s,%s)=-1 (IP version (6) not matching)\n",__FUNCTION__,ip->str, net_ip->ipv6_address);
//S1AP_DEBUG("%s(%s,%s)=-1 (IP version (6) not matching)\n",__FUNCTION__,ip->str, net_ip->ipv6_address);
return -1;
break;
default:
......
......@@ -87,6 +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");
}
LOG_D(ENB_APP, "Waiting RX packet num %d\n", packet->packet_number);
g_fsm_state = ET_FSM_STATE_WAITING_RX_EVENT;
packet->status = ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING;
}
......@@ -144,6 +145,7 @@ void et_scenario_schedule_tx_packet(et_packet_t * const packet)
packet->sctp_hdr.u.data_hdr.payload.binary_stream_allocated_size,
packet->sctp_hdr.u.data_hdr.stream);
packet->status = ET_PACKET_STATUS_SENT;
g_scenario->next_packet = g_scenario->next_packet->next;
g_fsm_state = ET_FSM_STATE_RUNNING;
}
break;
......@@ -161,8 +163,76 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event)
switch (event.code){
case ET_EVENT_TICK:
//TODO
while (NULL != g_scenario->next_packet) {
LOG_D(ENB_APP, "EVENT_TICK: Considering packet num %d:\n", g_scenario->next_packet->packet_number);
switch (g_scenario->next_packet->sctp_hdr.chunk_type) {
case SCTP_CID_DATA :
// no init in this scenario, may be sub-scenario
if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) {
if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
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->status != ET_PACKET_STATUS_SCHEDULED_FOR_SENDING) {
AssertFatal(0, "Invalid packet status %d", g_scenario->next_packet->status);
}
} else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) {
g_scenario->next_packet = g_scenario->next_packet->next;
} else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) {
et_scenario_wait_rx_packet(g_scenario->next_packet);
pthread_mutex_unlock(&g_fsm_lock);
return g_fsm_state;
} else {
AssertFatal(0, "Invalid packet status %d", g_scenario->next_packet->status);
}
} else {
AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action);
}
break;
case SCTP_CID_INIT:
case SCTP_CID_INIT_ACK:
case SCTP_CID_HEARTBEAT:
case SCTP_CID_HEARTBEAT_ACK:
case SCTP_CID_COOKIE_ECHO:
case SCTP_CID_COOKIE_ACK:
case SCTP_CID_ECN_ECNE:
case SCTP_CID_ECN_CWR:
LOG_D(ENB_APP, "EVENT_TICK: Ignoring packet num %d SCTP CID %s\n",
g_scenario->next_packet->packet_number,
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
g_scenario->next_packet = g_scenario->next_packet->next;
break;
case SCTP_CID_ABORT:
case SCTP_CID_SHUTDOWN:
case SCTP_CID_SHUTDOWN_ACK:
case SCTP_CID_ERROR:
case SCTP_CID_SHUTDOWN_COMPLETE:
AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)",
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
break;
default:
LOG_D(ENB_APP, "EVENT_TICK: Ignoring packet num %d SCTP CID %s\n",
g_scenario->next_packet->packet_number,
et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type));
g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT;
g_scenario->next_packet = g_scenario->next_packet->next;
}
}
fprintf(stderr, "No Packet found in this scenario: %s\n", g_scenario->name);
g_fsm_state = ET_FSM_STATE_NULL;
pthread_mutex_unlock(&g_fsm_lock);
return g_fsm_state;
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");
......@@ -186,6 +256,7 @@ 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_TICK:
fprintf(stdout, "EVENT_TICK: waiting for tx event\n");
break;
case ET_EVENT_RX_S1AP:
......@@ -202,6 +273,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event)
event.u.tx_timed_packet->sctp_hdr.u.data_hdr.payload.binary_stream_allocated_size,
event.u.tx_timed_packet->sctp_hdr.u.data_hdr.stream);
event.u.tx_timed_packet->status = ET_PACKET_STATUS_SENT;
g_scenario->next_packet = event.u.tx_timed_packet->next;
g_fsm_state = ET_FSM_STATE_RUNNING;
break;
......@@ -219,6 +291,7 @@ 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:
fprintf(stdout, "EVENT_TICK: waiting for rx event\n");
break;
case ET_EVENT_RX_PACKET_TIME_OUT:
......@@ -272,7 +345,6 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even
} else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) {
g_scenario->last_rx_packet = g_scenario->next_packet;
g_scenario->next_packet = g_scenario->next_packet->next;
g_scenario->time_last_rx_packet = g_scenario->last_rx_packet->timestamp_packet;
g_scenario->next_packet = g_scenario->next_packet->next;
......@@ -357,7 +429,6 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event)
} else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) {
g_scenario->last_rx_packet = g_scenario->next_packet;
g_scenario->next_packet = g_scenario->next_packet->next;
g_scenario->time_last_rx_packet = g_scenario->last_rx_packet->timestamp_packet;
g_scenario->next_packet = g_scenario->next_packet->next;
......
......@@ -250,9 +250,24 @@ et_packet_t* et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t * const
// return 0 if packet was waited
int et_scenario_set_packet_received(et_packet_t * const packet)
{
int rc = 0;
et_packet_t * p = NULL;
int rc = 0;
packet->status = ET_PACKET_STATUS_RECEIVED;
S1AP_DEBUG("Packet num %d received\n", packet->packet_number);
p = g_scenario->last_rx_packet;
while (NULL != p) {
if (p->action == ET_PACKET_ACTION_S1C_RECEIVE) {
if (p->status == ET_PACKET_STATUS_RECEIVED) {
g_scenario->last_rx_packet = p;
} else {
break;
}
}
p = p->next;
}
if (packet->timer_id != 0) {
rc = timer_remove(packet->timer_id);
AssertFatal(rc == 0, "TODO: Debug Timer on Rx packet num %d unknown", packet->packet_number);
......@@ -278,6 +293,7 @@ int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const s1ap_data_ind)
if (packet->action == ET_PACKET_ACTION_S1C_RECEIVE) {
if (packet->status == ET_PACKET_STATUS_RECEIVED) {
g_scenario->last_rx_packet = packet;
g_scenario->time_last_rx_packet = g_scenario->last_rx_packet->timestamp_packet;
} else {
break;
}
......@@ -286,7 +302,7 @@ int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const s1ap_data_ind)
}
packet = g_scenario->list_packet;
} else {
packet = g_scenario->last_rx_packet;
packet = g_scenario->last_rx_packet->next;
}
// not_found threshold may sure depend on number of mme, may be not sure on number of UE
while ((NULL != packet) && (not_found < 5)) {
......@@ -308,8 +324,8 @@ int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const s1ap_data_ind)
not_found += 1;
packet = packet->next;
}
S1AP_DEBUG("Rx packet not found in scenario:\n");
et_display_packet_sctp(&rx_packet->sctp_hdr);
AssertFatal(0, "Rx packet not found in scenario (see dump above)");
return -1;
}
......
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