s1 reset encoder/decoder is added

This commit is contained in:
Sukchan Lee 2018-03-21 16:10:20 +09:00
parent 13ece7f4d4
commit ef9d5948a8
10 changed files with 537 additions and 17 deletions

View File

@ -2056,7 +2056,7 @@ status_t s1ap_build_error_indication(
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
*MME_UE_S1AP_ID = *mme_ue_s1ap_id;
d_trace(5, " MME_UE_S1AP_ID[%d]\n", mme_ue_s1ap_id);
d_trace(5, " MME_UE_S1AP_ID[%d]\n", mme_ue_s1ap_id);
}
if (enb_ue_s1ap_id)
@ -2100,3 +2100,219 @@ status_t s1ap_build_error_indication(
return CORE_OK;
}
status_t s1ap_build_s1_reset(
pkbuf_t **s1apbuf,
S1AP_Cause_PR group, long cause,
S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface)
{
status_t rv;
S1AP_S1AP_PDU_t pdu;
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
S1AP_Reset_t *Reset = NULL;
S1AP_ResetIEs_t *ie = NULL;
S1AP_Cause_t *Cause = NULL;
S1AP_ResetType_t *ResetType = NULL;
d_trace(3, "[MME] Reset\n");
memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t));
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage =
core_calloc(1, sizeof(S1AP_InitiatingMessage_t));
initiatingMessage = pdu.choice.initiatingMessage;
initiatingMessage->procedureCode = S1AP_ProcedureCode_id_Reset;
initiatingMessage->criticality = S1AP_Criticality_ignore;
initiatingMessage->value.present =
S1AP_InitiatingMessage__value_PR_Reset;
Reset = &initiatingMessage->value.choice.Reset;
ie = core_calloc(1, sizeof(S1AP_ResetIEs_t));
ASN_SEQUENCE_ADD(&Reset->protocolIEs, ie);
ie->id = S1AP_ProtocolIE_ID_id_Cause;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_ResetIEs__value_PR_Cause;
Cause = &ie->value.choice.Cause;
ie = core_calloc(1, sizeof(S1AP_ResetIEs_t));
ASN_SEQUENCE_ADD(&Reset->protocolIEs, ie);
ie->id = S1AP_ProtocolIE_ID_id_ResetType;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_ResetIEs__value_PR_ResetType;
ResetType = &ie->value.choice.ResetType;
Cause->present = group;
Cause->choice.radioNetwork = cause;
d_trace(5, " Group[%d] Cause[%d] partOfS1_Interface[%p]\n",
Cause->present, Cause->choice.radioNetwork, partOfS1_Interface);
if (partOfS1_Interface)
{
ResetType->present = S1AP_ResetType_PR_partOfS1_Interface;
ResetType->choice.partOfS1_Interface = partOfS1_Interface;
}
else
{
ResetType->present = S1AP_ResetType_PR_s1_Interface;
ResetType->choice.s1_Interface = S1AP_ResetAll_reset_all;
}
rv = s1ap_encode_pdu(s1apbuf, &pdu);
s1ap_free_pdu(&pdu);
if (rv != CORE_OK)
{
d_error("s1ap_encode_pdu() failed");
return CORE_ERROR;
}
return CORE_OK;
}
status_t s1ap_build_s1_reset_partial(
pkbuf_t **s1apbuf,
S1AP_Cause_PR group, long cause,
S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id,
S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id)
{
S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface = NULL;
S1AP_UE_associatedLogicalS1_ConnectionItemRes_t *ie2 = NULL;
S1AP_UE_associatedLogicalS1_ConnectionItem_t *item = NULL;
partOfS1_Interface = core_calloc(1,
sizeof(S1AP_UE_associatedLogicalS1_ConnectionListRes_t));
d_assert(partOfS1_Interface, return CORE_ERROR,);
ie2 = core_calloc(1,
sizeof(S1AP_UE_associatedLogicalS1_ConnectionItemRes_t));
ASN_SEQUENCE_ADD(&partOfS1_Interface->list, ie2);
ie2->id = S1AP_ProtocolIE_ID_id_UE_associatedLogicalS1_ConnectionItem;
ie2->criticality = S1AP_Criticality_reject;
ie2->value.present = S1AP_UE_associatedLogicalS1_ConnectionItemRes__value_PR_UE_associatedLogicalS1_ConnectionItem;
item = &ie2->value.choice.UE_associatedLogicalS1_ConnectionItem;
item->mME_UE_S1AP_ID = mme_ue_s1ap_id;
item->eNB_UE_S1AP_ID = enb_ue_s1ap_id;
return s1ap_build_s1_reset(s1apbuf, group, cause, partOfS1_Interface);
}
status_t s1ap_build_s1_reset_ack(
pkbuf_t **s1apbuf,
S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface)
{
status_t rv;
S1AP_S1AP_PDU_t pdu;
S1AP_SuccessfulOutcome_t *successfulOutcome = NULL;
S1AP_ResetAcknowledge_t *ResetAcknowledge = NULL;
S1AP_ResetAcknowledgeIEs_t *ie = NULL;
d_trace(3, "[MME] ResetAcknowledge\n");
memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t));
pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome;
pdu.choice.successfulOutcome =
core_calloc(1, sizeof(S1AP_SuccessfulOutcome_t));
successfulOutcome = pdu.choice.successfulOutcome;
successfulOutcome->procedureCode = S1AP_ProcedureCode_id_Reset;
successfulOutcome->criticality = S1AP_Criticality_reject;
successfulOutcome->value.present =
S1AP_SuccessfulOutcome__value_PR_ResetAcknowledge;
ResetAcknowledge = &successfulOutcome->value.choice.ResetAcknowledge;
if (partOfS1_Interface && partOfS1_Interface->list.count)
{
int i = 0;
S1AP_UE_associatedLogicalS1_ConnectionListResAck_t *list = NULL;
ie = core_calloc(1, sizeof(S1AP_ResetAcknowledgeIEs_t));
ASN_SEQUENCE_ADD(&ResetAcknowledge->protocolIEs, ie);
ie->id =
S1AP_ProtocolIE_ID_id_UE_associatedLogicalS1_ConnectionListResAck;
ie->criticality = S1AP_Criticality_ignore;
ie->value.present = S1AP_ResetAcknowledgeIEs__value_PR_UE_associatedLogicalS1_ConnectionListResAck;
list = &ie->value.choice.UE_associatedLogicalS1_ConnectionListResAck;
for (i = 0; i < partOfS1_Interface->list.count; i++)
{
S1AP_UE_associatedLogicalS1_ConnectionItemRes_t *ie1 = NULL;
S1AP_UE_associatedLogicalS1_ConnectionItem_t *item1 = NULL;
S1AP_UE_associatedLogicalS1_ConnectionItemResAck_t *ie2 = NULL;
S1AP_UE_associatedLogicalS1_ConnectionItem_t *item2 = NULL;
ie1 = (S1AP_UE_associatedLogicalS1_ConnectionItemRes_t *)
partOfS1_Interface->list.array[i];
d_assert(ie1, return CORE_ERROR,);
item1 = &ie1->value.choice.UE_associatedLogicalS1_ConnectionItem;
d_assert(item1, return CORE_ERROR,);
if (item1->mME_UE_S1AP_ID == NULL && item1->eNB_UE_S1AP_ID == NULL)
{
d_warn("No MME_UE_S1AP_ID & ENB_UE_S1AP_ID");
continue;
}
ie2 = core_calloc(1,
sizeof(S1AP_UE_associatedLogicalS1_ConnectionItemResAck_t));
d_assert(ie2, return CORE_ERROR,);
ASN_SEQUENCE_ADD(&list->list, ie2);
ie2->id =
S1AP_ProtocolIE_ID_id_UE_associatedLogicalS1_ConnectionItem;
ie2->criticality = S1AP_Criticality_ignore;
ie2->value.present = S1AP_UE_associatedLogicalS1_ConnectionItemResAck__value_PR_UE_associatedLogicalS1_ConnectionItem;
item2 = &ie2->value.choice.UE_associatedLogicalS1_ConnectionItem;
d_assert(item2, return CORE_ERROR,);
if (item1->mME_UE_S1AP_ID)
{
item2->mME_UE_S1AP_ID = core_calloc(1,
sizeof(S1AP_MME_UE_S1AP_ID_t));
d_assert(item2->mME_UE_S1AP_ID, return CORE_ERROR,);
*item2->mME_UE_S1AP_ID = *item1->mME_UE_S1AP_ID;
}
if (item1->eNB_UE_S1AP_ID)
{
item2->eNB_UE_S1AP_ID = core_calloc(1,
sizeof(S1AP_ENB_UE_S1AP_ID_t));
d_assert(item2->eNB_UE_S1AP_ID, return CORE_ERROR,);
*item2->eNB_UE_S1AP_ID = *item1->eNB_UE_S1AP_ID;
}
d_trace(5, " MME_UE_S1AP_ID[%d] ENB_UE_S1AP_ID[%d]\n",
item2->mME_UE_S1AP_ID ? *item2->mME_UE_S1AP_ID : -1,
item2->eNB_UE_S1AP_ID ? *item2->eNB_UE_S1AP_ID : -1);
}
}
rv = s1ap_encode_pdu(s1apbuf, &pdu);
s1ap_free_pdu(&pdu);
if (rv != CORE_OK)
{
d_error("s1ap_encode_pdu() failed");
return CORE_ERROR;
}
return CORE_OK;
}

View File

@ -60,6 +60,21 @@ CORE_DECLARE(status_t) s1ap_build_error_indication(
S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id,
S1AP_Cause_PR group, long cause);
CORE_DECLARE(status_t) s1ap_build_s1_reset(
pkbuf_t **s1apbuf,
S1AP_Cause_PR group, long cause,
S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface);
CORE_DECLARE(status_t) s1ap_build_s1_reset_partial(
pkbuf_t **s1apbuf,
S1AP_Cause_PR group, long cause,
S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id,
S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id);
CORE_DECLARE(status_t) s1ap_build_s1_reset_ack(
pkbuf_t **s1apbuf,
S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -533,17 +533,17 @@ void s1ap_handle_initial_context_setup_response(
for (i = 0; i < E_RABSetupListCtxtSURes->list.count; i++)
{
S1AP_E_RABSetupItemCtxtSUResIEs_t *item = NULL;
S1AP_E_RABSetupItemCtxtSUResIEs_t *ie2 = NULL;
S1AP_E_RABSetupItemCtxtSURes_t *e_rab = NULL;
mme_sess_t *sess = NULL;
mme_bearer_t *bearer = NULL;
item = (S1AP_E_RABSetupItemCtxtSUResIEs_t *)
ie2 = (S1AP_E_RABSetupItemCtxtSUResIEs_t *)
E_RABSetupListCtxtSURes->list.array[i];
d_assert(item, return,);
d_assert(ie2, return,);
e_rab = &item->value.choice.E_RABSetupItemCtxtSURes;
e_rab = &ie2->value.choice.E_RABSetupItemCtxtSURes;
d_assert(e_rab, return, "Null param");
sess = mme_sess_find_by_ebi(mme_ue, e_rab->e_RAB_ID);
@ -755,16 +755,16 @@ void s1ap_handle_e_rab_setup_response(
for (i = 0; i < E_RABSetupListBearerSURes->list.count; i++)
{
S1AP_E_RABSetupItemBearerSUResIEs_t *item = NULL;
S1AP_E_RABSetupItemBearerSUResIEs_t *ie2 = NULL;
S1AP_E_RABSetupItemBearerSURes_t *e_rab = NULL;
mme_bearer_t *bearer = NULL;
item = (S1AP_E_RABSetupItemBearerSUResIEs_t *)
ie2 = (S1AP_E_RABSetupItemBearerSUResIEs_t *)
E_RABSetupListBearerSURes->list.array[i];
d_assert(item, return,);
d_assert(ie2, return,);
e_rab = &item->value.choice.E_RABSetupItemBearerSURes;
e_rab = &ie2->value.choice.E_RABSetupItemBearerSURes;
d_assert(e_rab, return, "Null param");
bearer = mme_bearer_find_by_ue_ebi(mme_ue, e_rab->e_RAB_ID);
@ -1236,16 +1236,16 @@ void s1ap_handle_path_switch_request(
d_assert(E_RABToBeSwitchedDLList, return,);
for (i = 0; i < E_RABToBeSwitchedDLList->list.count; i++)
{
S1AP_E_RABToBeSwitchedDLItemIEs_t *item = NULL;
S1AP_E_RABToBeSwitchedDLItemIEs_t *ie2 = NULL;
S1AP_E_RABToBeSwitchedDLItem_t *e_rab = NULL;
mme_bearer_t *bearer = NULL;
item = (S1AP_E_RABToBeSwitchedDLItemIEs_t *)
ie2 = (S1AP_E_RABToBeSwitchedDLItemIEs_t *)
E_RABToBeSwitchedDLList->list.array[i];
d_assert(item, return,);
d_assert(ie2, return,);
e_rab = &item->value.choice.E_RABToBeSwitchedDLItem;
e_rab = &ie2->value.choice.E_RABToBeSwitchedDLItem;
d_assert(e_rab, return, "Null param");
bearer = mme_bearer_find_by_ue_ebi(mme_ue, e_rab->e_RAB_ID);
@ -1541,15 +1541,15 @@ void s1ap_handle_handover_request_ack(mme_enb_t *enb, s1ap_message_t *message)
for (i = 0; i < E_RABAdmittedList->list.count; i++)
{
S1AP_E_RABAdmittedItemIEs_t *item = NULL;
S1AP_E_RABAdmittedItemIEs_t *ie2 = NULL;
S1AP_E_RABAdmittedItem_t *e_rab = NULL;
mme_bearer_t *bearer = NULL;
item = (S1AP_E_RABAdmittedItemIEs_t *)E_RABAdmittedList->list.array[i];
d_assert(item, return,);
ie2 = (S1AP_E_RABAdmittedItemIEs_t *)E_RABAdmittedList->list.array[i];
d_assert(ie2, return,);
e_rab = &item->value.choice.E_RABAdmittedItem;
e_rab = &ie2->value.choice.E_RABAdmittedItem;
d_assert(e_rab, return,);
bearer = mme_bearer_find_by_ue_ebi(mme_ue, e_rab->e_RAB_ID);
@ -1972,3 +1972,126 @@ void s1ap_handle_handover_notification(mme_enb_t *enb, s1ap_message_t *message)
sess = mme_sess_next(sess);
}
}
void s1ap_handle_s1_reset(
mme_enb_t *enb, s1ap_message_t *message)
{
status_t rv;
char buf[CORE_ADDRSTRLEN];
int i;
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
S1AP_Reset_t *Reset = NULL;
S1AP_ResetIEs_t *ie = NULL;
S1AP_Cause_t *Cause = NULL;
S1AP_ResetType_t *ResetType = NULL;
S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface = NULL;
d_assert(enb, return,);
d_assert(enb->sock, return,);
d_assert(message, return,);
initiatingMessage = message->choice.initiatingMessage;
d_assert(initiatingMessage, return,);
Reset = &initiatingMessage->value.choice.Reset;
d_assert(Reset, return,);
d_trace(3, "[MME] Reset\n");
for (i = 0; i < Reset->protocolIEs.list.count; i++)
{
ie = Reset->protocolIEs.list.array[i];
switch(ie->id)
{
case S1AP_ProtocolIE_ID_id_Cause:
Cause = &ie->value.choice.Cause;
break;
case S1AP_ProtocolIE_ID_id_ResetType:
ResetType = &ie->value.choice.ResetType;
break;
default:
break;
}
}
d_trace(5, " IP[%s] ENB_ID[%d]\n",
CORE_ADDR(enb->addr, buf), enb->enb_id);
d_assert(Cause, return,);
d_trace(5, " Cause[Group:%d Cause:%d]\n",
Cause->present, Cause->choice.radioNetwork);
switch(Cause->present)
{
case S1AP_Cause_PR_radioNetwork:
case S1AP_Cause_PR_transport:
case S1AP_Cause_PR_protocol:
case S1AP_Cause_PR_misc:
break;
case S1AP_Cause_PR_nas:
d_warn("NAS-Cause[%d]", Cause->choice.nas);
default:
d_warn("Invalid cause group[%d]", Cause->present);
break;
}
d_assert(ResetType, return,);
switch(ResetType->present)
{
case S1AP_ResetType_PR_s1_Interface:
{
d_trace(5, " S1AP_ResetType_PR_s1_Interface\n");
break;
}
case S1AP_ResetType_PR_partOfS1_Interface:
{
d_trace(5, " S1AP_ResetType_PR_partOfS1_Interface\n");
partOfS1_Interface = ResetType->choice.partOfS1_Interface;
d_assert(partOfS1_Interface, return,);
for (i = 0; i < partOfS1_Interface->list.count; i++)
{
S1AP_UE_associatedLogicalS1_ConnectionItemRes_t *ie2 = NULL;
S1AP_UE_associatedLogicalS1_ConnectionItem_t *item = NULL;
enb_ue_t *enb_ue = NULL;
ie2 = (S1AP_UE_associatedLogicalS1_ConnectionItemRes_t *)
partOfS1_Interface->list.array[i];
d_assert(ie2, return,);
item = &ie2->value.choice.UE_associatedLogicalS1_ConnectionItem;
d_assert(item, return,);
d_trace(5, " MME_UE_S1AP_ID[%d] ENB_UE_S1AP_ID[%d]\n",
item->mME_UE_S1AP_ID ? *item->mME_UE_S1AP_ID : -1,
item->eNB_UE_S1AP_ID ? *item->eNB_UE_S1AP_ID : -1);
if (item->mME_UE_S1AP_ID)
enb_ue = enb_ue_find_by_mme_ue_s1ap_id(
*item->mME_UE_S1AP_ID);
else if (item->eNB_UE_S1AP_ID)
enb_ue = enb_ue_find_by_enb_ue_s1ap_id(enb,
*item->eNB_UE_S1AP_ID);
if (enb_ue == NULL)
{
d_warn("Cannot find S1 Context "
"(MME_UE_S1AP_ID[%d] ENB_UE_S1AP_ID[%d])\n",
item->mME_UE_S1AP_ID ? *item->mME_UE_S1AP_ID : -1,
item->eNB_UE_S1AP_ID ? *item->eNB_UE_S1AP_ID : -1);
continue;
}
}
break;
}
default:
d_warn("Invalid ResetType[%d]", ResetType->present);
break;
}
rv = s1ap_send_s1_reset_ack(enb, partOfS1_Interface);
d_assert(rv == CORE_OK,,);
}

View File

@ -50,6 +50,8 @@ CORE_DECLARE(void) s1ap_handle_enb_configuration_transfer(
CORE_DECLARE(void) s1ap_handle_handover_notification(
mme_enb_t *enb, s1ap_message_t *message);
CORE_DECLARE(void) s1ap_handle_s1_reset(
mme_enb_t *enb, s1ap_message_t *message);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -508,3 +508,21 @@ status_t s1ap_send_error_indication(
return rv;
}
status_t s1ap_send_s1_reset_ack(
mme_enb_t *enb,
S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface)
{
status_t rv;
pkbuf_t *s1apbuf = NULL;
d_assert(enb, return CORE_ERROR,);
rv = s1ap_build_s1_reset_ack(&s1apbuf, partOfS1_Interface);
d_assert(rv == CORE_OK && s1apbuf, return CORE_ERROR, "s1ap build error");
rv = s1ap_send_to_enb(enb, s1apbuf);
d_assert(rv == CORE_OK,, "s1ap send error");
return rv;
}

View File

@ -72,6 +72,9 @@ CORE_DECLARE(status_t) s1ap_send_error_indication(
S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id,
S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id,
S1AP_Cause_PR group, long cause);
CORE_DECLARE(status_t) s1ap_send_s1_reset_ack(
mme_enb_t *enb,
S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface);
#ifdef __cplusplus
}

View File

@ -125,6 +125,11 @@ void s1ap_state_operational(fsm_t *s, event_t *e)
s1ap_handle_handover_notification(enb, pdu);
break;
}
case S1AP_ProcedureCode_id_Reset:
{
s1ap_handle_s1_reset(enb, pdu);
break;
}
default:
{
d_warn("Not implemented(choice:%d, proc:%d)",

View File

@ -6,6 +6,7 @@
#include "app/context.h"
#include "mme/mme_context.h"
#include "mme/s1ap_build.h"
#include "s1ap/s1ap_message.h"
#include "testutil.h"
@ -1612,6 +1613,99 @@ static void attach_test5(abts_case *tc, void *data)
d_assert(mme_ue, goto out,);
m_tmsi = mme_ue->guti.m_tmsi;
#if 0
#if 0
rv = tests1ap_build_s1_reset(&sendbuf, 0);
#elif 0
rv = s1ap_build_s1_reset(&sendbuf,
S1AP_Cause_PR_radioNetwork,
S1AP_CauseRadioNetwork_release_due_to_eutran_generated_reason,
NULL);
#elif 0
S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id = NULL;
S1AP_ENB_UE_S1AP_ID_t *enb_ue_s1ap_id = NULL;
#if 0
mme_ue_s1ap_id = core_calloc(1, sizeof(S1AP_MME_UE_S1AP_ID_t));
d_assert(mme_ue_s1ap_id, goto out,);
*mme_ue_s1ap_id = 100;
#else
enb_ue_s1ap_id = core_calloc(1, sizeof(S1AP_ENB_UE_S1AP_ID_t));
d_assert(enb_ue_s1ap_id, goto out,);
*enb_ue_s1ap_id = 4;
#endif
rv = s1ap_build_s1_reset_partial(&sendbuf,
S1AP_Cause_PR_radioNetwork,
S1AP_CauseRadioNetwork_release_due_to_eutran_generated_reason,
mme_ue_s1ap_id, enb_ue_s1ap_id);
#else
S1AP_UE_associatedLogicalS1_ConnectionListRes_t *partOfS1_Interface = NULL;
S1AP_UE_associatedLogicalS1_ConnectionItemRes_t *ie = NULL;
S1AP_UE_associatedLogicalS1_ConnectionItem_t *item = NULL;
partOfS1_Interface = core_calloc(1,
sizeof(S1AP_UE_associatedLogicalS1_ConnectionListRes_t));
d_assert(partOfS1_Interface, goto out,);
ie = core_calloc(1,
sizeof(S1AP_UE_associatedLogicalS1_ConnectionItemRes_t));
ASN_SEQUENCE_ADD(&partOfS1_Interface->list, ie);
ie->id = S1AP_ProtocolIE_ID_id_UE_associatedLogicalS1_ConnectionItem;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_UE_associatedLogicalS1_ConnectionItemRes__value_PR_UE_associatedLogicalS1_ConnectionItem;
item = &ie->value.choice.UE_associatedLogicalS1_ConnectionItem;
item->mME_UE_S1AP_ID = core_calloc(1, sizeof(S1AP_MME_UE_S1AP_ID_t));
d_assert(item->mME_UE_S1AP_ID, goto out,);
*item->mME_UE_S1AP_ID = 100;
item->eNB_UE_S1AP_ID = core_calloc(1, sizeof(S1AP_ENB_UE_S1AP_ID_t));
d_assert(item->eNB_UE_S1AP_ID, goto out,);
*item->eNB_UE_S1AP_ID = 4;
ie = core_calloc(1,
sizeof(S1AP_UE_associatedLogicalS1_ConnectionItemRes_t));
ASN_SEQUENCE_ADD(&partOfS1_Interface->list, ie);
ie->id = S1AP_ProtocolIE_ID_id_UE_associatedLogicalS1_ConnectionItem;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_UE_associatedLogicalS1_ConnectionItemRes__value_PR_UE_associatedLogicalS1_ConnectionItem;
item = &ie->value.choice.UE_associatedLogicalS1_ConnectionItem;
item->mME_UE_S1AP_ID = core_calloc(1, sizeof(S1AP_MME_UE_S1AP_ID_t));
d_assert(item->mME_UE_S1AP_ID, goto out,);
*item->mME_UE_S1AP_ID = 2;
item->eNB_UE_S1AP_ID = core_calloc(1, sizeof(S1AP_ENB_UE_S1AP_ID_t));
d_assert(item->eNB_UE_S1AP_ID, goto out,);
*item->eNB_UE_S1AP_ID = 3;
ie = core_calloc(1,
sizeof(S1AP_UE_associatedLogicalS1_ConnectionItemRes_t));
ASN_SEQUENCE_ADD(&partOfS1_Interface->list, ie);
ie->id = S1AP_ProtocolIE_ID_id_UE_associatedLogicalS1_ConnectionItem;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_UE_associatedLogicalS1_ConnectionItemRes__value_PR_UE_associatedLogicalS1_ConnectionItem;
item = &ie->value.choice.UE_associatedLogicalS1_ConnectionItem;
item->mME_UE_S1AP_ID = core_calloc(1, sizeof(S1AP_MME_UE_S1AP_ID_t));
d_assert(item->mME_UE_S1AP_ID, goto out,);
*item->mME_UE_S1AP_ID = 44;
rv = s1ap_build_s1_reset(&sendbuf,
S1AP_Cause_PR_radioNetwork,
S1AP_CauseRadioNetwork_release_due_to_eutran_generated_reason,
partOfS1_Interface);
#endif
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = tests1ap_enb_send(sock, sendbuf);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
core_sleep(time_from_msec(1000));
#else
/* Send Service request */
rv = tests1ap_build_service_request(&sendbuf,
0x40072e, 4, 0xda67, m_tmsi);
@ -1636,6 +1730,7 @@ static void attach_test5(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = tests1ap_enb_send(sock, sendbuf);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
#endif
core_sleep(time_from_msec(300));

View File

@ -2400,6 +2400,47 @@ status_t tests1ap_build_handover_cancel(pkbuf_t **pkbuf, int i)
return CORE_OK;
}
status_t tests1ap_build_s1_reset(pkbuf_t **pkbuf, int i)
{
char *payload[TESTS1AP_MAX_MESSAGE] = {
"000e001500000200 0240020060005c00 084000005b000220 04",
"",
"",
"",
"",
"",
"",
"",
"",
};
c_uint16_t len[TESTS1AP_MAX_MESSAGE] = {
25,
0,
0,
0,
0,
0,
0,
0,
0,
};
char hexbuf[MAX_SDU_LEN];
*pkbuf = pkbuf_alloc(0, MAX_SDU_LEN);
if (!(*pkbuf)) return CORE_ERROR;
(*pkbuf)->len = len[i];
memcpy((*pkbuf)->payload, CORE_HEX(payload[i], strlen(payload[i]), hexbuf),
(*pkbuf)->len);
return CORE_OK;
}
status_t testgtpu_enb_connect(sock_id *new)
{
char buf[INET_ADDRSTRLEN];

View File

@ -90,6 +90,8 @@ CORE_DECLARE(status_t) tests1ap_build_enb_configuration_transfer(
CORE_DECLARE(status_t) tests1ap_build_handover_notify(pkbuf_t **pkbuf, int i);
CORE_DECLARE(status_t) tests1ap_build_handover_cancel(pkbuf_t **pkbuf, int i);
CORE_DECLARE(status_t) tests1ap_build_s1_reset(pkbuf_t **pkbuf, int i);
CORE_DECLARE(status_t) testgtpu_enb_connect(sock_id *new);
CORE_DECLARE(status_t) testgtpu_enb2_connect(sock_id *new);
CORE_DECLARE(status_t) testgtpu_enb_close(sock_id sock);