Commit de2e7a17 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Fix issue for getting SD value from UPF profile

parent 2db8bca2
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "NFStatusNotifyApi.h" #include "NFStatusNotifyApi.h"
#include "Helpers.h" #include "Helpers.h"
#include "logger.hpp"
#include "smf_config.hpp" #include "smf_config.hpp"
extern smf::smf_config smf_cfg; extern smf::smf_config smf_cfg;
...@@ -56,6 +57,9 @@ void NFStatusNotifyApi::setupRoutes() { ...@@ -56,6 +57,9 @@ void NFStatusNotifyApi::setupRoutes() {
void NFStatusNotifyApi::notify_nf_status_handler( void NFStatusNotifyApi::notify_nf_status_handler(
const Pistache::Rest::Request& request, const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response) { 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 // Getting the body param
NotificationData notificationData; NotificationData notificationData;
......
...@@ -27,11 +27,12 @@ ...@@ -27,11 +27,12 @@
\email: Tien-Thinh.Nguyen@eurecom.fr \email: Tien-Thinh.Nguyen@eurecom.fr
*/ */
#include "smf_profile.hpp"
#include "3gpp_conversions.hpp"
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/split.hpp>
#include "logger.hpp" #include "logger.hpp"
#include "smf_profile.hpp"
#include "string.hpp" #include "string.hpp"
using namespace std; using namespace std;
...@@ -282,17 +283,11 @@ void nf_profile::from_json(const nlohmann::json& data) { ...@@ -282,17 +283,11 @@ void nf_profile::from_json(const nlohmann::json& data) {
if (data.find("sNssais") != data.end()) { if (data.find("sNssais") != data.end()) {
for (auto it : data["sNssais"]) { for (auto it : data["sNssais"]) {
snssai_t s = {}; snssai_t s = {};
s.sst = it["sst"].get<int>(); s.sd = SD_NO_VALUE;
s.sd = 0xFFFFFF; if (it.find("sst") != it.end()) s.sst = it["sst"].get<int>();
try { if (it.find("sd") != it.end()) {
s.sd = std::stoul(it["sd"].get<std::string>(), nullptr, 10); xgpp_conv::sd_string_to_int(it["sd"].get<std::string>(), s.sd);
} 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 = it["sd"].get<std::string>();
snssais.push_back(s); snssais.push_back(s);
} }
} }
...@@ -472,20 +467,13 @@ void smf_profile::from_json(const nlohmann::json& data) { ...@@ -472,20 +467,13 @@ void smf_profile::from_json(const nlohmann::json& data) {
for (auto it : snssai_smf_info_list) { for (auto it : snssai_smf_info_list) {
snssai_smf_info_item_t smf_info_item = {}; snssai_smf_info_item_t smf_info_item = {};
smf_info_item.snssai.sd = SD_NO_VALUE;
if (it.find("sNssai") != it.end()) { if (it.find("sNssai") != it.end()) {
if (it["sNssai"].find("sst") != it["sNssai"].end()) if (it["sNssai"].find("sst") != it["sNssai"].end())
smf_info_item.snssai.sst = it["sNssai"]["sst"].get<int>(); smf_info_item.snssai.sst = it["sNssai"]["sst"].get<int>();
if (it["sNssai"].find("sd") != it["sNssai"].end()) { if (it["sNssai"].find("sd") != it["sNssai"].end()) {
smf_info_item.snssai.sd = 0xFFFFFF; xgpp_conv::sd_string_to_int(
try { it["sNssai"]["sd"].get<std::string>(), smf_info_item.snssai.sd);
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());
}
} }
} }
if (it.find("dnnSmfInfoList") != it.end()) { if (it.find("dnnSmfInfoList") != it.end()) {
...@@ -629,20 +617,13 @@ void upf_profile::from_json(const nlohmann::json& data) { ...@@ -629,20 +617,13 @@ void upf_profile::from_json(const nlohmann::json& data) {
for (auto it : snssai_upf_info_list) { for (auto it : snssai_upf_info_list) {
snssai_upf_info_item_t upf_info_item = {}; snssai_upf_info_item_t upf_info_item = {};
upf_info_item.snssai.sd = SD_NO_VALUE;
if (it.find("sNssai") != it.end()) { if (it.find("sNssai") != it.end()) {
if (it["sNssai"].find("sst") != it["sNssai"].end()) if (it["sNssai"].find("sst") != it["sNssai"].end())
upf_info_item.snssai.sst = it["sNssai"]["sst"].get<int>(); upf_info_item.snssai.sst = it["sNssai"]["sst"].get<int>();
if (it["sNssai"].find("sd") != it["sNssai"].end()) { if (it["sNssai"].find("sd") != it["sNssai"].end()) {
upf_info_item.snssai.sd = 0xFFFFFF; xgpp_conv::sd_string_to_int(
try { it["sNssai"]["sd"].get<std::string>(), upf_info_item.snssai.sd);
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());
}
} }
} }
if (it.find("dnnUpfInfoList") != it.end()) { if (it.find("dnnUpfInfoList") != it.end()) {
......
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