Commit 5227afe5 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Add NSSAI to PduSessionResourceSetupRequest

parent b26dc726
......@@ -65,22 +65,16 @@ amf_app::amf_app(const amf_config &amf_cfg) {
Logger::amf_app().error("Cannot create task TASK_AMF_APP");
throw std::runtime_error("Cannot create task TASK_AMF_APP");
}
try {
amf_n2_inst = new amf_n2(std::string(inet_ntoa(amf_cfg.n2.addr4)), amf_cfg.n2.port);
} catch (std::exception &e) {
Logger::amf_app().error("Cannot create N2 interface: %s", e.what());
throw;
}
try {
amf_n1_inst = new amf_n1();
} catch (std::exception &e) {
Logger::amf_app().error("Cannot create N1 interface: %s", e.what());
}
try {
amf_n2_inst = new amf_n2(std::string(inet_ntoa(amf_cfg.n2.addr4)), amf_cfg.n2.port);
amf_n11_inst = new amf_n11();
} catch (std::exception &e) {
Logger::amf_app().error("Cannot create N11 interface: %s", e.what());
Logger::amf_app().error("Cannot create AMF APP: %s", e.what());
throw;
}
timer_id_t tid = itti_inst->timer_setup(amf_cfg.statistics_interval, 0, TASK_AMF_APP, TASK_AMF_APP_PERIODIC_STATISTICS, 0);
Logger::amf_app().startup("Started timer(%d)", tid);
}
......
......@@ -29,6 +29,7 @@
#include "amf_n2.hpp"
#include "amf_n1.hpp"
#include "amf_n11.hpp"
#include "amf_app.hpp"
#include "logger.hpp"
#include "sctp_server.hpp"
......@@ -52,6 +53,7 @@ using namespace config;
extern itti_mw *itti_inst;
extern amf_n2 *amf_n2_inst;
extern amf_n1 *amf_n1_inst;
extern amf_n11 *amf_n11_inst;
extern amf_config amf_cfg;
extern amf_app *amf_app_inst;
extern statistics stacs;
......@@ -546,6 +548,26 @@ void amf_n2::handle_itti_message(itti_pdu_session_resource_setup_request &itti_m
item.sizeofpduSessionNAS_PDU = blength(itti_msg.nas);
item.s_nssai.sst = "01"; //TODO: get from N1N2msgTranferMsg
item.s_nssai.sd = ""; //TODO: get from N1N2msgTranferMsg
//Get NSSAI from PDU Session Context
std::shared_ptr<nas_context> nc;
if (amf_n1_inst->is_amf_ue_id_2_nas_context(itti_msg.amf_ue_ngap_id))
nc = amf_n1_inst->amf_ue_id_2_nas_context(itti_msg.amf_ue_ngap_id);
else {
Logger::amf_n2().warn("No existed nas_context with amf_ue_ngap_id(0x%x)", itti_msg.amf_ue_ngap_id);
//TODO:
}
string supi = "imsi-" + nc.get()->imsi;
Logger::amf_n2().debug("SUPI (%s)", supi.c_str());
std::shared_ptr<pdu_session_context> psc;
if (amf_n11_inst->is_supi_to_pdu_ctx(supi)) {
psc = amf_n11_inst->supi_to_pdu_ctx(supi);
} else {
Logger::amf_n2().warn("Cannot get pdu_session_context with SUPI (%s)", supi.c_str());
}
item.s_nssai.sst = std::to_string(psc.get()->snssai.sST);
item.s_nssai.sd = psc.get()->snssai.sD;
item.pduSessionResourceSetupRequestTransfer.buf = (uint8_t*) bdata(itti_msg.n2sm);
item.pduSessionResourceSetupRequestTransfer.size = blength(itti_msg.n2sm);
list.push_back(item);
......
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