|
|
@ -43,6 +43,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
#define MIN_TB_LEN (100) // MAX_TB_LEN defined in api.h
|
|
|
|
#define MIN_TB_LEN (100) // MAX_TB_LEN defined in api.h
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define PING_REQUEST_PDU 1
|
|
|
|
|
|
|
|
|
|
|
|
namespace srslte {
|
|
|
|
namespace srslte {
|
|
|
|
|
|
|
|
|
|
|
|
struct pnf_metrics_t {
|
|
|
|
struct pnf_metrics_t {
|
|
|
@ -63,6 +65,7 @@ public:
|
|
|
|
const uint32_t& tb_len_) :
|
|
|
|
const uint32_t& tb_len_) :
|
|
|
|
running(false),
|
|
|
|
running(false),
|
|
|
|
type(type_),
|
|
|
|
type(type_),
|
|
|
|
|
|
|
|
tti(100), ///< Random start TTI
|
|
|
|
vnf_addr(vnf_p5_addr),
|
|
|
|
vnf_addr(vnf_p5_addr),
|
|
|
|
vnf_port(vnf_p5_port),
|
|
|
|
vnf_port(vnf_p5_port),
|
|
|
|
sf_interval_us(sf_interval),
|
|
|
|
sf_interval_us(sf_interval),
|
|
|
@ -210,6 +213,11 @@ private:
|
|
|
|
// Send request
|
|
|
|
// Send request
|
|
|
|
send_sf_ind(tti);
|
|
|
|
send_sf_ind(tti);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// provide UL data every 2nd TTI
|
|
|
|
|
|
|
|
if (tti % 2 == 0) {
|
|
|
|
|
|
|
|
send_rx_data_ind(tti);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sf_counter++;
|
|
|
|
sf_counter++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -334,8 +342,52 @@ private:
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void send_dl_ind(uint32_t tti_)
|
|
|
|
void send_rx_data_ind(const uint32_t tti)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
// MAC PDU for UL-SCH with IPv6 router solicitation
|
|
|
|
|
|
|
|
static uint8_t tv[] = {0x04, 0x38, 0x00, 0x80, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a, 0xff, 0xfe,
|
|
|
|
|
|
|
|
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x44, 0x4b, 0x0f, 0x2c, 0x33, 0x98, 0xf2,
|
|
|
|
|
|
|
|
0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
|
|
|
0x02, 0x85, 0x00, 0x4b, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x7f, 0x00, 0x00, 0x3f, 0x00};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
basic_vnf_api::rx_data_ind_msg_t rx_ind = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rx_ind.header.type = basic_vnf_api::RX_DATA_IND;
|
|
|
|
|
|
|
|
rx_ind.header.msg_len = sizeof(rx_ind) - sizeof(basic_vnf_api::msg_header_t);
|
|
|
|
|
|
|
|
rx_ind.sfn = tti;
|
|
|
|
|
|
|
|
rx_ind.t1 = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rx_ind.nof_pdus = 1;
|
|
|
|
|
|
|
|
rx_ind.pdus[0].type = basic_vnf_api::PUSCH;
|
|
|
|
|
|
|
|
rx_ind.pdus[0].length = tb_len > 0 ? tb_len : rand_dist(rand_gen);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rx_ind.pdus[0].length >= sizeof(tv)) {
|
|
|
|
|
|
|
|
// copy TV
|
|
|
|
|
|
|
|
memcpy(rx_ind.pdus[0].data, tv, sizeof(tv));
|
|
|
|
|
|
|
|
// set remaining bytes to zero
|
|
|
|
|
|
|
|
memset(rx_ind.pdus[0].data + sizeof(tv), 0xaa, rx_ind.pdus[0].length - sizeof(tv));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// just fill with dummy bytes
|
|
|
|
|
|
|
|
memset(rx_ind.pdus[0].data, 0xab, rx_ind.pdus[0].length);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int n = 0;
|
|
|
|
|
|
|
|
if ((n = sendto(sockfd, &rx_ind, sizeof(rx_ind), 0, (struct sockaddr*)&servaddr, sizeof(servaddr))) < 0) {
|
|
|
|
|
|
|
|
printf("sendto failed, ret=%d\n", n);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void send_dl_ind(uint32_t tti)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
#if PING_REQUEST_PDU
|
|
|
|
|
|
|
|
static uint8_t tv[] = {
|
|
|
|
|
|
|
|
0x04, 0x5c, 0x00, 0x80, 0x00, 0x00, 0x45, 0x00, 0x00, 0x54, 0x15, 0x02, 0x40, 0x00, 0x40, 0x01, 0xa2, 0x52,
|
|
|
|
|
|
|
|
0xc0, 0xa8, 0x01, 0x01, 0xc0, 0xa8, 0x01, 0x03, 0x08, 0x00, 0x26, 0x40, 0x5e, 0x8f, 0x00, 0xb3, 0x04, 0x55,
|
|
|
|
|
|
|
|
0xc4, 0x5d, 0x00, 0x00, 0x00, 0x00, 0xe4, 0xf7, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x11, 0x12, 0x13,
|
|
|
|
|
|
|
|
0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
|
|
|
|
|
|
|
|
0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
|
|
|
|
|
|
|
|
0x4f, 0x7f, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
|
|
|
|
|
|
#else
|
|
|
|
// MAC PDU with a single LCID with padding only
|
|
|
|
// MAC PDU with a single LCID with padding only
|
|
|
|
static uint8_t tv[] = {
|
|
|
|
static uint8_t tv[] = {
|
|
|
|
0x01,
|
|
|
|
0x01,
|
|
|
@ -350,12 +402,13 @@ private:
|
|
|
|
0x88,
|
|
|
|
0x88,
|
|
|
|
0x3f,
|
|
|
|
0x3f,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PING_REQUEST_PDU
|
|
|
|
|
|
|
|
|
|
|
|
basic_vnf_api::dl_ind_msg_t dl_ind = {};
|
|
|
|
basic_vnf_api::dl_ind_msg_t dl_ind = {};
|
|
|
|
|
|
|
|
|
|
|
|
dl_ind.header.type = basic_vnf_api::DL_IND;
|
|
|
|
dl_ind.header.type = basic_vnf_api::DL_IND;
|
|
|
|
dl_ind.header.msg_len = sizeof(dl_ind) - sizeof(basic_vnf_api::msg_header_t);
|
|
|
|
dl_ind.header.msg_len = sizeof(dl_ind) - sizeof(basic_vnf_api::msg_header_t);
|
|
|
|
dl_ind.tti = tti_;
|
|
|
|
dl_ind.tti = tti;
|
|
|
|
dl_ind.t1 = 0;
|
|
|
|
dl_ind.t1 = 0;
|
|
|
|
|
|
|
|
|
|
|
|
dl_ind.nof_pdus = 1;
|
|
|
|
dl_ind.nof_pdus = 1;
|
|
|
|