From: subhash kumar singh Date: Wed, 18 May 2022 16:14:03 +0000 (+0000) Subject: Message handler for e2nodeConfigUpdate X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fe2-interface.git;a=commitdiff_plain;h=ccc33c0a48b945c3a13054f9661aae4e5f4c4c75 Message handler for e2nodeConfigUpdate Enable message handler for e2nodeConfigUpdate. Signed-off-by: subhash kumar singh Change-Id: I8afcc83a5dfc0a298f4c4cbad236e9b11b641b70 --- diff --git a/e2sim/src/messagerouting/e2ap_message_handler.cpp b/e2sim/src/messagerouting/e2ap_message_handler.cpp index ca2d400..57d28c2 100755 --- a/e2sim/src/messagerouting/e2ap_message_handler.cpp +++ b/e2sim/src/messagerouting/e2ap_message_handler.cpp @@ -189,6 +189,20 @@ void e2ap_handle_sctp_data(int &socket_fd, sctp_buffer_t &data, bool xmlenc, E2S } break; + case ProcedureCode_id_E2nodeConfigurationUpdate: + switch (index) + { + case E2AP_PDU_PR_successfulOutcome: + LOG_I("[E2AP] Received E2nodeConfigurationUpdate") + break; + + default: + LOG_E("[E2AP] Invalid message index=%d in E2AP-PDU %d", index, + (int)ProcedureCode_id_E2nodeConfigurationUpdate); + break; + } + break; + case ProcedureCode_id_RICserviceUpdate: switch (index) { @@ -269,6 +283,42 @@ void e2ap_handle_E2SeviceRequest(E2AP_PDU_t* pdu, int &socket_fd, E2Sim *e2sim) } } +void e2ap_send_e2nodeConfigUpdate(int &socket_fd) { + + auto buffer_size = MAX_SCTP_BUFFER; + unsigned char buffer[MAX_SCTP_BUFFER]; + E2AP_PDU_t* pdu = (E2AP_PDU_t*)calloc(1,sizeof(E2AP_PDU)); + + LOG_D("about to call e2nodeconfigUpdate encode\n"); + + encoding::generate_e2apv2_config_update(pdu); + + LOG_D("[E2AP] Created E2nodeConfigUpdate"); + + e2ap_asn1c_print_pdu(pdu); + + sctp_buffer_t data; + + char error_buf[300] = {0, }; + size_t errlen = 0; + + asn_check_constraints(&asn_DEF_E2AP_PDU, pdu, error_buf, &errlen); + + auto er = asn_encode_to_buffer(nullptr, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2AP_PDU, pdu, buffer, buffer_size); + + data.len = er.encoded; + fprintf(stderr, "er encoded is %d\n", er.encoded); + + memcpy(data.buffer, buffer, er.encoded); + + //send response data over sctp + if(sctp_send_data(socket_fd, data) > 0) { + LOG_I("[SCTP] Sent E2nodeConfigUpdate"); + } else { + LOG_E("[SCTP] Unable to send E2nodeConfigUpdate to peer"); + } +} + void e2ap_handle_E2SetupRequest(E2AP_PDU_t* pdu, int &socket_fd) { diff --git a/e2sim/src/messagerouting/e2ap_message_handler.hpp b/e2sim/src/messagerouting/e2ap_message_handler.hpp index f937745..f49f76c 100644 --- a/e2sim/src/messagerouting/e2ap_message_handler.hpp +++ b/e2sim/src/messagerouting/e2ap_message_handler.hpp @@ -47,4 +47,6 @@ void e2ap_handle_ResourceStatusRequest(E2AP_PDU_t* pdu, int &socket_fd); void e2ap_handle_E2SeviceRequest(E2AP_PDU_t* pdu, int &socket_fd, E2Sim *e2sim); +void e2ap_send_e2nodeConfigUpdate(int &socket_fd); + #endif