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

decode N2 SM info

parent 35a96ac9
......@@ -52,13 +52,25 @@ void IndividualSMContextApiImpl::update_sm_context(const std::string &smContextR
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());
//Step1. Decode N2 SM information into decoded ngap msg
std::string n2_sm_info_type = smContextUpdateData.getN2SmInfoType();
if (n2_sm_info_type.compare("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,&asn_DEF_Ngap_PDUSessionResourceSetupRequestTransfer, (void **)&decoded_msg, n2_sm_msg_hex, n2_sm_msg_hex.length());
if(rc.code != RC_OK)
{
Logger::smf_api_server().warn("asn_decode failed %d...\n",rc.code );
}
}
/*
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
......
......@@ -648,6 +648,18 @@ void SmContextUpdateData::unsetN2SmInfo()
{
m_N2SmInfoIsSet = false;
}
std::string SmContextUpdateData::getN2SmInfoType() const
{
return m_N2SmInfoType;
}
void SmContextUpdateData::setN2SmInfoType(std::string const& value)
{
m_N2SmInfoType = value;
m_N2SmInfoTypeIsSet = true;
}
/*
N2SmInfoType SmContextUpdateData::getN2SmInfoType() const
{
return m_N2SmInfoType;
......@@ -657,6 +669,7 @@ void SmContextUpdateData::setN2SmInfoType(N2SmInfoType const& value)
m_N2SmInfoType = value;
m_N2SmInfoTypeIsSet = true;
}
*/
bool SmContextUpdateData::n2SmInfoTypeIsSet() const
{
return m_N2SmInfoTypeIsSet;
......
......@@ -188,8 +188,11 @@ public:
/// <summary>
///
/// </summary>
N2SmInfoType getN2SmInfoType() const;
void setN2SmInfoType(N2SmInfoType const& value);
//N2SmInfoType getN2SmInfoType() const;
//void setN2SmInfoType(N2SmInfoType const& value);
std::string getN2SmInfoType() const;
void setN2SmInfoType(std::string const& value);
bool n2SmInfoTypeIsSet() const;
void unsetN2SmInfoType();
/// <summary>
......@@ -356,7 +359,8 @@ protected:
bool m_N1SmMsgIsSet;
RefToBinaryData m_N2SmInfo;
bool m_N2SmInfoIsSet;
N2SmInfoType m_N2SmInfoType;
//N2SmInfoType m_N2SmInfoType;
std::string m_N2SmInfoType;
bool m_N2SmInfoTypeIsSet;
NgRanTargetId m_TargetId;
bool m_TargetIdIsSet;
......
......@@ -494,6 +494,10 @@ void smf_app::handle_amf_msg (std::shared_ptr<itti_n11_update_sm_context_request
pdu_session_id_t pdu_session_id = std::get<2>(sm_context);
supi64_t supi64 = smf_supi_to_u64(supi);
//store in itti_n11_update_sm_context_request to be processed later on
smreq->set_supi(supi);
smreq->set_dnn(dnn);
smreq->set_pdu_session_id(pdu_session_id);
//Step 1. get necessary information (N2 SM information)
......@@ -519,6 +523,15 @@ void smf_app::handle_amf_msg (std::shared_ptr<itti_n11_update_sm_context_request
return;
}
//get dnn context
std::shared_ptr<dnn_context> sd;
if (!sc.get()->find_dnn_context(dnn, sd)) {
if (nullptr == sd.get()){
//TODO: Error, DNN context doesn't exist
}
}
//Step 3. Verify AMF??
//TODO: based on AMF ID > get the fteid -> get the SMF context (we should also verify AMF_ID)
......@@ -3046,6 +3059,13 @@ int smf_app::decode_ngap_message(Ngap_NGAP_PDU_t& ngap_msg, std::string& n2_sm_i
//step 1. Decode NGAP message (for instance, ... only served as an example)
int decoder_rc = RETURNok;
//Ngap_PDUSessionResourceSetupRequestTransfer_t
// Ngap_PDUSessionResourceSetupRequestTransfer_t *decoded_msg = null;
// std::string n2_sm_info_hex; //store the n2_sm_info from AMF
//Decode N2 SM info into decoded nas msg
// asn_dec_rval_t rc = asn_decode(NULL,&asn_DEF_Ngap_PDUSessionResourceSetupRequestTransfer, (void **)&decoded_msg, n2_sm_info_hex, n2_sm_info_hex.length());
return decoder_rc;
}
......
......@@ -82,11 +82,11 @@ private:
//---------------------------------------------------------------------------------------
//for PDU session update
//see SmContextUpdateData (TS29502_Nsmf_PDUSession.yaml)
class pdu_session_update_sm_context_request: public pdu_session_msg {
public:
pdu_session_update_sm_context_request(): pdu_session_msg(){ };
private:
//
//std::string m_Ppei;
std::string m_nf_instanceId;
oai::smf_server::model::Guami m_guami;
......@@ -118,8 +118,7 @@ private:
$ref: '../TS29571_CommonData.yaml#/components/schemas/TimeZone'
addUeLocation:
$ref: '../TS29571_CommonData.yaml#/components/schemas/UserLocation'
upCnxState:
$ref: '#/components/schemas/UpCnxState'
hoState:
$ref: '#/components/schemas/HoState'
toBeSwitched:
......@@ -128,6 +127,7 @@ private:
failedToBeSwitched:
type: boolean
*/
std::string m_upCnx_state; //'#/components/schemas/UpCnxState'
oai::smf_server::model::RefToBinaryData m_n1_sm_msg; //n1SmMsg
oai::smf_server::model::RefToBinaryData m_n2_sm_info; //n2SmInfo
......
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