Commit 502f5ade authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

fix issue for Network-initiated service request

parent 803292a9
......@@ -301,7 +301,10 @@ class itti_n11_n1n2_message_transfer_response_status : public itti_n11_msg {
scid(0),
response_code(0),
msg_type(0),
procedure_type(session_management_procedures_type_e::PROCEDURE_TYPE_UNKNOWN) {
procedure_type(
session_management_procedures_type_e::PROCEDURE_TYPE_UNKNOWN),
seid(0),
trxn_id(0) {
}
itti_n11_n1n2_message_transfer_response_status(
const itti_n11_n1n2_message_transfer_response_status &i)
......@@ -310,7 +313,9 @@ class itti_n11_n1n2_message_transfer_response_status : public itti_n11_msg {
scid(i.scid),
response_code(i.response_code),
msg_type(i.msg_type),
procedure_type(i.procedure_type) {
procedure_type(i.procedure_type),
seid(i.seid),
trxn_id(i.trxn_id) {
}
itti_n11_n1n2_message_transfer_response_status(
const itti_n11_n1n2_message_transfer_response_status &i,
......@@ -320,7 +325,9 @@ class itti_n11_n1n2_message_transfer_response_status : public itti_n11_msg {
scid(i.scid),
response_code(i.response_code),
msg_type(i.msg_type),
procedure_type(i.procedure_type) {
procedure_type(i.procedure_type),
seid(i.seid),
trxn_id(i.trxn_id) {
}
const char* get_msg_name() {
return "N11_SESSION_N1N2_MESSAGE_TRANSFER_RESPONSE_STATUS";
......@@ -346,11 +353,24 @@ class itti_n11_n1n2_message_transfer_response_status : public itti_n11_msg {
procedure_type = type;
}
;
void set_seid(const seid_t &s) {
seid = s;
}
;
void set_trxn_id(uint64_t t) {
trxn_id = t;
}
;
scid_t scid; //SM Context ID
int16_t response_code;
std::string cause;
uint8_t msg_type;
session_management_procedures_type_e procedure_type;
seid_t seid;
uint64_t trxn_id;
};
......
......@@ -705,4 +705,33 @@ class itti_n4_session_report_response : public itti_n4_msg {
pfcp::pfcp_session_report_response pfcp_ies;
};
//-----------------------------------------------------------------------------
class itti_n4_session_failure_indication : public itti_n4_msg {
public:
itti_n4_session_failure_indication(const task_id_t origin,
const task_id_t destination)
:
itti_n4_msg(N4_SESSION_REPORT_RESPONSE, origin, destination) {
}
itti_n4_session_failure_indication(const itti_n4_session_failure_indication &i)
:
itti_n4_msg(i) {
pfcp_ies = i.pfcp_ies;
}
itti_n4_session_failure_indication(const itti_n4_session_failure_indication &i,
const task_id_t orig, const task_id_t dest)
:
itti_n4_msg(i, orig, dest) {
pfcp_ies = i.pfcp_ies;
}
const char* get_msg_name() {
return typeid(itti_n4_session_failure_indication).name();
}
;
pfcp::pfcp_session_modification_request pfcp_ies;
};
#endif /* ITTI_MSG_N4_HPP_INCLUDED_ */
......@@ -380,12 +380,12 @@ void smf_app::handle_itti_msg(
//------------------------------------------------------------------------------
void smf_app::handle_itti_msg(
itti_n11_n1n2_message_transfer_response_status &m) {
//see TS29518_Namf_Communication.yaml
Logger::smf_app().info("Process N1N2MessageTransfer Response");
//Update PDU Session accordingly
//TODO: to be completed (process cause)
switch (m.procedure_type) {
case session_management_procedures_type_e::PDU_SESSION_ESTABLISHMENT_UE_REQUESTED: {
//Update PDU Session accordingly
pdu_session_status_e status =
{ pdu_session_status_e::PDU_SESSION_INACTIVE };
upCnx_state_e state = { upCnx_state_e::UPCNX_STATE_DEACTIVATED };
......@@ -413,20 +413,42 @@ void smf_app::handle_itti_msg(
}
break;
case session_management_procedures_type_e::SERVICE_REQUEST_NETWORK_TRIGGERED: {
Logger::smf_app().debug("Got response from AMF (Response code %d) with cause %s",
m.response_code, m.cause.c_str());
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);
!= http_response_codes_e::HTTP_RESPONSE_CODE_OK)
and (static_cast<http_response_codes_e>(m.response_code)
!= http_response_codes_e::HTTP_RESPONSE_CODE_ACCEPTED)) {
//send failure indication to UPF
Logger::smf_app().debug("Send failure indication to UPF");
//TODO: to be completed
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_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> itti_n4_failure_indication =
std::shared_ptr<itti_n4_session_failure_indication>(itti_n4);
Logger::smf_app().info(
"Sending ITTI message %s to task TASK_SMF_N4",
itti_n4->get_msg_name());
int ret = itti_inst->send_msg(itti_n4_failure_indication);
if (RETURNok != ret) {
Logger::smf_app().error(
"Could not send ITTI message %s to task TASK_SMF_N4",
itti_n4->get_msg_name());
return;
}
}
}
......
......@@ -714,6 +714,9 @@ void smf_context::handle_itti_msg(
+ fmt::format(NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL,
supi_str.c_str());
session_report_msg.set_amf_url(url);
//seid and trxn_id to be used in Failure indication
session_report_msg.set_seid(req->seid);
session_report_msg.set_trxn_id(req->trxn_id);
//QFIs, QoS profiles, CN Tunnel
smf_qos_flow flow = { };
......
......@@ -626,8 +626,7 @@ std::string pdu_session_report_response::get_n1_sm_message() const {
}
//-----------------------------------------------------------------------------
void pdu_session_report_response::set_n1_sm_message(
const std::string &value) {
void pdu_session_report_response::set_n1_sm_message(const std::string &value) {
m_n1_sm_message = value;
m_n1_sm_msg_is_set = true;
}
......@@ -641,3 +640,24 @@ bool pdu_session_report_response::n1_sm_msg_is_set() const {
bool pdu_session_report_response::n2_sm_info_is_set() const {
return m_n2_sm_info_is_set;
}
//-----------------------------------------------------------------------------
void pdu_session_report_response::set_seid(const seid_t &s) {
seid = s;
}
//-----------------------------------------------------------------------------
void pdu_session_report_response::set_trxn_id(const uint64_t &t) {
trxn_id = t;
}
//-----------------------------------------------------------------------------
seid_t pdu_session_report_response::get_seid() const {
return seid;
}
//-----------------------------------------------------------------------------
uint64_t pdu_session_report_response::get_trxn_id() const {
return trxn_id;
}
......@@ -482,6 +482,8 @@ class pdu_session_report_response : public pdu_session_msg {
pdu_session_msg() {
m_n2_sm_info_is_set = false;
m_n1_sm_msg_is_set = false;
seid = 0;
trxn_id = 0;
}
;
pdu_session_report_response(pdu_session_msg_type_t msg_type)
......@@ -489,6 +491,8 @@ class pdu_session_report_response : public pdu_session_msg {
pdu_session_msg(msg_type) {
m_n2_sm_info_is_set = false;
m_n1_sm_msg_is_set = false;
seid = 0;
trxn_id = 0;
}
;
void set_amf_url(std::string const &value);
......@@ -506,6 +510,10 @@ class pdu_session_report_response : public pdu_session_msg {
void set_n1_sm_message(const std::string &value);
bool n1_sm_msg_is_set() const;
bool n2_sm_info_is_set() const;
void set_seid(const seid_t &s);
void set_trxn_id(const uint64_t &t);
seid_t get_seid() const;
uint64_t get_trxn_id() const;
nlohmann::json n1n2_message_transfer_data; //N1N2MessageTransferReqData from oai::amf::model
......@@ -519,6 +527,8 @@ class pdu_session_report_response : public pdu_session_msg {
std::string m_n2_sm_information;
bool m_n2_sm_info_is_set;
std::string m_n2_sm_info_type;
seid_t seid;
uint64_t trxn_id;
};
}
......
......@@ -403,6 +403,8 @@ void smf_n11::send_n1n2_message_transfer_request(
itti_msg->set_procedure_type(
session_management_procedures_type_e::SERVICE_REQUEST_NETWORK_TRIGGERED);
itti_msg->set_cause(response_data["cause"]);
itti_msg->set_seid(report_msg->res.get_seid());
itti_msg->set_trxn_id(report_msg->res.get_trxn_id());
std::shared_ptr<itti_n11_n1n2_message_transfer_response_status> i =
std::shared_ptr<itti_n11_n1n2_message_transfer_response_status>(
......
......@@ -151,7 +151,7 @@ int session_create_sm_context_procedure::run(
pfcp::destination_interface_t destination_interface = { };
sps->generate_far_id(far_id);
apply_action.forw = 1;
apply_action.forw = 1; //forward the packets
//wys-test-add
pfcp::outer_header_creation_t outer_header_creation = { };
......@@ -662,7 +662,8 @@ int session_update_sm_context_procedure::run(
.s_addr;
update_forwarding_parameters.set(outer_header_creation);
update_far.set(update_forwarding_parameters);
apply_action.forw = 1;
apply_action.forw = 1; //forward the packets
//apply_action.nocp = 1; //notify the CP function about the arrival of a first DL packet
update_far.set(apply_action);
n4_ser->pfcp_ies.set(update_far);
......@@ -692,7 +693,8 @@ int session_update_sm_context_procedure::run(
//pfcp::proxying_t proxying = {};
sps->generate_far_id(far_id);
apply_action.forw = 1;
apply_action.forw = 1; //forward the packets
//apply_action.nocp = 1; //notify the CP function about the arrival of a first DL packet
destination_interface.interface_value = pfcp::INTERFACE_VALUE_ACCESS; // ACCESS is for downlink, CORE for uplink
forwarding_parameters.set(destination_interface);
......@@ -874,7 +876,7 @@ int session_update_sm_context_procedure::run(
far_id.far_id = flow.far_id_dl.second.far_id;
// apply_action.buff = 1;
pfcp::apply_action_t apply_action = { };
apply_action.nocp = 1;
apply_action.nocp = 1; //notify the CP function about the arrival of a first DL packet
far.set(far_id);
far.set(apply_action);
......
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