Commit 96bda27e authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

code cleanup

parent b36adeb9
...@@ -252,11 +252,11 @@ void amf_config::display() { ...@@ -252,11 +252,11 @@ void amf_config::display() {
Logger::config().info(" (%s, %s, %s , %s, %s)", guami_list[i].mcc.c_str(), guami_list[i].mnc.c_str(), guami_list[i].regionID.c_str(), guami_list[i].AmfSetID.c_str(), guami_list[i].AmfPointer.c_str()); Logger::config().info(" (%s, %s, %s , %s, %s)", guami_list[i].mcc.c_str(), guami_list[i].mnc.c_str(), guami_list[i].regionID.c_str(), guami_list[i].AmfSetID.c_str(), guami_list[i].AmfPointer.c_str());
} }
Logger::config().info("- RelativeAMFCapacity ................................: %d", relativeAMFCapacity); Logger::config().info("- RelativeAMFCapacity ................................: %d", relativeAMFCapacity);
Logger::config().info("- PLMNSupportList (MCC, MNC)..........................: "); Logger::config().info("- PLMNSupportList ....................................: ");
for (int i = 0; i < plmn_list.size(); i++) { for (int i = 0; i < plmn_list.size(); i++) {
Logger::config().info(" [%s] [%s] ", plmn_list[i].mcc.c_str(), plmn_list[i].mnc.c_str()); Logger::config().info(" (MCC %s, MNC %s) ", plmn_list[i].mcc.c_str(), plmn_list[i].mnc.c_str());
Logger::config().info(" TAC [%d]", plmn_list[i].tac); Logger::config().info(" TAC: %d", plmn_list[i].tac);
Logger::config().info(" - SliceSupportList (SST, SD) ....................: "); Logger::config().info(" SliceSupportList (SST, SD) ....................: ");
for (int j = 0; j < plmn_list[i].slice_list.size(); j++) { for (int j = 0; j < plmn_list[i].slice_list.size(); j++) {
Logger::config().info(" (%s, %s) ", plmn_list[i].slice_list[j].sST.c_str(), plmn_list[i].slice_list[j].sD.c_str()); Logger::config().info(" (%s, %s) ", plmn_list[i].slice_list[j].sST.c_str(), plmn_list[i].slice_list[j].sD.c_str());
} }
......
...@@ -1241,13 +1241,13 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id, long amf_ue_ ...@@ -1241,13 +1241,13 @@ void amf_n1::security_mode_complete_handle(uint32_t ran_ue_ngap_id, long amf_ue_
} }
if (!uc.get()->isUeContextRequest) { if (!uc.get()->isUeContextRequest) {
Logger::amf_n1().debug("UE Context is not requested, ue with ran_ue_ngap_id(%d), amf_ue_ngap_id(%d) attached", ran_ue_ngap_id, amf_ue_ngap_id); Logger::amf_n1().debug("UE Context is not requested, ue with ran_ue_ngap_id %d, amf_ue_ngap_id %d attached", ran_ue_ngap_id, amf_ue_ngap_id);
//send registration accept back //send registration accept back
} else { } else {
//encoding InitialContextSetupRequest(NGAP message) back //encoding InitialContextSetupRequest(NGAP message) back
std::shared_ptr<nas_context> nc; std::shared_ptr<nas_context> nc;
nc = amf_ue_id_2_nas_context(amf_ue_ngap_id); nc = amf_ue_id_2_nas_context(amf_ue_ngap_id);
Logger::amf_n1().info("UE [imsi:%s][guti:%s][current ranid:%d][current amfid:%d] has been registred into network", nc.get()->imsi.c_str(), guti.c_str(), ran_ue_ngap_id, amf_ue_ngap_id); Logger::amf_n1().info("UE (IMSI %s, GUTI %s, current RAN ID %d, current AMF ID %d) has been registered into network", nc.get()->imsi.c_str(), guti.c_str(), ran_ue_ngap_id, amf_ue_ngap_id);
if (nc.get()->is_stacs_available) { if (nc.get()->is_stacs_available) {
int index = 0; int index = 0;
for (int i = 0; i < stacs.ues.size(); i++) { for (int i = 0; i < stacs.ues.size(); i++) {
......
...@@ -40,17 +40,23 @@ void statistics::display() { ...@@ -40,17 +40,23 @@ void statistics::display() {
//Logger::amf_app().info("--------------------------------------------------"); //Logger::amf_app().info("--------------------------------------------------");
Logger::amf_app().info("|-----------------------------------------------------------------------------------------------------------------|"); Logger::amf_app().info("|-----------------------------------------------------------------------------------------------------------------|");
Logger::amf_app().info("|----------------------------------------------------gNBs' information--------------------------------------------|"); Logger::amf_app().info("|----------------------------------------------------gNBs' information--------------------------------------------|");
Logger::amf_app().info("| Index | Status | Global ID | gNB Name | Tracking Area (PLMN, TAC)| ");
for (int i = 0; i < gnbs.size(); i++) { for (int i = 0; i < gnbs.size(); i++) {
Logger::amf_app().info("[index %d][connected][GlobalID: 0x%x][gnb name: %s][Tracking Area: plmn(%s), tac(%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("| %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("[index %d][connected][GlobalID: 0x%x][gnb name: %s][Tracking Area: plmn(%s), tac(%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("-----------------------------------------------------------------------------------------------------------------"); Logger::amf_app().info("-----------------------------------------------------------------------------------------------------------------");
Logger::amf_app().info(""); Logger::amf_app().info("");
Logger::amf_app().info("|----------------------------------------------------------------------------------------------------------------|"); Logger::amf_app().info("|----------------------------------------------------------------------------------------------------------------|");
Logger::amf_app().info("|----------------------------------------------------UEs' information--------------------------------------------|"); Logger::amf_app().info("|----------------------------------------------------UEs' information--------------------------------------------|");
Logger::amf_app().info("| Index | Connection state | Registration state | IMSI | GUTI | RAN UE NGAP ID | AMF UE ID |");
for (int i = 0; i < ues.size(); i++) { for (int i = 0; i < ues.size(); i++) {
Logger::amf_app().info("[index %d][%s][%s][imsi %s][guti %s]", i + 1, ues[i].connStatus.c_str(), ues[i].registerStatus.c_str(), ues[i].imsi.c_str(), ues[i].guti.c_str()); //Logger::amf_app().info("[index %d][%s][%s][imsi %s][guti %s]", i + 1, ues[i].connStatus.c_str(), ues[i].registerStatus.c_str(), ues[i].imsi.c_str(), ues[i].guti.c_str());
Logger::amf_app().info("Current ran_ue_ngap_id[%d]; Current amf_ue_ngap_id[%d]", ues[i].ranid, ues[i].amfid); Logger::amf_app().info("| %d | %s | %s | %s | %s | %d | %d | ", i + 1, ues[i].connStatus.c_str(), ues[i].registerStatus.c_str(), ues[i].imsi.c_str(), ues[i].guti.c_str(), ues[i].ranid, ues[i].amfid);
//Logger::amf_app().info("Current ran_ue_ngap_id[%d]; Current amf_ue_ngap_id[%d]", ues[i].ranid, ues[i].amfid);
Logger::amf_app().info("Location[NrCgi][PLMN(%s), cellID(%d)]", (ues[i].mcc + ues[i].mnc).c_str(), ues[i].cellId); Logger::amf_app().info("Location[NrCgi][PLMN(%s), cellID(%d)]", (ues[i].mcc + ues[i].mnc).c_str(), ues[i].cellId);
Logger::amf_app().info(""); Logger::amf_app().info("");
} }
......
...@@ -185,7 +185,7 @@ int sctp_server::sctp_read_from_socket(int sd, uint32_t ppid) { ...@@ -185,7 +185,7 @@ int sctp_server::sctp_read_from_socket(int sd, uint32_t ppid) {
Logger::sctp().error("Received data from peer with unsolicited PPID (%d), expecting (%d)", ntohl(sinfo.sinfo_ppid), association->ppid); Logger::sctp().error("Received data from peer with unsolicited PPID (%d), expecting (%d)", ntohl(sinfo.sinfo_ppid), association->ppid);
return SCTP_RC_ERROR; return SCTP_RC_ERROR;
} }
Logger::sctp().info("[Assoc_id (%d)][Socket (%d)] Received a msg (length %d) from port %d, on stream %d, PPID %d", sinfo.sinfo_assoc_id, sd, n, ntohs(addr.sin6_port), sinfo.sinfo_stream, ntohl(sinfo.sinfo_ppid)); Logger::sctp().info("[Assoc_id %d, Socket %d] Received a msg (length %d) from port %d, on stream %d, PPID %d", sinfo.sinfo_assoc_id, sd, n, ntohs(addr.sin6_port), sinfo.sinfo_stream, ntohl(sinfo.sinfo_ppid));
bstring payload = blk2bstr(buffer, n); bstring payload = blk2bstr(buffer, n);
//handle payload //handle payload
app_->handle_receive(payload, (sctp_assoc_id_t) sinfo.sinfo_assoc_id, sinfo.sinfo_stream, association->instreams, association->outstreams); app_->handle_receive(payload, (sctp_assoc_id_t) sinfo.sinfo_assoc_id, sinfo.sinfo_stream, association->instreams, association->outstreams);
...@@ -279,14 +279,14 @@ int sctp_server::sctp_get_peeraddresses(int sock, struct sockaddr **remote_addr, ...@@ -279,14 +279,14 @@ int sctp_server::sctp_get_peeraddresses(int sock, struct sockaddr **remote_addr,
struct sockaddr_in *addr = NULL; struct sockaddr_in *addr = NULL;
addr = (struct sockaddr_in*) &temp_addr_p[j]; addr = (struct sockaddr_in*) &temp_addr_p[j];
if (inet_ntop(AF_INET, &addr->sin_addr, address, sizeof(address)) != NULL) { if (inet_ntop(AF_INET, &addr->sin_addr, address, sizeof(address)) != NULL) {
Logger::sctp().info(" - IPv4 Addr: %s\n", address); Logger::sctp().info(" - IPv4 Addr: %s", address);
} }
} else { } else {
struct sockaddr_in6 *addr = NULL; struct sockaddr_in6 *addr = NULL;
char address[40] = { 0 }; char address[40] = { 0 };
addr = (struct sockaddr_in6*) &temp_addr_p[j]; addr = (struct sockaddr_in6*) &temp_addr_p[j];
if (inet_ntop(AF_INET6, &addr->sin6_addr.s6_addr, address, sizeof(address)) != NULL) { if (inet_ntop(AF_INET6, &addr->sin6_addr.s6_addr, address, sizeof(address)) != NULL) {
Logger::sctp().info(" - IPv6 Addr: %s\n", address); Logger::sctp().info(" - Addr: %s", address);
} }
} }
} }
...@@ -317,17 +317,17 @@ int sctp_server::sctp_get_localaddresses(int sock, struct sockaddr **local_addr, ...@@ -317,17 +317,17 @@ int sctp_server::sctp_get_localaddresses(int sock, struct sockaddr **local_addr,
struct sockaddr_in *addr = NULL; struct sockaddr_in *addr = NULL;
addr = (struct sockaddr_in*) &temp_addr_p[j]; addr = (struct sockaddr_in*) &temp_addr_p[j];
if (inet_ntop(AF_INET, &addr->sin_addr, address, sizeof(address)) != NULL) { if (inet_ntop(AF_INET, &addr->sin_addr, address, sizeof(address)) != NULL) {
Logger::sctp().info(" - IPv4 Addr: %s\n", address); Logger::sctp().info(" - IPv4 Addr: %s", address);
} }
} else if (temp_addr_p[j].sa_family == AF_INET6) { } else if (temp_addr_p[j].sa_family == AF_INET6) {
struct sockaddr_in6 *addr = NULL; struct sockaddr_in6 *addr = NULL;
char address[40] = { 0 }; char address[40] = { 0 };
addr = (struct sockaddr_in6*) &temp_addr_p[j]; addr = (struct sockaddr_in6*) &temp_addr_p[j];
if (inet_ntop(AF_INET6, &addr->sin6_addr.s6_addr, address, sizeof(address)) != NULL) { if (inet_ntop(AF_INET6, &addr->sin6_addr.s6_addr, address, sizeof(address)) != NULL) {
Logger::sctp().info(" - IPv6 Addr: %s\n", address); Logger::sctp().info(" - Addr: %s", address);
} }
} else { } else {
Logger::sctp().error(" - unhandled address family %d", temp_addr_p[j].sa_family); Logger::sctp().error(" - Unknown address family %d", temp_addr_p[j].sa_family);
} }
} }
if (local_addr != NULL && nb_local_addresses != NULL) { if (local_addr != NULL && nb_local_addresses != NULL) {
......
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