|
|
|
@ -373,6 +373,50 @@ int test_rx_out_of_order(uint8_t pdcp_sn_len, srslte::byte_buffer_pool* pool, sr
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* RX Test: PDCP Entity with packtes received out of order
|
|
|
|
|
* PDCP entity configured with EIA2 and EEA2
|
|
|
|
|
*/
|
|
|
|
|
int test_rx_out_of_order_timeout(uint8_t pdcp_sn_len, srslte::byte_buffer_pool* pool, srslte::log* log)
|
|
|
|
|
{
|
|
|
|
|
srslte::pdcp_entity_nr pdcp_rx;
|
|
|
|
|
srslte::pdcp_config_t cfg_rx = {
|
|
|
|
|
1, srslte::PDCP_RB_IS_DRB, srslte::SECURITY_DIRECTION_DOWNLINK, srslte::SECURITY_DIRECTION_UPLINK, pdcp_sn_len};
|
|
|
|
|
|
|
|
|
|
rlc_dummy rlc_rx(log);
|
|
|
|
|
rrc_dummy rrc_rx(log);
|
|
|
|
|
gw_dummy gw_rx(log);
|
|
|
|
|
srslte::timers timers_rx(64);
|
|
|
|
|
|
|
|
|
|
pdcp_rx.init(&rlc_rx, &rrc_rx, &gw_rx, &timers_rx, log, 0, cfg_rx);
|
|
|
|
|
pdcp_rx.config_security(
|
|
|
|
|
k_enc, k_int, k_enc, k_int, srslte::CIPHERING_ALGORITHM_ID_128_EEA2, srslte::INTEGRITY_ALGORITHM_ID_128_EIA2);
|
|
|
|
|
pdcp_rx.enable_integrity();
|
|
|
|
|
pdcp_rx.enable_encryption();
|
|
|
|
|
|
|
|
|
|
srslte::unique_byte_buffer_t sdu_act = allocate_unique_buffer(*pool);
|
|
|
|
|
srslte::unique_byte_buffer_t sdu_exp = allocate_unique_buffer(*pool);
|
|
|
|
|
memcpy(sdu_exp->msg, sdu2, SDU2_LEN);
|
|
|
|
|
sdu_exp->N_bytes = SDU2_LEN;
|
|
|
|
|
|
|
|
|
|
// Generate encripted and integrity protected PDUs
|
|
|
|
|
srslte::unique_byte_buffer_t rx_pdu7 = allocate_unique_buffer(*pool);
|
|
|
|
|
memcpy(rx_pdu7->msg, pdu7, PDU7_LEN);
|
|
|
|
|
rx_pdu7->N_bytes = PDU7_LEN;
|
|
|
|
|
|
|
|
|
|
// decript and check matching SDUs (out of order)
|
|
|
|
|
pdcp_rx.write_pdu(std::move(rx_pdu7));
|
|
|
|
|
gw_rx.get_last_pdu(sdu_act);
|
|
|
|
|
|
|
|
|
|
// Make sure out of order is not received until time out
|
|
|
|
|
TESTASSERT(gw_rx.rx_count == 0);
|
|
|
|
|
|
|
|
|
|
TESTASSERT(sdu_exp->N_bytes == sdu_act->N_bytes);
|
|
|
|
|
for (uint32_t j = 0; j < sdu_act->N_bytes; ++j) {
|
|
|
|
|
TESTASSERT(sdu_exp->msg[j] == sdu_act->msg[j]);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
// Setup all tests
|
|
|
|
|
int run_all_tests(srslte::byte_buffer_pool* pool)
|
|
|
|
|
{
|
|
|
|
@ -381,11 +425,12 @@ int run_all_tests(srslte::byte_buffer_pool* pool)
|
|
|
|
|
log.set_level(srslte::LOG_LEVEL_DEBUG);
|
|
|
|
|
log.set_hex_limit(128);
|
|
|
|
|
|
|
|
|
|
// TESTASSERT(test_tx_all(pool, &log) == 0);
|
|
|
|
|
// TESTASSERT(test_rx_in_sequence(4097, srslte::PDCP_SN_LEN_12, pool, &log) == 0);
|
|
|
|
|
TESTASSERT(test_tx_all(pool, &log) == 0);
|
|
|
|
|
TESTASSERT(test_rx_in_sequence(4097, srslte::PDCP_SN_LEN_12, pool, &log) == 0);
|
|
|
|
|
// TESTASSERT(test_rx_in_sequence(4294967297, srslte::PDCP_SN_LEN_12, pool, &log) == 0);
|
|
|
|
|
// TESTASSERT(test_rx_in_sequence(262145, srslte::PDCP_SN_LEN_18, pool, &log) == 0);
|
|
|
|
|
TESTASSERT(test_rx_in_sequence(262145, srslte::PDCP_SN_LEN_18, pool, &log) == 0);
|
|
|
|
|
TESTASSERT(test_rx_out_of_order(srslte::PDCP_SN_LEN_12, pool, &log) == 0);
|
|
|
|
|
TESTASSERT(test_rx_out_of_order_timeout(srslte::PDCP_SN_LEN_12, pool, &log) == 0);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|