Commit 36b45758 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'avoid_raw_pointer' into 'develop'

Avoid raw pointer

See merge request oai/cn5g/oai-cn5g-smf!85
parents 515cdc7e 88664783
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
#include <stdexcept> #include <stdexcept>
#include <vector> #include <vector>
//#define SPDLOG_LEVEL_NAMES { "trace", "debug", "info", "warning", "error",
//"critical", "off" };
#define SPDLOG_LEVEL_NAMES \ #define SPDLOG_LEVEL_NAMES \
{"trace", "debug", "info ", "start", "warn ", "error", "off "}; {"trace", "debug", "info ", "start", "warn ", "error", "off "};
......
...@@ -587,24 +587,24 @@ void smf_app::handle_itti_msg( ...@@ -587,24 +587,24 @@ void smf_app::handle_itti_msg(
return; return;
} }
itti_n4_session_failure_indication* itti_n4 =
new itti_n4_session_failure_indication(TASK_SMF_APP, TASK_SMF_N4);
itti_n4->seid = m.seid;
itti_n4->trxn_id = m.trxn_id;
itti_n4->r_endpoint =
endpoint(up_node_id.u1.ipv4_address, pfcp::default_port);
std::shared_ptr<itti_n4_session_failure_indication> std::shared_ptr<itti_n4_session_failure_indication>
itti_n4_failure_indication = itti_n4_failure_indication =
std::shared_ptr<itti_n4_session_failure_indication>(itti_n4); std::make_shared<itti_n4_session_failure_indication>(
TASK_SMF_APP, TASK_SMF_N4);
itti_n4_failure_indication->seid = m.seid;
itti_n4_failure_indication->trxn_id = m.trxn_id;
itti_n4_failure_indication->r_endpoint =
endpoint(up_node_id.u1.ipv4_address, pfcp::default_port);
Logger::smf_app().info( Logger::smf_app().info(
"Sending ITTI message %s to task TASK_SMF_N4", "Sending ITTI message %s to task TASK_SMF_N4",
itti_n4->get_msg_name()); itti_n4_failure_indication->get_msg_name());
int ret = itti_inst->send_msg(itti_n4_failure_indication); int ret = itti_inst->send_msg(itti_n4_failure_indication);
if (RETURNok != ret) { if (RETURNok != ret) {
Logger::smf_app().error( Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_N4", "Could not send ITTI message %s to task TASK_SMF_N4",
itti_n4->get_msg_name()); itti_n4_failure_indication->get_msg_name());
return; return;
} }
} }
...@@ -864,7 +864,7 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -864,7 +864,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
// authorization by the external DN // authorization by the external DN
// Step 3. check if the DNN requested is valid // Step 3. check if the DNN requested is valid
std::string nd_dnn; std::string nd_dnn = {};
util::dotted_to_string(dnn, nd_dnn); util::dotted_to_string(dnn, nd_dnn);
dnn = nd_dnn; dnn = nd_dnn;
// Update DNN // Update DNN
...@@ -947,10 +947,9 @@ void smf_app::handle_pdu_session_create_sm_context_request( ...@@ -947,10 +947,9 @@ void smf_app::handle_pdu_session_create_sm_context_request(
if (not sc.get()->is_dnn_snssai_subscription_data(dnn, snssai)) { if (not sc.get()->is_dnn_snssai_subscription_data(dnn, snssai)) {
Logger::smf_app().debug( Logger::smf_app().debug(
"The Session Management Subscription data is not available"); "The Session Management Subscription data is not available");
session_management_subscription* s =
new session_management_subscription(snssai);
std::shared_ptr<session_management_subscription> subscription = std::shared_ptr<session_management_subscription> subscription =
std::shared_ptr<session_management_subscription>(s); std::shared_ptr<session_management_subscription>(
new session_management_subscription(snssai));
if (not use_local_configuration_subscription_data(dnn_selection_mode)) { if (not use_local_configuration_subscription_data(dnn_selection_mode)) {
Logger::smf_app().debug( Logger::smf_app().debug(
...@@ -1027,7 +1026,7 @@ void smf_app::handle_pdu_session_update_sm_context_request( ...@@ -1027,7 +1026,7 @@ void smf_app::handle_pdu_session_update_sm_context_request(
"version %d)", "version %d)",
smreq->http_version); smreq->http_version);
// Step 1. Get supi, dnn, nssai, pdu_session id from sm_context // Step 1. Get SUPI, DNN, NSSAI, PDU Session ID from sm_context
// SM Context ID - uint32_t in our case // SM Context ID - uint32_t in our case
scid_t scid = {}; scid_t scid = {};
try { try {
...@@ -1058,7 +1057,7 @@ void smf_app::handle_pdu_session_update_sm_context_request( ...@@ -1058,7 +1057,7 @@ void smf_app::handle_pdu_session_update_sm_context_request(
return; return;
} }
// Step 2. Store supi, dnn, nssai in itti_n11_update_sm_context_request to be // Step 2. Store SUPI, DNN, NSSAI in itti_n11_update_sm_context_request to be
// processed later on // processed later on
supi64_t supi64 = smf_supi_to_u64(scf.get()->supi); supi64_t supi64 = smf_supi_to_u64(scf.get()->supi);
smreq->req.set_supi(scf.get()->supi); smreq->req.set_supi(scf.get()->supi);
...@@ -1110,7 +1109,7 @@ void smf_app::handle_pdu_session_update_sm_context_request( ...@@ -1110,7 +1109,7 @@ void smf_app::handle_pdu_session_update_sm_context_request(
scf.get()->target_amf = smreq.get()->req.get_target_serving_nf_id(); scf.get()->target_amf = smreq.get()->req.get_target_serving_nf_id();
} }
// Step 7. handle the message in smf_context // Step 7. Handle the message in smf_context
if (!sc.get()->handle_pdu_session_update_sm_context_request(smreq)) { if (!sc.get()->handle_pdu_session_update_sm_context_request(smreq)) {
Logger::smf_app().warn( Logger::smf_app().warn(
"Received PDU Session Update SM Context Request, couldn't process!"); "Received PDU Session Update SM Context Request, couldn't process!");
...@@ -1668,7 +1667,7 @@ bool smf_app::get_session_management_subscription_data( ...@@ -1668,7 +1667,7 @@ bool smf_app::get_session_management_subscription_data(
const supi64_t& supi, const std::string& dnn, const snssai_t& snssai, const supi64_t& supi, const std::string& dnn, const snssai_t& snssai,
std::shared_ptr<session_management_subscription> subscription) { std::shared_ptr<session_management_subscription> subscription) {
Logger::smf_app().debug( Logger::smf_app().debug(
"Get Session Management Subscription from configuration file"); "Get Session Management Subscription from the configuration file");
std::shared_ptr<dnn_configuration_t> dnn_configuration = std::shared_ptr<dnn_configuration_t> dnn_configuration =
std::make_shared<dnn_configuration_t>(); std::make_shared<dnn_configuration_t>();
...@@ -1703,7 +1702,7 @@ bool smf_app::get_session_management_subscription_data( ...@@ -1703,7 +1702,7 @@ bool smf_app::get_session_management_subscription_data(
dnn_configuration->pdu_session_types.default_session_type = dnn_configuration->pdu_session_types.default_session_type =
pdu_session_type; pdu_session_type;
// Ssc_Mode // SSC_Mode
dnn_configuration->ssc_modes.default_ssc_mode.ssc_mode = dnn_configuration->ssc_modes.default_ssc_mode.ssc_mode =
smf_cfg.session_management_subscription[i].ssc_mode; smf_cfg.session_management_subscription[i].ssc_mode;
...@@ -1722,7 +1721,7 @@ bool smf_app::get_session_management_subscription_data( ...@@ -1722,7 +1721,7 @@ bool smf_app::get_session_management_subscription_data(
dnn_configuration->_5g_qos_profile.priority_level = dnn_configuration->_5g_qos_profile.priority_level =
smf_cfg.session_management_subscription[i].default_qos.priority_level; smf_cfg.session_management_subscription[i].default_qos.priority_level;
// session_ambr // Session_ambr
dnn_configuration->session_ambr.uplink = dnn_configuration->session_ambr.uplink =
smf_cfg.session_management_subscription[i].session_ambr.uplink; smf_cfg.session_management_subscription[i].session_ambr.uplink;
dnn_configuration->session_ambr.downlink = dnn_configuration->session_ambr.downlink =
......
This diff is collapsed.
...@@ -220,7 +220,6 @@ smf_n4::smf_n4() ...@@ -220,7 +220,6 @@ smf_n4::smf_n4()
std::time_t ellapsed = now_c - time_epoch; std::time_t ellapsed = now_c - time_epoch;
// recovery_time_stamp = ellapsed; // recovery_time_stamp = ellapsed;
// test new way to calculate recovery_time_stamp
std::time_t time_epoch_ntp = std::time(nullptr); std::time_t time_epoch_ntp = std::time(nullptr);
uint64_t tv_ntp = time_epoch_ntp + SECONDS_SINCE_FIRST_EPOCH; uint64_t tv_ntp = time_epoch_ntp + SECONDS_SINCE_FIRST_EPOCH;
recovery_time_stamp = tv_ntp; recovery_time_stamp = tv_ntp;
...@@ -610,19 +609,19 @@ void smf_n4::handle_receive_session_establishment_response( ...@@ -610,19 +609,19 @@ void smf_n4::handle_receive_session_establishment_response(
handle_receive_message_cb(msg, remote_endpoint, TASK_SMF_N4, error, trxn_id); handle_receive_message_cb(msg, remote_endpoint, TASK_SMF_N4, error, trxn_id);
if (!error) { if (!error) {
itti_n4_session_establishment_response* itti_msg = std::shared_ptr<itti_n4_session_establishment_response> itti_msg =
new itti_n4_session_establishment_response(TASK_SMF_N4, TASK_SMF_APP); std::make_shared<itti_n4_session_establishment_response>(
TASK_SMF_N4, TASK_SMF_APP);
itti_msg->pfcp_ies = msg_ies_container; itti_msg->pfcp_ies = msg_ies_container;
itti_msg->r_endpoint = remote_endpoint; itti_msg->r_endpoint = remote_endpoint;
itti_msg->trxn_id = trxn_id; itti_msg->trxn_id = trxn_id;
itti_msg->seid = msg.get_seid(); itti_msg->seid = msg.get_seid();
std::shared_ptr<itti_n4_session_establishment_response> i =
std::shared_ptr<itti_n4_session_establishment_response>(itti_msg); int ret = itti_inst->send_msg(itti_msg);
int ret = itti_inst->send_msg(i);
if (RETURNok != ret) { if (RETURNok != ret) {
Logger::smf_n4().error( Logger::smf_n4().error(
"Could not send ITTI message %s to task TASK_SMF_APP", "Could not send ITTI message %s to task TASK_SMF_APP",
i->get_msg_name()); itti_msg->get_msg_name());
} }
} }
// else ignore // else ignore
...@@ -638,19 +637,20 @@ void smf_n4::handle_receive_session_modification_response( ...@@ -638,19 +637,20 @@ void smf_n4::handle_receive_session_modification_response(
handle_receive_message_cb(msg, remote_endpoint, TASK_SMF_N4, error, trxn_id); handle_receive_message_cb(msg, remote_endpoint, TASK_SMF_N4, error, trxn_id);
if (!error) { if (!error) {
itti_n4_session_modification_response* itti_msg = std::shared_ptr<itti_n4_session_modification_response> itti_msg =
new itti_n4_session_modification_response(TASK_SMF_N4, TASK_SMF_APP); std::make_shared<itti_n4_session_modification_response>(
TASK_SMF_N4, TASK_SMF_APP);
itti_msg->pfcp_ies = msg_ies_container; itti_msg->pfcp_ies = msg_ies_container;
itti_msg->r_endpoint = remote_endpoint; itti_msg->r_endpoint = remote_endpoint;
itti_msg->trxn_id = trxn_id; itti_msg->trxn_id = trxn_id;
itti_msg->seid = msg.get_seid(); itti_msg->seid = msg.get_seid();
std::shared_ptr<itti_n4_session_modification_response> i =
std::shared_ptr<itti_n4_session_modification_response>(itti_msg); int ret = itti_inst->send_msg(itti_msg);
int ret = itti_inst->send_msg(i);
if (RETURNok != ret) { if (RETURNok != ret) {
Logger::smf_n4().error( Logger::smf_n4().error(
"Could not send ITTI message %s to task TASK_SMF_APP", "Could not send ITTI message %s to task TASK_SMF_APP",
i->get_msg_name()); itti_msg->get_msg_name());
} }
} }
// else ignore // else ignore
...@@ -666,19 +666,20 @@ void smf_n4::handle_receive_session_deletion_response( ...@@ -666,19 +666,20 @@ void smf_n4::handle_receive_session_deletion_response(
handle_receive_message_cb(msg, remote_endpoint, TASK_SMF_N4, error, trxn_id); handle_receive_message_cb(msg, remote_endpoint, TASK_SMF_N4, error, trxn_id);
if (!error) { if (!error) {
itti_n4_session_deletion_response* itti_msg = std::shared_ptr<itti_n4_session_deletion_response> itti_msg =
new itti_n4_session_deletion_response(TASK_SMF_N4, TASK_SMF_APP); std::make_shared<itti_n4_session_deletion_response>(
TASK_SMF_N4, TASK_SMF_APP);
itti_msg->pfcp_ies = msg_ies_container; itti_msg->pfcp_ies = msg_ies_container;
itti_msg->r_endpoint = remote_endpoint; itti_msg->r_endpoint = remote_endpoint;
itti_msg->trxn_id = trxn_id; itti_msg->trxn_id = trxn_id;
itti_msg->seid = msg.get_seid(); itti_msg->seid = msg.get_seid();
std::shared_ptr<itti_n4_session_deletion_response> i =
std::shared_ptr<itti_n4_session_deletion_response>(itti_msg); int ret = itti_inst->send_msg(itti_msg);
int ret = itti_inst->send_msg(i);
if (RETURNok != ret) { if (RETURNok != ret) {
Logger::smf_n4().error( Logger::smf_n4().error(
"Could not send ITTI message %s to task TASK_SMF_APP", "Could not send ITTI message %s to task TASK_SMF_APP",
i->get_msg_name()); itti_msg->get_msg_name());
} }
} }
// else ignore // else ignore
...@@ -694,19 +695,18 @@ void smf_n4::handle_receive_session_report_request( ...@@ -694,19 +695,18 @@ void smf_n4::handle_receive_session_report_request(
handle_receive_message_cb(msg, remote_endpoint, TASK_SMF_N4, error, trxn_id); handle_receive_message_cb(msg, remote_endpoint, TASK_SMF_N4, error, trxn_id);
if (!error) { if (!error) {
itti_n4_session_report_request* itti_msg = std::shared_ptr<itti_n4_session_report_request> itti_msg =
new itti_n4_session_report_request(TASK_SMF_N4, TASK_SMF_APP); std::make_shared<itti_n4_session_report_request>(
TASK_SMF_N4, TASK_SMF_APP);
itti_msg->pfcp_ies = msg_ies_container; itti_msg->pfcp_ies = msg_ies_container;
itti_msg->r_endpoint = remote_endpoint; itti_msg->r_endpoint = remote_endpoint;
itti_msg->trxn_id = trxn_id; itti_msg->trxn_id = trxn_id;
itti_msg->seid = msg.get_seid(); itti_msg->seid = msg.get_seid();
std::shared_ptr<itti_n4_session_report_request> i = int ret = itti_inst->send_msg(itti_msg);
std::shared_ptr<itti_n4_session_report_request>(itti_msg);
int ret = itti_inst->send_msg(i);
if (RETURNok != ret) { if (RETURNok != ret) {
Logger::smf_n4().error( Logger::smf_n4().error(
"Could not send ITTI message %s to task TASK_SMF_APP", "Could not send ITTI message %s to task TASK_SMF_APP",
i->get_msg_name()); itti_msg->get_msg_name());
} }
} }
// else ignore // else ignore
......
...@@ -72,8 +72,9 @@ void pfcp_association::restore_n4_sessions() { ...@@ -72,8 +72,9 @@ void pfcp_association::restore_n4_sessions() {
std::unique_lock<std::mutex> l(m_sessions); std::unique_lock<std::mutex> l(m_sessions);
if (sessions.size()) { if (sessions.size()) {
is_restore_sessions_pending = true; is_restore_sessions_pending = true;
n4_session_restore_procedure* restore_proc = std::unique_ptr<n4_session_restore_procedure> restore_proc =
new n4_session_restore_procedure(sessions); std::make_unique<n4_session_restore_procedure>(sessions);
restore_proc->run(); restore_proc->run();
} }
} }
...@@ -125,9 +126,7 @@ bool pfcp_associations::add_association( ...@@ -125,9 +126,7 @@ bool pfcp_associations::add_association(
} }
restore_n4_sessions = false; restore_n4_sessions = false;
pfcp_association* association = sa = std::make_shared<pfcp_association>(node_id, recovery_time_stamp);
new pfcp_association(node_id, recovery_time_stamp);
sa = std::shared_ptr<pfcp_association>(association);
sa->recovery_time_stamp = recovery_time_stamp; sa->recovery_time_stamp = recovery_time_stamp;
std::size_t hash_node_id = std::hash<pfcp::node_id_t>{}(node_id); std::size_t hash_node_id = std::hash<pfcp::node_id_t>{}(node_id);
// Associate with UPF profile if exist // Associate with UPF profile if exist
...@@ -193,10 +192,9 @@ bool pfcp_associations::add_association( ...@@ -193,10 +192,9 @@ bool pfcp_associations::add_association(
} }
restore_n4_sessions = false; restore_n4_sessions = false;
pfcp_association* association = sa = std::make_shared<pfcp_association>(
new pfcp_association(node_id, recovery_time_stamp, function_features); node_id, recovery_time_stamp, function_features);
sa = std::shared_ptr<pfcp_association>(association); sa->recovery_time_stamp = recovery_time_stamp;
sa->recovery_time_stamp = recovery_time_stamp;
sa->function_features.first = true; sa->function_features.first = true;
sa->function_features.second = function_features; sa->function_features.second = function_features;
std::size_t hash_node_id = std::hash<pfcp::node_id_t>{}(node_id); std::size_t hash_node_id = std::hash<pfcp::node_id_t>{}(node_id);
...@@ -235,10 +233,9 @@ bool pfcp_associations::add_association( ...@@ -235,10 +233,9 @@ bool pfcp_associations::add_association(
sa->function_features.second = function_features; sa->function_features.second = function_features;
} else { } else {
restore_n4_sessions = false; restore_n4_sessions = false;
pfcp_association* association = sa = std::make_shared<pfcp_association>(
new pfcp_association(node_id, recovery_time_stamp, function_features); node_id, recovery_time_stamp, function_features);
sa = std::shared_ptr<pfcp_association>(association); sa->recovery_time_stamp = recovery_time_stamp;
sa->recovery_time_stamp = recovery_time_stamp;
sa->function_features.first = true; sa->function_features.first = true;
sa->function_features.second = function_features; sa->function_features.second = function_features;
std::size_t hash_node_id = std::hash<pfcp::node_id_t>{}(node_id); std::size_t hash_node_id = std::hash<pfcp::node_id_t>{}(node_id);
...@@ -485,9 +482,9 @@ bool pfcp_associations::add_peer_candidate_node( ...@@ -485,9 +482,9 @@ bool pfcp_associations::add_peer_candidate_node(
break; break;
} }
} }
pfcp_association* association = new pfcp_association(node_id);
std::shared_ptr<pfcp_association> s = std::shared_ptr<pfcp_association> s =
std::shared_ptr<pfcp_association>(association); std::make_shared<pfcp_association>(node_id);
pending_associations.push_back(s); pending_associations.push_back(s);
return true; return true;
} }
...@@ -505,9 +502,9 @@ bool pfcp_associations::add_peer_candidate_node( ...@@ -505,9 +502,9 @@ bool pfcp_associations::add_peer_candidate_node(
break; break;
} }
} }
pfcp_association* association = new pfcp_association(node_id);
std::shared_ptr<pfcp_association> s = std::shared_ptr<pfcp_association> s =
std::shared_ptr<pfcp_association>(association); std::make_shared<pfcp_association>(node_id);
s->set_upf_node_profile(profile); s->set_upf_node_profile(profile);
pending_associations.push_back(s); pending_associations.push_back(s);
return true; return true;
......
...@@ -106,8 +106,6 @@ int session_create_sm_context_procedure::run( ...@@ -106,8 +106,6 @@ int session_create_sm_context_procedure::run(
snssai_t snssai = sm_context_req->req.get_snssai(); snssai_t snssai = sm_context_req->req.get_snssai();
std::string dnn = sm_context_req->req.get_dnn(); 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( if (not pfcp_associations::get_instance().select_up_node(
up_node_id, snssai, dnn)) { up_node_id, snssai, dnn)) {
sm_context_resp->res.set_cause( sm_context_resp->res.set_cause(
...@@ -132,19 +130,20 @@ int session_create_sm_context_procedure::run( ...@@ -132,19 +130,20 @@ int session_create_sm_context_procedure::run(
n11_triggered_pending = sm_context_resp; n11_triggered_pending = sm_context_resp;
uint64_t seid = smf_app_inst->generate_seid(); uint64_t seid = smf_app_inst->generate_seid();
sps->set_seid(seid); sps->set_seid(seid);
itti_n4_session_establishment_request* n4_ser =
new itti_n4_session_establishment_request(TASK_SMF_APP, TASK_SMF_N4); n4_triggered = std::make_shared<itti_n4_session_establishment_request>(
n4_ser->seid = 0; TASK_SMF_APP, TASK_SMF_N4);
n4_ser->trxn_id = this->trxn_id; n4_triggered->seid = 0;
n4_ser->r_endpoint = endpoint(up_node_id.u1.ipv4_address, pfcp::default_port); n4_triggered->trxn_id = this->trxn_id;
n4_triggered = std::shared_ptr<itti_n4_session_establishment_request>(n4_ser); n4_triggered->r_endpoint =
endpoint(up_node_id.u1.ipv4_address, pfcp::default_port);
//------------------- //-------------------
// IE node_id_t // IE node_id_t
//------------------- //-------------------
pfcp::node_id_t node_id = {}; pfcp::node_id_t node_id = {};
smf_cfg.get_pfcp_node_id(node_id); smf_cfg.get_pfcp_node_id(node_id);
n4_ser->pfcp_ies.set(node_id); n4_triggered->pfcp_ies.set(node_id);
//------------------- //-------------------
// IE fseid_t // IE fseid_t
...@@ -152,7 +151,7 @@ int session_create_sm_context_procedure::run( ...@@ -152,7 +151,7 @@ int session_create_sm_context_procedure::run(
pfcp::fseid_t cp_fseid = {}; pfcp::fseid_t cp_fseid = {};
smf_cfg.get_pfcp_fseid(cp_fseid); smf_cfg.get_pfcp_fseid(cp_fseid);
cp_fseid.seid = sps->seid; cp_fseid.seid = sps->seid;
n4_ser->pfcp_ies.set(cp_fseid); n4_triggered->pfcp_ies.set(cp_fseid);
//******************* //*******************
// UPLINK // UPLINK
...@@ -266,8 +265,8 @@ int session_create_sm_context_procedure::run( ...@@ -266,8 +265,8 @@ int session_create_sm_context_procedure::run(
//------------------- //-------------------
// ADD IEs to message // ADD IEs to message
//------------------- //-------------------
n4_ser->pfcp_ies.set(create_pdr); n4_triggered->pfcp_ies.set(create_pdr);
n4_ser->pfcp_ies.set(create_far); n4_triggered->pfcp_ies.set(create_far);
// TODO: verify whether N4 SessionID should be included in PDR and FAR // TODO: verify whether N4 SessionID should be included in PDR and FAR
// (Section 5.8.2.11@3GPP TS 23.501) // (Section 5.8.2.11@3GPP TS 23.501)
...@@ -301,12 +300,13 @@ int session_create_sm_context_procedure::run( ...@@ -301,12 +300,13 @@ int session_create_sm_context_procedure::run(
smf_app_inst->set_seid_2_smf_context(cp_fseid.seid, sc); smf_app_inst->set_seid_2_smf_context(cp_fseid.seid, sc);
Logger::smf_app().info( Logger::smf_app().info(
"Sending ITTI message %s to task TASK_SMF_N4", n4_ser->get_msg_name()); "Sending ITTI message %s to task TASK_SMF_N4",
n4_triggered->get_msg_name());
int ret = itti_inst->send_msg(n4_triggered); int ret = itti_inst->send_msg(n4_triggered);
if (RETURNok != ret) { if (RETURNok != ret) {
Logger::smf_app().error( Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_N4", "Could not send ITTI message %s to task TASK_SMF_N4",
n4_ser->get_msg_name()); n4_triggered->get_msg_name());
return RETURNerror; return RETURNerror;
} }
...@@ -386,8 +386,10 @@ void session_create_sm_context_procedure::handle_itti_msg( ...@@ -386,8 +386,10 @@ void session_create_sm_context_procedure::handle_itti_msg(
// fill content for N1N2MessageTransfer (including N1, N2 SM) // fill content for N1N2MessageTransfer (including N1, N2 SM)
// Create N1 SM container & N2 SM Information // Create N1 SM container & N2 SM Information
std::string n1_sm_msg, n1_sm_msg_hex; std::string n1_sm_msg = {};
std::string n2_sm_info, n2_sm_info_hex; std::string n1_sm_msg_hex = {};
std::string n2_sm_info = {};
std::string n2_sm_info_hex = {};
if (n11_triggered_pending->res.get_cause() != if (n11_triggered_pending->res.get_cause() !=
static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED)) { static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_255_REQUEST_ACCEPTED)) {
...@@ -436,14 +438,11 @@ void session_create_sm_context_procedure::handle_itti_msg( ...@@ -436,14 +438,11 @@ void session_create_sm_context_procedure::handle_itti_msg(
} }
// Fill N1N2MesasgeTransferRequestData // Fill N1N2MesasgeTransferRequestData
// get supi and put into URL // get SUPI and put into URL
supi_t supi = n11_triggered_pending->res.get_supi(); supi_t supi = n11_triggered_pending->res.get_supi();
std::string supi_str = n11_triggered_pending->res.get_supi_prefix() + "-" + std::string supi_str = n11_triggered_pending->res.get_supi_prefix() + "-" +
smf_supi_to_string(supi); smf_supi_to_string(supi);
std::string url = 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://" + sps.get()->get_amf_addr() + NAMF_COMMUNICATION_BASE + "http://" + sps.get()->get_amf_addr() + NAMF_COMMUNICATION_BASE +
smf_cfg.amf_addr.api_version + smf_cfg.amf_addr.api_version +
fmt::format( fmt::format(
...@@ -477,9 +476,6 @@ void session_create_sm_context_procedure::handle_itti_msg( ...@@ -477,9 +476,6 @@ void session_create_sm_context_procedure::handle_itti_msg(
// N1N2MsgTxfrFailureNotification // N1N2MsgTxfrFailureNotification
std::string callback_uri = std::string callback_uri =
// std::string(
// inet_ntoa(*((struct in_addr*) &smf_cfg.amf_addr.ipv4_addr))) +
//":" + std::to_string(smf_cfg.amf_addr.port) + NSMF_PDU_SESSION_BASE +
sps.get()->get_amf_addr() + NSMF_PDU_SESSION_BASE + sps.get()->get_amf_addr() + NSMF_PDU_SESSION_BASE +
smf_cfg.sbi_api_version + smf_cfg.sbi_api_version +
fmt::format( fmt::format(
...@@ -555,12 +551,13 @@ int session_update_sm_context_procedure::run( ...@@ -555,12 +551,13 @@ int session_update_sm_context_procedure::run(
n11_triggered_pending = sm_context_resp; n11_triggered_pending = sm_context_resp;
uint64_t seid = smf_app_inst->generate_seid(); uint64_t seid = smf_app_inst->generate_seid();
sps->set_seid(seid); sps->set_seid(seid);
itti_n4_session_modification_request* n4_ser =
new itti_n4_session_modification_request(TASK_SMF_APP, TASK_SMF_N4); n4_triggered = std::make_shared<itti_n4_session_modification_request>(
n4_ser->seid = sps->up_fseid.seid; TASK_SMF_APP, TASK_SMF_N4);
n4_ser->trxn_id = this->trxn_id; n4_triggered->seid = sps->up_fseid.seid;
n4_ser->r_endpoint = endpoint(up_node_id.u1.ipv4_address, pfcp::default_port); n4_triggered->trxn_id = this->trxn_id;
n4_triggered = std::shared_ptr<itti_n4_session_modification_request>(n4_ser); n4_triggered->r_endpoint =
endpoint(up_node_id.u1.ipv4_address, pfcp::default_port);
// qos Flow to be modified // qos Flow to be modified
pdu_session_update_sm_context_request sm_context_req_msg = pdu_session_update_sm_context_request sm_context_req_msg =
...@@ -648,7 +645,7 @@ int session_update_sm_context_procedure::run( ...@@ -648,7 +645,7 @@ int session_update_sm_context_procedure::run(
// of a first DL packet // of a first DL packet
update_far.set(apply_action); update_far.set(apply_action);
n4_ser->pfcp_ies.set(update_far); n4_triggered->pfcp_ies.set(update_far);
send_n4 = true; send_n4 = true;
flow.far_id_dl.first = true; flow.far_id_dl.first = true;
...@@ -695,7 +692,7 @@ int session_update_sm_context_procedure::run( ...@@ -695,7 +692,7 @@ int session_update_sm_context_procedure::run(
create_far.set(forwarding_parameters); create_far.set(forwarding_parameters);
// Add IEs to message // Add IEs to message
n4_ser->pfcp_ies.set(create_far); n4_triggered->pfcp_ies.set(create_far);
send_n4 = true; send_n4 = true;
...@@ -764,7 +761,7 @@ int session_update_sm_context_procedure::run( ...@@ -764,7 +761,7 @@ int session_update_sm_context_procedure::run(
create_pdr.set(far_id); create_pdr.set(far_id);
// Add IEs to message // Add IEs to message
n4_ser->pfcp_ies.set(create_pdr); n4_triggered->pfcp_ies.set(create_pdr);
send_n4 = true; send_n4 = true;
...@@ -788,7 +785,7 @@ int session_update_sm_context_procedure::run( ...@@ -788,7 +785,7 @@ int session_update_sm_context_procedure::run(
apply_action.forw = 1; apply_action.forw = 1;
update_far.set(apply_action); update_far.set(apply_action);
n4_ser->pfcp_ies.set(update_far); n4_triggered->pfcp_ies.set(update_far);
send_n4 = true; send_n4 = true;
...@@ -825,7 +822,7 @@ int session_update_sm_context_procedure::run( ...@@ -825,7 +822,7 @@ int session_update_sm_context_procedure::run(
update_pdr.set(flow.far_id_dl.second); update_pdr.set(flow.far_id_dl.second);
// Add IEs to message // Add IEs to message
n4_ser->pfcp_ies.set(update_pdr); n4_triggered->pfcp_ies.set(update_pdr);
send_n4 = true; send_n4 = true;
Logger::smf_app().debug( Logger::smf_app().debug(
...@@ -884,7 +881,7 @@ int session_update_sm_context_procedure::run( ...@@ -884,7 +881,7 @@ int session_update_sm_context_procedure::run(
far.set(far_id); far.set(far_id);
far.set(apply_action); far.set(apply_action);
// Add IEs to message // Add IEs to message
n4_ser->pfcp_ies.set(far); n4_triggered->pfcp_ies.set(far);
send_n4 = true; send_n4 = true;
...@@ -906,7 +903,7 @@ int session_update_sm_context_procedure::run( ...@@ -906,7 +903,7 @@ int session_update_sm_context_procedure::run(
far.set(far_id); far.set(far_id);
far.set(apply_action); far.set(apply_action);
// Add IEs to message // Add IEs to message
n4_ser->pfcp_ies.set(far); n4_triggered->pfcp_ies.set(far);
send_n4 = true; send_n4 = true;
} }
...@@ -925,12 +922,13 @@ int session_update_sm_context_procedure::run( ...@@ -925,12 +922,13 @@ int session_update_sm_context_procedure::run(
if (send_n4) { if (send_n4) {
Logger::smf_app().info( Logger::smf_app().info(
"Sending ITTI message %s to task TASK_SMF_N4", n4_ser->get_msg_name()); "Sending ITTI message %s to task TASK_SMF_N4",
n4_triggered->get_msg_name());
int ret = itti_inst->send_msg(n4_triggered); int ret = itti_inst->send_msg(n4_triggered);
if (RETURNok != ret) { if (RETURNok != ret) {
Logger::smf_app().error( Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_N4", "Could not send ITTI message %s to task TASK_SMF_N4",
n4_ser->get_msg_name()); n4_triggered->get_msg_name());
return RETURNerror; return RETURNerror;
} }
} else { } else {
...@@ -1406,20 +1404,22 @@ int session_release_sm_context_procedure::run( ...@@ -1406,20 +1404,22 @@ int session_release_sm_context_procedure::run(
n11_triggered_pending = sm_context_res; n11_triggered_pending = sm_context_res;
uint64_t seid = smf_app_inst->generate_seid(); uint64_t seid = smf_app_inst->generate_seid();
sps->set_seid(seid); sps->set_seid(seid);
itti_n4_session_deletion_request* n4_ser =
new itti_n4_session_deletion_request(TASK_SMF_APP, TASK_SMF_N4); n4_triggered = std::make_shared<itti_n4_session_deletion_request>(
n4_ser->seid = sps->up_fseid.seid; TASK_SMF_APP, TASK_SMF_N4);
n4_ser->trxn_id = this->trxn_id; n4_triggered->seid = sps->up_fseid.seid;
n4_ser->r_endpoint = endpoint(up_node_id.u1.ipv4_address, pfcp::default_port); n4_triggered->trxn_id = this->trxn_id;
n4_triggered = std::shared_ptr<itti_n4_session_deletion_request>(n4_ser); n4_triggered->r_endpoint =
endpoint(up_node_id.u1.ipv4_address, pfcp::default_port);
Logger::smf_app().info( Logger::smf_app().info(
"Sending ITTI message %s to task TASK_SMF_N4", n4_ser->get_msg_name()); "Sending ITTI message %s to task TASK_SMF_N4",
n4_triggered->get_msg_name());
int ret = itti_inst->send_msg(n4_triggered); int ret = itti_inst->send_msg(n4_triggered);
if (RETURNok != ret) { if (RETURNok != ret) {
Logger::smf_app().error( Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_N4", "Could not send ITTI message %s to task TASK_SMF_N4",
n4_ser->get_msg_name()); n4_triggered->get_msg_name());
return RETURNerror; return RETURNerror;
} }
return RETURNok; return RETURNok;
......
...@@ -260,9 +260,10 @@ void smf_sbi::send_n1n2_message_transfer_request( ...@@ -260,9 +260,10 @@ void smf_sbi::send_n1n2_message_transfer_request(
response_data_json["cause"].dump().c_str()); response_data_json["cause"].dump().c_str());
// Send response to APP to process // Send response to APP to process
itti_n11_n1n2_message_transfer_response_status* itti_msg = std::shared_ptr<itti_n11_n1n2_message_transfer_response_status> itti_msg =
new itti_n11_n1n2_message_transfer_response_status( std::make_shared<itti_n11_n1n2_message_transfer_response_status>(
TASK_SMF_SBI, TASK_SMF_APP); TASK_SMF_SBI, TASK_SMF_APP);
itti_msg->set_response_code(response_code); itti_msg->set_response_code(response_code);
itti_msg->set_scid(sm_context_res->scid); itti_msg->set_scid(sm_context_res->scid);
itti_msg->set_procedure_type(session_management_procedures_type_e:: itti_msg->set_procedure_type(session_management_procedures_type_e::
...@@ -274,13 +275,12 @@ void smf_sbi::send_n1n2_message_transfer_request( ...@@ -274,13 +275,12 @@ void smf_sbi::send_n1n2_message_transfer_request(
} else { } else {
itti_msg->set_msg_type(PDU_SESSION_ESTABLISHMENT_REJECT); itti_msg->set_msg_type(PDU_SESSION_ESTABLISHMENT_REJECT);
} }
std::shared_ptr<itti_n11_n1n2_message_transfer_response_status> i =
std::shared_ptr<itti_n11_n1n2_message_transfer_response_status>(itti_msg); int ret = itti_inst->send_msg(itti_msg);
int ret = itti_inst->send_msg(i);
if (RETURNok != ret) { if (RETURNok != ret) {
Logger::smf_sbi().error( Logger::smf_sbi().error(
"Could not send ITTI message %s to task TASK_SMF_APP", "Could not send ITTI message %s to task TASK_SMF_APP",
i->get_msg_name()); itti_msg->get_msg_name());
} }
return; return;
} }
...@@ -421,9 +421,10 @@ void smf_sbi::send_n1n2_message_transfer_request( ...@@ -421,9 +421,10 @@ void smf_sbi::send_n1n2_message_transfer_request(
response_data_json["cause"].dump().c_str()); response_data_json["cause"].dump().c_str());
// Send response to APP to process // Send response to APP to process
itti_n11_n1n2_message_transfer_response_status* itti_msg = std::shared_ptr<itti_n11_n1n2_message_transfer_response_status> itti_msg =
new itti_n11_n1n2_message_transfer_response_status( std::make_shared<itti_n11_n1n2_message_transfer_response_status>(
TASK_SMF_SBI, TASK_SMF_APP); TASK_SMF_SBI, TASK_SMF_APP);
itti_msg->set_response_code(httpCode); itti_msg->set_response_code(httpCode);
itti_msg->set_procedure_type( itti_msg->set_procedure_type(
session_management_procedures_type_e::SERVICE_REQUEST_NETWORK_TRIGGERED); session_management_procedures_type_e::SERVICE_REQUEST_NETWORK_TRIGGERED);
...@@ -431,13 +432,11 @@ void smf_sbi::send_n1n2_message_transfer_request( ...@@ -431,13 +432,11 @@ void smf_sbi::send_n1n2_message_transfer_request(
itti_msg->set_seid(report_msg->res.get_seid()); itti_msg->set_seid(report_msg->res.get_seid());
itti_msg->set_trxn_id(report_msg->res.get_trxn_id()); itti_msg->set_trxn_id(report_msg->res.get_trxn_id());
std::shared_ptr<itti_n11_n1n2_message_transfer_response_status> i = int ret = itti_inst->send_msg(itti_msg);
std::shared_ptr<itti_n11_n1n2_message_transfer_response_status>(itti_msg);
int ret = itti_inst->send_msg(i);
if (RETURNok != ret) { if (RETURNok != ret) {
Logger::smf_sbi().error( Logger::smf_sbi().error(
"Could not send ITTI message %s to task TASK_SMF_APP", "Could not send ITTI message %s to task TASK_SMF_APP",
i->get_msg_name()); itti_msg->get_msg_name());
} }
} }
......
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