Send DRB PDUs as JSON to TTCN3

master
Daniel Willmann 5 years ago committed by Andre Puschmann
parent 31f1516d74
commit 0b88161b3c

@ -27,6 +27,7 @@
#include "srslte/mac/pdu.h" #include "srslte/mac/pdu.h"
#include "ttcn3_interfaces.h" #include "ttcn3_interfaces.h"
#include "ttcn3_port_handler.h" #include "ttcn3_port_handler.h"
#include <srslte/asn1/asn1_utils.h>
#include <srslte/interfaces/ue_interfaces.h> #include <srslte/interfaces/ue_interfaces.h>
using namespace srslte; using namespace srslte;
@ -49,11 +50,12 @@ public:
return port_listen(); return port_listen();
} }
void tx(unique_byte_buffer_t pdu) void tx(std::string out)
{ {
if (initialized) { if (initialized) {
log->info_hex(pdu->msg, pdu->N_bytes, "Sending %d B to Titan\n", pdu->N_bytes); log->info_hex(
send(pdu->msg, pdu->N_bytes); reinterpret_cast<const uint8_t*>(out.c_str()), out.length(), "Sending %ld B to Titan\n", out.length());
send(reinterpret_cast<const uint8_t*>(out.c_str()), out.length());
} else { } else {
log->error("Trying to transmit but port not connected.\n"); log->error("Trying to transmit but port not connected.\n");
} }

@ -1023,6 +1023,8 @@ void ttcn3_syssim::write_pdu(uint32_t lcid, unique_byte_buffer_t pdu)
cells[pcell_idx]->cell.id, cells[pcell_idx]->cell.id,
pdu->N_bytes); pdu->N_bytes);
// push content to Titan
if (lcid <= 2) {
// check cell ID // check cell ID
if (cells[pcell_idx]->cell.id > 256) { if (cells[pcell_idx]->cell.id > 256) {
log->error("Cell ID too large to fit in single byte.\n"); log->error("Cell ID too large to fit in single byte.\n");
@ -1039,11 +1041,11 @@ void ttcn3_syssim::write_pdu(uint32_t lcid, unique_byte_buffer_t pdu)
*pdu->msg = static_cast<uint8_t>(cells[pcell_idx]->cell.id); *pdu->msg = static_cast<uint8_t>(cells[pcell_idx]->cell.id);
pdu->N_bytes++; pdu->N_bytes++;
// push content to Titan
if (lcid <= 2) {
srb.tx(std::move(pdu)); srb.tx(std::move(pdu));
} else { } 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);
} }
} }

Loading…
Cancel
Save