Commit 7e539e72 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Update UPF selection procedure

parent d978e85e
......@@ -543,6 +543,7 @@ void smf_app::handle_itti_msg(
Logger::smf_app().debug("Send failure indication to UPF");
// TODO: to be completed
pfcp::node_id_t up_node_id = {};
// TODO: Update select_up_node function
if (not pfcp_associations::get_instance().select_up_node(
up_node_id, NODE_SELECTION_CRITERIA_MIN_PFCP_SESSIONS)) {
Logger::smf_app().info("REMOTE_PEER_NOT_RESPONDING");
......
......@@ -89,6 +89,7 @@ class smf_context_ref {
pdu_session_id = 0;
amf_status_uri = "";
amf_addr = "";
upf_node_id = {};
}
supi_t supi;
......@@ -97,6 +98,7 @@ class smf_context_ref {
snssai_t nssai;
std::string amf_status_uri;
std::string amf_addr;
pfcp::node_id_t upf_node_id;
};
class smf_app {
......
......@@ -735,12 +735,26 @@ void smf_context::handle_itti_msg(
if (find_pdu_session(pdr_id, qfi, sd, sp)) {
// Step 1. send N4 Data Report Ack to UPF
pfcp::node_id_t up_node_id = {};
if (not pfcp_associations::get_instance().select_up_node(
up_node_id, NODE_SELECTION_CRITERIA_MIN_PFCP_SESSIONS)) {
Logger::smf_app().info("REMOTE_PEER_NOT_RESPONDING");
scid_t scid = get_scid();
// Get UPF node
std::shared_ptr<smf_context_ref> scf = {};
if (smf_app_inst->is_scid_2_smf_context(scid)) {
scf = smf_app_inst->scid_2_smf_context(scid);
up_node_id = scf.get()->upf_node_id;
} else {
Logger::smf_app().warn(
"SM Context associated with this id " SCID_FMT
" does not exit!",
scid);
return;
}
/*
if (not pfcp_associations::get_instance().select_up_node(
up_node_id, NODE_SELECTION_CRITERIA_MIN_PFCP_SESSIONS)) {
Logger::smf_app().info("REMOTE_PEER_NOT_RESPONDING");
return;
}
*/
itti_n4_session_report_response* n4_ser =
new itti_n4_session_report_response(TASK_SMF_APP, TASK_SMF_N4);
n4_ser->seid = req->seid;
......
......@@ -104,11 +104,28 @@ int session_create_sm_context_procedure::run(
Logger::smf_app().info("Perform a procedure - Create SM Context Request");
// TODO check if compatible with ongoing procedures if any
pfcp::node_id_t up_node_id = {};
snssai_t snssai = sm_context_req->req.get_snssai();
std::string dnn = sm_context_req->req.get_dnn();
// if (not pfcp_associations::get_instance().select_up_node(
// up_node_id, NODE_SELECTION_CRITERIA_MIN_PFCP_SESSIONS)) {
if (not pfcp_associations::get_instance().select_up_node(
up_node_id, NODE_SELECTION_CRITERIA_MIN_PFCP_SESSIONS)) {
up_node_id, snssai, dnn)) {
sm_context_resp->res.set_cause(
PDU_SESSION_APPLICATION_ERROR_PEER_NOT_RESPONDING);
return RETURNerror;
} else {
// Store UPF node
std::shared_ptr<smf_context_ref> scf = {};
if (smf_app_inst->is_scid_2_smf_context(sm_context_req->scid)) {
scf = smf_app_inst->scid_2_smf_context(sm_context_req->scid);
scf.get()->upf_node_id = up_node_id;
} else {
Logger::smf_app().warn(
"SM Context associated with this id " SCID_FMT " does not exit!",
sm_context_req->scid);
// TODO:
}
}
//-------------------
......@@ -498,14 +515,34 @@ int session_update_sm_context_procedure::run(
Logger::smf_app().info("Perform a procedure - Update SM Context Request");
// TODO check if compatible with ongoing procedures if any
pfcp::node_id_t up_node_id = {};
if (not pfcp_associations::get_instance().select_up_node(
up_node_id, NODE_SELECTION_CRITERIA_MIN_PFCP_SESSIONS)) {
sm_context_resp->res.set_cause(
PDU_SESSION_APPLICATION_ERROR_PEER_NOT_RESPONDING);
Logger::smf_app().info("[SMF Procedure] REMOTE_PEER_NOT_RESPONDING");
return RETURNerror;
// Get UPF node
std::shared_ptr<smf_context_ref> scf = {};
scid_t scid = {};
try {
scid = std::stoi(sm_context_req->scid);
} catch (const std::exception& err) {
Logger::smf_app().warn(
"SM Context associated with this id %s does not exit!",
sm_context_req->scid);
}
if (smf_app_inst->is_scid_2_smf_context(scid)) {
scf = smf_app_inst->scid_2_smf_context(scid);
up_node_id = scf.get()->upf_node_id;
} else {
Logger::smf_app().warn(
"SM Context associated with this id " SCID_FMT " does not exit!", scid);
// TODO:
}
/* if (not pfcp_associations::get_instance().select_up_node(
up_node_id, NODE_SELECTION_CRITERIA_MIN_PFCP_SESSIONS)) {
sm_context_resp->res.set_cause(
PDU_SESSION_APPLICATION_ERROR_PEER_NOT_RESPONDING);
Logger::smf_app().info("[SMF Procedure] REMOTE_PEER_NOT_RESPONDING");
return RETURNerror;
}
*/
//-------------------
n11_trigger = sm_context_req;
n11_triggered_pending = sm_context_resp;
......@@ -1269,14 +1306,33 @@ int session_release_sm_context_procedure::run(
Logger::smf_app().info("Release SM Context Request");
// TODO check if compatible with ongoing procedures if any
pfcp::node_id_t 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(
PDU_SESSION_APPLICATION_ERROR_PEER_NOT_RESPONDING);
Logger::smf_app().info("REMOTE_PEER_NOT_RESPONDING");
return RETURNerror;
// Get UPF node
std::shared_ptr<smf_context_ref> scf = {};
scid_t scid = {};
try {
scid = std::stoi(sm_context_req->scid);
} catch (const std::exception& err) {
Logger::smf_app().warn(
"SM Context associated with this id %s does not exit!",
sm_context_req->scid);
}
if (smf_app_inst->is_scid_2_smf_context(scid)) {
scf = smf_app_inst->scid_2_smf_context(scid);
up_node_id = scf.get()->upf_node_id;
} else {
Logger::smf_app().warn(
"SM Context associated with this id " SCID_FMT " does not exit!", scid);
// TODO:
}
/* if (not pfcp_associations::get_instance().select_up_node(
up_node_id, NODE_SELECTION_CRITERIA_MIN_PFCP_SESSIONS)) {
sm_context_res->res.set_cause(
PDU_SESSION_APPLICATION_ERROR_PEER_NOT_RESPONDING);
Logger::smf_app().info("REMOTE_PEER_NOT_RESPONDING");
return RETURNerror;
}
*/
//-------------------
n11_trigger = sm_context_req;
n11_triggered_pending = sm_context_res;
......
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