From 940626108b05e8894c12ed7cffa854530135bd55 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Wed, 19 Feb 2020 14:57:51 +0000 Subject: [PATCH] Fix PDCP DRB test. Enabled encryption on PDCP LTE tests. Tests passing now. --- lib/test/upper/pdcp_lte_test.h | 2 +- lib/test/upper/pdcp_lte_test_rx.cc | 21 ++++++++------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/lib/test/upper/pdcp_lte_test.h b/lib/test/upper/pdcp_lte_test.h index 5e0adcaf5..d51bf198f 100644 --- a/lib/test/upper/pdcp_lte_test.h +++ b/lib/test/upper/pdcp_lte_test.h @@ -55,7 +55,7 @@ pdcp_security_cfg sec_cfg = { k_int, k_enc, srslte::INTEGRITY_ALGORITHM_ID_128_EIA2, - srslte::CIPHERING_ALGORITHM_ID_EEA0, + srslte::CIPHERING_ALGORITHM_ID_128_EEA2, }; // Test SDUs for tx diff --git a/lib/test/upper/pdcp_lte_test_rx.cc b/lib/test/upper/pdcp_lte_test_rx.cc index 6d471f777..814a8c591 100644 --- a/lib/test/upper/pdcp_lte_test_rx.cc +++ b/lib/test/upper/pdcp_lte_test_rx.cc @@ -60,8 +60,6 @@ int test_rx(std::vector events, } } - log->debug("%d", gw_rx->rx_count); - log->debug("%d", rrc_rx->rx_count); // Test if the number of RX packets if (rb_type == srslte::PDCP_RB_IS_DRB) { TESTASSERT(gw_rx->rx_count == n_sdus_exp); @@ -69,12 +67,9 @@ int test_rx(std::vector events, gw_rx->get_last_pdu(sdu_act); TESTASSERT(compare_two_packets(sdu_exp, sdu_act) == 0); } else { - log->debug("%d", rrc_rx->rx_count); TESTASSERT(rrc_rx->rx_count == n_sdus_exp); srslte::unique_byte_buffer_t sdu_act = allocate_unique_buffer(*pool); 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); } 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. * This tests correct handling of HFN in the case of SN wraparound (SN LEN 12) */ { - std::vector test1_counts(2); // Test two packets - std::iota(test1_counts.begin(), test1_counts.end(), 4095); // Starting at COUNT 4095 - std::vector test1_pdus = gen_expected_pdus_vector( - tst_sdu1, test1_counts, srslte::PDCP_SN_LEN_12, srslte::PDCP_RB_IS_SRB, sec_cfg, pool, log); - pdcp_lte_initial_state test1_init_state = { + std::vector test_counts(2); // Test two packets + std::iota(test_counts.begin(), test_counts.end(), 4095); // Starting at COUNT 4095 + std::vector test_pdus = gen_expected_pdus_vector( + tst_sdu1, test_counts, srslte::PDCP_SN_LEN_12, srslte::PDCP_RB_IS_DRB, sec_cfg, pool, log); + pdcp_lte_initial_state test_init_state = { .tx_count = 0, .rx_hfn = 0, .next_pdcp_rx_sn = 4095, .last_submitted_pdcp_rx_sn = 4094}; - TESTASSERT(test_rx(std::move(test1_pdus), - test1_init_state, + TESTASSERT(test_rx(std::move(test_pdus), + test_init_state, srslte::PDCP_SN_LEN_12, srslte::PDCP_RB_IS_DRB, 2,