Commit c5f759d4 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Code cleanup

parent 4eaea279
......@@ -483,10 +483,8 @@ void smf_app::handle_itti_msg(itti_n4_session_deletion_response& smresp) {
std::shared_ptr<smf_context> pc = {};
if (seid_2_smf_context(smresp.seid, pc)) {
pc.get()->handle_itti_msg(smresp);
// if (pc->get_number_dnn_contexts() == 0) {
// delete_smf_context(pc);
// }
// TODO: Delete SM Context if there's no PDU Session associated with this
// context
} else {
Logger::smf_app().debug(
"Received N4 Session Deletion Response seid" TEID_FMT
......@@ -629,15 +627,11 @@ void smf_app::handle_itti_msg(
std::shared_ptr<smf_pdu_session> sp = {};
if (!sc.get()->find_pdu_session(scf.get()->pdu_session_id, sp)) {
Logger::smf_app().warn("PDU session context does not exist!");
}
if (sp.get() != nullptr) {
sp.get()->get_upf_node_id(up_node_id);
} else {
Logger::smf_app().warn("PDU session context does not exist!");
return;
}
sp.get()->get_upf_node_id(up_node_id);
std::shared_ptr<itti_n4_session_failure_indication>
itti_n4_failure_indication =
std::make_shared<itti_n4_session_failure_indication>(
......@@ -960,56 +954,20 @@ void smf_app::handle_pdu_session_create_sm_context_request(
set_supi_2_smf_context(supi64, sc);
}
/*
//TO BE REMOVED
// Step 5. Create/update context with dnn information
std::shared_ptr<dnn_context> sd = {};
if (!sc.get()->find_dnn_context(snssai, dnn, sd)) {
if (nullptr == sd.get()) {
// Create a new one and insert to the list
Logger::smf_app().debug(
"Create a DNN context and add to the SMF context");
sd = std::shared_ptr<dnn_context>(new dnn_context(dnn));
sd.get()->in_use = true;
sd.get()->dnn_in_use = dnn;
sd.get()->nssai = snssai;
sc.get()->insert_dnn(sd);
}
}
*/
// Step 6. If colliding with an existing SM context (session is already
// Step 5. If colliding with an existing SM context (session is already
// existed and request type is INITIAL_REQUEST). Delete the local context
// (including and any associated resources in the UPF and PCF) and create a
// new one
if (is_scid_2_smf_context(supi64, pdu_session_id) &&
(request_type.compare("INITIAL_REQUEST") == 0)) {
// Remove smf_pdu_session (including all flows associated to this session)
// sd.get()->remove_pdu_session(pdu_session_id);
sc.get()->remove_pdu_session(pdu_session_id);
Logger::smf_app().warn(
"PDU Session already existed (SUPI " SUPI_64_FMT ", PDU Session ID %d)",
supi64, pdu_session_id);
}
/*
// Step 5. Create/update PDU Session
std::shared_ptr<smf_pdu_session> sp = {};
if (!sc.get()->find_pdu_session(pdu_session_id, sp)) {
if (nullptr == sp.get()) {
// Create a new one and insert to the list
Logger::smf_app().debug(
"Create a PDU Session and add to the SMF context");
sp = std::shared_ptr<smf_pdu_session>(new
smf_pdu_session(pdu_session_id)); sp.get()->dnn = dnn; sp.get()->snssai =
snssai; sc.get()->add_pdu_session(pdu_session_id, sp);
}
}
*/
// Step 7. Retrieve Session Management Subscription data from UDM if not
// Step 6. Retrieve Session Management Subscription data from UDM if not
// available (step 4, section 4.3.2 3GPP TS 23.502)
std::string dnn_selection_mode = smreq->req.get_dnn_selection_mode();
// If the Session Management Subscription data is not available, get from
......@@ -1066,17 +1024,15 @@ void smf_app::handle_pdu_session_create_sm_context_request(
}
}
// Store PLMN
// Step 7. Store PLMN
sc.get()->set_plmn(smreq->req.get_plmn());
// Step 8. Generate a SMF context Id and store the corresponding information
// in a map (SM_Context_ID, (supi, dnn, nssai, pdu_session_id))
// in a map (SM_Context_ID, (supi, pdu_session_id))
scid_t scid = generate_smf_context_ref();
std::shared_ptr<smf_context_ref> scf =
std::shared_ptr<smf_context_ref>(new smf_context_ref());
scf.get()->supi = supi;
// scf.get()->dnn = dnn; //TO BE REMOVED
// scf.get()->nssai = snssai; //TO BE REMOVED
scf.get()->supi = supi;
scf.get()->pdu_session_id = pdu_session_id;
set_scid_2_smf_context(scid, scf);
smreq->set_scid(scid);
......@@ -1096,7 +1052,7 @@ void smf_app::handle_pdu_session_update_sm_context_request(
"version %d)",
smreq->http_version);
// Step 1. Get SUPI, DNN, NSSAI, PDU Session ID from sm_context
// Step 1. Get SUPI, PDU Session ID from sm_context
// SM Context ID - uint32_t in our case
scid_t scid = {};
try {
......@@ -1152,49 +1108,28 @@ void smf_app::handle_pdu_session_update_sm_context_request(
// Get PDU Session
std::shared_ptr<smf_pdu_session> sp = {};
if (!sc.get()->find_pdu_session(scf.get()->pdu_session_id, sp)) {
if (nullptr == sp.get()) {
Logger::smf_app().warn(
"Received PDU Session Update SM Context Request, couldn't retrieve "
"the corresponding SMF context, ignore message!");
// Trigger to send reply to AMF
trigger_update_context_error_response(
http_status_code_e::HTTP_STATUS_CODE_404_NOT_FOUND,
PDU_SESSION_APPLICATION_ERROR_CONTEXT_NOT_FOUND, smreq->pid);
return;
}
Logger::smf_app().warn(
"Received PDU Session Update SM Context Request, couldn't retrieve "
"the corresponding SMF context, ignore message!");
// Trigger to send reply to AMF
trigger_update_context_error_response(
http_status_code_e::HTTP_STATUS_CODE_404_NOT_FOUND,
PDU_SESSION_APPLICATION_ERROR_CONTEXT_NOT_FOUND, smreq->pid);
return;
}
// Step 2. Store SUPI, DNN, NSSAI in itti_n11_update_sm_context_request to be
// Step 4. Store SUPI, DNN, NSSAI in itti_n11_update_sm_context_request to be
// processed later on
smreq->req.set_supi(scf.get()->supi);
smreq->req.set_pdu_session_id(scf.get()->pdu_session_id);
smreq->req.set_dnn(sp.get()->get_dnn());
smreq->req.set_snssai(sp.get()->get_snssai());
/*
// Step 4. get dnn context
std::shared_ptr<dnn_context> sd = {};
if (!sc.get()->find_dnn_context(scf.get()->nssai, scf.get()->dnn, sd)) {
if (nullptr == sd.get()) {
Logger::smf_app().warn(
"Received PDU Session Update SM Context Request, couldn't retrieve "
"the corresponding SMF context, ignore message!");
// Trigger to send reply to AMF
trigger_update_context_error_response(
http_status_code_e::HTTP_STATUS_CODE_404_NOT_FOUND,
PDU_SESSION_APPLICATION_ERROR_CONTEXT_NOT_FOUND, smreq->pid);
return;
}
}
*/
// Step 5. Verify AMF??
// Step 6. Update targetServingNfId if available (for N2 Handover with AMF
// change)
if (smreq.get()->req.target_serving_nf_id_is_set()) {
// scf.get()->target_amf = smreq.get()->req.get_target_serving_nf_id();
std::string target_amf = smreq.get()->req.get_target_serving_nf_id();
sc.get()->set_target_amf(target_amf);
}
......@@ -1216,7 +1151,7 @@ void smf_app::handle_pdu_session_release_sm_context_request(
Logger::smf_app().info(
"Handle a PDU Session Release SM Context Request from an AMF");
// Step 1. get supi, dnn, nssai, pdu_session id from sm_context
// Step 1. Get SUPI, PDU Session ID from sm_context
// SM Context ID - uint32_t in our case
scid_t scid = {};
try {
......@@ -1271,26 +1206,7 @@ void smf_app::handle_pdu_session_release_sm_context_request(
return;
}
/*
// get dnn context
std::shared_ptr<dnn_context> sd = {};
if (!sc.get()->find_dnn_context(scf.get()->nssai, scf.get()->dnn, sd)) {
if (nullptr == sd.get()) {
// Error, DNN context doesn't exist, send PDUSession_SMUpdateContext
// Response to AMF
Logger::smf_app().warn(
"Received PDU Session Release SM Context Request, couldn't retrieve
" "the corresponding SMF context, ignore message!");
// trigger to send reply to AMF
trigger_http_response(
http_status_code_e::HTTP_STATUS_CODE_404_NOT_FOUND, smreq->pid,
N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE);
return;
}
}
*/
// Find PDU Session Context
std::shared_ptr<smf_pdu_session> sp = {};
if (!sc.get()->find_pdu_session(scf.get()->pdu_session_id, sp)) {
Logger::smf_app().warn(
......@@ -1337,7 +1253,7 @@ void smf_app::trigger_pdu_session_modification(
itti_msg->msg.add_qfi(qfi);
supi64_t supi64 = smf_supi_to_u64(supi);
// Step 2. find the smf context
// Step 2. find the SMF Context
std::shared_ptr<smf_context> sc = {};
if (is_supi_2_smf_context(supi64)) {
......@@ -1603,7 +1519,7 @@ void smf_app::update_pdu_session_status(
const scid_t& scid, const pdu_session_status_e& status) {
Logger::smf_app().info("Update PDU Session Status");
// get the smf context
// get the SMF Context
std::shared_ptr<smf_context_ref> scf = {};
if (is_scid_2_smf_context(scid)) {
......@@ -1630,32 +1546,13 @@ void smf_app::update_pdu_session_status(
supi64);
}
/*
// get dnn context
std::shared_ptr<dnn_context> sd = {};
if (!sc.get()->find_dnn_context(scf.get()->nssai, scf.get()->dnn, sd)) {
if (nullptr == sd.get()) {
Logger::smf_app().warn(
"Could not retrieve the corresponding DNN context!");
}
}
// get smd_pdu_session
// Get PDU Session
std::shared_ptr<smf_pdu_session> sp = {};
bool find_pdn = sd.get()->find_pdu_session(pdu_session_id, sp);
if (nullptr == sp.get()) {
if (!sc.get()->find_pdu_session(pdu_session_id, sp)) {
Logger::smf_app().warn(
"Could not retrieve the corresponding SMF PDU Session context!");
}
*/
std::shared_ptr<smf_pdu_session> sp = {};
if (!sc.get()->find_pdu_session(pdu_session_id, sp)) {
if (sp.get() == nullptr)
// error
Logger::smf_app().warn(
"Could not retrieve the corresponding SMF PDU Session context!");
return;
}
sp.get()->set_pdu_session_status(status);
......@@ -1696,33 +1593,12 @@ void smf_app::update_pdu_session_upCnx_state(
supi64);
}
/*
// get dnn context
std::shared_ptr<dnn_context> sd = {};
if (!sc.get()->find_dnn_context(scf.get()->nssai, scf.get()->dnn, sd)) {
if (nullptr == sd.get()) {
Logger::smf_app().warn(
"Could not retrieve the corresponding DNN context!");
}
}
// get smd_pdu_session
std::shared_ptr<smf_pdu_session> sp = {};
bool find_pdn = sd.get()->find_pdu_session(pdu_session_id, sp);
if (nullptr == sp.get()) {
Logger::smf_app().warn(
"Could not retrieve the corresponding SMF PDU Session context!");
}
*/
// get PDU Session
std::shared_ptr<smf_pdu_session> sp = {};
if (!sc.get()->find_pdu_session(pdu_session_id, sp)) {
if (sp.get() == nullptr)
Logger::smf_app().warn(
"Could not retrieve the corresponding SMF PDU Session context!");
Logger::smf_app().warn(
"Could not retrieve the corresponding SMF PDU Session context!");
return;
}
sp.get()->set_upCnx_state(state);
......
......@@ -200,7 +200,6 @@ class smf_app {
void operator=(smf_app const&) = delete;
void test_dns();
/*
* Set the association between Seid and SM Context
* @param [const seid_t &] seid: SessionID
......
......@@ -87,28 +87,26 @@ void smf_qos_flow::mark_as_released() {
std::string smf_qos_flow::toString() const {
std::string s = {};
s.append("QoS Flow:\n");
s.append("\tQFI:\t\t\t\t")
.append(std::to_string((uint8_t) qfi.qfi))
.append("\n");
s.append("\tUL FTEID:\t\t").append(ul_fteid.toString()).append("\n");
s.append("\tDL FTEID:\t\t").append(dl_fteid.toString()).append("\n");
s.append("\tPDR ID UL:\t\t\t")
s.append("\tQFI:\t\t").append(std::to_string((uint8_t) qfi.qfi)).append("\n");
s.append("\tUL FTEID:\t").append(ul_fteid.toString()).append("\n");
s.append("\tDL FTEID:\t").append(dl_fteid.toString()).append("\n");
s.append("\tPDR ID UL:\t")
.append(std::to_string(pdr_id_ul.rule_id))
.append("\n");
s.append("\tPDR ID DL:\t\t\t")
s.append("\tPDR ID DL:\t")
.append(std::to_string(pdr_id_dl.rule_id))
.append("\n");
s.append("\tPrecedence:\t\t\t")
s.append("\tPrecedence:\t")
.append(std::to_string(precedence.precedence))
.append("\n");
if (far_id_ul.first) {
s.append("\tFAR ID UL:\t\t\t")
s.append("\tFAR ID UL:\t")
.append(std::to_string(far_id_ul.second.far_id))
.append("\n");
}
if (far_id_dl.first) {
s.append("\tFAR ID DL:\t\t\t")
s.append("\tFAR ID DL:\t")
.append(std::to_string(far_id_dl.second.far_id))
.append("\n");
}
......@@ -427,7 +425,7 @@ std::string smf_pdu_session::toString() const {
s.append("\tDefault ");
for (auto it : qos_flows) {
if (it.second.qfi == default_qfi.qfi) {
s.append(it.second.toString());
s.append("\t").append(it.second.toString());
}
}
}
......@@ -783,7 +781,6 @@ void smf_context::handle_itti_msg(
if (req->pfcp_ies.get(data_report)) {
pfcp::pdr_id_t pdr_id;
if (data_report.get(pdr_id)) {
// std::shared_ptr<dnn_context> sd = {};
std::shared_ptr<smf_pdu_session> sp = {};
pfcp::qfi_t qfi = {};
if (find_pdu_session(pdr_id, qfi, sp)) {
......@@ -1305,29 +1302,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
xgpp_conv::create_sm_context_response_from_ctx_request(
smreq, sm_context_resp_pending);
/*
// TO BE REMOVED
// Step 3. Find pdu_session
std::shared_ptr<dnn_context> sd = {};
bool find_dnn = find_dnn_context(snssai, dnn, sd);
// Step 3.1. Create DNN context if not exist
// At this step, this context should be existed
if (nullptr == sd.get()) {
Logger::smf_app().debug(
"DNN context (dnn_in_use %s) is not existed yet!", dnn.c_str());
sd = std::shared_ptr<dnn_context>(new dnn_context());
sd.get()->in_use = true;
sd.get()->dnn_in_use = dnn;
sd.get()->nssai = snssai;
insert_dnn(sd);
} else {
sd.get()->dnn_in_use = dnn;
Logger::smf_app().debug(
"DNN context (dnn_in_use %s) is already existed", dnn.c_str());
}
*/
// Update AMF ID
set_amf_addr(smreq->req.get_serving_nf_id()); // amf id
......@@ -1342,7 +1316,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
smreq->req.get_pdu_session_type();
sp.get()->set_dnn(dnn);
sp.get()->set_snssai(snssai);
// sd->insert_pdu_session(sp); //TO BE REMOVED
add_pdu_session(pdu_session_id, sp);
} else {
Logger::smf_app().warn("PDU session is already existed!");
......@@ -1527,19 +1500,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// Store AMF callback URI and subscribe to the status notification: AMF will
// be notified when SM context changes
/* std::shared_ptr<smf_context_ref> scf = {};
if (smf_app_inst->is_scid_2_smf_context(smreq->scid)) {
scf = smf_app_inst->scid_2_smf_context(smreq->scid);
} else {
Logger::smf_app().warn(
"SM Context associated with this id " SCID_FMT " does not exit!",
smreq->scid);
// TODO: return;
}
scf.get()->amf_status_uri = smreq->req.get_sm_context_status_uri();
*/
std::string amf_status_uri = smreq->req.get_sm_context_status_uri();
set_amf_status_uri(amf_status_uri);
// Get and Store AMF Addr if available
......@@ -1560,7 +1521,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
Logger::smf_api_server().debug("AMF IP Addr %s", amf_addr_str.c_str());
}
}
// scf.get()->amf_addr = amf_addr_str;
set_amf_addr(amf_addr_str);
// Trigger SMF APP to send response to SMF-HTTP-API-SERVER (Step
......@@ -1629,7 +1590,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
case PDU_SESSION_TYPE_E_IPV4:
case PDU_SESSION_TYPE_E_IPV4V6:
// paa_dynamic::get_instance().release_paa(
// sd->dnn_in_use, free_paa.ipv4_address);
// dnn, free_paa.ipv4_address);
// break;
case PDU_SESSION_TYPE_E_IPV6:
paa_dynamic::get_instance().release_paa(dnn, free_paa);
......@@ -2035,13 +1996,7 @@ bool smf_context::handle_pdu_session_release_complete(
// changes notification from UDM by invoking Numd_SDM_Unsubscribe
// TODO: should check if sd context exist
/* std::shared_ptr<dnn_context> sd = {};
find_dnn_context(
sm_context_request.get()->req.get_snssai(),
sm_context_request.get()->req.get_dnn(), sd);
*/
// if (sd.get() != nullptr) {
if (get_number_pdu_sessions() == 0) {
Logger::smf_app().debug(
"Unsubscribe from Session Management Subscription data changes "
......@@ -2049,7 +2004,7 @@ bool smf_context::handle_pdu_session_release_complete(
// TODO: unsubscribes from Session Management Subscription data
// changes notification from UDM
}
//}
// TODO: Invoke Nudm_UECM_Deregistration
return true;
}
......@@ -2357,30 +2312,9 @@ bool smf_context::handle_pdu_session_update_sm_context_request(
session_management_procedures_type_e::
PDU_SESSION_ESTABLISHMENT_UE_REQUESTED);
// Step 1. get DNN, SMF PDU session context. At this stage, dnn_context and
// pdu_session must be existed
// std::shared_ptr<dnn_context> sd = {};
// Step 1. get SMF PDU session context. At this stage, pdu_session must be
// existed
std::shared_ptr<smf_pdu_session> sp = {};
/*
bool find_dnn = find_dnn_context(
sm_context_req_msg.get_snssai(), sm_context_req_msg.get_dnn(), sd);
bool find_pdu = false;
if (find_dnn) {
find_pdu =
sd.get()->find_pdu_session(sm_context_req_msg.get_pdu_session_id(),
sp);
}
if (!find_dnn or !find_pdu) {
// error, send reply to AMF with error code "Context Not Found"
Logger::smf_app().warn("DNN or PDU session context does not exist!");
// trigger to send reply to AMF
smf_app_inst->trigger_update_context_error_response(
http_status_code_e::HTTP_STATUS_CODE_404_NOT_FOUND,
PDU_SESSION_APPLICATION_ERROR_CONTEXT_NOT_FOUND, smreq->pid);
return false;
}
*/
if (!find_pdu_session(sm_context_req_msg.get_pdu_session_id(), sp)) {
// error
Logger::smf_app().warn("PDU session context does not exist!");
......@@ -2919,28 +2853,9 @@ void smf_context::handle_pdu_session_release_sm_context_request(
"Handle a PDU Session Release SM Context Request message from AMF");
bool update_upf = false;
// Step 1. get DNN, SMF PDU session context. At this stage, dnn_context and
// pdu_session must be existed
// std::shared_ptr<dnn_context> sd = {};
// Step 1. get SMF PDU session context. At this stage, pdu_session must be
// existed
std::shared_ptr<smf_pdu_session> sp = {};
/*
bool find_dnn =
find_dnn_context(smreq->req.get_snssai(), smreq->req.get_dnn(), sd);
bool find_pdu = false;
if (find_dnn) {
find_pdu = sd.get()->find_pdu_session(smreq->req.get_pdu_session_id(),
sp);
}
if (!find_dnn or !find_pdu) {
// error, send reply to AMF with error code "Context Not Found"
Logger::smf_app().warn("DNN or PDU session context does not exist!");
// trigger to send reply to AMF
smf_app_inst->trigger_http_response(
http_status_code_e::HTTP_STATUS_CODE_404_NOT_FOUND, smreq->pid,
N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE);
return;
}
*/
if (!find_pdu_session(smreq->req.get_pdu_session_id(), sp)) {
// error
Logger::smf_app().warn("PDU session context does not exist!");
......@@ -3005,42 +2920,15 @@ void smf_context::handle_pdu_session_modification_network_requested(
std::string n2_sm_info = {};
std::string n2_sm_info_hex = {};
// Step 1. get DNN, SMF PDU session context. At this stage, dnn_context and
// pdu_session must be existed
// std::shared_ptr<dnn_context> sd = {};
// Step 1. get SMF PDU session context. At this stage, pdu_session must be
// existed
std::shared_ptr<smf_pdu_session> sp = {};
/*
bool find_dnn =
find_dnn_context(itti_msg->msg.get_snssai(), itti_msg->msg.get_dnn(), sd);
bool find_pdu = false;
if (find_dnn) {
find_pdu =
sd.get()->find_pdu_session(itti_msg->msg.get_pdu_session_id(), sp);
}
if (!find_dnn or !find_pdu) {
Logger::smf_app().warn("DNN or PDU session context does not exist!");
return;
}
*/
if (!find_pdu_session(itti_msg->msg.get_pdu_session_id(), sp)) {
// error
Logger::smf_app().warn("PDU session context does not exist!");
return;
}
/*
std::string dnn = sp.get()->get_dnn();
if ((dnn.compare(smreq->req.get_dnn()) != 0) or (!(sp.get()->get_snssai() ==
smreq->req.get_snssai()))){
// error
Logger::smf_n1().warn("DNN/SNSSAI doesn't matched with this
session!");
// trigger to send reply to AMF
smf_app_inst->trigger_http_response(
http_status_code_e::HTTP_STATUS_CODE_404_NOT_FOUND,
smreq->pid, N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE); return;
}
*/
std::vector<pfcp::qfi_t> list_qfis_to_be_updated;
itti_msg->msg.get_qfis(list_qfis_to_be_updated);
......@@ -3092,9 +2980,6 @@ void smf_context::handle_pdu_session_modification_network_requested(
std::string supi_str =
itti_msg->msg.get_supi_prefix() + "-" + smf_supi_to_string(supi);
std::string url =
// std::string(inet_ntoa(*((struct in_addr*)
// &smf_cfg.amf_addr.ipv4_addr))) +
//":" + std::to_string(smf_cfg.amf_addr.port) + NAMF_COMMUNICATION_BASE +
"http://" + get_amf_addr() + NAMF_COMMUNICATION_BASE +
smf_cfg.amf_addr.api_version +
fmt::format(
......@@ -3618,7 +3503,7 @@ bool smf_context::find_pdu_session(
std::shared_lock lock(m_pdu_sessions_mutex);
if (pdu_sessions.count(psi) > 0) {
sp = pdu_sessions.at(psi);
return true;
if (sp) return true;
}
return false;
}
......@@ -3633,7 +3518,8 @@ bool smf_context::find_pdu_session(
if (it.second->find_qos_flow(pdr_id, flow)) {
qfi.qfi = flow.qfi.qfi;
sp = it.second;
return true;
if (sp) return true;
break;
}
}
return false;
......
......@@ -597,11 +597,11 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
amf_status_uri = {};
target_amf = {};
supi_prefix = {};
// Subscribe to sm context status change
// Subscribe to SM Context Status Change
sm_context_status_connection =
event_sub.subscribe_sm_context_status(boost::bind(
&smf_context::handle_sm_context_status_change, this, _1, _2, _3));
// Subscribe to pdu session release (event exposure)
// Subscribe to PDU Session Release (event exposure)
ee_pdu_session_release_connection =
event_sub.subscribe_ee_pdu_session_release(boost::bind(
&smf_context::handle_ee_pdu_session_release, this, _1, _2, _3));
......@@ -1019,13 +1019,6 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
*/
supi_t get_supi() const;
/*
* Get the number of dnn contexts
* @param
* @return std::size_t: the number of contexts
*/
std::size_t get_number_dnn_contexts() const;
/*
* Get Supi prefix
* @param [const std::string &] prefix: Supi prefix (e.g., imsi)
......@@ -1251,12 +1244,10 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
const pdu_session_id_t& pdu_session_id) const;
private:
// std::vector<std::shared_ptr<dnn_context>> dnns;
std::vector<std::shared_ptr<smf_procedure>> pending_procedures;
// snssai-sst <-> session management subscription
std::map<uint8_t, std::shared_ptr<session_management_subscription>>
dnn_subscriptions;
std::map<pdu_session_id_t, std::shared_ptr<smf_pdu_session>>
pdu_sessions; // Store all PDU Sessions associated with this UE
mutable std::shared_mutex m_pdu_sessions_mutex;
......@@ -1265,9 +1256,6 @@ class smf_context : public std::enable_shared_from_this<smf_context> {
std::string supi_prefix;
plmn_t plmn;
// AMF IP addr
// string amf_addr;
std::string amf_id;
std::string amf_addr;
std::string amf_status_uri;
......
......@@ -415,8 +415,7 @@ bool smf_n1::create_n1_pdu_session_modification_command(
Logger::smf_n1().info("PDU_SESSION_MODIFICATION_COMMAND, encode starting...");
// Get the SMF_PDU_Session
std::shared_ptr<smf_context> sc = {};
// std::shared_ptr<dnn_context> sd = {};
std::shared_ptr<smf_context> sc = {};
std::shared_ptr<smf_pdu_session> sp = {};
supi_t supi = sm_context_res.get_supi();
supi64_t supi64 = smf_supi_to_u64(supi);
......@@ -429,20 +428,6 @@ bool smf_n1::create_n1_pdu_session_modification_command(
"SMF context with SUPI " SUPI_64_FMT " does not exist!", supi64);
return false;
}
/*
bool find_dnn = sc.get()->find_dnn_context(
sm_context_res.get_snssai(), sm_context_res.get_dnn(), sd);
bool find_pdu = false;
if (find_dnn) {
find_pdu =
sd.get()->find_pdu_session(sm_context_res.get_pdu_session_id(), sp);
}
if (!find_dnn or !find_pdu) {
// error
Logger::smf_n1().warn("DNN or PDU session context does not exist!");
return false;
}
*/
if (!sc.get()->find_pdu_session(sm_context_res.get_pdu_session_id(), sp)) {
// error
......@@ -573,8 +558,7 @@ bool smf_n1::create_n1_pdu_session_modification_command(
Logger::smf_n1().info("PDU_SESSION_MODIFICATION_COMMAND, encode starting...");
// Get the SMF_PDU_Session
std::shared_ptr<smf_context> sc = {};
// std::shared_ptr<dnn_context> sd = {};
std::shared_ptr<smf_context> sc = {};
std::shared_ptr<smf_pdu_session> sp = {};
supi_t supi = msg.get_supi();
supi64_t supi64 = smf_supi_to_u64(supi);
......@@ -587,19 +571,6 @@ bool smf_n1::create_n1_pdu_session_modification_command(
"SMF context with SUPI " SUPI_64_FMT " does not exist!", supi64);
return false;
}
/*
bool find_dnn =
sc.get()->find_dnn_context(msg.get_snssai(), msg.get_dnn(), sd);
bool find_pdu = false;
if (find_dnn) {
find_pdu = sd.get()->find_pdu_session(msg.get_pdu_session_id(), sp);
}
if (!find_dnn or !find_pdu) {
// error
Logger::smf_n1().warn("DNN or PDU session context does not exist!");
return false;
}
*/
if (!sc.get()->find_pdu_session(msg.get_pdu_session_id(), sp)) {
// error
......
......@@ -125,7 +125,7 @@ int session_create_sm_context_procedure::run(
PDU_SESSION_APPLICATION_ERROR_CONTEXT_NOT_FOUND);
return RETURNerror;
}
if (sp.get() != nullptr) sp.get()->set_upf_node_id(up_node_id);
sp.get()->set_upf_node_id(up_node_id);
} else {
Logger::smf_app().warn(
......@@ -549,13 +549,9 @@ int session_update_sm_context_procedure::run(
std::shared_ptr<smf_pdu_session> sp = {};
if (!sc.get()->find_pdu_session(scf.get()->pdu_session_id, sp)) {
Logger::smf_app().warn("PDU session context does not exist!");
}
if (sp.get() != nullptr) {
sp.get()->get_upf_node_id(up_node_id);
} else {
Logger::smf_app().warn("PDU session context does not exist!");
return RETURNerror;
}
sp.get()->get_upf_node_id(up_node_id);
// TODO: UPF insertion in case of Handover
......@@ -1421,14 +1417,11 @@ int session_release_sm_context_procedure::run(
std::shared_ptr<smf_pdu_session> sp = {};
if (!sc.get()->find_pdu_session(scf.get()->pdu_session_id, sp)) {
Logger::smf_app().warn("PDU session context does not exist!");
}
if (sp.get() != nullptr) {
sp.get()->get_upf_node_id(up_node_id);
} else {
Logger::smf_app().warn("PDU session context does not exist!");
return RETURNerror;
}
sp.get()->get_upf_node_id(up_node_id);
/* if (not pfcp_associations::get_instance().select_up_node(
up_node_id, NODE_SELECTION_CRITERIA_MIN_PFCP_SESSIONS)) {
sm_context_res->res.set_cause(
......
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