Skip to content

Commit b8ddb8e

Browse files
alvasMancodebot
authored andcommitted
du,f1u: add methods to F1-U DU gateway to obtain bind address
1 parent a6e2a2e commit b8ddb8e

File tree

9 files changed

+34
-0
lines changed

9 files changed

+34
-0
lines changed

include/srsran/f1u/du/f1u_gateway.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ class f1u_du_gateway : public srs_du::f1u_bearer_disconnector
5656
srs_du::f1u_du_gateway_bearer_rx_notifier& du_rx,
5757
timer_factory timers,
5858
task_executor& ue_executor) = 0;
59+
60+
virtual expected<std::string> get_du_bind_address(uint32_t du_index) = 0;
5961
};
6062

6163
} // namespace srsran::srs_du

include/srsran/f1u/du/split_connector/f1u_split_connector.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ class f1u_split_connector final : public f1u_du_gateway
197197

198198
void remove_du_bearer(const up_transport_layer_info& dl_up_tnl_info) override;
199199

200+
expected<std::string> get_du_bind_address(uint32_t du_index) override;
201+
200202
private:
201203
srslog::basic_logger& logger_du;
202204
// Key is the UL UP TNL Info (CU-CP address and UL TEID reserved by CU-CP)

include/srsran/f1u/local_connector/f1u_local_connector.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ class f1u_local_connector final : public srs_du::f1u_du_gateway, public f1u_cu_u
199199

200200
void remove_du_bearer(const up_transport_layer_info& dl_up_tnl_info) override;
201201

202+
expected<std::string> get_du_bind_address(uint32_t du_index) override
203+
{
204+
return fmt::format("127.0.0.{}", 1 + du_index);
205+
}
206+
202207
private:
203208
srslog::basic_logger& logger_cu;
204209
srslog::basic_logger& logger_du;

include/srsran/gtpu/ngu_gateway.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ class ngu_tnl_pdu_session : public udp_network_gateway_data_handler, public netw
3131
public:
3232
~ngu_tnl_pdu_session() override = default;
3333

34+
/// \brief Get the address to which the socket is bound.
35+
///
36+
/// In case the gateway was configured to use a hostname,
37+
/// this function can be used to get the actual IP address in string form.
38+
virtual bool get_bind_address(std::string& ip_address) = 0;
39+
3440
/// Get bind port currently being used by the NG-U TNL session for the reception of PDUs.
3541
/// \return If a UDP link is being used, returns the respective bind port. If the connection is local, it returns
3642
/// std::nullopt.

lib/f1u/du/split_connector/f1u_split_connector.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,12 @@ void f1u_split_connector::remove_du_bearer(const up_transport_layer_info& dl_up_
7474
}
7575
logger_du.debug("Removed CU F1-U bearer with UL GTP Tunnel={}.", dl_up_tnl_info);
7676
}
77+
78+
expected<std::string> f1u_split_connector::get_du_bind_address(uint32_t du_index)
79+
{
80+
std::string ip_address;
81+
if (not udp_session->get_bind_address(ip_address)) {
82+
return default_error_t{};
83+
}
84+
return ip_address;
85+
}

lib/gtpu/ngu_gateway.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ class udp_ngu_tnl_session final : public ngu_tnl_pdu_session
6868
data_notifier.on_new_pdu(std::move(pdu), src_addr);
6969
}
7070

71+
bool get_bind_address(std::string& ip_address) override { return udp_gw->get_bind_address(ip_address); }
72+
7173
std::optional<uint16_t> get_bind_port() override { return udp_gw->get_bind_port(); }
7274

7375
private:
@@ -125,6 +127,8 @@ class no_core_ngu_tnl_pdu_session final : public ngu_tnl_pdu_session
125127
}
126128

127129
std::optional<uint16_t> get_bind_port() override { return std::nullopt; }
130+
131+
bool get_bind_address(std::string& ip_address) override { return false; }
128132
};
129133

130134
/// Implementation of the NG-U gateway for the case a local UPF stub is used.

tests/benchmarks/du_high/du_high_benchmark.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ class cu_up_simulator : public f1u_du_gateway
339339
}
340340

341341
void remove_du_bearer(const up_transport_layer_info& dl_tnl) override {}
342+
343+
expected<std::string> get_du_bind_address(uint32_t du_index) override { return std::string("127.0.0.1"); }
342344
};
343345

344346
/// \brief Instantiation of the DU-high workers and executors for the benchmark.

tests/test_doubles/f1u/dummy_f1u_du_gateway.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ class cu_up_simulator : public f1u_du_gateway
6868
}
6969
}
7070
}
71+
72+
expected<std::string> get_du_bind_address(uint32_t du_index) override { return std::string("127.0.0.1"); }
7173
};
7274

7375
} // namespace srs_du

tests/unittests/du_manager/du_manager_test_helpers.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ class f1u_gateway_dummy : public f1u_du_gateway
196196
f1u_bearers.erase(bearer_it);
197197
}
198198

199+
expected<std::string> get_du_bind_address(uint32_t du_index) override { return std::string("127.0.0.1"); }
200+
199201
std::map<up_transport_layer_info, std::map<up_transport_layer_info, f1u_gw_bearer_dummy*>> f1u_bearers;
200202
};
201203

0 commit comments

Comments
 (0)