Commit 6a4351b4 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Update UE-requested Service Request/Code cleanup

parent dd228492
......@@ -184,7 +184,7 @@ void IndividualSMContextApi::update_sm_context_handler(
free_wrapper((void**) &data);
uint8_t size = g_parts.size();
Logger::smf_api_server().debug("Number of g_parts %d", g_parts.size());
Logger::smf_api_server().debug("Number of MIME parts %d", g_parts.size());
part p0 = { };
part p1 = { };
......
......@@ -189,7 +189,9 @@ static const std::vector<std::string> multipart_related_content_part_e2str = {
//for CURL
#define AMF_CURL_TIMEOUT_MS 100L
#define AMF_NUMBER_RETRIES 3
#define UDM_CURL_TIMEOUT_MS 100L
#define UDM_NUMBER_RETRIES 3
//for N1N2
#define BUF_LEN 512
#endif
......@@ -494,12 +494,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
return;
}
Logger::smf_app().debug(
"NAS information: Extended Protocol Discriminator %d, Security Header Type %d, Message Type %d",
decoded_nas_msg.header.extended_protocol_discriminator,
decoded_nas_msg.header.security_header_type,
decoded_nas_msg.plain.sm.header.message_type);
//Extended protocol discriminator (Mandatory)
smreq->req.set_epd(decoded_nas_msg.header.extended_protocol_discriminator);
//PDUSessionIdentity
......@@ -517,7 +511,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
== PDU_SESSION_ESTABLISHMENT_REQUEST) {
//TODO: Disable this command temporarily since can't get this info from tester
Logger::smf_app().debug(
"NAS, pdu_session_type %d",
"PDU Session Type %d",
decoded_nas_msg.plain.sm.pdu_session_establishment_request
._pdusessiontype.pdu_session_type_value);
pdu_session_type.pdu_session_type = decoded_nas_msg.plain.sm
......@@ -565,7 +559,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
uint8_t message_type = decoded_nas_msg.plain.sm.header.message_type;
std::string request_type = smreq->req.get_request_type();
Logger::smf_app().info(
"Handle a PDU Session Create SM Context Request message from AMF, supi " SUPI_64_FMT ", dnn %s, snssai_sst %d, snssai_sd %s",
"Handle a PDU Session Create SM Context Request message from AMF, SUPI " SUPI_64_FMT ", DNN %s, SNSSAI SST %d, SD %s",
supi64, dnn.c_str(), snssai.sST, snssai.sD.c_str());
//If no DNN information from UE, set to default value
......@@ -577,7 +571,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
//check pti
if ((pti.procedure_transaction_id == PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED )
|| (pti.procedure_transaction_id > PROCEDURE_TRANSACTION_IDENTITY_LAST )) {
Logger::smf_app().warn(" Invalid PTI value (pti = %d)",
Logger::smf_app().warn("Invalid PTI value (pti = %d)",
pti.procedure_transaction_id);
problem_details.setCause(
pdu_session_application_error_e2str[PDU_SESSION_APPLICATION_ERROR_N1_SM_ERROR]);
......@@ -599,7 +593,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
//check pdu session id
if ((pdu_session_id == PDU_SESSION_IDENTITY_UNASSIGNED )
|| (pdu_session_id > PDU_SESSION_IDENTITY_LAST )) {
Logger::smf_app().warn(" Invalid PDU Session ID value (%d)",
Logger::smf_app().warn("Invalid PDU Session ID value (%d)",
pdu_session_id);
//section 7.3.2@3GPP TS 24.501; NAS N1 SM message: ignore the message
return;
......@@ -630,7 +624,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
//check request type
if (request_type.compare("INITIAL_REQUEST") != 0) {
Logger::smf_app().warn("Invalid request type (request type = %s)",
"INITIAL_REQUEST");
request_type.c_str());
//TODO:
//return
}
......@@ -703,7 +697,6 @@ void smf_app::handle_pdu_session_create_sm_context_request(
std::shared_ptr<session_management_subscription> subscription =
std::shared_ptr<session_management_subscription>(s);
if (smf_n10_inst->get_sm_data(supi64, dnn, snssai, subscription)) {
Logger::smf_app().debug("Update DNN subscription info");
//update dnn_context with subscription info
sc.get()->insert_dnn_subscription(snssai, subscription);
} else {
......@@ -782,7 +775,7 @@ void smf_app::handle_pdu_session_update_sm_context_request(
scf = scid_2_smf_context(scid);
} else {
Logger::smf_app().warn(
"Context associated with this id " SCID_FMT " does not exit!", scid);
"SM Context associated with this id " SCID_FMT " does not exit!", scid);
problem_details.setCause(
pdu_session_application_error_e2str[PDU_SESSION_APPLICATION_ERROR_CONTEXT_NOT_FOUND]);
smContextUpdateError.setError(problem_details);
......
......@@ -741,15 +741,15 @@ smf_config::~smf_config() {
//------------------------------------------------------------------------------
bool smf_config::is_dotted_dnn_handled(
const std::string &dnn, const pdu_session_type_t &pdn_session_type) {
Logger::smf_app().debug("requested dnn: %s", dnn.c_str());
Logger::smf_app().debug("Requested DNN: %s", dnn.c_str());
for (int i = 0; i < smf_cfg.num_apn; i++) {
Logger::smf_app().debug("apn_label: %s, apn: %s",
Logger::smf_app().debug("DNN label: %s, dnn: %s",
smf_cfg.apn[i].apn_label.c_str(),
smf_cfg.apn[i].apn.c_str());
//if (0 == dnn.compare(smf_cfg.apn[i].apn_label)) {
if (0 == dnn.compare(smf_cfg.apn[i].apn)) {
Logger::smf_app().debug("DNN matched!");
Logger::smf_app().debug("pdu session type %d, pdn_type %d",
Logger::smf_app().debug("PDU Session Type %d, PDN Type %d",
pdn_session_type.pdu_session_type,
smf_cfg.apn[i].pdn_type.pdn_type);
if (pdn_session_type.pdu_session_type
......
......@@ -78,7 +78,7 @@ std::string smf_qos_flow::toString() const {
.append("\n");
s.append("\tPDR ID DL:\t\t\t").append(std::to_string(pdr_id_dl.rule_id))
.append("\n");
s.append("\tPRECEDENCE:\t\t\t").append(std::to_string(precedence.precedence))
s.append("\tPrecedence:\t\t\t").append(std::to_string(precedence.precedence))
.append("\n");
if (far_id_ul.first) {
s.append("\tFAR ID UL:\t\t\t").append(
......@@ -169,11 +169,11 @@ void smf_pdu_session::add_qos_flow(const smf_qos_flow &flow) {
qos_flows.erase(flow.qfi.qfi);
qos_flows.insert(
std::pair<uint8_t, smf_qos_flow>((uint8_t) flow.qfi.qfi, flow));
Logger::smf_app().trace("smf_pdu_session::add_qos_flow(%d) success",
Logger::smf_app().trace("QoS Flow (flow Id %d) has been added successfully",
flow.qfi.qfi);
} else {
Logger::smf_app().error(
"smf_pdu_session::add_qos_flow(%d) failed, invalid QFI", flow.qfi.qfi);
Logger::smf_app().error("Failed to add QoS flow (flow Id %d), invalid QFI",
flow.qfi.qfi);
}
}
......@@ -227,6 +227,12 @@ void smf_pdu_session::set_default_qos_flow(const pfcp::qfi_t &qfi) {
default_qfi.qfi = qfi.qfi;
}
//------------------------------------------------------------------------------
bool smf_pdu_session::get_default_qos_flow(smf_qos_flow &flow) {
Logger::smf_app().debug("Get default QoS Flow of this PDU session.");
return get_qos_flow(default_qfi, flow);
}
//------------------------------------------------------------------------------
void smf_pdu_session::get_qos_flows(std::vector<smf_qos_flow> &flows) {
flows.clear();
......@@ -339,8 +345,7 @@ std::string smf_pdu_session::toString() const {
"\n");
s.append("\tDefault QFI:\t\t\t").append(std::to_string(default_qfi.qfi))
.append("\n");
s.append("\tSEID:\t\t\t").append(std::to_string(seid)).append("\n");
s.append("\tSEID:\t\t\t\t").append(std::to_string(seid)).append("\n");
return s;
}
......@@ -361,6 +366,8 @@ pdu_session_status_e smf_pdu_session::get_pdu_session_status() const {
//------------------------------------------------------------------------------
void smf_pdu_session::set_upCnx_state(const upCnx_state_e &state) {
Logger::smf_app().info("Set upCnxState to %s",
upCnx_state_e2str[static_cast<int>(state)].c_str());
upCnx_state = state;
}
......@@ -477,17 +484,17 @@ void smf_pdu_session::add_qos_rule(const QOSRulesIE &qos_rule) {
if ((rule_id >= QOS_RULE_IDENTIFIER_FIRST )
and (rule_id <= QOS_RULE_IDENTIFIER_LAST )) {
if (qos_rules.count(rule_id) > 0) {
Logger::smf_app().error(
"smf_pdu_session::add_qos_rule(%d) failed, rule existed", rule_id);
Logger::smf_app().error("Failed to add rule (Id %d), rule existed",
rule_id);
} else {
qos_rules.insert(std::pair<uint8_t, QOSRulesIE>(rule_id, qos_rule));
Logger::smf_app().trace("smf_pdu_session::add_qos_rule(%d) success",
Logger::smf_app().trace("Rule (Id %d) has been added successfully",
rule_id);
}
} else {
Logger::smf_app().error(
"smf_pdu_session::add_qos_rule(%d) failed, invalid Rule Id", rule_id);
"Failed to add rule (Id %d) failed: invalid rule Id", rule_id);
}
}
......@@ -503,7 +510,7 @@ void session_management_subscription::insert_dnn_configuration(
//------------------------------------------------------------------------------
void session_management_subscription::find_dnn_configuration(
std::string dnn, std::shared_ptr<dnn_configuration_t> &dnn_configuration) {
Logger::smf_app().info("find_dnn_configuration with dnn %s", dnn.c_str());
Logger::smf_app().info("Find DNN configuration with DNN %s", dnn.c_str());
if (dnn_configurations.count(dnn) > 0) {
dnn_configuration = dnn_configurations.at(dnn);
}
......@@ -595,7 +602,11 @@ void smf_context::handle_itti_msg(itti_n4_session_deletion_response &sdresp) {
"Received N4 SESSION DELETION RESPONSE sender teid " TEID_FMT " pfcp_tx_id %" PRIX64", smf_procedure not found, discarded!",
sdresp.seid, sdresp.trxn_id);
}
std::cout << toString() << std::endl;
Logger::smf_app().info(
"Handle N4 SESSION DELETION RESPONSE with SMF context %s",
toString().c_str());
}
//------------------------------------------------------------------------------
......@@ -607,17 +618,14 @@ void smf_context::handle_itti_msg(
std::string smf_context::toString() const {
std::unique_lock<std::recursive_mutex> lock(m_context);
std::string s = { };
s.append("\n");
s.append("SMF CONTEXT:\n");
s.append("\tIMSI:\t\t\t\t").append(imsi.toString()).append("\n");
s.append("\tIMSI UNAUTHENTICATED:\t\t").append(
std::to_string(imsi_unauthenticated_indicator)).append("\n");
s.append("\tSUPI:\t\t\t\t").append(smf_supi_to_string(supi).c_str()).append(
"\n");
for (auto it : dnns) {
s.append(it->toString());
}
s.append("\tSUPI:\t\t\t\t").append(smf_supi_to_string(supi)).append("\n");
//s.append("\tIMSI:\t"+toString(p.msisdn));
//apns.reserve(MAX_APN_PER_UE);
// s.append("\n");
return s;
}
......@@ -625,7 +633,8 @@ std::string smf_context::toString() const {
void smf_context::get_default_qos(const snssai_t &snssai,
const std::string &dnn,
subscribed_default_qos_t &default_qos) {
Logger::smf_app().info("get_default_qos, key %d", (uint8_t) snssai.sST);
Logger::smf_app().info("Get default QoS for a PDU Session, key %d",
(uint8_t) snssai.sST);
//get the default QoS profile
std::shared_ptr<session_management_subscription> ss = { };
std::shared_ptr<dnn_configuration_t> sdc = { };
......@@ -644,7 +653,8 @@ void smf_context::get_default_qos(const snssai_t &snssai,
void smf_context::get_default_qos_rule(QOSRulesIE &qos_rule,
uint8_t pdu_session_type) {
//TODO, update according to PDU Session type
Logger::smf_app().info("Get default QoS rule (PDU session type %d)",
Logger::smf_app().info(
"Get default QoS rule for a PDU Session (PDU session type %d)",
pdu_session_type);
//see section 9.11.4.13 @ 3GPP TS 24.501 and section 5.7.1.4 @ 3GPP TS 23.501
qos_rule.qosruleidentifer = 0x01; //be updated later on
......@@ -749,7 +759,8 @@ void smf_context::get_default_qos_flow_description(
void smf_context::get_session_ambr(SessionAMBR &session_ambr,
const snssai_t &snssai,
const std::string &dnn) {
Logger::smf_app().debug("Get AMBR info from the DNN configuration");
Logger::smf_app().debug(
"Get AMBR info from the subscription information (DNN %s)", dnn.c_str());
std::shared_ptr<session_management_subscription> ss = { };
std::shared_ptr<dnn_configuration_t> sdc = { };
......@@ -759,7 +770,7 @@ void smf_context::get_session_ambr(SessionAMBR &session_ambr,
ss.get()->find_dnn_configuration(dnn, sdc);
if (nullptr != sdc.get()) {
Logger::smf_app().debug(
"Default AMBR info from the DNN configuration, downlink %s, uplink %s",
"Default AMBR info from the subscription information, downlink %s, uplink %s",
(sdc.get()->session_ambr).downlink.c_str(),
(sdc.get()->session_ambr).uplink.c_str());
......@@ -830,6 +841,9 @@ void smf_context::get_session_ambr(SessionAMBR &session_ambr,
}
}
} else {
Logger::smf_app().debug(
"Could not get default info from the subscription information, use default value instead.");
//use default value
session_ambr.session_ambr_for_downlink = 1;
session_ambr.uint_for_session_ambr_for_downlink =
......@@ -845,7 +859,8 @@ void smf_context::get_session_ambr(SessionAMBR &session_ambr,
void smf_context::get_session_ambr(
Ngap_PDUSessionAggregateMaximumBitRate_t &session_ambr,
const snssai_t &snssai, const std::string &dnn) {
Logger::smf_app().debug("Get AMBR info from the DNN configuration");
Logger::smf_app().debug(
"Get AMBR info from the subscription information (DNN %s)", dnn.c_str());
std::shared_ptr<session_management_subscription> ss = { };
std::shared_ptr<dnn_configuration_t> sdc = { };
......@@ -1015,7 +1030,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
bool find_pdu = sd.get()->find_pdu_session(pdu_session_id, sp);
if (nullptr == sp.get()) {
Logger::smf_app().debug("Create a new PDN connection!");
Logger::smf_app().debug("Create a new PDN connection");
sp = std::shared_ptr<smf_pdu_session>(new smf_pdu_session());
sp.get()->pdn_type.pdn_type = smreq->req.get_pdu_session_type();
sp.get()->pdu_session_id = pdu_session_id;
......@@ -1058,6 +1073,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
//smf_app_inst->process_pco_request(extended_protocol_options, pco_resp, pco_ids);
//Step 7. Address allocation based on PDN type
Logger::smf_app().debug("UE address allocation");
switch (sp->pdn_type.pdn_type) {
case PDN_TYPE_E_IPV4: {
if (!pco_ids.ci_ipv4_address_allocation_via_dhcpv4) { //use SM NAS signalling
......@@ -1166,7 +1182,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
//TODO: PDU Session authentication/authorization (Optional)
//see section 4.3.2.3@3GPP TS 23.502 and section 6.3.1@3GPP TS 24.501
Logger::smf_app().info("Create a procedure to process this message!");
Logger::smf_app().info("Create a procedure to process this message.");
session_create_sm_context_procedure *proc =
new session_create_sm_context_procedure(sp);
std::shared_ptr<smf_procedure> sproc = std::shared_ptr<smf_procedure>(proc);
......@@ -1264,7 +1280,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
void smf_context::handle_pdu_session_update_sm_context_request(
std::shared_ptr<itti_n11_update_sm_context_request> smreq) {
Logger::smf_app().info(
"Handle a PDU Session Update SM Context Request message from AMF");
"Handle a PDU Session Update SM Context Request message from an AMF");
pdu_session_update_sm_context_request sm_context_req_msg = smreq->req;
smf_n1_n2 smf_n1_n2_inst = { };
oai::smf_server::model::SmContextUpdateError smContextUpdateError = { };
......@@ -1836,13 +1852,13 @@ void smf_context::handle_pdu_session_update_sm_context_request(
//1 - UE-Requested PDU Session Establishment procedure (Section 4.3.2.2.1@3GPP TS 23.502)
//2 - UE Triggered Service Request Procedure (step 2)
Logger::smf_app().info("PDU_RES_SETUP_RSP");
Logger::smf_app().info("PDU Session Resource Setup Response Transfer");
if (sm_context_req_msg.rat_type_is_set()
and sm_context_req_msg.an_type_is_set()) {
procedure_type =
session_management_procedures_type_e::SERVICE_REQUEST_UE_TRIGGERED_STEP2;
Logger::smf_app().info(
"UE Triggered Service Request, processing N2 SM Information");
"UE-Triggered Service Request, processing N2 SM Information");
} else {
procedure_type =
session_management_procedures_type_e::PDU_SESSION_ESTABLISHMENT_UE_REQUESTED;
......@@ -1888,9 +1904,9 @@ void smf_context::handle_pdu_session_update_sm_context_request(
decoded_msg->dLQosFlowPerTNLInformation.uPTransportLayerInformation
.choice.gTPTunnel->transportLayerAddress.buf,
4);
Logger::smf_app().debug("gTP_TEID " "0x%" PRIx32 " ",
Logger::smf_app().debug("DL GTP_F-TEID (AN F-TEID) " "0x%" PRIx32 " ",
htonl(dl_teid.teid_gre_key));
Logger::smf_app().debug("uPTransportLayerInformation IP Addr %s",
Logger::smf_app().debug("uPTransportLayerInformation (AN IP Addr) %s",
conv::toString(dl_teid.ipv4_address).c_str());
smreq->req.set_dl_fteid(dl_teid);
......@@ -2030,12 +2046,10 @@ void smf_context::handle_pdu_session_update_sm_context_request(
if (!sm_context_req_msg.n1_sm_msg_is_set()
and !sm_context_req_msg.n2_sm_info_is_set()
and sm_context_req_msg.upCnx_state_is_set()) {
Logger::smf_app().info("SERVICE_REQUEST_UE_TRIGGERED_STEP1");
Logger::smf_app().info("Service Request (UE-triggered)");
Logger::smf_app().info("Service Request (UE-triggered, step 1)");
procedure_type =
session_management_procedures_type_e::SERVICE_REQUEST_UE_TRIGGERED_STEP1;
//if request accepted-> set unCnxState to ACTIVATING
//Update upCnxState
sp.get()->set_upCnx_state(upCnx_state_e::UPCNX_STATE_ACTIVATING);
......@@ -2044,9 +2058,45 @@ void smf_context::handle_pdu_session_update_sm_context_request(
sp.get()->get_qos_flows(qos_flows);
for (auto i : qos_flows) {
smreq->req.add_qfi(i.qfi.qfi);
qos_flow_context_updated qcu = { };
qcu.set_cause(REQUEST_ACCEPTED);
qcu.set_qfi(i.qfi);
qcu.set_ul_fteid(i.ul_fteid);
qcu.set_qos_profile(i.qos_profile);
sm_context_resp_pending->res.add_qos_flow_context_updated(qcu);
}
//need update UPF
update_upf = true;
sm_context_resp_pending->session_procedure_type = procedure_type;
// Create N2 SM Information: PDU Session Resource Setup Request Transfer IE
//N2 SM Information
smf_n1_n2_inst.create_n2_sm_information(
sm_context_resp_pending->res, 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);
sm_context_resp_pending->res.set_n2_sm_information(n2_sm_info_hex);
//fill the content of SmContextUpdatedData
sm_context_resp_pending->res.sm_context_updated_data = { };
sm_context_resp_pending->res.sm_context_updated_data["n2InfoContainer"]["n2InformationClass"] =
N1N2_MESSAGE_CLASS;
sm_context_resp_pending->res.sm_context_updated_data["n2InfoContainer"]["smInfo"]["PduSessionId"] =
sm_context_resp_pending->res.get_pdu_session_id();
sm_context_resp_pending->res.sm_context_updated_data["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapData"]["contentId"] =
N2_SM_CONTENT_ID;
sm_context_resp_pending->res.sm_context_updated_data["n2InfoContainer"]["smInfo"]["n2InfoContent"]["ngapIeType"] =
"PDU_RES_SETUP_REQ"; //NGAP message
sm_context_resp_pending->res.sm_context_updated_data["upCnxState"] =
"ACTIVATING";
//Update upCnxState to ACTIVATING
sp.get()->set_upCnx_state(upCnx_state_e::UPCNX_STATE_ACTIVATING);
//do not need update UPF
update_upf = false;
//TODO: If new UPF is used, need to send N4 Session Modification Request/Response to new/old UPF
//Accept the activation of UP connection and continue to using the current UPF
//TODO: Accept the activation of UP connection and select a new UPF
......@@ -2340,19 +2390,18 @@ void smf_context::handle_pdu_session_modification_network_requested(
void smf_context::insert_dnn_subscription(
const snssai_t &snssai,
std::shared_ptr<session_management_subscription> &ss) {
Logger::smf_app().info("Insert dnn subscription, key: %d",
(uint8_t) snssai.sST);
//std::unique_lock<std::recursive_mutex> lock(m_context);
//dnn_subscriptions.insert (std::make_pair <const uint8_t, std::shared_ptr<session_management_subscription> >((uint8_t)snssai.sST, ss));
dnn_subscriptions[(uint8_t) snssai.sST] = ss;
Logger::smf_app().info("Inserted DNN Subscription, key: %d",
(uint8_t) snssai.sST);
}
//------------------------------------------------------------------------------
bool smf_context::find_dnn_subscription(
const snssai_t &snssai,
std::shared_ptr<session_management_subscription> &ss) {
Logger::smf_app().info("find_dnn_subscription: %d, map size %d",
Logger::smf_app().info("Find a DNN Subscription with key: %d, map size %d",
(uint8_t) snssai.sST, dnn_subscriptions.size());
//std::unique_lock<std::recursive_mutex> lock(m_context);
if (dnn_subscriptions.count((uint8_t) snssai.sST) > 0) {
......@@ -2360,8 +2409,7 @@ bool smf_context::find_dnn_subscription(
return true;
}
Logger::smf_app().info(
"find_dnn_subscription: cannot find DNN subscription for SNSSAI %d",
Logger::smf_app().info("DNN subscription (SNSSAI %d) not found",
(uint8_t) snssai.sST);
return false;
}
......
......@@ -200,6 +200,13 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
*/
void set_default_qos_flow(const pfcp::qfi_t &qfi);
/*
* Get the default QoS flow of this PDU Session
* @param [smf_qos_flow &] flow: Default QoS flow
* @return bool: Return true if the default QoS flow exist
*/
bool get_default_qos_flow(smf_qos_flow &flow);
/*
* Find a QoS flow by its PDR ID
* @param [const pfcp::pdr_id_t &] pdr_id: PDR ID
......
......@@ -457,11 +457,11 @@ void pdu_session_update_sm_context_response::add_qos_flow_context_updated(
std::pair<uint8_t, qos_flow_context_updated>((uint8_t) flow.qfi.qfi,
flow));
Logger::smf_app().trace(
"pdu_session_update_sm_context_response::add_qos_flow_context(%d) success",
"A QoS Flow Context (QFI %d) has been added successfully",
flow.qfi.qfi);
} else {
Logger::smf_app().error(
"pdu_session_update_sm_context_response::add_qos_flow_context(%d) failed, invalid QFI",
"Failed to add a QoS Flow Context (QFI %d), invalid QFI",
flow.qfi.qfi);
}
}
......
......@@ -423,9 +423,7 @@ class pdu_session_release_sm_context_request : public pdu_session_msg {
}
;
private:
};
class pdu_session_release_sm_context_response : public pdu_session_msg {
......
......@@ -119,7 +119,7 @@ bool smf_n10::get_sm_data(
inet_ntoa(*((struct in_addr*) &smf_cfg.udm_addr.ipv4_addr))) + ":"
+ std::to_string(smf_cfg.udm_addr.port)
+ fmt::format(NUDM_SDM_GET_SM_DATA_URL, std::to_string(supi));
Logger::smf_n10().debug("[get_sm_data] UDM's URL: %s ", url.c_str());
Logger::smf_n10().debug("UDM's URL: %s ", url.c_str());
if (curl) {
CURLcode res = { };
......@@ -142,13 +142,13 @@ bool smf_n10::get_sm_data(
while (numRetries < UDM_NUMBER_RETRIES) {
res = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
Logger::smf_n10().debug("[get_sm_data] Response from UDM, Http Code: %d ",
Logger::smf_n10().debug("Response from UDM, HTTP Code: %d ",
httpCode);
if (static_cast<http_response_codes_e>(httpCode)
== http_response_codes_e::HTTP_RESPONSE_CODE_OK) {
Logger::smf_n10().debug(
"[get_sm_data] Got successful response from UDM, URL: %s ",
"Got successful response from UDM, URL: %s ",
url.c_str());
//Logger::smf_n10().debug("[get_sm_data] Http Data from UDM: %s ", *httpData.get());
try {
......@@ -157,12 +157,12 @@ bool smf_n10::get_sm_data(
break;
} catch (json::exception &e) {
Logger::smf_n10().warn(
"[get_sm_data] Couldn't Parse json data from UDM");
"Could not parse json data from UDM");
}
numRetries++;
} else {
Logger::smf_n10().warn(
"[get_sm_data] Couldn't GET response from UDM, URL %s, retry ...",
"Could not get response from UDM, URL %s, retry ...",
url.c_str());
//retry
numRetries++;
......@@ -173,13 +173,13 @@ bool smf_n10::get_sm_data(
//process the response
if (!jsonData.empty()) {
Logger::smf_n10().debug("[get_sm_data] GET response from UDM %s",
Logger::smf_n10().debug("Response from UDM %s",
jsonData.dump().c_str());
//retrieve SessionManagementSubscription and store in the context
for (nlohmann::json::iterator it = jsonData["dnnConfigurations"].begin();
it != jsonData["dnnConfigurations"].end(); ++it) {
Logger::smf_n10().debug("[get_sm_data] DNN %s", it.key().c_str());
Logger::smf_n10().debug("DNN %s", it.key().c_str());
try {
std::shared_ptr<dnn_configuration_t> dnn_configuration =
std::make_shared<dnn_configuration_t>();
......@@ -188,7 +188,7 @@ bool smf_n10::get_sm_data(
pdu_session_type_e::PDU_SESSION_TYPE_E_IPV4);
std::string default_session_type =
it.value()["pduSessionTypes"]["defaultSessionType"];
Logger::smf_n10().debug("[get_sm_data] default_session_type %s",
Logger::smf_n10().debug("Default session type %s",
default_session_type.c_str());
if (default_session_type.compare("IPV4") == 0) {
pdu_session_type.pdu_session_type =
......@@ -206,7 +206,7 @@ bool smf_n10::get_sm_data(
//Ssc_Mode
ssc_mode_t ssc_mode(ssc_mode_e::SSC_MODE_1);
std::string default_ssc_mode = it.value()["sscModes"]["defaultSscMode"];
Logger::smf_n10().debug("[get_sm_data] defaultSscMode %s",
Logger::smf_n10().debug("Default SSC Mode %s",
default_ssc_mode.c_str());
if (default_ssc_mode.compare("SSC_MODE_1") == 0) {
dnn_configuration->ssc_modes.default_ssc_mode = ssc_mode_t(
......@@ -236,15 +236,14 @@ bool smf_n10::get_sm_data(
dnn_configuration->session_ambr.downlink =
it.value()["sessionAmbr"]["downlink"];
Logger::smf_n10().debug(
"[get_sm_data] sessionAmbr uplink %s, downlink %s",
"Session AMBR Uplink %s, Downlink %s",
dnn_configuration->session_ambr.uplink.c_str(),
dnn_configuration->session_ambr.downlink.c_str());
//sdc = std::shared_ptr<dnn_configuration_t> (dnn_configuration);
subscription->insert_dnn_configuration(it.key(), dnn_configuration);
} catch (nlohmann::json::exception &e) {
Logger::smf_n10().warn(
"[get_sm_data] exception message %s, exception id %d ", e.what(),
"Exception message %s, exception id %d ", e.what(),
e.id);
return false;
}
......
......@@ -443,7 +443,7 @@ void smf_n11::send_n1n2_message_transfer_request(
//------------------------------------------------------------------------------
void smf_n11::send_pdu_session_update_sm_context_response(
std::shared_ptr<itti_n11_update_sm_context_response> sm_context_res) {
Logger::smf_n11().debug("Send PDUSessionUpdateContextResponse to AMF ");
Logger::smf_n11().debug("Send PDUSession_UpdateSMContext Response to AMF.");
switch (sm_context_res->session_procedure_type) {
......@@ -591,7 +591,7 @@ void smf_n11::send_pdu_session_update_sm_context_response(
Pistache::Http::Code code) {
Logger::smf_n11().debug(
"[SMF N11] Send PDUSessionUpdateContextResponse to AMF!");
"Send PDUSession_UpdateSMContext Response to AMF.");
nlohmann::json json_data = { };
to_json(json_data, smContextUpdateError);
......@@ -611,7 +611,7 @@ void smf_n11::send_pdu_session_update_sm_context_response(
oai::smf_server::model::SmContextUpdateError &smContextUpdateError,
Pistache::Http::Code code, std::string &n1_sm_msg) {
Logger::smf_n11().debug(
"[SMF N11] Send PDUSessionUpdateContextResponse to AMF!");
"Send PDUSession_UpdateSMContext Response to AMF.");
std::string boundary = "----Boundary";
nlohmann::json json_part = { };
......@@ -634,7 +634,7 @@ void smf_n11::send_pdu_session_create_sm_context_response(
oai::smf_server::model::SmContextCreateError &smContextCreateError,
Pistache::Http::Code code, std::string &n1_sm_msg) {
Logger::smf_n11().debug(
"[SMF N11] Send PDUSessionCreateContextResponse to AMF!");
"Send PDUSession_CreateSMContext Response to AMF.");
std::string boundary = "----Boundary";
nlohmann::json json_part = { };
......@@ -657,7 +657,7 @@ void smf_n11::send_pdu_session_update_sm_context_response(
oai::smf_server::model::SmContextUpdatedData &smContextUpdatedData,
Pistache::Http::Code code) {
Logger::smf_n11().debug(
"[SMF N11] Send PDUSessionUpdateContextResponse to AMF!");
"Send PDUSession_UpdateSMContext Response to AMF.");
nlohmann::json json_data = { };
to_json(json_data, smContextUpdatedData);
if (!json_data.empty()) {
......@@ -676,7 +676,7 @@ void smf_n11::send_pdu_session_create_sm_context_response(
oai::smf_server::model::SmContextCreatedData &smContextCreatedData,
Pistache::Http::Code code) {
Logger::smf_n11().debug(
"[SMF N11] Send PDUSessionUpdateContextResponse to AMF!");
"Send PDUSession_CreateSMContext Response to AMF.");
nlohmann::json json_data = { };
to_json(json_data, smContextCreatedData);
if (!json_data.empty()) {
......@@ -699,7 +699,7 @@ void smf_n11::send_n1n2_message_transfer_request(
void smf_n11::send_pdu_session_release_sm_context_response(
Pistache::Http::ResponseWriter &httpResponse, Pistache::Http::Code code) {
Logger::smf_n11().debug(
"[SMF N11] Send PDUSessionReleaseContextResponse to AMF!");
"Send PDUSession_ReleaseSMContext Response to AMF.");
httpResponse.send(code);
}
......@@ -710,7 +710,7 @@ void smf_n11::send_pdu_session_release_sm_context_response(
Pistache::Http::Code code) {
Logger::smf_n11().debug(
"[SMF N11] Send PDUSessionReleaseContextResponse to AMF!");
"Send PDUSession_ReleaseSMContext Response to AMF.");
nlohmann::json json_data = { };
to_json(json_data, problem);
if (!json_data.empty()) {
......
......@@ -37,8 +37,10 @@
#include <pistache/http.h>
#include <pistache/mime.h>
#include <arpa/inet.h>
#include "smf.h"
extern "C" {
#include "dynamic_memory_check.h"
#include "nas_message.h"
#include "Ngap_NGAP-PDU.h"
#include "Ngap_ProtocolIE-Field.h"
......@@ -55,34 +57,16 @@ extern "C" {
#include "Ngap_UL-NGU-UP-TNLModifyItem.h"
#include "Ngap_QosFlowAddOrModifyRequestItem.h"
#include "Ngap_PDUSessionResourceReleaseCommandTransfer.h"
#include "dynamic_memory_check.h"
#include "Ngap_PDUSessionResourceReleaseResponseTransfer.h"
#include "Ngap_QosFlowAddOrModifyResponseItem.h"
#include "Ngap_QosFlowAddOrModifyResponseList.h"
}
#define BUF_LEN 512
using namespace Pistache::Http;
using namespace Pistache::Http::Mime;
//TODO: move to a common file
#define AMF_CURL_TIMEOUT_MS 100L
#define AMF_NUMBER_RETRIES 3
using namespace smf;
extern smf_app *smf_app_inst;
/*
* To read content of the response from UDM
*/
static std::size_t callback(const char *in, std::size_t size, std::size_t num,
std::string *out) {
const std::size_t totalBytes(size * num);
out->append(in, totalBytes);
return totalBytes;
}
//-----------------------------------------------------------------------------------------------------
void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
uint8_t n1_msg_type,
......@@ -91,16 +75,12 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
Logger::smf_app().info("Create N1 SM Container, n1 message type %d",
n1_msg_type);
//To be updated according to NAS implementation
int size = NAS_MESSAGE_SECURITY_HEADER_SIZE;
int bytes = { 0 };
int length = BUF_LEN;
unsigned char data[BUF_LEN] = { '\0' };
memset(data, 0, sizeof(data));
nas_message_t nas_msg = { };
memset(&nas_msg, 0, sizeof(nas_message_t));
nas_msg.header.extended_protocol_discriminator =
EPD_5GS_SESSION_MANAGEMENT_MESSAGES;
nas_msg.header.security_header_type = SECURITY_HEADER_TYPE_NOT_PROTECTED;
......@@ -108,6 +88,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
//nas_msg.header.message_authentication_code = 0xffee;
SM_msg *sm_msg = &nas_msg.plain.sm;
//Fill the content of SM header
//Extended Protocol Discriminator
sm_msg->header.extended_protocol_discriminator =
......@@ -115,13 +96,11 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
//PDU Session Identity
sm_msg->header.pdu_session_identity = msg.get_pdu_session_id();
//Depending on message type, encode N1 message accordingly
switch (n1_msg_type) {
//PDU Session Establishment Accept
case PDU_SESSION_ESTABLISHMENT_ACCEPT: {
//PDU Session Establishment Accept is including in the N1N2MessageTransfer Request
//sent from SMF to AMF (PDU Session Establishment procedure)
//PDU Session Establishment Accept is including in the N1N2MessageTransfer Request sent from SMF to AMF (PDU Session Establishment procedure)
if (msg.get_msg_type() != PDU_SESSION_CREATE_SM_CONTEXT_RESPONSE) {
Logger::smf_app().error(
"Cannot create an PDU Session Establishment Accept for this message (type %d)",
......@@ -135,8 +114,6 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
//get default QoS value
qos_flow_context_updated qos_flow = { };
qos_flow = sm_context_res.get_qos_flow_context();
//TODO: to be completed
//get the default QoS profile and assign to the NAS message
Logger::smf_app().info(
"PDU_SESSION_ESTABLISHMENT_ACCEPT, encode starting...");
......@@ -149,11 +126,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
sm_msg->header.message_type = PDU_SESSION_ESTABLISHMENT_ACCEPT;
Logger::smf_app().debug(
"NAS header, Extended Protocol Discriminator 0x%x, Security Header Type 0x%x",
nas_msg.header.extended_protocol_discriminator,
nas_msg.header.security_header_type);
Logger::smf_app().debug(
"SM header, Extended Protocol Discriminator 0x%x, PDU Session Identity 0x%x, Procedure Transaction Identity: 0x%x, Message Type: 0x%x",
"SM header, Extended Protocol Discriminator 0x%x, PDU Session Identity %d, Procedure Transaction Identity: %d, Message Type: %d",
sm_msg->header.extended_protocol_discriminator,
sm_msg->header.pdu_session_identity,
sm_msg->header.procedure_transaction_identity,
......@@ -164,7 +137,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
sm_msg->pdu_session_establishment_accept._pdusessiontype
.pdu_session_type_value = sm_context_res.get_pdu_session_type();
Logger::smf_app().debug(
"PDU Session Type: %#0x",
"PDU Session Type: %d",
sm_msg->pdu_session_establishment_accept._pdusessiontype
.pdu_session_type_value);
......@@ -172,25 +145,28 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
sm_msg->pdu_session_establishment_accept.sscmode.ssc_mode_value =
SSC_MODE_1; //TODO: get from sm_context_res
Logger::smf_app().debug(
"SSC Mode: %#0x",
"SSC Mode: %d",
sm_msg->pdu_session_establishment_accept.sscmode.ssc_mode_value);
//authorized QoS rules of the PDU session: QOSRules (Section 6.2.5@3GPP TS 24.501)
//(Section 6.4.1.3@3GPP TS 24.501 V16.1.0) Make sure that the number of the packet filters used in the authorized QoS rules of the PDU Session does not
// exceed the maximum number of packet filters supported by the UE for the PDU session
sm_msg->pdu_session_establishment_accept.qosrules.lengthofqosrulesie = qos_flow.qos_rules.size();
sm_msg->pdu_session_establishment_accept.qosrules.lengthofqosrulesie =
qos_flow.qos_rules.size();
sm_msg->pdu_session_establishment_accept.qosrules.qosrulesie =
(QOSRulesIE*) calloc(qos_flow.qos_rules.size(), sizeof(QOSRulesIE));
int i = 0;
for (auto rule: qos_flow.qos_rules) {
for (auto rule : qos_flow.qos_rules) {
sm_msg->pdu_session_establishment_accept.qosrules.qosrulesie[i]
.qosruleidentifer = rule.second.qosruleidentifer;
memcpy(&sm_msg->pdu_session_establishment_accept.qosrules.qosrulesie[i], &rule.second, sizeof(QOSRulesIE));
memcpy(&sm_msg->pdu_session_establishment_accept.qosrules.qosrulesie[i],
&rule.second, sizeof(QOSRulesIE));
i++;
}
//SessionAMBR
Logger::smf_app().debug("Get default values for Session-AMBR");
//TODO: get from subscription DB
supi_t supi = sm_context_res.get_supi();
supi64_t supi64 = smf_supi_to_u64(supi);
......@@ -215,7 +191,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
sm_msg->pdu_session_establishment_accept._5gsmcause =
static_cast<uint8_t>(sm_cause);
Logger::smf_app().debug(
"5GSM Cause: %#0x",
"5GSM Cause: %d",
sm_msg->pdu_session_establishment_accept._5gsmcause);
//PDUAddress
......@@ -243,7 +219,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
sm_msg->pdu_session_establishment_accept.pduaddress.pdu_session_type_value =
static_cast<uint8_t>(PDU_SESSION_TYPE_E_IPV4);
Logger::smf_app().debug("PDU Address %s",
Logger::smf_app().debug("UE Address %s",
conv::toString(paa.ipv4_address).c_str());
//GPRSTimer
......@@ -267,7 +243,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
}
Logger::smf_app().debug(
"SNSSAI SST %#0x, SD %#0x",
"SNSSAI SST %d, SD %#0x",
sm_msg->pdu_session_establishment_accept.snssai.sst,
sm_msg->pdu_session_establishment_accept.snssai.sd);
......@@ -292,8 +268,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
sc.get()->get_default_qos_flow_description(
sm_msg->pdu_session_establishment_accept.qosflowdescriptions
.qosflowdescriptionscontents[0],
sm_context_res.get_pdu_session_type(),
qos_flow.qfi);
sm_context_res.get_pdu_session_type(), qos_flow.qfi);
}
//ExtendedProtocolConfigurationOptions
......@@ -320,19 +295,16 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
printf("%02x ", data[i]);
printf(" (bytes %d)\n", bytes);
#endif
std::string n1Message((char*) data, bytes);
nas_msg_str = n1Message;
//free memory
// free_wrapper(
// (void**) &sm_msg->pdu_session_establishment_accept.qosrules.qosrulesie[0]
// .packetfilterlist.create_modifyandadd_modifyandreplace);
free_wrapper(
(void**) &sm_msg->pdu_session_establishment_accept.qosrules.qosrulesie);
free_wrapper(
(void**) &sm_msg->pdu_session_establishment_accept.qosflowdescriptions
.qosflowdescriptionscontents);
}
break;
......@@ -515,7 +487,8 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
Logger::smf_app().debug("QoS Rule to be updated (Id %d)",
qos_rules[i].qosruleidentifer);
//sm_msg->pdu_session_modification_command.qosrules.qosrulesie[i] = qos_rules[i];
memcpy (&sm_msg->pdu_session_modification_command.qosrules.qosrulesie[i], &qos_rules[i], sizeof(QOSRulesIE));
memcpy(&sm_msg->pdu_session_modification_command.qosrules.qosrulesie[i],
&qos_rules[i], sizeof(QOSRulesIE));
}
//MappedEPSBearerContexts
......@@ -536,8 +509,7 @@ void smf_n1_n2::create_n1_sm_container(pdu_session_msg &msg,
sm_msg->pdu_session_modification_command.qosflowdescriptions
.qosflowdescriptionscontents[0],
sm_context_res.get_pdu_session_type(),
qos_rules[0].qosflowidentifer
);
qos_rules[0].qosflowidentifer);
}
//Encode NAS message
......@@ -685,6 +657,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
//1 - N1N2MessageTransfer Request (Accept, PDU Session Establishment procedure - UE initiated) (PDU Session Create SM Context)
//2 - PDU Session Update SM Context Response​ (Service Request, step 2)
Logger::smf_app().info("PDU Session Resource Setup Request Transfer");
Ngap_PDUSessionResourceSetupRequestTransfer_t *ngap_IEs = nullptr;
ngap_IEs = (Ngap_PDUSessionResourceSetupRequestTransfer_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceSetupRequestTransfer_t));
......@@ -699,7 +672,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
qos_flow = sm_context_res.get_qos_flow_context();
Logger::smf_app().debug(
"UL F-TEID, Teid" "0x%" PRIx32 ", IP Address %s",
"UL F-TEID, TEID " "0x%" PRIx32 ", IP Address %s",
qos_flow.ul_fteid.teid_gre_key,
conv::toString(qos_flow.ul_fteid.ipv4_address).c_str());
Logger::smf_app().info(
......@@ -711,7 +684,6 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
//Case 2: in PDU Session Update SM Context Response​ (Service Request, step 2)​
case PDU_SESSION_UPDATE_SM_CONTEXT_RESPONSE: {
Logger::smf_app().info("PDU_SESSION_UPDATE_SM_CONTEXT_RESPONSE");
pdu_session_update_sm_context_response &sm_context_res =
static_cast<pdu_session_update_sm_context_response&>(msg);
......@@ -720,15 +692,14 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
sm_context_res.get_all_qos_flow_context_updateds(qos_flows);
for (std::map<uint8_t, qos_flow_context_updated>::iterator it =
qos_flows.begin(); it != qos_flows.end(); ++it)
Logger::smf_app().debug("qos_flow_context_updated qfi %d",
Logger::smf_app().debug("QoS Flow context to be updated QFI %d",
it->first);
//TODO: support only 1 qos flow
qos_flow = qos_flows.begin()->second;
Logger::smf_app().debug("UL F-TEID, Teid" "0x%" PRIx32 "",
qos_flow.ul_fteid.teid_gre_key);
Logger::smf_app().debug(
"UL F-TEID, IP Addr: %s",
"UL F-TEID, TEID " "0x%" PRIx32 ", IP Address %s",
qos_flow.ul_fteid.teid_gre_key,
conv::toString(qos_flow.ul_fteid.ipv4_address).c_str());
Logger::smf_app().info(
"QoS parameters: QFI %d, Priority level %d, ARP priority level %d",
......@@ -897,7 +868,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
ASN_SEQUENCE_ADD(&ngap_IEs->protocolIEs.list, qosFlowSetupRequestList);
//encode
size_t buffer_size = 512;
size_t buffer_size = BUF_LEN;
char *buffer = (char*) calloc(1, buffer_size);
asn_enc_rval_t er = aper_encode_to_buffer(
......@@ -905,7 +876,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
ngap_IEs, (void*) buffer, buffer_size);
if (er.encoded < 0) {
Logger::smf_app().warn(
"[Create N2 SM Information] NGAP PDU Session Resource Setup Request Transfer encode failed, er.encoded: %d",
"NGAP PDU Session Resource Setup Request Transfer encode failed, er.encoded: %d",
er.encoded);
return;
}
......@@ -1161,7 +1132,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
//TODO
//encode
size_t buffer_size = 512;
size_t buffer_size = BUF_LEN;
char *buffer = (char*) calloc(1, buffer_size);
asn_enc_rval_t er = aper_encode_to_buffer(
......@@ -1286,7 +1257,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
qos_flow_item);
//encode
size_t buffer_size = 512;
size_t buffer_size = BUF_LEN;
char *buffer = (char*) calloc(1, buffer_size);
asn_enc_rval_t er = aper_encode_to_buffer(
......@@ -1326,7 +1297,6 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
}
break;
case n2_sm_info_type_e::PDU_RES_MOD_RSP: {
//PDU Session Resource Modify Response Transfer IE
//for testing purpose
......@@ -1340,48 +1310,58 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
//struct Ngap_QosFlowPerTNLInformationList *additionalDLQosFlowPerTNLInformation; /* OPTIONAL */
// struct Ngap_QosFlowListWithCause *qosFlowFailedToAddOrModifyList; /* OPTIONAL */
Ngap_PDUSessionResourceModifyResponseTransfer_t *ngap_resource_response_transfer =
nullptr;
ngap_resource_response_transfer =
(Ngap_PDUSessionResourceModifyResponseTransfer_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceModifyResponseTransfer_t));
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation =
(Ngap_UPTransportLayerInformation*) calloc(
1, sizeof(Ngap_UPTransportLayerInformation));
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation = (Ngap_UPTransportLayerInformation *) calloc (1, sizeof (Ngap_UPTransportLayerInformation));
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->present = Ngap_UPTransportLayerInformation_PR_gTPTunnel;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel = (Ngap_GTPTunnel_t*) calloc(1, sizeof(Ngap_GTPTunnel_t));
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel->transportLayerAddress
.size = 4;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel->transportLayerAddress
.buf = (uint8_t*) calloc(4, sizeof(uint8_t));
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel->transportLayerAddress
.buf[0] = 0xc0;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel->transportLayerAddress
.buf[1] = 0xa8;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel->transportLayerAddress
.buf[2] = 0xf8;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel->transportLayerAddress
.buf[3] = 0x9f;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel->transportLayerAddress
.bits_unused = 0;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel->gTP_TEID.size = 4;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel->gTP_TEID.buf =
(uint8_t*) calloc(4, sizeof(uint8_t));
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel->gTP_TEID.buf[0] = 0x00;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel->gTP_TEID.buf[1] = 0x00;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel->gTP_TEID.buf[2] = 0x00;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel->gTP_TEID.buf[3] = 0x01;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->present =
Ngap_UPTransportLayerInformation_PR_gTPTunnel;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice
.gTPTunnel = (Ngap_GTPTunnel_t*) calloc(1, sizeof(Ngap_GTPTunnel_t));
ngap_resource_response_transfer->qosFlowAddOrModifyResponseList = (Ngap_QosFlowAddOrModifyResponseList_t*) calloc(1, sizeof (Ngap_QosFlowAddOrModifyResponseList_t));
Ngap_QosFlowAddOrModifyResponseItem *qosFlowAddOrModifyResponseItem = nullptr;
qosFlowAddOrModifyResponseItem = (Ngap_QosFlowAddOrModifyResponseItem*) calloc (1, sizeof(Ngap_QosFlowAddOrModifyResponseItem));
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice
.gTPTunnel->transportLayerAddress.size = 4;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice
.gTPTunnel->transportLayerAddress.buf = (uint8_t*) calloc(
4, sizeof(uint8_t));
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice
.gTPTunnel->transportLayerAddress.buf[0] = 0xc0;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice
.gTPTunnel->transportLayerAddress.buf[1] = 0xa8;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice
.gTPTunnel->transportLayerAddress.buf[2] = 0xf8;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice
.gTPTunnel->transportLayerAddress.buf[3] = 0x9f;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice
.gTPTunnel->transportLayerAddress.bits_unused = 0;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice
.gTPTunnel->gTP_TEID.size = 4;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice
.gTPTunnel->gTP_TEID.buf = (uint8_t*) calloc(4, sizeof(uint8_t));
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice
.gTPTunnel->gTP_TEID.buf[0] = 0x00;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice
.gTPTunnel->gTP_TEID.buf[1] = 0x00;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice
.gTPTunnel->gTP_TEID.buf[2] = 0x00;
ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice
.gTPTunnel->gTP_TEID.buf[3] = 0x01;
ngap_resource_response_transfer->qosFlowAddOrModifyResponseList =
(Ngap_QosFlowAddOrModifyResponseList_t*) calloc(
1, sizeof(Ngap_QosFlowAddOrModifyResponseList_t));
Ngap_QosFlowAddOrModifyResponseItem *qosFlowAddOrModifyResponseItem =
nullptr;
qosFlowAddOrModifyResponseItem =
(Ngap_QosFlowAddOrModifyResponseItem*) calloc(
1, sizeof(Ngap_QosFlowAddOrModifyResponseItem));
qosFlowAddOrModifyResponseItem->qosFlowIdentifier = 60;
ASN_SEQUENCE_ADD(
......@@ -1389,7 +1369,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
qosFlowAddOrModifyResponseItem);
//encode
size_t buffer_size = 512;
size_t buffer_size = BUF_LEN;
char *buffer = (char*) calloc(1, buffer_size);
asn_enc_rval_t er = aper_encode_to_buffer(
......@@ -1414,20 +1394,23 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
//free memory
free_wrapper(
(void**) &ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel->transportLayerAddress
.buf);
(void**) &ngap_resource_response_transfer->dL_NGU_UP_TNLInformation
->choice.gTPTunnel->transportLayerAddress.buf);
free_wrapper(
(void**) &ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel->gTP_TEID.buf);
(void**) &ngap_resource_response_transfer->dL_NGU_UP_TNLInformation
->choice.gTPTunnel->gTP_TEID.buf);
free_wrapper(
(void**) &ngap_resource_response_transfer->dL_NGU_UP_TNLInformation->choice.gTPTunnel);
(void**) &ngap_resource_response_transfer->dL_NGU_UP_TNLInformation
->choice.gTPTunnel);
free_wrapper((void**) &qosFlowAddOrModifyResponseItem);
free_wrapper((void**) &ngap_resource_response_transfer->qosFlowAddOrModifyResponseList);
free_wrapper(
(void**) &ngap_resource_response_transfer
->qosFlowAddOrModifyResponseList);
free_wrapper((void**) &ngap_resource_response_transfer);
free_wrapper((void**) &buffer);
}
break;
//PDU Session Resource Release Command Transfer
case n2_sm_info_type_e::PDU_RES_REL_CMD: {
//PDU Session Resource Release Command Transfer IE
......@@ -1463,7 +1446,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
ngap_resource_release_command_transfer->cause.choice.radioNetwork = 1;
//encode
size_t buffer_size = 512;
size_t buffer_size = BUF_LEN;
char *buffer = (char*) calloc(1, buffer_size);
asn_enc_rval_t er = aper_encode_to_buffer(
......@@ -1509,7 +1492,7 @@ void smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
//TODO: To be completed, here's an example
//encode
size_t buffer_size = 512;
size_t buffer_size = BUF_LEN;
char *buffer = (char*) calloc(1, buffer_size);
asn_enc_rval_t er = aper_encode_to_buffer(
......@@ -1571,17 +1554,8 @@ int smf_n1_n2::decode_n1_sm_container(nas_message_t &nas_msg,
//decode the NAS message (using NAS lib)
decoder_rc = nas_message_decode(data, &nas_msg, data_len, nullptr,
&decode_status);
Logger::smf_app().debug("NAS message type 0x%x ",
nas_msg.plain.sm.header.message_type);
Logger::smf_app().debug(
"NAS header decode, Extended protocol discriminator 0x%x, Security header type 0x%x",
nas_msg.header.extended_protocol_discriminator,
nas_msg.header.security_header_type);
Logger::smf_app().debug(
"NAS message, Extended protocol discriminator 0x%x, PDU session identity 0x%x, Procedure transaction identity 0x%x, Message type 0x%x",
"NAS message, Extended Protocol Discriminator 0x%x, PDU Session Identity 0x%x, Procedure Transaction Identity 0x%x, Message Type 0x%x",
nas_msg.plain.sm.header.extended_protocol_discriminator,
nas_msg.plain.sm.header.pdu_session_identity,
nas_msg.plain.sm.header.procedure_transaction_identity,
......
......@@ -99,7 +99,7 @@ int session_create_sm_context_procedure::run(
std::shared_ptr<itti_n11_create_sm_context_response> sm_context_resp,
std::shared_ptr<smf::smf_context> sc) {
Logger::smf_app().info("[SMF Procedure] Create SM Context Request");
Logger::smf_app().info("Perform a procedure - Create SM Context Request");
// TODO check if compatible with ongoing procedures if any
pfcp::node_id_t up_node_id = { };
if (not pfcp_associations::get_instance().select_up_node(
......@@ -216,8 +216,7 @@ int session_create_sm_context_procedure::run(
sm_context_req->req.get_dnn(), default_qos);
//Default QoS Flow - Non GBR, qfi = 5qi
qfi.qfi = default_qos._5qi;
Logger::smf_app().info("session_create_sm_context_procedure default qfi %d",
qfi.qfi);
Logger::smf_app().info("Default qfi %d", qfi.qfi);
//Packet detection information
pdi.set(source_interface); //source interface
......@@ -261,7 +260,7 @@ int session_create_sm_context_procedure::run(
flow.pdr_id_ul = pdr_id;
flow.pdu_session_id = sm_context_req->req.get_pdu_session_id();
//default QoS profile
flow.qfi = default_qos._5qi;
flow.qfi.qfi = default_qos._5qi;
flow.qos_profile._5qi = default_qos._5qi;
flow.qos_profile.arp = default_qos.arp;
flow.qos_profile.priority_level = default_qos.priority_level;
......@@ -313,7 +312,7 @@ void session_create_sm_context_procedure::handle_itti_msg(
itti_n4_session_establishment_response &resp,
std::shared_ptr<smf::smf_context> sc) {
Logger::smf_app().info(
"session_create_sm_context_procedure handle itti_n4_session_establishment_response: pdu-session-id %d",
"Handle N4 Session Establishment Response (PDU Session Id %d)",
n11_trigger.get()->req.get_pdu_session_id());
cause_value_5gsm_e cause_n1 = { cause_value_5gsm_e::CAUSE_0_UNKNOWN };
......@@ -357,40 +356,34 @@ void session_create_sm_context_procedure::handle_itti_msg(
}
}
//get the default QoS profile
pfcp::qfi_t qfi = { };
subscribed_default_qos_t default_qos = { };
sc.get()->get_default_qos(n11_triggered_pending->res.get_snssai(),
n11_triggered_pending->res.get_dnn(), default_qos);
qfi.qfi = default_qos._5qi;
//TODO: how about pdu_session_id??
smf_qos_flow default_qos_flow = { };
//flow_updated info will be used to construct N1,N2 container
qos_flow_context_updated flow_updated = { };
smf_qos_flow flow = { };
//smf_qos_flow flow = { };
QOSRulesIE qos_rule = { };
flow_updated.set_cause(REQUEST_ACCEPTED);
if (not sps->get_qos_flow(qfi, flow)) {
if (not sps->get_default_qos_flow(default_qos_flow)) {
flow_updated.set_cause(SYSTEM_FAILURE);
} else {
if (flow.ul_fteid.is_zero()) {
if (default_qos_flow.ul_fteid.is_zero()) {
flow_updated.set_cause(SYSTEM_FAILURE);
} else {
flow_updated.set_ul_fteid(flow.ul_fteid); //tunnel info
flow_updated.set_ul_fteid(default_qos_flow.ul_fteid); //tunnel info
}
if (sps->get_default_qos_rule(qos_rule)) {
flow_updated.add_qos_rule(qos_rule);
// qos_rule.qosruleidentifer = 2;
// flow_updated.add_qos_rule(qos_rule);
}
}
flow_updated.set_qfi(qfi);
flow_updated.set_qfi(default_qos_flow.qfi);
qos_profile_t profile = { };
profile.arp = default_qos.arp;
profile = default_qos_flow.qos_profile;
flow_updated.set_qos_profile(profile);
//qos_flow.set_arp(default_qos.arp);
flow_updated.set_priority_level(default_qos.priority_level);
flow_updated.set_priority_level(
default_qos_flow.qos_profile.priority_level);
}
//TODO: Set RQA (optional)
n11_triggered_pending->res.set_qos_flow_context(flow_updated);
......@@ -515,7 +508,7 @@ int session_update_sm_context_procedure::run(
bool send_n4 = false;
Logger::smf_app().info("[SMF Procedure] Update SM Context Request");
Logger::smf_app().info("Perform a procedure - Update SM Context Request");
// TODO check if compatible with ongoing procedures if any
pfcp::node_id_t up_node_id = { };
if (not pfcp_associations::get_instance().select_up_node(
......@@ -544,23 +537,23 @@ int session_update_sm_context_procedure::run(
sm_context_req_msg.get_qfis(list_of_qfis_to_be_modified);
for (auto i : list_of_qfis_to_be_modified) {
Logger::smf_app().debug("qfi to be modified: %d", i.qfi);
Logger::smf_app().debug("QoS Flow to be modified (QFI %d)", i.qfi);
}
Logger::smf_app().debug(
"Update SM Context procedure, session_procedure_type: %s",
"Session procedure type: %s",
session_management_procedures_type_e2str[static_cast<int>(session_procedure_type)]
.c_str());
switch (session_procedure_type) {
/*
case session_management_procedures_type_e::SERVICE_REQUEST_UE_TRIGGERED_STEP1: {
//PFCP Session Modification to delete AN Tunnel info
for (auto qfi : list_of_qfis_to_be_modified) {
smf_qos_flow flow = { };
if (!sps->get_qos_flow(qfi, flow)) { //no QoS flow found
Logger::smf_app().error(
"Update SM Context procedure: could not found QoS flow with QFI %d",
Logger::smf_app().error("Could not found any QoS flow with QFI %d",
qfi.qfi);
//Set cause to SYSTEM_FAILURE and send response
qos_flow_context_updated qcu = { };
......@@ -575,7 +568,8 @@ int session_update_sm_context_procedure::run(
//if FAR DL exist -> remove it
if ((flow.far_id_dl.first) && (flow.far_id_dl.second.far_id)) {
Logger::smf_app().debug(
"Update SM Context procedure: send a request to remove FAR DL at UPF");
"Send a request to remove FAR DL at UPF (QFI %d, FAR ID " "0x%" PRIx32 ")",
flow.qfi, flow.far_id_dl.second.far_id);
// Remove FAR
far_id.far_id = flow.far_id_dl.second.far_id;
pfcp::remove_far remove_far = { };
......@@ -589,6 +583,9 @@ int session_update_sm_context_procedure::run(
if (flow.pdr_id_dl.rule_id) {
Logger::smf_app().debug(
"Update SM Context procedure: send a request to remove PDR DL at UPF");
Logger::smf_app().debug(
"Send a request to remove PDR DL at UPF (QFI %d, PDR ID " "0x%" PRIx16 ")",
flow.qfi, flow.pdr_id_dl.rule_id);
//Remove PDR DL
pdr_id.rule_id = flow.pdr_id_dl.rule_id;
pfcp::remove_pdr remove_pdr = { };
......@@ -610,6 +607,7 @@ int session_update_sm_context_procedure::run(
}
break;
*/
case session_management_procedures_type_e::PDU_SESSION_ESTABLISHMENT_UE_REQUESTED:
case session_management_procedures_type_e::SERVICE_REQUEST_UE_TRIGGERED_STEP2:
......@@ -623,8 +621,7 @@ int session_update_sm_context_procedure::run(
for (auto qfi : list_of_qfis_to_be_modified) {
smf_qos_flow flow = { };
if (!sps->get_qos_flow(qfi, flow)) { //no QoS flow found
Logger::smf_app().error(
"Update SM Context procedure: could not found QoS flow with QFI %d",
Logger::smf_app().error("could not found any QoS flow with QFI %d",
qfi.qfi);
//Set cause to SYSTEM_FAILURE and send response
qos_flow_context_updated qcu = { };
......@@ -633,20 +630,23 @@ int session_update_sm_context_procedure::run(
n11_triggered_pending->res.add_qos_flow_context_updated(qcu);
continue;
}
Logger::smf_app().debug(
"FAR ID DL first %d, FAR DL ID second " "0x%" PRIx32 " ",
flow.far_id_dl.first, flow.far_id_dl.second.far_id);
pfcp::far_id_t far_id = { };
pfcp::pdr_id_t pdr_id = { };
if ((dl_fteid == flow.dl_fteid) and (not flow.released)) {
Logger::smf_app().debug(
"Update SM Context procedure: QFI %d dl_fteid unchanged",
qfi.qfi);
Logger::smf_app().debug("QFI %d dl_fteid unchanged", qfi.qfi);
qos_flow_context_updated qcu = { };
qcu.set_cause(REQUEST_ACCEPTED);
qcu.set_qfi(qfi);
n11_triggered_pending->res.add_qos_flow_context_updated(qcu);
continue;
} else if ((flow.far_id_dl.first)
&& (flow.far_id_dl.second.far_id)) {
Logger::smf_app().debug("Update SM Context procedure: Update FAR DL");
} else if ((flow.far_id_dl.first) && (flow.far_id_dl.second.far_id)) {
Logger::smf_app().debug("Update FAR DL " "0x%" PRIx32 " ",
flow.far_id_dl.second.far_id);
// Update FAR
far_id.far_id = flow.far_id_dl.second.far_id;
pfcp::update_far update_far = { };
......@@ -671,7 +671,7 @@ int session_update_sm_context_procedure::run(
flow.far_id_dl.first = true;
} else {
Logger::smf_app().debug("Update SM Context procedure: Create FAR DL");
Logger::smf_app().debug("Create FAR DL");
//Create FAR
pfcp::create_far create_far = { };
pfcp::apply_action_t apply_action = { };
......@@ -712,11 +712,12 @@ int session_update_sm_context_procedure::run(
send_n4 = true;
flow.far_id_dl.first = true;
flow.far_id_dl.second = far_id;
flow.far_id_dl.second.far_id = far_id.far_id;
Logger::smf_app().debug("FAR DL ID " "0x%" PRIx32 " ", far_id.far_id);
}
if (not flow.pdr_id_dl.rule_id) {
Logger::smf_app().debug("Update SM Context procedure, Create PDR DL");
Logger::smf_app().debug("Create PDR DL");
//-------------------
// IE create_pdr
//-------------------
......@@ -771,11 +772,14 @@ int session_update_sm_context_procedure::run(
send_n4 = true;
flow.pdr_id_dl = pdr_id;
flow.pdr_id_dl.rule_id = pdr_id.rule_id;
Logger::smf_app().debug("PDR DL ID " "0x%" PRIx16 " ",
pdr_id.rule_id);
} else {
Logger::smf_app().debug(
"Update SM Context procedure: Update FAR, qos_flow.pdr_id_dl.rule_id %d",
flow.pdr_id_dl.rule_id);
"Update FAR, PDR DL Rule Id " "0x%" PRIx16 ", 0x%" PRIx32 " ",
flow.pdr_id_dl.rule_id, flow.far_id_dl.second.far_id);
/*
// Update FAR
far_id.far_id = flow.far_id_ul.second.far_id;
pfcp::update_far update_far = { };
......@@ -790,6 +794,40 @@ int session_update_sm_context_procedure::run(
send_n4 = true;
flow.far_id_dl.first = true;
*/
pfcp::update_pdr update_pdr = { };
pfcp::precedence_t precedence = { };
pfcp::pdi pdi = { };
pfcp::ue_ip_address_t ue_ip_address = { };
pfcp::source_interface_t source_interface = { };
if (sps->ipv4) {
ue_ip_address.v4 = 1;
ue_ip_address.ipv4_address.s_addr = sps->ipv4_address.s_addr;
}
if (sps->ipv6) {
ue_ip_address.v6 = 1;
ue_ip_address.ipv6_address = sps->ipv6_address;
}
precedence.precedence = flow.precedence.precedence; //TODO: should be verified
source_interface.interface_value = pfcp::INTERFACE_VALUE_CORE;
pdi.set(source_interface);
pdi.set(ue_ip_address);
update_pdr.set(flow.pdr_id_dl);
update_pdr.set(precedence);
update_pdr.set(pdi);
update_pdr.set(flow.far_id_dl.second);
// Add IEs to message
n4_ser->pfcp_ies.set(update_pdr);
send_n4 = true;
Logger::smf_app().debug("PDR DL ID " "0x%" PRIx16 " updated",
flow.pdr_id_dl.rule_id);
}
// after a release flows
if (not flow.ul_fteid.is_zero()) {
......@@ -908,9 +946,8 @@ void session_update_sm_context_procedure::handle_itti_msg(
std::string n2_sm_info, n2_sm_info_hex;
Logger::smf_app().info(
"Handle itti_n4_session_modification_response: pdu-session-id %d",
"Handle N4 Session Modification Response (PDU Session Id %d)",
n11_trigger.get()->req.get_pdu_session_id());
//TODO: to be completed
pfcp::cause_t cause = { };
::cause_t cause_gtp = { .cause_value = REQUEST_ACCEPTED };
......@@ -925,15 +962,16 @@ void session_update_sm_context_procedure::handle_itti_msg(
n11_trigger->req.get_qfis(list_of_qfis_to_be_modified);
Logger::smf_app().debug(
"Update SM Context procedure, session_procedure_type: %s",
"Session procedure type: %s",
session_management_procedures_type_e2str[static_cast<int>(session_procedure_type)]
.c_str());
switch (session_procedure_type) {
/*
case session_management_procedures_type_e::SERVICE_REQUEST_UE_TRIGGERED_STEP1: {
if (cause.cause_value == CAUSE_VALUE_REQUEST_ACCEPTED) {
Logger::smf_app().info(
"PDU Session Update SM Context (Service Request- step1) accepted by UPF");
"Service Request (step 1) accepted by UPF");
//delete AN Info
std::map<uint8_t, qos_flow_context_updated> qos_flow_context_to_be_updateds =
......@@ -943,22 +981,21 @@ void session_update_sm_context_procedure::handle_itti_msg(
n11_triggered_pending->res.remove_all_qos_flow_context_updateds();
for (auto it : qos_flow_context_to_be_updateds)
Logger::smf_app().debug("qos_flow_context_to_be_modifieds qfi %d",
Logger::smf_app().debug("QoS Flow context to be modified QFI %d",
it.first);
for (auto it : qos_flow_context_to_be_updateds) {
smf_qos_flow flow = { };
if (!sps->get_qos_flow(it.second.qfi, flow)) { //no QoS flow found
Logger::smf_app().error(
"Update SM Context procedure: could not found QoS flow with QFI %d",
"Could not found any QoS flow with QFI %d",
it.first);
continue;
}
//if FAR DL exist -> remove it
if ((flow.far_id_dl.first)
&& (flow.far_id_dl.second.far_id)) {
if ((flow.far_id_dl.first) && (flow.far_id_dl.second.far_id)) {
Logger::smf_app().debug(
"Update SM Context procedure: FAR DL %d has been removed",
"FAR DL " "0x%" PRIx32 " has been removed",
flow.far_id_dl.second.far_id);
flow.far_id_dl.first = false;
flow.far_id_dl.second.far_id = 0;
......@@ -966,7 +1003,7 @@ void session_update_sm_context_procedure::handle_itti_msg(
//remove PDR DL if exist
if (flow.pdr_id_dl.rule_id) {
Logger::smf_app().debug(
"Update SM Context procedure: PDR DL %d has been removed",
"PDR DL " "0x%" PRIx16 " has been removed",
flow.pdr_id_dl.rule_id);
flow.pdr_id_dl.rule_id = 0;
}
......@@ -986,9 +1023,11 @@ void session_update_sm_context_procedure::handle_itti_msg(
}
}
break;
*/
case session_management_procedures_type_e::PDU_SESSION_ESTABLISHMENT_UE_REQUESTED:
case session_management_procedures_type_e::PDU_SESSION_MODIFICATION_SMF_REQUESTED:
case session_management_procedures_type_e::PDU_SESSION_MODIFICATION_AN_REQUESTED:
case session_management_procedures_type_e::SERVICE_REQUEST_UE_TRIGGERED_STEP2:
case session_management_procedures_type_e::PDU_SESSION_MODIFICATION_UE_INITIATED_STEP2: {
::fteid_t dl_fteid = { };
......@@ -1001,7 +1040,7 @@ void session_update_sm_context_procedure::handle_itti_msg(
n11_triggered_pending->res.remove_all_qos_flow_context_updateds();
for (auto it : qos_flow_context_to_be_updateds)
Logger::smf_app().debug("qos_flow_context_to_be_modifieds qfi %d",
Logger::smf_app().debug("QoS Flow context to be modified QFI %d",
it.first);
for (auto it_created_pdr : resp.pfcp_ies.created_pdrs) {
......@@ -1009,7 +1048,7 @@ void session_update_sm_context_procedure::handle_itti_msg(
if (it_created_pdr.get(pdr_id)) {
smf_qos_flow flow = { };
if (sps->get_qos_flow(pdr_id, flow)) {
Logger::smf_app().debug("QoS Flow, qfi %d", flow.qfi.qfi);
Logger::smf_app().debug("QoS Flow, QFI %d", flow.qfi.qfi);
for (auto it : qos_flow_context_to_be_updateds) {
flow.dl_fteid = dl_fteid;
flow.dl_fteid.interface_type = S1_U_ENODEB_GTP_U; //eNB's N3 interface
......@@ -1018,11 +1057,12 @@ void session_update_sm_context_procedure::handle_itti_msg(
if (it_created_pdr.get(local_up_fteid)) {
xgpp_conv::pfcp_to_core_fteid(local_up_fteid, flow.ul_fteid);
flow.ul_fteid.interface_type = S1_U_SGW_GTP_U; //UPF's N3 interface, TODO: should be modified
Logger::smf_app().warn("got local_up_fteid from created_pdr %s",
Logger::smf_app().debug(
"Got local_up_fteid from created_pdr %s",
flow.ul_fteid.toString().c_str());
} else {
//UPF doesn't include its fteid in the response
Logger::smf_app().warn(
Logger::smf_app().debug(
"Could not get local_up_fteid from created_pdr");
}
......@@ -1423,7 +1463,8 @@ void session_release_sm_context_procedure::handle_itti_msg(
problem_details.setCause(
pdu_session_application_error_e2str[PDU_SESSION_APPLICATION_ERROR_NETWORK_FAILURE]); //To be updated
smf_n11_inst->send_pdu_session_release_sm_context_response(
n11_triggered_pending->http_response, Pistache::Http::Code::Not_Acceptable);
n11_triggered_pending->http_response,
Pistache::Http::Code::Not_Acceptable);
}
//TODO:
......
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