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

First version for PDU Session Resource Modify request

parent f1c2d4b9
...@@ -155,8 +155,8 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer& itti_msg) { ...@@ -155,8 +155,8 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer& itti_msg) {
protected_nas); protected_nas);
if (itti_msg.is_n2sm_set) { if (itti_msg.is_n2sm_set) {
// PDU Session Resource Release Command
if (itti_msg.n2sm_info_type.compare("PDU_RES_REL_CMD") == 0) { if (itti_msg.n2sm_info_type.compare("PDU_RES_REL_CMD") == 0) {
// PDU SESSION RESOURCE RELEASE COMMAND
itti_pdu_session_resource_release_command* release_command = itti_pdu_session_resource_release_command* release_command =
new itti_pdu_session_resource_release_command( new itti_pdu_session_resource_release_command(
TASK_AMF_N1, TASK_AMF_N2); TASK_AMF_N1, TASK_AMF_N2);
...@@ -174,6 +174,46 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer& itti_msg) { ...@@ -174,6 +174,46 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer& itti_msg) {
"Could not send ITTI message %s to task TASK_AMF_N2", "Could not send ITTI message %s to task TASK_AMF_N2",
i->get_msg_name()); i->get_msg_name());
} }
// PDU Session Resource Modify Request
} else if (itti_msg.n2sm_info_type.compare("PDU_RES_MOD_REQ") == 0) {
std::shared_ptr<itti_pdu_session_resource_modify_request>
itti_modify_request_msg =
std::make_shared<itti_pdu_session_resource_modify_request>(
TASK_AMF_N1, TASK_AMF_N2);
itti_modify_request_msg->nas = protected_nas;
itti_modify_request_msg->n2sm = itti_msg.n2sm;
itti_modify_request_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_modify_request_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_modify_request_msg->pdu_session_id = itti_msg.pdu_session_id;
// Get NSSAI
std::shared_ptr<nas_context> nc = {};
if (!is_amf_ue_id_2_nas_context(amf_ue_ngap_id)) {
Logger::amf_n1().warn(
"No existed NAS context for UE with amf_ue_ngap_id (0x%x)",
amf_ue_ngap_id);
return;
}
nc = amf_ue_id_2_nas_context(amf_ue_ngap_id);
std::shared_ptr<pdu_session_context> psc = {};
if (!amf_app_inst->find_pdu_session_context(
nc->imsi, itti_msg.pdu_session_id, psc)) {
Logger::amf_n1().error(
"Cannot get pdu_session_context with SUPI (%s)", nc->imsi.c_str());
return;
}
itti_modify_request_msg->s_NSSAI.setSd(psc->snssai.sD);
itti_modify_request_msg->s_NSSAI.setSst(std::to_string(psc->snssai.sST));
int ret = itti_inst->send_msg(itti_modify_request_msg);
if (0 != ret) {
Logger::amf_n1().error(
"Could not send ITTI message %s to task TASK_AMF_N2",
itti_modify_request_msg->get_msg_name());
}
} else { } else {
string ue_context_key = "app_ue_ranid_" + to_string(ran_ue_ngap_id) + string ue_context_key = "app_ue_ranid_" + to_string(ran_ue_ngap_id) +
":amfid_" + to_string(amf_ue_ngap_id); ":amfid_" + to_string(amf_ue_ngap_id);
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "PDUSessionResourceHandoverCommandTransfer.hpp" #include "PDUSessionResourceHandoverCommandTransfer.hpp"
#include "PduSessionResourceReleaseCommand.hpp" #include "PduSessionResourceReleaseCommand.hpp"
#include "PduSessionResourceSetupRequest.hpp" #include "PduSessionResourceSetupRequest.hpp"
#include "PduSessionResourceModifyRequest.hpp"
#include "UEContextReleaseCommand.hpp" #include "UEContextReleaseCommand.hpp"
#include "HandoverPreparationFailure.hpp" #include "HandoverPreparationFailure.hpp"
#include "Paging.hpp" #include "Paging.hpp"
...@@ -132,6 +133,13 @@ void amf_n2_task(void* args_p) { ...@@ -132,6 +133,13 @@ void amf_n2_task(void* args_p) {
dynamic_cast<itti_pdu_session_resource_setup_request*>(msg); dynamic_cast<itti_pdu_session_resource_setup_request*>(msg);
amf_n2_inst->handle_itti_message(ref(*m)); amf_n2_inst->handle_itti_message(ref(*m));
} break; } break;
case PDU_SESSION_RESOURCE_MODIFY_REQUEST: {
Logger::amf_n2().info(
"Received PDU_SESSION_RESOURCE_MODIFY_REQUEST message, handling");
itti_pdu_session_resource_modify_request* m =
dynamic_cast<itti_pdu_session_resource_modify_request*>(msg);
amf_n2_inst->handle_itti_message(ref(*m));
} break;
case INITIAL_CONTEXT_SETUP_REQUEST: { case INITIAL_CONTEXT_SETUP_REQUEST: {
Logger::amf_n2().info( Logger::amf_n2().info(
"Encoding INITIAL CONTEXT SETUP REQUEST message, sending"); "Encoding INITIAL CONTEXT SETUP REQUEST message, sending");
...@@ -1028,6 +1036,81 @@ void amf_n2::handle_itti_message( ...@@ -1028,6 +1036,81 @@ void amf_n2::handle_itti_message(
free_wrapper((void**) &buffer); free_wrapper((void**) &buffer);
} }
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(
itti_pdu_session_resource_modify_request& itti_msg) {
Logger::amf_n2().debug("Handle PDU Session Resource Modify Request ...");
if (!amf_n2_inst->is_ran_ue_id_2_ue_ngap_context(itti_msg.ran_ue_ngap_id)) {
Logger::amf_n2().error(
"No UE NGAP context with ran_ue_ngap_id (%d)", itti_msg.ran_ue_ngap_id);
return;
}
std::shared_ptr<ue_ngap_context> unc = {};
unc = ran_ue_id_2_ue_ngap_context(itti_msg.ran_ue_ngap_id);
if (unc.get() == nullptr) {
Logger::amf_n2().error(
"Illegal UE with ran_ue_ngap_id (0x%x)", itti_msg.ran_ue_ngap_id);
return;
}
std::shared_ptr<gnb_context> gc = {};
if (!is_assoc_id_2_gnb_context(unc.get()->gnb_assoc_id)) {
Logger::amf_n2().error(
"No existing gNG context with assoc_id (%d)", unc.get()->gnb_assoc_id);
return;
}
gc = assoc_id_2_gnb_context(unc.get()->gnb_assoc_id);
if (gc.get() == nullptr) {
Logger::amf_n2().error(
"Illegal gNB with assoc id (0x%x)", unc.get()->gnb_assoc_id);
return;
}
std::unique_ptr<PduSessionResourceModifyRequestMsg> modify_request_msg =
std::make_unique<PduSessionResourceModifyRequestMsg>();
modify_request_msg->setAmfUeNgapId(itti_msg.amf_ue_ngap_id);
modify_request_msg->setRanUeNgapId(itti_msg.ran_ue_ngap_id);
std::vector<PDUSessionResourceModifyRequestItem_t> list;
PDUSessionResourceModifyRequestItem_t item = {};
item.pduSessionId = itti_msg.pdu_session_id;
item.pduSessionResourceModifyRequestTransfer.buf =
(uint8_t*) bdata(itti_msg.n2sm);
item.pduSessionResourceModifyRequestTransfer.size = blength(itti_msg.n2sm);
item.s_nssai.sd = itti_msg.s_NSSAI.getSd();
item.s_nssai.sst = itti_msg.s_NSSAI.getSst();
uint8_t* nas_pdu = (uint8_t*) calloc(1, blength(itti_msg.nas) + 1);
memcpy(nas_pdu, (uint8_t*) bdata(itti_msg.nas), blength(itti_msg.nas));
nas_pdu[blength(itti_msg.nas)] = '\0';
item.pduSessionNAS_PDU = nas_pdu;
item.sizeofpduSessionNAS_PDU = blength(itti_msg.nas);
list.push_back(item);
modify_request_msg->setPduSessionResourceModifyRequestList(list);
size_t buffer_size = BUFFER_SIZE_512;
char* buffer = (char*) calloc(1, buffer_size);
int encoded_size = 0;
modify_request_msg->encode2buffer_new(buffer, encoded_size);
#if DEBUG_IS_ON
Logger::amf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
#endif
Logger::amf_n2().debug(" (%d bytes) \n", encoded_size);
bstring b = blk2bstr(buffer, encoded_size);
sctp_s_38412.sctp_send_msg(
gc.get()->sctp_assoc_id, unc.get()->sctp_stream_send, &b);
// free memory
free_wrapper((void**) &nas_pdu);
free_wrapper((void**) &buffer);
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n2::handle_itti_message( void amf_n2::handle_itti_message(
itti_pdu_session_resource_release_command& itti_msg) { itti_pdu_session_resource_release_command& itti_msg) {
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "DownlinkRANStatusTransfer.hpp" #include "DownlinkRANStatusTransfer.hpp"
#include "HandoverCommandMsg.hpp" #include "HandoverCommandMsg.hpp"
#include "HandoverRequest.hpp" #include "HandoverRequest.hpp"
#include "PduSessionResourceReleaseCommand.hpp"
#include "amf.hpp" #include "amf.hpp"
#include "itti_msg_n2.hpp" #include "itti_msg_n2.hpp"
#include "ngap_app.hpp" #include "ngap_app.hpp"
...@@ -53,11 +52,12 @@ class amf_n2 : public ngap::ngap_app { ...@@ -53,11 +52,12 @@ class amf_n2 : public ngap::ngap_app {
void handle_itti_message(itti_dl_nas_transport& dl_nas_transport); void handle_itti_message(itti_dl_nas_transport& dl_nas_transport);
void handle_itti_message(itti_initial_context_setup_request& itti_msg); void handle_itti_message(itti_initial_context_setup_request& itti_msg);
void handle_itti_message(itti_pdu_session_resource_setup_request& itti_msg); void handle_itti_message(itti_pdu_session_resource_setup_request& itti_msg);
void handle_itti_message(itti_pdu_session_resource_modify_request& itti_msg);
void handle_itti_message(itti_pdu_session_resource_release_command& itti_msg);
void handle_itti_message(itti_ue_context_release_request& itti_msg); void handle_itti_message(itti_ue_context_release_request& itti_msg);
void handle_itti_message(itti_ue_context_release_complete& itti_msg); void handle_itti_message(itti_ue_context_release_complete& itti_msg);
void handle_itti_message(itti_ue_radio_capability_indication& itti_msg); void handle_itti_message(itti_ue_radio_capability_indication& itti_msg);
void handle_itti_message(itti_ue_context_release_command& itti_msg); void handle_itti_message(itti_ue_context_release_command& itti_msg);
void handle_itti_message(itti_pdu_session_resource_release_command& itti_msg);
bool handle_itti_message(itti_handover_required& itti_msg); bool handle_itti_message(itti_handover_required& itti_msg);
void handle_itti_message(itti_handover_request_Ack& itti_msg); void handle_itti_message(itti_handover_request_Ack& itti_msg);
void handle_itti_message(itti_handover_notify& itti_msg); void handle_itti_message(itti_handover_notify& itti_msg);
......
...@@ -70,6 +70,7 @@ typedef enum { ...@@ -70,6 +70,7 @@ typedef enum {
ITTI_DL_NAS_TRANSPORT, ITTI_DL_NAS_TRANSPORT,
INITIAL_CONTEXT_SETUP_REQUEST, INITIAL_CONTEXT_SETUP_REQUEST,
PDU_SESSION_RESOURCE_SETUP_REQUEST, PDU_SESSION_RESOURCE_SETUP_REQUEST,
PDU_SESSION_RESOURCE_MODIFY_REQUEST,
PDU_SESSION_RESOURCE_RELEASE_COMMAND, PDU_SESSION_RESOURCE_RELEASE_COMMAND,
UE_CONTEXT_RELEASE_REQUEST, UE_CONTEXT_RELEASE_REQUEST,
UE_CONTEXT_RELEASE_COMPLETE, UE_CONTEXT_RELEASE_COMPLETE,
......
...@@ -67,9 +67,13 @@ class itti_n1n2_message_transfer_request : public itti_msg_amf_app { ...@@ -67,9 +67,13 @@ class itti_n1n2_message_transfer_request : public itti_msg_amf_app {
itti_n1n2_message_transfer_request( itti_n1n2_message_transfer_request(
const task_id_t origin, const task_id_t destination) const task_id_t origin, const task_id_t destination)
: itti_msg_amf_app(N1N2_MESSAGE_TRANSFER_REQ, origin, destination) { : itti_msg_amf_app(N1N2_MESSAGE_TRANSFER_REQ, origin, destination) {
is_n2sm_set = false; is_n2sm_set = false;
is_n1sm_set = false; is_n1sm_set = false;
is_ppi_set = false; is_ppi_set = false;
supi = {};
n2sm_info_type = {};
pdu_session_id = 0;
ppi = 0;
} }
itti_n1n2_message_transfer_request( itti_n1n2_message_transfer_request(
const itti_n1n2_message_transfer_request& i) const itti_n1n2_message_transfer_request& i)
......
...@@ -160,6 +160,22 @@ class itti_pdu_session_resource_setup_request : public itti_msg_n2 { ...@@ -160,6 +160,22 @@ class itti_pdu_session_resource_setup_request : public itti_msg_n2 {
uint8_t pdu_session_id; uint8_t pdu_session_id;
}; };
class itti_pdu_session_resource_modify_request : public itti_msg_n2 {
public:
itti_pdu_session_resource_modify_request(
const task_id_t origin, const task_id_t destination)
: itti_msg_n2(PDU_SESSION_RESOURCE_MODIFY_REQUEST, origin, destination) {}
itti_pdu_session_resource_modify_request(
const itti_pdu_session_resource_modify_request& i)
: itti_msg_n2(i) {}
bstring nas;
bstring n2sm;
uint32_t ran_ue_ngap_id;
long amf_ue_ngap_id;
uint8_t pdu_session_id;
S_NSSAI s_NSSAI;
};
class itti_pdu_session_resource_release_command : public itti_msg_n2 { class itti_pdu_session_resource_release_command : public itti_msg_n2 {
public: public:
itti_pdu_session_resource_release_command( itti_pdu_session_resource_release_command(
......
...@@ -106,6 +106,7 @@ typedef struct { ...@@ -106,6 +106,7 @@ typedef struct {
uint8_t pduSessionId; uint8_t pduSessionId;
uint8_t* pduSessionNAS_PDU; uint8_t* pduSessionNAS_PDU;
size_t sizeofpduSessionNAS_PDU; size_t sizeofpduSessionNAS_PDU;
S_Nssai s_nssai;
OCTET_STRING_t pduSessionResourceModifyRequestTransfer; OCTET_STRING_t pduSessionResourceModifyRequestTransfer;
} PDUSessionResourceModifyRequestItem_t; } PDUSessionResourceModifyRequestItem_t;
......
...@@ -44,7 +44,8 @@ PDUSessionResourceModifyItemModReq::~PDUSessionResourceModifyItemModReq() {} ...@@ -44,7 +44,8 @@ PDUSessionResourceModifyItemModReq::~PDUSessionResourceModifyItemModReq() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceModifyItemModReq::setPDUSessionResourceModifyItemModReq( void PDUSessionResourceModifyItemModReq::setPDUSessionResourceModifyItemModReq(
const PDUSessionID& m_pDUSessionID, const NAS_PDU& m_nAS_PDU, const PDUSessionID& m_pDUSessionID, const NAS_PDU& m_nAS_PDU,
const OCTET_STRING_t m_pDUSessionResourceModifyRequestTransfer) { const OCTET_STRING_t m_pDUSessionResourceModifyRequestTransfer,
const S_NSSAI& m_s_NSSAI) {
pDUSessionID = m_pDUSessionID; pDUSessionID = m_pDUSessionID;
uint8_t* nas_buf = nullptr; uint8_t* nas_buf = nullptr;
size_t nas_len = 0; size_t nas_len = 0;
...@@ -53,6 +54,8 @@ void PDUSessionResourceModifyItemModReq::setPDUSessionResourceModifyItemModReq( ...@@ -53,6 +54,8 @@ void PDUSessionResourceModifyItemModReq::setPDUSessionResourceModifyItemModReq(
nAS_PDU->setNasPdu(nas_buf, nas_len); nAS_PDU->setNasPdu(nas_buf, nas_len);
pDUSessionResourceModifyRequestTransfer = pDUSessionResourceModifyRequestTransfer =
m_pDUSessionResourceModifyRequestTransfer; m_pDUSessionResourceModifyRequestTransfer;
s_NSSAI->setSd(m_s_NSSAI.getSd());
s_NSSAI->setSst(m_s_NSSAI.getSst());
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -107,11 +110,13 @@ bool PDUSessionResourceModifyItemModReq:: ...@@ -107,11 +110,13 @@ bool PDUSessionResourceModifyItemModReq::
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceModifyItemModReq::getPDUSessionResourceModifyItemModReq( void PDUSessionResourceModifyItemModReq::getPDUSessionResourceModifyItemModReq(
PDUSessionID& m_pDUSessionID, NAS_PDU& m_nAS_PDU, PDUSessionID& m_pDUSessionID, NAS_PDU& m_nAS_PDU,
OCTET_STRING_t& m_pDUSessionResourceModifyRequestTransfer) { OCTET_STRING_t& m_pDUSessionResourceModifyRequestTransfer,
S_NSSAI& m_s_NSSAI) {
m_pDUSessionID = pDUSessionID; m_pDUSessionID = pDUSessionID;
m_nAS_PDU = *nAS_PDU; m_nAS_PDU = *nAS_PDU;
m_pDUSessionResourceModifyRequestTransfer = m_pDUSessionResourceModifyRequestTransfer =
pDUSessionResourceModifyRequestTransfer; pDUSessionResourceModifyRequestTransfer;
m_s_NSSAI = *s_NSSAI;
} }
} // namespace ngap } // namespace ngap
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "NAS-PDU.hpp" #include "NAS-PDU.hpp"
#include "PDUSessionID.hpp" #include "PDUSessionID.hpp"
#include "S-NSSAI.hpp"
extern "C" { extern "C" {
#include "Ngap_PDUSessionResourceModifyItemModReq.h" #include "Ngap_PDUSessionResourceModifyItemModReq.h"
...@@ -45,10 +46,12 @@ class PDUSessionResourceModifyItemModReq { ...@@ -45,10 +46,12 @@ class PDUSessionResourceModifyItemModReq {
void setPDUSessionResourceModifyItemModReq( void setPDUSessionResourceModifyItemModReq(
const PDUSessionID& m_pDUSessionID, const NAS_PDU& m_nAS_PDU, const PDUSessionID& m_pDUSessionID, const NAS_PDU& m_nAS_PDU,
const OCTET_STRING_t m_pDUSessionResourceModifyRequestTransfer); const OCTET_STRING_t m_pDUSessionResourceModifyRequestTransfer,
const S_NSSAI& m_s_NSSAI);
void getPDUSessionResourceModifyItemModReq( void getPDUSessionResourceModifyItemModReq(
PDUSessionID& m_pDUSessionID, NAS_PDU& m_nAS_PDU, PDUSessionID& m_pDUSessionID, NAS_PDU& m_nAS_PDU,
OCTET_STRING_t& m_pDUSessionResourceModifyRequestTransfer); OCTET_STRING_t& m_pDUSessionResourceModifyRequestTransfer,
S_NSSAI& m_s_NSSAI);
bool encode2PDUSessionResourceModifyItemModReq( bool encode2PDUSessionResourceModifyItemModReq(
Ngap_PDUSessionResourceModifyItemModReq_t& Ngap_PDUSessionResourceModifyItemModReq_t&
...@@ -61,6 +64,7 @@ class PDUSessionResourceModifyItemModReq { ...@@ -61,6 +64,7 @@ class PDUSessionResourceModifyItemModReq {
PDUSessionID pDUSessionID; PDUSessionID pDUSessionID;
NAS_PDU* nAS_PDU; // Optional NAS_PDU* nAS_PDU; // Optional
OCTET_STRING_t pDUSessionResourceModifyRequestTransfer; OCTET_STRING_t pDUSessionResourceModifyRequestTransfer;
S_NSSAI* s_NSSAI; // Optional
}; };
} // namespace ngap } // namespace ngap
......
...@@ -86,10 +86,15 @@ void S_NSSAI::setSst(const std::string charSst) { ...@@ -86,10 +86,15 @@ void S_NSSAI::setSst(const std::string charSst) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void S_NSSAI::getSst(std::string& charSst) { void S_NSSAI::getSst(std::string& charSst) const {
charSst = to_string((int) sst); charSst = to_string((int) sst);
} }
//------------------------------------------------------------------------------
std::string S_NSSAI::getSst() const {
return to_string((int) sst);
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void S_NSSAI::setSd(const std::string charSd) { void S_NSSAI::setSd(const std::string charSd) {
sdIsSet = true; sdIsSet = true;
...@@ -97,7 +102,7 @@ void S_NSSAI::setSd(const std::string charSd) { ...@@ -97,7 +102,7 @@ void S_NSSAI::setSd(const std::string charSd) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool S_NSSAI::getSd(std::string& s_nssaiSd) { bool S_NSSAI::getSd(std::string& s_nssaiSd) const {
if (sdIsSet) { if (sdIsSet) {
s_nssaiSd = to_string(sd); s_nssaiSd = to_string(sd);
} else } else
...@@ -106,6 +111,13 @@ bool S_NSSAI::getSd(std::string& s_nssaiSd) { ...@@ -106,6 +111,13 @@ bool S_NSSAI::getSd(std::string& s_nssaiSd) {
return sdIsSet; return sdIsSet;
} }
//------------------------------------------------------------------------------
std::string S_NSSAI::getSd() const {
if (sdIsSet) {
return to_string(sd);
} else
return "None";
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool S_NSSAI::encode2S_NSSAI(Ngap_S_NSSAI_t* s_NSSAI) { bool S_NSSAI::encode2S_NSSAI(Ngap_S_NSSAI_t* s_NSSAI) {
if (!sSTEncode2OctetString(s_NSSAI->sST)) return false; if (!sSTEncode2OctetString(s_NSSAI->sST)) return false;
......
...@@ -48,14 +48,16 @@ class S_NSSAI { ...@@ -48,14 +48,16 @@ class S_NSSAI {
bool sDEncode2OctetString(Ngap_SD_t*); bool sDEncode2OctetString(Ngap_SD_t*);
bool sDdecodefromOctetString(Ngap_SD_t*); bool sDdecodefromOctetString(Ngap_SD_t*);
void setSst(const std::string charSst); void setSst(const std::string charSst);
void getSst(std::string& charSst); void getSst(std::string& charSst) const;
std::string getSst() const;
void setSd(const std::string charSd); void setSd(const std::string charSd);
bool getSd(std::string& s_nssaiSd); bool getSd(std::string& s_nssaiSd) const;
std::string getSd() const;
bool encode2S_NSSAI(Ngap_S_NSSAI_t*); bool encode2S_NSSAI(Ngap_S_NSSAI_t*);
bool decodefromS_NSSAI(Ngap_S_NSSAI_t*); bool decodefromS_NSSAI(Ngap_S_NSSAI_t*);
private: private:
uint8_t sst; // mandotory OCTET_STRING(SIZE(1)) uint8_t sst; // mandatory OCTET_STRING(SIZE(1))
uint32_t sd; // OCTET_STRING(SIZE(3)) uint32_t sd; // OCTET_STRING(SIZE(3))
bool sdIsSet; bool sdIsSet;
}; };
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
*/ */
#include "PduSessionResourceModifyRequest.hpp" #include "PduSessionResourceModifyRequest.hpp"
#include "amf.hpp"
#include "logger.hpp" #include "logger.hpp"
extern "C" { extern "C" {
...@@ -45,14 +46,32 @@ namespace ngap { ...@@ -45,14 +46,32 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PduSessionResourceModifyRequestMsg::PduSessionResourceModifyRequestMsg() { PduSessionResourceModifyRequestMsg::PduSessionResourceModifyRequestMsg() {
pduSessionResourceModifyRequestPdu = nullptr; // Set Message Type
pduSessionResourceModifyRequestIEs = nullptr; pduSessionResourceModifyRequestPdu =
ranPagingPriority = nullptr; (Ngap_NGAP_PDU_t*) calloc(1, sizeof(Ngap_NGAP_PDU_t));
pduSessionResourceModifyList = nullptr;
MessageType pdu = {};
pdu.setProcedureCode(Ngap_ProcedureCode_id_PDUSessionResourceModify);
pdu.setTypeOfMessage(Ngap_NGAP_PDU_PR_initiatingMessage);
pdu.setCriticality(Ngap_Criticality_reject);
pdu.setValuePresent(
Ngap_InitiatingMessage__value_PR_PDUSessionResourceModifyRequest);
pdu.encode2pdu(pduSessionResourceModifyRequestPdu);
pduSessionResourceModifyRequestIEs =
&(pduSessionResourceModifyRequestPdu->choice.initiatingMessage->value
.choice.PDUSessionResourceModifyRequest);
ranPagingPriority = nullptr;
pduSessionResourceModifyList = nullptr;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PduSessionResourceModifyRequestMsg::~PduSessionResourceModifyRequestMsg() {} PduSessionResourceModifyRequestMsg::~PduSessionResourceModifyRequestMsg() {
if (pduSessionResourceModifyRequestPdu)
free(pduSessionResourceModifyRequestPdu);
// TODO:
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PduSessionResourceModifyRequestMsg::setMessageType() { void PduSessionResourceModifyRequestMsg::setMessageType() {
...@@ -159,9 +178,6 @@ void PduSessionResourceModifyRequestMsg::setPduSessionResourceModifyRequestList( ...@@ -159,9 +178,6 @@ void PduSessionResourceModifyRequestMsg::setPduSessionResourceModifyRequestList(
if (!pduSessionResourceModifyList) if (!pduSessionResourceModifyList)
pduSessionResourceModifyList = new PDUSessionResourceModifyListModReq(); pduSessionResourceModifyList = new PDUSessionResourceModifyListModReq();
// PDUSessionResourceModifyItemModReq* m_pduSessionResourceModifyItemModReq =
// new PDUSessionResourceModifyItemModReq[list.size()]();
std::vector<PDUSessionResourceModifyItemModReq> std::vector<PDUSessionResourceModifyItemModReq>
m_pduSessionResourceModifyItemModReq; m_pduSessionResourceModifyItemModReq;
...@@ -173,12 +189,15 @@ void PduSessionResourceModifyRequestMsg::setPduSessionResourceModifyRequestList( ...@@ -173,12 +189,15 @@ void PduSessionResourceModifyRequestMsg::setPduSessionResourceModifyRequestList(
m_nAS_PDU.setNasPdu( m_nAS_PDU.setNasPdu(
list[i].pduSessionNAS_PDU, list[i].sizeofpduSessionNAS_PDU); list[i].pduSessionNAS_PDU, list[i].sizeofpduSessionNAS_PDU);
} }
S_NSSAI s_NSSAI = {};
s_NSSAI.setSd(list[i].s_nssai.sd);
s_NSSAI.setSst(list[i].s_nssai.sst);
PDUSessionResourceModifyItemModReq item = {}; PDUSessionResourceModifyItemModReq item = {};
item.setPDUSessionResourceModifyItemModReq( item.setPDUSessionResourceModifyItemModReq(
m_pDUSessionID, m_nAS_PDU, m_pDUSessionID, m_nAS_PDU,
list[i].pduSessionResourceModifyRequestTransfer); list[i].pduSessionResourceModifyRequestTransfer, s_NSSAI);
m_pduSessionResourceModifyItemModReq.push_back(item); m_pduSessionResourceModifyItemModReq.push_back(item);
} }
...@@ -230,7 +249,7 @@ int PduSessionResourceModifyRequestMsg::encode2buffer( ...@@ -230,7 +249,7 @@ int PduSessionResourceModifyRequestMsg::encode2buffer(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PduSessionResourceModifyRequestMsg::encode2buffer_new( void PduSessionResourceModifyRequestMsg::encode2buffer_new(
char* buf, int& encoded_size) { char* buf, int& encoded_size) {
char* buffer = (char*) calloc(1, 1024); // TODO: remove hardcoded value char* buffer = (char*) calloc(1, BUFFER_SIZE_1024);
asn_fprint( asn_fprint(
stderr, &asn_DEF_Ngap_NGAP_PDU, pduSessionResourceModifyRequestPdu); stderr, &asn_DEF_Ngap_NGAP_PDU, pduSessionResourceModifyRequestPdu);
encoded_size = aper_encode_to_new_buffer( encoded_size = aper_encode_to_new_buffer(
...@@ -391,18 +410,21 @@ bool PduSessionResourceModifyRequestMsg::getPduSessionResourceModifyRequestList( ...@@ -391,18 +410,21 @@ bool PduSessionResourceModifyRequestMsg::getPduSessionResourceModifyRequestList(
for (int i = 0; i < m_pduSessionResourceModifyItemModReq.size(); i++) { for (int i = 0; i < m_pduSessionResourceModifyItemModReq.size(); i++) {
PDUSessionResourceModifyRequestItem_t request; PDUSessionResourceModifyRequestItem_t request;
PDUSessionID m_pDUSessionID; PDUSessionID m_pDUSessionID = {};
NAS_PDU m_nAS_PDU; NAS_PDU m_nAS_PDU = {};
S_NSSAI s_NSSAI = {};
m_pduSessionResourceModifyItemModReq[i] m_pduSessionResourceModifyItemModReq[i]
.getPDUSessionResourceModifyItemModReq( .getPDUSessionResourceModifyItemModReq(
m_pDUSessionID, m_nAS_PDU, m_pDUSessionID, m_nAS_PDU,
request.pduSessionResourceModifyRequestTransfer); request.pduSessionResourceModifyRequestTransfer, s_NSSAI);
m_pDUSessionID.getPDUSessionID(request.pduSessionId); m_pDUSessionID.getPDUSessionID(request.pduSessionId);
m_nAS_PDU.getNasPdu( m_nAS_PDU.getNasPdu(
request.pduSessionNAS_PDU, request.sizeofpduSessionNAS_PDU); request.pduSessionNAS_PDU, request.sizeofpduSessionNAS_PDU);
s_NSSAI.getSd(request.s_nssai.sd);
s_NSSAI.getSst(request.s_nssai.sst);
list.push_back(request); list.push_back(request);
} }
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "AMF-UE-NGAP-ID.hpp" #include "AMF-UE-NGAP-ID.hpp"
#include "MessageType.hpp" #include "MessageType.hpp"
#include "NAS-PDU.hpp"
#include "NgapIEsStruct.hpp" #include "NgapIEsStruct.hpp"
#include "PDUSessionResourceModifyListModReq.hpp" #include "PDUSessionResourceModifyListModReq.hpp"
#include "RAN-UE-NGAP-ID.hpp" #include "RAN-UE-NGAP-ID.hpp"
......
...@@ -112,6 +112,11 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer( ...@@ -112,6 +112,11 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer(
itti_msg->is_n2sm_set = true; itti_msg->is_n2sm_set = true;
itti_msg->pdu_session_id = itti_msg->pdu_session_id =
(uint8_t) n1N2MessageTransferReqData.getPduSessionId(); (uint8_t) n1N2MessageTransferReqData.getPduSessionId();
itti_msg->n2sm_info_type = n1N2MessageTransferReqData.getN2InfoContainer()
.getSmInfo()
.getN2InfoContent()
.getNgapIeType()
.get_value();
// For Paging // For Paging
if (n1N2MessageTransferReqData.ppiIsSet()) { if (n1N2MessageTransferReqData.ppiIsSet()) {
......
...@@ -25,11 +25,22 @@ void NgapIeType::validate() { ...@@ -25,11 +25,22 @@ void NgapIeType::validate() {
// TODO: implement validation // TODO: implement validation
} }
std::string NgapIeType::get_value() const {
return value;
}
void NgapIeType::set_value(std::string v) {
value = v;
}
void to_json(nlohmann::json& j, const NgapIeType& o) { void to_json(nlohmann::json& j, const NgapIeType& o) {
j = nlohmann::json(); j = nlohmann::json();
j = o.get_value();
} }
void from_json(const nlohmann::json& j, NgapIeType& o) {} void from_json(const nlohmann::json& j, NgapIeType& o) {
o.set_value(j.get<std::string>());
}
} // namespace model } // namespace model
} // namespace amf } // namespace amf
......
...@@ -35,6 +35,8 @@ class NgapIeType { ...@@ -35,6 +35,8 @@ class NgapIeType {
void validate(); void validate();
std::string get_value() const;
void set_value(std::string v);
///////////////////////////////////////////// /////////////////////////////////////////////
/// NgapIeType members /// NgapIeType members
...@@ -42,6 +44,7 @@ class NgapIeType { ...@@ -42,6 +44,7 @@ class NgapIeType {
friend void from_json(const nlohmann::json& j, NgapIeType& o); friend void from_json(const nlohmann::json& j, NgapIeType& o);
protected: protected:
std::string value;
}; };
} // namespace model } // namespace model
......
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