diff --git a/srsgnb/src/stack/rrc/test/rrc_nr_test.cc b/srsgnb/src/stack/rrc/test/rrc_nr_test.cc index 1d07ab06b..4308a9faf 100644 --- a/srsgnb/src/stack/rrc/test/rrc_nr_test.cc +++ b/srsgnb/src/stack/rrc/test/rrc_nr_test.cc @@ -133,7 +133,7 @@ void test_rrc_sa_connection() mac_nr_dummy mac_obj; rlc_nr_rrc_tester rlc_obj; pdcp_nr_rrc_tester pdcp_obj; - ngap_dummy ngap_obj; + ngap_rrc_tester ngap_obj; rrc_nr rrc_obj(&task_sched); @@ -158,7 +158,8 @@ void test_rrc_sa_connection() uecfg.phy_cfg.pdcch.search_space_present[2] = false; TESTASSERT_SUCCESS(rrc_obj.add_user(0x4601, uecfg)); - test_rrc_nr_connection_establishment(task_sched, rrc_obj, rlc_obj, mac_obj, 0x4601); + + test_rrc_nr_connection_establishment(task_sched, rrc_obj, rlc_obj, mac_obj, ngap_obj,0x4601); test_rrc_nr_security_mode_cmd(task_sched, rrc_obj, pdcp_obj, 0x4601); } diff --git a/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.cc b/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.cc index 6ac574d87..68da890e1 100644 --- a/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.cc +++ b/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.cc @@ -10,8 +10,11 @@ * */ +#define DED_NAS_MSG_STRING "7E01280E534C337E004109000BF200F110800101347B80802E02F07071002D7E004109000BF200F110800101347B80801001002E02F0702F0201015200F11000006418010174000090530101" + #include "rrc_nr_test_helpers.h" #include "srsran/common/test_common.h" +#include using namespace asn1::rrc_nr; @@ -21,6 +24,7 @@ void test_rrc_nr_connection_establishment(srsran::task_scheduler& task_sched, rrc_nr& rrc_obj, rlc_nr_rrc_tester& rlc, mac_nr_dummy& mac, + ngap_rrc_tester& ngap, uint16_t rnti) { srsran::unique_byte_buffer_t pdu; @@ -96,8 +100,7 @@ void test_rrc_nr_connection_establishment(srsran::task_scheduler& task_sched, complete_ies.registered_amf.amf_id.from_number(0x800101); complete_ies.guami_type_present = true; complete_ies.guami_type.value = rrc_setup_complete_ies_s::guami_type_opts::native; - complete_ies.ded_nas_msg.from_string("7E01280E534C337E004109000BF200F110800101347B80802E02F07071002D7E004109000BF200F" - "110800101347B80801001002E02F0702F0201015200F11000006418010174000090530101"); + auto& ded_nas_msg = complete_ies.ded_nas_msg.from_string(DED_NAS_MSG_STRING); { pdu = srsran::make_byte_buffer(); @@ -118,6 +121,14 @@ void test_rrc_nr_connection_establishment(srsran::task_scheduler& task_sched, } } TESTASSERT(ss_ue_found); /// Ensure UE-specific SearchSpace was added + + // Check here if the MSG sent to NGAP is correct + // Create a srsran::span object for the expected MSG + asn1::unbounded_octstring expected; + expected.from_string(DED_NAS_MSG_STRING); + srsran::span expected_span{expected}; + TESTASSERT(expected_span == ngap.last_pdu); + } void test_rrc_nr_security_mode_cmd(srsran::task_scheduler& task_sched, diff --git a/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.h b/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.h index d893068d3..534552821 100644 --- a/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.h +++ b/srsgnb/src/stack/rrc/test/rrc_nr_test_helpers.h @@ -49,6 +49,23 @@ public: srsran::unique_byte_buffer_t last_sdu; }; +class ngap_rrc_tester : public ngap_dummy +{ +public: + void initial_ue(uint16_t rnti, + uint32_t gnb_cc_idx, + asn1::ngap_nr::rrcestablishment_cause_e cause, + srsran::const_byte_span pdu, + uint32_t s_tmsi) + { + last_sdu_rnti = rnti; + last_pdu = pdu; + } + + uint16_t last_sdu_rnti; + srsran::const_byte_span last_pdu; +}; + /** * Run TS 38.331, 5.3.3 "RRC connection establishment" to completion * RRC actions: @@ -64,6 +81,7 @@ void test_rrc_nr_connection_establishment(srsran::task_scheduler& task_sched, rrc_nr& rrc_obj, rlc_nr_rrc_tester& rlc, mac_nr_dummy& mac, + ngap_rrc_tester& ngap, uint16_t rnti); void test_rrc_nr_security_mode_cmd(srsran::task_scheduler& task_sched,