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

Add network-initiated service request procedure/ code cleanup

parent e20bc2a9
......@@ -300,7 +300,8 @@ class itti_n11_n1n2_message_transfer_response_status : public itti_n11_msg {
dest),
scid(0),
response_code(0),
msg_type(0) {
msg_type(0),
procedure_type(session_management_procedures_type_e::PROCEDURE_TYPE_UNKNOWN) {
}
itti_n11_n1n2_message_transfer_response_status(
const itti_n11_n1n2_message_transfer_response_status &i)
......@@ -308,7 +309,8 @@ class itti_n11_n1n2_message_transfer_response_status : public itti_n11_msg {
itti_n11_msg(i),
scid(i.scid),
response_code(i.response_code),
msg_type(i.msg_type) {
msg_type(i.msg_type),
procedure_type(i.procedure_type) {
}
itti_n11_n1n2_message_transfer_response_status(
const itti_n11_n1n2_message_transfer_response_status &i,
......@@ -317,7 +319,8 @@ class itti_n11_n1n2_message_transfer_response_status : public itti_n11_msg {
itti_n11_msg(i, orig, dest),
scid(i.scid),
response_code(i.response_code),
msg_type(i.msg_type) {
msg_type(i.msg_type),
procedure_type(i.procedure_type) {
}
const char* get_msg_name() {
return "N11_SESSION_N1N2_MESSAGE_TRANSFER_RESPONSE_STATUS";
......@@ -339,10 +342,15 @@ class itti_n11_n1n2_message_transfer_response_status : public itti_n11_msg {
msg_type = type;
}
;
void set_procedure_type(session_management_procedures_type_e type) {
procedure_type = type;
}
;
scid_t scid; //SM Context ID
int16_t response_code;
std::string cause;
uint8_t msg_type;
session_management_procedures_type_e procedure_type;
};
......@@ -396,8 +404,8 @@ class itti_n11_release_sm_context_request : public itti_n11_msg {
class itti_n11_release_sm_context_response : public itti_n11_msg {
public:
itti_n11_release_sm_context_response(const task_id_t orig,
const task_id_t dest,
Pistache::Http::ResponseWriter &response)
const task_id_t dest,
Pistache::Http::ResponseWriter &response)
:
itti_n11_msg(N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE, orig, dest),
http_response(response.clone()),
......@@ -427,5 +435,30 @@ class itti_n11_release_sm_context_response : public itti_n11_msg {
};
//-----------------------------------------------------------------------------
class itti_n11_session_report_request : public itti_n11_msg {
public:
itti_n11_session_report_request(const task_id_t orig, const task_id_t dest)
:
itti_n11_msg(N11_SESSION_REPORT_RESPONSE, orig, dest),
res() {
}
itti_n11_session_report_request(const itti_n11_session_report_request &i)
:
itti_n11_msg(i) {
}
itti_n11_session_report_request(const itti_n11_session_report_request &i,
const task_id_t orig, const task_id_t dest)
:
itti_n11_msg(i, orig, dest),
res(i.res) {
}
const char* get_msg_name() {
return "N11_SESSION_REPORT_RESPONSE";
}
;
smf::pdu_session_report_response res;
};
#endif /* ITTI_MSG_N11_HPP_INCLUDED_ */
......@@ -109,22 +109,23 @@ enum class http_response_codes_e {
//From 23.502
enum class session_management_procedures_type_e {
PDU_SESSION_ESTABLISHMENT_UE_REQUESTED = 0,
SERVICE_REQUEST_UE_TRIGGERED_STEP1 = 1,
SERVICE_REQUEST_UE_TRIGGERED_STEP2 = 2,
SERVICE_REQUEST_NETWORK_TRIGGERED = 3,
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP1 = 4,
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP2 = 5,
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP3 = 6,
PDU_SESSION_MODIFICATION_SMF_REQUESTED = 7,
PDU_SESSION_MODIFICATION_AN_REQUESTED = 8,
PDU_SESSION_RELEASE_UE_REQUESTED_STEP1 = 9,
PDU_SESSION_RELEASE_UE_REQUESTED_STEP2 = 10,
PDU_SESSION_RELEASE_UE_REQUESTED_STEP3 = 11,
PDU_SESSION_RELEASE_SMF_INITIATED = 12,
PDU_SESSION_RELEASE_AMF_INITIATED = 13,
PDU_SESSION_RELEASE_AN_INITIATED = 14,
PDU_SESSION_TEST = 15
PROCEDURE_TYPE_UNKNOWN = 0,
PDU_SESSION_ESTABLISHMENT_UE_REQUESTED = 1,
SERVICE_REQUEST_UE_TRIGGERED_STEP1 = 2,
SERVICE_REQUEST_UE_TRIGGERED_STEP2 = 3,
SERVICE_REQUEST_NETWORK_TRIGGERED = 4,
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP1 = 5,
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP2 = 6,
PDU_SESSION_MODIFICATION_UE_INITIATED_STEP3 = 7,
PDU_SESSION_MODIFICATION_SMF_REQUESTED = 8,
PDU_SESSION_MODIFICATION_AN_REQUESTED = 9,
PDU_SESSION_RELEASE_UE_REQUESTED_STEP1 = 10,
PDU_SESSION_RELEASE_UE_REQUESTED_STEP2 = 11,
PDU_SESSION_RELEASE_UE_REQUESTED_STEP3 = 12,
PDU_SESSION_RELEASE_SMF_INITIATED = 13,
PDU_SESSION_RELEASE_AMF_INITIATED = 14,
PDU_SESSION_RELEASE_AN_INITIATED = 15,
PDU_SESSION_TEST = 16
};
static const std::vector<std::string> session_management_procedures_type_e2str =
......@@ -190,9 +191,12 @@ static const std::vector<std::string> multipart_related_content_part_e2str = {
#define AMF_NUMBER_RETRIES 3
#define UDM_CURL_TIMEOUT_MS 100L
#define UDM_NUMBER_RETRIES 3
constexpr auto CURL_MIME_BOUNDARY = "----Boundary";
//for N1N2
#define BUF_LEN 512
//for PFCP
constexpr uint64_t SECONDS_SINCE_FIRST_EPOCH = 2208988800;
#endif
......@@ -116,6 +116,7 @@ typedef enum {
N11_SESSION_N1N2_MESSAGE_TRANSFER_RESPONSE_STATUS,
N11_SESSION_RELEASE_SM_CONTEXT_REQUEST,
N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE,
N11_SESSION_REPORT_RESPONSE,
NX_TRIGGER_SESSION_MODIFICATION,
UDP_INIT,
UDP_DATA_REQ,
......
......@@ -383,28 +383,57 @@ void smf_app::handle_itti_msg(
Logger::smf_app().info("Process N1N2MessageTransfer Response");
//Update PDU Session accordingly
//TODO: to be completed (process cause)
pdu_session_status_e status = { pdu_session_status_e::PDU_SESSION_INACTIVE };
upCnx_state_e state = { upCnx_state_e::UPCNX_STATE_DEACTIVATED };
if ((static_cast<http_response_codes_e>(m.response_code)
== http_response_codes_e::HTTP_RESPONSE_CODE_OK)
or (static_cast<http_response_codes_e>(m.response_code)
== http_response_codes_e::HTTP_RESPONSE_CODE_ACCEPTED)) {
if (m.msg_type == PDU_SESSION_ESTABLISHMENT_REJECT) {
status = pdu_session_status_e::PDU_SESSION_INACTIVE;
} else if (m.msg_type == PDU_SESSION_ESTABLISHMENT_ACCEPT) {
status = pdu_session_status_e::PDU_SESSION_ESTABLISHMENT_PENDING;
state = upCnx_state_e::UPCNX_STATE_ACTIVATING;
switch (m.procedure_type) {
case session_management_procedures_type_e::PDU_SESSION_ESTABLISHMENT_UE_REQUESTED: {
pdu_session_status_e status =
{ pdu_session_status_e::PDU_SESSION_INACTIVE };
upCnx_state_e state = { upCnx_state_e::UPCNX_STATE_DEACTIVATED };
if ((static_cast<http_response_codes_e>(m.response_code)
== http_response_codes_e::HTTP_RESPONSE_CODE_OK)
or (static_cast<http_response_codes_e>(m.response_code)
== http_response_codes_e::HTTP_RESPONSE_CODE_ACCEPTED)) {
if (m.msg_type == PDU_SESSION_ESTABLISHMENT_REJECT) {
status = pdu_session_status_e::PDU_SESSION_INACTIVE;
} else if (m.msg_type == PDU_SESSION_ESTABLISHMENT_ACCEPT) {
status = pdu_session_status_e::PDU_SESSION_ESTABLISHMENT_PENDING;
state = upCnx_state_e::UPCNX_STATE_ACTIVATING;
}
update_pdu_session_status(m.scid, status);
update_pdu_session_upCnx_state(m.scid, state);
Logger::smf_app().debug(
"Got successful response from AMF (Response code %d), set session status to %s",
m.response_code,
pdu_session_status_e2str[static_cast<int>(status)].c_str());
} else {
//TODO:
Logger::smf_app().debug("Got response from AMF (Response code %d)",
m.response_code);
}
}
break;
case session_management_procedures_type_e::SERVICE_REQUEST_NETWORK_TRIGGERED: {
if ((static_cast<http_response_codes_e>(m.response_code)
== http_response_codes_e::HTTP_RESPONSE_CODE_OK)
or (static_cast<http_response_codes_e>(m.response_code)
== http_response_codes_e::HTTP_RESPONSE_CODE_ACCEPTED)) {
//TODO:
Logger::smf_app().debug(
"Got successful response from AMF (Response code %d)",
m.response_code);
} else {
//TODO:
Logger::smf_app().debug("Got response from AMF (Response code %d)",
m.response_code);
//send failure indication to UPF
}
}
break;
default: {
}
update_pdu_session_status(m.scid, status);
update_pdu_session_upCnx_state(m.scid, state);
Logger::smf_app().debug(
"Got successful response from AMF (Response code %d), set session status to %s",
m.response_code,
pdu_session_status_e2str[static_cast<int>(status)].c_str());
} else {
//TODO:
Logger::smf_app().debug("Got response from AMF (Response code %d)",
m.response_code);
}
}
......@@ -516,6 +545,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
//Get necessary information
supi_t supi = smreq->req.get_supi();
std::string supi_prefix = smreq->req.get_supi_prefix();
supi64_t supi64 = smf_supi_to_u64(supi);
std::string dnn = smreq->req.get_dnn();
snssai_t snssai = smreq->req.get_snssai();
......@@ -628,6 +658,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
"Create a new SMF context with SUPI " SUPI_64_FMT "", supi64);
sc = std::shared_ptr<smf_context>(new smf_context());
sc.get()->set_supi(supi);
sc.get()->set_supi_prefix(supi_prefix);
set_supi_2_smf_context(supi64, sc);
}
......@@ -894,10 +925,10 @@ void smf_app::handle_pdu_session_release_sm_context_request(
}
//------------------------------------------------------------------------------
void smf_app::trigger_pdu_session_modification(supi_t &supi, std::string &dnn,
pdu_session_id_t pdu_session_id,
snssai_t &snssai,
pfcp::qfi_t &qfi) {
void smf_app::trigger_pdu_session_modification(const supi_t &supi, const std::string &dnn,
const pdu_session_id_t pdu_session_id,
const snssai_t &snssai,
const pfcp::qfi_t &qfi) {
//SMF-requested session modification, see section 4.3.3.2@3GPP TS 23.502
//The SMF may decide to modify PDU Session. This procedure also may be
//triggered based on locally configured policy or triggered from the (R)AN (see clause 4.2.6 and clause 4.9.1).
......@@ -1007,22 +1038,22 @@ bool smf_app::use_local_configuration_subscription_data(
}
//------------------------------------------------------------------------------
bool smf_app::is_supi_dnn_snssai_subscription_data(supi_t &supi,
std::string &dnn,
snssai_t &snssai) {
bool smf_app::is_supi_dnn_snssai_subscription_data(const supi_t &supi,
const std::string &dnn,
const snssai_t &snssai) const {
//TODO: should be implemented
return false; //Session Management Subscription from UDM isn't available
}
//------------------------------------------------------------------------------
bool smf_app::is_create_sm_context_request_valid() {
bool smf_app::is_create_sm_context_request_valid() const {
//TODO: should be implemented
return true;
}
//---------------------------------------------------------------------------------------------
void smf_app::convert_string_2_hex(std::string &input_str,
void smf_app::convert_string_2_hex(const std::string &input_str,
std::string &output_str) {
Logger::smf_app().debug("Convert string to Hex");
unsigned char *data = (unsigned char*) malloc(input_str.length() + 1);
......@@ -1052,7 +1083,7 @@ void smf_app::convert_string_2_hex(std::string &input_str,
}
//---------------------------------------------------------------------------------------------
unsigned char* smf_app::format_string_as_hex(std::string &str) {
unsigned char* smf_app::format_string_as_hex(const std::string &str) {
unsigned int str_len = str.length();
char *data = (char*) malloc(str_len + 1);
memset(data, 0, str_len + 1);
......@@ -1192,7 +1223,7 @@ void smf_app::timer_t3591_timeout(timer_id_t timer_id, uint64_t arg2_user) {
}
//---------------------------------------------------------------------------------------------
n2_sm_info_type_e smf_app::n2_sm_info_type_str2e(std::string &n2_info_type) {
n2_sm_info_type_e smf_app::n2_sm_info_type_str2e(const std::string &n2_info_type) const {
std::size_t number_of_types = n2_sm_info_type_e2str.size();
for (auto i = 0; i < number_of_types; ++i) {
if (n2_info_type.compare(n2_sm_info_type_e2str[i]) == 0) {
......@@ -1202,7 +1233,7 @@ n2_sm_info_type_e smf_app::n2_sm_info_type_str2e(std::string &n2_info_type) {
}
bool smf_app::get_session_management_subscription_data(
supi64_t &supi, std::string &dnn, snssai_t &snssai,
const supi64_t &supi, const std::string &dnn, const snssai_t &snssai,
std::shared_ptr<session_management_subscription> subscription) {
Logger::smf_app().debug(
......
......@@ -392,16 +392,16 @@ class smf_app {
/*
* Trigger pdu session modification
* @param [supi_t &] supi
* @param [std::string &] dnn
* @param [pdu_session_id_t] pdu_session_id
* @param [snssai_t &] snssai
* @param [pfcp::qfi_t &] qfi
* @param [const supi_t &] supi
* @param [const std::string &] dnn
* @param [const pdu_session_id_t] pdu_session_id
* @param [const snssai_t &] snssai
* @param [const pfcp::qfi_t &] qfi
* @return void
*/
void trigger_pdu_session_modification(supi_t &supi, std::string &dnn,
pdu_session_id_t pdu_session_id,
snssai_t &snssai, pfcp::qfi_t &qfi);
void trigger_pdu_session_modification(const supi_t &supi, const std::string &dnn,
const pdu_session_id_t pdu_session_id,
const snssai_t &snssai, const pfcp::qfi_t &qfi);
/*
* Verify if SM Context is existed for this Supi
......@@ -412,7 +412,7 @@ class smf_app {
/*
* Create/Update SMF context with the corresponding supi
* @param [supi_t] supi
* @param [const supi_t&] supi
* @param [std::shared_ptr<smf_context>] sc Shared_ptr Pointer to an SMF context
* @return True if existed, otherwise false
*/
......@@ -428,7 +428,7 @@ class smf_app {
/*
* Check whether SMF uses local configuration instead of retrieving Session Management Data from UDM
* @param [std::string] dnn_selection_mode
* @param [const std::string&] dnn_selection_mode
* @return True if SMF uses the local configuration to check the validity of the UE request, False otherwise
*/
bool use_local_configuration_subscription_data(
......@@ -436,24 +436,25 @@ class smf_app {
/*
* Verify whether the Session Management Data is existed
* @param [supi_t] SUPI
* @param [std::string] DNN
* @param [snssai_t] S-NSSAI
* @param [const supi_t&] SUPI
* @param [const std::string&] DNN
* @param [const snssai_t&] S-NSSAI
* @return True if SMF uses the local configuration to check the validity of the UE request, False otherwise
*/
bool is_supi_dnn_snssai_subscription_data(supi_t &supi, std::string &dnn,
snssai_t &snssai);
bool is_supi_dnn_snssai_subscription_data(const supi_t &supi,
const std::string &dnn,
const snssai_t &snssai) const;
/*
* Get the Session Management Subscription data from local configuration
* @param [supi_t &] SUPI
* @param [std::string &] DNN
* @param [snssai_t &] S-NSSAI
* @param [std::shared_ptr<session_management_subscription>] subscription: store subscription data if exist
* @return True if local configuration for this session management subscription exists, False otherwise
*/
* Get the Session Management Subscription data from local configuration
* @param [const supi_t &] SUPI
* @param [const std::string &] DNN
* @param [const snssai_t &] S-NSSAI
* @param [std::shared_ptr<session_management_subscription>] subscription: store subscription data if exist
* @return True if local configuration for this session management subscription exists, False otherwise
*/
bool get_session_management_subscription_data(
supi64_t &supi, std::string &dnn, snssai_t &snssai,
const supi64_t &supi, const std::string &dnn, const snssai_t &snssai,
std::shared_ptr<session_management_subscription> subscription);
/*
......@@ -461,23 +462,23 @@ class smf_app {
* @param [..]
* @return True if the request is valid, otherwise False
*/
bool is_create_sm_context_request_valid();
bool is_create_sm_context_request_valid() const;
/*
* Convert a string to hex representing this string
* @param [std::string&] input_str Input string
* @param [const std::string&] input_str Input string
* @param [std::string&] output_str String represents string in hex format
* @return void
*/
void convert_string_2_hex(std::string &input_str, std::string &output_str);
void convert_string_2_hex(const std::string &input_str,
std::string &output_str);
/*
* Represent a string as hex
* @param [std::string&] str: input string
* @param [std::string&] output_str String represents string in hex format
* @return void
* @param [const std::string&] str: input string
* @return String represents string in hex format
*/
unsigned char* format_string_as_hex(std::string &str);
unsigned char* format_string_as_hex(const std::string &str);
/*
* Update PDU session status
......@@ -490,10 +491,10 @@ class smf_app {
/*
* Convert N2 Info type representing by a string to n2_sm_info_type_e
* @param [std::string] n2_info_type
* @param [const std::string] n2_info_type
* @return representing of N2 info type in a form of emum
*/
n2_sm_info_type_e n2_sm_info_type_str2e(std::string &n2_info_type);
n2_sm_info_type_e n2_sm_info_type_str2e(const std::string &n2_info_type) const;
/*
* Update PDU session UpCnxState
......
......@@ -43,6 +43,7 @@
#include "3gpp_29.502.h"
#include "3gpp_24.501.h"
#include "SmContextCreatedData.h"
#include "smf_pfcp_association.hpp"
extern "C" {
#include "Ngap_PDUSessionResourceSetupResponseTransfer.h"
......@@ -433,7 +434,7 @@ bool smf_pdu_session::get_default_qos_rule(QOSRulesIE &qos_rule) const {
}
//------------------------------------------------------------------------------
bool smf_pdu_session::get_qos_rule(uint8_t rule_id,
bool smf_pdu_session::get_qos_rule(const uint8_t rule_id,
QOSRulesIE &qos_rule) const {
Logger::smf_app().info("Find QoS Rule with Rule Id %d", (uint8_t) rule_id);
if (qos_rules.count(rule_id) > 0) {
......@@ -468,7 +469,7 @@ void smf_pdu_session::update_qos_rule(const QOSRulesIE &qos_rule) {
}
//------------------------------------------------------------------------------
void smf_pdu_session::mark_qos_rule_to_be_synchronised(uint8_t rule_id) {
void smf_pdu_session::mark_qos_rule_to_be_synchronised(const uint8_t rule_id) {
if ((rule_id >= QOS_RULE_IDENTIFIER_FIRST )
and (rule_id <= QOS_RULE_IDENTIFIER_LAST )) {
......@@ -639,6 +640,153 @@ void smf_context::handle_itti_msg(itti_n4_session_deletion_response &sdresp) {
//------------------------------------------------------------------------------
void smf_context::handle_itti_msg(
std::shared_ptr<itti_n4_session_report_request> &req) {
pfcp::report_type_t report_type;
if (req->pfcp_ies.get(report_type)) {
pfcp::pdr_id_t pdr_id;
// Downlink Data Report
if (report_type.dldr) {
pfcp::downlink_data_report data_report;
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, sd, sp)) {/*
downlink_data_report_procedure *proc =
new downlink_data_report_procedure(shared_from_this(), sp);
std::shared_ptr<smf_procedure> sproc =
std::shared_ptr<smf_procedure>(proc);
insert_procedure(sproc);
if (proc->run(pdr_id, qfi)) {
// error !
Logger::smf_app().info(
"Downlink Data Report Request procedure failed");
remove_procedure(proc);
}
*/
//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)) {
// TODO
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;
n4_ser->trxn_id = req->trxn_id;
n4_ser->r_endpoint = endpoint(up_node_id.u1.ipv4_address,
pfcp::default_port);
std::shared_ptr<itti_n4_session_report_response> n4_report_ack =
std::shared_ptr<itti_n4_session_report_response>(n4_ser);
Logger::smf_app().info(
"Sending ITTI message %s to task TASK_SMF_N4",
n4_ser->get_msg_name());
int ret = itti_inst->send_msg(n4_report_ack);
if (RETURNok != ret) {
Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_N4",
n4_ser->get_msg_name());
return;
}
//Step 2. Send N1N2MessageTranfer to AMF
pdu_session_report_response session_report_msg = { };
//set the required IEs
session_report_msg.set_supi(supi); //supi
session_report_msg.set_snssai(sd.get()->nssai); //s-nssai
session_report_msg.set_dnn(sd.get()->dnn_in_use); //dnn
session_report_msg.set_pdu_session_type(
sp.get()->get_pdn_type().pdn_type); //pdu session type
//get supi and put into URL
std::string supi_prefix = { };
get_supi_prefix(supi_prefix);
std::string supi_str = 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)
+ fmt::format(NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL,
supi_str.c_str());
session_report_msg.set_amf_url(url);
//QFIs, QoS profiles, CN Tunnel
smf_qos_flow flow = { };
sp.get()->get_qos_flow(qfi, flow);
//ADD QoS Flow to be updated
qos_flow_context_updated qcu = { };
qcu.set_qfi(qfi);
qcu.set_ul_fteid(flow.ul_fteid);
qcu.set_qos_profile(flow.qos_profile);
session_report_msg.add_qos_flow_context_updated(qcu);
// Create N2 SM Information: PDU Session Resource Setup Request Transfer IE
//N2 SM Information
smf_n1_n2 smf_n1_n2_inst = { };
std::string n2_sm_info, n2_sm_info_hex;
smf_n1_n2_inst.create_n2_sm_information(
session_report_msg, 1, n2_sm_info_type_e::PDU_RES_SETUP_REQ,
n2_sm_info);
smf_app_inst->convert_string_2_hex(n2_sm_info, n2_sm_info_hex);
session_report_msg.set_n2_sm_information(n2_sm_info_hex);
//Fill the json part
session_report_msg.n1n2_message_transfer_data["n2InfoContainer"]["n2InformationClass"] =
N1N2_MESSAGE_CLASS;
session_report_msg.n1n2_message_transfer_data["n2InfoContainer"]["smInfo"]["PduSessionId"] =
session_report_msg.get_pdu_session_id();
//N2InfoContent (section 6.1.6.2.27@3GPP TS 29.518)
session_report_msg.n1n2_message_transfer_data["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapIeType"] =
"PDU_RES_SETUP_REQ"; //NGAP message type
session_report_msg.n1n2_message_transfer_data["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapData"]["contentId"] =
N2_SM_CONTENT_ID; //NGAP part
session_report_msg.n1n2_message_transfer_data["n2InfoContainer"]["smInfo"]["sNssai"]["sst"] =
session_report_msg.get_snssai().sST;
session_report_msg.n1n2_message_transfer_data["n2InfoContainer"]["smInfo"]["sNssai"]["sd"] =
session_report_msg.get_snssai().sD;
itti_n11_session_report_request *itti_n11 =
new itti_n11_session_report_request(TASK_SMF_APP, TASK_SMF_N11);
std::shared_ptr<itti_n11_session_report_request> itti_n11_report =
std::shared_ptr<itti_n11_session_report_request>(itti_n11);
itti_n11_report->res = session_report_msg;
//send ITTI message to N11 interface to trigger N1N2MessageTransfer towards AMFs
Logger::smf_app().info(
"Sending ITTI message %s to task TASK_SMF_N11",
itti_n11_report->get_msg_name());
ret = itti_inst->send_msg(itti_n11_report);
if (RETURNok != ret) {
Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_N11",
itti_n11_report->get_msg_name());
}
}
}
}
}
// Usage Report
if (report_type.usar) {
Logger::smf_app().debug("TODO PFCP_SESSION_REPORT_REQUEST/Usage Report");
}
// Error Indication Report
if (report_type.erir) {
Logger::smf_app().debug(
"TODO PFCP_SESSION_REPORT_REQUEST/Error Indication Report");
}
// User Plane Inactivity Report
if (report_type.upir) {
Logger::smf_app().debug(
"TODO PFCP_SESSION_REPORT_REQUEST/User Plane Inactivity Report");
}
}
}
//------------------------------------------------------------------------------
......@@ -1959,7 +2107,8 @@ void smf_context::handle_pdu_session_update_sm_context_request(
//PDU Session Establishment procedure
//PDU Session Resource Setup Unsuccessful Transfer
case n2_sm_info_type_e::PDU_RES_SETUP_FAIL: {
Logger::smf_app().info("PDU Sessio