Commit 280954f5 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Remove unnecessary info for log/debug

parent 2d0fe283
......@@ -310,7 +310,8 @@ void amf_n2::handle_itti_message(itti_new_sctp_association& new_assoc) {}
//------------------------------------------------------------------------------
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(
"[gNB Assoc ID %d] Handle NG Setup Request...", itti_msg->assoc_id);
Logger::amf_n2().debug(
"Parameters: assoc_id %d, stream %d", itti_msg->assoc_id,
itti_msg->stream);
......@@ -318,45 +319,46 @@ void amf_n2::handle_itti_message(
std::shared_ptr<gnb_context> gc = {};
if (!assoc_id_2_gnb_context(itti_msg->assoc_id, gc)) {
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;
}
if (gc->ng_state == NGAP_RESETING || gc->ng_state == NGAP_SHUTDOWN) {
Logger::amf_n2().warn(
"Received a new association request on an association that is being "
"[gNB Assoc ID %d] Received a new association request on an "
"association that is being "
"%s, "
"ignoring",
ng_gnb_state_str[gc->ng_state]);
itti_msg->assoc_id, ng_gnb_state_str[gc->ng_state]);
} else {
Logger::amf_n2().debug(
"Update gNB context with assoc id (%d)", itti_msg->assoc_id);
}
gnb_infos gnbItem = {};
// Get IE Global RAN Node ID
uint32_t gnb_id = {};
std::string gnb_mcc = {};
std::string 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(
"[gNB Assoc ID %d] Missing Mandatory IE Global RAN Node ID",
itti_msg->assoc_id);
return;
}
Logger::amf_n2().debug(
"RAN Node Info, Global RAN Node ID: 0x%x, MCC %s, MNC %s", gnb_id,
gnb_mcc.c_str(), gnb_mnc.c_str());
// Store GNB info in the gNB context
gc->globalRanNodeId = gnb_id;
gnbItem.gnb_id = gnb_id;
gnbItem.mcc = gnb_mcc;
gnbItem.mnc = gnb_mnc;
gc->plmn.mcc = gnb_mcc;
gc->plmn.mnc = gnb_mnc;
std::string gnb_name = {};
if (!itti_msg->ngSetupReq->getRanNodeName(gnb_name)) {
Logger::amf_n2().warn("Missing IE RanNodeName");
} else {
gc->gnb_name = gnb_name;
gnbItem.gnb_name = gnb_name;
gc->gnb_name = gnb_name;
Logger::amf_n2().debug("IE RanNodeName: %s", gnb_name.c_str());
}
......@@ -395,14 +397,11 @@ void amf_n2::handle_itti_message(
bstring b = blk2bstr(buffer, encoded);
sctp_s_38412.sctp_send_msg(itti_msg->assoc_id, itti_msg->stream, &b);
Logger::amf_n2().error(
"No common PLMN, encoding NG_SETUP_FAILURE with cause (Unknown PLMN)");
"[gNB ID %d] No common PLMN between gNB and AMF, encoding "
"NG_SETUP_FAILURE with cause (Unknown PLMN)",
gc->globalRanNodeId);
bdestroy_wrapper(&b);
return;
} else {
for (auto i : gc->s_ta_list) {
gnbItem.plmn_list.push_back(i);
}
}
set_gnb_id_2_gnb_context(gnb_id, gc);
......@@ -455,7 +454,10 @@ void amf_n2::handle_itti_message(
Logger::amf_n2().debug(
"gNB with gNB_id 0x%x, assoc_id %d has been attached to AMF",
gc->globalRanNodeId, itti_msg->assoc_id);
stacs.add_gnb(gnbItem.gnb_id, gnbItem);
// store gNB info for statistic purpose
stacs.add_gnb(gc);
bdestroy_wrapper(&b);
return;
}
......
......@@ -149,6 +149,21 @@ void statistics::add_gnb(const uint32_t& gnb_id, const gnb_infos& gnb) {
gNB_connected += 1;
}
//------------------------------------------------------------------------------
void statistics::add_gnb(const std::shared_ptr<gnb_context>& gc) {
gnb_infos gnb = {};
gnb.gnb_id = gc->globalRanNodeId;
gnb.mcc = gc->plmn.mcc;
gnb.mnc = gc->plmn.mnc;
gnb.gnb_name = gc->gnb_name;
for (auto i : gc->s_ta_list) {
gnb.plmn_list.push_back(i);
}
std::unique_lock lock(m_gnbs);
gnbs.insert(std::pair<uint32_t, gnb_infos>(gc->globalRanNodeId, gnb));
gNB_connected += 1;
}
//------------------------------------------------------------------------------
void statistics::update_gnb(const uint32_t& gnb_id, const gnb_infos& gnb) {
std::unique_lock lock(m_gnbs);
......
......@@ -109,6 +109,13 @@ class statistics {
*/
void add_gnb(const uint32_t& gnb_id, const gnb_infos& gnb);
/*
* Add gNB to the list connected gNB to this AMF
* @param [const std::shared_ptr<gnb_context> &] gc: pointer to gNB Context
* @return void
*/
void add_gnb(const std::shared_ptr<gnb_context>& gc);
/*
* Update gNB info
* @param [const uint32_t&] gnb_id: gNB ID
......
......@@ -29,6 +29,7 @@
#include "NgapIEsStruct.hpp"
#include "sctp_server.hpp"
#include "3gpp_23.003.h"
extern "C" {
#include "Ngap_PagingDRX.h"
......@@ -54,6 +55,7 @@ class gnb_context {
std::string gnb_name;
long globalRanNodeId;
plmn_t plmn;
e_Ngap_PagingDRX default_paging_drx; // v32, v64, v128, v256
std::vector<SupportedTaItem_t> s_ta_list;
bstring ue_radio_cap_ind;
......
......@@ -59,7 +59,9 @@ constexpr uint8_t NGAP_PRESENT_MAX_VALUE = 3;
int ngap_amf_handle_ng_setup_request(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending ITTI NG Setup Request message to TASK_AMF_N2");
Logger::ngap().debug(
"[gNB Assoc Id %d] Sending ITTI NG Setup Request message to TASK_AMF_N2",
assoc_id);
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p);
NGSetupRequestMsg* ng_setup_req = new NGSetupRequestMsg();
if (!ng_setup_req->decodeFromPdu(message_p)) {
......@@ -105,7 +107,9 @@ int ngap_handle_ng_setup_failure(
int ngap_amf_handle_initial_ue_message(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending ITTI Initial UE Message to TASK_AMF_N2");
Logger::ngap().debug(
"[gNB Assoc ID %d] Sending ITTI Initial UE Message to TASK_AMF_N2",
assoc_id);
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p);
InitialUEMessageMsg* init_ue_msg = new InitialUEMessageMsg();
......
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