forked from acouzens/open5gs
eNB Configuration Transfer is added (#29)
This commit is contained in:
parent
5fad2f0e5c
commit
c31dfb507d
|
@ -172,6 +172,7 @@ static int s1ap_decode_initiating(s1ap_message_t *message,
|
|||
s1ap_xer_print_s1ap_errorindication,
|
||||
s1ap_xer__print2sp, message);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_Reset:
|
||||
ret = s1ap_decode_s1ap_reseties(
|
||||
&message->s1ap_ResetIEs,
|
||||
|
@ -180,6 +181,16 @@ static int s1ap_decode_initiating(s1ap_message_t *message,
|
|||
s1ap_xer_print_s1ap_reset,
|
||||
s1ap_xer__print2sp, message);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_eNBConfigurationTransfer:
|
||||
ret = s1ap_decode_s1ap_enbconfigurationtransferies(
|
||||
&message->s1ap_ENBConfigurationTransferIEs,
|
||||
&initiating_p->value);
|
||||
s1ap_decode_xer_print_message(
|
||||
s1ap_xer_print_s1ap_enbconfigurationtransfer,
|
||||
s1ap_xer__print2sp, message);
|
||||
break;
|
||||
|
||||
default:
|
||||
d_error("Unknown procedure ID (%d) for initiating message",
|
||||
(int)initiating_p->procedureCode);
|
||||
|
|
|
@ -55,6 +55,8 @@ static inline int s1ap_encode_handover_preparation_failure(
|
|||
s1ap_message_t *message_p, pkbuf_t *pkbuf);
|
||||
static inline int s1ap_encode_mme_status_transfer(
|
||||
s1ap_message_t *message_p, pkbuf_t *pkbuf);
|
||||
static inline int s1ap_encode_mme_configuration_transfer(
|
||||
s1ap_message_t *message_p, pkbuf_t *pkbuf);
|
||||
|
||||
static inline int s1ap_encode_error_indication(
|
||||
s1ap_message_t *message_p, pkbuf_t *pkbuf);
|
||||
|
@ -201,6 +203,13 @@ static inline int s1ap_encode_initiating_message(
|
|||
ret = s1ap_encode_reset(message_p, pkbuf);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_eNBConfigurationTransfer:
|
||||
s1ap_encode_xer_print_message(
|
||||
s1ap_xer_print_s1ap_mmeconfigurationtransfer,
|
||||
s1ap_xer__print2sp, message_p);
|
||||
ret = s1ap_encode_mme_configuration_transfer(message_p, pkbuf);
|
||||
break;
|
||||
|
||||
default:
|
||||
d_warn("Unknown procedure ID (%d) for initiating message_p\n",
|
||||
(int)message_p->procedureCode);
|
||||
|
@ -1104,6 +1113,44 @@ static inline int s1ap_encode_mme_status_transfer(
|
|||
return enc_ret.encoded;
|
||||
}
|
||||
|
||||
static inline int s1ap_encode_mme_configuration_transfer(
|
||||
s1ap_message_t *message_p, pkbuf_t *pkbuf)
|
||||
{
|
||||
asn_enc_rval_t enc_ret = {0};
|
||||
|
||||
S1AP_PDU_t pdu;
|
||||
S1ap_MMEConfigurationTransfer_t transfer;
|
||||
asn_TYPE_descriptor_t *td = &asn_DEF_S1ap_MMEConfigurationTransfer;
|
||||
|
||||
memset(&transfer, 0, sizeof(S1ap_MMEConfigurationTransfer_t));
|
||||
if (s1ap_encode_s1ap_mmeconfigurationtransferies(
|
||||
&transfer, &message_p->s1ap_MMEConfigurationTransferIEs) < 0)
|
||||
{
|
||||
d_error("Encoding of %s failed", td->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(&pdu, 0, sizeof (S1AP_PDU_t));
|
||||
pdu.present = S1AP_PDU_PR_initiatingMessage;
|
||||
pdu.choice.initiatingMessage.procedureCode = message_p->procedureCode;
|
||||
pdu.choice.initiatingMessage.criticality = S1ap_Criticality_ignore;
|
||||
ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, &transfer);
|
||||
|
||||
enc_ret = aper_encode_to_buffer(&asn_DEF_S1AP_PDU,
|
||||
&pdu, pkbuf->payload, MAX_SDU_LEN);
|
||||
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(*td, &transfer);
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_PDU, &pdu);
|
||||
|
||||
if (enc_ret.encoded < 0)
|
||||
{
|
||||
d_error("Encoding of %s failed", td->name);
|
||||
}
|
||||
|
||||
return enc_ret.encoded;
|
||||
}
|
||||
|
||||
|
||||
static inline int s1ap_encode_error_indication(
|
||||
s1ap_message_t *message_p, pkbuf_t *pkbuf)
|
||||
{
|
||||
|
|
|
@ -145,6 +145,16 @@ static inline int s1ap_free_initiating_message(s1ap_message_t *message)
|
|||
&message->s1ap_ResetIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_eNBConfigurationTransfer:
|
||||
s1ap_free_s1ap_enbconfigurationtransferies(
|
||||
&message->s1ap_ENBConfigurationTransferIEs);
|
||||
break;
|
||||
|
||||
case S1ap_ProcedureCode_id_MMEConfigurationTransfer:
|
||||
s1ap_free_s1ap_mmeconfigurationtransferies(
|
||||
&message->s1ap_MMEConfigurationTransferIEs);
|
||||
break;
|
||||
|
||||
default:
|
||||
d_warn("Unknown procedure ID (%d) for initiating message\n",
|
||||
(int)message->procedureCode);
|
||||
|
|
|
@ -1225,6 +1225,68 @@ void s1ap_handle_enb_status_transfer(mme_enb_t *enb, s1ap_message_t *message)
|
|||
d_assert(rv == CORE_OK,,);
|
||||
}
|
||||
|
||||
void s1ap_handle_enb_configuration_transfer(
|
||||
mme_enb_t *enb, s1ap_message_t *message)
|
||||
{
|
||||
status_t rv;
|
||||
char buf[CORE_ADDRSTRLEN];
|
||||
|
||||
S1ap_ENBConfigurationTransferIEs_t *ies = NULL;
|
||||
|
||||
d_assert(enb, return,);
|
||||
|
||||
ies = &message->s1ap_ENBConfigurationTransferIEs;
|
||||
d_assert(ies, return,);
|
||||
|
||||
d_trace(3, "[MME] ENB configuration transfer\n");
|
||||
d_trace(5, " IP[%s] ENB_ID[%d]\n",
|
||||
CORE_ADDR(enb->addr, buf), enb->enb_id);
|
||||
|
||||
if (ies->presenceMask &
|
||||
S1AP_ENBCONFIGURATIONTRANSFERIES_SONCONFIGURATIONTRANSFERECT_PRESENT)
|
||||
{
|
||||
S1ap_SONConfigurationTransfer_t *transfer =
|
||||
&ies->sonConfigurationTransferECT;
|
||||
mme_enb_t *target_enb = NULL;
|
||||
c_uint32_t source_enb_id, target_enb_id;
|
||||
c_uint16_t source_tac, target_tac;
|
||||
|
||||
s1ap_ENB_ID_to_uint32(
|
||||
&transfer->sourceeNB_ID.global_S1ap_ENB_ID.eNB_ID,
|
||||
&source_enb_id);
|
||||
s1ap_ENB_ID_to_uint32(
|
||||
&transfer->targeteNB_ID.global_S1ap_ENB_ID.eNB_ID,
|
||||
&target_enb_id);
|
||||
|
||||
memcpy(&source_tac, transfer->sourceeNB_ID.selected_S1ap_TAI.tAC.buf,
|
||||
sizeof(source_tac));
|
||||
source_tac = ntohs(source_tac);
|
||||
memcpy(&target_tac, transfer->targeteNB_ID.selected_S1ap_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_S1ap_ENB_ID.eNB_ID.present ==
|
||||
S1ap_ENB_ID_PR_homeENB_ID ? "Home" :
|
||||
transfer->sourceeNB_ID.global_S1ap_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_S1ap_ENB_ID.eNB_ID.present ==
|
||||
S1ap_ENB_ID_PR_homeENB_ID ? "Home" :
|
||||
transfer->targeteNB_ID.global_S1ap_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);
|
||||
d_assert(target_enb, return,
|
||||
"Cannot find target eNB = %d", target_enb_id);
|
||||
|
||||
rv = s1ap_send_mme_configuration_transfer(target_enb, ies);
|
||||
d_assert(rv == CORE_OK,,);
|
||||
}
|
||||
}
|
||||
|
||||
void s1ap_handle_handover_notification(mme_enb_t *enb, s1ap_message_t *message)
|
||||
{
|
||||
status_t rv;
|
||||
|
|
|
@ -45,6 +45,8 @@ CORE_DECLARE(void) s1ap_handle_handover_cancel(
|
|||
|
||||
CORE_DECLARE(void) s1ap_handle_enb_status_transfer(
|
||||
mme_enb_t *enb, s1ap_message_t *message);
|
||||
CORE_DECLARE(void) s1ap_handle_enb_configuration_transfer(
|
||||
mme_enb_t *enb, s1ap_message_t *message);
|
||||
CORE_DECLARE(void) s1ap_handle_handover_notification(
|
||||
mme_enb_t *enb, s1ap_message_t *message);
|
||||
|
||||
|
|
|
@ -455,6 +455,13 @@ status_t s1ap_send_mme_status_transfer(
|
|||
return rv;
|
||||
}
|
||||
|
||||
status_t s1ap_send_mme_configuration_transfer(
|
||||
mme_enb_t *target_enb, S1ap_ENBConfigurationTransferIEs_t *ies)
|
||||
{
|
||||
d_warn("Not Implemented : MME Configuration Transfer");
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t s1ap_send_error_indication(
|
||||
mme_enb_t *enb, c_uint16_t presenceMask,
|
||||
c_uint32_t enb_ue_s1ap_id, c_uint32_t mme_ue_s1ap_id,
|
||||
|
|
|
@ -55,6 +55,8 @@ CORE_DECLARE(status_t) s1ap_send_handover_cancel_ack(enb_ue_t *source_ue);
|
|||
|
||||
CORE_DECLARE(status_t) s1ap_send_mme_status_transfer(
|
||||
enb_ue_t *target_ue, S1ap_ENBStatusTransferIEs_t *ies);
|
||||
CORE_DECLARE(status_t) s1ap_send_mme_configuration_transfer(
|
||||
mme_enb_t *target_enb, S1ap_ENBConfigurationTransferIEs_t *ies);
|
||||
CORE_DECLARE(status_t) s1ap_send_error_indication(
|
||||
mme_enb_t *enb, c_uint16_t presenceMask,
|
||||
c_uint32_t enb_ue_s1ap_id, c_uint32_t mme_ue_s1ap_id,
|
||||
|
|
|
@ -107,6 +107,12 @@ void s1ap_state_operational(fsm_t *s, event_t *e)
|
|||
s1ap_handle_enb_status_transfer(enb, message);
|
||||
break;
|
||||
}
|
||||
case S1ap_ProcedureCode_id_eNBConfigurationTransfer:
|
||||
{
|
||||
s1ap_handle_enb_configuration_transfer(
|
||||
enb, message);
|
||||
break;
|
||||
}
|
||||
case S1ap_ProcedureCode_id_HandoverNotification:
|
||||
{
|
||||
s1ap_handle_handover_notification(enb, message);
|
||||
|
|
|
@ -613,6 +613,13 @@ static void handover_test2(abts_case *tc, void *data)
|
|||
|
||||
core_sleep(time_from_msec(300));
|
||||
|
||||
rv = tests1ap_build_enb_configuration_transfer(&sendbuf, 0);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
rv = tests1ap_enb_send(sock1, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
||||
core_sleep(time_from_msec(300));
|
||||
|
||||
/* Send Handover Required */
|
||||
rv = tests1ap_build_handover_required(&sendbuf, 0);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
|
|
@ -1936,6 +1936,50 @@ status_t tests1ap_build_enb_status_transfer(
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
status_t tests1ap_build_enb_configuration_transfer(
|
||||
pkbuf_t **pkbuf, int i)
|
||||
{
|
||||
char *payload[TESTS1AP_MAX_MESSAGE] = {
|
||||
"0028"
|
||||
"403c000001008140 354000f110000004 3000f1105ba00000 f11040830bb87000"
|
||||
"f1105ba000000000 98401341f0c0a864 6800000099400702 00f8c0a86468",
|
||||
"",
|
||||
"",
|
||||
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
|
||||
};
|
||||
c_uint16_t len[TESTS1AP_MAX_MESSAGE] = {
|
||||
64,
|
||||
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 tests1ap_build_handover_notify(pkbuf_t **pkbuf, int i)
|
||||
{
|
||||
char *payload[TESTS1AP_MAX_MESSAGE] = {
|
||||
|
|
|
@ -82,6 +82,8 @@ CORE_DECLARE(status_t) tests1ap_build_handover_request_ack_static(
|
|||
pkbuf_t **pkbuf, int i);
|
||||
CORE_DECLARE(status_t) tests1ap_build_enb_status_transfer(
|
||||
pkbuf_t **pkbuf, int i);
|
||||
CORE_DECLARE(status_t) tests1ap_build_enb_configuration_transfer(
|
||||
pkbuf_t **pkbuf, int i);
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue