Commit 552f041c authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Process NGReset at N2

parent 0ba67b9f
......@@ -96,6 +96,11 @@ void amf_n2_task(void* args_p) {
itti_ng_setup_request* m = dynamic_cast<itti_ng_setup_request*>(msg);
amf_n2_inst->handle_itti_message(ref(*m));
} break;
case NG_RESET: {
Logger::amf_n2().info("Received NGReset message, handling");
itti_ng_reset* m = dynamic_cast<itti_ng_reset*>(msg);
amf_n2_inst->handle_itti_message(ref(*m));
} break;
case INITIAL_UE_MSG: {
Logger::amf_n2().info("Received INITIAL_UE_MESSAGE message, handling");
itti_initial_ue_message* m =
......@@ -344,6 +349,32 @@ void amf_n2::handle_itti_message(itti_ng_setup_request& itti_msg) {
return;
}
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_ng_reset& itti_msg) {
Logger::amf_n2().debug(
"Parameters: assoc_id %d, stream %d", itti_msg.assoc_id, itti_msg.stream);
std::shared_ptr<gnb_context> gc;
if (!is_assoc_id_2_gnb_context(itti_msg.assoc_id)) {
Logger::amf_n2().error(
"No existed gNB context with assoc_id(%d)", itti_msg.assoc_id);
return;
}
gc = assoc_id_2_gnb_context(itti_msg.assoc_id);
if (gc.get()->ng_state == NGAP_RESETING ||
gc.get()->ng_state == NGAP_SHUTDOWN) {
Logger::amf_n2().warn(
"Received new association request on an association that is being %s, "
"ignoring",
ng_gnb_state_str[gc.get()->ng_state]);
} else {
Logger::amf_n2().debug(
"Update gNB context with assoc id (%d)", itti_msg.assoc_id);
}
return;
}
//------------------------------------------------------------------------------
// INITIAL_UE_MESSAGE Handler
void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
......
......@@ -47,6 +47,7 @@ class amf_n2 : public ngap::ngap_app {
~amf_n2();
void handle_itti_message(itti_new_sctp_association& new_assoc);
void handle_itti_message(itti_ng_setup_request& ngsetupreq);
void handle_itti_message(itti_ng_reset&);
void handle_itti_message(itti_initial_ue_message& init_ue_msg);
void handle_itti_message(itti_ul_nas_transport& ul_nas_transport);
void handle_itti_message(itti_dl_nas_transport& dl_nas_transport);
......
......@@ -47,9 +47,10 @@ namespace ngap {
//------------------------------------------------------------------------------
NGResetMsg::NGResetMsg() {
ngResetPdu = NULL;
ngResetIEs = NULL;
cause = {};
ngResetPdu = nullptr;
ngResetIEs = nullptr;
// cause = {};
cause = nullptr;
resetType = {};
}
//------------------------------------------------------------------------------
......@@ -81,7 +82,7 @@ void NGResetMsg::setMessageType() {
//------------------------------------------------------------------------------
void NGResetMsg::setCause(Ngap_Cause_t cause) {
this->cause = cause;
// this->cause = cause;
}
//------------------------------------------------------------------------------
......@@ -90,7 +91,7 @@ void NGResetMsg::setResetType(Ngap_ResetType_t resetType) {
}
void NGResetMsg::getCause(Ngap_Cause_t& cause) {
cause = this->cause;
// cause = this->cause;
}
void NGResetMsg::getResetType(Ngap_ResetType_t& resetType) {
......@@ -126,7 +127,15 @@ bool NGResetMsg::decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu) {
Ngap_Criticality_reject &&
ngResetIEs->protocolIEs.list.array[i]->value.present ==
Ngap_NGResetIEs__value_PR_Cause) {
cause = ngResetIEs->protocolIEs.list.array[i]->value.choice.Cause;
cause = new Cause();
if (!cause->decodefromCause(
&ngResetIEs->protocolIEs.list.array[i]
->value.choice.Cause)) {
cout << "decoded ngap Cause IE error" << endl;
return false;
}
// cause =
// ngResetIEs->protocolIEs.list.array[i]->value.choice.Cause;
} else {
cout << "Decoded NGAP Cause IE error" << endl;
return false;
......
......@@ -32,10 +32,7 @@
#include "NgapIEsStruct.hpp"
#include "MessageType.hpp"
#include "GlobalRanNodeId.hpp"
#include "RanNodeName.hpp"
#include "DefaultPagingDRX.hpp"
#include "SupportedTAList.hpp"
#include "Cause.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
......@@ -62,9 +59,9 @@ class NGResetMsg {
private:
Ngap_NGAP_PDU_t* ngResetPdu;
Ngap_NGReset_t* ngResetIEs;
Ngap_Cause_t cause;
// Ngap_Cause_t cause;
Ngap_ResetType_t resetType;
// Cause *cause;
Cause* cause;
// ResetType resetType;
};
......
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