Commit 53be2cc0 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'fix_sd_log' into 'develop'

Fix sd log

See merge request oai/cn5g/oai-cn5g-amf!132
parents 306af566 319f474f
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "string.hpp" #include "string.hpp"
#include "thread_sched.hpp" #include "thread_sched.hpp"
#include "fqdn.hpp" #include "fqdn.hpp"
#include "conversions.hpp"
extern "C" { extern "C" {
#include <arpa/inet.h> #include <arpa/inet.h>
...@@ -226,16 +227,14 @@ int amf_config::load(const std::string& config_file) { ...@@ -226,16 +227,14 @@ int amf_config::load(const std::string& config_file) {
std::string sd = {}; std::string sd = {};
slice_item.lookupValue(AMF_CONFIG_STRING_SST, sst); slice_item.lookupValue(AMF_CONFIG_STRING_SST, sst);
slice_item.lookupValue(AMF_CONFIG_STRING_SD, sd); slice_item.lookupValue(AMF_CONFIG_STRING_SD, sd);
slice.sd = SD_NO_VALUE; // Default value
try { try {
slice.sst = std::stoi(sst); slice.sst = std::stoi(sst);
slice.sd = SD_NO_VALUE; // Default value conv::sd_string_to_int(sd, slice.sd);
// Get SD if available for non standardized SST
if (slice.sst > SST_MAX_STANDARDIZED_VALUE) {
if (!sd.empty()) slice.sd = std::stoi(sd);
}
} catch (const std::exception& err) { } catch (const std::exception& err) {
Logger::amf_app().error("Invalid SST/SD"); Logger::amf_app().error("Invalid SST/SD");
} }
plmn_item.slice_list.push_back(slice); plmn_item.slice_list.push_back(slice);
} }
plmn_list.push_back(plmn_item); plmn_list.push_back(plmn_item);
...@@ -713,24 +712,15 @@ void amf_config::display() { ...@@ -713,24 +712,15 @@ void amf_config::display() {
Logger::config().info(" TAC ...................: %d", plmn_list[i].tac); Logger::config().info(" TAC ...................: %d", plmn_list[i].tac);
Logger::config().info(" Slice Support .........:"); Logger::config().info(" Slice Support .........:");
for (int j = 0; j < plmn_list[i].slice_list.size(); j++) { for (int j = 0; j < plmn_list[i].slice_list.size(); j++) {
std::string str = {}; if (plmn_list[i].slice_list[j].sd != SD_NO_VALUE) {
str = str.append(" SST") Logger::config().info(
.append( " SST, SD ...........: %d, %ld (0x%x)",
(plmn_list[i].slice_list[j].sst > plmn_list[i].slice_list[j].sst, plmn_list[i].slice_list[j].sd,
SST_MAX_STANDARDIZED_VALUE && plmn_list[i].slice_list[j].sd);
(plmn_list[i].slice_list[j].sd != SD_NO_VALUE)) ? } else {
", SD " : Logger::config().info(
" ....") " SST ...............: %d", plmn_list[i].slice_list[j].sst);
.append("...........: ") }
.append(std::to_string(plmn_list[i].slice_list[j].sst))
.append("")
.append(
(plmn_list[i].slice_list[j].sst >
SST_MAX_STANDARDIZED_VALUE &&
(plmn_list[i].slice_list[j].sd != SD_NO_VALUE)) ?
", " + std::to_string(plmn_list[i].slice_list[j].sd) :
" ");
Logger::config().info(str.c_str());
} }
} }
Logger::config().info( Logger::config().info(
......
...@@ -254,14 +254,15 @@ typedef struct slice_s { ...@@ -254,14 +254,15 @@ typedef struct slice_s {
nlohmann::json to_json() const { nlohmann::json to_json() const {
nlohmann::json json_data = {}; nlohmann::json json_data = {};
json_data["sst"] = this->sst; json_data["sst"] = this->sst;
if (sst > SST_MAX_STANDARDIZED_VALUE) json_data["sd"] = this->sd; if (this->sd != SD_NO_VALUE) json_data["sd"] = this->sd;
return json_data; return json_data;
} }
void from_json(nlohmann::json& json_data) { void from_json(nlohmann::json& json_data) {
this->sst = json_data["sst"].get<int>(); this->sst = json_data["sst"].get<int>();
if (this->sst > SST_MAX_STANDARDIZED_VALUE) if (json_data.find("sd") != json_data.end()) {
this->sd = json_data["sd"].get<int>(); this->sd = json_data["sd"].get<int>();
}
} }
} slice_t; } slice_t;
......
...@@ -3766,10 +3766,11 @@ void amf_n1::initialize_registration_accept( ...@@ -3766,10 +3766,11 @@ void amf_n1::initialize_registration_accept(
for (auto s : p.slice_list) { for (auto s : p.slice_list) {
SNSSAI_t snssai = {}; SNSSAI_t snssai = {};
snssai.sst = s.sst; snssai.sst = s.sst;
snssai.sd = SD_NO_VALUE; // Default value snssai.sd = s.sd;
// Get SD if available for non standardized SST if (snssai.sd == SD_NO_VALUE) {
if (s.sst > SST_MAX_STANDARDIZED_VALUE) { snssai.length = SST_LENGTH;
snssai.sd = s.sd; } else {
snssai.length = SST_LENGTH + SD_LENGTH;
} }
nssai.push_back(snssai); nssai.push_back(snssai);
} }
...@@ -4139,7 +4140,7 @@ bool amf_n1::check_requested_nssai(const std::shared_ptr<nas_context>& nc) { ...@@ -4139,7 +4140,7 @@ bool amf_n1::check_requested_nssai(const std::shared_ptr<nas_context>& nc) {
for (auto s : p.slice_list) { for (auto s : p.slice_list) {
std::string sd = std::to_string(s.sd); std::string sd = std::to_string(s.sd);
if (s.sst == n.sst) { if (s.sst == n.sst) {
if ((s.sst <= SST_MAX_STANDARDIZED_VALUE) or (s.sd == n.sd)) { if (s.sd == n.sd) {
found_nssai = true; found_nssai = true;
Logger::amf_n1().debug( Logger::amf_n1().debug(
"Found S-NSSAI (SST %d, SD %d)", s.sst, n.sd); "Found S-NSSAI (SST %d, SD %d)", s.sst, n.sd);
...@@ -4187,16 +4188,16 @@ bool amf_n1::check_subscribed_nssai( ...@@ -4187,16 +4188,16 @@ bool amf_n1::check_subscribed_nssai(
"NSSAIs"); "NSSAIs");
std::vector<oai::amf::model::Snssai> common_snssais; std::vector<oai::amf::model::Snssai> common_snssais;
for (auto s : nc->requestedNssai) { for (auto s : nc->requestedNssai) {
std::string sd = std::to_string(s.sd); // std::string sd = std::to_string(s.sd);
// Check with default subscribed NSSAIs // Check with default subscribed NSSAIs
for (auto n : nssai.getDefaultSingleNssais()) { for (auto n : nssai.getDefaultSingleNssais()) {
if (s.sst == n.getSst()) { if (s.sst == n.getSst()) {
if ((s.sst <= SST_MAX_STANDARDIZED_VALUE) or uint32_t sd = SD_NO_VALUE;
(n.sdIsSet() and (n.getSd().compare(sd) == 0)) or conv::sd_string_to_int(n.getSd(), sd);
(!n.sdIsSet() and sd.empty())) { if (sd == s.sd) {
common_snssais.push_back(n); common_snssais.push_back(n);
Logger::amf_n1().debug( Logger::amf_n1().debug(
"Common S-NSSAI (SST %d, SD %s)", s.sst, sd.c_str()); "Common S-NSSAI (SST %d, SD %ld)", s.sst, sd);
break; break;
} }
} }
...@@ -4205,12 +4206,12 @@ bool amf_n1::check_subscribed_nssai( ...@@ -4205,12 +4206,12 @@ bool amf_n1::check_subscribed_nssai(
// check with other subscribed NSSAIs // check with other subscribed NSSAIs
for (auto n : nssai.getSingleNssais()) { for (auto n : nssai.getSingleNssais()) {
if (s.sst == n.getSst()) { if (s.sst == n.getSst()) {
if ((s.sst <= SST_MAX_STANDARDIZED_VALUE) or uint32_t sd = SD_NO_VALUE;
(n.sdIsSet() and (n.getSd().compare(sd) == 0)) or conv::sd_string_to_int(n.getSd(), sd);
(!n.sdIsSet() and sd.empty())) { if (sd == s.sd) {
common_snssais.push_back(n); common_snssais.push_back(n);
Logger::amf_n1().debug( Logger::amf_n1().debug(
"Common S-NSSAI (SST %d, SD %s)", s.sst, sd.c_str()); "Common S-NSSAI (SST %d, SD %ld)", s.sst, sd);
break; break;
} }
} }
...@@ -4225,11 +4226,10 @@ bool amf_n1::check_subscribed_nssai( ...@@ -4225,11 +4226,10 @@ bool amf_n1::check_subscribed_nssai(
for (auto n : nssai.getDefaultSingleNssais()) { for (auto n : nssai.getDefaultSingleNssais()) {
bool found_nssai = false; bool found_nssai = false;
for (auto s : p.slice_list) { for (auto s : p.slice_list) {
std::string sd = std::to_string(s.sd);
if (s.sst == n.getSst()) { if (s.sst == n.getSst()) {
if ((s.sst <= SST_MAX_STANDARDIZED_VALUE) or uint32_t sd = SD_NO_VALUE;
(n.sdIsSet() and (n.getSd().compare(sd) == 0)) or conv::sd_string_to_int(n.getSd(), sd);
(!n.sdIsSet() and sd.empty())) { if (sd == s.sd) {
found_nssai = true; found_nssai = true;
Logger::amf_n1().debug( Logger::amf_n1().debug(
"Found S-NSSAI (SST %d, SD %s)", s.sst, n.getSd().c_str()); "Found S-NSSAI (SST %d, SD %s)", s.sst, n.getSd().c_str());
...@@ -4248,11 +4248,10 @@ bool amf_n1::check_subscribed_nssai( ...@@ -4248,11 +4248,10 @@ bool amf_n1::check_subscribed_nssai(
for (auto n : common_snssais) { for (auto n : common_snssais) {
bool found_nssai = false; bool found_nssai = false;
for (auto s : p.slice_list) { for (auto s : p.slice_list) {
std::string sd = std::to_string(s.sd);
if (s.sst == n.getSst()) { if (s.sst == n.getSst()) {
if ((s.sst <= SST_MAX_STANDARDIZED_VALUE) or uint32_t sd = SD_NO_VALUE;
(n.sdIsSet() and (n.getSd().compare(sd) == 0)) or conv::sd_string_to_int(n.getSd(), sd);
(!n.sdIsSet() and sd.empty())) { if (sd == s.sd) {
found_nssai = true; found_nssai = true;
Logger::amf_n1().debug( Logger::amf_n1().debug(
"Found S-NSSAI (SST %d, SD %s)", s.sst, n.getSd().c_str()); "Found S-NSSAI (SST %d, SD %s)", s.sst, n.getSd().c_str());
......
...@@ -893,13 +893,15 @@ bool amf_n11::discover_smf( ...@@ -893,13 +893,15 @@ bool amf_n11::discover_smf(
for (auto& s : instance_json["sNssais"].items()) { for (auto& s : instance_json["sNssais"].items()) {
nlohmann::json Snssai = s.value(); nlohmann::json Snssai = s.value();
int sst = 0; int sst = 0;
std::string sd = {}; uint32_t sd = SD_NO_VALUE; // Default value
if (Snssai.count("sst") > 0) sst = Snssai["sst"].get<int>(); if (Snssai.count("sst") > 0) sst = Snssai["sst"].get<int>();
if (Snssai.count("sd") > 0) sd = Snssai["sd"].get<string>(); if (Snssai.count("sd") > 0) {
conv::sd_string_to_int(Snssai["sd"].get<string>(), sd);
}
if (sst == snssai.sST) { if (sst == snssai.sST) {
// Match SD (optional) only if it is provided uint32_t input_sd = SD_NO_VALUE; // Default value
if ((sst <= SST_MAX_STANDARDIZED_VALUE) or sd.empty() or conv::sd_string_to_int(snssai.sD, input_sd);
(snssai.sD.compare(sd) == 0)) { if (sd == input_sd) {
Logger::amf_n11().debug( Logger::amf_n11().debug(
"S-NSSAI [SST- %d, SD -%s] is matched for SMF profile", "S-NSSAI [SST- %d, SD -%s] is matched for SMF profile",
snssai.sST, snssai.sD.c_str()); snssai.sST, snssai.sD.c_str());
......
...@@ -2326,9 +2326,9 @@ bool amf_n2::get_common_plmn( ...@@ -2326,9 +2326,9 @@ bool amf_n2::get_common_plmn(
"S-NSSAI from AMF (SST %d, SD %s)", s2.sst, "S-NSSAI from AMF (SST %d, SD %s)", s2.sst,
std::to_string(s2.sd).c_str()); std::to_string(s2.sd).c_str());
if (s1.sst.compare(std::to_string(s2.sst)) == 0) { if (s1.sst.compare(std::to_string(s2.sst)) == 0) {
if ((s2.sst <= SST_MAX_STANDARDIZED_VALUE) or uint32_t s1_sd = SD_NO_VALUE;
(s1.sd.compare(std::to_string(s2.sd)) == conv::sd_string_to_int(s1.sd, s1_sd);
0)) { // don't need to check SD for standard NSSAI if (s1_sd == s2.sd) {
Logger::amf_n2().debug( Logger::amf_n2().debug(
"Common S-NSSAI (SST %s, SD %s)", s1.sst.c_str(), "Common S-NSSAI (SST %s, SD %s)", s1.sst.c_str(),
s1.sd.c_str()); s1.sd.c_str());
......
...@@ -26,12 +26,16 @@ ...@@ -26,12 +26,16 @@
*/ */
#include "conversions.hpp" #include "conversions.hpp"
#include "amf.hpp"
#include "logger.hpp"
#include <arpa/inet.h> #include <arpa/inet.h>
#include <ctype.h> #include <ctype.h>
#include <inttypes.h> #include <inttypes.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <boost/algorithm/string.hpp>
static const char hex_to_ascii_table[16] = { static const char hex_to_ascii_table[16] = {
'0', '1', '2', '3', '4', '5', '6', '7', '0', '1', '2', '3', '4', '5', '6', '7',
...@@ -262,3 +266,23 @@ void conv::octet_string_2_bstring( ...@@ -262,3 +266,23 @@ void conv::octet_string_2_bstring(
void conv::bstring_2_octet_string(bstring& b_str, OCTET_STRING_t& octet_str) { void conv::bstring_2_octet_string(bstring& b_str, OCTET_STRING_t& octet_str) {
OCTET_STRING_fromBuf(&octet_str, (char*) bdata(b_str), blength(b_str)); OCTET_STRING_fromBuf(&octet_str, (char*) bdata(b_str), blength(b_str));
} }
//------------------------------------------------------------------------------
void conv::sd_string_to_int(const std::string& sd_str, uint32_t& sd) {
sd = SD_NO_VALUE;
if (sd_str.empty()) return;
uint8_t base = 10;
try {
if (sd_str.size() > 2) {
if (boost::iequals(sd_str.substr(0, 2), "0x")) {
base = 16;
}
}
sd = std::stoul(sd_str, nullptr, base);
} catch (const std::exception& e) {
Logger::amf_app().error(
"Error when converting from string to int for S-NSSAI SD, error: %s",
e.what());
sd = SD_NO_VALUE;
}
}
...@@ -73,5 +73,6 @@ class conv { ...@@ -73,5 +73,6 @@ class conv {
std::string& input_str, std::string& output_str); std::string& input_str, std::string& output_str);
void octet_string_2_bstring(const OCTET_STRING_t& octet_str, bstring& b_str); void octet_string_2_bstring(const OCTET_STRING_t& octet_str, bstring& b_str);
void bstring_2_octet_string(bstring& b_str, OCTET_STRING_t& octet_str); void bstring_2_octet_string(bstring& b_str, OCTET_STRING_t& octet_str);
static void sd_string_to_int(const std::string& sd_str, uint32_t& sd);
}; };
#endif /* FILE_CONVERSIONS_HPP_SEEN */ #endif /* FILE_CONVERSIONS_HPP_SEEN */
...@@ -49,9 +49,9 @@ NSSAI::NSSAI(const uint8_t iei, std::vector<struct SNSSAI_s> nssai) { ...@@ -49,9 +49,9 @@ NSSAI::NSSAI(const uint8_t iei, std::vector<struct SNSSAI_s> nssai) {
S_NSSAI.assign(nssai.begin(), nssai.end()); S_NSSAI.assign(nssai.begin(), nssai.end());
for (int i = 0; i < nssai.size(); i++) { for (int i = 0; i < nssai.size(); i++) {
length += 2; // 1 for IEI and 1 for sst length += 2; // 1 for IEI and 1 for sst
if (nssai[i].sd != SD_NO_VALUE) length += 3; if (nssai[i].sd != SD_NO_VALUE) length += SD_LENGTH;
if (nssai[i].mHplmnSst != -1) length += 1; if (nssai[i].mHplmnSst != -1) length += SST_LENGTH;
if (nssai[i].mHplmnSd != SD_NO_VALUE) length += 3; if (nssai[i].mHplmnSd != SD_NO_VALUE) length += SD_LENGTH;
} }
} }
...@@ -84,12 +84,12 @@ int NSSAI::encode2buffer(uint8_t* buf, int len) { ...@@ -84,12 +84,12 @@ int NSSAI::encode2buffer(uint8_t* buf, int len) {
encoded_size++; encoded_size++;
for (int i = 0; i < S_NSSAI.size(); i++) { for (int i = 0; i < S_NSSAI.size(); i++) {
int len_s_nssai = 1; int len_s_nssai = SST_LENGTH;
encoded_size++; encoded_size++;
*(buf + encoded_size) = S_NSSAI.at(i).sst; *(buf + encoded_size) = S_NSSAI.at(i).sst;
encoded_size++; encoded_size++;
if (S_NSSAI.at(i).sd != SD_NO_VALUE) { if (S_NSSAI.at(i).sd != SD_NO_VALUE) {
len_s_nssai += 3; len_s_nssai += SD_LENGTH;
*(buf + encoded_size) = (S_NSSAI.at(i).sd & 0x00ff0000) >> 16; *(buf + encoded_size) = (S_NSSAI.at(i).sd & 0x00ff0000) >> 16;
encoded_size++; encoded_size++;
Logger::nas_mm().debug( Logger::nas_mm().debug(
...@@ -104,12 +104,12 @@ int NSSAI::encode2buffer(uint8_t* buf, int len) { ...@@ -104,12 +104,12 @@ int NSSAI::encode2buffer(uint8_t* buf, int len) {
"Encoded NSSAI SD third octet (%x)", *(buf + encoded_size - 1)); "Encoded NSSAI SD third octet (%x)", *(buf + encoded_size - 1));
} }
if (S_NSSAI.at(i).mHplmnSst != -1) { if (S_NSSAI.at(i).mHplmnSst != -1) {
len_s_nssai += 1; len_s_nssai += SST_LENGTH;
*(buf + encoded_size) = S_NSSAI.at(i).mHplmnSst; *(buf + encoded_size) = S_NSSAI.at(i).mHplmnSst;
encoded_size++; encoded_size++;
} }
if (S_NSSAI.at(i).mHplmnSd != SD_NO_VALUE) { if (S_NSSAI.at(i).mHplmnSd != SD_NO_VALUE) {
len_s_nssai += 3; len_s_nssai += SD_LENGTH;
*(buf + encoded_size) = (S_NSSAI.at(i).mHplmnSd & 0x00ff0000) >> 16; *(buf + encoded_size) = (S_NSSAI.at(i).mHplmnSd & 0x00ff0000) >> 16;
encoded_size++; encoded_size++;
*(buf + encoded_size) = (S_NSSAI.at(i).mHplmnSd & 0x0000ff00) >> 8; *(buf + encoded_size) = (S_NSSAI.at(i).mHplmnSd & 0x0000ff00) >> 8;
...@@ -138,10 +138,13 @@ int NSSAI::decodefrombuffer(uint8_t* buf, int len, bool is_option) { ...@@ -138,10 +138,13 @@ int NSSAI::decodefrombuffer(uint8_t* buf, int len, bool is_option) {
length = *(buf + decoded_size); length = *(buf + decoded_size);
decoded_size++; decoded_size++;
int length_tmp = length; int length_tmp = length;
a.sd = SD_NO_VALUE; // Default value
a.mHplmnSd = SD_NO_VALUE; // Default value
while (length_tmp) { while (length_tmp) {
switch (*(buf + decoded_size)) { switch (*(buf + decoded_size)) {
case 1: { case 1: {
decoded_size++; // snssai—leagth decoded_size++; // snssai—length
length_tmp--; length_tmp--;
a.sst = *(buf + decoded_size); a.sst = *(buf + decoded_size);
decoded_size++; decoded_size++;
...@@ -227,7 +230,9 @@ int NSSAI::decodefrombuffer(uint8_t* buf, int len, bool is_option) { ...@@ -227,7 +230,9 @@ int NSSAI::decodefrombuffer(uint8_t* buf, int len, bool is_option) {
} }
S_NSSAI.insert(S_NSSAI.end(), a); S_NSSAI.insert(S_NSSAI.end(), a);
a = {0, 0, 0, 0}; a = {0, 0, 0, 0};
a.sd = SD_NO_VALUE; // Default value
a.mHplmnSd = SD_NO_VALUE; // Default value
} }
for (int i = 0; i < S_NSSAI.size(); i++) { for (int i = 0; i < S_NSSAI.size(); i++) {
......
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
#include <vector> #include <vector>
#include "nas_ie_header.hpp" #include "nas_ie_header.hpp"
#define SST_LENGTH 1
#define SD_LENGTH 3
namespace nas { namespace nas {
class NSSAI { class NSSAI {
......
...@@ -127,6 +127,16 @@ bool S_NSSAI::getSd(std::string& s_nssaiSd) const { ...@@ -127,6 +127,16 @@ bool S_NSSAI::getSd(std::string& s_nssaiSd) const {
return sdIsSet; return sdIsSet;
} }
//------------------------------------------------------------------------------
bool S_NSSAI::getSd(uint32_t& s_nssaiSd) const {
if (sdIsSet) {
s_nssaiSd = sd;
} else {
s_nssaiSd = SD_NO_VALUE;
}
return sdIsSet;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
std::string S_NSSAI::getSd() const { std::string S_NSSAI::getSd() const {
if (sdIsSet) { if (sdIsSet) {
......
...@@ -55,6 +55,7 @@ class S_NSSAI { ...@@ -55,6 +55,7 @@ class S_NSSAI {
void setSd(const uint32_t s); void setSd(const uint32_t s);
bool getSd(std::string& s_nssaiSd) const; bool getSd(std::string& s_nssaiSd) const;
std::string getSd() const; std::string getSd() const;
bool getSd(uint32_t& s_nssaiSd) const;
bool encode2S_NSSAI(Ngap_S_NSSAI_t*); bool encode2S_NSSAI(Ngap_S_NSSAI_t*);
bool decodefromS_NSSAI(Ngap_S_NSSAI_t*); bool decodefromS_NSSAI(Ngap_S_NSSAI_t*);
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "InitialContextSetupRequest.hpp" #include "InitialContextSetupRequest.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "amf.hpp" #include "amf.hpp"
#include "conversions.hpp"
extern "C" { extern "C" {
#include "dynamic_memory_check.h" #include "dynamic_memory_check.h"
...@@ -290,9 +291,11 @@ void InitialContextSetupRequestMsg::setAllowedNssai( ...@@ -290,9 +291,11 @@ void InitialContextSetupRequestMsg::setAllowedNssai(
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
S_NSSAI snssai = {}; S_NSSAI snssai = {};
snssai.setSst(list[i].sst); snssai.setSst(list[i].sst);
if (!list[i].sd.empty() && uint32_t sd = SD_NO_VALUE;
((list[i].sd.compare(std::to_string(SD_NO_VALUE)) != 0))) if (!list[i].sd.empty()) {
snssai.setSd(list[i].sd); conv::sd_string_to_int(list[i].sd, sd);
}
snssai.setSd(sd);
snssaiList.push_back(snssai); snssaiList.push_back(snssai);
} }
allowedNssai.setAllowedNSSAI(snssaiList); allowedNssai.setAllowedNSSAI(snssaiList);
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "NGSetupResponse.hpp" #include "NGSetupResponse.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "amf.hpp" #include "amf.hpp"
#include "conversions.hpp"
extern "C" { extern "C" {
#include "dynamic_memory_check.h" #include "dynamic_memory_check.h"
...@@ -138,11 +139,12 @@ void NGSetupResponseMsg::setPlmnSupportList( ...@@ -138,11 +139,12 @@ void NGSetupResponseMsg::setPlmnSupportList(
for (int j = 0; j < list[i].slice_list.size(); j++) { for (int j = 0; j < list[i].slice_list.size(); j++) {
S_NSSAI snssai = {}; S_NSSAI snssai = {};
snssai.setSst(list[i].slice_list[j].sst); snssai.setSst(list[i].slice_list[j].sst);
if (!list[i].slice_list[j].sd.empty() &&
(list[i].slice_list[j].sd.compare(std::to_string(SD_NO_VALUE)) != uint32_t sd = SD_NO_VALUE;
0)) { if (!list[i].slice_list[j].sd.empty()) {
snssai.setSd(list[i].slice_list[j].sd); conv::sd_string_to_int(list[i].slice_list[j].sd, sd);
} }
snssai.setSd(sd);
snssais.push_back(snssai); snssais.push_back(snssai);
} }
plmnSupportItem.setPlmnSliceSupportList(plmn, snssais); plmnSupportItem.setPlmnSliceSupportList(plmn, snssais);
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "RerouteNASRequest.hpp" #include "RerouteNASRequest.hpp"
#include "common_defs.h" #include "common_defs.h"
#include "amf.hpp" #include "amf.hpp"
#include "conversions.hpp"
#include "logger.hpp" #include "logger.hpp"
...@@ -111,9 +112,12 @@ void RerouteNASRequest::setAllowedNssai(const std::vector<S_Nssai>& list) { ...@@ -111,9 +112,12 @@ void RerouteNASRequest::setAllowedNssai(const std::vector<S_Nssai>& list) {
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
S_NSSAI snssai = {}; S_NSSAI snssai = {};
snssai.setSst(list[i].sst); snssai.setSst(list[i].sst);
if (!list[i].sd.empty() &&
((list[i].sd.compare(std::to_string(SD_NO_VALUE)) != 0))) uint32_t sd = SD_NO_VALUE;
snssai.setSd(list[i].sd); if (!list[i].sd.empty()) {
conv::sd_string_to_int(list[i].sd, sd);
}
snssai.setSd(sd);
snssaiList.push_back(snssai); snssaiList.push_back(snssai);
} }
allowedNssai->setAllowedNSSAI(snssaiList); allowedNssai->setAllowedNSSAI(snssaiList);
......
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