Commit 9aa51384 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Merge branch 'fix_sd_issue' into fix_sd_ue_rel_16

parents d804b703 80e08b65
......@@ -21,6 +21,7 @@
#include "NFStatusNotifyApi.h"
#include "Helpers.h"
#include "logger.hpp"
#include "smf_config.hpp"
extern smf::smf_config smf_cfg;
......@@ -56,6 +57,9 @@ void NFStatusNotifyApi::setupRoutes() {
void NFStatusNotifyApi::notify_nf_status_handler(
const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response) {
Logger::smf_api_server().info("Received a NFStatusNotify message");
Logger::smf_api_server().debug("Message body: %s\n", request.body().c_str());
// Getting the body param
NotificationData notificationData;
......
......@@ -22,14 +22,15 @@
#ifndef FILE_SMF_SEEN
#define FILE_SMF_SEEN
#include "3gpp_29.274.h"
#include "3gpp_29.571.h"
#include "3gpp_24.501.h"
#include <nlohmann/json.hpp>
#include <boost/algorithm/string.hpp>
#include <map>
#include <vector>
#include <nlohmann/json.hpp>
#include <unordered_set>
#include <vector>
#include "3gpp_24.501.h"
#include "3gpp_29.274.h"
#include "3gpp_29.571.h"
typedef uint64_t supi64_t;
#define SUPI_64_FMT "%" SCNu64
......@@ -85,13 +86,21 @@ typedef struct s_nssai // section 28.4, TS23.003
uint32_t sd;
s_nssai(const uint8_t& m_sst, const uint32_t m_sd) : sst(m_sst), sd(m_sd) {}
s_nssai(const uint8_t& m_sst, const std::string m_sd) : sst(m_sst) {
sd = 0xFFFFFF;
sd = SD_NO_VALUE;
if (m_sd.empty()) return;
uint8_t base = 10;
try {
sd = std::stoul(m_sd, nullptr, 10);
if (m_sd.size() > 2) {
if (boost::iequals(m_sd.substr(0, 2), "0x")) {
base = 16;
}
}
sd = std::stoul(m_sd, nullptr, base);
} catch (const std::exception& e) {
Logger::smf_app().warn(
"Error when converting from string to int for snssai.SD, error: %s",
Logger::smf_app().error(
"Error when converting from string to int for S-NSSAI SD, error: %s",
e.what());
sd = SD_NO_VALUE;
}
}
s_nssai() : sst(), sd() {}
......
......@@ -690,6 +690,11 @@ void smf_app::handle_itti_msg(
graph->start_asynch_dfs_procedure(true, empty_flow);
graph->dfs_next_upf(dl_edges, ul_edges, current_upf);
if (!current_upf) {
Logger::smf_app().warn("Could not select UPF in graph!");
return;
}
up_node_id = current_upf->node_id;
std::shared_ptr<itti_n4_session_failure_indication>
......
......@@ -1302,6 +1302,7 @@ std::shared_ptr<upf_graph> upf_graph::select_upf_node(
}
return upf_graph_ptr;
}
return upf_graph_ptr;
}
//------------------------------------------------------------------------------
......
......@@ -27,11 +27,12 @@
\email: Tien-Thinh.Nguyen@eurecom.fr
*/
#include "smf_profile.hpp"
#include "3gpp_conversions.hpp"
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include "logger.hpp"
#include "smf_profile.hpp"
#include "string.hpp"
using namespace std;
......@@ -282,17 +283,11 @@ void nf_profile::from_json(const nlohmann::json& data) {
if (data.find("sNssais") != data.end()) {
for (auto it : data["sNssais"]) {
snssai_t s = {};
s.sst = it["sst"].get<int>();
s.sd = 0xFFFFFF;
try {
s.sd = std::stoul(it["sd"].get<std::string>(), nullptr, 10);
} catch (const std::exception& e) {
Logger::smf_app().warn(
"Error when converting from string to int for snssai.SD, error: %s",
e.what());
s.sd = SD_NO_VALUE;
if (it.find("sst") != it.end()) s.sst = it["sst"].get<int>();
if (it.find("sd") != it.end()) {
xgpp_conv::sd_string_to_int(it["sd"].get<std::string>(), s.sd);
}
// s.sD = it["sd"].get<std::string>();
snssais.push_back(s);
}
}
......@@ -472,20 +467,13 @@ void smf_profile::from_json(const nlohmann::json& data) {
for (auto it : snssai_smf_info_list) {
snssai_smf_info_item_t smf_info_item = {};
smf_info_item.snssai.sd = SD_NO_VALUE;
if (it.find("sNssai") != it.end()) {
if (it["sNssai"].find("sst") != it["sNssai"].end())
smf_info_item.snssai.sst = it["sNssai"]["sst"].get<int>();
if (it["sNssai"].find("sd") != it["sNssai"].end()) {
smf_info_item.snssai.sd = 0xFFFFFF;
try {
smf_info_item.snssai.sd = std::stoul(
it["sNssai"]["sd"].get<std::string>(), nullptr, 10);
} catch (const std::exception& e) {
Logger::smf_app().warn(
"Error when converting from string to int for snssai.SD, "
"error: %s",
e.what());
}
xgpp_conv::sd_string_to_int(
it["sNssai"]["sd"].get<std::string>(), smf_info_item.snssai.sd);
}
}
if (it.find("dnnSmfInfoList") != it.end()) {
......@@ -629,20 +617,13 @@ void upf_profile::from_json(const nlohmann::json& data) {
for (auto it : snssai_upf_info_list) {
snssai_upf_info_item_t upf_info_item = {};
upf_info_item.snssai.sd = SD_NO_VALUE;
if (it.find("sNssai") != it.end()) {
if (it["sNssai"].find("sst") != it["sNssai"].end())
upf_info_item.snssai.sst = it["sNssai"]["sst"].get<int>();
if (it["sNssai"].find("sd") != it["sNssai"].end()) {
upf_info_item.snssai.sd = 0xFFFFFF;
try {
upf_info_item.snssai.sd = std::stoul(
it["sNssai"]["sd"].get<std::string>(), nullptr, 10);
} catch (const std::exception& e) {
Logger::smf_app().warn(
"Error when converting from string to int for snssai.SD, "
"error: %s",
e.what());
}
xgpp_conv::sd_string_to_int(
it["sNssai"]["sd"].get<std::string>(), upf_info_item.snssai.sd);
}
}
if (it.find("dnnUpfInfoList") != it.end()) {
......
......@@ -927,7 +927,7 @@ bool smf_sbi::get_sm_data(
}
if (jsonData["singleNssai"].find("sd") != jsonData["singleNssai"].end()) {
std::string sd_str = jsonData["singleNssai"]["sd"];
uint32_t sd = 0xFFFFFF;
uint32_t sd = SD_NO_VALUE;
xgpp_conv::sd_string_to_int(
jsonData["singleNssai"]["sd"].get<std::string>(), sd);
if (sd != snssai.sd) {
......
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