mirror of https://github.com/PentHertz/srsLTE.git
Added test for reception of duplicated packets
This commit is contained in:
parent
347e10d967
commit
900d535baa
|
@ -106,13 +106,13 @@ int test_tx(uint32_t n_packets,
|
||||||
/*
|
/*
|
||||||
* Genric function to test reception of in-sequence packets
|
* Genric function to test reception of in-sequence packets
|
||||||
*/
|
*/
|
||||||
int test_rx(std::vector<pdcp_test_event_t> events,
|
int test_rx(std::vector<pdcp_test_event_t> events,
|
||||||
const pdcp_initial_state& init_state,
|
const pdcp_initial_state& init_state,
|
||||||
uint8_t pdcp_sn_len,
|
uint8_t pdcp_sn_len,
|
||||||
uint32_t n_sdus_exp,
|
uint32_t n_sdus_exp,
|
||||||
const srslte::unique_byte_buffer_t &sdu_exp,
|
const srslte::unique_byte_buffer_t& sdu_exp,
|
||||||
srslte::byte_buffer_pool* pool,
|
srslte::byte_buffer_pool* pool,
|
||||||
srslte::log* log)
|
srslte::log* log)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ int test_rx(std::vector<pdcp_test_event_t> events,
|
||||||
srslte::pdcp_t_reordering_t::ms500};
|
srslte::pdcp_t_reordering_t::ms500};
|
||||||
|
|
||||||
pdcp_nr_test_helper pdcp_hlp_rx(cfg_rx, sec_cfg, log);
|
pdcp_nr_test_helper pdcp_hlp_rx(cfg_rx, sec_cfg, log);
|
||||||
srslte::pdcp_entity_nr* pdcp_rx = &pdcp_hlp_rx.pdcp;
|
srslte::pdcp_entity_nr* pdcp_rx = &pdcp_hlp_rx.pdcp;
|
||||||
gw_dummy* gw_rx = &pdcp_hlp_rx.gw;
|
gw_dummy* gw_rx = &pdcp_hlp_rx.gw;
|
||||||
srslte::timers* timers_rx = &pdcp_hlp_rx.timers;
|
srslte::timers* timers_rx = &pdcp_hlp_rx.timers;
|
||||||
pdcp_hlp_rx.set_pdcp_initial_state(init_state);
|
pdcp_hlp_rx.set_pdcp_initial_state(init_state);
|
||||||
|
@ -134,7 +134,7 @@ int test_rx(std::vector<pdcp_test_event_t> events,
|
||||||
|
|
||||||
// Decript and integrity check the PDU
|
// Decript and integrity check the PDU
|
||||||
pdcp_rx->write_pdu(std::move(event.pkt));
|
pdcp_rx->write_pdu(std::move(event.pkt));
|
||||||
for (uint32_t i = 0; i < event.ticks; ++i){
|
for (uint32_t i = 0; i < event.ticks; ++i) {
|
||||||
timers_rx->step_all();
|
timers_rx->step_all();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -368,12 +368,12 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
|
||||||
pdcp_initial_state test5_init_state = {};
|
pdcp_initial_state test5_init_state = {};
|
||||||
|
|
||||||
// First PDU
|
// First PDU
|
||||||
pdcp_test_event_t event_pdu1;
|
pdcp_test_event_t event_pdu1;
|
||||||
event_pdu1.pkt = srslte::allocate_unique_buffer(*pool);
|
event_pdu1.pkt = srslte::allocate_unique_buffer(*pool);
|
||||||
event_pdu1.pkt->append_bytes(pdu1_count0_snlen12, sizeof(pdu1_count0_snlen12));
|
event_pdu1.pkt->append_bytes(pdu1_count0_snlen12, sizeof(pdu1_count0_snlen12));
|
||||||
|
|
||||||
// Second PDU
|
// Second PDU
|
||||||
pdcp_test_event_t event_pdu2;
|
pdcp_test_event_t event_pdu2;
|
||||||
event_pdu2.pkt = srslte::allocate_unique_buffer(*pool);
|
event_pdu2.pkt = srslte::allocate_unique_buffer(*pool);
|
||||||
event_pdu2.pkt->append_bytes(pdu2_count1_snlen12, sizeof(pdu2_count1_snlen12));
|
event_pdu2.pkt->append_bytes(pdu2_count1_snlen12, sizeof(pdu2_count1_snlen12));
|
||||||
|
|
||||||
|
@ -392,12 +392,12 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
|
||||||
pdcp_initial_state test6_init_state = {};
|
pdcp_initial_state test6_init_state = {};
|
||||||
|
|
||||||
// First PDU
|
// First PDU
|
||||||
pdcp_test_event_t event_pdu1;
|
pdcp_test_event_t event_pdu1;
|
||||||
event_pdu1.pkt = srslte::allocate_unique_buffer(*pool);
|
event_pdu1.pkt = srslte::allocate_unique_buffer(*pool);
|
||||||
event_pdu1.pkt->append_bytes(pdu1_count0_snlen18, sizeof(pdu1_count0_snlen18));
|
event_pdu1.pkt->append_bytes(pdu1_count0_snlen18, sizeof(pdu1_count0_snlen18));
|
||||||
|
|
||||||
// Second PDU
|
// Second PDU
|
||||||
pdcp_test_event_t event_pdu2;
|
pdcp_test_event_t event_pdu2;
|
||||||
event_pdu2.pkt = srslte::allocate_unique_buffer(*pool);
|
event_pdu2.pkt = srslte::allocate_unique_buffer(*pool);
|
||||||
event_pdu2.pkt->append_bytes(pdu2_count1_snlen18, sizeof(pdu2_count1_snlen18));
|
event_pdu2.pkt->append_bytes(pdu2_count1_snlen18, sizeof(pdu2_count1_snlen18));
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
|
||||||
pdcp_initial_state test7_init_state = {};
|
pdcp_initial_state test7_init_state = {};
|
||||||
|
|
||||||
// First PDU
|
// First PDU
|
||||||
pdcp_test_event_t event_pdu1;
|
pdcp_test_event_t event_pdu1;
|
||||||
event_pdu1.pkt = srslte::allocate_unique_buffer(*pool);
|
event_pdu1.pkt = srslte::allocate_unique_buffer(*pool);
|
||||||
event_pdu1.pkt->append_bytes(pdu2_count1_snlen12, sizeof(pdu2_count1_snlen12));
|
event_pdu1.pkt->append_bytes(pdu2_count1_snlen12, sizeof(pdu2_count1_snlen12));
|
||||||
event_pdu1.ticks = 500;
|
event_pdu1.ticks = 500;
|
||||||
|
@ -435,12 +435,12 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
|
||||||
pdcp_initial_state test8_init_state = {};
|
pdcp_initial_state test8_init_state = {};
|
||||||
|
|
||||||
// First PDU
|
// First PDU
|
||||||
pdcp_test_event_t event_pdu1;
|
pdcp_test_event_t event_pdu1;
|
||||||
event_pdu1.pkt = srslte::allocate_unique_buffer(*pool);
|
event_pdu1.pkt = srslte::allocate_unique_buffer(*pool);
|
||||||
event_pdu1.pkt->append_bytes(pdu1_count0_snlen12, sizeof(pdu1_count0_snlen12));
|
event_pdu1.pkt->append_bytes(pdu1_count0_snlen12, sizeof(pdu1_count0_snlen12));
|
||||||
|
|
||||||
// Second PDU
|
// Second PDU
|
||||||
pdcp_test_event_t event_pdu2;
|
pdcp_test_event_t event_pdu2;
|
||||||
event_pdu2.pkt = srslte::allocate_unique_buffer(*pool);
|
event_pdu2.pkt = srslte::allocate_unique_buffer(*pool);
|
||||||
event_pdu2.pkt->append_bytes(pdu1_count0_snlen12, sizeof(pdu1_count0_snlen12));
|
event_pdu2.pkt->append_bytes(pdu1_count0_snlen12, sizeof(pdu1_count0_snlen12));
|
||||||
|
|
||||||
|
@ -464,11 +464,11 @@ int run_all_tests(srslte::byte_buffer_pool* pool)
|
||||||
TESTASSERT(test_rx_all(pool, &log) == 0);
|
TESTASSERT(test_rx_all(pool, &log) == 0);
|
||||||
|
|
||||||
// Helpers for generating expected PDUs
|
// Helpers for generating expected PDUs
|
||||||
//srslte::unique_byte_buffer_t sdu = srslte::allocate_unique_buffer(*pool);
|
// srslte::unique_byte_buffer_t sdu = srslte::allocate_unique_buffer(*pool);
|
||||||
//sdu->append_bytes(sdu2, sizeof(sdu2));
|
// sdu->append_bytes(sdu2, sizeof(sdu2));
|
||||||
//uint32_t tx_next = 1;
|
// uint32_t tx_next = 1;
|
||||||
//srslte::unique_byte_buffer_t pdu = gen_expected_pdu(std::move(sdu), tx_next, srslte::PDCP_SN_LEN_18, sec_cfg, pool, &log);
|
// srslte::unique_byte_buffer_t pdu = gen_expected_pdu(std::move(sdu), tx_next, srslte::PDCP_SN_LEN_18, sec_cfg, pool,
|
||||||
//print_packet_array(pdu);
|
// &log); print_packet_array(pdu);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue