Commit 319f474f authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Code cleanup

parent ed5ea7f3
......@@ -230,12 +230,11 @@ int amf_config::load(const std::string& config_file) {
slice.sd = SD_NO_VALUE; // Default value
try {
slice.sst = std::stoi(sst);
// Get SD if available
if (!sd.empty()) slice.sd = std::stoi(sd);
conv::sd_string_to_int(sd, slice.sd);
} catch (const std::exception& err) {
Logger::amf_app().error("Invalid SST/SD");
}
conv::sd_string_to_int(sd, slice.sd);
plmn_item.slice_list.push_back(slice);
}
plmn_list.push_back(plmn_item);
......
......@@ -4193,25 +4193,13 @@ bool amf_n1::check_subscribed_nssai(
for (auto n : nssai.getDefaultSingleNssais()) {
if (s.sst == n.getSst()) {
uint32_t sd = SD_NO_VALUE;
if (!n.getSd().empty()) {
conv::sd_string_to_int(n.getSd(), sd);
}
conv::sd_string_to_int(n.getSd(), sd);
if (sd == s.sd) {
common_snssais.push_back(n);
Logger::amf_n1().debug(
"Common S-NSSAI (SST %d, SD %ld)", s.sst, sd);
break;
}
/*
if ((s.sst <= SST_MAX_STANDARDIZED_VALUE) or
(n.sdIsSet() and (n.getSd().compare(sd) == 0)) or
(!n.sdIsSet() and sd.empty())) {
common_snssais.push_back(n);
Logger::amf_n1().debug(
"Common S-NSSAI (SST %d, SD %s)", s.sst, sd.c_str());
break;
}
*/
}
}
......@@ -4219,25 +4207,13 @@ bool amf_n1::check_subscribed_nssai(
for (auto n : nssai.getSingleNssais()) {
if (s.sst == n.getSst()) {
uint32_t sd = SD_NO_VALUE;
if (!n.getSd().empty()) {
conv::sd_string_to_int(n.getSd(), sd);
}
conv::sd_string_to_int(n.getSd(), sd);
if (sd == s.sd) {
common_snssais.push_back(n);
Logger::amf_n1().debug(
"Common S-NSSAI (SST %d, SD %ld)", s.sst, sd);
break;
}
/*
if ((s.sst <= SST_MAX_STANDARDIZED_VALUE) or
(n.sdIsSet() and (n.getSd().compare(sd) == 0)) or
(!n.sdIsSet() and sd.empty())) {
common_snssais.push_back(n);
Logger::amf_n1().debug(
"Common S-NSSAI (SST %d, SD %s)", s.sst, sd.c_str());
break;
}
*/
}
}
}
......@@ -4250,28 +4226,15 @@ bool amf_n1::check_subscribed_nssai(
for (auto n : nssai.getDefaultSingleNssais()) {
bool found_nssai = false;
for (auto s : p.slice_list) {
// std::string sd = std::to_string(s.sd);
if (s.sst == n.getSst()) {
uint32_t sd = SD_NO_VALUE;
if (!n.getSd().empty()) {
conv::sd_string_to_int(n.getSd(), sd);
}
conv::sd_string_to_int(n.getSd(), sd);
if (sd == s.sd) {
found_nssai = true;
Logger::amf_n1().debug(
"Found S-NSSAI (SST %d, SD %s)", s.sst, n.getSd().c_str());
break;
}
/*
if ((s.sst <= SST_MAX_STANDARDIZED_VALUE) or
(n.sdIsSet() and (n.getSd().compare(sd) == 0)) or
(!n.sdIsSet() and sd.empty())) {
found_nssai = true;
Logger::amf_n1().debug(
"Found S-NSSAI (SST %d, SD %s)", s.sst, n.getSd().c_str());
break;
}
*/
}
}
......@@ -4285,28 +4248,15 @@ bool amf_n1::check_subscribed_nssai(
for (auto n : common_snssais) {
bool found_nssai = false;
for (auto s : p.slice_list) {
// std::string sd = std::to_string(s.sd);
if (s.sst == n.getSst()) {
uint32_t sd = SD_NO_VALUE;
if (!n.getSd().empty()) {
conv::sd_string_to_int(n.getSd(), sd);
}
conv::sd_string_to_int(n.getSd(), sd);
if (sd == s.sd) {
found_nssai = true;
Logger::amf_n1().debug(
"Found S-NSSAI (SST %d, SD %s)", s.sst, n.getSd().c_str());
break;
}
/*
if ((s.sst <= SST_MAX_STANDARDIZED_VALUE) or
(n.sdIsSet() and (n.getSd().compare(sd) == 0)) or
(!n.sdIsSet() and sd.empty())) {
found_nssai = true;
Logger::amf_n1().debug(
"Found S-NSSAI (SST %d, SD %s)", s.sst, n.getSd().c_str());
break;
}
*/
}
}
......
......@@ -909,18 +909,6 @@ bool amf_n11::discover_smf(
break; // NSSAI is included in the list of supported slices
// from SMF
}
/*
// Match SD (optional) only if it is provided
if ((sst <= SST_MAX_STANDARDIZED_VALUE) or sd.empty() or
(snssai.sD.compare(sd) == 0)) {
Logger::amf_n11().debug(
"S-NSSAI [SST- %d, SD -%s] is matched for SMF profile",
snssai.sST, snssai.sD.c_str());
result = true;
break; // NSSAI is included in the list of supported slices
// from SMF
}
*/
}
}
}
......
......@@ -2327,9 +2327,7 @@ bool amf_n2::get_common_plmn(
std::to_string(s2.sd).c_str());
if (s1.sst.compare(std::to_string(s2.sst)) == 0) {
uint32_t s1_sd = SD_NO_VALUE;
if (!s1.sd.empty()) {
conv::sd_string_to_int(s1.sd, s1_sd);
}
conv::sd_string_to_int(s1.sd, s1_sd);
if (s1_sd == s2.sd) {
Logger::amf_n2().debug(
"Common S-NSSAI (SST %s, SD %s)", s1.sst.c_str(),
......@@ -2337,17 +2335,6 @@ bool amf_n2::get_common_plmn(
plmn_slice_support_item.slice_list.push_back(s1);
found_common_plmn = true;
}
/*
if ((s2.sst <= SST_MAX_STANDARDIZED_VALUE) or
(s1.sd.compare(std::to_string(s2.sd)) ==
0)) { // don't need to check SD for
standard NSSAI Logger::amf_n2().debug( "Common S-NSSAI (SST
%s, SD %s)", s1.sst.c_str(), s1.sd.c_str());
plmn_slice_support_item.slice_list.push_back(s1);
found_common_plmn = true;
}
*/
}
}
}
......
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