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

add smf_ngap - containing all ngap-releated functions/polish the code

parent ced83268
......@@ -49,7 +49,7 @@ SMF =
#SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
#SCHED_PRIORITY = 84;
#};
#PGW_APP_SCHED_PARAMS :
#SMF_APP_SCHED_PARAMS :
#{
#CPU_ID = 1;
#SCHED_POLICY = "SCHED_FIFO"; # Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
......
......@@ -10,6 +10,27 @@
* Do not edit the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "SMContextsCollectionApi.h"
#include "logger.hpp"
#include "Helpers.h"
......@@ -133,9 +154,8 @@ void SMContextsCollectionApi::setupRoutes() {
void SMContextsCollectionApi::post_sm_contexts_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the body param
Logger::smf_api_server().debug("[SMF API] Received a SM context create request %s",request.body().c_str());
Logger::smf_api_server().info("Received a SM context create request from AMF");
Logger::smf_api_server().debug("Request body: %s\n",request.body().c_str());
SmContextMessage smContextMessage;
SmContextCreateData smContextCreateData;
......@@ -151,15 +171,18 @@ void SMContextsCollectionApi::post_sm_contexts_handler(const Pistache::Rest::Req
g_callbacks.on_body_end = &on_body_end;
multipartparser parser;
init_globals();
multipartparser_init(&parser, BOUNDARY);
if ((multipartparser_execute(&parser, &g_callbacks, request.body().c_str(), strlen(request.body().c_str())) != strlen(request.body().c_str())) or (!g_body_begin_called)){
response.send(Pistache::Http::Code::Bad_Request, "");
return;
}
assert(multipartparser_execute(&parser, &g_callbacks, request.body().c_str(), strlen(request.body().c_str())) == strlen(request.body().c_str()));
assert(g_body_begin_called);
//at least 2 parts for Json data and N1 (+ N2)
assert(g_parts.size() >= 2);
//at least 2 parts for Json data and N1 (+ N2)
if (g_parts.size() < 2){
response.send(Pistache::Http::Code::Bad_Request, "");
return;
}
part p0 = g_parts.front(); g_parts.pop_front();
Logger::smf_api_server().debug("Request body, part 1: \n%s", p0.body.c_str());
part p1 = g_parts.front(); g_parts.pop_front();
......@@ -171,7 +194,6 @@ void SMContextsCollectionApi::post_sm_contexts_handler(const Pistache::Rest::Req
//step 2. process the request
try {
//nlohmann::json::parse(p0.body.c_str()).get_to(smContextMessage);
nlohmann::json::parse(p0.body.c_str()).get_to(smContextCreateData);
smContextMessage.setJsonData(smContextCreateData);
smContextMessage.setBinaryDataN1SmMessage(p1.body.c_str());
......
......@@ -10,10 +10,29 @@
* Do not edit the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "IndividualSMContextApiImpl.h"
extern "C" {
#include "Ngap_NGAP-PDU.h"
}
namespace oai {
namespace smf_server {
namespace api {
......@@ -36,37 +55,19 @@ void IndividualSMContextApiImpl::retrieve_sm_context(const std::string &smContex
void IndividualSMContextApiImpl::update_sm_context(const std::string &smContextRef, const SmContextUpdateData &smContextUpdateData, Pistache::Http::ResponseWriter &response) {
//handle Nsmf_PDUSession_UpdateSMContext Request
Logger::smf_api_server().info("update_sm_contexts...");
Logger::smf_api_server().info("Received a PDUSession_UpdateSMContext Request from AMF.");
//Get the SmContextUpdateData from this message and process in smf_app
smf::pdu_session_update_sm_context_request sm_context_req_msg = {};
//decode NGAP message and assign the necessary informations to pdu_session_update_sm_context_request
//and pass this message to SMF to handle this message
Ngap_NGAP_PDU_t decoded_ngap_msg = {};
std::string n2_sm_information = (smContextUpdateData.getN2SmInfo()).getContentId();
std::string n2_sm_msg_hex;
m_smf_app->convert_string_2_hex(n2_sm_information, n2_sm_msg_hex);
Logger::smf_api_server().debug("smContextMessage, n2 sm information %s",n2_sm_information.c_str());
std::string n2_sm_info_type = smContextUpdateData.getN2SmInfoType();
sm_context_req_msg.set_n2_sm_information(n2_sm_msg_hex);
sm_context_req_msg.set_n2_sm_info_type(n2_sm_info_type);
/*
// do it from SMF_APP
int decoder_rc = m_smf_app->decode_ngap_message(decoded_ngap_msg, n2_sm_msg_hex);
if (decoder_rc != RETURNok) {
//TODO: error, should send reply to AMF with error code!!
}
*/
//Step 2. TODO: initialize necessary values for sm context req from smContextUpdateData
//Step 3. Handle the itti_n11_update_sm_context_request message in smf_app
......@@ -76,7 +77,6 @@ void IndividualSMContextApiImpl::update_sm_context(const std::string &smContextR
m_smf_app->handle_amf_msg(itti_msg);
}
}
......
......@@ -10,18 +10,34 @@
* Do not edit the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "SMContextsCollectionApiImpl.h"
#include "logger.hpp"
#include "smf_msg.hpp"
#include "itti_msg_n11.hpp"
#include "3gpp_29.502.h"
extern "C" {
#include "nas_message.h"
#include "mmData.h"
#include "nas_sm_encode_to_json.h"
}
namespace oai {
namespace smf_server {
namespace api {
......@@ -35,13 +51,11 @@ SMContextsCollectionApiImpl::SMContextsCollectionApiImpl(std::shared_ptr<Pistach
void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smContextMessage, Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("[SMF API] Process SmContextMessage ...");
Logger::smf_api_server().info("Process SmContextMessage ...");
//decode NAS message and assign the necessary informations to smf::pdu_session_create_sm_context_request
//Assign the necessary informations to smf::pdu_session_create_sm_context_request
//and pass this message to SMF to handle this message
nas_message_t decoded_nas_msg;
memset (&decoded_nas_msg, 0, sizeof (nas_message_t));
//decode NAS should be done in SMF APP
SmContextCreateData smContextCreateData = smContextMessage.getJsonData();
std::string n1_sm_msg = smContextMessage.getBinaryDataN1SmMessage();
......@@ -49,44 +63,12 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
m_smf_app->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex);
Logger::smf_api_server().debug("smContextMessage, N1 SM message: %s",n1_sm_msg.c_str());
//Step1. Decode N1 SM container into decoded nas msg
int decoder_rc = m_smf_app->decode_nas_message_n1_sm_container(decoded_nas_msg, n1_sm_msg_hex);
if (decoder_rc != RETURNok) {
//error, should send reply to AMF with error code!!
Logger::smf_api_server().warn("N1 SM container cannot be decoded correctly!\n");
SmContextCreateError smContextCreateError;
ProblemDetails problem_details;
RefToBinaryData binary_data;
std::string n1_container;
problem_details.setCause(pdu_session_application_error_e2str[PDU_SESSION_APPLICATION_ERROR_N1_SM_ERROR]);
smContextCreateError.setError(problem_details);
//PDU Session Establishment Reject
//24.501: response with a 5GSM STATUS message including cause "#95 Semantically incorrect message"
m_smf_app->create_n1_sm_container(PDU_SESSION_ESTABLISHMENT_REJECT, n1_container, 95); //TODO: should define 5GSM cause in 24.501
binary_data.setContentId(n1_container);
smContextCreateError.setN1SmMsg(binary_data);
//Send response to AMF
nlohmann::json jsonData;
to_json(jsonData, smContextCreateError);
std::string resBody = jsonData.dump();
//httpResponse.headers().add<Pistache::Http::Header::Location>(url);
response.send(Pistache::Http::Code::Forbidden, resBody);
return;
}
Logger::smf_api_server().debug("NAS header information: extended_protocol_discriminator %d, security_header_type:%d,sequence_number:%d,message_authentication_code:%d\n",
decoded_nas_msg.header.extended_protocol_discriminator,
decoded_nas_msg.header.security_header_type,
decoded_nas_msg.header.sequence_number,
decoded_nas_msg.header.message_authentication_code);
//Step 2. Create a pdu_session_create_sm_context_request message and store the necessary information
Logger::smf_api_server().debug("Create a pdu_session_create_sm_context_request message and store the necessary information\n");
smf::pdu_session_create_sm_context_request sm_context_req_msg = {};
//set N1 SM Message
sm_context_req_msg.set_n1_sm_message(n1_sm_msg_hex);
//set api root to be used as location header in HTTP response
sm_context_req_msg.set_api_root(m_address + base + "/sm-contexts");
......@@ -135,35 +117,6 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
//Subscription for PDU Session Status Notification
// Trace requirement
//From N1 Container (NAS)
//Extended protocol discriminator (Mandatory)
Logger::smf_api_server().debug("SmContextCreateData, Extended protocol discriminator \n");
sm_context_req_msg.set_epd(decoded_nas_msg.header.extended_protocol_discriminator);
//PDU session ID (Mandatory)
Logger::smf_api_server().debug("SmContextCreateData, PDU session identity %d\n", decoded_nas_msg.plain.sm.header.pdu_session_identity);
sm_context_req_msg.set_pdu_session_id(decoded_nas_msg.plain.sm.header.pdu_session_identity);
//PTI (Mandatory)
Logger::smf_api_server().debug("SmContextCreateData, Procedure transaction ID %d\n", decoded_nas_msg.plain.sm.header.procedure_transaction_identity);
procedure_transaction_id_t pti = {.procedure_transaction_id = decoded_nas_msg.plain.sm.header.procedure_transaction_identity};
sm_context_req_msg.set_pti(pti);
//Message type (Mandatory) (PDU SESSION ESTABLISHMENT REQUEST message identity)
Logger::smf_api_server().debug("SmContextCreateData, Message Type %d\n", decoded_nas_msg.plain.sm.header.message_type);
sm_context_req_msg.set_message_type(decoded_nas_msg.plain.sm.header.message_type);
//Integrity protection maximum data rate (Mandatory)
//PDU session type (Optional)
Logger::smf_api_server().debug("SmContextCreateData, Message Type %d\n", PDN_TYPE_E_IPV4);
sm_context_req_msg.set_pdu_session_type(PDN_TYPE_E_IPV4);
if (decoded_nas_msg.plain.sm.header.message_type == PDU_SESSION_ESTABLISHMENT_REQUEST){
//TODO: Disable this command temporarily since can't get this info from tester
//sm_context_req_msg.set_pdu_session_type(decoded_nas_msg.plain.sm.specific_msg.pdu_session_establishment_request._pdusessiontype.pdu_session_type_value);
}
//SSC mode (Optional)
//5GSM capability (Optional)
//Maximum number of supported (Optional)
......
......@@ -65,7 +65,6 @@ public:
};
//-----------------------------------------------------------------------------
class itti_n11_create_sm_context_response : public itti_n11_msg {
public:
......@@ -108,7 +107,6 @@ public:
smf::pdu_session_update_sm_context_response res;
Pistache::Http::ResponseWriter http_response;
};
#endif /* ITTI_MSG_N11_HPP_INCLUDED_ */
......@@ -78,6 +78,7 @@ typedef uint8_t pdu_session_id;
//should move to 24.501
enum pdu_session_type_e {
PDU_SESSION_TYPE_E_UNKNOWN = 0,
PDU_SESSION_TYPE_E_IPV4 = 1,
PDU_SESSION_TYPE_E_IPV6 = 2,
PDU_SESSION_TYPE_E_IPV4V6 = 3,
......
......@@ -81,6 +81,8 @@ extern "C" {
//0b11******
//5GS Session Management Messages
//TODO should be updated with enum
#define PDU_SESSION_MESSAGE_TYPE_UNKNOWN 0b00000000
#define PDU_SESSION_ESTABLISHMENT_REQUEST 0b11000001
#define PDU_SESSION_ESTABLISHMENT_ACCEPT 0b11000010
#define PDU_SESSION_ESTABLISHMENT_REJECT 0b11000011
......
......@@ -32,7 +32,7 @@ Ngap_PDUSessionResourceSetupRequestIEs_t *make_req_RAN_UE_NGAP_ID(uint32_t rAN_
ie->value.present = Ngap_PDUSessionResourceSetupRequestIEs__value_PR_RAN_UE_NGAP_ID;
ie->value.choice.RAN_UE_NGAP_ID = rAN_UE_NGAP_ID ;
printf("RAN_UE_NGAP_ID: 0x%x\n",ie->value.choice.RAN_UE_NGAP_ID);
printf("RAN_UE_NGAP_ID: %lu\n",ie->value.choice.RAN_UE_NGAP_ID);
return ie;
}
......@@ -48,7 +48,7 @@ Ngap_PDUSessionResourceSetupRequestIEs_t *make_req_AMF_UE_NGAP_ID(uint64_t amf_
asn_ulong2INTEGER(&ie->value.choice.AMF_UE_NGAP_ID, amf_UE_NGAP_ID & AMF_UE_NGAP_ID_MASK_);
printf("AMF_UE_NGAP_ID: 0x%x\n",amf_UE_NGAP_ID);
printf("AMF_UE_NGAP_ID: %lu\n",amf_UE_NGAP_ID);
return ie;
}
......@@ -62,7 +62,7 @@ Ngap_PDUSessionResourceSetupRequestIEs_t *make_RANPagingPriority(const long ra
ie->value.present = Ngap_PDUSessionResourceSetupRequestIEs__value_PR_RANPagingPriority;
ie->value.choice.RANPagingPriority = ranPagingPriority;
printf("RANPagingPriority: 0x%x\n",ie->value.choice.RANPagingPriority);
printf("RANPagingPriority: %ld",ie->value.choice.RANPagingPriority);
return ie;
}
......@@ -76,7 +76,7 @@ Ngap_PDUSessionResourceSetupRequestIEs_t *make_NAS_PDU(const char *nas_pdu)
ie->value.present = Ngap_PDUSessionResourceSetupRequestIEs__value_PR_NAS_PDU;
OCTET_STRING_fromBuf (&ie->value.choice.NAS_PDU, nas_pdu, strlen(nas_pdu));
printf("nas_pdu, nas_pdu_size:%d, nas_pdu:%s,\n", strlen(nas_pdu), nas_pdu);
printf("nas_pdu, nas_pdu_size:%ld, nas_pdu:%s,\n", strlen(nas_pdu), nas_pdu);
return ie;
}
......
......@@ -89,7 +89,7 @@ int main(int argc, char **argv)
}
// Logger
Logger::init( "spgwc" , Options::getlogStdout() , Options::getlogRotFilelog());
Logger::init( "smf" , Options::getlogStdout() , Options::getlogRotFilelog());
Logger::smf_app().startup( "Options parsed" );
......
......@@ -59,6 +59,7 @@ add_library (SMF STATIC
smf_app.cpp
smf_config.cpp
smf_context.cpp
smf_ngap.cpp
smf_pfcp_association.cpp
smf_pco.cpp
smf_procedure.cpp
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -43,12 +43,6 @@
#include "pistache/router.h"
#include "smf_msg.hpp"
extern "C"{
#include "nas_message.h"
#include "mmData.h"
#include "Ngap_NGAP-PDU.h"
}
#include <map>
#include <set>
#include <shared_mutex>
......@@ -195,59 +189,12 @@ public:
void send_create_session_response(Pistache::Http::ResponseWriter& httpResponse, oai::smf_server::model::SmContextCreateError& smContextCreateError, Pistache::Http::Code code);
/*
* Create N1 SM Container to send to AMF (using NAS lib)
* @param [std::shared_ptr<itti_n11_create_sm_context_response>] sm_context_res
* @param [uint8_t] msg_type Type of N1 message
* @param [std::string&] nas_msg_str store NAS message in form of string
*
* Convert a string to hex representing this string
* @param [std::string&] input_str Input string
* @param [std::string&] output_str String represents string in hex format
* @return void
*/
void create_n1_sm_container(std::shared_ptr<itti_n11_create_sm_context_response> sm_context_res, uint8_t msg_type, std::string& nas_msg_str, uint8_t sm_cause = 0);
//for testing purpose!!
void create_n1_sm_container(uint8_t msg_type, std::string& nas_msg_str, uint8_t sm_cause = 0);
/*
* Create N1 SM Container to send to AMF (using NAS lib)
* @param [std::shared_ptr<itti_n11_create_sm_context_request>] sm_context_req
* @param [uint8_t] msg_type Type of N1 message
* @param [std::string&] nas_msg_str store NAS message in form of string
*
*/
void create_n1_sm_container(std::shared_ptr<itti_n11_create_sm_context_request> sm_context_req, uint8_t msg_type, std::string& nas_msg_str, uint8_t sm_cause = 0);
/*
* Create N2 SM Information to send to AMF (using NAS lib)
* @param [std::shared_ptr<itti_n11_create_sm_context_response>] sm_context_res
* @param [uint8_t] msg_type Type of N2 message
* @param [std::string&] ngap_msg_str store NGAP message in form of string
*
*/
void create_n2_sm_information(std::shared_ptr<itti_n11_create_sm_context_response> sm_context_res, uint8_t ngap_msg_type, uint8_t ngap_ie_type, std::string& ngap_msg_str);
/*
* Decode N1 SM Container into the NAS mesasge (using NAS lib)
* @param [nas_message_t&] nas_msg Store NAS message after decoded
* @param [std::string&] n1_sm_msg N1 SM Container from AMF
* @return status of the decode process
*/
int decode_nas_message_n1_sm_container(nas_message_t& nas_msg, std::string& n1_sm_msg);
/*
* Convert a string to hex representing this string
* @param [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);
/*
* Decode N2 SM Information (using NGAP lib)
* @param [Ngap_NGAP_PDU_t&] ngap_msg Store decoded NGAP message
* @param [std::string&] n2_sm_info N2 SM Information from AMF
* @return status of the decode process
*/
int decode_ngap_message(Ngap_NGAP_PDU_t& ngap_msg, std::string& n2_sm_info);
void convert_string_2_hex(std::string& input_str, std::string& output_str);
};
}
......
......@@ -151,8 +151,8 @@ int smf_config::load_itti(const Setting& itti_cfg, itti_cfg_t& cfg)
}
try {
const Setting& pgw_app_sched_params_cfg = itti_cfg[SMF_CONFIG_STRING_PGW_APP_SCHED_PARAMS];
load_thread_sched_params(pgw_app_sched_params_cfg, cfg.pgw_app_sched_params);
const Setting& smf_app_sched_params_cfg = itti_cfg[SMF_CONFIG_STRING_SMF_APP_SCHED_PARAMS];
load_thread_sched_params(smf_app_sched_params_cfg, cfg.smf_app_sched_params);
} catch(const SettingNotFoundException &nfex) {
Logger::smf_app().info("%s : %s, using defaults", nfex.what(), nfex.getPath());
}
......@@ -482,7 +482,7 @@ int smf_config::load(const string& config_file)
void smf_config::display ()
{
Logger::smf_app().info( "==== EURECOM %s v%s ====", PACKAGE_NAME, PACKAGE_VERSION);
Logger::smf_app().info( "Configuration PGW-C:");
Logger::smf_app().info( "Configuration SMF:");
Logger::smf_app().info( "- Instance ..............: %d\n", instance);
Logger::smf_app().info( "- PID dir ...............: %s\n", pid_dir.c_str());
......@@ -524,10 +524,10 @@ void smf_config::display ()
Logger::smf_app().info( " CPU id............: %d", itti.sx_sched_params.cpu_id);
Logger::smf_app().info( " Scheduling policy : %d", itti.sx_sched_params.sched_policy);
Logger::smf_app().info( " Scheduling prio .: %d", itti.sx_sched_params.sched_priority);
Logger::smf_app().info( "- ITTI PGW_APP task Threading:");
Logger::smf_app().info( " CPU id............: %d", itti.pgw_app_sched_params.cpu_id);
Logger::smf_app().info( " Scheduling policy : %d", itti.pgw_app_sched_params.sched_policy);
Logger::smf_app().info( " Scheduling prio .: %d", itti.pgw_app_sched_params.sched_priority);
Logger::smf_app().info( "- ITTI SMF_APP task Threading:");
Logger::smf_app().info( " CPU id............: %d", itti.smf_app_sched_params.cpu_id);
Logger::smf_app().info( " Scheduling policy : %d", itti.smf_app_sched_params.sched_policy);
Logger::smf_app().info( " Scheduling prio .: %d", itti.smf_app_sched_params.sched_priority);
Logger::smf_app().info( "- ITTI ASYNC_CMD task Threading:");
Logger::smf_app().info( " CPU id............: %d", itti.async_cmd_sched_params.cpu_id);
Logger::smf_app().info( " Scheduling policy : %d", itti.async_cmd_sched_params.sched_policy);
......
......@@ -122,7 +122,7 @@
#define SMF_CONFIG_STRING_S11_SCHED_PARAMS "S11_SCHED_PARAMS"
#define SMF_CONFIG_STRING_S5S8_SCHED_PARAMS "S5S8_SCHED_PARAMS"
#define SMF_CONFIG_STRING_SX_SCHED_PARAMS "SX_SCHED_PARAMS"
#define SMF_CONFIG_STRING_PGW_APP_SCHED_PARAMS "PGW_APP_SCHED_PARAMS"
#define SMF_CONFIG_STRING_SMF_APP_SCHED_PARAMS "SMF_APP_SCHED_PARAMS"
#define SMF_CONFIG_STRING_ASYNC_CMD_SCHED_PARAMS "ASYNC_CMD_SCHED_PARAMS"
......@@ -151,7 +151,7 @@ typedef struct itti_cfg_s {
util::thread_sched_params itti_timer_sched_params;
util::thread_sched_params sx_sched_params;
util::thread_sched_params s5s8_sched_params;
util::thread_sched_params pgw_app_sched_params;
util::thread_sched_params smf_app_sched_params;
util::thread_sched_params async_cmd_sched_params;
} itti_cfg_t;
......@@ -249,7 +249,7 @@ public:
itti.itti_timer_sched_params.sched_priority = 85;
itti.sx_sched_params.sched_priority = 84;
itti.s5s8_sched_params.sched_priority = 84;
itti.pgw_app_sched_params.sched_priority = 84;
itti.smf_app_sched_params.sched_priority = 84;
itti.async_cmd_sched_params.sched_priority = 84;
sx.thread_rd_sched_params.sched_priority = 90;
......@@ -279,7 +279,7 @@ public:
bool is_dotted_dnn_handled(const std::string& apn, const pdu_session_type_t& pdn_session_type);
};
} // namespace pgw
} // namespace smf
#endif /* FILE_SMF_CONFIG_HPP_SEEN */
......@@ -32,6 +32,7 @@
#include "smf_app.hpp"
#include "smf_config.hpp"
#include "smf_context.hpp"
#include "smf_ngap.hpp"
#include "smf_paa_dynamic.hpp"
#include "smf_procedure.hpp"
#include "ProblemDetails.h"
......@@ -162,25 +163,25 @@ void smf_pdu_session::set_seid(const uint64_t& s){
}
//------------------------------------------------------------------------------
// TODO check if prd_id should be uniq in the (S)PGW-U or in the context of a pdn connection
// TODO check if prd_id should be uniq in the UPF or in the context of a pdn connection
void smf_pdu_session::generate_far_id(pfcp::far_id_t& far_id)
{
far_id.far_id = far_id_generator.get_uid();
}
//------------------------------------------------------------------------------
// TODO check if prd_id should be uniq in the (S)PGW-U or in the context of a pdn connection
// TODO check if prd_id should be uniq in the UPF or in the context of a pdn connection
void smf_pdu_session::release_far_id(const pfcp::far_id_t& far_id)
{
far_id_generator.free_uid(far_id.far_id);
}
//------------------------------------------------------------------------------
// TODO check if prd_id should be uniq in the (S)PGW-U or in the context of a pdn connection
// TODO check if prd_id should be uniq in the UPF or in the context of a pdn connection
void smf_pdu_session::generate_pdr_id(pfcp::pdr_id_t& pdr_id)
{
pdr_id.rule_id = pdr_id_generator.get_uid();
}
//------------------------------------------------------------------------------
// TODO check if prd_id should be uniq in the (S)PGW-U or in the context of a pdn connection
// TODO check if prd_id should be uniq in the UPF or in the context of a pdn connection
void smf_pdu_session::release_pdr_id(const pfcp::pdr_id_t& pdr_id)
{
pdr_id_generator.free_uid(pdr_id.rule_id);
......@@ -281,7 +282,7 @@ std::string smf_context::toString() const
{
std::unique_lock<std::recursive_mutex> lock(m_context);
std::string s = {};
s.append("PGW CONTEXT:\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");
for (auto it : dnns) {
......@@ -354,6 +355,7 @@ void smf_context::handle_amf_msg (std::shared_ptr<itti_n11_create_sm_context_req
sm_context_resp->res.set_snssai(snssai);
sm_context_resp->res.set_dnn(dnn);
//Step 3. find pdu_session
std::shared_ptr<dnn_context> sd;
bool find_dnn = find_dnn_context (dnn, sd);
......@@ -595,7 +597,7 @@ void smf_context::handle_amf_msg (std::shared_ptr<itti_n11_update_sm_context_req
//decode Ngap_PDUSessionResourceSetupResponseTransfer
if (n2_sm_info_type.compare(n2_sm_info_type_e2str[PDU_RES_SETUP_RSP]) == 0){
Ngap_PDUSessionResourceSetupResponseTransfer_t *decoded_msg = NULL;
std::unique_ptr<Ngap_PDUSessionResourceSetupResponseTransfer_t> decoded_msg = std::unique_ptr<Ngap_PDUSessionResourceSetupResponseTransfer_t>();
//Decode N2 SM info into decoded nas msg
asn_dec_rval_t rc = asn_decode(NULL,ATS_ALIGNED_CANONICAL_PER, &asn_DEF_Ngap_PDUSessionResourceSetupResponseTransfer, (void **)&decoded_msg, (void *)n2_sm_infomation.c_str(), n2_sm_infomation.length());
if(rc.code != RC_OK)
......
......@@ -31,20 +31,35 @@
using namespace smf;