fix paging opportunity calculation in RRC and add respective unit test

master
Francisco Paisana 3 years ago committed by Andre Puschmann
parent eb4ec84310
commit 8de3d7436e

@ -32,7 +32,7 @@ public:
T(default_paging_cycle_),
Nb(static_cast<uint32_t>((float)T * nb_)),
N(std::min(T, Nb)),
Ns(std::max(1U, Nb)),
Ns(std::max(1U, static_cast<uint32_t>(nb_))),
logger(srslog::fetch_basic_logger("RRC"))
{
for (subframe_info& sf_obj : sf_pending_pcch) {

@ -18,6 +18,10 @@ target_link_libraries(erab_setup_test test_helpers ${LIBCONFIGPP_LIBRARIES} ${AT
add_executable(rrc_mobility_test rrc_mobility_test.cc)
target_link_libraries(rrc_mobility_test srsran_asn1 test_helpers ${ATOMIC_LIBS})
add_executable(rrc_paging_test rrc_paging_test.cc)
target_link_libraries(rrc_paging_test srsran_asn1 test_helpers)
add_test(rrc_mobility_test rrc_mobility_test -i ${CMAKE_CURRENT_SOURCE_DIR}/../..)
add_test(erab_setup_test erab_setup_test -i ${CMAKE_CURRENT_SOURCE_DIR}/../..)
add_test(rrc_meascfg_test rrc_meascfg_test -i ${CMAKE_CURRENT_SOURCE_DIR}/../..)
add_test(rrc_paging_test rrc_paging_test)

@ -0,0 +1,48 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2021 Software Radio Systems Limited
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the distribution.
*
*/
#include "srsenb/hdr/stack/rrc/rrc_paging.h"
#include "srsran/common/test_common.h"
using namespace srsenb;
void test_paging()
{
unsigned paging_cycle = 32;
float nb = 1;
paging_manager pcch_manager{paging_cycle, nb};
unsigned ue_id = 4780;
unsigned mmec = 10;
uint8_t m_tmsi[] = {0x64, 0x04, 0x00, 0x02};
pcch_manager.add_tmsi_paging(ue_id, mmec, m_tmsi);
// \remark: See TS 36.304, section 7.1.
unsigned N = std::min(paging_cycle, (unsigned)std::round(nb * paging_cycle));
unsigned Ns = std::max(1, (int)nb);
unsigned i_s = (ue_id / N) % Ns;
TESTASSERT_EQ(0, i_s);
tti_point t{0};
for (unsigned count = 0; count < 1024 * 10; ++count, ++t) {
if (pcch_manager.pending_pcch_bytes(t) > 0) {
fmt::print("[{}]\n", t);
TESTASSERT_EQ((paging_cycle / N) * (ue_id % N), (t.sfn() % paging_cycle));
TESTASSERT_EQ(9, t.sf_idx()); // PO when i_s == 0.
}
}
}
int main()
{
test_paging();
}
Loading…
Cancel
Save