rrc-nr,test: add fnc to trigger send_security_cmd

The SecurityModeCommand procedure was previously initiated by the
RRCSetupComplete msg. However, it should be trigger by the NGAP
through the InitialContextSetupRequest msg.
This commit implements this change and fills in the function of
the NGAP interface that starts the SecurityModeCommand procedure

Signed-off-by: Carlo Galiotto <carlo@srs.io>
This commit is contained in:
Carlo Galiotto 2021-11-16 17:38:24 +01:00 committed by Francisco Paisana
parent 1679df928b
commit aa979708a0
3 changed files with 12 additions and 3 deletions

View File

@ -74,6 +74,9 @@ public:
// NGAP interface
void establish_eps_bearer(uint32_t pdu_session_id, srsran::const_byte_span nas_pdu, uint32_t lcid);
/* TS 38.331 - 5.3.4 Initial AS security activation */
void send_security_mode_command();
private:
int send_dl_ccch(const asn1::rrc_nr::dl_ccch_msg_s& dl_ccch_msg);
int send_dl_dcch(srsran::nr_srb srb, const asn1::rrc_nr::dl_dcch_msg_s& dl_dcch_msg);
@ -82,9 +85,6 @@ private:
void send_rrc_setup();
void send_rrc_reject(uint8_t reject_wait_time_secs);
/* TS 38.331 - 5.3.4 Initial AS security activation */
void send_security_mode_command();
/* TS 38.331 - 5.3.5 RRC reconfiguration */
void send_rrc_reconfiguration();

View File

@ -557,6 +557,12 @@ int rrc_nr::ue_set_security_cfg_capabilities(uint16_t rnti, const asn1::ngap_nr:
}
int rrc_nr::start_security_mode_procedure(uint16_t rnti)
{
auto user_it = users.find(rnti);
if (user_it == users.end()){
logger.error("Starting SecurityModeCommand procedure failed - rnti=0x%x not found", rnti);
return SRSRAN_ERROR;
}
user_it->second->send_security_mode_command();
return SRSRAN_SUCCESS;
}
int rrc_nr::establish_rrc_bearer(uint16_t rnti, uint16_t pdu_session_id, srsran::const_byte_span nas_pdu, uint32_t lcid)

View File

@ -94,6 +94,9 @@ void test_rrc_nr_security_mode_cmd(srsran::task_scheduler& task_sched,
{
srsran::unique_byte_buffer_t pdu;
// Trigger Send SecurityCommand (simulate request from NGAP)
rrc_obj.start_security_mode_procedure(rnti);
// Test whether there exists the SRB1 initiated in the Connection Establishment
// We test this as the SRB1 was setup in a different function
TESTASSERT_EQ(rnti, pdcp.last_sdu_rnti);