From 03859803476118b2651dae3a5098226d8bf95729 Mon Sep 17 00:00:00 2001 From: David Rupprecht Date: Mon, 23 Aug 2021 10:02:23 +0200 Subject: [PATCH] Fixed minor NGAP issues --- srsenb/hdr/stack/ngap/ngap_ue.h | 10 +++++----- srsenb/hdr/stack/ngap/ngap_ue_proc.h | 2 +- srsenb/src/stack/ngap/ngap_ue.cc | 19 ++++++++----------- srsenb/src/stack/ngap/ngap_ue_proc.cc | 10 +++++----- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/srsenb/hdr/stack/ngap/ngap_ue.h b/srsenb/hdr/stack/ngap/ngap_ue.h index 99f203628..77bbc626e 100644 --- a/srsenb/hdr/stack/ngap/ngap_ue.h +++ b/srsenb/hdr/stack/ngap/ngap_ue.h @@ -44,22 +44,22 @@ public: void ue_ctxt_setup_complete(); void notify_rrc_reconf_complete(const bool reconf_complete_outcome); - srsran::proc_t initial_context_setup_proc; - srsran::proc_t ue_context_release_proc; - ngap_ue_ctxt_t ctxt = {}; uint16_t stream_id = 1; private: // args - ngap* ngap_ptr; - rrc_interface_ngap_nr* rrc_ptr; + ngap* ngap_ptr = nullptr; // state bool release_requested = false; // logger srslog::basic_logger& logger; + + // procedures + srsran::proc_t initial_context_setup_proc; + srsran::proc_t ue_context_release_proc; }; } // namespace srsenb diff --git a/srsenb/hdr/stack/ngap/ngap_ue_proc.h b/srsenb/hdr/stack/ngap/ngap_ue_proc.h index 9464fcd8e..eeb13c5b6 100644 --- a/srsenb/hdr/stack/ngap/ngap_ue_proc.h +++ b/srsenb/hdr/stack/ngap/ngap_ue_proc.h @@ -37,7 +37,7 @@ public: rrc_interface_ngap_nr* rrc_, ngap_ue_ctxt_t* ue_ctxt); srsran::proc_outcome_t init(const asn1::ngap_nr::init_context_setup_request_s& msg); - srsran::proc_outcome_t react(const bool security_mode_command_outcome); + srsran::proc_outcome_t react(const bool rrc_reconf_outcome); srsran::proc_outcome_t step(); static const char* name() { return "Initial Context Setup"; } diff --git a/srsenb/src/stack/ngap/ngap_ue.cc b/srsenb/src/stack/ngap/ngap_ue.cc index 59b9f4737..ac988ca45 100644 --- a/srsenb/src/stack/ngap/ngap_ue.cc +++ b/srsenb/src/stack/ngap/ngap_ue.cc @@ -26,9 +26,8 @@ namespace srsenb { ngap::ue::ue(ngap* ngap_ptr_, rrc_interface_ngap_nr* rrc_ptr_, srslog::basic_logger& logger_) : logger(logger_), ngap_ptr(ngap_ptr_), - rrc_ptr(rrc_ptr_), - initial_context_setup_proc(this, rrc_ptr, &ctxt), - ue_context_release_proc(this, rrc_ptr, &ctxt) + initial_context_setup_proc(this, rrc_ptr_, &ctxt), + ue_context_release_proc(this, rrc_ptr_, &ctxt) { ctxt.ran_ue_ngap_id = ngap_ptr->next_gnb_ue_ngap_id++; gettimeofday(&ctxt.init_timestamp, nullptr); @@ -82,6 +81,10 @@ bool ngap::ue::send_initial_ue_message(asn1::ngap_nr::rrcestablishment_cause_e c container.user_location_info.value.user_location_info_nr().tai.plmn_id = ngap_ptr->tai.plmn_id; container.user_location_info.value.user_location_info_nr().tai.tac = ngap_ptr->tai.tac; + // UE context request for setup in the NAS registration request + container.ue_context_request_present = true; + container.ue_context_request.value = asn1::ngap_nr::ue_context_request_opts::options::requested; + return ngap_ptr->sctp_send_ngap_pdu(tx_pdu, ctxt.rnti, "InitialUEMessage"); } @@ -138,7 +141,7 @@ bool ngap::ue::send_initial_ctxt_setup_response() } ngap_pdu_c tx_pdu; - tx_pdu.set_init_msg().load_info_obj(ASN1_NGAP_NR_ID_INIT_CONTEXT_SETUP); + tx_pdu.set_successful_outcome().load_info_obj(ASN1_NGAP_NR_ID_INIT_CONTEXT_SETUP); init_context_setup_resp_s& container = tx_pdu.successful_outcome().value.init_context_setup_resp(); // AMF UE NGAP ID @@ -147,13 +150,7 @@ bool ngap::ue::send_initial_ctxt_setup_response() // RAN UE NGAP ID container.protocol_ies.ran_ue_ngap_id.value = ctxt.ran_ue_ngap_id; - /* // TODO: PDU Session Resource Setup Response List - Integrate PDU Session and Bearer management into NGAP - container.protocol_ies.pdu_session_res_setup_list_cxt_res_present = true; - - // Case PDU Session Resource Failed to Setup List - container.protocol_ies.pdu_session_res_failed_to_setup_list_cxt_res_present = true; */ - - return true; + return ngap_ptr->sctp_send_ngap_pdu(tx_pdu, ctxt.rnti, "InitialContextSetupResponse"); } bool ngap::ue::send_initial_ctxt_setup_failure(cause_c cause) diff --git a/srsenb/src/stack/ngap/ngap_ue_proc.cc b/srsenb/src/stack/ngap/ngap_ue_proc.cc index 8b113b098..52b0812b3 100644 --- a/srsenb/src/stack/ngap/ngap_ue_proc.cc +++ b/srsenb/src/stack/ngap/ngap_ue_proc.cc @@ -52,17 +52,17 @@ proc_outcome_t ngap_ue_initial_context_setup_proc::init(const asn1::ngap_nr::ini return proc_outcome_t::yield; }; -proc_outcome_t ngap_ue_initial_context_setup_proc::react(bool security_mode_command_outcome) +proc_outcome_t ngap_ue_initial_context_setup_proc::react(bool rrc_reconf_outcome) { - if(security_mode_command_outcome == true) { + if (rrc_reconf_outcome == true) { parent->send_initial_ctxt_setup_response(); return proc_outcome_t::success; - } - // TODO: error handling if security mode command fails + } + return proc_outcome_t::error; } -proc_outcome_t ngap_ue_initial_context_setup_proc::step() +proc_outcome_t ngap_ue_initial_context_setup_proc::step() { return proc_outcome_t::yield; }