Commit ed394778 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

merge develop into prepare_release

parents 21a25f33 2aec7a14
......@@ -71,7 +71,7 @@ class IndividualSMContextApi {
}
void init();
const std::string base = "/nsmf-pdusession/v2";
const std::string base = "/nsmf-pdusession/v1";
private:
void setupRoutes();
......
......@@ -62,7 +62,7 @@ class SMContextsCollectionApi {
}
void init();
const std::string base = "/nsmf-pdusession/v2";
const std::string base = "/nsmf-pdusession/v1";
private:
void setupRoutes();
......
......@@ -292,7 +292,7 @@ void smf_http2_server::create_sm_contexts_handler(
//set api root to be used as location header in HTTP response
sm_context_req_msg.set_api_root(
m_address + ":" + std::to_string(m_port)
+ "/nsmf-pdusession/v2/sm-context");
+ "/nsmf-pdusession/v1/sm-context");
//supi
supi_t supi = { .length = 0 };
......
......@@ -62,6 +62,8 @@ void Logger::_init(const char *app, const bool log_stdout,
m_udp = new _Logger("udp ", m_sinks, ss.str().c_str());
m_pfcp = new _Logger("pfcp ", m_sinks, ss.str().c_str());
m_pfcp_switch = new _Logger("pfcp_sw ", m_sinks, ss.str().c_str());
m_smf_n1 = new _Logger("smf_n1 ", m_sinks, ss.str().c_str());
m_smf_n2 = new _Logger("smf_n2 ", m_sinks, ss.str().c_str());
m_smf_n4 = new _Logger("smf_n4 ", m_sinks, ss.str().c_str());
m_smf_n10 = new _Logger("smf_n10 ", m_sinks, ss.str().c_str());
m_smf_n11 = new _Logger("smf_n11 ", m_sinks, ss.str().c_str());
......
......@@ -107,6 +107,13 @@ class Logger {
static _Logger& pfcp_switch() {
return *singleton().m_pfcp_switch;
}
static _Logger& smf_n1() {
return *singleton().m_smf_n1;
}
static _Logger& smf_n2() {
return *singleton().m_smf_n2;
}
static _Logger& smf_n4() {
return *singleton().m_smf_n4;
}
......@@ -146,6 +153,8 @@ class Logger {
_Logger *m_udp;
_Logger *m_pfcp;
_Logger *m_pfcp_switch;
_Logger *m_smf_n1;
_Logger *m_smf_n2;
_Logger *m_smf_n4;
_Logger *m_smf_n10;
_Logger *m_smf_n11;
......
......@@ -179,14 +179,15 @@ typedef struct qos_profile_s {
} qos_profile_t;
//URL, N1, N2 (may get from configuration file)
#define NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL "/namf-comm/v2/ue-contexts/{}/n1-n2-messages" //context id
#define NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL "/namf-comm/v1/ue-contexts/{}/n1-n2-messages" //context id
#define NUDM_SDM_GET_SM_DATA_URL "/nudm-sdm/v2/{}/sm-data" //ue Id
#define N1_SM_CONTENT_ID "n1SmMsg"
#define N1N2_MESSAGE_CLASS "SM"
#define N2_SM_CONTENT_ID "n2msg"
#define NSMF_CALLBACK_N1N2_MESSAGE_TRANSFER_FAILURE "/nsmf-pdusession/v2/callback/N1N2MsgTxfrFailureNotification/{}" //UE Id
#define NSMF_PDU_SESSION_SM_CONTEXT_CREATE_URL "/nsmf-pdusession/v2/sm-contexts"
#define NSMF_PDU_SESSION_SM_CONTEXT_UPDATE_URL "/nsmf-pdusession/v2/sm-contexts/"
#define NSMF_CALLBACK_N1N2_MESSAGE_TRANSFER_FAILURE "/nsmf-pdusession/v1/callback/N1N2MsgTxfrFailureNotification/{}" //UE Id
#define NSMF_PDU_SESSION_SM_CONTEXT_CREATE_URL "/nsmf-pdusession/v1/sm-contexts"
#define NSMF_PDU_SESSION_SM_CONTEXT_UPDATE_URL "/nsmf-pdusession/v1/sm-contexts/"
//for CURL
#define AMF_CURL_TIMEOUT_MS 100L
......
......@@ -50,7 +50,8 @@ add_library (SMF STATIC
smf_app.cpp
smf_config.cpp
smf_context.cpp
smf_n1_n2.cpp
smf_n1.cpp
smf_n2.cpp
smf_pfcp_association.cpp
smf_pco.cpp
smf_procedure.cpp
......
......@@ -44,7 +44,7 @@
#include "3gpp_24.007.h"
#include "smf.h"
#include "3gpp_24.501.h"
#include "smf_n1_n2.hpp"
#include "smf_n1.hpp"
#include "smf_paa_dynamic.hpp"
#include "smf_n4.hpp"
#include "smf_n10.hpp"
......@@ -548,7 +548,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
oai::smf_server::model::ProblemDetails problem_details = { };
oai::smf_server::model::RefToBinaryData refToBinaryData = { };
std::string n1_sm_message, n1_sm_message_hex;
smf_n1_n2 smf_n1_n2_inst = { };
smf_n1 smf_n1_inst = { };
nas_message_t decoded_nas_msg = { };
cause_value_5gsm_e cause_n1 = { cause_value_5gsm_e::CAUSE_0_UNKNOWN };
pdu_session_type_t pdu_session_type = { .pdu_session_type =
......@@ -557,7 +557,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
//Step 1. Decode NAS and get the necessary information
std::string n1_sm_msg = smreq->req.get_n1_sm_message();
int decoder_rc = smf_n1_n2_inst.decode_n1_sm_container(decoded_nas_msg,
int decoder_rc = smf_n1_inst.decode_n1_sm_container(decoded_nas_msg,
n1_sm_msg);
if (decoder_rc != RETURNok) {
//error, send reply to AMF with PDU Session Establishment Reject
......@@ -567,9 +567,9 @@ void smf_app::handle_pdu_session_create_sm_context_request(
smContextCreateError.setError(problem_details);
refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData);
if (smf_n1_n2_inst.create_n1_sm_container(
smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
cause_value_5gsm_e::CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE)) {
if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req, n1_sm_message,
cause_value_5gsm_e::CAUSE_95_SEMANTICALLY_INCORRECT_MESSAGE)) {
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
//trigger to send reply to AMF
trigger_http_response(http_status_code_e::HTTP_STATUS_CODE_403_FORBIDDEN,
......@@ -625,9 +625,8 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject
if (smf_n1_n2_inst.create_n1_sm_container(smreq->req,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message, cause_n1)) {
if (smf_n1_inst.create_n1_pdu_session_establishment_reject(smreq->req,
n1_sm_message, cause_n1)) {
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
//trigger to send reply to AMF
trigger_http_response(http_status_code_e::HTTP_STATUS_CODE_403_FORBIDDEN,
......@@ -677,9 +676,9 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject including cause "#81 Invalid PTI value" (section 7.3.1 @3GPP TS 24.501)
if (smf_n1_n2_inst.create_n1_sm_container(
smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
cause_value_5gsm_e::CAUSE_81_INVALID_PTI_VALUE)) {
if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req, n1_sm_message,
cause_value_5gsm_e::CAUSE_81_INVALID_PTI_VALUE)) {
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
//trigger to send reply to AMF
trigger_http_response(http_status_code_e::HTTP_STATUS_CODE_403_FORBIDDEN,
......@@ -717,12 +716,10 @@ void smf_app::handle_pdu_session_create_sm_context_request(
smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject
//(24.501 (section 7.4)) implementation dependent->do similar to UE: response with a 5GSM STATUS message including cause "#98 message type not compatible with protocol state."
if (smf_n1_n2_inst.create_n1_sm_container(
smreq->req,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message,
cause_value_5gsm_e::CAUSE_98_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE)) {
if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req,
n1_sm_message,
cause_value_5gsm_e::CAUSE_98_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE)) {
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
//trigger to send reply to AMF
trigger_http_response(http_status_code_e::HTTP_STATUS_CODE_403_FORBIDDEN,
......@@ -759,9 +756,9 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject, 24.501 cause "#27 Missing or unknown DNN"
if (smf_n1_n2_inst.create_n1_sm_container(
smreq->req, PDU_SESSION_ESTABLISHMENT_REJECT, n1_sm_message,
cause_value_5gsm_e::CAUSE_27_MISSING_OR_UNKNOWN_DNN)) {
if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req, n1_sm_message,
cause_value_5gsm_e::CAUSE_27_MISSING_OR_UNKNOWN_DNN)) {
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
//trigger to send reply to AMF
trigger_http_response(http_status_code_e::HTTP_STATUS_CODE_403_FORBIDDEN,
......@@ -851,12 +848,11 @@ void smf_app::handle_pdu_session_create_sm_context_request(
refToBinaryData.setContentId(N1_SM_CONTENT_ID);
smContextCreateError.setN1SmMsg(refToBinaryData);
//PDU Session Establishment Reject, with cause "29 User authentication or authorization failed"
if (smf_n1_n2_inst.create_n1_sm_container(
if (smf_n1_inst.create_n1_pdu_session_establishment_reject(
smreq->req,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_message,
cause_value_5gsm_e::CAUSE_29_USER_AUTHENTICATION_OR_AUTHORIZATION_FAILED)) {
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
smf_app_inst->convert_string_2_hex(n1_sm_message, n1_sm_message_hex);
//trigger to send reply to AMF
trigger_http_response(
http_status_code_e::HTTP_STATUS_CODE_403_FORBIDDEN,
......
This diff is collapsed.
This diff is collapsed.
/*
* 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
*/
/*! \file smf_n1.hpp
* \brief
\author Tien-Thinh NGUYEN
\company Eurecom
\date 2019
\email: tien-thinh.nguyen@eurecom.fr
*/
#ifndef FILE_SMF_N1_HPP_SEEN
#define FILE_SMF_N1_HPP_SEEN
#include <string>
#include "smf.h"
#include "smf_context.hpp"
#include "smf_msg.hpp"
#include "3gpp_29.502.h"
extern "C" {
#include "nas_message.h"
}
namespace smf {
class smf_n1 {
private:
public:
smf_n1() {
}
;
smf_n1(smf_n1 const&) = delete;
void operator=(smf_n1 const&) = delete;
/*
* Create N1 SM Container: PDU Session Establishment Accept
* @param [pdu_session_create_sm_context_response] sm_context_res: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @param [uint8_t] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n1_pdu_session_establishment_accept(pdu_session_create_sm_context_response &sm_context_res,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Establishment Reject
* @param [pdu_session_msg] msg: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @param [uint8_t] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n1_pdu_session_establishment_reject(pdu_session_msg &msg,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
//TODO: separate into 4 functions (verify if necessary)
/*
bool create_n1_pdu_session_establishment_accept(pdu_session_create_sm_context_response &sm_context_res,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
bool create_n1_pdu_session_establishment_reject(pdu_session_create_sm_context_request &msg, uint8_t msg_type,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
bool create_n1_pdu_session_establishment_reject(pdu_session_update_sm_context_response &msg, uint8_t msg_type,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
bool create_n1_pdu_session_establishment_reject(pdu_session_update_sm_context_request &msg, uint8_t msg_type,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
*/
//For testing purpose
bool create_n1_pdu_session_modification_request(pdu_session_update_sm_context_response &msg,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Modification Command
* Included in PDU Session Update SM Context Response (PDU Session Modification UE-Initiated procedure - step 1)
* @param [pdu_session_msg] msg: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @param [uint8_t] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n1_pdu_session_modification_command(pdu_session_update_sm_context_response &msg,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Modification Command
* Included in N1N2MessageTransfer Request (PDU Session Modification SMF-Requested, step 1 (from SMF to AMF))
* @param [pdu_session_msg] msg: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @param [uint8_t] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n1_pdu_session_modification_command(pdu_session_modification_network_requested &msg,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Release Reject
* Included in PDU Session Update SM Context Response (PDU Session Release UE-Initiated, step 1)
* @param [pdu_session_msg] msg: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @param [uint8_t] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n1_pdu_session_release_reject(pdu_session_update_sm_context_request &sm_context_res,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Release Command
* Included in PDU Session Update SM Context Response (PDU Session Release UE-Initiated, step 1)
* @param [pdu_session_msg] msg: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @param [uint8_t] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n1_pdu_session_release_command(pdu_session_update_sm_context_response &msg,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Create N1 SM Container: PDU Session Release Command
* Included in N1N2MessageTransfer Request (PDU Session Release SMF-Requested, step 1)
* @param [pdu_session_msg] msg: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @param [uint8_t] sm_cause store NAS Cause
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n1_pdu_session_release_command(pdu_session_modification_network_requested &msg,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
/*
* Decode N1 SM Container into the NAS mesasge (using NAS lib)
* @param [nas_message_t&] nas_msg Store NAS message after decoded
* @param [const std::string&] n1_sm_msg N1 SM Container
* @return status of the decode process
*/
int decode_n1_sm_container(nas_message_t &nas_msg, const std::string &n1_sm_msg);
};
} // namespace smf
#endif /* FILE_SMF_N1_HPP_SEEN */
......@@ -42,7 +42,6 @@
#include "logger.hpp"
#include "smf_app.hpp"
#include "smf_config.hpp"
#include "smf_n1_n2.hpp"
#include "mime_parser.hpp"
extern "C" {
......@@ -129,7 +128,6 @@ void smf_n11::send_n1n2_message_transfer_request(
Logger::smf_n11().debug("Send Communication_N1N2MessageTransfer to AMF (HTTP version %d)", sm_context_res->http_version);
mime_parser parser = {};
smf_n1_n2 smf_n1_n2_inst = { };
std::string n1_message = sm_context_res->res.get_n1_sm_message();
nlohmann::json json_data = {};
std::string body;
......@@ -248,7 +246,6 @@ void smf_n11::send_n1n2_message_transfer_request(
mime_parser parser = {};
std::string body;
smf_n1_n2 smf_n1_n2_inst = { };
nlohmann::json json_data = {};
std::string json_part;
std::string n1_message = sm_session_modification->msg.get_n1_sm_message();
......@@ -337,7 +334,6 @@ void smf_n11::send_n1n2_message_transfer_request(
"Send Communication_N1N2MessageTransfer to AMF (Network-initiated Service Request)");
mime_parser parser = {};
smf_n1_n2 smf_n1_n2_inst = { };
std::string n2_message = report_msg->res.get_n2_sm_information();
nlohmann::json json_data = {};
std::string body;
......
This diff is collapsed.
This diff is collapsed.
......@@ -19,7 +19,7 @@
* contact@openairinterface.org
*/
/*! \file smf_n1_n2.hpp
/*! \file smf_n2.hpp
* \brief
\author Tien-Thinh NGUYEN
\company Eurecom
......@@ -27,24 +27,12 @@
\email: tien-thinh.nguyen@eurecom.fr
*/
#ifndef FILE_SMF_N1_N2_HPP_SEEN
#define FILE_SMF_N1_N2_HPP_SEEN
#ifndef FILE_SMF_N2_HPP_SEEN
#define FILE_SMF_N2_HPP_SEEN
#include <map>
#include <set>
#include <shared_mutex>
#include <string>
#include <thread>
#include "pistache/endpoint.h"
#include "pistache/http.h"
#include "pistache/router.h"
#include "smf.h"
#include "3gpp_29.274.h"
#include "itti_msg_n4.hpp"
#include "itti_msg_n11.hpp"
#include "smf_context.hpp"
#include "smf_pco.hpp"
#include "smf_msg.hpp"
#include "smf_app.hpp"
#include "3gpp_29.502.h"
......@@ -52,8 +40,6 @@
#include "SmContextCreateError.h"
extern "C" {
#include "nas_message.h"
#include "Ngap_NGAP-PDU.h"
#include "Ngap_PDUSessionResourceSetupResponseTransfer.h"
#include "Ngap_PDUSessionResourceModifyResponseTransfer.h"
#include "Ngap_PDUSessionResourceReleaseResponseTransfer.h"
......@@ -62,47 +48,98 @@ extern "C" {
namespace smf {
class smf_n1_n2 {
class smf_n2 {
private:
public:
smf_n1_n2() {
smf_n2() {
}
;
smf_n1_n2(smf_n1_n2 const&) = delete;
void operator=(smf_n1_n2 const&) = delete;
smf_n2(smf_n2 const&) = delete;
void operator=(smf_n2 const&) = delete;
/*
* Create N1 SM Container to send to AMF (using NAS lib)
* @param [pdu_session_msg&] msg
* @param [uint8_t] msg_type Type of N1 message
* @param [std::string&] nas_msg_str store NAS message in form of string
* @param [uint8_t] sm_cause store NAS Cause
* @return boolean: True if the NAS message has been created successfully, otherwise return false
* Create N2 SM Information: PDU Session Resource Setup Request Transfer
* This IE is included in N1N2MessageTransfer Request (Accept, PDU Session Establishment procedure - UE initiated)
* @param [pdu_session_create_sm_context_response] sm_context_res: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n1_sm_container(pdu_session_msg &msg, uint8_t msg_type,
std::string &nas_msg_str,
cause_value_5gsm_e sm_cause);
bool create_n2_pdu_session_resource_setup_request_transfer(pdu_session_create_sm_context_response &sm_context_res, n2_sm_info_type_e ngap_info_type,
std::string &ngap_msg_str);
/*
* 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
* Create N2 SM Information: PDU Session Resource Setup Request Transfer
* This IE is included in PDU Session Update SM Context Response​ (Service Request, step 2)
* @param [pdu_session_update_sm_context_response] sm_context_res: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n2_sm_information(pdu_session_msg &msg, uint8_t ngap_msg_type,
n2_sm_info_type_e ngap_ie_type,
std::string &ngap_msg_str);
bool create_n2_pdu_session_resource_setup_request_transfer(pdu_session_update_sm_context_response &sm_context_res, n2_sm_info_type_e ngap_info_type,
std::string &ngap_msg_str);
/*
* Create N2 SM Information: PDU Session Resource Setup Request Transfer
* This IE is included in N1N2MessageTranfer (N4 Data Report)
* @param [pdu_session_report_response] msg: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n2_pdu_session_resource_setup_request_transfer(pdu_session_report_response &msg, n2_sm_info_type_e ngap_info_type,
std::string &ngap_msg_str);
/*
* Create N2 SM Information: PDU Session Resource Modify Request Transfer IE
* This IE is included in PDU Session Update SM Context Response (PDU Session Modification procedure, UE-initiated, step 1)
* @param [pdu_session_update_sm_context_response] sm_context_res: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n2_pdu_session_resource_modify_request_transfer(pdu_session_update_sm_context_response &sm_context_res, n2_sm_info_type_e ngap_info_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 [const std::string&] n1_sm_msg N1 SM Container
* @return status of the decode process
* Create N2 SM Information: PDU Session Resource Modify Request Transfer IE
* This IE is included in N1N2MessageTransfer Request (PDU Session Modification procedure, SMF-requested, step 1)
* @param [pdu_session_update_sm_context_response] sm_context_res: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
int decode_n1_sm_container(nas_message_t &nas_msg, const std::string &n1_sm_msg);
bool create_n2_pdu_session_resource_modify_request_transfer(pdu_session_modification_network_requested &msg, n2_sm_info_type_e ngap_info_type,
std::string &ngap_msg_str);
/*
* Create N2 SM Information: PDU Session Resource Modify Response Transfer IE
*
* @param [pdu_session_update_sm_context_response] sm_context_res: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n2_pdu_session_resource_modify_response_transfer(pdu_session_update_sm_context_response &sm_context_res, n2_sm_info_type_e ngap_info_type,
std::string &ngap_msg_str);
// bool create_n2_pdu_session_resource_modify_response_transfer(pdu_session_modification_network_requested &msg, n2_sm_info_type_e ngap_info_type,
// std::string &ngap_msg_str);
/*
* Create N2 SM Information: PDU Session Resource Release Command Transfer IE
* This IE is included in the following messages:
* PDU Session Update SM Context Response (PDU Session Release UE-Initiated: section 4.3.4@3GPP TS 23.502, step 1)
* N1N2MessageTransfer Request​ (PDU Session Release SMF-Requested, step 1)
* @param [pdu_session_update_sm_context_response] sm_context_res: include necessary information for encoding NGAP msg
* @param [std::string&] ngap_msg_str store the created NGAP message in form of string
* @return boolean: True if the NGAP message has been created successfully, otherwise return false
*
*/
bool create_n2_pdu_session_resource_release_command_transfer(pdu_session_update_sm_context_response &sm_context_res, n2_sm_info_type_e ngap_info_type,
std::string &ngap_msg_str);
/*
* Decode N2 SM Information Ngap_PDUSessionResourceSetupResponseTransfer
......@@ -144,9 +181,8 @@ class smf_n1_n2 {
std::shared_ptr<Ngap_PDUSessionResourceSetupUnsuccessfulTransfer_t> &ngap_IE,
const std::string &n2_sm_info);
};
} // namespace smf
#endif /* FILE_SMF_N1_N2_HPP_SEEN */
#endif /* FILE_SMF_N2_HPP_SEEN */
......@@ -43,7 +43,8 @@
#include "smf_config.hpp"
#include "smf_pfcp_association.hpp"
#include "smf_context.hpp"
#include "smf_n1_n2.hpp"
#include "smf_n1.hpp"
#include "smf_n2.hpp"
#include "smf_n11.hpp"
#include "SmContextCreatedData.h"
......@@ -370,7 +371,8 @@ void session_create_sm_context_procedure::handle_itti_msg(
//fill content for N1N2MessageTransfer (including N1, N2 SM)
// Create N1 SM container & N2 SM Information
smf_n1_n2 smf_n1_n2_inst = { };
smf_n1 smf_n1_inst = { };
smf_n2 smf_n2_inst = { };
std::string n1_sm_msg, n1_sm_msg_hex;
std::string n2_sm_info, n2_sm_info_hex;
......@@ -386,9 +388,8 @@ void session_create_sm_context_procedure::handle_itti_msg(
cause_value_5gsm_e::CAUSE_50_PDU_SESSION_TYPE_IPV4_ONLY_ALLOWED;
}
smf_n1_n2_inst.create_n1_sm_container(n11_triggered_pending->res,
PDU_SESSION_ESTABLISHMENT_REJECT,
n1_sm_msg, cause_n1);
smf_n1_inst.create_n1_pdu_session_establishment_reject(n11_triggered_pending->res,
n1_sm_msg, cause_n1);
smf_app_inst->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex);
n11_triggered_pending->res.set_n1_sm_message(n1_sm_msg_hex);
......@@ -404,15 +405,15 @@ void session_create_sm_context_procedure::handle_itti_msg(
cause_value_5gsm_e::CAUSE_50_PDU_SESSION_TYPE_IPV4_ONLY_ALLOWED;
}
smf_n1_n2_inst.create_n1_sm_container(n11_triggered_pending->res,
PDU_SESSION_ESTABLISHMENT_ACCEPT,
n1_sm_msg, cause_n1);
smf_n1_inst.create_n1_pdu_session_establishment_accept(n11_triggered_pending->res,
n1_sm_msg, cause_n1);
smf_app_inst->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex);
n11_triggered_pending->res.set_n1_sm_message(n1_sm_msg_hex);
//N2 SM Information (Step 11, section 4.3.2.2.1 @ 3GPP TS 23.502): PDUSessionRessourceSetupRequestTransfer IE
smf_n1_n2_inst.create_n2_sm_information(
n11_triggered_pending->res, 1, n2_sm_info_type_e::PDU_RES_SETUP_REQ,
smf_n2_inst.create_n2_pdu_session_resource_setup_request_transfer(
n11_triggered_pending->res, 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);
n11_triggered_pending->res.set_n2_sm_information(n2_sm_info_hex);
}
......@@ -864,7 +865,8 @@ void session_update_sm_context_procedure::handle_itti_msg(
itti_n4_session_modification_response &resp,
std::shared_ptr<smf::smf_context> sc) {
smf_n1_n2 smf_n1_n2_inst = { };
smf_n1 smf_n1_inst = { };
smf_n2 smf_n2_inst = { };
std::string n1_sm_msg, n1_sm_msg_hex;
std::string n2_sm_info, n2_sm_info_hex;
......@@ -1055,14 +1057,13 @@ void session_update_sm_context_procedure::handle_itti_msg(
//FOR TESTING PURPOSE
case session_management_procedures_type_e::PDU_SESSION_TEST: {
//N1 SM
smf_n1_n2_inst.create_n1_sm_container(
n11_triggered_pending->res, PDU_SESSION_MODIFICATION_REQUEST,
n1_sm_msg, cause_value_5gsm_e::CAUSE_0_UNKNOWN);
smf_n1_inst.create_n1_pdu_session_modification_request(
n11_triggered_pending->res, n1_sm_msg, cause_value_5gsm_e::CAUSE_0_UNKNOWN);
smf_app_inst->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex);
n11_triggered_pending->res.set_n1_sm_message(n1_sm_msg_hex);
//N2 SM Information
smf_n1_n2_inst.create_n2_sm_information(
n11_triggered_pending->res, 1, n2_sm_info_type_e::PDU_RES_MOD_RSP,
smf_n2_inst.create_n2_pdu_session_resource_modify_response_transfer(
n11_triggered_pending->res, n2_sm_info_type_e::PDU_RES_MOD_RSP,
n2_sm_info);
smf_app_inst->convert_string_2_hex(n2_sm_info, n2_sm_info_hex);
n11_triggered_pending->res.set_n2_sm_information(n2_sm_info_hex);
......@@ -1096,9 +1097,10 @@ void session_update_sm_context_procedure::handle_itti_msg(
// Create N2 SM Information: PDU Session Resource Setup Request Transfer IE
//N2 SM Information
smf_n1_n2_inst.create_n2_sm_information(
n11_triggered_pending->res, 1, n2_sm_info_type_e::PDU_RES_SETUP_REQ,
smf_n2_inst.create_n2_pdu_session_resource_setup_request_transfer(
n11_triggered_pending->res, 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);
n11_triggered_pending->res.set_n2_sm_information(n2_sm_info_hex);
......@@ -1156,8 +1158,8 @@ void session_update_sm_context_procedure::handle_itti_msg(
Logger::smf_app().info("PDU Session Release UE-initiated (Step 1))");
//N1 SM
smf_n1_n2_inst.create_n1_sm_container(
n11_triggered_pending->res, PDU_SESSION_RELEASE_COMMAND, n1_sm_msg,
smf_n1_inst.create_n1_pdu_session_release_command(
n11_triggered_pending->res, n1_sm_msg,
cause_value_5gsm_e::CAUSE_26_INSUFFICIENT_RESOURCES); //TODO: check Cause
smf_app_inst->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex);
n11_triggered_pending->res.set_n1_sm_message(n1_sm_msg_hex);
......@@ -1165,8 +1167,8 @@ void session_update_sm_context_procedure::handle_itti_msg(
//include N2 SM Resource Release Request only when User Plane connection is activated
if (sps->get_upCnx_state() == upCnx_state_e::UPCNX_STATE_ACTIVATED) {
//N2 SM Information
smf_n1_n2_inst.create_n2_sm_information(
n11_triggered_pending->res, 1, n2_sm_info_type_e::PDU_RES_REL_CMD,
smf_n2_inst.create_n2_pdu_session_resource_release_command_transfer(
n11_triggered_pending->res, n2_sm_info_type_e::PDU_RES_REL_CMD,
n2_sm_info);
smf_app_inst->convert_string_2_hex(n2_sm_info, n2_sm_info_hex);
n11_triggered_pending->res.set_n2_sm_information(n2_sm_info_hex);
......
......@@ -44,7 +44,7 @@ public:
virtual ~N1N2MessageCollectionDocumentApi() {}
void init();
const std::string base = "/namf-comm/v2";
const std::string base = "/namf-comm/v1";
private:
void setupRoutes();
......
......@@ -233,7 +233,7 @@ bool send_pdu_session_establishment_request(uint8_t pid,
url.append(std::string(":"));
url.append(port);
}
url.append(std::string("/nsmf-pdusession/v2/sm-contexts"));
url.append(std::string("/nsmf-pdusession/v1/sm-contexts"));
//Fill the json part
pdu_session_establishment_request["supi"] = "imsi-200000000000001";
......@@ -372,10 +372,10 @@ bool send_pdu_session_update_sm_context_establishment(
url.append(std::string(":"));
url.append(port);
}
url.append(std::string("/nsmf-pdusession/v2/sm-contexts/"));
url.append(std::string("/nsmf-pdusession/v1/sm-contexts/"));
url.append(std::to_string(context_id));
url.append(std::string("/modify"));
// url.append(std::string("/nsmf-pdusession/v2/sm-contexts/1/modify"));
// url.append(std::string("/nsmf-pdusession/v1/sm-contexts/1/modify"));
//Fill the json part
pdu_session_update_request["n2SmInfoType"] = "PDU_RES_SETUP_RSP";
......@@ -530,8 +530,8 @@ void send_pdu_session_modification_request_step1(uint8_t pid,
url.append(std::string(":"));
url.append(port);
}
//url.append(std::string("/nsmf-pdusession/v2/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v2/sm-contexts/"));
//url.append(std::string("/nsmf-pdusession/v1/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v1/sm-contexts/"));
url.append(std::to_string(context_id));
url.append(std::string("/modify"));
......@@ -655,8 +655,8 @@ void send_pdu_session_modification_request_step2(uint8_t context_id,
url.append(std::string(":"));
url.append(port);
}
// url.append(std::string("/nsmf-pdusession/v2/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v2/sm-contexts/"));
// url.append(std::string("/nsmf-pdusession/v1/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v1/sm-contexts/"));
url.append(std::to_string(context_id));
url.append(std::string("/modify"));
......@@ -771,8 +771,8 @@ void send_pdu_session_modification_complete(uint8_t pid, uint8_t context_id,
url.append(std::string(":"));
url.append(port);
}
// url.append(std::string("/nsmf-pdusession/v2/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v2/sm-contexts/"));
// url.append(std::string("/nsmf-pdusession/v1/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v1/sm-contexts/"));
url.append(std::to_string(context_id));
url.append(std::string("/modify"));
......@@ -886,8 +886,8 @@ void send_pdu_session_release_request(uint8_t pid, uint8_t context_id,
url.append(std::string(":"));
url.append(port);
}
//url.append(std::string("/nsmf-pdusession/v2/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v2/sm-contexts/"));
//url.append(std::string("/nsmf-pdusession/v1/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v1/sm-contexts/"));
url.append(std::to_string(context_id));
url.append(std::string("/modify"));
......@@ -997,8 +997,8 @@ void send_pdu_session_release_resource_release_ack(uint8_t context_id,
url.append(std::string(":"));
url.append(port);
}
// url.append(std::string("/nsmf-pdusession/v2/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v2/sm-contexts/"));
// url.append(std::string("/nsmf-pdusession/v1/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v1/sm-contexts/"));
url.append(std::to_string(context_id));
url.append(std::string("/modify"));
......@@ -1116,8 +1116,8 @@ void send_pdu_session_release_complete(uint8_t pid, uint8_t context_id,
url.append(std::string(":"));
url.append(port);
}
//url.append(std::string("/nsmf-pdusession/v2/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v2/sm-contexts/"));
//url.append(std::string("/nsmf-pdusession/v1/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v1/sm-contexts/"));
url.append(std::to_string(context_id));
url.append(std::string("/modify"));
......@@ -1215,8 +1215,8 @@ void send_pdu_session_update_sm_context_ue_service_request(
url.append(std::string(":"));
url.append(port);
}
//url.append(std::string("/nsmf-pdusession/v2/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v2/sm-contexts/"));
//url.append(std::string("/nsmf-pdusession/v1/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v1/sm-contexts/"));
url.append(std::to_string(context_id));
url.append(std::string("/modify"));
......@@ -1329,8 +1329,8 @@ void send_pdu_session_update_sm_context_ue_service_request_step2(
url.append(std::string(":"));
url.append(port);
}
//url.append(std::string("/nsmf-pdusession/v2/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v2/sm-contexts/"));
//url.append(std::string("/nsmf-pdusession/v1/sm-contexts/1/modify"));
url.append(std::string("/nsmf-pdusession/v1/sm-contexts/"));
url.append(std::to_string(context_id));
url.append(std::string("/modify"));
......@@ -1437,8 +1437,8 @@ void send_release_sm_context_request(uint8_t pid, uint8_t context_id,
url.append(std::string(":"));
url.append(port);
}
//url.append(std::string("/nsmf-pdusession/v2/sm-contexts/1/release"));
url.append(std::string("/nsmf-pdusession/v2/sm-contexts/"));
//url.append(std::string("/nsmf-pdusession/v1/sm-contexts/1/release"));
url.append(std::string("/nsmf-pdusession/v1/sm-contexts/"));
url.append(std::to_string(context_id));
url.append(std::string("/release"));
......
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