pdu_test: add UL-SCH unpacking test

TV captured in PCAPs.
master
Andre Puschmann 4 years ago
parent 6be57dd216
commit b379910690

@ -1020,6 +1020,118 @@ int mac_sch_pdu_unpack_test3()
return SRSRAN_SUCCESS;
}
// Unpacking of UL-SCH PDU containing Padding, PHR and two SDUs for same LCID
int mac_sch_pdu_unpack_test4()
{
static uint8_t tv[] = {
0x3f, 0x3a, 0x23, 0x09, 0x03, 0x1e, 0xd9, 0xd0, 0x84, 0x1d, 0xc4, 0x77, 0xc7, 0x3b, 0xf0, 0x9a, 0x31, 0xc6, 0xb7,
0x48, 0x61, 0x6e, 0xc3, 0x97, 0x48, 0xa6, 0xe3, 0xac, 0xc0, 0x75, 0x9f, 0xb2, 0xc8, 0xed, 0xb0, 0xad, 0xcc, 0xc2,
0x0d, 0x28, 0xdd, 0xbb, 0x4b, 0x4c, 0xc5, 0xfc, 0x52, 0x40, 0xc2, 0x09, 0x89, 0x23, 0x77, 0x4c, 0xba, 0xbf, 0xf2,
0x9d, 0x6b, 0xb2, 0x12, 0x0b, 0x64, 0xda, 0xf8, 0x14, 0x88, 0xc4, 0xd7, 0x95, 0xec, 0xb4, 0x50, 0x37, 0x00, 0x15,
0x33, 0x52, 0x56, 0xf5, 0x5b, 0xdf, 0x18, 0xd2, 0x2b, 0xd2, 0x92, 0x1d, 0x6f, 0xfd, 0xcf, 0x82, 0x08, 0x33, 0x5c,
0x00, 0x48, 0xe4, 0xc4, 0x1f, 0x79, 0xb0, 0xd3, 0xca, 0xe8, 0xd3, 0xdf, 0x1b, 0x25, 0x35, 0x11, 0x80, 0x14, 0x29,
0x52, 0x3f, 0xfc, 0xe4, 0x5c, 0x6b, 0xe2, 0x2b, 0xed, 0xea, 0x5f, 0x4a, 0xeb, 0xa7, 0x2e, 0xaf, 0xc6, 0xa8, 0x60,
0x99, 0x72, 0x48, 0x6c, 0x51, 0x63, 0x91, 0x87, 0x74, 0x11, 0x9b, 0x9e, 0x63, 0xdb, 0x9a, 0x48, 0x37, 0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32_t sdu2_len = 1048;
srsran::sch_pdu pdu(5, srslog::fetch_basic_logger("MAC"));
pdu.init_rx(sizeof(tv), true);
pdu.parse_packet(tv);
TESTASSERT(pdu.nof_subh() == 4);
// Padding
TESTASSERT(pdu.next());
TESTASSERT(pdu.get()->is_sdu() == false);
TESTASSERT(pdu.get()->ul_sch_ce_type() == srsran::ul_sch_lcid::PADDING);
// PHR
TESTASSERT(pdu.next());
TESTASSERT(pdu.get()->is_sdu() == false);
TESTASSERT(pdu.get()->ul_sch_ce_type() == srsran::ul_sch_lcid::PHR_REPORT);
TESTASSERT(pdu.get()->get_phr() == 7);
// SDU1
TESTASSERT(pdu.next());
TESTASSERT(pdu.get()->is_sdu() == true);
TESTASSERT(pdu.get()->get_sdu_lcid() == 3);
TESTASSERT(pdu.get()->get_payload_size() == sdu1_len);
TESTASSERT(memcmp(sdu1, pdu.get()->get_sdu_ptr(), sdu1_len) == 0);
// SDU2
TESTASSERT(pdu.next());
TESTASSERT(pdu.get()->is_sdu() == true);
TESTASSERT(pdu.get()->get_sdu_lcid() == 3);
TESTASSERT(pdu.get()->get_payload_size() == sdu2_len);
TESTASSERT(memcmp(sdu2, pdu.get()->get_sdu_ptr(), sdu2_len) == 0);
// end of PDU
TESTASSERT(pdu.next() == false);
fmt::memory_buffer buffer;
pdu.to_string(buffer);
std::cout << fmt::to_string(buffer) << std::endl;
#if HAVE_PCAP
pcap_handle->write_ul_crnti(tv, sizeof(tv), 0x1001, true, 1, 0);
#endif
return SRSRAN_SUCCESS;
}
int mac_slsch_pdu_unpack_test1()
{
// SL-SCH PDU captures from UXM 5G CV2X
@ -1076,6 +1188,7 @@ int main(int argc, char** argv)
TESTASSERT(mac_sch_pdu_unpack_test1() == SRSRAN_SUCCESS);
TESTASSERT(mac_sch_pdu_unpack_test2() == SRSRAN_SUCCESS);
TESTASSERT(mac_sch_pdu_unpack_test3() == SRSRAN_SUCCESS);
TESTASSERT(mac_sch_pdu_unpack_test4() == SRSRAN_SUCCESS);
TESTASSERT(mac_slsch_pdu_unpack_test1() == SRSRAN_SUCCESS);

Loading…
Cancel
Save