Skip to content

Commit 07c3d1a

Browse files
pgawlowiczcodebot
authored andcommitted
sctp: add connection name
1 parent 538475b commit 07c3d1a

File tree

6 files changed

+15
-1
lines changed

6 files changed

+15
-1
lines changed

apps/gnb/gnb.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ static void populate_cli11_generic_args(CLI::App& app)
8888
static void compute_derived_args(const gnb_appconfig& gnb_params)
8989
{
9090
/// Simply set the respective values in the appconfig.
91+
ngap_nw_config.connection_name = "AMF";
9192
ngap_nw_config.connect_address = gnb_params.amf_cfg.ip_addr;
9293
ngap_nw_config.connect_port = gnb_params.amf_cfg.port;
9394
ngap_nw_config.bind_address = gnb_params.amf_cfg.bind_addr;
@@ -110,6 +111,7 @@ static void compute_derived_args(const gnb_appconfig& gnb_params)
110111

111112
/// E2 interface - simply set the respective values in the appconfig.
112113
if (gnb_params.e2_cfg.enable_du_e2) {
114+
e2_nw_config.connection_name = "NearRT-RIC";
113115
e2_nw_config.connect_address = gnb_params.e2_cfg.ip_addr;
114116
e2_nw_config.connect_port = gnb_params.e2_cfg.port;
115117
e2_nw_config.bind_address = gnb_params.e2_cfg.bind_addr;

include/srsran/gateways/sctp_network_gateway.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ constexpr uint16_t NGAP_PPID = 60; // NGAP PPID, see TS 38.412, section 7.
2424

2525
/// \brief Configuration for SCTP network gateway
2626
struct sctp_network_gateway_config : common_network_gateway_config {
27+
std::string connection_name;
2728
std::string connect_address;
2829
int connect_port = 0;
2930
int ppid = 0; /// the Payload Protocol Identifier

lib/gateways/sctp_network_gateway_impl.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,10 @@ bool sctp_network_gateway_impl::create_and_connect()
248248
return false;
249249
}
250250

251-
fmt::print("Connecting to AMF on {}:{}\n", config.connect_address.c_str(), connect_port.c_str());
251+
fmt::print("Connecting to {} on {}:{}\n",
252+
config.connection_name.c_str(),
253+
config.connect_address.c_str(),
254+
connect_port.c_str());
252255
std::chrono::time_point<std::chrono::steady_clock> start = std::chrono::steady_clock::now();
253256
struct addrinfo* result;
254257
for (result = results; result != nullptr; result = result->ai_next) {

tests/integrationtests/e2ap/e2ap_integration_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class e2ap_integration_test : public ::testing::Test
9494
cfg.e2sm_kpm_enabled = true;
9595

9696
sctp_network_gateway_config nw_config;
97+
nw_config.connection_name = "NearRT-RIC";
9798
nw_config.connect_address = "127.0.0.1";
9899
nw_config.connect_port = 36421;
99100
nw_config.bind_address = "127.0.0.101";
@@ -168,6 +169,7 @@ class e2ap_gw_connector_integration_test : public ::testing::Test
168169
cfg.gnb_id = 123;
169170

170171
sctp_network_gateway_config nw_config;
172+
nw_config.connection_name = "NearRT-RIC";
171173
nw_config.connect_address = "127.0.0.1";
172174
nw_config.connect_port = 36421;
173175
nw_config.bind_address = "127.0.0.101";

tests/integrationtests/ngap/ngap_integration_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class ngap_integration_test : public ::testing::Test
9191
cfg.slice_configurations.push_back(slice_cfg);
9292

9393
sctp_network_gateway_config nw_config;
94+
nw_config.connection_name = "AMF";
9495
nw_config.connect_address = "10.12.1.105";
9596
nw_config.connect_port = 38412;
9697
nw_config.bind_address = "10.8.1.10";

tests/unittests/gateways/sctp_network_gateway_test.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ TEST_F(sctp_network_gateway_tester, when_socket_not_exists_then_connect_fails)
150150
ASSERT_FALSE(client_control_notifier.get_connection_dropped());
151151

152152
sctp_network_gateway_config config;
153+
config.connection_name = "TEST";
153154
config.connect_address = "127.0.0.1";
154155
config.connect_port = get_unused_sctp_port(config.connect_address);
155156
config.non_blocking_mode = true;
@@ -166,6 +167,7 @@ TEST_F(sctp_network_gateway_tester, when_v6_socket_not_exists_then_connect_fails
166167
ASSERT_FALSE(client_control_notifier.get_connection_dropped());
167168

168169
sctp_network_gateway_config config;
170+
config.connection_name = "TEST";
169171
config.connect_address = "::1";
170172
config.connect_port = get_unused_sctp_port(config.connect_address);
171173
config.non_blocking_mode = true;
@@ -186,6 +188,7 @@ TEST_F(sctp_network_gateway_tester, when_config_valid_then_trx_succeeds)
186188
ASSERT_NE(server_config.bind_port, 0);
187189

188190
sctp_network_gateway_config client_config;
191+
client_config.connection_name = "TEST";
189192
client_config.connect_address = server_config.bind_address;
190193
client_config.connect_port = server_config.bind_port;
191194
client_config.non_blocking_mode = true;
@@ -227,6 +230,7 @@ TEST_F(sctp_network_gateway_tester, when_v6_config_valid_then_trx_succeeds)
227230
ASSERT_NE(server_config.bind_port, 0);
228231

229232
sctp_network_gateway_config client_config;
233+
client_config.connection_name = "TEST";
230234
client_config.connect_address = server_config.bind_address;
231235
client_config.connect_port = server_config.bind_port;
232236
client_config.non_blocking_mode = true;
@@ -268,6 +272,7 @@ TEST_F(sctp_network_gateway_tester, when_hostname_resolved_then_trx_succeeds)
268272
ASSERT_NE(server_config.bind_port, 0);
269273

270274
sctp_network_gateway_config client_config;
275+
client_config.connection_name = "TEST";
271276
client_config.connect_address = server_config.bind_address;
272277
client_config.connect_port = server_config.bind_port;
273278
client_config.non_blocking_mode = true;

0 commit comments

Comments
 (0)