From 0b88161b3cdac192b7db94d52066a110ec20f5aa Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Fri, 29 May 2020 11:29:46 +0200 Subject: [PATCH] Send DRB PDUs as JSON to TTCN3 --- srsue/test/ttcn3/hdr/ttcn3_drb_interface.h | 8 +++-- srsue/test/ttcn3/src/ttcn3_syssim.cc | 36 ++++++++++++---------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/srsue/test/ttcn3/hdr/ttcn3_drb_interface.h b/srsue/test/ttcn3/hdr/ttcn3_drb_interface.h index a5c315d55..bebec5126 100644 --- a/srsue/test/ttcn3/hdr/ttcn3_drb_interface.h +++ b/srsue/test/ttcn3/hdr/ttcn3_drb_interface.h @@ -27,6 +27,7 @@ #include "srslte/mac/pdu.h" #include "ttcn3_interfaces.h" #include "ttcn3_port_handler.h" +#include #include using namespace srslte; @@ -49,11 +50,12 @@ public: return port_listen(); } - void tx(unique_byte_buffer_t pdu) + void tx(std::string out) { if (initialized) { - log->info_hex(pdu->msg, pdu->N_bytes, "Sending %d B to Titan\n", pdu->N_bytes); - send(pdu->msg, pdu->N_bytes); + log->info_hex( + reinterpret_cast(out.c_str()), out.length(), "Sending %ld B to Titan\n", out.length()); + send(reinterpret_cast(out.c_str()), out.length()); } else { log->error("Trying to transmit but port not connected.\n"); } diff --git a/srsue/test/ttcn3/src/ttcn3_syssim.cc b/srsue/test/ttcn3/src/ttcn3_syssim.cc index 2d2f9d123..c1b78d6cf 100644 --- a/srsue/test/ttcn3/src/ttcn3_syssim.cc +++ b/srsue/test/ttcn3/src/ttcn3_syssim.cc @@ -1023,27 +1023,29 @@ void ttcn3_syssim::write_pdu(uint32_t lcid, unique_byte_buffer_t pdu) cells[pcell_idx]->cell.id, pdu->N_bytes); - // check cell ID - if (cells[pcell_idx]->cell.id > 256) { - log->error("Cell ID too large to fit in single byte.\n"); - return; - } - - // We don't handle RRC, prepend LCID - pdu->msg--; - *pdu->msg = lcid; - pdu->N_bytes++; - - // prepend pcell PCID - pdu->msg--; - *pdu->msg = static_cast(cells[pcell_idx]->cell.id); - pdu->N_bytes++; - // push content to Titan if (lcid <= 2) { + // check cell ID + if (cells[pcell_idx]->cell.id > 256) { + log->error("Cell ID too large to fit in single byte.\n"); + return; + } + + // We don't handle RRC, prepend LCID + pdu->msg--; + *pdu->msg = lcid; + pdu->N_bytes++; + + // prepend pcell PCID + pdu->msg--; + *pdu->msg = static_cast(cells[pcell_idx]->cell.id); + pdu->N_bytes++; + srb.tx(std::move(pdu)); } else { - drb.tx(std::move(pdu)); + std::string out = ttcn3_helpers::get_drb_common_ind_for_pdu(lcid, cells[pcell_idx]->name, std::move(pdu)); + log->error("DRB send:\n%s", out.c_str()); + drb.tx(out); } }