|
|
|
@ -37,7 +37,6 @@ pdcp_security_cfg sec_cfg = {
|
|
|
|
|
srslte::CIPHERING_ALGORITHM_ID_128_EEA2,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Test SDUs for tx
|
|
|
|
|
uint8_t sdu1[] = {0x18, 0xe2};
|
|
|
|
|
uint8_t sdu2[] = {0xde, 0xad};
|
|
|
|
@ -55,7 +54,6 @@ uint8_t pdu1_count4294967295_snlen18[] = {0x83, 0xff, 0xff, 0x1e, 0x47, 0xe6, 0x
|
|
|
|
|
// Test PDUs for rx (generated from SDU2)
|
|
|
|
|
uint8_t pdu2_count1_snlen12[] = {0x80, 0x01, 0x5e, 0x3d, 0x64, 0xaf, 0xac, 0x7c};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This is the normal initial state. All state variables are set to zero
|
|
|
|
|
pdcp_initial_state normal_init_state = {};
|
|
|
|
|
|
|
|
|
@ -154,7 +152,10 @@ int test_rx_in_sequence(std::vector<srslte::unique_byte_buffer_t> pdus,
|
|
|
|
|
/*
|
|
|
|
|
* Genric function to test reception of a single out-of-order packet
|
|
|
|
|
*/
|
|
|
|
|
int test_rx_out_of_order(pdcp_initial_state init_state, uint8_t pdcp_sn_len, srslte::byte_buffer_pool* pool, srslte::log* log)
|
|
|
|
|
int test_rx_out_of_order(pdcp_initial_state init_state,
|
|
|
|
|
uint8_t pdcp_sn_len,
|
|
|
|
|
srslte::byte_buffer_pool* pool,
|
|
|
|
|
srslte::log* log)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
srslte::pdcp_config_t cfg_tx = {1,
|
|
|
|
@ -425,8 +426,7 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
|
|
|
|
|
std::vector<srslte::unique_byte_buffer_t> test1_pdus =
|
|
|
|
|
gen_expected_pdus_vector(tst_sdu1, test1_counts, srslte::PDCP_SN_LEN_12, sec_cfg, pool, log);
|
|
|
|
|
pdcp_initial_state test1_init_state = {.tx_next = 4095, .rx_next = 4095, .rx_deliv = 4095, .rx_reord = 0};
|
|
|
|
|
TESTASSERT(test_rx_in_sequence(std::move(test1_pdus), test1_init_state, srslte::PDCP_SN_LEN_12, 2, pool, log) ==
|
|
|
|
|
0);
|
|
|
|
|
TESTASSERT(test_rx_in_sequence(std::move(test1_pdus), test1_init_state, srslte::PDCP_SN_LEN_12, 2, pool, log) == 0);
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* RX Test 2: PDCP Entity with SN LEN = 12
|
|
|
|
@ -441,8 +441,7 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
|
|
|
|
|
gen_expected_pdus_vector(tst_sdu1, test2_counts, srslte::PDCP_SN_LEN_12, sec_cfg, pool, log);
|
|
|
|
|
pdcp_initial_state test2_init_state = {
|
|
|
|
|
.tx_next = 4294967295, .rx_next = 4294967295, .rx_deliv = 4294967295, .rx_reord = 0};
|
|
|
|
|
TESTASSERT(test_rx_in_sequence(std::move(test2_pdus), test2_init_state, srslte::PDCP_SN_LEN_12, 1, pool, log) ==
|
|
|
|
|
0);
|
|
|
|
|
TESTASSERT(test_rx_in_sequence(std::move(test2_pdus), test2_init_state, srslte::PDCP_SN_LEN_12, 1, pool, log) == 0);
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* RX Test 3: PDCP Entity with SN LEN = 18
|
|
|
|
@ -455,8 +454,7 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
|
|
|
|
|
std::vector<srslte::unique_byte_buffer_t> test3_pdus =
|
|
|
|
|
gen_expected_pdus_vector(tst_sdu1, test3_counts, srslte::PDCP_SN_LEN_18, sec_cfg, pool, log);
|
|
|
|
|
pdcp_initial_state test3_init_state = {.tx_next = 262144, .rx_next = 262144, .rx_deliv = 262144, .rx_reord = 0};
|
|
|
|
|
TESTASSERT(test_rx_in_sequence(std::move(test3_pdus), test3_init_state, srslte::PDCP_SN_LEN_18, 2, pool, log) ==
|
|
|
|
|
0);
|
|
|
|
|
TESTASSERT(test_rx_in_sequence(std::move(test3_pdus), test3_init_state, srslte::PDCP_SN_LEN_18, 2, pool, log) == 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -469,9 +467,9 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
|
|
|
|
|
std::iota(test4_counts.begin(), test4_counts.end(), 4294967295); // Starting at COUNT 4294967295
|
|
|
|
|
std::vector<srslte::unique_byte_buffer_t> test4_pdus =
|
|
|
|
|
gen_expected_pdus_vector(tst_sdu1, test4_counts, srslte::PDCP_SN_LEN_18, sec_cfg, pool, log);
|
|
|
|
|
pdcp_initial_state test4_init_state = {.tx_next = 4294967295, .rx_next = 4294967295, .rx_deliv = 4294967295, .rx_reord = 0};
|
|
|
|
|
TESTASSERT(test_rx_in_sequence(std::move(test4_pdus), test4_init_state, srslte::PDCP_SN_LEN_18, 1, pool, log) ==
|
|
|
|
|
0);
|
|
|
|
|
pdcp_initial_state test4_init_state = {
|
|
|
|
|
.tx_next = 4294967295, .rx_next = 4294967295, .rx_deliv = 4294967295, .rx_reord = 0};
|
|
|
|
|
TESTASSERT(test_rx_in_sequence(std::move(test4_pdus), test4_init_state, srslte::PDCP_SN_LEN_18, 1, pool, log) == 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -487,8 +485,7 @@ int test_rx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
|
|
|
|
|
pdu2->append_bytes(pdu2_count1_snlen12, sizeof(pdu2_count1_snlen12));
|
|
|
|
|
test5_pdus.push_back(std::move(pdu2));
|
|
|
|
|
test5_pdus.push_back(std::move(pdu1));
|
|
|
|
|
TESTASSERT(test_rx_in_sequence(std::move(test5_pdus), test5_init_state, srslte::PDCP_SN_LEN_12, 2, pool, log) ==
|
|
|
|
|
0);
|
|
|
|
|
TESTASSERT(test_rx_in_sequence(std::move(test5_pdus), test5_init_state, srslte::PDCP_SN_LEN_12, 2, pool, log) == 0);
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* RX Test 5: PDCP Entity with SN LEN = 12
|
|
|
|
|