Commit 86f119a0 authored by Stefan Spettel's avatar Stefan Spettel

feat(smf): Added UL CL support in Uplink direction

Signed-off-by: default avatarStefan Spettel <stefan.spettel@eurecom.fr>
parent 184e034d
......@@ -1766,8 +1766,8 @@ void smf_context::handle_pdu_session_create_sm_context_request(
std::shared_ptr<smf_procedure> sproc = proc;
insert_procedure(sproc);
if (proc->run(smreq, sm_context_resp_pending, shared_from_this()) !=
smf_procedure_code::OK) {
if (proc->run(smreq, sm_context_resp_pending, shared_from_this()) ==
smf_procedure_code::ERROR) {
// error !
Logger::smf_app().info(
"PDU Session Establishment Request: Create SM Context Request "
......@@ -2992,8 +2992,8 @@ bool smf_context::handle_pdu_session_update_sm_context_request(
proc->session_procedure_type = procedure_type;
insert_procedure(sproc);
if (proc->run(smreq, sm_context_resp_pending, shared_from_this()) !=
smf_procedure_code::OK) {
if (proc->run(smreq, sm_context_resp_pending, shared_from_this()) ==
smf_procedure_code::ERROR) {
// error
Logger::smf_app().info(
"PDU Update SM Context Request procedure failed (session procedure "
......@@ -3125,8 +3125,8 @@ void smf_context::handle_pdu_session_release_sm_context_request(
std::shared_ptr<smf_procedure> sproc = proc;
insert_procedure(sproc);
if (proc->run(smreq, sm_context_resp_pending, shared_from_this()) !=
smf_procedure_code::OK) {
if (proc->run(smreq, sm_context_resp_pending, shared_from_this()) ==
smf_procedure_code::ERROR) {
Logger::smf_app().info("PDU Release SM Context Request procedure failed");
// Trigger to send reply to AMF
smf_app_inst->trigger_http_response(
......
......@@ -1036,8 +1036,6 @@ void upf_graph::dfs_next_upf(
std::shared_ptr<pfcp_association> association = stack_asynch.top();
stack_asynch.pop();
visited_asynch[association] = true;
auto node_it = adjacency_list.find(association);
if (node_it == adjacency_list.end()) {
// TODO this scenario might happen when in the meantime one of the UPFs
......@@ -1048,39 +1046,37 @@ void upf_graph::dfs_next_upf(
"happen");
return;
}
upf = node_it->first;
// here we need to check if we have more than one unvisited N9_UL edge
// if yes, we have a UL CL scenario, and we need to finish the other
// branch first
Logger::smf_app().debug(
"DFS Asynch: Handle UPF %s", upf->get_printable_name().c_str());
int unvisited_n9_ul_nodes = 0;
bool add_neighbors = true;
"DFS Asynch: Handle UPF %s",
node_it->first->get_printable_name().c_str());
bool unvisited_n9_node = false;
// as we have no diamond shape, we only need to care about this in UL
// direction
if (uplink_asynch) {
for (const auto& edge_it : node_it->second) {
if (edge_it.association) {
if (!visited_asynch[edge_it.association]) {
if (edge_it.type == iface_type::N9) {
++unvisited_n9_ul_nodes;
if (unvisited_n9_ul_nodes > 0) {
// we continue here, but we need to set visited false because
// this node is evaluated late;r also we cannot add the
// neighbors of this node (yet)
visited_asynch[association] = false;
add_neighbors = false;
Logger::smf_app().debug(
"UL CL scenario: We have a node with an unvisited N9_UL "
"node.");
}
if (edge_it.type == iface_type::N9 && edge_it.uplink) {
unvisited_n9_node = true;
Logger::smf_app().debug(
"UL CL scenario: We have a node with an unvisited N9_UL "
"node.");
break;
}
}
}
}
}
if (add_neighbors) {
// we removed the current UPF from stack, but did not set visited
// so it is re-visited again from another branch
// we also dont add the neighbors yet
if (!unvisited_n9_node) {
visited_asynch[association] = true;
for (const auto& edge_it : node_it->second) {
// first add all neighbors to the stack
if (edge_it.association) {
......@@ -1090,23 +1086,23 @@ void upf_graph::dfs_next_upf(
}
}
}
upf = node_it->first;
// set correct edge infos
for (auto edge_it = node_it->second.begin();
edge_it != node_it->second.end(); ++edge_it) {
for (auto& edge_it : node_it->second) {
// copy QOS Flow for the whole graph
// TODO currently only one flow is supported
if (edge_it->qos_flows.empty()) {
if (edge_it.qos_flows.empty()) {
std::shared_ptr<smf_qos_flow> flow =
std::make_shared<smf_qos_flow>(qos_flow_asynch);
edge_it->qos_flows.emplace_back(flow);
edge_it.qos_flows.emplace_back(flow);
}
// set the correct edges to return
if (edge_it->uplink) {
info_ul.push_back(*edge_it);
if (edge_it.uplink) {
info_ul.push_back(edge_it);
} else {
info_dl.push_back(*edge_it);
info_dl.push_back(edge_it);
}
current_upf_asynch = upf;
current_edges_dl_asynch = info_dl;
......
This diff is collapsed.
......@@ -104,6 +104,29 @@ class smf_session_procedure : public smf_procedure {
void synch_ul_dl_edges(
const vector<edge>& dl_edges, const vector<edge>& ul_edges,
const pfcp::qfi_t& qfi);
/**
* Helper function to get current UPF from graph in a safe way
* @param dl_edges
* @param ul_edges
* @param current_upf
* @return ERROR in case not successful
*/
smf_procedure_code get_current_upf(
std::vector<edge>& dl_edges, std::vector<edge>& ul_edges,
std::shared_ptr<pfcp_association>& current_upf);
/**
* Helper function to get next UPF from graph in a safe way
* @param dl_edges
* @param ul_edges
* @param current_upf
* @return ERROR in case not successful, OK when UPF graph is empty and
* CONTINUE if UPF is not null
*/
smf_procedure_code get_next_upf(
std::vector<edge>& dl_edges, std::vector<edge>& ul_edges,
std::shared_ptr<pfcp_association>& next_upf);
};
//------------------------------------------------------------------------------
......@@ -155,10 +178,19 @@ class session_create_sm_context_procedure : public smf_session_procedure {
itti_n4_session_establishment_response& resp,
std::shared_ptr<smf::smf_context> sc) override;
/**
* Sends a session establishment request, based on current UPF graph
* @return
*/
smf_procedure_code send_n4_session_establishment_request();
std::shared_ptr<itti_n4_session_establishment_request> n4_triggered;
std::shared_ptr<itti_n11_create_sm_context_request> n11_trigger;
std::shared_ptr<itti_n11_create_sm_context_response> n11_triggered_pending;
private:
smf_qos_flow current_flow;
};
//------------------------------------------------------------------------------
......
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