rrc-nr,test: add test for initial_ue msg sent to ngap

Signed-off-by: Carlo Galiotto <carlo@srs.io>
master
Carlo Galiotto 3 years ago committed by Andre Puschmann
parent 3e61448a41
commit 1417331edb

@ -133,7 +133,7 @@ void test_rrc_sa_connection()
mac_nr_dummy mac_obj; mac_nr_dummy mac_obj;
rlc_nr_rrc_tester rlc_obj; rlc_nr_rrc_tester rlc_obj;
pdcp_nr_rrc_tester pdcp_obj; pdcp_nr_rrc_tester pdcp_obj;
ngap_dummy ngap_obj; ngap_rrc_tester ngap_obj;
rrc_nr rrc_obj(&task_sched); rrc_nr rrc_obj(&task_sched);
@ -158,7 +158,8 @@ void test_rrc_sa_connection()
uecfg.phy_cfg.pdcch.search_space_present[2] = false; uecfg.phy_cfg.pdcch.search_space_present[2] = false;
TESTASSERT_SUCCESS(rrc_obj.add_user(0x4601, uecfg)); 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); test_rrc_nr_security_mode_cmd(task_sched, rrc_obj, pdcp_obj, 0x4601);
} }

@ -10,8 +10,11 @@
* *
*/ */
#define DED_NAS_MSG_STRING "7E01280E534C337E004109000BF200F110800101347B80802E02F07071002D7E004109000BF200F110800101347B80801001002E02F0702F0201015200F11000006418010174000090530101"
#include "rrc_nr_test_helpers.h" #include "rrc_nr_test_helpers.h"
#include "srsran/common/test_common.h" #include "srsran/common/test_common.h"
#include <string>
using namespace asn1::rrc_nr; using namespace asn1::rrc_nr;
@ -21,6 +24,7 @@ void test_rrc_nr_connection_establishment(srsran::task_scheduler& task_sched,
rrc_nr& rrc_obj, rrc_nr& rrc_obj,
rlc_nr_rrc_tester& rlc, rlc_nr_rrc_tester& rlc,
mac_nr_dummy& mac, mac_nr_dummy& mac,
ngap_rrc_tester& ngap,
uint16_t rnti) uint16_t rnti)
{ {
srsran::unique_byte_buffer_t pdu; 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.registered_amf.amf_id.from_number(0x800101);
complete_ies.guami_type_present = true; complete_ies.guami_type_present = true;
complete_ies.guami_type.value = rrc_setup_complete_ies_s::guami_type_opts::native; complete_ies.guami_type.value = rrc_setup_complete_ies_s::guami_type_opts::native;
complete_ies.ded_nas_msg.from_string("7E01280E534C337E004109000BF200F110800101347B80802E02F07071002D7E004109000BF200F" auto& ded_nas_msg = complete_ies.ded_nas_msg.from_string(DED_NAS_MSG_STRING);
"110800101347B80801001002E02F0702F0201015200F11000006418010174000090530101");
{ {
pdu = srsran::make_byte_buffer(); 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 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<false> expected;
expected.from_string(DED_NAS_MSG_STRING);
srsran::span<const uint8_t> expected_span{expected};
TESTASSERT(expected_span == ngap.last_pdu);
} }
void test_rrc_nr_security_mode_cmd(srsran::task_scheduler& task_sched, void test_rrc_nr_security_mode_cmd(srsran::task_scheduler& task_sched,

@ -49,6 +49,23 @@ public:
srsran::unique_byte_buffer_t last_sdu; 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 * Run TS 38.331, 5.3.3 "RRC connection establishment" to completion
* RRC actions: * RRC actions:
@ -64,6 +81,7 @@ void test_rrc_nr_connection_establishment(srsran::task_scheduler& task_sched,
rrc_nr& rrc_obj, rrc_nr& rrc_obj,
rlc_nr_rrc_tester& rlc, rlc_nr_rrc_tester& rlc,
mac_nr_dummy& mac, mac_nr_dummy& mac,
ngap_rrc_tester& ngap,
uint16_t rnti); uint16_t rnti);
void test_rrc_nr_security_mode_cmd(srsran::task_scheduler& task_sched, void test_rrc_nr_security_mode_cmd(srsran::task_scheduler& task_sched,

Loading…
Cancel
Save