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

Code cleanup for HO procedure

parent 82d32d76
...@@ -69,7 +69,7 @@ extern statistics stacs; ...@@ -69,7 +69,7 @@ extern statistics stacs;
extern void print_buffer( extern void print_buffer(
const std::string app, const std::string commit, uint8_t* buf, int len); const std::string app, const std::string commit, uint8_t* buf, int len);
uint32_t ran_id_Global = 0; uint32_t ran_id_global = 0;
uint32_t AMF_TARGET_ran_id_global = 0; uint32_t AMF_TARGET_ran_id_global = 0;
sctp_assoc_id_t downlink_sctp_assoc_id = 0; sctp_assoc_id_t downlink_sctp_assoc_id = 0;
sctp_assoc_id_t source_assoc_id = 0; sctp_assoc_id_t source_assoc_id = 0;
...@@ -1046,65 +1046,62 @@ void amf_n2::handle_itti_message( ...@@ -1046,65 +1046,62 @@ void amf_n2::handle_itti_message(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
// TODO: to be tesbed/clean up // TODO: Experimental procedure, to be testbed
ncc++; ncc++; // TODO: to be verified
unsigned long amf_ue_ngap_id = itti_msg.handvoerRequ->getAmfUeNgapId(); unsigned long amf_ue_ngap_id = itti_msg.handoverReq->getAmfUeNgapId();
uint32_t ran_ue_ngap_id = itti_msg.handvoerRequ->getRanUeNgapId(); uint32_t ran_ue_ngap_id = itti_msg.handoverReq->getRanUeNgapId();
ran_id_Global = ran_ue_ngap_id; ran_id_global = ran_ue_ngap_id;
source_assoc_id = itti_msg.assoc_id; source_assoc_id = itti_msg.assoc_id;
std::shared_ptr<gnb_context> gc;
std::shared_ptr<gnb_context> gc = {};
if (!is_assoc_id_2_gnb_context(itti_msg.assoc_id)) { if (!is_assoc_id_2_gnb_context(itti_msg.assoc_id)) {
Logger::amf_n2().error( Logger::amf_n2().error(
"gNB with assoc_id (%d) is illegal", itti_msg.assoc_id); "gNB with assoc_id (%d) is illegal", itti_msg.assoc_id);
return; return;
} }
gc = assoc_id_2_gnb_context(itti_msg.assoc_id); gc = assoc_id_2_gnb_context(itti_msg.assoc_id);
std::shared_ptr<ue_ngap_context> unc;
if (!is_ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id)) { std::shared_ptr<ue_ngap_context> unc = {};
Logger::amf_n2().error(
"UE with ran_ue_ngap_id (0x%x) is not attached to gNB with "
"assoc_id (%d)",
ran_ue_ngap_id, itti_msg.assoc_id);
return;
}
if (!is_ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id)) { if (!is_ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id)) {
Logger::amf_n2().error( Logger::amf_n2().error(
"No UE NGAP context with ran_ue_ngap_id(%d)", ran_ue_ngap_id); "No UE NGAP context with ran_ue_ngap_id (0x%x)", ran_ue_ngap_id);
return; return;
} }
unc = ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id); unc = ran_ue_id_2_ue_ngap_context(ran_ue_ngap_id);
if (unc.get()->amf_ue_ngap_id != amf_ue_ngap_id) { if (unc.get()->amf_ue_ngap_id != amf_ue_ngap_id) {
Logger::amf_n2().error( Logger::amf_n2().error(
"The requested UE (amf_ue_ngap_id:0x%x) is not valid, existed UE " "The requested UE (amf_ue_ngap_id:0x%x) is not valid, existed UE "
"which's amf_ue_ngap_id(0x%x)", "with amf_ue_ngap_id (0x%x)",
amf_ue_ngap_id, unc.get()->amf_ue_ngap_id); amf_ue_ngap_id, unc.get()->amf_ue_ngap_id);
} }
if (itti_msg.handvoerRequ->getHandoverType() != Ngap_HandoverType_intra5gs) {
Logger::amf_n2().error( if (itti_msg.handoverReq->getHandoverType() != Ngap_HandoverType_intra5gs) {
"Received Handover Required message,but handover type is not " Logger::amf_n2().error("Handover Type is not supported");
"Ngap_HandoverType_intra5gs");
return; return;
} }
if (itti_msg.handvoerRequ->getChoiceOfCause() != Ngap_Cause_PR_radioNetwork) {
Logger::amf_n2().error( if (itti_msg.handoverReq->getChoiceOfCause() != Ngap_Cause_PR_radioNetwork) {
"Received Handover Required message,but Cause Of Choice is wrong"); Logger::amf_n2().error("CHOICE Cause Group is not supported");
return; return;
} }
if (itti_msg.handvoerRequ->getCauseValue() !=
if (itti_msg.handoverReq->getCauseValue() !=
Ngap_CauseRadioNetwork_handover_desirable_for_radio_reason) { Ngap_CauseRadioNetwork_handover_desirable_for_radio_reason) {
Logger::amf_n2().error( Logger::amf_n2().error("Radio Network Layer Cause is not supported");
"Received Handover Required message, but value of Cause is wrong");
return; return;
} }
if (itti_msg.handvoerRequ->getDirectForwardingPathAvailability() !=
if (itti_msg.handoverReq->getDirectForwardingPathAvailability() !=
Ngap_DirectForwardingPathAvailability_direct_path_available) { Ngap_DirectForwardingPathAvailability_direct_path_available) {
Logger::amf_n2().error( Logger::amf_n2().error(
"Received Handover Required message, but " "DirectForwardingPathAvailability must be "
"DirectForwardingPathAvailability is wrong"); "Ngap_DirectForwardingPathAvailability_direct_path_available!");
return; return;
} }
GlobalgNBId* TargetGlobalgNBId = new GlobalgNBId(); GlobalgNBId* TargetGlobalgNBId = new GlobalgNBId();
itti_msg.handvoerRequ->getGlobalRanNodeId(TargetGlobalgNBId); itti_msg.handoverReq->getGlobalRanNodeId(TargetGlobalgNBId);
PlmnId* plmn = new PlmnId(); PlmnId* plmn = new PlmnId();
GNB_ID* gnbid = new GNB_ID(); GNB_ID* gnbid = new GNB_ID();
TargetGlobalgNBId->getGlobalgNBId(plmn, gnbid); TargetGlobalgNBId->getGlobalgNBId(plmn, gnbid);
...@@ -1115,8 +1112,9 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1115,8 +1112,9 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
"Handover required: Target ID GlobalRanNodeID PLmn (mcc: %s, mnc: %s, " "Handover required: Target ID GlobalRanNodeID PLmn (mcc: %s, mnc: %s, "
"gnbid: %ld)\n", "gnbid: %ld)\n",
mcc.c_str(), mnc.c_str(), gnbid->getValue()); mcc.c_str(), mnc.c_str(), gnbid->getValue());
TAI* tai = new TAI(); TAI* tai = new TAI();
itti_msg.handvoerRequ->getTAI(tai); itti_msg.handoverReq->getTAI(tai);
PlmnId* plmnOfTAI = new PlmnId(); PlmnId* plmnOfTAI = new PlmnId();
TAC* tac = new TAC(); TAC* tac = new TAC();
tai->getTAI(plmnOfTAI, tac); tai->getTAI(plmnOfTAI, tac);
...@@ -1126,17 +1124,19 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1126,17 +1124,19 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
printf( printf(
"Handover required:Target ID selectedTAI PLmn=mcc%s mnc%s tac=%x\n", "Handover required:Target ID selectedTAI PLmn=mcc%s mnc%s tac=%x\n",
mccOfselectTAI.c_str(), mncOfselectTAI.c_str(), tac->getTac()); mccOfselectTAI.c_str(), mncOfselectTAI.c_str(), tac->getTac());
std::vector<PDUSessionResourceItem_t> List_HORqd; std::vector<PDUSessionResourceItem_t> List_HORqd;
if (!itti_msg.handvoerRequ->getPDUSessionResourceList(List_HORqd)) { if (!itti_msg.handoverReq->getPDUSessionResourceList(List_HORqd)) {
Logger::ngap().error( Logger::ngap().error(
"Decoding HandoverRequiredMsg getPDUSessionResourceList IE error"); "Decoding HandoverRequiredMsg getPDUSessionResourceList IE error");
return; return;
} }
OCTET_STRING_t sourceTotarget; OCTET_STRING_t sourceTotarget;
sourceTotarget = sourceTotarget =
itti_msg.handvoerRequ->getSourceToTarget_TransparentContainer(); itti_msg.handoverReq->getSourceToTarget_TransparentContainer();
// send handover request to target gnb // Create HandoverRequest message to be sent to target gNB
std::unique_ptr<HandoverRequest> handoverrequest = std::unique_ptr<HandoverRequest> handoverrequest =
std::make_unique<HandoverRequest>(); std::make_unique<HandoverRequest>();
handoverrequest->setMessageType(); handoverrequest->setMessageType();
...@@ -1145,14 +1145,16 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1145,14 +1145,16 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
handoverrequest->setCause( handoverrequest->setCause(
Ngap_Cause_PR_radioNetwork, Ngap_Cause_PR_radioNetwork,
Ngap_CauseRadioNetwork_handover_desirable_for_radio_reason); Ngap_CauseRadioNetwork_handover_desirable_for_radio_reason);
handoverrequest->setUEAggregateMaximumBitRate(300000000, 100000000); handoverrequest->setUEAggregateMaximumBitRate(
handoverrequest->setUESecurityCapabilities(0xe000, 0xe000, 0xe000, 0xe000); 300000000, 100000000); // TODO: remove hardcoded values
handoverrequest->setUESecurityCapabilities(
0xe000, 0xe000, 0xe000, 0xe000); // TODO: remove hardcoded values
S_NSSAI s_nssai; S_NSSAI s_nssai = {};
s_nssai.setSst("01"); s_nssai.setSst("01"); // TODO: remove hardcoded values
std::vector<S_NSSAI> Allowed_Nssai; std::vector<S_NSSAI> Allowed_Nssai;
Allowed_Nssai.push_back(s_nssai); Allowed_Nssai.push_back(s_nssai);
// handoverrequest->setAllowedNSSAI(Allowed_Nssai);
Guami_t guami; Guami_t guami;
guami.mcc = amf_cfg.guami.mcc; guami.mcc = amf_cfg.guami.mcc;
guami.mnc = amf_cfg.guami.mnc; guami.mnc = amf_cfg.guami.mnc;
...@@ -1167,9 +1169,6 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1167,9 +1169,6 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
m_aMFRegionID->setAMFRegionID(guami.regionID); m_aMFRegionID->setAMFRegionID(guami.regionID);
m_aMFSetID->setAMFSetID(guami.AmfSetID); m_aMFSetID->setAMFSetID(guami.AmfSetID);
m_aMFPointer->setAMFPointer(guami.AmfPointer); m_aMFPointer->setAMFPointer(guami.AmfPointer);
// handoverrequest->setMobilityRestrictionList(m_plmnId);
// handoverrequest->setGUAMI(m_plmnId, m_aMFRegionID, m_aMFSetID,
// m_aMFPointer);
std::shared_ptr<nas_context> nc = std::shared_ptr<nas_context> nc =
amf_n1_inst->amf_ue_id_2_nas_context(amf_ue_ngap_id); amf_n1_inst->amf_ue_id_2_nas_context(amf_ue_ngap_id);
...@@ -1185,7 +1184,6 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1185,7 +1184,6 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
handoverrequest->setSecurityContext( handoverrequest->setSecurityContext(
ncc /*NCC count*/, (uint8_t*) bdata(knh_bs)); ncc /*NCC count*/, (uint8_t*) bdata(knh_bs));
// handoverrequest->setSourceToTarget_TransparentContainer(sourceTotarget);
string supi = "imsi-" + nc.get()->imsi; string supi = "imsi-" + nc.get()->imsi;
// Get all the active PDU sessions // Get all the active PDU sessions
...@@ -1195,7 +1193,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1195,7 +1193,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
} }
std::vector<PDUSessionResourceSetupRequestItem_t> list; std::vector<PDUSessionResourceSetupRequestItem_t> list;
PDUSessionResourceSetupRequestItem_t item; PDUSessionResourceSetupRequestItem_t item = {};
if (pdu_sessions.size() > 0) { if (pdu_sessions.size() > 0) {
for (auto pdu_session : pdu_sessions) { for (auto pdu_session : pdu_sessions) {
...@@ -1226,7 +1224,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1226,7 +1224,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
uint8_t buffer[20240]; uint8_t buffer[20240];
int encoded_size = handoverrequest->encode2buffer(buffer, 20240); int encoded_size = handoverrequest->encode2buffer(buffer, 20240);
bstring b = blk2bstr(buffer, encoded_size); bstring b = blk2bstr(buffer, encoded_size);
std::shared_ptr<gnb_context> gc_target; std::shared_ptr<gnb_context> gc_target = {};
gc_target = gnb_id_2_gnb_context(gnbid->getValue()); gc_target = gnb_id_2_gnb_context(gnbid->getValue());
downlink_sctp_assoc_id = gc_target.get()->sctp_assoc_id; downlink_sctp_assoc_id = gc_target.get()->sctp_assoc_id;
sctp_s_38412.sctp_send_msg(gc_target.get()->sctp_assoc_id, 0, &b); sctp_s_38412.sctp_send_msg(gc_target.get()->sctp_assoc_id, 0, &b);
...@@ -1234,26 +1232,29 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1234,26 +1232,29 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) { void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
// TODO:remove cout/cleanup // TODO: Experimental procedure, to be testbed
unsigned long amf_ue_ngap_id = itti_msg.handoverrequestAck->getAmfUeNgapId(); unsigned long amf_ue_ngap_id = itti_msg.handoverrequestAck->getAmfUeNgapId();
uint32_t ran_ue_ngap_id = itti_msg.handoverrequestAck->getRanUeNgapId(); uint32_t ran_ue_ngap_id = itti_msg.handoverrequestAck->getRanUeNgapId();
AMF_TARGET_ran_id_global = ran_ue_ngap_id; AMF_TARGET_ran_id_global = ran_ue_ngap_id;
Logger::amf_n2().error( Logger::amf_n2().error(
"Handover request Ack ran_ue_ngap_id(0x%d) amf_ue_ngap_id(%d)", "Handover Request Ack ran_ue_ngap_id (0x%d) amf_ue_ngap_id (%d)",
ran_ue_ngap_id, amf_ue_ngap_id); ran_ue_ngap_id, amf_ue_ngap_id);
std::shared_ptr<gnb_context> gc;
std::shared_ptr<gnb_context> gc = {};
if (!is_assoc_id_2_gnb_context(itti_msg.assoc_id)) { if (!is_assoc_id_2_gnb_context(itti_msg.assoc_id)) {
Logger::amf_n2().error( Logger::amf_n2().error(
"gNB with assoc_id(%d) is illegal", itti_msg.assoc_id); "gNB with assoc_id(%d) is illegal", itti_msg.assoc_id);
return; return;
} }
gc = assoc_id_2_gnb_context(itti_msg.assoc_id); gc = assoc_id_2_gnb_context(itti_msg.assoc_id);
std::vector<PDUSessionResourceAdmittedItem_t> list; std::vector<PDUSessionResourceAdmittedItem_t> list;
if (!itti_msg.handoverrequestAck->getPDUSessionResourceAdmittedList(list)) { if (!itti_msg.handoverrequestAck->getPDUSessionResourceAdmittedList(list)) {
Logger::ngap().error( Logger::ngap().error(
"Decoding HandoverRequestACK getPDUSessionResourceList IE error"); "Decoding HandoverRequestACK getPDUSessionResourceList IE error");
return; return;
} }
OCTET_STRING_t targetTosource; OCTET_STRING_t targetTosource;
targetTosource = targetTosource =
itti_msg.handoverrequestAck->getTargetToSource_TransparentContainer(); itti_msg.handoverrequestAck->getTargetToSource_TransparentContainer();
...@@ -1261,21 +1262,22 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) { ...@@ -1261,21 +1262,22 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
PDUSessionResourceHandoverRequestAckTransfer* PDUHandoverRequestAckTransfer = PDUSessionResourceHandoverRequestAckTransfer* PDUHandoverRequestAckTransfer =
new PDUSessionResourceHandoverRequestAckTransfer(); new PDUSessionResourceHandoverRequestAckTransfer();
uint8_t buf[1024]; uint8_t buf[1024];
cout << list[0].handoverRequestAcknowledgeTransfer.buf << endl; // cout << list[0].handoverRequestAcknowledgeTransfer.buf << endl;
cout << list[0].handoverRequestAcknowledgeTransfer.size << endl; // cout << list[0].handoverRequestAcknowledgeTransfer.size << endl;
memcpy( memcpy(
buf, list[0].handoverRequestAcknowledgeTransfer.buf, buf, list[0].handoverRequestAcknowledgeTransfer.buf,
list[0].handoverRequestAcknowledgeTransfer.size); list[0].handoverRequestAcknowledgeTransfer.size);
if (!PDUHandoverRequestAckTransfer->decodefromHandoverRequestAckTransfer( if (!PDUHandoverRequestAckTransfer->decodefromHandoverRequestAckTransfer(
buf, list[0].handoverRequestAcknowledgeTransfer.size)) { buf, list[0].handoverRequestAcknowledgeTransfer.size)) {
cout << "Decode handoverrequestacktransfer error" << endl; Logger::ngap().error("Decode handoverrequestacktransfer error");
return; return;
} }
GtpTunnel_t* gtptunnel = new GtpTunnel_t(); GtpTunnel_t* gtptunnel = new GtpTunnel_t();
if (!PDUHandoverRequestAckTransfer->getUpTransportLayerInformation2( if (!PDUHandoverRequestAckTransfer->getUpTransportLayerInformation2(
gtptunnel)) { gtptunnel)) {
cout << "Decode GtpTunnel error" << endl; Logger::ngap().error("Decode GtpTunnel error");
return; return;
} }
string n3_ip_address; string n3_ip_address;
...@@ -1288,21 +1290,21 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) { ...@@ -1288,21 +1290,21 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
long qosflowidentifiervalue; long qosflowidentifiervalue;
qosflowidentifiervalue = qosflowidentifiervalue =
(long) QosFlowWithDataForwardinglist[0].qosFlowIdentifier; (long) QosFlowWithDataForwardinglist[0].qosFlowIdentifier;
cout << "QFI get is " << qosflowidentifiervalue << endl; Logger::ngap().debug("QFI %lu", qosflowidentifiervalue);
// send HandoverCommandMsg to Source gnb // send HandoverCommandMsg to Source gnb
std::unique_ptr<HandoverCommandMsg> handovercommand = std::unique_ptr<HandoverCommandMsg> handovercommand =
std::make_unique<HandoverCommandMsg>(); std::make_unique<HandoverCommandMsg>();
handovercommand->setMessageType(); handovercommand->setMessageType();
handovercommand->setAmfUeNgapId(amf_ue_ngap_id); handovercommand->setAmfUeNgapId(amf_ue_ngap_id);
handovercommand->setRanUeNgapId(ran_id_Global); handovercommand->setRanUeNgapId(ran_id_global);
handovercommand->setHandoverType(Ngap_HandoverType_intra5gs); handovercommand->setHandoverType(Ngap_HandoverType_intra5gs);
std::shared_ptr<nas_context> nc = std::shared_ptr<nas_context> nc =
amf_n1_inst->amf_ue_id_2_nas_context(amf_ue_ngap_id); amf_n1_inst->amf_ue_id_2_nas_context(amf_ue_ngap_id);
// setPduSessionResourceHandoverList_PDYSessionID_handovercommandtransfer // setPduSessionResourceHandoverList_PDYSessionID_handovercommandtransfer
std::vector<PDUSessionResourceHandoverItem_t> handover_list; std::vector<PDUSessionResourceHandoverItem_t> handover_list;
PDUSessionResourceHandoverItem_t item; PDUSessionResourceHandoverItem_t item = {};
// set pdu id // set pdu id
item.pduSessionId = list[0].pduSessionId; item.pduSessionId = list[0].pduSessionId;
// set qosFLowtobeforwardedlist // set qosFLowtobeforwardedlist
...@@ -1318,7 +1320,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) { ...@@ -1318,7 +1320,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
PDUSessionResourceHandoverCommandTransfer* handovercommandtransfer = PDUSessionResourceHandoverCommandTransfer* handovercommandtransfer =
new PDUSessionResourceHandoverCommandTransfer(); new PDUSessionResourceHandoverCommandTransfer();
handovercommandtransfer->setQosFlowToBeForwardedList(forward_list); handovercommandtransfer->setQosFlowToBeForwardedList(forward_list);
GtpTunnel_t uptlinfo; GtpTunnel_t uptlinfo = {};
uptlinfo.gtp_teid = teid; uptlinfo.gtp_teid = teid;
uptlinfo.ip_address = n3_ip_address; uptlinfo.ip_address = n3_ip_address;
handovercommandtransfer->setUPTransportLayerInformation(uptlinfo); handovercommandtransfer->setUPTransportLayerInformation(uptlinfo);
...@@ -1339,21 +1341,21 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) { ...@@ -1339,21 +1341,21 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
int encoded_size = handovercommand->encode2buffer(buffer, 10240); int encoded_size = handovercommand->encode2buffer(buffer, 10240);
bstring b = blk2bstr(buffer, encoded_size); bstring b = blk2bstr(buffer, encoded_size);
std::shared_ptr<ue_ngap_context> unc; std::shared_ptr<ue_ngap_context> unc;
if (!is_ran_ue_id_2_ue_ngap_context(ran_id_Global)) { if (!is_ran_ue_id_2_ue_ngap_context(ran_id_global)) {
Logger::amf_n2().debug( Logger::amf_n2().debug(
"Create a new ue ngap context with ran_ue_ngap_id(0x%x)", "Create a new ue ngap context with ran_ue_ngap_id(0x%x)",
ran_id_Global); ran_id_global);
unc = std::shared_ptr<ue_ngap_context>(new ue_ngap_context()); unc = std::shared_ptr<ue_ngap_context>(new ue_ngap_context());
set_ran_ue_ngap_id_2_ue_ngap_context(ran_id_Global, unc); set_ran_ue_ngap_id_2_ue_ngap_context(ran_id_global, unc);
unc.get()->gnb_assoc_id = source_assoc_id; unc.get()->gnb_assoc_id = source_assoc_id;
} else { } else {
unc = ran_ue_id_2_ue_ngap_context(ran_id_Global); unc = ran_ue_id_2_ue_ngap_context(ran_id_global);
unc.get()->gnb_assoc_id = source_assoc_id; unc.get()->gnb_assoc_id = source_assoc_id;
} }
// std::shared_ptr<ue_ngap_context> ngc = // std::shared_ptr<ue_ngap_context> ngc =
// ran_ue_id_2_ue_ngap_context(nc.get()->ran_ue_ngap_id); // ran_ue_id_2_ue_ngap_context(nc.get()->ran_ue_ngap_id);
// std::shared_ptr<ue_ngap_context> ngc = // std::shared_ptr<ue_ngap_context> ngc =
// ran_ue_id_2_ue_ngap_context(ran_id_Global); // ran_ue_id_2_ue_ngap_context(ran_id_global);
// sctp_s_38412.sctp_send_msg(ngc.get()->gnb_assoc_id, 0, &b); // sctp_s_38412.sctp_send_msg(ngc.get()->gnb_assoc_id, 0, &b);
sctp_s_38412.sctp_send_msg(unc.get()->gnb_assoc_id, 0, &b); sctp_s_38412.sctp_send_msg(unc.get()->gnb_assoc_id, 0, &b);
} }
...@@ -1380,7 +1382,7 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) { ...@@ -1380,7 +1382,7 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) {
std::unique_ptr<UEContextReleaseCommandMsg> ueContextReleaseCommand = std::unique_ptr<UEContextReleaseCommandMsg> ueContextReleaseCommand =
std::make_unique<UEContextReleaseCommandMsg>(); std::make_unique<UEContextReleaseCommandMsg>();
ueContextReleaseCommand->setMessageType(); ueContextReleaseCommand->setMessageType();
ueContextReleaseCommand->setUeNgapIdPair(amf_ue_ngap_id, ran_id_Global); ueContextReleaseCommand->setUeNgapIdPair(amf_ue_ngap_id, ran_id_global);
ueContextReleaseCommand->setCauseRadioNetwork( ueContextReleaseCommand->setCauseRadioNetwork(
Ngap_CauseRadioNetwork_successful_handover); Ngap_CauseRadioNetwork_successful_handover);
uint8_t buffer[10240]; uint8_t buffer[10240];
......
...@@ -218,7 +218,7 @@ class itti_handover_required : public itti_msg_n2 { ...@@ -218,7 +218,7 @@ class itti_handover_required : public itti_msg_n2 {
itti_handover_required(const task_id_t origin, const task_id_t destination) itti_handover_required(const task_id_t origin, const task_id_t destination)
: itti_msg_n2(HANDOVER_REQUIRED, origin, destination) {} : itti_msg_n2(HANDOVER_REQUIRED, origin, destination) {}
itti_handover_required(const itti_handover_required& i) : itti_msg_n2(i) {} itti_handover_required(const itti_handover_required& i) : itti_msg_n2(i) {}
HandoverRequiredMsg* handvoerRequ; HandoverRequiredMsg* handoverReq;
}; };
class itti_handover_request_Ack : public itti_msg_n2 { class itti_handover_request_Ack : public itti_msg_n2 {
......
...@@ -543,7 +543,7 @@ int downlink_ue_associated_nappa_transport( ...@@ -543,7 +543,7 @@ int downlink_ue_associated_nappa_transport(
int handover_cancel( int handover_cancel(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) { struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti handover cancel to TASK_AMF_N2"); Logger::ngap().debug("Sending ITTI Handover Cancel to TASK_AMF_N2");
return 0; return 0;
} }
...@@ -551,18 +551,18 @@ int handover_cancel( ...@@ -551,18 +551,18 @@ int handover_cancel(
int handover_preparation( int handover_preparation(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) { struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti handover preparation to TASK_AMF_N2"); Logger::ngap().debug("Sending ITTI Handover Preparation to TASK_AMF_N2");
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p);
HandoverRequiredMsg* handoverrequired = new HandoverRequiredMsg(); HandoverRequiredMsg* handover_required = new HandoverRequiredMsg();
if (!handoverrequired->decodefrompdu(message_p)) { if (!handover_required->decodefrompdu(message_p)) {
Logger::ngap().error("decoding HandoverRequired message error"); Logger::ngap().error("Decoding HandoverRequired message error");
return -1; return -1;
} }
itti_handover_required* itti_handover_requ = itti_handover_required* itti_handover_requ =
new itti_handover_required(TASK_NGAP, TASK_AMF_N2); new itti_handover_required(TASK_NGAP, TASK_AMF_N2);
itti_handover_requ->assoc_id = assoc_id; itti_handover_requ->assoc_id = assoc_id;
itti_handover_requ->stream = stream; itti_handover_requ->stream = stream;
itti_handover_requ->handvoerRequ = handoverrequired; itti_handover_requ->handoverReq = handover_required;
std::shared_ptr<itti_handover_required> i = std::shared_ptr<itti_handover_required> i =
std::shared_ptr<itti_handover_required>(itti_handover_requ); std::shared_ptr<itti_handover_required>(itti_handover_requ);
int ret = itti_inst->send_msg(i); int ret = itti_inst->send_msg(i);
...@@ -578,11 +578,11 @@ int handover_preparation( ...@@ -578,11 +578,11 @@ int handover_preparation(
int handover_notification( int handover_notification(
const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream, const sctp_assoc_id_t assoc_id, const sctp_stream_id_t stream,
struct Ngap_NGAP_PDU* message_p) { struct Ngap_NGAP_PDU* message_p) {
Logger::ngap().debug("Sending itti handover Notification to TASK_AMF_N2"); Logger::ngap().debug("Sending ITTI Handover Notification to TASK_AMF_N2");
asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p); asn_fprint(stderr, &asn_DEF_Ngap_NGAP_PDU, message_p);
HandoverNotifyMsg* handoverNotify = new HandoverNotifyMsg(); HandoverNotifyMsg* handoverNotify = new HandoverNotifyMsg();
if (!handoverNotify->decodefrompdu(message_p)) { if (!handoverNotify->decodefrompdu(message_p)) {
Logger::ngap().error("decoding handoverNotify message error"); Logger::ngap().error("Decoding HandoverNotify message error");
return -1; return -1;
} }
itti_handover_notify* itti_handover_NOTIFY = itti_handover_notify* itti_handover_NOTIFY =
......
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