Skip to content

Commit 6663e05

Browse files
frankistcodebot
authored andcommitted
e1ap: fix names of e1 gateways
1 parent 1f87bf8 commit 6663e05

File tree

8 files changed

+48
-42
lines changed

8 files changed

+48
-42
lines changed

include/srsran/e1ap/gateways/e1_local_connector_factory.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ struct e1_local_sctp_connector_config {
3535
dlt_pcap& pcap;
3636
/// IO broker to handle the SCTP Rx data and notifications.
3737
io_broker& broker;
38+
/// Port to bind the SCTP socket.
39+
int bind_port = 0;
3840
};
3941

4042
/// Creates an E1 local connector using an SCTP socket as channel.

include/srsran/e1ap/gateways/e1_network_client_factory.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ namespace srsran {
1818
class dlt_pcap;
1919
class io_broker;
2020

21-
struct e1_du_sctp_gateway_config {
21+
/// Configuration of an SCTP-based E1 Gateway in the CU-UP.
22+
struct e1_cu_up_sctp_gateway_config {
2223
/// SCTP configuration.
2324
sctp_network_connector_config sctp;
2425
/// IO broker responsible for handling SCTP Rx data and notifications.
@@ -28,6 +29,6 @@ struct e1_du_sctp_gateway_config {
2829
};
2930

3031
/// \brief Create an E1 gateway connector that the CU-UP can use to connect to the CU-CP.
31-
std::unique_ptr<srs_cu_up::e1_connection_client> create_e1_gateway_client(const e1_du_sctp_gateway_config& params);
32+
std::unique_ptr<srs_cu_up::e1_connection_client> create_e1_gateway_client(const e1_cu_up_sctp_gateway_config& params);
3233

3334
} // namespace srsran

include/srsran/e1ap/gateways/e1_network_server_factory.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ namespace srsran {
1919
class dlt_pcap;
2020
class io_broker;
2121

22-
/// Configuration of an SCTP-based E1 Gateway.
23-
struct e1_cu_sctp_gateway_config {
22+
/// Configuration of an SCTP-based E1 Gateway in the CU-CP.
23+
struct e1_cu_cp_sctp_gateway_config {
2424
/// SCTP configuration.
2525
sctp_network_gateway_config sctp;
2626
/// IO broker responsible for handling SCTP Rx data and notifications.
@@ -31,6 +31,6 @@ struct e1_cu_sctp_gateway_config {
3131

3232
/// Creates an E1 Gateway server that listens for incoming SCTP connections, packs/unpacks E1AP PDUs and forwards
3333
/// them to the GW/CU-CP E1AP handler.
34-
std::unique_ptr<srs_cu_cp::e1_connection_server> create_e1_gateway_server(const e1_cu_sctp_gateway_config& params);
34+
std::unique_ptr<srs_cu_cp::e1_connection_server> create_e1_gateway_server(const e1_cu_cp_sctp_gateway_config& params);
3535

3636
} // namespace srsran

lib/cu_cp/cu_up_processor/cu_up_processor_repository.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,12 @@ async_task<void> cu_up_processor_repository::remove_cu_up(cu_up_index_t cu_up_in
8888

8989
// Stop CU-UP activity, eliminating pending transactions for the CU-UP and respective UEs.
9090
// TODO
91+
92+
// Remove CU-UP
9193
removed_cu_up_db.insert(std::make_pair(cu_up_index, std::move(cu_up_db.at(cu_up_index))));
9294
cu_up_db.erase(cu_up_index);
9395

94-
// Remove DU
96+
// Remove CU-UP
9597
logger.info("Removed CU-UP {}", cu_up_index);
9698

9799
CORO_RETURN();

lib/e1ap/gateways/e1_local_connector_factory.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class e1_local_connector_impl final : public e1_local_connector
6666
{
6767
report_fatal_error_if_not(cu_cp_e1_mng != nullptr, "CU-CP has not been attached to E1 gateway.");
6868

69-
// Decorate DU RX notifier with pcap writing.
69+
// Decorate CU-UP RX notifier with pcap writing.
7070
if (pcap_writer.is_write_enabled()) {
7171
cu_up_notifier = std::make_unique<e1ap_pdu_pcap_notifier>(
7272
std::move(cu_up_notifier), pcap_writer, srslog::fetch_basic_logger("CU-UP-E1"));
@@ -89,7 +89,7 @@ class e1_local_connector_impl final : public e1_local_connector
8989
srs_cu_cp::cu_cp_e1_handler* cu_cp_e1_mng = nullptr;
9090
};
9191

92-
/// Implementation of a CU-UP and CU-CP E1 SCTP-based gateway for the case that the DU and CU-CP are co-located.
92+
/// Implementation of a CU-UP and CU-CP E1 SCTP-based gateway for the case that the CU-UP and CU-CP are co-located.
9393
///
9494
/// Note: This class should only be used for testing purposes.
9595
class e1_sctp_connector_impl final : public e1_local_connector
@@ -103,8 +103,8 @@ class e1_sctp_connector_impl final : public e1_local_connector
103103
sctp.ppid = E1AP_PPID;
104104
sctp.bind_address = "127.0.0.1";
105105
// Use any bind port available.
106-
sctp.bind_port = 0;
107-
server = create_e1_gateway_server(e1_cu_sctp_gateway_config{sctp, broker, pcap_writer});
106+
sctp.bind_port = cfg.bind_port;
107+
server = create_e1_gateway_server(e1_cu_cp_sctp_gateway_config{sctp, broker, pcap_writer});
108108
}
109109

110110
void attach_cu_cp(srs_cu_cp::cu_cp_e1_handler& cu_e1_handler_) override
@@ -119,7 +119,7 @@ class e1_sctp_connector_impl final : public e1_local_connector
119119
sctp_client.connect_port = server->get_listen_port().value();
120120
sctp_client.ppid = E1AP_PPID;
121121
// Note: We only need to save the PCAPs in one side of the connection.
122-
client = create_e1_gateway_client(e1_du_sctp_gateway_config{sctp_client, broker, *null_pcap_writer});
122+
client = create_e1_gateway_client(e1_cu_up_sctp_gateway_config{sctp_client, broker, *null_pcap_writer});
123123
}
124124

125125
std::optional<uint16_t> get_listen_port() const override { return server->get_listen_port(); }

lib/e1ap/gateways/e1_network_client_factory.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ namespace {
2424
class sctp_to_e1_pdu_notifier final : public sctp_association_sdu_notifier
2525
{
2626
public:
27-
sctp_to_e1_pdu_notifier(std::unique_ptr<e1ap_message_notifier> du_rx_pdu_notifier_,
27+
sctp_to_e1_pdu_notifier(std::unique_ptr<e1ap_message_notifier> cu_up_rx_pdu_notifier_,
2828
dlt_pcap& pcap_writer_,
2929
srslog::basic_logger& logger_) :
30-
du_rx_pdu_notifier(std::move(du_rx_pdu_notifier_)), pcap_writer(pcap_writer_), logger(logger_)
30+
cu_up_rx_pdu_notifier(std::move(cu_up_rx_pdu_notifier_)), pcap_writer(pcap_writer_), logger(logger_)
3131
{
3232
}
3333

@@ -47,13 +47,13 @@ class sctp_to_e1_pdu_notifier final : public sctp_association_sdu_notifier
4747
}
4848

4949
// Forward unpacked Rx PDU to the CU-UP.
50-
du_rx_pdu_notifier->on_new_message(msg);
50+
cu_up_rx_pdu_notifier->on_new_message(msg);
5151

5252
return true;
5353
}
5454

5555
private:
56-
std::unique_ptr<e1ap_message_notifier> du_rx_pdu_notifier;
56+
std::unique_ptr<e1ap_message_notifier> cu_up_rx_pdu_notifier;
5757
dlt_pcap& pcap_writer;
5858
srslog::basic_logger& logger;
5959
};
@@ -98,7 +98,7 @@ class e1_to_sctp_pdu_notifier final : public e1ap_message_notifier
9898
class e1_sctp_gateway_client final : public srs_cu_up::e1_connection_client
9999
{
100100
public:
101-
e1_sctp_gateway_client(const e1_du_sctp_gateway_config& params) :
101+
e1_sctp_gateway_client(const e1_cu_up_sctp_gateway_config& params) :
102102
pcap_writer(params.pcap), broker(params.broker), sctp_params(params.sctp)
103103
{
104104
// Create SCTP network adapter.
@@ -152,7 +152,7 @@ class e1_sctp_gateway_client final : public srs_cu_up::e1_connection_client
152152
} // namespace
153153

154154
std::unique_ptr<srs_cu_up::e1_connection_client>
155-
srsran::create_e1_gateway_client(const e1_du_sctp_gateway_config& params)
155+
srsran::create_e1_gateway_client(const e1_cu_up_sctp_gateway_config& params)
156156
{
157157
return std::make_unique<e1_sctp_gateway_client>(params);
158158
}

lib/e1ap/gateways/e1_network_server_factory.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class gw_to_e1_pdu_notifier final : public sctp_association_sdu_notifier
9898
class e1_sctp_server final : public srs_cu_cp::e1_connection_server, public sctp_network_association_factory
9999
{
100100
public:
101-
e1_sctp_server(const e1_cu_sctp_gateway_config& params_) : params(params_)
101+
e1_sctp_server(const e1_cu_cp_sctp_gateway_config& params_) : params(params_)
102102
{
103103
// Create SCTP server.
104104
sctp_server = create_sctp_network_server(sctp_network_server_config{params.sctp, params.broker, *this});
@@ -138,16 +138,17 @@ class e1_sctp_server final : public srs_cu_cp::e1_connection_server, public sctp
138138
}
139139

140140
private:
141-
const e1_cu_sctp_gateway_config params;
142-
srslog::basic_logger& logger = srslog::fetch_basic_logger("CU-CP-E1");
143-
srs_cu_cp::cu_cp_e1_handler* cu_e1_handler = nullptr;
141+
const e1_cu_cp_sctp_gateway_config params;
142+
srslog::basic_logger& logger = srslog::fetch_basic_logger("CU-CP-E1");
143+
srs_cu_cp::cu_cp_e1_handler* cu_e1_handler = nullptr;
144144

145145
std::unique_ptr<sctp_network_server> sctp_server;
146146
};
147147

148148
} // namespace
149149

150-
std::unique_ptr<srs_cu_cp::e1_connection_server> srsran::create_e1_gateway_server(const e1_cu_sctp_gateway_config& cfg)
150+
std::unique_ptr<srs_cu_cp::e1_connection_server>
151+
srsran::create_e1_gateway_server(const e1_cu_cp_sctp_gateway_config& cfg)
151152
{
152153
return std::make_unique<e1_sctp_server>(cfg);
153154
}

tests/unittests/e1ap/gateways/e1_gateway_test.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class e1_link : public srs_cu_cp::cu_cp_e1_handler
8383
// Note: May be called from io broker thread.
8484
cu_cp_tx_pdu_notifier = std::move(e1ap_tx_pdu_notifier);
8585
std::promise<void> eof_signal;
86-
cu_gw_assoc_close_signaled = eof_signal.get_future();
86+
cu_cp_gw_assoc_close_signaled = eof_signal.get_future();
8787

8888
logger.info("CU-CP handled new DU connection");
8989
connection_complete_signal.set_value();
@@ -97,21 +97,21 @@ class e1_link : public srs_cu_cp::cu_cp_e1_handler
9797
srslog::basic_logger& logger = srslog::fetch_basic_logger("TEST");
9898

9999
blocking_queue<e1ap_message> cu_rx_pdus{128};
100-
blocking_queue<e1ap_message> du_rx_pdus{128};
100+
blocking_queue<e1ap_message> cu_up_rx_pdus{128};
101101

102-
std::future<void> cu_gw_assoc_close_signaled;
103-
std::future<void> du_gw_assoc_close_signaled;
102+
std::future<void> cu_cp_gw_assoc_close_signaled;
103+
std::future<void> cu_up_gw_assoc_close_signaled;
104104
std::unique_ptr<e1ap_message_notifier> cu_cp_tx_pdu_notifier;
105-
std::unique_ptr<e1ap_message_notifier> du_tx_pdu_notifier;
105+
std::unique_ptr<e1ap_message_notifier> cu_up_tx_pdu_notifier;
106106

107107
protected:
108108
void connect_client()
109109
{
110110
// Connect client to server.
111111
std::promise<void> eof_signal;
112-
du_gw_assoc_close_signaled = eof_signal.get_future();
113-
du_tx_pdu_notifier = connector->handle_cu_up_connection_request(
114-
std::make_unique<rx_pdu_notifier>("CU-UP", du_rx_pdus, std::move(eof_signal)));
112+
cu_up_gw_assoc_close_signaled = eof_signal.get_future();
113+
cu_up_tx_pdu_notifier = connector->handle_cu_up_connection_request(
114+
std::make_unique<rx_pdu_notifier>("CU-UP", cu_up_rx_pdus, std::move(eof_signal)));
115115

116116
// Wait for server to receive connection.
117117
std::future<void> connection_completed = connection_complete_signal.get_future();
@@ -143,7 +143,7 @@ class e1_gateway_link_test : public ::testing::TestWithParam<bool>
143143

144144
void send_to_cu_up(const e1ap_message& msg) { link->cu_cp_tx_pdu_notifier->on_new_message(msg); }
145145

146-
void send_to_cu_cp(const e1ap_message& msg) { link->du_tx_pdu_notifier->on_new_message(msg); }
146+
void send_to_cu_cp(const e1ap_message& msg) { link->cu_up_tx_pdu_notifier->on_new_message(msg); }
147147

148148
bool pop_cu_rx_pdu(e1ap_message& msg)
149149
{
@@ -152,10 +152,10 @@ class e1_gateway_link_test : public ::testing::TestWithParam<bool>
152152
return res;
153153
}
154154

155-
bool pop_du_rx_pdu(e1ap_message& msg)
155+
bool pop_cu_up_rx_pdu(e1ap_message& msg)
156156
{
157157
bool res;
158-
msg = link->du_rx_pdus.pop_blocking(&res);
158+
msg = link->cu_up_rx_pdus.pop_blocking(&res);
159159
return res;
160160
}
161161

@@ -190,7 +190,7 @@ static bool is_equal(const e1ap_message& lhs, const e1ap_message& rhs)
190190
return lhs_pdu == rhs_pdu;
191191
}
192192

193-
TEST_P(e1_gateway_link_test, when_du_sends_msg_then_cu_receives_msg)
193+
TEST_P(e1_gateway_link_test, when_cu_up_sends_msg_then_cu_receives_msg)
194194
{
195195
create_link();
196196

@@ -202,15 +202,15 @@ TEST_P(e1_gateway_link_test, when_du_sends_msg_then_cu_receives_msg)
202202
ASSERT_TRUE(is_equal(orig_msg, dest_msg));
203203
}
204204

205-
TEST_P(e1_gateway_link_test, when_cu_sends_msg_then_du_receives_msg)
205+
TEST_P(e1_gateway_link_test, when_cu_cp_sends_msg_then_cu_up_receives_msg)
206206
{
207207
create_link();
208208

209209
e1ap_message orig_msg = create_test_message();
210210
send_to_cu_up(orig_msg);
211211

212212
e1ap_message dest_msg;
213-
ASSERT_TRUE(pop_du_rx_pdu(dest_msg));
213+
ASSERT_TRUE(pop_cu_up_rx_pdu(dest_msg));
214214
ASSERT_TRUE(is_equal(orig_msg, dest_msg));
215215
}
216216

@@ -221,7 +221,7 @@ TEST_P(e1_gateway_link_test, when_pcap_writer_disabled_then_no_pcap_is_written)
221221
e1ap_message orig_msg = create_test_message();
222222
send_to_cu_up(orig_msg);
223223
e1ap_message dest_msg;
224-
ASSERT_TRUE(pop_du_rx_pdu(dest_msg));
224+
ASSERT_TRUE(pop_cu_up_rx_pdu(dest_msg));
225225
byte_buffer sdu;
226226
ASSERT_FALSE(link->pcap.last_sdus.try_pop(sdu));
227227

@@ -238,7 +238,7 @@ TEST_P(e1_gateway_link_test, when_pcap_writer_enabled_then_pcap_is_written)
238238

239239
send_to_cu_up(orig_msg);
240240
e1ap_message dest_msg;
241-
ASSERT_TRUE(pop_du_rx_pdu(dest_msg));
241+
ASSERT_TRUE(pop_cu_up_rx_pdu(dest_msg));
242242
bool popped = false;
243243
byte_buffer sdu = link->pcap.last_sdus.pop_blocking(&popped);
244244
ASSERT_TRUE(popped);
@@ -260,8 +260,8 @@ TEST_P(e1_gateway_link_test, when_cu_tx_pdu_notifier_is_closed_then_connection_c
260260
logger.info("Closing CU-CP Tx path...");
261261
link->cu_cp_tx_pdu_notifier.reset();
262262

263-
// Wait for GW to report to DU that the association is closed.
264-
link->du_gw_assoc_close_signaled.wait();
263+
// Wait for GW to report to CU-UP that the association is closed.
264+
link->cu_up_gw_assoc_close_signaled.wait();
265265
}
266266

267267
TEST_P(e1_gateway_link_test, when_cu_up_tx_pdu_notifier_is_closed_then_connection_closes)
@@ -270,10 +270,10 @@ TEST_P(e1_gateway_link_test, when_cu_up_tx_pdu_notifier_is_closed_then_connectio
270270

271271
// The CU-UP resets its E1 Tx notifier.
272272
logger.info("Closing CU-UP Tx path...");
273-
link->du_tx_pdu_notifier.reset();
273+
link->cu_up_tx_pdu_notifier.reset();
274274

275275
// Wait for GW to report to CU that the association is closed.
276-
link->cu_gw_assoc_close_signaled.wait();
276+
link->cu_cp_gw_assoc_close_signaled.wait();
277277
}
278278

279279
INSTANTIATE_TEST_SUITE_P(e1_gateway_link_tests, e1_gateway_link_test, ::testing::Values(true, false));

0 commit comments

Comments
 (0)