forked from acouzens/open5gs
eNB/MME Configuration Transfer with new S1AP library
This commit is contained in:
parent
82dee88309
commit
8ff9a7cf4c
|
@ -79,7 +79,9 @@ void app_did_terminate(void)
|
|||
{
|
||||
if (context_self()->db_uri)
|
||||
{
|
||||
d_trace(1, "DB-Client try to terminate\n");
|
||||
context_db_final();
|
||||
d_trace(1, "DB-Client terminate...done\n");
|
||||
}
|
||||
|
||||
app_logger_final();
|
||||
|
|
|
@ -1166,6 +1166,65 @@ status_t s1ap_build_paging(pkbuf_t **s1apbuf, mme_ue_t *mme_ue)
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s1ap_build_mme_configuration_transfer(
|
||||
pkbuf_t **s1apbuf,
|
||||
S1AP_SONConfigurationTransfer_t *son_configuration_transfer)
|
||||
{
|
||||
status_t rv;
|
||||
|
||||
S1AP_S1AP_PDU_t pdu;
|
||||
S1AP_InitiatingMessage_t *initiatingMessage = NULL;
|
||||
S1AP_MMEConfigurationTransfer_t *MMEConfigurationTransfer = NULL;
|
||||
|
||||
S1AP_MMEConfigurationTransferIEs_t *ie = NULL;
|
||||
S1AP_SONConfigurationTransfer_t *SONConfigurationTransfer = NULL;
|
||||
|
||||
d_assert(s1apbuf, return CORE_ERROR,);
|
||||
d_assert(son_configuration_transfer, return CORE_ERROR,);
|
||||
|
||||
d_trace(3, "[MME] MME Configuration Transfer\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_MMEConfigurationTransfer;
|
||||
initiatingMessage->criticality = S1AP_Criticality_ignore;
|
||||
initiatingMessage->value.present =
|
||||
S1AP_InitiatingMessage__value_PR_MMEConfigurationTransfer;
|
||||
|
||||
MMEConfigurationTransfer =
|
||||
&initiatingMessage->value.choice.MMEConfigurationTransfer;
|
||||
|
||||
ie = core_calloc(1, sizeof(S1AP_MMEConfigurationTransferIEs_t));
|
||||
ASN_SEQUENCE_ADD(&MMEConfigurationTransfer->protocolIEs, ie);
|
||||
|
||||
ie->id = S1AP_ProtocolIE_ID_id_SONConfigurationTransferMCT;
|
||||
ie->criticality = S1AP_Criticality_ignore;
|
||||
ie->value.present =
|
||||
S1AP_MMEConfigurationTransferIEs__value_PR_SONConfigurationTransfer;
|
||||
|
||||
SONConfigurationTransfer = &ie->value.choice.SONConfigurationTransfer;
|
||||
|
||||
rv = s1ap_copy_ie(&asn_DEF_S1AP_SONConfigurationTransfer,
|
||||
son_configuration_transfer, SONConfigurationTransfer);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR,);
|
||||
|
||||
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_path_switch_ack(pkbuf_t **s1apbuf, mme_ue_t *mme_ue)
|
||||
{
|
||||
status_t rv;
|
||||
|
|
|
@ -25,6 +25,10 @@ CORE_DECLARE(status_t) s1ap_build_ue_context_release_command(
|
|||
pkbuf_t **s1apbuf, enb_ue_t *enb_ue, S1AP_Cause_PR group, long cause);
|
||||
CORE_DECLARE(status_t) s1ap_build_paging(pkbuf_t **s1apbuf, mme_ue_t *mme_ue);
|
||||
|
||||
CORE_DECLARE(status_t) s1ap_build_mme_configuration_transfer(
|
||||
pkbuf_t **s1apbuf,
|
||||
S1AP_SONConfigurationTransfer_t *son_configuration_transfer);
|
||||
|
||||
CORE_DECLARE(status_t) s1ap_build_path_switch_ack(
|
||||
pkbuf_t **s1apbuf, mme_ue_t *mme_ue);
|
||||
CORE_DECLARE(status_t) s1ap_build_path_switch_failure(pkbuf_t **s1apbuf,
|
||||
|
|
|
@ -1312,49 +1312,50 @@ void s1ap_handle_enb_configuration_transfer(
|
|||
|
||||
if (SONConfigurationTransfer)
|
||||
{
|
||||
S1AP_SONConfigurationTransfer_t *transfer = SONConfigurationTransfer;
|
||||
S1AP_TargeteNB_ID_t *targeteNB_ID =
|
||||
&SONConfigurationTransfer->targeteNB_ID;
|
||||
S1AP_SourceeNB_ID_t *sourceeNB_ID =
|
||||
&SONConfigurationTransfer->sourceeNB_ID;
|
||||
|
||||
mme_enb_t *target_enb = NULL;
|
||||
c_uint32_t source_enb_id, target_enb_id;
|
||||
c_uint16_t source_tac, target_tac;
|
||||
|
||||
d_assert(transfer, return,);
|
||||
|
||||
s1ap_ENB_ID_to_uint32(
|
||||
&transfer->sourceeNB_ID.global_ENB_ID.eNB_ID,
|
||||
&source_enb_id);
|
||||
&sourceeNB_ID->global_ENB_ID.eNB_ID, &source_enb_id);
|
||||
s1ap_ENB_ID_to_uint32(
|
||||
&transfer->targeteNB_ID.global_ENB_ID.eNB_ID,
|
||||
&target_enb_id);
|
||||
&targeteNB_ID->global_ENB_ID.eNB_ID, &target_enb_id);
|
||||
|
||||
memcpy(&source_tac, transfer->sourceeNB_ID.selected_TAI.tAC.buf,
|
||||
memcpy(&source_tac, sourceeNB_ID->selected_TAI.tAC.buf,
|
||||
sizeof(source_tac));
|
||||
source_tac = ntohs(source_tac);
|
||||
memcpy(&target_tac, transfer->targeteNB_ID.selected_TAI.tAC.buf,
|
||||
memcpy(&target_tac, targeteNB_ID->selected_TAI.tAC.buf,
|
||||
sizeof(target_tac));
|
||||
target_tac = ntohs(target_tac);
|
||||
|
||||
d_trace(5, " Source : ENB_ID[%s:%d], TAC[%d]\n",
|
||||
transfer->sourceeNB_ID.global_ENB_ID.eNB_ID.present ==
|
||||
sourceeNB_ID->global_ENB_ID.eNB_ID.present ==
|
||||
S1AP_ENB_ID_PR_homeENB_ID ? "Home" :
|
||||
transfer->sourceeNB_ID.global_ENB_ID.eNB_ID.present ==
|
||||
sourceeNB_ID->global_ENB_ID.eNB_ID.present ==
|
||||
S1AP_ENB_ID_PR_macroENB_ID ? "Macro" : "Others",
|
||||
source_enb_id, source_tac);
|
||||
d_trace(5, " Target : ENB_ID[%s:%d], TAC[%d]\n",
|
||||
transfer->targeteNB_ID.global_ENB_ID.eNB_ID.present ==
|
||||
targeteNB_ID->global_ENB_ID.eNB_ID.present ==
|
||||
S1AP_ENB_ID_PR_homeENB_ID ? "Home" :
|
||||
transfer->targeteNB_ID.global_ENB_ID.eNB_ID.present ==
|
||||
targeteNB_ID->global_ENB_ID.eNB_ID.present ==
|
||||
S1AP_ENB_ID_PR_macroENB_ID ? "Macro" : "Others",
|
||||
target_enb_id, target_tac);
|
||||
|
||||
target_enb = mme_enb_find_by_enb_id(target_enb_id);
|
||||
if (target_enb == NULL)
|
||||
{
|
||||
d_error("Cannot find target eNB-id[%d] "
|
||||
d_warn("Cannot find target eNB-id[%d] "
|
||||
"in eNB-Configuration-Transfer", target_enb_id);
|
||||
return;
|
||||
}
|
||||
|
||||
rv = s1ap_send_mme_configuration_transfer(target_enb, pkbuf);
|
||||
rv = s1ap_send_mme_configuration_transfer(
|
||||
target_enb, SONConfigurationTransfer);
|
||||
d_assert(rv == CORE_OK,,);
|
||||
}
|
||||
}
|
||||
|
@ -1444,7 +1445,7 @@ void s1ap_handle_handover_required(mme_enb_t *enb, s1ap_message_t *message)
|
|||
target_enb = mme_enb_find_by_enb_id(target_enb_id);
|
||||
if (target_enb == NULL)
|
||||
{
|
||||
d_error("Cannot find target eNB-id[%d] in Handover-Required",
|
||||
d_warn("Cannot find target eNB-id[%d] in Handover-Required",
|
||||
target_enb_id);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -272,6 +272,26 @@ status_t s1ap_send_ue_context_release_command(
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s1ap_send_mme_configuration_transfer(
|
||||
mme_enb_t *target_enb,
|
||||
S1AP_SONConfigurationTransfer_t *SONConfigurationTransfer)
|
||||
{
|
||||
status_t rv;
|
||||
pkbuf_t *s1apbuf = NULL;
|
||||
|
||||
d_assert(target_enb, return CORE_ERROR,);
|
||||
d_assert(SONConfigurationTransfer, return CORE_ERROR,);
|
||||
|
||||
rv = s1ap_build_mme_configuration_transfer(
|
||||
&s1apbuf, SONConfigurationTransfer);
|
||||
d_assert(rv == CORE_OK && s1apbuf, return CORE_ERROR, "s1ap build error");
|
||||
|
||||
rv = s1ap_send_to_enb(target_enb, s1apbuf);
|
||||
d_assert(rv == CORE_OK,, "s1ap send error");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
status_t s1ap_send_path_switch_ack(mme_ue_t *mme_ue)
|
||||
{
|
||||
status_t rv;
|
||||
|
@ -442,28 +462,6 @@ status_t s1ap_send_mme_status_transfer(
|
|||
return rv;
|
||||
}
|
||||
|
||||
status_t s1ap_send_mme_configuration_transfer(
|
||||
mme_enb_t *target_enb, pkbuf_t *recvbuf)
|
||||
{
|
||||
status_t rv;
|
||||
unsigned char *payload;
|
||||
pkbuf_t *sendbuf = NULL;
|
||||
|
||||
d_assert(target_enb, return CORE_ERROR,);
|
||||
d_assert(recvbuf, return CORE_ERROR,);
|
||||
|
||||
sendbuf = pkbuf_copy(recvbuf);
|
||||
d_assert(sendbuf, return CORE_ERROR,);
|
||||
|
||||
payload = sendbuf->payload;
|
||||
payload[1] = S1AP_ProcedureCode_id_MMEConfigurationTransfer;
|
||||
payload[8] = S1AP_ProtocolIE_ID_id_SONConfigurationTransferMCT;
|
||||
|
||||
rv = s1ap_send_to_enb(target_enb, sendbuf);
|
||||
d_assert(rv == CORE_OK,, "s1ap send error");
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s1ap_send_error_indication(
|
||||
mme_enb_t *enb,
|
||||
S1AP_MME_UE_S1AP_ID_t *mme_ue_s1ap_id,
|
||||
|
|
|
@ -39,14 +39,15 @@ CORE_DECLARE(status_t) s1ap_send_ue_context_release_command(
|
|||
enb_ue_t *enb_ue, S1AP_Cause_PR group, long cause,
|
||||
c_uint8_t action, c_uint32_t delay);
|
||||
|
||||
CORE_DECLARE(status_t) s1ap_send_mme_configuration_transfer(
|
||||
mme_enb_t *target_enb,
|
||||
S1AP_SONConfigurationTransfer_t *SONConfigurationTransfer);
|
||||
|
||||
CORE_DECLARE(status_t) s1ap_send_path_switch_ack(mme_ue_t *mme_ue);
|
||||
CORE_DECLARE(status_t) s1ap_send_path_switch_failure(mme_enb_t *enb,
|
||||
c_uint32_t enb_ue_s1ap_id, c_uint32_t mme_ue_s1ap_id,
|
||||
S1AP_Cause_PR group, long cause);
|
||||
|
||||
CORE_DECLARE(status_t) s1ap_send_mme_configuration_transfer(
|
||||
mme_enb_t *target_enb, pkbuf_t *pkbuf);
|
||||
|
||||
CORE_DECLARE(status_t) s1ap_send_handover_command(enb_ue_t *source_ue);
|
||||
CORE_DECLARE(status_t) s1ap_send_handover_preparation_failure(
|
||||
enb_ue_t *source_ue, S1AP_Cause_t *cause);
|
||||
|
|
|
@ -625,6 +625,18 @@ static void handover_test2(abts_case *tc, void *data)
|
|||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
pkbuf_free(recvbuf);
|
||||
|
||||
/* Send ENB configuration transfer */
|
||||
rv = tests1ap_build_enb_configuration_transfer(&sendbuf, 1);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
rv = tests1ap_enb_send(sock2, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
||||
/* Receive MME configuration transfer */
|
||||
recvbuf = pkbuf_alloc(0, MAX_SDU_LEN);
|
||||
rv = tests1ap_enb_read(sock1, recvbuf);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
pkbuf_free(recvbuf);
|
||||
|
||||
/* Send Handover Required */
|
||||
rv = tests1ap_build_handover_required(&sendbuf, 0);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
|
|
@ -2274,9 +2274,11 @@ status_t tests1ap_build_enb_configuration_transfer(
|
|||
{
|
||||
char *payload[TESTS1AP_MAX_MESSAGE] = {
|
||||
"0028"
|
||||
"403c000001008140 354000f110000004 3000f1105ba00000 f11040830bb87000"
|
||||
"f1105ba000000000 98401341f0c0a864 6800000099400702 00f8c0a86468",
|
||||
"",
|
||||
"403b000001008140 3440049699000004 3004969900020004 969900001f200496"
|
||||
"9900020000000098 401341f0ac110e02 0000009940070200 f8ac110e02",
|
||||
"0028"
|
||||
"403b000001008140 344004969900001f 2004969900020004 9699000004300496"
|
||||
"9900020000000098 401341f0ac110e02 0000009940070200 f8ac110e02",
|
||||
"",
|
||||
|
||||
"",
|
||||
|
@ -2289,8 +2291,8 @@ status_t tests1ap_build_enb_configuration_transfer(
|
|||
|
||||
};
|
||||
c_uint16_t len[TESTS1AP_MAX_MESSAGE] = {
|
||||
64,
|
||||
0,
|
||||
63,
|
||||
63,
|
||||
0,
|
||||
|
||||
0,
|
||||
|
|
Loading…
Reference in New Issue