Commit 7a5ee444 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'fix_mcc_00' into 'develop'

Fix issue for MCC starting with 00 (e.g., 001)

See merge request oai/cn5g/oai-cn5g-amf!84
parents acc73357 4d1806fd
......@@ -342,7 +342,9 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
Logger::amf_n2().error("Missing Mandatory IE Global RAN Node ID");
return;
}
Logger::amf_n2().debug("Global RAN Node ID: 0x%x", gnb_id);
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());
gc->globalRanNodeId = gnb_id;
gnbItem.gnb_id = gnb_id;
gnbItem.mcc = gnb_mcc;
......
......@@ -562,9 +562,16 @@ int _5GSMobilityIdentity::suci_decodefrombuffer(
if (mnc < 10) {
mnc_str = "0" + mnc_str;
}
std::string mcc_str = std::to_string(mcc);
if (mcc < 10) {
mcc_str = "00" + mcc_str;
} else if (mcc < 100) {
mcc_str = "0" + mcc_str;
}
Logger::nas_mm().debug(
"MCC %s, MNC %s", std::to_string(mcc).c_str(), mnc_str.c_str());
supi_format_imsi->mcc = (const string)(std::to_string(mcc));
"MCC %s, MNC %s", mcc_str.c_str(), mnc_str.c_str());
supi_format_imsi->mcc = (const string)(mcc_str);
supi_format_imsi->mnc = (const string)(mnc_str);
int routid = 0;
uint8_t digit[4];
......
......@@ -74,6 +74,11 @@ void PlmnId::setMccMnc(const std::string mcc, const std::string mnc) {
void PlmnId::getMcc(std::string& mcc) {
int m_mcc = mcc_digit1 * 100 + mcc_digit2 * 10 + mcc_digit3;
mcc = to_string(m_mcc);
if ((mcc_digit2 == 0) and (mcc_digit1 == 0)) {
mcc = "00" + mcc;
} else if (mcc_digit1 == 0) {
mcc = "0" + mcc;
}
}
//------------------------------------------------------------------------------
......
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