Skip to content

Commit d8c4e70

Browse files
FabianEckermannFabian Eckermann
authored andcommitted
cu_cp,ngap: move ue creation to cu-cp
1 parent 704df95 commit d8c4e70

File tree

7 files changed

+41
-24
lines changed

7 files changed

+41
-24
lines changed

lib/cu_cp/adapters/ngap_adapters.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ class ngap_cu_cp_adapter : public ngap_cu_cp_du_repository_notifier, public ngap
3232
cu_cp_handler = &cu_cp_handler_;
3333
}
3434

35-
ue_index_t request_new_ue_index_allocation(nr_cell_global_id_t cgi) override
36-
{
37-
srsran_assert(du_repository_handler != nullptr, "CU-CP Paging handler must not be nullptr");
38-
return du_repository_handler->handle_ue_index_allocation_request(cgi);
39-
}
40-
4135
void on_paging_message(cu_cp_paging_message& msg) override
4236
{
4337
srsran_assert(du_repository_handler != nullptr, "CU-CP Paging handler must not be nullptr");
@@ -103,6 +97,12 @@ class ngap_cu_cp_adapter : public ngap_cu_cp_du_repository_notifier, public ngap
10397
return cu_cp_handler->handle_new_handover_command(ue_index, std::move(command));
10498
}
10599

100+
ue_index_t request_new_ue_index_allocation(nr_cell_global_id_t cgi) override
101+
{
102+
srsran_assert(cu_cp_handler != nullptr, "CU-CP NGAP handler must not be nullptr");
103+
return cu_cp_handler->handle_ue_index_allocation_request(cgi);
104+
}
105+
106106
void on_n2_disconnection() override
107107
{
108108
srsran_assert(cu_cp_handler != nullptr, "CU-CP NGAP handler must not be nullptr");

lib/cu_cp/cu_cp_impl.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,16 @@ async_task<bool> cu_cp_impl::handle_new_handover_command(ue_index_t ue_index, by
497497
});
498498
}
499499

500+
ue_index_t cu_cp_impl::handle_ue_index_allocation_request(const nr_cell_global_id_t& cgi)
501+
{
502+
du_index_t du_index = du_db.find_du(cgi);
503+
if (du_index == du_index_t::invalid) {
504+
logger.warning("Could not find DU for CGI={}", cgi.nci);
505+
return ue_index_t::invalid;
506+
}
507+
return ue_mng.add_ue(du_index);
508+
}
509+
500510
void cu_cp_impl::handle_n2_disconnection()
501511
{
502512
// TODO

lib/cu_cp/cu_cp_impl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class cu_cp_impl final : public cu_cp,
8181
async_task<ngap_handover_resource_allocation_response>
8282
handle_ngap_handover_request(const ngap_handover_request& request) override;
8383
async_task<bool> handle_new_handover_command(ue_index_t ue_index, byte_buffer command) override;
84+
ue_index_t handle_ue_index_allocation_request(const nr_cell_global_id_t& cgi) override;
8485
void handle_n2_disconnection() override;
8586

8687
// cu_cp_measurement_handler

lib/cu_cp/cu_cp_impl_interface.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ class cu_cp_ngap_handler : public cu_cp_ue_context_release_handler, public cu_cp
9393
/// \returns True if the Handover Command was successfully handled, false otherwise.
9494
virtual async_task<bool> handle_new_handover_command(ue_index_t ue_index, byte_buffer command) = 0;
9595

96+
/// \brief Handles UE index allocation request for N2 handover at target gNB
97+
virtual ue_index_t handle_ue_index_allocation_request(const nr_cell_global_id_t& cgi) = 0;
98+
9699
/// \brief Handle N2 AMF connection drop.
97100
virtual void handle_n2_disconnection() = 0;
98101
};

lib/cu_cp/du_processor/du_processor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,6 @@ class du_repository_ngap_handler
290290

291291
/// \brief Handles a Paging message notification.
292292
virtual void handle_paging_message(cu_cp_paging_message& msg) = 0;
293-
294-
/// \brief Handles UE index allocation request for N2 handover at target gNB
295-
virtual ue_index_t handle_ue_index_allocation_request(const nr_cell_global_id_t& cgi) = 0;
296293
};
297294

298295
/// Methods to get statistics of the DU processor.

lib/cu_cp/du_processor/du_processor_repository.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,21 @@ du_index_t du_processor_repository::find_du(pci_t pci)
114114
{
115115
du_index_t index = du_index_t::invalid;
116116
for (const auto& du : du_db) {
117-
if (du.second.processor->has_cell(pci))
117+
if (du.second.processor->has_cell(pci)) {
118118
return du.first;
119+
}
120+
}
121+
122+
return index;
123+
}
124+
125+
du_index_t du_processor_repository::find_du(const nr_cell_global_id_t& cgi)
126+
{
127+
du_index_t index = du_index_t::invalid;
128+
for (const auto& du : du_db) {
129+
if (du.second.processor->has_cell(cgi)) {
130+
return du.first;
131+
}
119132
}
120133

121134
return index;
@@ -136,17 +149,6 @@ void du_processor_repository::handle_paging_message(cu_cp_paging_message& msg)
136149
}
137150
}
138151

139-
ue_index_t du_processor_repository::handle_ue_index_allocation_request(const nr_cell_global_id_t& cgi)
140-
{
141-
for (auto& du : du_db) {
142-
if (du.second.processor->has_cell(cgi)) {
143-
return cfg.ue_mng.add_ue(du.first);
144-
}
145-
}
146-
logger.debug("No DU with plmn={} and cell_id={} found.", cgi.plmn_id, cgi.nci);
147-
return ue_index_t::invalid;
148-
}
149-
150152
std::vector<metrics_report::du_info> du_processor_repository::handle_du_metrics_report_request() const
151153
{
152154
std::vector<metrics_report::du_info> du_reports;

lib/cu_cp/du_processor/du_processor_repository.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,19 @@ class du_processor_repository : public du_repository_ngap_handler, public du_rep
4848
explicit du_processor_repository(du_repository_config cfg_);
4949

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

55+
/// \brief Checks whether a cell with the specified CGI is served by any of the connected DUs.
56+
/// \param[in] cgi The serving cell CGI.
57+
/// \return The index of the DU serving the given CGI.
58+
du_index_t find_du(const nr_cell_global_id_t& cgi);
59+
5460
du_processor& get_du_processor(du_index_t du_index);
5561

5662
void handle_paging_message(cu_cp_paging_message& msg) override;
5763

58-
ue_index_t handle_ue_index_allocation_request(const nr_cell_global_id_t& nci) override;
59-
6064
std::vector<metrics_report::du_info> handle_du_metrics_report_request() const override;
6165

6266
size_t get_nof_f1ap_ues();

0 commit comments

Comments
 (0)