Commit 96e00243 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Add HandoverPreparationFailure

parent 40420fef
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "PduSessionResourceReleaseCommand.hpp" #include "PduSessionResourceReleaseCommand.hpp"
#include "PduSessionResourceSetupRequest.hpp" #include "PduSessionResourceSetupRequest.hpp"
#include "UEContextReleaseCommand.hpp" #include "UEContextReleaseCommand.hpp"
#include "HandoverPreparationFailure.hpp"
#include "amf_app.hpp" #include "amf_app.hpp"
#include "amf_config.hpp" #include "amf_config.hpp"
#include "amf_n1.hpp" #include "amf_n1.hpp"
...@@ -170,7 +171,9 @@ void amf_n2_task(void* args_p) { ...@@ -170,7 +171,9 @@ void amf_n2_task(void* args_p) {
Logger::amf_n2().info("Received HANDOVER_REQUIRED message,handling"); Logger::amf_n2().info("Received HANDOVER_REQUIRED message,handling");
itti_handover_required* m = dynamic_cast<itti_handover_required*>(msg); itti_handover_required* m = dynamic_cast<itti_handover_required*>(msg);
if (!amf_n2_inst->handle_itti_message(ref(*m))) if (!amf_n2_inst->handle_itti_message(ref(*m)))
amf_n2_inst->send_handover_preparation_failure(m->assoc_id); amf_n2_inst->send_handover_preparation_failure(
m->handoverReq->getAmfUeNgapId(),
m->handoverReq->getRanUeNgapId(), m->assoc_id);
} break; } break;
case HANDOVER_REQUEST_ACK: { case HANDOVER_REQUEST_ACK: {
Logger::amf_n2().info("Received HANDOVER_REQUEST_ACK message,handling"); Logger::amf_n2().info("Received HANDOVER_REQUEST_ACK message,handling");
...@@ -1517,9 +1520,22 @@ void amf_n2::handle_itti_message(itti_uplinkranstatsutransfer& itti_msg) { ...@@ -1517,9 +1520,22 @@ void amf_n2::handle_itti_message(itti_uplinkranstatsutransfer& itti_msg) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void amf_n2::send_handover_preparation_failure( void amf_n2::send_handover_preparation_failure(
const unsigned long amf_ue_ngap_id, const uint32_t ran_ue_ngap_id,
const sctp_assoc_id_t& gnb_assoc_id) { const sctp_assoc_id_t& gnb_assoc_id) {
// TODO: // Create HandoverPreparationFailure message to be sent to target gNB
return; std::unique_ptr<HandoverPreparationFailure> hoPreparationFailure =
std::make_unique<HandoverPreparationFailure>();
hoPreparationFailure->setMessageType();
hoPreparationFailure->setAmfUeNgapId(amf_ue_ngap_id);
hoPreparationFailure->setRanUeNgapId(amf_ue_ngap_id);
hoPreparationFailure->setCause(Ngap_Cause_PR_NOTHING);
uint8_t buffer[BUFFER_SIZE_1024];
int encoded_size =
hoPreparationFailure->encode2buffer(buffer, BUFFER_SIZE_1024);
bstring b = blk2bstr(buffer, encoded_size);
sctp_s_38412.sctp_send_msg(gnb_assoc_id, 0, &b);
} }
// Context management functions // Context management functions
......
...@@ -62,7 +62,9 @@ class amf_n2 : public ngap::ngap_app { ...@@ -62,7 +62,9 @@ class amf_n2 : public ngap::ngap_app {
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);
void handle_itti_message(itti_uplinkranstatsutransfer& itti_msg); void handle_itti_message(itti_uplinkranstatsutransfer& itti_msg);
void send_handover_preparation_failure(const sctp_assoc_id_t& gnb_assoc_id); void send_handover_preparation_failure(
const unsigned long amf_ue_ngap_id, const uint32_t ran_ue_ngap_id,
const sctp_assoc_id_t& gnb_assoc_id);
bool verifyPlmn(std::vector<SupportedItem_t> list); bool verifyPlmn(std::vector<SupportedItem_t> list);
std::vector<SupportedItem_t> get_common_plmn( std::vector<SupportedItem_t> get_common_plmn(
......
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef _HANDOVER_PREPARATION_FAILURE_H_
#define _HANDOVER_PREPARATION_FAILURE_H_
#include "AMF-UE-NGAP-ID.hpp"
#include "Cause.hpp"
#include "MessageType.hpp"
#include "NgapIEsStruct.hpp"
#include "RAN-UE-NGAP-ID.hpp"
extern "C" {
#include "Ngap_NGAP-PDU.h"
#include "Ngap_ProtocolIE-Field.h"
}
namespace ngap {
class HandoverPreparationFailure {
public:
HandoverPreparationFailure();
virtual ~HandoverPreparationFailure();
void setMessageType(); // Initialize the PDU and populate the MessageType;
void setAmfUeNgapId(unsigned long id); // 40 bits
unsigned long getAmfUeNgapId() const;
void setRanUeNgapId(uint32_t id); // 32 bits
uint32_t getRanUeNgapId() const;
int encode2buffer(uint8_t* buf, int buf_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
void getCause(Cause& cause) const;
void setCause(Ngap_Cause_PR m_causePresent, long value = 0);
Ngap_Cause_PR getChoiceOfCause() const;
private:
Ngap_NGAP_PDU_t* hoPreparationFailurePdu;
Ngap_HandoverPreparationFailure_t* hoPreparationFailureIEs;
AMF_UE_NGAP_ID* amfUeNgapId;
RAN_UE_NGAP_ID* ranUeNgapId;
Cause* cause;
Ngap_CriticalityDiagnostics_t* CriticalityDiagnostics;
};
} // namespace ngap
#endif
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