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

Code cleanup

parent b3b52792
...@@ -69,8 +69,8 @@ extern statistics stacs; ...@@ -69,8 +69,8 @@ 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 source_ran_id_global = 0;
uint32_t AMF_TARGET_ran_id_global = 0; uint32_t 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;
int ncc = 0; int ncc = 0;
...@@ -1050,7 +1050,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) { ...@@ -1050,7 +1050,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
ncc++; // TODO: to be verified ncc++; // TODO: to be verified
unsigned long amf_ue_ngap_id = itti_msg.handoverReq->getAmfUeNgapId(); unsigned long amf_ue_ngap_id = itti_msg.handoverReq->getAmfUeNgapId();
uint32_t ran_ue_ngap_id = itti_msg.handoverReq->getRanUeNgapId(); uint32_t ran_ue_ngap_id = itti_msg.handoverReq->getRanUeNgapId();
ran_id_global = ran_ue_ngap_id; source_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 = {};
...@@ -1236,7 +1236,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) { ...@@ -1236,7 +1236,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
// TODO: Experimental procedure, to be tested // TODO: Experimental procedure, to be tested
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; 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);
...@@ -1297,7 +1297,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) { ...@@ -1297,7 +1297,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
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(source_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);
...@@ -1341,21 +1341,21 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) { ...@@ -1341,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(source_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); source_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(source_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(source_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(source_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);
} }
...@@ -1383,7 +1383,8 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) { ...@@ -1383,7 +1383,8 @@ 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, source_ran_id_global);
ueContextReleaseCommand->setCauseRadioNetwork( ueContextReleaseCommand->setCauseRadioNetwork(
Ngap_CauseRadioNetwork_successful_handover); Ngap_CauseRadioNetwork_successful_handover);
...@@ -1467,14 +1468,14 @@ void amf_n2::handle_itti_message(itti_uplinkranstatsutransfer& itti_msg) { ...@@ -1467,14 +1468,14 @@ void amf_n2::handle_itti_message(itti_uplinkranstatsutransfer& itti_msg) {
std::make_unique<DownlinkRANStatusTransfer>(); std::make_unique<DownlinkRANStatusTransfer>();
downLinkranstatustransfer->setmessagetype(); downLinkranstatustransfer->setmessagetype();
downLinkranstatustransfer->setAmfUeNgapId(amf_ue_ngap_id); downLinkranstatustransfer->setAmfUeNgapId(amf_ue_ngap_id);
downLinkranstatustransfer->setRanUeNgapId(AMF_TARGET_ran_id_global); downLinkranstatustransfer->setRanUeNgapId(target_ran_id_global);
downLinkranstatustransfer->setRANStatusTransfer_TransparentContainer( downLinkranstatustransfer->setRANStatusTransfer_TransparentContainer(
amf_drb_id, amf_ul_pdcp, amf_hfn_ul_pdcp, amf_dl_pdcp, amf_hfn_dl_pdcp); amf_drb_id, amf_ul_pdcp, amf_hfn_ul_pdcp, amf_dl_pdcp, amf_hfn_dl_pdcp);
uint8_t buffer[1024]; uint8_t buffer[1024];
int encode_size = downLinkranstatustransfer->encodetobuffer(buffer, 1024); int encode_size = downLinkranstatustransfer->encodetobuffer(buffer, 1024);
bstring b = blk2bstr(buffer, encode_size); bstring b = blk2bstr(buffer, encode_size);
// std::shared_ptr<ue_ngap_context> ngc = // std::shared_ptr<ue_ngap_context> ngc =
// ran_ue_id_2_ue_ngap_context(AMF_TARGET_ran_id_global); // ran_ue_id_2_ue_ngap_context(target_ran_id_global);
sctp_s_38412.sctp_send_msg(downlink_sctp_assoc_id, 0, &b); sctp_s_38412.sctp_send_msg(downlink_sctp_assoc_id, 0, &b);
} }
......
...@@ -60,8 +60,8 @@ class HandoverCommandMsg { ...@@ -60,8 +60,8 @@ class HandoverCommandMsg {
int encode2buffer(uint8_t* buf, int buf_size); int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu); bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId(); // return -1;(不存在) unsigned long getAmfUeNgapId(); // return -1;
uint32_t getRanUeNgapId(); // return -1;(不存在) uint32_t getRanUeNgapId(); // return -1;
/*void getHandoverType(Ngap_HandoverType_t &handovertype); /*void getHandoverType(Ngap_HandoverType_t &handovertype);
void getCause(Cause cause); void getCause(Cause cause);
void getTargetID(Ngap_TargetID_t targetID); void getTargetID(Ngap_TargetID_t targetID);
......
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