Commit 6b654827 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Update gNB/UE statistic

parent 212fedf7
......@@ -237,19 +237,21 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
"Update gNB context with assoc id (%d)", itti_msg.assoc_id);
}
gnb_infos gnbItem;
gnb_infos gnbItem = {};
// Get IE Global RAN Node ID
uint32_t gnb_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 GlobalGnbID");
Logger::amf_n2().error("Missing Mandatory IE Global RAN Node ID");
return;
}
Logger::amf_n2().debug("IE GlobalGNBID: 0x%x", gnb_id);
Logger::amf_n2().debug("Global RAN Node ID: 0x%x", gnb_id);
gc->globalRanNodeId = gnb_id;
gnbItem.gnb_id = gnb_id;
gnbItem.mcc = gnb_mcc;
gnbItem.mnc = gnb_mnc;
std::string gnb_name;
if (!itti_msg.ngSetupReq->getRanNodeName(gnb_name)) {
......@@ -267,15 +269,16 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
}
Logger::amf_n2().debug("IE DefaultPagingDRX: %d", defPagingDrx);
// Get supported TA List
vector<SupportedItem_t> s_ta_list;
if (!itti_msg.ngSetupReq->getSupportedTAList(
s_ta_list)) { // getSupportedTAList
if (!itti_msg.ngSetupReq->getSupportedTAList(s_ta_list)) {
return;
}
// TODO: should be removed, since we stored list of common PLMNs
gnbItem.mcc = s_ta_list[0].b_plmn_list[0].mcc;
gnbItem.mnc = s_ta_list[0].b_plmn_list[0].mnc;
gnbItem.tac = s_ta_list[0].tac;
// gnbItem.mcc = s_ta_list[0].b_plmn_list[0].mcc;
// gnbItem.mnc = s_ta_list[0].b_plmn_list[0].mnc;
// gnbItem.tac = s_ta_list[0].tac;
// association GlobalRANNodeID with assoc_id
// store RAN Node Name in gNB context, if present
// verify PLMN Identity and TAC with configuration and store supportedTAList
......@@ -404,8 +407,6 @@ void amf_n2::handle_itti_message(itti_ng_reset& itti_msg) {
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_ng_shutdown& itti_msg) {
Logger::amf_n2().debug("Parameters: assoc_id %d", itti_msg.assoc_id);
std::shared_ptr<gnb_context> gc;
if (!is_assoc_id_2_gnb_context(itti_msg.assoc_id)) {
Logger::amf_n2().error(
......@@ -434,11 +435,11 @@ void amf_n2::handle_itti_message(itti_ng_shutdown& itti_msg) {
}
// Delete gNB context
Logger::amf_n2().debug("Remove gNB Context %d", itti_msg.assoc_id);
remove_gnb_context(itti_msg.assoc_id);
stacs.gnbs.erase(gc.get()->globalRanNodeId);
Logger::amf_n2().debug(
"Remove gNB with globalRanNodeId 0x%x", gc.get()->globalRanNodeId);
"Remove gNB with association id %d, globalRanNodeId 0x%x",
itti_msg.assoc_id, gc.get()->globalRanNodeId);
stacs.gNB_connected -= 1;
stacs.display();
return;
......
......@@ -33,13 +33,7 @@
//------------------------------------------------------------------------------
void statistics::display() {
Logger::amf_app().info("");
// Logger::amf_app().info("--------------------------------------------------");
// Logger::amf_app().info("| connected gNBs | connected UEs | registered UEs
// |");
// Logger::amf_app().info("--------------------------------------------------");
// Logger::amf_app().info("| %d | %d | %d
// |",gNB_connected,UE_connected,UE_registred);
// Logger::amf_app().info("--------------------------------------------------");
Logger::amf_app().info(
"|-----------------------------------------------------------------------"
"-----------------------------------------|");
......@@ -48,31 +42,24 @@ void statistics::display() {
"information-------------------------------------------|");
Logger::amf_app().info(
"| Index | Status | Global ID | gNB "
"Name | Tracking Area (PLMN, TAC) |");
"Name | PLMN | Supported TA list |");
if (gnbs.size() == 0) {
Logger::amf_app().info(
"| - | - | - | "
"- | - |");
"- | - | - |");
}
// TODO: Show the list of common PLMNs
int i = 1;
for (auto const& gnb : gnbs) {
Logger::amf_app().info(
"| %d | Connected | 0x%x | %s "
" | %s, %d | ",
" | %s, %s | %s |",
i, gnb.second.gnb_id, gnb.second.gnb_name.c_str(),
(gnb.second.mcc + gnb.second.mnc).c_str(), gnb.second.tac);
gnb.second.mcc.c_str(), gnb.second.mnc.c_str(),
gnb.second.plmn_to_string().c_str());
i++;
}
/* for (int i = 0; i < gnbs.size(); i++) {
Logger::amf_app().info(
"| %d | Connected | 0x%x | %s "
" | %s, %d | ",
i + 1, gnbs[i].gnb_id, gnbs[i].gnb_name.c_str(),
(gnbs[i].mcc + gnbs[i].mnc).c_str(), gnbs[i].tac);
}
*/
Logger::amf_app().info(
"|-----------------------------------------------------------------------"
"-----------------------------------------|");
......@@ -91,10 +78,10 @@ void statistics::display() {
i = 0;
for (auto const& ue : ue_infos) {
Logger::amf_app().info(
"|%7d|%22s|%18s|%15s|%16d|%11d|%9s|%7d|", i + 1,
"|%7d|%22s|%18s|%15s|%16d|%11d|%3s, %4s|%7d|", i + 1,
ue.second.registerStatus.c_str(), ue.second.imsi.c_str(),
ue.second.guti.c_str(), ue.second.ranid, ue.second.amfid,
(ue.second.mcc + ue.second.mnc).c_str(), ue.second.cellId);
ue.second.mcc.c_str(), ue.second.mnc.c_str(), ue.second.cellId);
i++;
}
Logger::amf_app().info(
......
......@@ -44,6 +44,24 @@ typedef struct {
std::string gnb_name;
uint32_t tac;
// long nrCellId;
std::string plmn_to_string() const {
std::string s = {};
s.append("PLMN List: ");
for (auto supported_item : plmn_list) {
s.append("TAC " + std::to_string(supported_item.tac));
s.append("PLMNs (");
for (auto plmn_slice : supported_item.b_plmn_list) {
s.append("(MCC " + plmn_slice.mcc);
s.append(", MNC " + plmn_slice.mnc);
for (auto slice : plmn_slice.slice_list) {
s.append("(SST " + slice.sst + ", SD " + slice.sd + ")");
}
s.append(")");
}
s.append(")");
}
return s;
}
} gnb_infos;
typedef struct ue_info_s {
......
......@@ -170,10 +170,9 @@ void ngap_app::set_gnb_id_2_gnb_context(
//------------------------------------------------------------------------------
void ngap_app::remove_gnb_context(const long& gnb_id) {
if (is_gnb_id_2_gnb_context(gnb_id)) {
std::unique_lock lock(m_gnbid2gnbContext);
gnbid2gnbContext.erase(gnb_id);
return;
std::unique_lock lock(m_gnbid2gnbContext);
gnbid2gnbContext.erase(gnb_id);
return;
}
}
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