Fix PDCP DRB test. Enabled encryption on PDCP LTE tests. Tests passing now.

master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent d98b888ca4
commit 940626108b

@ -55,7 +55,7 @@ pdcp_security_cfg sec_cfg = {
k_int, k_int,
k_enc, k_enc,
srslte::INTEGRITY_ALGORITHM_ID_128_EIA2, srslte::INTEGRITY_ALGORITHM_ID_128_EIA2,
srslte::CIPHERING_ALGORITHM_ID_EEA0, srslte::CIPHERING_ALGORITHM_ID_128_EEA2,
}; };
// Test SDUs for tx // Test SDUs for tx

@ -60,8 +60,6 @@ int test_rx(std::vector<pdcp_test_event_t> events,
} }
} }
log->debug("%d", gw_rx->rx_count);
log->debug("%d", rrc_rx->rx_count);
// Test if the number of RX packets // Test if the number of RX packets
if (rb_type == srslte::PDCP_RB_IS_DRB) { if (rb_type == srslte::PDCP_RB_IS_DRB) {
TESTASSERT(gw_rx->rx_count == n_sdus_exp); TESTASSERT(gw_rx->rx_count == n_sdus_exp);
@ -69,12 +67,9 @@ int test_rx(std::vector<pdcp_test_event_t> events,
gw_rx->get_last_pdu(sdu_act); gw_rx->get_last_pdu(sdu_act);
TESTASSERT(compare_two_packets(sdu_exp, sdu_act) == 0); TESTASSERT(compare_two_packets(sdu_exp, sdu_act) == 0);
} else { } else {
log->debug("%d", rrc_rx->rx_count);
TESTASSERT(rrc_rx->rx_count == n_sdus_exp); TESTASSERT(rrc_rx->rx_count == n_sdus_exp);
srslte::unique_byte_buffer_t sdu_act = allocate_unique_buffer(*pool); srslte::unique_byte_buffer_t sdu_act = allocate_unique_buffer(*pool);
rrc_rx->get_last_pdu(sdu_act); rrc_rx->get_last_pdu(sdu_act);
log->debug("%d", sdu_act->N_bytes);
log->debug("%d", sdu_exp->N_bytes);
TESTASSERT(compare_two_packets(sdu_exp, sdu_act) == 0); TESTASSERT(compare_two_packets(sdu_exp, sdu_act) == 0);
} }
return 0; return 0;
@ -115,19 +110,19 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
} }
/* /*
* RX Test 1: PDCP LTE Entity with SN LEN = 12 * RX Test 2: PDCP LTE Entity with SN LEN = 12
* Test in-sequence reception of 4096 packets. * Test in-sequence reception of 4096 packets.
* This tests correct handling of HFN in the case of SN wraparound (SN LEN 12) * This tests correct handling of HFN in the case of SN wraparound (SN LEN 12)
*/ */
{ {
std::vector<uint32_t> test1_counts(2); // Test two packets std::vector<uint32_t> test_counts(2); // Test two packets
std::iota(test1_counts.begin(), test1_counts.end(), 4095); // Starting at COUNT 4095 std::iota(test_counts.begin(), test_counts.end(), 4095); // Starting at COUNT 4095
std::vector<pdcp_test_event_t> test1_pdus = gen_expected_pdus_vector( std::vector<pdcp_test_event_t> test_pdus = gen_expected_pdus_vector(
tst_sdu1, test1_counts, srslte::PDCP_SN_LEN_12, srslte::PDCP_RB_IS_SRB, sec_cfg, pool, log); tst_sdu1, test_counts, srslte::PDCP_SN_LEN_12, srslte::PDCP_RB_IS_DRB, sec_cfg, pool, log);
pdcp_lte_initial_state test1_init_state = { pdcp_lte_initial_state test_init_state = {
.tx_count = 0, .rx_hfn = 0, .next_pdcp_rx_sn = 4095, .last_submitted_pdcp_rx_sn = 4094}; .tx_count = 0, .rx_hfn = 0, .next_pdcp_rx_sn = 4095, .last_submitted_pdcp_rx_sn = 4094};
TESTASSERT(test_rx(std::move(test1_pdus), TESTASSERT(test_rx(std::move(test_pdus),
test1_init_state, test_init_state,
srslte::PDCP_SN_LEN_12, srslte::PDCP_SN_LEN_12,
srslte::PDCP_RB_IS_DRB, srslte::PDCP_RB_IS_DRB,
2, 2,

Loading…
Cancel
Save