Commit 7475d3aa authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Ignore SD for Standardized SST value

parent 677695d0
......@@ -228,7 +228,11 @@ int amf_config::load(const std::string& config_file) {
slice_item.lookupValue(AMF_CONFIG_STRING_SD, sd);
try {
slice.sst = std::stoi(sst);
slice.sd = std::stoi(sd);
slice.sd = SD_NO_VALUE; // Default value
// 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) {
Logger::amf_app().error("Invalid SST/SD");
}
......
......@@ -261,7 +261,7 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer& itti_msg) {
}
itti_modify_request_msg->s_NSSAI.setSd(psc->snssai.sD);
itti_modify_request_msg->s_NSSAI.setSst(std::to_string(psc->snssai.sST));
itti_modify_request_msg->s_NSSAI.setSst(psc->snssai.sST);
int ret = itti_inst->send_msg(itti_modify_request_msg);
if (0 != ret) {
......@@ -4134,10 +4134,13 @@ bool amf_n1::check_requested_nssai(const std::shared_ptr<nas_context>& nc) {
bool found_nssai = false;
for (auto s : p.slice_list) {
std::string sd = std::to_string(s.sd);
if ((s.sst == n.sst) and (s.sd == n.sd)) {
found_nssai = true;
Logger::amf_n1().debug("Found S-NSSAI (SST %d, SD %d)", s.sst, n.sd);
break;
if (s.sst == n.sst) {
if ((s.sst <= SST_MAX_STANDARDIZED_VALUE) or (s.sd == n.sd)) {
found_nssai = true;
Logger::amf_n1().debug(
"Found S-NSSAI (SST %d, SD %d)", s.sst, n.sd);
break;
}
}
}
if (!found_nssai) {
......@@ -4184,7 +4187,8 @@ bool amf_n1::check_subscribed_nssai(
// Check with default subscribed NSSAIs
for (auto n : nssai.getDefaultSingleNssais()) {
if (s.sst == n.getSst()) {
if ((n.sdIsSet() and (n.getSd().compare(sd) == 0)) or
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(
......@@ -4197,7 +4201,8 @@ bool amf_n1::check_subscribed_nssai(
// check with other subscribed NSSAIs
for (auto n : nssai.getSingleNssais()) {
if (s.sst == n.getSst()) {
if ((n.sdIsSet() and (n.getSd().compare(sd) == 0)) or
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(
......@@ -4218,7 +4223,8 @@ bool amf_n1::check_subscribed_nssai(
for (auto s : p.slice_list) {
std::string sd = std::to_string(s.sd);
if (s.sst == n.getSst()) {
if ((n.sdIsSet() and (n.getSd().compare(sd) == 0)) or
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(
......@@ -4240,7 +4246,8 @@ bool amf_n1::check_subscribed_nssai(
for (auto s : p.slice_list) {
std::string sd = std::to_string(s.sd);
if (s.sst == n.getSst()) {
if ((n.sdIsSet() and (n.getSd().compare(sd) == 0)) or
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(
......
......@@ -47,7 +47,7 @@ NSSAI::NSSAI(const uint8_t iei, std::vector<struct SNSSAI_s> nssai) {
length = 0;
S_NSSAI.assign(nssai.begin(), nssai.end());
for (int i = 0; i < nssai.size(); i++) {
length += 2; // for sst
length += 2; // 1 for IEI and 1 for sst
if (nssai[i].sd != -1) length += 3;
if (nssai[i].mHplmnSst != -1) length += 1;
if (nssai[i].mHplmnSd != -1) length += 3;
......
......@@ -43,13 +43,16 @@ namespace nas {
typedef struct SNSSAI_s {
uint8_t sst;
int32_t sd;
int32_t mHplmnSst;
int8_t mHplmnSst;
int32_t mHplmnSd;
uint8_t length;
SNSSAI_s& operator=(const struct SNSSAI_s& s) {
sst = s.sst;
sd = s.sd;
mHplmnSst = s.mHplmnSst;
mHplmnSd = s.mHplmnSd;
length = s.length;
return *this;
}
} SNSSAI_t;
......
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