Commit e3cd0205 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen
Browse files

Select UPF node according to UPF profile

parent 75cf50e2
......@@ -403,7 +403,7 @@ void smf_app::start_upf_association(
std::time_t time_epoch = std::time(nullptr);
uint64_t tv_ntp = time_epoch + SECONDS_SINCE_FIRST_EPOCH;
pfcp_associations::get_instance().add_peer_candidate_node(node_id);
pfcp_associations::get_instance().add_peer_candidate_node(node_id, profile);
std::shared_ptr<itti_n4_association_setup_request> n4_asc =
std::shared_ptr<itti_n4_association_setup_request>(
new itti_n4_association_setup_request(TASK_SMF_APP, TASK_SMF_N4));
......
......@@ -100,7 +100,6 @@ bool pfcp_associations::add_association(
sa = std::shared_ptr<pfcp_association>(association);
sa->recovery_time_stamp = recovery_time_stamp;
std::size_t hash_node_id = std::hash<pfcp::node_id_t>{}(node_id);
// Associate with UPF profile if exist
for (std::vector<std::shared_ptr<pfcp_association>>::iterator it =
pending_associations.begin();
......@@ -111,7 +110,6 @@ bool pfcp_associations::add_association(
break;
}
}
associations.insert((int32_t) hash_node_id, sa);
trigger_heartbeat_request_procedure(sa);
}
......@@ -144,6 +142,16 @@ bool pfcp_associations::add_association(
sa->function_features.first = true;
sa->function_features.second = function_features;
std::size_t hash_node_id = std::hash<pfcp::node_id_t>{}(node_id);
// Associate with UPF profile if exist
for (std::vector<std::shared_ptr<pfcp_association>>::iterator it =
pending_associations.begin();
it < pending_associations.end(); ++it) {
if ((*it)->node_id == node_id) {
Logger::smf_app().info("Associate with UPF profile");
sa->set_upf_node_profile((*it)->get_upf_node_profile());
break;
}
}
associations.insert((int32_t) hash_node_id, sa);
trigger_heartbeat_request_procedure(sa);
}
......
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