Skip to content

Commit

Permalink
cu_cp,ngap: move ue creation to cu-cp
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianEckermann authored and Fabian Eckermann committed Jun 28, 2024
1 parent 704df95 commit d8c4e70
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 24 deletions.
12 changes: 6 additions & 6 deletions lib/cu_cp/adapters/ngap_adapters.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ class ngap_cu_cp_adapter : public ngap_cu_cp_du_repository_notifier, public ngap
cu_cp_handler = &cu_cp_handler_;
}

ue_index_t request_new_ue_index_allocation(nr_cell_global_id_t cgi) override
{
srsran_assert(du_repository_handler != nullptr, "CU-CP Paging handler must not be nullptr");
return du_repository_handler->handle_ue_index_allocation_request(cgi);
}

void on_paging_message(cu_cp_paging_message& msg) override
{
srsran_assert(du_repository_handler != nullptr, "CU-CP Paging handler must not be nullptr");
Expand Down Expand Up @@ -103,6 +97,12 @@ class ngap_cu_cp_adapter : public ngap_cu_cp_du_repository_notifier, public ngap
return cu_cp_handler->handle_new_handover_command(ue_index, std::move(command));
}

ue_index_t request_new_ue_index_allocation(nr_cell_global_id_t cgi) override
{
srsran_assert(cu_cp_handler != nullptr, "CU-CP NGAP handler must not be nullptr");
return cu_cp_handler->handle_ue_index_allocation_request(cgi);
}

void on_n2_disconnection() override
{
srsran_assert(cu_cp_handler != nullptr, "CU-CP NGAP handler must not be nullptr");
Expand Down
10 changes: 10 additions & 0 deletions lib/cu_cp/cu_cp_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,16 @@ async_task<bool> cu_cp_impl::handle_new_handover_command(ue_index_t ue_index, by
});
}

ue_index_t cu_cp_impl::handle_ue_index_allocation_request(const nr_cell_global_id_t& cgi)
{
du_index_t du_index = du_db.find_du(cgi);
if (du_index == du_index_t::invalid) {
logger.warning("Could not find DU for CGI={}", cgi.nci);
return ue_index_t::invalid;
}
return ue_mng.add_ue(du_index);
}

void cu_cp_impl::handle_n2_disconnection()
{
// TODO
Expand Down
1 change: 1 addition & 0 deletions lib/cu_cp/cu_cp_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class cu_cp_impl final : public cu_cp,
async_task<ngap_handover_resource_allocation_response>
handle_ngap_handover_request(const ngap_handover_request& request) override;
async_task<bool> handle_new_handover_command(ue_index_t ue_index, byte_buffer command) override;
ue_index_t handle_ue_index_allocation_request(const nr_cell_global_id_t& cgi) override;
void handle_n2_disconnection() override;

// cu_cp_measurement_handler
Expand Down
3 changes: 3 additions & 0 deletions lib/cu_cp/cu_cp_impl_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class cu_cp_ngap_handler : public cu_cp_ue_context_release_handler, public cu_cp
/// \returns True if the Handover Command was successfully handled, false otherwise.
virtual async_task<bool> handle_new_handover_command(ue_index_t ue_index, byte_buffer command) = 0;

/// \brief Handles UE index allocation request for N2 handover at target gNB
virtual ue_index_t handle_ue_index_allocation_request(const nr_cell_global_id_t& cgi) = 0;

/// \brief Handle N2 AMF connection drop.
virtual void handle_n2_disconnection() = 0;
};
Expand Down
3 changes: 0 additions & 3 deletions lib/cu_cp/du_processor/du_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,6 @@ class du_repository_ngap_handler

/// \brief Handles a Paging message notification.
virtual void handle_paging_message(cu_cp_paging_message& msg) = 0;

/// \brief Handles UE index allocation request for N2 handover at target gNB
virtual ue_index_t handle_ue_index_allocation_request(const nr_cell_global_id_t& cgi) = 0;
};

/// Methods to get statistics of the DU processor.
Expand Down
26 changes: 14 additions & 12 deletions lib/cu_cp/du_processor/du_processor_repository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,21 @@ du_index_t du_processor_repository::find_du(pci_t pci)
{
du_index_t index = du_index_t::invalid;
for (const auto& du : du_db) {
if (du.second.processor->has_cell(pci))
if (du.second.processor->has_cell(pci)) {
return du.first;
}
}

return index;
}

du_index_t du_processor_repository::find_du(const nr_cell_global_id_t& cgi)
{
du_index_t index = du_index_t::invalid;
for (const auto& du : du_db) {
if (du.second.processor->has_cell(cgi)) {
return du.first;
}
}

return index;
Expand All @@ -136,17 +149,6 @@ void du_processor_repository::handle_paging_message(cu_cp_paging_message& msg)
}
}

ue_index_t du_processor_repository::handle_ue_index_allocation_request(const nr_cell_global_id_t& cgi)
{
for (auto& du : du_db) {
if (du.second.processor->has_cell(cgi)) {
return cfg.ue_mng.add_ue(du.first);
}
}
logger.debug("No DU with plmn={} and cell_id={} found.", cgi.plmn_id, cgi.nci);
return ue_index_t::invalid;
}

std::vector<metrics_report::du_info> du_processor_repository::handle_du_metrics_report_request() const
{
std::vector<metrics_report::du_info> du_reports;
Expand Down
10 changes: 7 additions & 3 deletions lib/cu_cp/du_processor/du_processor_repository.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,19 @@ class du_processor_repository : public du_repository_ngap_handler, public du_rep
explicit du_processor_repository(du_repository_config cfg_);

/// \brief Checks whether a cell with the specified PCI is served by any of the connected DUs.
/// \param[out] The index of the DU serving the given PCI.
/// \param[in] pci The serving cell PCI.
/// \return The index of the DU serving the given PCI.
du_index_t find_du(pci_t pci);

/// \brief Checks whether a cell with the specified CGI is served by any of the connected DUs.
/// \param[in] cgi The serving cell CGI.
/// \return The index of the DU serving the given CGI.
du_index_t find_du(const nr_cell_global_id_t& cgi);

du_processor& get_du_processor(du_index_t du_index);

void handle_paging_message(cu_cp_paging_message& msg) override;

ue_index_t handle_ue_index_allocation_request(const nr_cell_global_id_t& nci) override;

std::vector<metrics_report::du_info> handle_du_metrics_report_request() const override;

size_t get_nof_f1ap_ues();
Expand Down

0 comments on commit d8c4e70

Please sign in to comment.