Skip to content

Commit a1107a0

Browse files
author
Piotr Gawlowicz
committed
e2: refactoring, use sctp client instead of the old sctp gw
1 parent 336fe44 commit a1107a0

32 files changed

+662
-403
lines changed

apps/cu/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ add_executable(srscu
1212
cu_appconfig_validator.cpp
1313
cu_appconfig_yaml_writer.cpp
1414
../gnb/gnb_appconfig_translators.cpp
15-
../gnb/adapters/e2_gateway_remote_connector.cpp # TODO: Delete
1615
)
1716

1817
install(TARGETS srscu

apps/cu/adapters/e2_gateways.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
*
3+
* Copyright 2021-2024 Software Radio Systems Limited
4+
*
5+
* By using this file, you agree to the terms and conditions set
6+
* forth in the LICENSE file which can be found at the top level of
7+
* the distribution.
8+
*
9+
*/
10+
11+
#pragma once
12+
13+
#include "apps/services/e2/e2_appconfig.h"
14+
#include "srsran/e2/gateways/e2_network_client_factory.h"
15+
16+
namespace srsran {
17+
18+
/// Instantiates an E2AP client.
19+
std::unique_ptr<e2_connection_client>
20+
create_cu_e2_client_gateway(const e2_appconfig& e2_cfg, io_broker& broker, dlt_pcap& f1ap_pcap)
21+
{
22+
sctp_network_connector_config e2ap_sctp{};
23+
e2ap_sctp.if_name = "E2AP";
24+
e2ap_sctp.dest_name = "Near-RT-RIC";
25+
e2ap_sctp.connect_address = e2_cfg.ip_addr;
26+
e2ap_sctp.connect_port = e2_cfg.port;
27+
e2ap_sctp.ppid = E2_CP_PPID;
28+
e2ap_sctp.bind_address = e2_cfg.bind_addr;
29+
return create_e2_gateway_client(e2_sctp_gateway_config{e2ap_sctp, broker, f1ap_pcap});
30+
}
31+
32+
} // namespace srsran

apps/cu/cu.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include "srsran/cu_up/cu_up.h"
4141

4242
// TODO remove apps/gnb/*.h
43-
#include "apps/gnb/adapters/e2_gateway_remote_connector.h"
43+
#include "apps/cu/adapters/e2_gateways.h"
4444
#include "apps/gnb/gnb_appconfig_translators.h"
4545

4646
#include "apps/services/application_message_banners.h"
@@ -308,18 +308,18 @@ int main(int argc, char** argv)
308308
// Create time source that ticks the timers
309309
io_timer_source time_source{app_timers, *epoll_broker, std::chrono::milliseconds{1}};
310310

311+
// Instantiate E2AP client gateway.
312+
std::unique_ptr<e2_connection_client> e2_gw_cu =
313+
create_cu_e2_client_gateway(cu_cfg.e2_cfg, *epoll_broker, *cu_cp_dlt_pcaps.e2ap);
314+
311315
// Create CU-CP config.
312316
cu_cp_build_dependencies cu_cp_dependencies;
313317
cu_cp_dependencies.cu_cp_executor = workers.cu_cp_exec;
314318
cu_cp_dependencies.cu_cp_e2_exec = workers.cu_cp_e2_exec;
315319
cu_cp_dependencies.timers = cu_timers;
316320
cu_cp_dependencies.ngap_pcap = cu_cp_dlt_pcaps.ngap.get();
317321
cu_cp_dependencies.broker = epoll_broker.get();
318-
// E2AP configuration.
319-
srsran::sctp_network_connector_config e2_cu_nw_config = generate_e2ap_nw_config(cu_cfg.e2_cfg, E2_CP_PPID);
320-
// Create E2AP GW remote connector.
321-
e2_gateway_remote_connector e2_gw_cu{*epoll_broker, e2_cu_nw_config, *cu_cp_dlt_pcaps.e2ap};
322-
cu_cp_dependencies.e2_gw = &e2_gw_cu;
322+
cu_cp_dependencies.e2_gw = e2_gw_cu.get();
323323
// create CU-CP.
324324
auto cu_cp_obj_and_cmds = cu_cp_app_unit->create_cu_cp(cu_cp_dependencies);
325325
srs_cu_cp::cu_cp& cu_cp_obj = *cu_cp_obj_and_cmds.unit;

apps/du/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ add_executable(srsdu
1212
du_appconfig_validators.cpp
1313
du_appconfig_translators.cpp
1414
du_appconfig_yaml_writer.cpp
15-
../gnb/adapters/e2_gateway_remote_connector.cpp # TODO: Delete
1615
)
1716

1817
install(TARGETS srsdu

apps/du/adapters/e2_gateways.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
*
3+
* Copyright 2021-2024 Software Radio Systems Limited
4+
*
5+
* By using this file, you agree to the terms and conditions set
6+
* forth in the LICENSE file which can be found at the top level of
7+
* the distribution.
8+
*
9+
*/
10+
11+
#pragma once
12+
13+
#include "apps/services/e2/e2_appconfig.h"
14+
#include "srsran/e2/gateways/e2_network_client_factory.h"
15+
16+
namespace srsran {
17+
18+
/// Instantiates an E2AP client.
19+
std::unique_ptr<e2_connection_client>
20+
create_du_e2_client_gateway(const e2_appconfig& e2_cfg, io_broker& broker, dlt_pcap& f1ap_pcap)
21+
{
22+
sctp_network_connector_config e2ap_sctp{};
23+
e2ap_sctp.if_name = "E2AP";
24+
e2ap_sctp.dest_name = "Near-RT-RIC";
25+
e2ap_sctp.connect_address = e2_cfg.ip_addr;
26+
e2ap_sctp.connect_port = e2_cfg.port;
27+
e2ap_sctp.ppid = E2_DU_PPID;
28+
e2ap_sctp.bind_address = e2_cfg.bind_addr;
29+
30+
return create_e2_gateway_client(e2_sctp_gateway_config{e2ap_sctp, broker, f1ap_pcap});
31+
}
32+
33+
} // namespace srsran

apps/du/du.cpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232
#include "apps/services/worker_manager.h"
3333
#include "apps/units/flexible_du/split_dynamic/dynamic_du_factory.h"
3434

35-
#include "apps/gnb/adapters/e2_gateway_remote_connector.h"
35+
#include "apps/du/adapters/e2_gateways.h"
3636
#include "apps/services/e2/e2_metric_connector_manager.h"
37+
#include "srsran/e2/gateways/e2_connection_client.h"
3738

3839
// Include ThreadSanitizer (TSAN) options if thread sanitization is enabled.
3940
// This include is not unused - it helps prevent false alarms from the thread sanitizer.
@@ -288,11 +289,9 @@ int main(int argc, char** argv)
288289
srslog::sink& json_sink =
289290
srslog::fetch_udp_sink(du_cfg.metrics_cfg.addr, du_cfg.metrics_cfg.port, srslog::create_json_formatter());
290291

291-
// E2AP configuration.
292-
srsran::sctp_network_connector_config e2_du_nw_config = generate_e2ap_nw_config(du_cfg.e2_cfg, E2_DU_PPID);
293-
294-
// Create E2AP GW remote connector.
295-
e2_gateway_remote_connector e2_gw{*epoll_broker, e2_du_nw_config, *du_pcaps.e2ap};
292+
// Instantiate E2AP client gateway.
293+
std::unique_ptr<e2_connection_client> e2_gw =
294+
create_du_e2_client_gateway(du_cfg.e2_cfg, *epoll_broker, *du_pcaps.e2ap);
296295

297296
app_services::metrics_notifier_proxy_impl metrics_notifier_forwarder;
298297
du_unit_dependencies du_dependencies;
@@ -302,7 +301,7 @@ int main(int argc, char** argv)
302301
du_dependencies.timer_mng = &app_timers;
303302
du_dependencies.mac_p = du_pcaps.mac.get();
304303
du_dependencies.rlc_p = du_pcaps.rlc.get();
305-
du_dependencies.e2_client_handler = &e2_gw;
304+
du_dependencies.e2_client_handler = e2_gw.get();
306305
du_dependencies.json_sink = &json_sink;
307306
du_dependencies.metrics_notifier = &metrics_notifier_forwarder;
308307

@@ -331,12 +330,6 @@ int main(int argc, char** argv)
331330
// Stop DU activity.
332331
du_inst.get_power_controller().stop();
333332

334-
if (du_cfg.e2_cfg.enable_du_e2) {
335-
du_logger.info("Closing E2 network connections...");
336-
e2_gw.close();
337-
du_logger.info("E2 Network connections closed successfully");
338-
}
339-
340333
du_logger.info("Closing PCAP files...");
341334
du_pcaps.close();
342335
du_logger.info("PCAP files successfully closed.");

apps/gnb/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ add_executable(gnb
1212
gnb_appconfig_validators.cpp
1313
gnb_appconfig_translators.cpp
1414
gnb_appconfig_yaml_writer.cpp
15-
adapters/e2_gateway_remote_connector.cpp
1615
)
1716

1817
install(TARGETS gnb

apps/gnb/adapters/e2_gateway_remote_connector.cpp

Lines changed: 0 additions & 66 deletions
This file was deleted.

apps/gnb/adapters/e2_gateway_remote_connector.h

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)