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

Merge branch 'pdu_session_modification_v2.0' into 'develop'

Pdu session modification v2.0

See merge request oai/oai-cn5g-smf!10
parents a9abca49 acd67431
......@@ -6,21 +6,24 @@ The license information is distributed under LICENSE file in the same directory.
The OpenAirInterface CN SMF software is composed of the following parts:
openair-cn5g-smf
├── 3gpp-specs: Directory containing 3GPP specification files (YAML) used to implement SMF network function.
├── build: Build directory, contains targets and object files generated by compilation of network functions.
├── log: Directory containing build log files.
├── scripts: Directory containing scripts for building network functions
├── scripts: Directory containing scripts for building network functions.
└── smf: Directory containing CMakefile.txt and object files generated by compilation of SMF network function.
├── ci-scripts: Directory containing the script files for CI framework.
├── docs: Directory containing the documentation files.
├── etc: Directory containing the configuration file to be deployed for SMF.
└── src: Source files of SMF.
├── api-server: SMF services APIs.
├── common: Common header files
│   ├── msg: ITTI messages definitions.
│   └── utils: Common utilities.
├── gtpv1u: Generic GTPV1-U stack implementation
├── gtpv2c: Generic GTPV2-C stack implementation
├── itti: Inter task interface
├── nas: NAS protocol implememtation
├── mgap: NGAP protocol implememtation
├── gtpv1u: Generic GTPV1-U stack implementation.
├── gtpv2c: Generic GTPV2-C stack implementation.
├── itti: Inter task interface.
├── nas: NAS protocol implememtation.
├── ngap: NGAP protocol implememtation.
├── oai_smf: SMF main directory, contains the "main" CMakeLists.txt file.
├── pfcp: Generic PFCP stack implementation.
├── smf_app: SMF network functions procedures and contexts.
......
<table style="border-collapse: collapse; border: none;">
<tr style="border-collapse: collapse; border: none;">
<td style="border-collapse: collapse; border: none;">
<a href="http://www.openairinterface.org/">
<img src="./images/oai_final_logo.png" alt="" border=3 height=50 width=150>
</img>
</a>
</td>
<td style="border-collapse: collapse; border: none; vertical-align: center;">
<b><font size = "5">OpenAirInterface SMF Feature Set</font></b>
</td>
</tr>
</table>
**Table of Contents**
1. [5GC Service Based Architecture](#1-5gc-service-based-architecture)
2. [OAI SMF Available Interfaces](#2-oai-smf-available-interfaces)
3. [OAI SMF Feature List](#3-oai-smf-feature-list)
# 1. 5GC Service Based Architecture #
![5GC SBA](./images/5gc_sba.png)
# 2. OAI SMF Available Interfaces #
| **ID** | **Interface** | **Status** | **Comment** |
| ------ | ------------- | ------------------ | --------------------------------------------------------------------------|
| 1 | N4 | :heavy_check_mark: | between SMF and UPF (PFCP) |
| 2 | N7 | :x: | between SMF and PCF |
| 3 | N10 | :heavy_check_mark: | between SMF and UDM (Nudm_SubscriberDataManagement) |
| 4 | N11 | :heavy_check_mark: | between SMF and AMF (Nsmf_PDU_Session Services, Namf_N1N2MessageTransfer) |
| 5 | N16/16a | :x: | between SMFs |
# 3. OAI SMF Feature List #
Based on document **3GPP TS 23.501 v16.0.0 §6.2.2**.
| **ID** | **Classification** | **Status** | **Comments** |
| ------ | ------------------------------------------------------------------- | ------------------ | ------------------------------------------- |
| 1 | Session Management (Session Establishment/Modification/Release) | :heavy_check_mark: | |
| 2 | UE IP address allocation & management​ | :heavy_check_mark: | Only support static ipv4 address allocation |
| 3 | DHCPv4 (server and client) and DHCPv6 (server and client) function | :x: | |
| 4 | Respond to ARP requests and/or IPv6 Neighbour Solicitation requests | :x: | Local configuration in SMF |
| 5 | Selection of UPF function​ | :x: | |
| 6 | Configures traffic steering at UPF | :x: | |
| 7 | Termination of interfaces towards PCFs | :x: | |
| 8 | Lawful intercept | :x: | |
| 8 | Charging data collection and support of charging interfaces | :x: | |
| 10 | Termination of SM parts of NAS messages | :heavy_check_mark: | |
| 11 | Downlink Data Notification | :heavy_check_mark: | |
| 12 | Determine SSC mode of a session​ | :heavy_check_mark: | Only support SSC mode 1​ |
| 13 | Initiator of AN specific SM information, sent via AMF over N2 to AN | :heavy_check_mark: | |
| 14 | Support for Control Plane CIoT 5GS Optimisation | :x: | |
| 15 | Support of header compression. ​ | :x: | |
| 16 | Act as I-SMF in deployments | :x: | |
| 17 | Provisioning of external parameters | :x: | |
......@@ -89,12 +89,6 @@ SMF =
# Non standard feature, normally should be set to "no", but you may need to set to yes for UE that do not explicitly request a PDN address through NAS signalling
FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS = "no"; # STRING, {"yes", "no"}.
PCEF :
{
# Waiting for HSS APN-AMBR IE ...
APN_AMBR_UL = 500000; # Maximum UL bandwidth that can be used by non guaranteed bit rate traffic in Kbits/seconds.
APN_AMBR_DL = 500000; # Maximum DL bandwidth that can be used by non guaranteed bit rate traffic in Kbits/seconds.
};
AMF :
{
IPV4_ADDRESS="@AMF_IPV4_ADDRESS@";
......
......@@ -139,7 +139,7 @@ void IndividualSMContextApi::update_sm_context_handler(
Logger::smf_api_server().debug("");
Logger::smf_api_server().info(
"Received a SM context update request from AMF");
"Received a SM context update request from AMF.");
Logger::smf_api_server().debug("Request body: %s\n", request.body().c_str());
//find boundary
......@@ -174,7 +174,7 @@ void IndividualSMContextApi::update_sm_context_handler(
if ((multipartparser_execute(&parser, &g_callbacks,
reinterpret_cast<const char*>(data), str_len)
!= strlen(request.body().c_str())) or (!g_body_begin_called)) {
Logger::smf_api_server().warn(
Logger::smf_api_server().debug(
"The received message can not be parsed properly!");
//TODO: fix this issue
//response.send(Pistache::Http::Code::Bad_Request, "");
......@@ -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 = { };
......
......@@ -41,7 +41,6 @@
#include <map>
#include <string>
#include "logger.hpp"
#include "Helpers.h"
extern "C" {
......@@ -83,8 +82,9 @@ void SMContextsCollectionApi::post_sm_contexts_handler(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response) {
Logger::smf_api_server().debug("");
Logger::smf_api_server().info(
"\nReceived a SM context create request from AMF");
"Received a SM context create request from AMF.");
Logger::smf_api_server().debug("Request body: %s", request.body().c_str());
//find boundary
......@@ -120,7 +120,7 @@ void SMContextsCollectionApi::post_sm_contexts_handler(
if ((multipartparser_execute(&parser, &g_callbacks,
reinterpret_cast<const char*>(data), str_len)
!= strlen(request.body().c_str())) or (!g_body_begin_called)) {
Logger::smf_api_server().warn(
Logger::smf_api_server().debug(
"The received message can not be parsed properly!");
//TODO: fix this issue
//response.send(Pistache::Http::Code::Bad_Request, "");
......@@ -130,7 +130,7 @@ void SMContextsCollectionApi::post_sm_contexts_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());
//at least 2 parts for Json data and N1 (+ N2)
if (g_parts.size() < 2) {
response.send(Pistache::Http::Code::Bad_Request, "");
......
......@@ -58,7 +58,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
const SmContextMessage &smContextMessage,
Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("PDU Session Create SM Context Request ...");
Logger::smf_api_server().info("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
......@@ -88,18 +88,18 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
sm_context_req_msg.set_supi(supi);
sm_context_req_msg.set_supi_prefix(supi_prefix);
Logger::smf_api_server().debug(
"SmContextCreateData, supi %s, prefix %s, imsi %s",
"SmContextCreateData, SUPI %s, SUPI Prefix %s, IMSI %s",
smContextCreateData.getSupi().c_str(), supi_prefix.c_str(),
supi_str.c_str());
//dnn
Logger::smf_api_server().debug("SmContextCreateData, dnn %s",
Logger::smf_api_server().debug("SmContextCreateData, DNN %s",
smContextCreateData.getDnn().c_str());
sm_context_req_msg.set_dnn(smContextCreateData.getDnn().c_str());
//S-Nssai
Logger::smf_api_server().debug(
"SmContextCreateData, S-NSSAI sst %d, sd %s",
"SmContextCreateData, S-NSSAI SST %d, SD %s",
smContextCreateData.getSNssai().getSst(),
smContextCreateData.getSNssai().getSd().c_str());
snssai_t snssai(smContextCreateData.getSNssai().getSst(),
......@@ -107,7 +107,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
sm_context_req_msg.set_snssai(snssai);
//PDU session ID
Logger::smf_api_server().debug("SmContextCreateData, PDU SessionID %d",
Logger::smf_api_server().debug("SmContextCreateData, PDU Session ID %d",
smContextCreateData.getPduSessionId());
sm_context_req_msg.set_pdu_session_id(smContextCreateData.getPduSessionId());
......
......@@ -142,8 +142,7 @@ static const std::vector<std::string> session_management_procedures_type_e2str =
"PDU_SESSION_RELEASE_UE_REQUESTED_STEP2",
"PDU_SESSION_RELEASE_UE_REQUESTED_STEP3",
"PDU_SESSION_RELEASE_SMF_INITIATED",
"PDU_SESSION_RELEASE_AMF_INITIATED",
"PDU_SESSION_RELEASE_AN_INITIATED",
"PDU_SESSION_RELEASE_AMF_INITIATED", "PDU_SESSION_RELEASE_AN_INITIATED",
"PDU_SESSION_TEST"
};
......@@ -189,5 +188,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
......@@ -331,14 +331,17 @@ static int _nas_message_header_encode(
//Security header type associated with a spare half octet;
ENCODE_U8(buffer + size, *((uint8_t* )(header) + 1), size);
//ENCODE_U8 (buffer+size,header->security_header_type,size);
#if DEBUG_IS_ON
printf("extended_protocol_discriminator %d, security_header_type %d \n",
header->extended_protocol_discriminator, header->security_header_type);
#endif
if (header->extended_protocol_discriminator
== EPD_5GS_MOBILITY_MANAGEMENT_MESSAGES) {
// header->extended_protocol_discriminator == EPD_5GS_SESSION_MANAGEMENT_MESSAGES) {
if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) {
#if DEBUG_IS_ON
printf("security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED\n");
#endif
if (length < NAS_MESSAGE_SECURITY_HEADER_SIZE) {
/*
* The buffer is not big enough to contain security header
......@@ -357,7 +360,9 @@ static int _nas_message_header_encode(
*/
ENCODE_U8(buffer + size, header->sequence_number, size);
}
#if DEBUG_IS_ON
printf("security_header_type: SECURITY_HEADER_TYPE_NOT_PROTECTED\n");
#endif
}
return size;
//OAILOG_STREAM_HEX(OAILOG_LEVEL_DEBUG, LOG_NAS, "encode nas header Incoming NAS message: ", buffer, size)
......
......@@ -184,8 +184,9 @@ int encode_pdu_session_establishment_accept(
uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encoded_result = 0;
#if DEBUG_IS_ON
printf("\nEncode PDU Session Establishment Accept\n");
#endif
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, PDU_SESSION_ESTABLISHMENT_ACCEPT_MINIMUM_LENGTH, len);
......
......@@ -175,8 +175,9 @@ int fivegsm_msg_encode(SM_msg *msg, uint8_t *buffer, uint32_t len) {
buffer += header_result;
len -= header_result;
#if DEBUG_IS_ON
printf(", message type %d", msg->header.message_type);
#endif
switch (msg->header.message_type) {
case PDU_SESSION_ESTABLISHMENT_REQUEST:
encode_result = encode_pdu_session_establishment_request(
......
......@@ -8039,6 +8039,9 @@ public:
//--------
explicit pfcp_update_pdr_ie(const pfcp::update_pdr& b) : pfcp_grouped_ie(PFCP_IE_UPDATE_PDR){
tlv.set_length(0);
std::shared_ptr<pfcp_pdr_id_ie> sie(new pfcp_pdr_id_ie(b.pdr_id)); add_ie(sie);
if (b.far_id.first) {std::shared_ptr<pfcp_far_id_ie> sie(new pfcp_far_id_ie(b.far_id.second)); add_ie(sie);}
if (b.pdi.first) { std::shared_ptr<pfcp_pdi_ie> sie(new pfcp_pdi_ie(b.pdi.second)); add_ie(sie);}
}
//--------
pfcp_update_pdr_ie() : pfcp_grouped_ie(PFCP_IE_UPDATE_PDR){
......
......@@ -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,8 +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 (psi = %d)",
pdu_session_id);
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 +623,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
}
......@@ -697,13 +690,12 @@ void smf_app::handle_pdu_session_create_sm_context_request(
&& not is_supi_dnn_snssai_subscription_data(supi, dnn, snssai)) {
//uses a dummy UDM to test this part
Logger::smf_app().debug(
"Retrieve Session Management Subscription data from an UDM");
"Retrieve Session Management Subscription data from the UDM");
session_management_subscription *s = new session_management_subscription(
snssai);
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 +774,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);
......@@ -924,7 +916,10 @@ void smf_app::handle_pdu_session_release_sm_context_request(
}
//------------------------------------------------------------------------------
void smf_app::trigger_pdu_session_modification () {
void smf_app::trigger_pdu_session_modification(supi_t &supi, std::string &dnn,
pdu_session_id_t pdu_session_id,
snssai_t &snssai,
pfcp::qfi_t &qfi) {
//SMF-requested session modification, see section 4.3.3.2@3GPP TS 23.502
//The SMF may decide to modify PDU Session. This procedure also may be
//triggered based on locally configured policy or triggered from the (R)AN (see clause 4.2.6 and clause 4.9.1).
......@@ -932,22 +927,30 @@ void smf_app::trigger_pdu_session_modification () {
//SMF has marked that the status of one or more QoS Flows are deleted in the 5GC but not synchronized with
//the UE yet.
std::shared_ptr<itti_nx_trigger_pdu_session_modification> itti_msg =
std::make_shared<itti_nx_trigger_pdu_session_modification>(
TASK_SMF_N11, TASK_SMF_APP);
std::make_shared<itti_nx_trigger_pdu_session_modification>(TASK_SMF_APP,
TASK_SMF_N11);
//step 1. collect the necessary information
supi_t supi = { };
std::string dnn;
pdu_session_id_t pdu_session_id = { 0 };
snssai_t snssai = { };
/*
//For testing purpose
supi_t supi = { };
std::string dnn("default");
pdu_session_id_t pdu_session_id = { 1 };
snssai_t snssai = { };
pfcp::qfi_t qfi = { };
qfi.qfi = 7;
std::string supi_str("200000000000001");
smf_string_to_supi(&supi, supi_str.c_str());
snssai.sST = 222;
snssai.sD = "0000D4";
*/
itti_msg->msg.set_supi(supi);
itti_msg->msg.set_dnn(dnn);
itti_msg->msg.set_pdu_session_id(pdu_session_id);
itti_msg->msg.set_snssai(snssai);
itti_msg->msg.add_qfi(qfi);
supi64_t supi64 = smf_supi_to_u64(supi);
//Step 2. find the smf context
......@@ -958,14 +961,13 @@ void smf_app::trigger_pdu_session_modification () {
Logger::smf_app().debug("Retrieve SMF context with SUPI " SUPI_64_FMT "",
supi64);
} else {
Logger::smf_app().debug("SMF context with SUPI " SUPI_64_FMT "does not exist",
supi64);
Logger::smf_app().debug(
"SMF context with SUPI " SUPI_64_FMT "does not exist", supi64);
return;
}
// handle the message in smf_context
sc.get()->handle_pdu_session_modification_network_requested(itti_msg);
sc.get()->handle_pdu_session_modification_network_requested(itti_msg);
}
//------------------------------------------------------------------------------
......@@ -1008,6 +1010,17 @@ bool smf_app::is_scid_2_smf_context(const scid_t &scid) const {
return bool { scid2smf_context.count(scid) > 0 };
}
//------------------------------------------------------------------------------
bool smf_app::scid_2_smf_context(const scid_t &scid,
std::shared_ptr<smf_context_ref> &scf) const {
std::shared_lock lock(m_scid2smf_context);
if (scid2smf_context.count(scid) > 0) {
scf = scid2smf_context.at(scid);
return true;
}
return false;
}
//------------------------------------------------------------------------------
bool smf_app::use_local_configuration_subscription_data(
const std::string &dnn_selection_mode) {
......@@ -1038,11 +1051,13 @@ void smf_app::convert_string_2_hex(std::string &input_str,
memset(data, 0, input_str.length() + 1);
memcpy((void*) data, (void*) input_str.c_str(), input_str.length());
#if DEBUG_IS_ON
Logger::smf_app().debug("Input: ");
for (int i = 0; i < input_str.length(); i++) {
printf("%02x ", data[i]);
}
printf("\n");
#endif
char *datahex = (char*) malloc(input_str.length() * 2 + 1);
memset(datahex, 0, input_str.length() * 2 + 1);
......@@ -1059,7 +1074,7 @@ void smf_app::convert_string_2_hex(std::string &input_str,
}
//---------------------------------------------------------------------------------------------
unsigned char* smf_app::format_string_as_hex(std::string str) {
unsigned char* smf_app::format_string_as_hex(std::string &str) {
unsigned int str_len = str.length();
char *data = (char*) malloc(str_len + 1);
memset(data, 0, str_len + 1);
......@@ -1071,11 +1086,11 @@ unsigned char* smf_app::format_string_as_hex(std::string str) {
Logger::smf_app().debug("[Format string as Hex] Input string (%d bytes): %s ",
str_len, str.c_str());
Logger::smf_app().debug("Data (formatted):");
#if DEBUG_IS_ON
for (int i = 0; i < str_len / 2; i++)
printf(" %02x ", data_hex[i]);
printf("\n");
#endif
//free memory
free_wrapper((void**) &data);
......@@ -1084,8 +1099,8 @@ unsigned char* smf_app::format_string_as_hex(std::string str) {
}
//---------------------------------------------------------------------------------------------
void smf_app::update_pdu_session_status(const scid_t scid,
const pdu_session_status_e status) {
void smf_app::update_pdu_session_status(const scid_t &scid,
const pdu_session_status_e &status) {
Logger::smf_app().info("Update PDU Session Status");
//get the smf context
......@@ -1140,8 +1155,8 @@ void smf_app::update_pdu_session_status(const scid_t scid,
}
//---------------------------------------------------------------------------------------------
void smf_app::update_pdu_session_upCnx_state(const scid_t scid,
const upCnx_state_e state) {
void smf_app::update_pdu_session_upCnx_state(const scid_t &scid,
const upCnx_state_e &state) {
Logger::smf_app().info("Update UpCnx_State");
//get the smf context
......@@ -1199,7 +1214,7 @@ void smf_app::timer_t3591_timeout(timer_id_t timer_id, uint64_t arg2_user) {
}
//---------------------------------------------------------------------------------------------
n2_sm_info_type_e smf_app::n2_sm_info_type_str2e(std::string n2_info_type) {
n2_sm_info_type_e smf_app::n2_sm_info_type_str2e(std::string &n2_info_type) {
std::size_t number_of_types = n2_sm_info_type_e2str.size();
for (auto i = 0; i < number_of_types; ++i) {
if (n2_info_type.compare(n2_sm_info_type_e2str[i]) == 0) {
......
......@@ -65,7 +65,6 @@ namespace smf {
#define T3592_TIMER_VALUE_SEC 16
#define T3592_TIMER_MAX_RETRIES 4
typedef enum {
PDU_SESSION_ESTABLISHMENT = 1,
PDU_SESSION_MODIFICATION = 2,
......@@ -88,13 +87,10 @@ class smf_context_ref {
pdu_session_id = 0;
}
// std::string toString() const;
supi_t supi;
std::string dnn;
pdu_session_id_t pdu_session_id;
snssai_t nssai;
};
class smf_app {
......@@ -118,17 +114,49 @@ class smf_app {
std::map<scid_t, std::shared_ptr<smf_context_ref>> scid2smf_context;
mutable std::shared_mutex m_scid2smf_context;
/*
* Apply the config from the configuration file for APN pools
* @param [const smf_config &cfg] cfg
* @return
*/
int apply_config(const smf_config &cfg);
/*
* pco_push_protocol_or_container_id
* @param [protocol_configuration_options_t &] pco
* @param [pco_protocol_or_container_id_t *const] proc_id
* @return
*/
int pco_push_protocol_or_container_id(
protocol_configuration_options_t &pco,
pco_protocol_or_container_id_t *const poc_id /* STOLEN_REF poc_id->contents*/);
/*
* process_pco_request_ipcp
* @param [protocol_configuration_options_t &] pco_resp
* @param [pco_protocol_or_container_id_t *const] proc_id
* @return
*/
int process_pco_request_ipcp(
protocol_configuration_options_t &pco_resp,
const pco_protocol_or_container_id_t *const poc_id);
/*
* process_pco_dns_server_request
* @param [protocol_configuration_options_t &] pco_resp
* @param [pco_protocol_or_container_id_t *const] proc_id
* @return
*/
int process_pco_dns_server_request(
protocol_configuration_options_t &pco_resp,
const pco_protocol_or_container_id_t *const poc_id);
/*
* process_pco_link_mtu_request
* @param [protocol_configuration_options_t &] pco_resp
* @param [pco_protocol_or_container_id_t *const] proc_id
* @return
*/
int process_pco_link_mtu_request(
protocol_configuration_options_t &pco_resp,
const pco_protocol_or_container_id_t *const poc_id);
......@@ -138,61 +166,206 @@ class smf_app {
smf_app(smf_app const&) = delete;
void operator=(smf_app const&) = delete;
/*
* Set the association between Seid and SM Context
* @param [const seid_t &] seid: SessionID
* @param [std::shared_ptr<smf_context> &] pc : Shared_ptr to a SMF context
* @return
*/
void set_seid_2_smf_context(const seid_t &seid,
std::shared_ptr<smf_context> &pc);
/*
* Find SMF context associated with a Session ID
* @param [const seid_t &] seid: SessionID
* @param [std::shared_ptr<smf_context> &] pc : Shared_ptr to a SMF context
* @return bool: True if SMF context found, otherwise return false
*/
bool seid_2_smf_context(const seid_t &seid,
std::shared_ptr<smf_context> &pc) const;