Commit 677695d0 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix issue for SD with Standardized SST

parent 7a1510be
...@@ -983,9 +983,8 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) { ...@@ -983,9 +983,8 @@ void amf_n2::handle_itti_message(itti_initial_context_setup_request& itti_msg) {
supi, itti_msg.pdu_session_id, psc)) { supi, itti_msg.pdu_session_id, psc)) {
Logger::amf_n2().warn( Logger::amf_n2().warn(
"Cannot get pdu_session_context with SUPI (%s)", supi.c_str()); "Cannot get pdu_session_context with SUPI (%s)", supi.c_str());
// TODO: remove hardcoded value item.s_nssai.sst = "01"; // TODO: remove the default value
item.s_nssai.sst = "01"; item.s_nssai.sd = std::to_string(SD_NO_VALUE);
item.s_nssai.sd = "none";
} else { } else {
item.s_nssai.sst = std::to_string(psc.get()->snssai.sST); item.s_nssai.sst = std::to_string(psc.get()->snssai.sST);
item.s_nssai.sd = psc.get()->snssai.sD; item.s_nssai.sd = psc.get()->snssai.sD;
...@@ -1093,8 +1092,9 @@ void amf_n2::handle_itti_message( ...@@ -1093,8 +1092,9 @@ void amf_n2::handle_itti_message(
supi, itti_msg.pdu_session_id, psc)) { supi, itti_msg.pdu_session_id, psc)) {
Logger::amf_n2().warn( Logger::amf_n2().warn(
"Cannot get pdu_session_context with SUPI (%s)", supi.c_str()); "Cannot get pdu_session_context with SUPI (%s)", supi.c_str());
item.s_nssai.sst = "01"; // TODO: get from N1N2msgTranferMsg item.s_nssai.sst = "01"; // TODO: get from N1N2msgTranferMsg
item.s_nssai.sd = "none"; // TODO: get from N1N2msgTranferMsg item.s_nssai.sd =
std::to_string(SD_NO_VALUE); // TODO: get from N1N2msgTranferMsg
} else { } else {
item.s_nssai.sst = std::to_string(psc.get()->snssai.sST); item.s_nssai.sst = std::to_string(psc.get()->snssai.sST);
item.s_nssai.sd = psc.get()->snssai.sD; item.s_nssai.sd = psc.get()->snssai.sD;
...@@ -2325,13 +2325,16 @@ bool amf_n2::get_common_plmn( ...@@ -2325,13 +2325,16 @@ bool amf_n2::get_common_plmn(
Logger::amf_n2().debug( Logger::amf_n2().debug(
"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) and if (s1.sst.compare(std::to_string(s2.sst)) == 0) {
(s1.sd.compare(std::to_string(s2.sd)) == 0)) { if ((s2.sst <= SST_MAX_STANDARDIZED_VALUE) or
Logger::amf_n2().debug( (s1.sd.compare(std::to_string(s2.sd)) ==
"Common S-NSSAI (SST %s, SD %s)", s1.sst.c_str(), 0)) { // don't need to check SD for standard NSSAI
s1.sd.c_str()); Logger::amf_n2().debug(
plmn_slice_support_item.slice_list.push_back(s1); "Common S-NSSAI (SST %s, SD %s)", s1.sst.c_str(),
found_common_plmn = true; s1.sd.c_str());
plmn_slice_support_item.slice_list.push_back(s1);
found_common_plmn = true;
}
} }
} }
} }
......
...@@ -69,6 +69,9 @@ constexpr uint64_t SECONDS_SINCE_FIRST_EPOCH = 2208988800; ...@@ -69,6 +69,9 @@ constexpr uint64_t SECONDS_SINCE_FIRST_EPOCH = 2208988800;
#define NAS_MESSAGE_DOWNLINK 1 #define NAS_MESSAGE_DOWNLINK 1
#define NAS_MESSAGE_UPLINK 0 #define NAS_MESSAGE_UPLINK 0
const uint32_t SD_NO_VALUE = 0xFFFFFF;
const uint8_t SST_MAX_STANDARDIZED_VALUE = 127;
typedef enum { typedef enum {
PlainNasMsg = 0x0, PlainNasMsg = 0x0,
IntegrityProtected = 0x1, IntegrityProtected = 0x1,
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
#include "S-NSSAI.hpp" #include "S-NSSAI.hpp"
#include "amf.hpp"
#include "String2Value.hpp" #include "String2Value.hpp"
using namespace std; using namespace std;
...@@ -38,7 +38,7 @@ namespace ngap { ...@@ -38,7 +38,7 @@ namespace ngap {
S_NSSAI::S_NSSAI() { S_NSSAI::S_NSSAI() {
sdIsSet = false; sdIsSet = false;
sst = 0; sst = 0;
sd = 0; sd = SD_NO_VALUE;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -116,13 +116,14 @@ void S_NSSAI::setSd(const uint32_t s) { ...@@ -116,13 +116,14 @@ void S_NSSAI::setSd(const uint32_t s) {
sdIsSet = true; sdIsSet = true;
sd = s; sd = s;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool S_NSSAI::getSd(std::string& s_nssaiSd) const { bool S_NSSAI::getSd(std::string& s_nssaiSd) const {
if (sdIsSet) { if (sdIsSet) {
s_nssaiSd = to_string(sd); s_nssaiSd = to_string(sd);
} else } else {
s_nssaiSd = "None"; s_nssaiSd = to_string(SD_NO_VALUE);
}
return sdIsSet; return sdIsSet;
} }
...@@ -131,19 +132,19 @@ std::string S_NSSAI::getSd() const { ...@@ -131,19 +132,19 @@ std::string S_NSSAI::getSd() const {
if (sdIsSet) { if (sdIsSet) {
return to_string(sd); return to_string(sd);
} else } else
return "None"; return to_string(SD_NO_VALUE);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool S_NSSAI::encode2S_NSSAI(Ngap_S_NSSAI_t* s_NSSAI) { bool S_NSSAI::encode2S_NSSAI(Ngap_S_NSSAI_t* s_NSSAI) {
if (!sSTEncode2OctetString(s_NSSAI->sST)) return false; if (!sSTEncode2OctetString(s_NSSAI->sST)) return false;
if (sdIsSet) { if (sdIsSet && (sd != SD_NO_VALUE)) {
Ngap_SD_t* sd = (Ngap_SD_t*) calloc(1, sizeof(Ngap_SD_t)); Ngap_SD_t* sd_tmp = (Ngap_SD_t*) calloc(1, sizeof(Ngap_SD_t));
if (!sd) return false; if (!sd_tmp) return false;
if (!sDEncode2OctetString(sd)) { if (!sDEncode2OctetString(sd_tmp)) {
free(sd); free(sd_tmp);
return false; return false;
} }
s_NSSAI->sD = sd; s_NSSAI->sD = sd_tmp;
} }
return true; return true;
} }
...@@ -154,6 +155,8 @@ bool S_NSSAI::decodefromS_NSSAI(Ngap_S_NSSAI_t* s_NSSAI) { ...@@ -154,6 +155,8 @@ bool S_NSSAI::decodefromS_NSSAI(Ngap_S_NSSAI_t* s_NSSAI) {
if (s_NSSAI->sD) { if (s_NSSAI->sD) {
sdIsSet = true; sdIsSet = true;
if (!sDdecodefromOctetString(s_NSSAI->sD)) return false; if (!sDdecodefromOctetString(s_NSSAI->sD)) return false;
} else {
sd = SD_NO_VALUE;
} }
return true; return true;
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "InitialContextSetupRequest.hpp" #include "InitialContextSetupRequest.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "amf.hpp"
extern "C" { extern "C" {
#include "dynamic_memory_check.h" #include "dynamic_memory_check.h"
...@@ -289,8 +290,8 @@ void InitialContextSetupRequestMsg::setAllowedNssai( ...@@ -289,8 +290,8 @@ 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() && ((list[i].sd.compare("None") != 0) && if (!list[i].sd.empty() &&
(list[i].sd.compare("none") != 0))) ((list[i].sd.compare(std::to_string(SD_NO_VALUE)) != 0)))
snssai.setSd(list[i].sd); snssai.setSd(list[i].sd);
snssaiList.push_back(snssai); snssaiList.push_back(snssai);
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "NGSetupResponse.hpp" #include "NGSetupResponse.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "amf.hpp"
extern "C" { extern "C" {
#include "dynamic_memory_check.h" #include "dynamic_memory_check.h"
...@@ -138,8 +139,8 @@ void NGSetupResponseMsg::setPlmnSupportList( ...@@ -138,8 +139,8 @@ void NGSetupResponseMsg::setPlmnSupportList(
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() && if (!list[i].slice_list[j].sd.empty() &&
(list[i].slice_list[j].sd.compare("None") != 0) && (list[i].slice_list[j].sd.compare(std::to_string(SD_NO_VALUE)) !=
(list[i].slice_list[j].sd.compare("none") != 0)) { 0)) {
snssai.setSd(list[i].slice_list[j].sd); snssai.setSd(list[i].slice_list[j].sd);
} }
snssais.push_back(snssai); snssais.push_back(snssai);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "RerouteNASRequest.hpp" #include "RerouteNASRequest.hpp"
#include "common_defs.h" #include "common_defs.h"
#include "amf.hpp"
#include "logger.hpp" #include "logger.hpp"
...@@ -110,8 +111,8 @@ void RerouteNASRequest::setAllowedNssai(const std::vector<S_Nssai>& list) { ...@@ -110,8 +111,8 @@ 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("None") != 0) && if (!list[i].sd.empty() &&
(list[i].sd.compare("none") != 0))) ((list[i].sd.compare(std::to_string(SD_NO_VALUE)) != 0)))
snssai.setSd(list[i].sd); snssai.setSd(list[i].sd);
snssaiList.push_back(snssai); snssaiList.push_back(snssai);
} }
......
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