Skip to content

Commit dc7bc86

Browse files
FabianEckermannFabian Eckermann
authored andcommitted
cu_cp: add unit test for amf connection loss without connected dus
1 parent 6b15817 commit dc7bc86

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

lib/cu_cp/cu_cp_controller/amf_connection_manager.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ void amf_connection_manager::connect_to_amf(std::promise<bool>* completion_signa
5959
async_task<void> amf_connection_manager::disconnect_amf()
6060
{
6161
if (ngaps.get_ngaps().empty() or amfs_connected.empty()) {
62-
logger.error("No NGAP interface available to disconnect from AMF");
6362
return launch_async([](coro_context<async_task<void>>& ctx) {
6463
CORO_BEGIN(ctx);
6564
CORO_RETURN();

tests/unittests/cu_cp/cu_cp_connectivity_test.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,18 @@ TEST_F(cu_cp_connectivity_test, when_ng_setup_fails_then_cu_cp_is_not_in_amf_con
8080
ASSERT_FALSE(get_cu_cp().get_ng_handler().amfs_are_connected());
8181
}
8282

83+
TEST_F(cu_cp_connectivity_test, when_amf_connection_is_lost_and_no_dus_are_connected_then_no_amfs_are_connected)
84+
{
85+
// Run NG setup to completion.
86+
run_ng_setup();
87+
88+
// Drop AMF connection.
89+
ASSERT_TRUE(drop_amf_connection(0));
90+
91+
// Check that CU-CP is still running but not connected to AMF.
92+
ASSERT_FALSE(this->get_cu_cp().get_ng_handler().amfs_are_connected());
93+
}
94+
8395
TEST_F(cu_cp_connectivity_test, when_amf_connection_is_lost_then_connected_ues_are_released_and_new_ues_are_rejected)
8496
{
8597
// Run NG setup to completion.

tests/unittests/cu_cp/cu_cp_test_environment.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ bool cu_cp_test_environment::drop_amf_connection(unsigned amf_idx)
333333
return false;
334334
}
335335
it->second.amf_stub->drop_connection();
336+
// Wait for the CU-CP to process the disconnection.
337+
cu_cp_workers->wait_pending_tasks();
336338
return true;
337339
}
338340

0 commit comments

Comments
 (0)