Commit 48e45928 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN Committed by sagar arora

Fix issue for NGSetupRequest handling

parent 60f9d83f
...@@ -89,8 +89,9 @@ void amf_n2_task(void* args_p) { ...@@ -89,8 +89,9 @@ void amf_n2_task(void* args_p) {
} break; } break;
case NG_SETUP_REQ: { case NG_SETUP_REQ: {
Logger::amf_n2().info("Received NGSetupRequest message, handling"); Logger::amf_n2().info("Received NGSetupRequest message, handling");
itti_ng_setup_request* m = dynamic_cast<itti_ng_setup_request*>(msg); // itti_ng_setup_request* m = dynamic_cast<itti_ng_setup_request*>(msg);
amf_n2_inst->handle_itti_message(ref(*m)); amf_n2_inst->handle_itti_message(
std::static_pointer_cast<itti_ng_setup_request>(shared_msg));
} break; } break;
case NG_RESET: { case NG_RESET: {
Logger::amf_n2().info("Received NGReset message, handling"); Logger::amf_n2().info("Received NGReset message, handling");
...@@ -304,15 +305,17 @@ void amf_n2::handle_itti_message(itti_paging& itti_msg) { ...@@ -304,15 +305,17 @@ void amf_n2::handle_itti_message(itti_paging& itti_msg) {
void amf_n2::handle_itti_message(itti_new_sctp_association& new_assoc) {} void amf_n2::handle_itti_message(itti_new_sctp_association& new_assoc) {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) { void amf_n2::handle_itti_message(
std::shared_ptr<itti_ng_setup_request> itti_msg) {
Logger::amf_n2().debug("Handle NG Setup Request..."); Logger::amf_n2().debug("Handle NG Setup Request...");
Logger::amf_n2().debug( Logger::amf_n2().debug(
"Parameters: assoc_id %d, stream %d", itti_msg.assoc_id, itti_msg.stream); "Parameters: assoc_id %d, stream %d", itti_msg->assoc_id,
itti_msg->stream);
std::shared_ptr<gnb_context> gc = {}; std::shared_ptr<gnb_context> gc = {};
if (!is_assoc_id_2_gnb_context(itti_msg.assoc_id, gc)) { if (!is_assoc_id_2_gnb_context(itti_msg->assoc_id, gc)) {
Logger::amf_n2().error( Logger::amf_n2().error(
"No existed gNB context with assoc_id(%d)", itti_msg.assoc_id); "No existed gNB context with assoc_id(%d)", itti_msg->assoc_id);
return; return;
} }
...@@ -324,7 +327,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) { ...@@ -324,7 +327,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
ng_gnb_state_str[gc.get()->ng_state]); ng_gnb_state_str[gc.get()->ng_state]);
} else { } else {
Logger::amf_n2().debug( Logger::amf_n2().debug(
"Update gNB context with assoc id (%d)", itti_msg.assoc_id); "Update gNB context with assoc id (%d)", itti_msg->assoc_id);
} }
gnb_infos gnbItem = {}; gnb_infos gnbItem = {};
...@@ -333,7 +336,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) { ...@@ -333,7 +336,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
uint32_t gnb_id = {}; uint32_t gnb_id = {};
std::string gnb_mcc = {}; std::string gnb_mcc = {};
std::string gnb_mnc = {}; std::string gnb_mnc = {};
if (!itti_msg.ngSetupReq->getGlobalGnbID(gnb_id, gnb_mcc, gnb_mnc)) { if (!itti_msg->ngSetupReq->getGlobalGnbID(gnb_id, gnb_mcc, gnb_mnc)) {
Logger::amf_n2().error("Missing Mandatory IE Global RAN Node ID"); Logger::amf_n2().error("Missing Mandatory IE Global RAN Node ID");
return; return;
} }
...@@ -346,7 +349,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) { ...@@ -346,7 +349,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
gnbItem.mnc = gnb_mnc; gnbItem.mnc = gnb_mnc;
std::string gnb_name = {}; std::string gnb_name = {};
if (!itti_msg.ngSetupReq->getRanNodeName(gnb_name)) { if (!itti_msg->ngSetupReq->getRanNodeName(gnb_name)) {
Logger::amf_n2().warn("Missing IE RanNodeName"); Logger::amf_n2().warn("Missing IE RanNodeName");
} else { } else {
gc->gnb_name = gnb_name; gc->gnb_name = gnb_name;
...@@ -355,7 +358,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) { ...@@ -355,7 +358,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
} }
// store Paging DRX in gNB context // store Paging DRX in gNB context
int defPagingDrx = itti_msg.ngSetupReq->getDefaultPagingDRX(); int defPagingDrx = itti_msg->ngSetupReq->getDefaultPagingDRX();
if (defPagingDrx == -1) { if (defPagingDrx == -1) {
Logger::amf_n2().error("Missing Mandatory IE DefaultPagingDRX"); Logger::amf_n2().error("Missing Mandatory IE DefaultPagingDRX");
return; return;
...@@ -364,7 +367,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) { ...@@ -364,7 +367,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
// Get supported TA List // Get supported TA List
vector<SupportedItem_t> s_ta_list; vector<SupportedItem_t> s_ta_list;
if (!itti_msg.ngSetupReq->getSupportedTAList(s_ta_list)) { if (!itti_msg->ngSetupReq->getSupportedTAList(s_ta_list)) {
Logger::amf_n2().error("Missing Mandatory IE Supported TA List"); Logger::amf_n2().error("Missing Mandatory IE Supported TA List");
return; return;
} }
...@@ -388,7 +391,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) { ...@@ -388,7 +391,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
} }
bstring b = blk2bstr(buffer, encoded); bstring b = blk2bstr(buffer, encoded);
sctp_s_38412.sctp_send_msg(itti_msg.assoc_id, itti_msg.stream, &b); sctp_s_38412.sctp_send_msg(itti_msg->assoc_id, itti_msg->stream, &b);
Logger::amf_n2().error( Logger::amf_n2().error(
"No common PLMN, encoding NG_SETUP_FAILURE with cause (Unknown PLMN)"); "No common PLMN, encoding NG_SETUP_FAILURE with cause (Unknown PLMN)");
return; return;
...@@ -443,12 +446,12 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) { ...@@ -443,12 +446,12 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
} }
bstring b = blk2bstr(buffer, encoded); bstring b = blk2bstr(buffer, encoded);
sctp_s_38412.sctp_send_msg(itti_msg.assoc_id, itti_msg.stream, &b); sctp_s_38412.sctp_send_msg(itti_msg->assoc_id, itti_msg->stream, &b);
Logger::amf_n2().debug("Sending NG_SETUP_RESPONSE Ok"); Logger::amf_n2().debug("Sending NG_SETUP_RESPONSE Ok");
gc.get()->ng_state = NGAP_READY; gc.get()->ng_state = NGAP_READY;
Logger::amf_n2().debug( Logger::amf_n2().debug(
"gNB with gNB_id 0x%x, assoc_id %d has been attached to AMF", "gNB with gNB_id 0x%x, assoc_id %d has been attached to AMF",
gc.get()->globalRanNodeId, itti_msg.assoc_id); gc.get()->globalRanNodeId, itti_msg->assoc_id);
stacs.add_gnb(gnbItem.gnb_id, gnbItem); stacs.add_gnb(gnbItem.gnb_id, gnbItem);
return; return;
} }
......
...@@ -49,7 +49,14 @@ class amf_n2 : public ngap::ngap_app { ...@@ -49,7 +49,14 @@ class amf_n2 : public ngap::ngap_app {
* @param [itti_downlink_nas_transfer&]: ITTI message * @param [itti_downlink_nas_transfer&]: ITTI message
* @return void * @return void
*/ */
void handle_itti_message(itti_ng_setup_request& ngsetupreq); void handle_itti_message(itti_ng_setup_request& ng_setup_req);
/*
* Handle ITTI message (Downlink NAS Transfer)
* @param [std::shared_ptr<itti_ng_setup_request>]: ITTI message
* @return void
*/
void handle_itti_message(std::shared_ptr<itti_ng_setup_request> ng_setup_req);
/* /*
* Handle ITTI message (Downlink NAS Transfer) * Handle ITTI message (Downlink NAS Transfer)
......
...@@ -21,9 +21,6 @@ ...@@ -21,9 +21,6 @@
#include "AdditionalQosFlowInformation.hpp" #include "AdditionalQosFlowInformation.hpp"
#include <iostream>
using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -21,9 +21,6 @@ ...@@ -21,9 +21,6 @@
#include "AllocationAndRetentionPriority.hpp" #include "AllocationAndRetentionPriority.hpp"
#include <iostream>
using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment