forked from acouzens/open5gs
Path Switch Request is added
This commit is contained in:
parent
49fba95ebb
commit
5172d2034a
|
@ -1124,11 +1124,17 @@ status_t s1ap_build_paging(pkbuf_t **s1apbuf, mme_ue_t *mme_ue)
|
|||
|
||||
status_t s1ap_build_path_switch_ack(pkbuf_t **s1apbuf, mme_ue_t *mme_ue)
|
||||
{
|
||||
#if 0
|
||||
int encoded;
|
||||
s1ap_message_t message;
|
||||
S1AP_PathSwitchRequestAcknowledgeIEs_t *ies =
|
||||
&message.s1ap_PathSwitchRequestAcknowledgeIEs;
|
||||
status_t rv;
|
||||
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
S1AP_SuccessfulOutcome_t *successfulOutcome = NULL;
|
||||
S1AP_PathSwitchRequestAcknowledge_t *PathSwitchRequestAcknowledge = NULL;
|
||||
|
||||
S1AP_PathSwitchRequestAcknowledgeIEs_t *ie = NULL;
|
||||
S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL;
|
||||
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
||||
S1AP_SecurityContext_t *SecurityContext = NULL;
|
||||
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
|
||||
d_assert(mme_ue, return CORE_ERROR, "Null param");
|
||||
|
@ -1136,31 +1142,74 @@ status_t s1ap_build_path_switch_ack(pkbuf_t **s1apbuf, mme_ue_t *mme_ue)
|
|||
d_assert(enb_ue, return CORE_ERROR, "Null param");
|
||||
|
||||
d_trace(3, "[MME] Path switch acknowledge\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_PathSwitchRequest;
|
||||
successfulOutcome->criticality = S1AP_Criticality_reject;
|
||||
successfulOutcome->value.present =
|
||||
S1AP_SuccessfulOutcome__value_PR_PathSwitchRequestAcknowledge;
|
||||
|
||||
PathSwitchRequestAcknowledge =
|
||||
&successfulOutcome->value.choice.PathSwitchRequestAcknowledge;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestAcknowledgeIEs_t));
|
||||
ASN_SEQUENCE_ADD(&PathSwitchRequestAcknowledge->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present =
|
||||
S1AP_PathSwitchRequestAcknowledgeIEs__value_PR_MME_UE_S1AP_ID;
|
||||
|
||||
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestAcknowledgeIEs_t));
|
||||
ASN_SEQUENCE_ADD(&PathSwitchRequestAcknowledge->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present =
|
||||
S1AP_PathSwitchRequestAcknowledgeIEs__value_PR_ENB_UE_S1AP_ID;
|
||||
|
||||
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestAcknowledgeIEs_t));
|
||||
ASN_SEQUENCE_ADD(&PathSwitchRequestAcknowledge->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_SecurityContext;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present =
|
||||
S1AP_PathSwitchRequestAcknowledgeIEs__value_PR_SecurityContext;
|
||||
|
||||
SecurityContext = &ie->value.choice.SecurityContext;
|
||||
|
||||
d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n",
|
||||
enb_ue->enb_ue_s1ap_id, enb_ue->mme_ue_s1ap_id);
|
||||
|
||||
memset(&message, 0, sizeof(s1ap_message_t));
|
||||
*MME_UE_S1AP_ID = enb_ue->mme_ue_s1ap_id;
|
||||
*ENB_UE_S1AP_ID = enb_ue->enb_ue_s1ap_id;
|
||||
|
||||
ies->mme_ue_s1ap_id = enb_ue->mme_ue_s1ap_id;
|
||||
ies->eNB_UE_S1AP_ID = enb_ue->enb_ue_s1ap_id;
|
||||
|
||||
ies->securityContext.nextHopChainingCount = mme_ue->nhcc;
|
||||
ies->securityContext.nextHopParameter.size = SHA256_DIGEST_SIZE;
|
||||
ies->securityContext.nextHopParameter.buf =
|
||||
core_calloc(ies->securityContext.nextHopParameter.size,
|
||||
SecurityContext->nextHopChainingCount = mme_ue->nhcc;
|
||||
SecurityContext->nextHopParameter.size = SHA256_DIGEST_SIZE;
|
||||
SecurityContext->nextHopParameter.buf =
|
||||
core_calloc(SecurityContext->nextHopParameter.size,
|
||||
sizeof(c_uint8_t));
|
||||
ies->securityContext.nextHopParameter.bits_unused = 0;
|
||||
memcpy(ies->securityContext.nextHopParameter.buf,
|
||||
mme_ue->nh, ies->securityContext.nextHopParameter.size);
|
||||
SecurityContext->nextHopParameter.bits_unused = 0;
|
||||
memcpy(SecurityContext->nextHopParameter.buf,
|
||||
mme_ue->nh, SecurityContext->nextHopParameter.size);
|
||||
|
||||
message.procedureCode = S1AP_ProcedureCode_id_PathSwitchRequest;
|
||||
message.direction = S1AP_PDU_PR_successfulOutcome;
|
||||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
encoded = s1ap_encode_pdu(s1apbuf, &message);
|
||||
s1ap_free_pdu(&message);
|
||||
|
||||
d_assert(s1apbuf && encoded >= 0,return CORE_ERROR,);
|
||||
#endif
|
||||
if (rv != CORE_OK)
|
||||
{
|
||||
d_error("s1ap_encode_pdu() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
@ -1169,32 +1218,80 @@ status_t s1ap_build_path_switch_failure(pkbuf_t **s1apbuf,
|
|||
c_uint32_t enb_ue_s1ap_id, c_uint32_t mme_ue_s1ap_id,
|
||||
S1AP_Cause_PR group, long cause)
|
||||
{
|
||||
#if 0
|
||||
int encoded;
|
||||
s1ap_message_t message;
|
||||
S1AP_PathSwitchRequestFailureIEs_t *ies =
|
||||
&message.s1ap_PathSwitchRequestFailureIEs;
|
||||
status_t rv;
|
||||
|
||||
memset(&message, 0, sizeof(s1ap_message_t));
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
S1AP_UnsuccessfulOutcome_t *unsuccessfulOutcome = NULL;
|
||||
S1AP_PathSwitchRequestFailure_t *PathSwitchRequestFailure = NULL;
|
||||
|
||||
S1AP_PathSwitchRequestFailureIEs_t *ie = NULL;
|
||||
S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL;
|
||||
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
||||
S1AP_Cause_t *Cause = NULL;
|
||||
|
||||
d_trace(3, "[MME] Path switch failure\n");
|
||||
|
||||
memset(&pdu, 0, sizeof (S1AP_S1AP_PDU_t));
|
||||
pdu.present = S1AP_S1AP_PDU_PR_unsuccessfulOutcome;
|
||||
pdu.choice.unsuccessfulOutcome =
|
||||
core_calloc(1, sizeof(S1AP_UnsuccessfulOutcome_t));
|
||||
|
||||
unsuccessfulOutcome = pdu.choice.unsuccessfulOutcome;
|
||||
unsuccessfulOutcome->procedureCode =
|
||||
S1AP_ProcedureCode_id_PathSwitchRequest;
|
||||
unsuccessfulOutcome->criticality = S1AP_Criticality_reject;
|
||||
unsuccessfulOutcome->value.present =
|
||||
S1AP_UnsuccessfulOutcome__value_PR_PathSwitchRequestFailure;
|
||||
|
||||
PathSwitchRequestFailure =
|
||||
&unsuccessfulOutcome->value.choice.PathSwitchRequestFailure;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestFailureIEs_t));
|
||||
ASN_SEQUENCE_ADD(&PathSwitchRequestFailure->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present =
|
||||
S1AP_PathSwitchRequestFailureIEs__value_PR_MME_UE_S1AP_ID;
|
||||
|
||||
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestFailureIEs_t));
|
||||
ASN_SEQUENCE_ADD(&PathSwitchRequestFailure->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present =
|
||||
S1AP_PathSwitchRequestFailureIEs__value_PR_ENB_UE_S1AP_ID;
|
||||
|
||||
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestFailureIEs_t));
|
||||
ASN_SEQUENCE_ADD(&PathSwitchRequestFailure->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_Cause;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_PathSwitchRequestFailureIEs__value_PR_Cause;
|
||||
|
||||
Cause = &ie->value.choice.Cause;
|
||||
|
||||
d_trace(5, " ENB_UE_S1AP_ID[%d] MME_UE_S1AP_ID[%d]\n",
|
||||
enb_ue_s1ap_id, mme_ue_s1ap_id);
|
||||
d_trace(5, " Group[%d] Cause[%d]\n", group, cause);
|
||||
|
||||
ies->mme_ue_s1ap_id = mme_ue_s1ap_id;
|
||||
ies->eNB_UE_S1AP_ID = enb_ue_s1ap_id;
|
||||
ies->cause.present = group;
|
||||
ies->cause.choice.radioNetwork = cause;
|
||||
*MME_UE_S1AP_ID = mme_ue_s1ap_id;
|
||||
*ENB_UE_S1AP_ID = enb_ue_s1ap_id;
|
||||
Cause->present = group;
|
||||
Cause->choice.radioNetwork = cause;
|
||||
|
||||
message.procedureCode = S1AP_ProcedureCode_id_PathSwitchRequest;
|
||||
message.direction = S1AP_PDU_PR_unsuccessfulOutcome;
|
||||
rv = s1ap_encode_pdu(s1apbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
encoded = s1ap_encode_pdu(s1apbuf, &message);
|
||||
s1ap_free_pdu(&message);
|
||||
|
||||
d_assert(s1apbuf && encoded >= 0,return CORE_ERROR,);
|
||||
#endif
|
||||
if (rv != CORE_OK)
|
||||
{
|
||||
d_error("s1ap_encode_pdu() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
|
|
@ -1076,66 +1076,105 @@ void s1ap_handle_paging(mme_ue_t *mme_ue)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void s1ap_handle_path_switch_request(
|
||||
mme_enb_t *enb, s1ap_message_t *message)
|
||||
{
|
||||
status_t rv;
|
||||
char buf[CORE_ADDRSTRLEN];
|
||||
int i;
|
||||
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
||||
S1AP_PathSwitchRequest_t *PathSwitchRequest = NULL;
|
||||
|
||||
S1AP_PathSwitchRequestIEs_t *ies = NULL;
|
||||
S1AP_EUTRAN_CGI_t *eutran_cgi;
|
||||
S1AP_PLMNidentity_t *PLMNidentity = NULL;
|
||||
S1AP_PathSwitchRequestIEs_t *ie = NULL;
|
||||
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
||||
S1AP_E_RABToBeSwitchedDLList_t *E_RABToBeSwitchedDLList = NULL;
|
||||
S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL;
|
||||
S1AP_EUTRAN_CGI_t *EUTRAN_CGI = NULL;
|
||||
S1AP_TAI_t *TAI = NULL;
|
||||
S1AP_UESecurityCapabilities_t *UESecurityCapabilities = NULL;
|
||||
|
||||
S1AP_PLMNidentity_t *pLMNidentity = NULL;
|
||||
S1AP_CellIdentity_t *cell_ID = NULL;
|
||||
S1AP_TAI_t *tai;
|
||||
S1AP_TAC_t *tAC = NULL;
|
||||
S1AP_UESecurityCapabilities_t *ueSecurityCapabilities = NULL;
|
||||
S1AP_EncryptionAlgorithms_t *encryptionAlgorithms = NULL;
|
||||
S1AP_IntegrityProtectionAlgorithms_t *integrityProtectionAlgorithms = NULL;
|
||||
c_uint16_t eea = 0, eia = 0;
|
||||
|
||||
d_assert(enb, return, "Null param");
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
|
||||
ies = &message->s1ap_PathSwitchRequestIEs;
|
||||
d_assert(ies, return, "Null param");
|
||||
d_assert(enb, return,);
|
||||
d_assert(enb->sock, return,);
|
||||
|
||||
d_assert(message, return,);
|
||||
initiatingMessage = message->choice.initiatingMessage;
|
||||
d_assert(initiatingMessage, return,);
|
||||
PathSwitchRequest = &initiatingMessage->value.choice.PathSwitchRequest;
|
||||
d_assert(PathSwitchRequest, return,);
|
||||
|
||||
d_trace(3, "[MME] Path switch request\n");
|
||||
|
||||
for (i = 0; i < PathSwitchRequest->protocolIEs.list.count; i++)
|
||||
{
|
||||
ie = PathSwitchRequest->protocolIEs.list.array[i];
|
||||
switch(ie->id)
|
||||
{
|
||||
case S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID:
|
||||
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
||||
break;
|
||||
case S1AP_ProtocolIE_ID_id_E_RABToBeSwitchedDLList:
|
||||
E_RABToBeSwitchedDLList =
|
||||
&ie->value.choice.E_RABToBeSwitchedDLList;
|
||||
break;
|
||||
case S1AP_ProtocolIE_ID_id_SourceMME_UE_S1AP_ID:
|
||||
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
|
||||
break;
|
||||
case S1AP_ProtocolIE_ID_id_EUTRAN_CGI:
|
||||
EUTRAN_CGI = &ie->value.choice.EUTRAN_CGI;
|
||||
break;
|
||||
case S1AP_ProtocolIE_ID_id_TAI:
|
||||
TAI = &ie->value.choice.TAI;
|
||||
break;
|
||||
case S1AP_ProtocolIE_ID_id_UESecurityCapabilities:
|
||||
UESecurityCapabilities = &ie->value.choice.UESecurityCapabilities;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
d_trace(5, " IP[%s] ENB_ID[%d]\n",
|
||||
CORE_ADDR(enb->addr, buf), enb->enb_id);
|
||||
|
||||
eutran_cgi = &ies->eutran_cgi;
|
||||
d_assert(eutran_cgi, return,);
|
||||
PLMNidentity = &eutran_cgi->PLMNidentity;
|
||||
d_assert(PLMNidentity && PLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
cell_ID = &eutran_cgi->cell_ID;
|
||||
d_assert(EUTRAN_CGI, return,);
|
||||
pLMNidentity = &EUTRAN_CGI->pLMNidentity;
|
||||
d_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
cell_ID = &EUTRAN_CGI->cell_ID;
|
||||
d_assert(cell_ID, return,);
|
||||
|
||||
tai = &ies->tai;
|
||||
d_assert(tai, return,);
|
||||
PLMNidentity = &tai->PLMNidentity;
|
||||
d_assert(PLMNidentity && PLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
tAC = &tai->tAC;
|
||||
d_assert(TAI, return,);
|
||||
pLMNidentity = &TAI->pLMNidentity;
|
||||
d_assert(pLMNidentity && pLMNidentity->size == sizeof(plmn_id_t), return,);
|
||||
tAC = &TAI->tAC;
|
||||
d_assert(tAC && tAC->size == sizeof(c_uint16_t), return,);
|
||||
|
||||
ueSecurityCapabilities = &ies->ueSecurityCapabilities;
|
||||
d_assert(ueSecurityCapabilities, return,);
|
||||
d_assert(UESecurityCapabilities, return,);
|
||||
encryptionAlgorithms =
|
||||
&ueSecurityCapabilities->encryptionAlgorithms;
|
||||
&UESecurityCapabilities->encryptionAlgorithms;
|
||||
integrityProtectionAlgorithms =
|
||||
&ueSecurityCapabilities->integrityProtectionAlgorithms;
|
||||
&UESecurityCapabilities->integrityProtectionAlgorithms;
|
||||
|
||||
enb_ue = enb_ue_find_by_mme_ue_s1ap_id(ies->sourceMME_UE_S1AP_ID);
|
||||
d_assert(MME_UE_S1AP_ID, return,);
|
||||
d_assert(ENB_UE_S1AP_ID, return,);
|
||||
enb_ue = enb_ue_find_by_mme_ue_s1ap_id(*MME_UE_S1AP_ID);
|
||||
if (!enb_ue)
|
||||
{
|
||||
d_error("Cannot find UE from sourceMME-UE-S1AP-ID[%d] and eNB[%s:%d]",
|
||||
ies->sourceMME_UE_S1AP_ID,
|
||||
CORE_ADDR(enb->addr, buf), enb->enb_id);
|
||||
*MME_UE_S1AP_ID, CORE_ADDR(enb->addr, buf), enb->enb_id);
|
||||
|
||||
s1ap_send_path_switch_failure(enb, ies->eNB_UE_S1AP_ID,
|
||||
ies->sourceMME_UE_S1AP_ID,
|
||||
s1ap_send_path_switch_failure(enb,
|
||||
*ENB_UE_S1AP_ID, *MME_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_radioNetwork,
|
||||
S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id);
|
||||
return;
|
||||
|
@ -1154,20 +1193,20 @@ void s1ap_handle_path_switch_request(
|
|||
}
|
||||
else
|
||||
{
|
||||
s1ap_send_path_switch_failure(enb, ies->eNB_UE_S1AP_ID,
|
||||
ies->sourceMME_UE_S1AP_ID,
|
||||
s1ap_send_path_switch_failure(enb,
|
||||
*ENB_UE_S1AP_ID, *MME_UE_S1AP_ID,
|
||||
S1AP_Cause_PR_nas, S1AP_CauseNas_authentication_failure);
|
||||
return;
|
||||
}
|
||||
|
||||
enb_ue->enb_ue_s1ap_id = ies->eNB_UE_S1AP_ID;
|
||||
enb_ue->enb_ue_s1ap_id = *ENB_UE_S1AP_ID;
|
||||
|
||||
memcpy(&enb_ue->nas.tai.plmn_id, PLMNidentity->buf,
|
||||
memcpy(&enb_ue->nas.tai.plmn_id, pLMNidentity->buf,
|
||||
sizeof(enb_ue->nas.tai.plmn_id));
|
||||
memcpy(&enb_ue->nas.tai.tac, tAC->buf, sizeof(enb_ue->nas.tai.tac));
|
||||
enb_ue->nas.tai.tac = ntohs(enb_ue->nas.tai.tac);
|
||||
|
||||
memcpy(&enb_ue->nas.e_cgi.plmn_id, PLMNidentity->buf,
|
||||
memcpy(&enb_ue->nas.e_cgi.plmn_id, pLMNidentity->buf,
|
||||
sizeof(enb_ue->nas.e_cgi.plmn_id));
|
||||
memcpy(&enb_ue->nas.e_cgi.cell_id, cell_ID->buf,
|
||||
sizeof(enb_ue->nas.e_cgi.cell_id));
|
||||
|
@ -1196,20 +1235,23 @@ void s1ap_handle_path_switch_request(
|
|||
mme_ue->ue_network_capability.eia = eia >> 9;
|
||||
mme_ue->ue_network_capability.eia0 = 0;
|
||||
|
||||
for (i = 0; i < ies->e_RABToBeSwitchedDLList.
|
||||
s1ap_E_RABToBeSwitchedDLItem.count; i++)
|
||||
d_assert(E_RABToBeSwitchedDLList, return,);
|
||||
for (i = 0; i < E_RABToBeSwitchedDLList->list.count; i++)
|
||||
{
|
||||
status_t rv;
|
||||
|
||||
mme_bearer_t *bearer = NULL;
|
||||
S1AP_E_RABToBeSwitchedDLItemIEs_t *item = NULL;
|
||||
S1AP_E_RABToBeSwitchedDLItem_t *e_rab = NULL;
|
||||
|
||||
e_rab = (S1AP_E_RABToBeSwitchedDLItem_t *)ies->e_RABToBeSwitchedDLList.
|
||||
s1ap_E_RABToBeSwitchedDLItem.array[i];
|
||||
mme_bearer_t *bearer = NULL;
|
||||
|
||||
item = (S1AP_E_RABToBeSwitchedDLItemIEs_t *)
|
||||
E_RABToBeSwitchedDLList->list.array[i];
|
||||
d_assert(item, return,);
|
||||
|
||||
e_rab = &item->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);
|
||||
d_assert(bearer, return, "Null param");
|
||||
d_assert(bearer, return, "Cannot find e_RAB_ID[%d]", e_rab->e_RAB_ID);
|
||||
|
||||
memcpy(&bearer->enb_s1u_teid, e_rab->gTP_TEID.buf,
|
||||
sizeof(bearer->enb_s1u_teid));
|
||||
|
@ -1229,6 +1271,7 @@ void s1ap_handle_path_switch_request(
|
|||
enb_ue_switch_to_enb(enb_ue, enb);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void s1ap_handle_handover_required(mme_enb_t *enb, s1ap_message_t *message)
|
||||
{
|
||||
status_t rv;
|
||||
|
|
|
@ -91,12 +91,12 @@ void s1ap_state_operational(fsm_t *s, event_t *e)
|
|||
enb, pdu);
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
case S1AP_ProcedureCode_id_PathSwitchRequest:
|
||||
{
|
||||
s1ap_handle_path_switch_request(enb, pdu);
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
case S1AP_ProcedureCode_id_HandoverPreparation:
|
||||
{
|
||||
s1ap_handle_handover_required(enb, pdu);
|
||||
|
|
|
@ -11,11 +11,9 @@ testepc_SOURCES = \
|
|||
common/testpacket.h common/testpacket.c common/testutil.h \
|
||||
basic/testutil.c basic/s1ap_message_test.c basic/nas_message_test.c \
|
||||
basic/gtp_message_test.c basic/security_test.c basic/s1setup_test.c \
|
||||
basic/attach_test.c basic/volte_test.c
|
||||
basic/attach_test.c basic/volte_test.c basic/handover_test.c \
|
||||
$(NULL)
|
||||
|
||||
# basic/attach_test.c basic/volte_test.c basic/handover_test.c
|
||||
|
||||
#testvolte_SOURCES = \
|
||||
# common/abts.h common/abts.c \
|
||||
# common/testpacket.h common/testpacket.c common/testutil.h \
|
||||
|
|
|
@ -121,7 +121,7 @@ static void handover_test1(abts_case *tc, void *data)
|
|||
|
||||
/* S1-Setup Reqeust/Response for Source eNB */
|
||||
rv = tests1ap_build_setup_req(
|
||||
&sendbuf, S1ap_ENB_ID_PR_macroENB_ID, 0x54f64);
|
||||
&sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f64);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
rv = tests1ap_enb_send(sock1, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
@ -133,7 +133,7 @@ static void handover_test1(abts_case *tc, void *data)
|
|||
|
||||
/* S1-Setup Reqeust/Response for Target eNB */
|
||||
rv = tests1ap_build_setup_req(
|
||||
&sendbuf, S1ap_ENB_ID_PR_macroENB_ID, 0x54f65);
|
||||
&sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x54f65);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
rv = tests1ap_enb_send(sock2, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
@ -343,6 +343,7 @@ static void handover_test1(abts_case *tc, void *data)
|
|||
core_sleep(time_from_msec(300));
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void handover_test2(abts_case *tc, void *data)
|
||||
{
|
||||
status_t rv;
|
||||
|
@ -450,7 +451,7 @@ static void handover_test2(abts_case *tc, void *data)
|
|||
|
||||
/* S1-Setup Reqeust/Response for Source eNB */
|
||||
rv = tests1ap_build_setup_req(
|
||||
&sendbuf, S1ap_ENB_ID_PR_macroENB_ID, 0x001f2);
|
||||
&sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x001f2);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
rv = tests1ap_enb_send(sock1, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
@ -462,7 +463,7 @@ static void handover_test2(abts_case *tc, void *data)
|
|||
|
||||
/* S1-Setup Reqeust/Response for Target eNB */
|
||||
rv = tests1ap_build_setup_req(
|
||||
&sendbuf, S1ap_ENB_ID_PR_macroENB_ID, 0x00043);
|
||||
&sendbuf, S1AP_ENB_ID_PR_macroENB_ID, 0x00043);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
rv = tests1ap_enb_send(sock2, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
@ -850,13 +851,16 @@ out:
|
|||
|
||||
core_sleep(time_from_msec(300));
|
||||
}
|
||||
#endif
|
||||
|
||||
abts_suite *test_handover(abts_suite *suite)
|
||||
{
|
||||
suite = ADD_SUITE(suite)
|
||||
|
||||
abts_run_test(suite, handover_test1, NULL);
|
||||
#if 0
|
||||
abts_run_test(suite, handover_test2, NULL);
|
||||
#endif
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
|
|
@ -33,9 +33,7 @@ const struct testlist alltests[] = {
|
|||
{test_s1setup},
|
||||
{test_attach},
|
||||
{test_volte},
|
||||
#if 0
|
||||
{test_handover},
|
||||
#endif
|
||||
{NULL},
|
||||
};
|
||||
|
||||
|
|
|
@ -1697,29 +1697,100 @@ status_t tests1ap_build_deactivate_bearer_accept(
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
#if 0
|
||||
status_t tests1ap_build_path_switch_request(
|
||||
pkbuf_t **pkbuf, int target,
|
||||
c_uint32_t mme_ue_s1ap_id, c_uint32_t enb_ue_s1ap_id,
|
||||
int num_of_bearer, c_uint8_t ebi, c_uint32_t teid)
|
||||
{
|
||||
int erval = -1;
|
||||
|
||||
status_t rv;
|
||||
int i;
|
||||
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
||||
S1AP_PathSwitchRequest_t *PathSwitchRequest = NULL;
|
||||
|
||||
S1AP_PathSwitchRequestIEs_t *ie = NULL;
|
||||
S1AP_ENB_UE_S1AP_ID_t *ENB_UE_S1AP_ID = NULL;
|
||||
S1AP_E_RABToBeSwitchedDLList_t *E_RABToBeSwitchedDLList = NULL;
|
||||
S1AP_MME_UE_S1AP_ID_t *MME_UE_S1AP_ID = NULL;
|
||||
S1AP_EUTRAN_CGI_t *EUTRAN_CGI = NULL;
|
||||
S1AP_TAI_t *TAI = NULL;
|
||||
S1AP_UESecurityCapabilities_t *UESecurityCapabilities = NULL;
|
||||
|
||||
enb_ue_t *enb_ue = NULL;
|
||||
mme_ue_t *mme_ue = NULL;
|
||||
|
||||
s1ap_message_t message;
|
||||
S1AP_PathSwitchRequestIEs_t *ies =
|
||||
&message.s1ap_PathSwitchRequestIEs;
|
||||
S1AP_E_RABToBeSwitchedDLItem_t *e_rab = NULL;
|
||||
S1AP_EUTRAN_CGI_t *eutran_cgi = &ies->eutran_cgi;
|
||||
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));
|
||||
|
||||
memset(&message, 0, sizeof(s1ap_message_t));
|
||||
initiatingMessage = pdu.choice.initiatingMessage;
|
||||
initiatingMessage->procedureCode = S1AP_ProcedureCode_id_PathSwitchRequest;
|
||||
initiatingMessage->criticality = S1AP_Criticality_reject;
|
||||
initiatingMessage->value.present =
|
||||
S1AP_InitiatingMessage__value_PR_PathSwitchRequest;
|
||||
|
||||
ies->eNB_UE_S1AP_ID = enb_ue_s1ap_id;
|
||||
ies->sourceMME_UE_S1AP_ID = mme_ue_s1ap_id;
|
||||
PathSwitchRequest = &initiatingMessage->value.choice.PathSwitchRequest;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t));
|
||||
ASN_SEQUENCE_ADD(&PathSwitchRequest->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_PathSwitchRequestIEs__value_PR_ENB_UE_S1AP_ID;
|
||||
|
||||
ENB_UE_S1AP_ID = &ie->value.choice.ENB_UE_S1AP_ID;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t));
|
||||
ASN_SEQUENCE_ADD(&PathSwitchRequest->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_E_RABToBeSwitchedDLList;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present =
|
||||
S1AP_PathSwitchRequestIEs__value_PR_E_RABToBeSwitchedDLList;
|
||||
|
||||
E_RABToBeSwitchedDLList = &ie->value.choice.E_RABToBeSwitchedDLList;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t));
|
||||
ASN_SEQUENCE_ADD(&PathSwitchRequest->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_SourceMME_UE_S1AP_ID;
|
||||
ie->criticality = S1AP_Criticality_reject;
|
||||
ie->value.present = S1AP_PathSwitchRequestIEs__value_PR_MME_UE_S1AP_ID;
|
||||
|
||||
MME_UE_S1AP_ID = &ie->value.choice.MME_UE_S1AP_ID;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t));
|
||||
ASN_SEQUENCE_ADD(&PathSwitchRequest->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_EUTRAN_CGI;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_PathSwitchRequestIEs__value_PR_EUTRAN_CGI;
|
||||
|
||||
EUTRAN_CGI = &ie->value.choice.EUTRAN_CGI;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t));
|
||||
ASN_SEQUENCE_ADD(&PathSwitchRequest->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_TAI;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present = S1AP_PathSwitchRequestIEs__value_PR_TAI;
|
||||
|
||||
TAI = &ie->value.choice.TAI;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_PathSwitchRequestIEs_t));
|
||||
ASN_SEQUENCE_ADD(&PathSwitchRequest->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_UESecurityCapabilities;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present =
|
||||
S1AP_PathSwitchRequestIEs__value_PR_UESecurityCapabilities;
|
||||
|
||||
UESecurityCapabilities = &ie->value.choice.UESecurityCapabilities;
|
||||
|
||||
*ENB_UE_S1AP_ID = enb_ue_s1ap_id;
|
||||
*MME_UE_S1AP_ID = mme_ue_s1ap_id;
|
||||
|
||||
enb_ue = enb_ue_find_by_mme_ue_s1ap_id(mme_ue_s1ap_id);
|
||||
d_assert(enb_ue, return CORE_ERROR,);
|
||||
|
@ -1728,12 +1799,23 @@ status_t tests1ap_build_path_switch_request(
|
|||
|
||||
for (i = 0; i < num_of_bearer; i++)
|
||||
{
|
||||
S1AP_E_RABToBeSwitchedDLItemIEs_t *item = NULL;
|
||||
S1AP_E_RABToBeSwitchedDLItem_t *e_rab = NULL;
|
||||
|
||||
gtp_f_teid_t f_teid;
|
||||
ip_t ip;
|
||||
int len;
|
||||
|
||||
e_rab = (S1AP_E_RABToBeSwitchedDLItem_t *)
|
||||
core_calloc(1, sizeof(S1AP_E_RABToBeSwitchedDLItem_t));
|
||||
item = core_calloc( 1, sizeof(S1AP_E_RABToBeSwitchedDLItemIEs_t));
|
||||
ASN_SEQUENCE_ADD(&E_RABToBeSwitchedDLList->list, item);
|
||||
|
||||
item->id = S1AP_ProtocolIE_ID_id_E_RABToBeSwitchedDLItem;
|
||||
item->criticality = S1AP_Criticality_reject;
|
||||
item->value.present =
|
||||
S1AP_E_RABToBeSwitchedDLItemIEs__value_PR_E_RABToBeSwitchedDLItem;
|
||||
|
||||
e_rab = &item->value.choice.E_RABToBeSwitchedDLItem;
|
||||
|
||||
e_rab->e_RAB_ID = ebi+i;
|
||||
|
||||
if (target == 0)
|
||||
|
@ -1749,58 +1831,52 @@ status_t tests1ap_build_path_switch_request(
|
|||
rv = s1ap_ip_to_BIT_STRING(&ip, &e_rab->transportLayerAddress);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
s1ap_uint32_to_OCTET_STRING(teid+i, &e_rab->gTP_TEID);
|
||||
|
||||
ASN_SEQUENCE_ADD(&ies->e_RABToBeSwitchedDLList, e_rab);
|
||||
}
|
||||
|
||||
s1ap_buffer_to_OCTET_STRING(
|
||||
&mme_ue->e_cgi.plmn_id, PLMN_ID_LEN, &ies->eutran_cgi.pLMNidentity);
|
||||
eutran_cgi->cell_ID.size = 4;
|
||||
eutran_cgi->cell_ID.buf = core_calloc(
|
||||
eutran_cgi->cell_ID.size, sizeof(c_uint8_t));
|
||||
d_assert(eutran_cgi->cell_ID.buf, return CORE_ERROR,);
|
||||
eutran_cgi->cell_ID.buf[0] = (mme_ue->e_cgi.cell_id >> 24);
|
||||
eutran_cgi->cell_ID.buf[1] = (mme_ue->e_cgi.cell_id >> 16);
|
||||
eutran_cgi->cell_ID.buf[2] = (mme_ue->e_cgi.cell_id >> 8);
|
||||
eutran_cgi->cell_ID.buf[3] = (mme_ue->e_cgi.cell_id);
|
||||
eutran_cgi->cell_ID.bits_unused = 4;
|
||||
&mme_ue->e_cgi.plmn_id, PLMN_ID_LEN, &EUTRAN_CGI->pLMNidentity);
|
||||
EUTRAN_CGI->cell_ID.size = 4;
|
||||
EUTRAN_CGI->cell_ID.buf = core_calloc(
|
||||
EUTRAN_CGI->cell_ID.size, sizeof(c_uint8_t));
|
||||
d_assert(EUTRAN_CGI->cell_ID.buf, return CORE_ERROR,);
|
||||
EUTRAN_CGI->cell_ID.buf[0] = (mme_ue->e_cgi.cell_id >> 24);
|
||||
EUTRAN_CGI->cell_ID.buf[1] = (mme_ue->e_cgi.cell_id >> 16);
|
||||
EUTRAN_CGI->cell_ID.buf[2] = (mme_ue->e_cgi.cell_id >> 8);
|
||||
EUTRAN_CGI->cell_ID.buf[3] = (mme_ue->e_cgi.cell_id);
|
||||
EUTRAN_CGI->cell_ID.bits_unused = 4;
|
||||
|
||||
s1ap_uint16_to_OCTET_STRING(
|
||||
mme_ue->tai.tac, &ies->tai.tAC);
|
||||
mme_ue->tai.tac, &TAI->tAC);
|
||||
s1ap_buffer_to_OCTET_STRING(
|
||||
&mme_ue->tai.plmn_id, PLMN_ID_LEN, &ies->tai.pLMNidentity);
|
||||
&mme_ue->tai.plmn_id, PLMN_ID_LEN, &TAI->pLMNidentity);
|
||||
|
||||
ies->ueSecurityCapabilities.encryptionAlgorithms.size = 2;
|
||||
ies->ueSecurityCapabilities.encryptionAlgorithms.buf =
|
||||
core_calloc(ies->ueSecurityCapabilities.encryptionAlgorithms.size,
|
||||
UESecurityCapabilities->encryptionAlgorithms.size = 2;
|
||||
UESecurityCapabilities->encryptionAlgorithms.buf =
|
||||
core_calloc(UESecurityCapabilities->encryptionAlgorithms.size,
|
||||
sizeof(c_uint8_t));
|
||||
ies->ueSecurityCapabilities.encryptionAlgorithms.bits_unused = 0;
|
||||
ies->ueSecurityCapabilities.encryptionAlgorithms.buf[0] =
|
||||
UESecurityCapabilities->encryptionAlgorithms.bits_unused = 0;
|
||||
UESecurityCapabilities->encryptionAlgorithms.buf[0] =
|
||||
(mme_ue->ue_network_capability.eea << 1);
|
||||
|
||||
ies->ueSecurityCapabilities.integrityProtectionAlgorithms.size = 2;
|
||||
ies->ueSecurityCapabilities.integrityProtectionAlgorithms.buf =
|
||||
core_calloc(ies->ueSecurityCapabilities.
|
||||
UESecurityCapabilities->integrityProtectionAlgorithms.size = 2;
|
||||
UESecurityCapabilities->integrityProtectionAlgorithms.buf =
|
||||
core_calloc(UESecurityCapabilities->
|
||||
integrityProtectionAlgorithms.size, sizeof(c_uint8_t));
|
||||
ies->ueSecurityCapabilities.integrityProtectionAlgorithms.bits_unused = 0;
|
||||
ies->ueSecurityCapabilities.integrityProtectionAlgorithms.buf[0] =
|
||||
UESecurityCapabilities->integrityProtectionAlgorithms.bits_unused = 0;
|
||||
UESecurityCapabilities->integrityProtectionAlgorithms.buf[0] =
|
||||
(mme_ue->ue_network_capability.eia << 1);
|
||||
|
||||
message.procedureCode = S1AP_ProcedureCode_id_PathSwitchRequest;
|
||||
message.direction = S1AP_PDU_PR_initiatingMessage;
|
||||
rv = s1ap_encode_pdu(pkbuf, &pdu);
|
||||
s1ap_free_pdu(&pdu);
|
||||
|
||||
erval = s1ap_encode_pdu(pkbuf, &message);
|
||||
s1ap_free_pdu(&message);
|
||||
|
||||
if (erval < 0)
|
||||
if (rv != CORE_OK)
|
||||
{
|
||||
d_error("s1ap_encode_error : (%d)", erval);
|
||||
d_error("s1ap_encode_pdu() failed");
|
||||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
status_t tests1ap_build_handover_required(
|
||||
pkbuf_t **pkbuf, int i)
|
||||
|
|
Loading…
Reference in New Issue