Commit 7fd421ee authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

fix issue for decode N2 sm info

parent 61f246d6
......@@ -320,8 +320,8 @@ check_install_smf_deps() {
ret=$?;[[ $ret -ne 0 ]] && return $ret
# Use fmt lib included in spdlog
#install_fmt $1
#ret=$?;[[ $ret -ne 0 ]] && return $ret
install_fmt $1
ret=$?;[[ $ret -ne 0 ]] && return $ret
install_fb_folly_from_source $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
......
......@@ -41,7 +41,7 @@ void SMContextsCollectionApi::post_sm_contexts_handler(const Pistache::Rest::Req
// Getting the body param
std::cout <<"received a SM context create request"<<std::endl;
std::cout <<"received a SM context create request" << request.body() <<std::endl;
SmContextMessage smContextMessage;
try {
......
......@@ -13,7 +13,6 @@
#include "IndividualSMContextApiImpl.h"
extern "C" {
#include "Ngap_NGAP-PDU.h"
#include "Ngap_PDUSessionResourceSetupRequestTransfer.h"
}
namespace oai {
namespace smf_server {
......@@ -55,27 +54,19 @@ void IndividualSMContextApiImpl::update_sm_context(const std::string &smContextR
std::string n2_sm_info_type = smContextUpdateData.getN2SmInfoType();
//Temps: decode Ngap_PDUSessionResourceSetupRequestTransfer
if (n2_sm_info_type.compare(n2_sm_info_type_e2str[PDU_RES_SETUP_REQ]) == 0){
Ngap_PDUSessionResourceSetupRequestTransfer_t *decoded_msg = NULL;
//Decode N2 SM info into decoded nas msg
asn_dec_rval_t rc = asn_decode(NULL,ATS_ALIGNED_CANONICAL_PER, &asn_DEF_Ngap_PDUSessionResourceSetupRequestTransfer, (void **)&decoded_msg, (void *)n2_sm_msg_hex.c_str(), n2_sm_msg_hex.length());
if(rc.code != RC_OK)
{
Logger::smf_api_server().warn("asn_decode failed %d...\n",rc.code );
//TODO: send error to AMF??
}
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
......
......@@ -499,7 +499,6 @@ void smf_app::handle_amf_msg (std::shared_ptr<itti_n11_update_sm_context_request
smreq->req.set_dnn(dnn);
smreq->req.set_pdu_session_id(pdu_session_id);
//Step 1. get necessary information (N2 SM information)
//Step 2. find the smf context
std::shared_ptr<smf_context> sc;
......
......@@ -38,7 +38,9 @@
#include "3gpp_24.501.h"
#include "SmContextCreatedData.h"
#include <algorithm>
extern "C"{
#include "Ngap_PDUSessionResourceSetupResponseTransfer.h"
}
using namespace smf;
extern itti_mw *itti_inst;
......@@ -620,6 +622,31 @@ void smf_context::handle_amf_msg (std::shared_ptr<itti_n11_update_sm_context_req
Logger::smf_app().info("Handle a PDU Session Update SM Context Request message from AMF");
pdu_session_update_sm_context_request sm_context_req_msg = smreq->req;
//Step 1. get necessary information (N2 SM information)
std::string n2_sm_info_type = smreq->req.get_n2_sm_info_type();
std::string n2_sm_infomation = smreq->req.get_n2_sm_information();
//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;
//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)
{
Logger::smf_api_server().warn("asn_decode failed %d...\n",rc.code );
//TODO: send error to AMF??
}
// Ngap_QosFlowPerTNLInformation_t qosFlowPerTNLInformation;
// struct Ngap_QosFlowPerTNLInformation *additionalQosFlowPerTNLInformation; /* OPTIONAL */
// struct Ngap_SecurityResult *securityResult; /* OPTIONAL */
// struct Ngap_QosFlowList *qosFlowFailedToSetupList; /* OPTIONAL */
// struct Ngap_ProtocolExtensionContainer *iE_Extensions; /* OPTIONAL */
}
//TODO:
//get dnn context
//get SMF PDU Session context
......
......@@ -237,3 +237,23 @@ void pdu_session_create_sm_context_response::set_qos_flow_context(const qos_flow
qos_flow_context = qos_flow;
}
/* pdu_session_update_sm_context_request */
std::string pdu_session_update_sm_context_request::get_n2_sm_information() const{
return n2_sm_information;
}
void pdu_session_update_sm_context_request::set_n2_sm_information(std::string const& value){
n2_sm_information = value;
}
std::string pdu_session_update_sm_context_request::get_n2_sm_info_type() const{
return n2_sm_info_type;
}
void pdu_session_update_sm_context_request::set_n2_sm_info_type(std::string const& value){
n2_sm_info_type = value;
}
......@@ -86,7 +86,13 @@ private:
class pdu_session_update_sm_context_request: public pdu_session_msg {
public:
pdu_session_update_sm_context_request(): pdu_session_msg(){ };
std::string get_n2_sm_information() const;
void set_n2_sm_information(std::string const& value);
std::string get_n2_sm_info_type() const;
void set_n2_sm_info_type(std::string const& value);
private:
std::string n2_sm_information;
std::string n2_sm_info_type;
//std::string m_Ppei;
std::string m_nf_instanceId;
oai::smf_server::model::Guami m_guami;
......
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