|
|
|
@ -29,6 +29,8 @@
|
|
|
|
|
|
|
|
|
|
#include "rapidjson/document.h" // rapidjson's DOM-style API
|
|
|
|
|
#include "rapidjson/prettywriter.h" // for stringify JSON
|
|
|
|
|
#include "srslte/asn1/asn1_utils.h"
|
|
|
|
|
#include "srslte/common/common.h"
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include <bitset>
|
|
|
|
@ -38,6 +40,7 @@
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
using namespace rapidjson;
|
|
|
|
|
using namespace srslte;
|
|
|
|
|
|
|
|
|
|
class ttcn3_helpers
|
|
|
|
|
{
|
|
|
|
@ -403,6 +406,88 @@ public:
|
|
|
|
|
|
|
|
|
|
return config_flag.GetBool();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static std::string
|
|
|
|
|
get_drb_common_ind_for_pdu(uint32_t lcid, const std::string cell_, srslte::unique_byte_buffer_t drbpdu)
|
|
|
|
|
{
|
|
|
|
|
Document resp;
|
|
|
|
|
resp.SetObject();
|
|
|
|
|
|
|
|
|
|
// Create members of common object
|
|
|
|
|
|
|
|
|
|
// Cell
|
|
|
|
|
Value cell(cell_.c_str(), resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
// RoutingInfo
|
|
|
|
|
Value radiobearer_id(kObjectType);
|
|
|
|
|
radiobearer_id.AddMember("Drb", lcid - 2, resp.GetAllocator());
|
|
|
|
|
Value routing_info(kObjectType);
|
|
|
|
|
routing_info.AddMember("RadioBearerId", radiobearer_id, resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
// TimingInfo
|
|
|
|
|
// FIXME: Use real TTI
|
|
|
|
|
uint32_t tti = 10;
|
|
|
|
|
|
|
|
|
|
// SFN
|
|
|
|
|
uint32_t sfn = tti / 10;
|
|
|
|
|
Value sfn_key(kObjectType);
|
|
|
|
|
sfn_key.AddMember("Number", sfn, resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
// Actual subframe index
|
|
|
|
|
uint32_t sf_idx = tti % 10;
|
|
|
|
|
Value sf_idx_key(kObjectType);
|
|
|
|
|
sf_idx_key.AddMember("Number", sf_idx, resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
// Put it all together
|
|
|
|
|
Value subframe_key(kObjectType);
|
|
|
|
|
subframe_key.AddMember("SFN", sfn_key, resp.GetAllocator());
|
|
|
|
|
subframe_key.AddMember("Subframe", sf_idx_key, resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
Value timing_info(kObjectType);
|
|
|
|
|
timing_info.AddMember("SubFrame", subframe_key, resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
// Status
|
|
|
|
|
Value status(kObjectType);
|
|
|
|
|
status.AddMember("Ok", true, resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
// Now, create the common object itself and add members
|
|
|
|
|
Value common(kObjectType);
|
|
|
|
|
common.AddMember("CellId", cell, resp.GetAllocator());
|
|
|
|
|
common.AddMember("RoutingInfo", routing_info, resp.GetAllocator());
|
|
|
|
|
common.AddMember("TimingInfo", timing_info, resp.GetAllocator());
|
|
|
|
|
common.AddMember("Status", status, resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
resp.AddMember("Common", common, resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
// Add the user plane data
|
|
|
|
|
std::string hexdrb = asn1::octstring_to_string(drbpdu->msg, drbpdu->N_bytes);
|
|
|
|
|
Value sdu(hexdrb.c_str(), resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
Value pdcpsdu(kArrayType);
|
|
|
|
|
pdcpsdu.PushBack(sdu, resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
Value pdusdulist(kObjectType);
|
|
|
|
|
pdusdulist.AddMember("PdcpSdu", pdcpsdu, resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
Value sfdata(kObjectType);
|
|
|
|
|
sfdata.AddMember("PduSduList", pdusdulist, resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
// FIXME: Get real no. of TTIs for transmission
|
|
|
|
|
sfdata.AddMember("NoOfTTIs", 1, resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
Value uplane(kObjectType);
|
|
|
|
|
uplane.AddMember("SubframeData", sfdata, resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
resp.AddMember("U_Plane", uplane, resp.GetAllocator());
|
|
|
|
|
|
|
|
|
|
// JSON-ize
|
|
|
|
|
StringBuffer buffer;
|
|
|
|
|
Writer<StringBuffer> writer(buffer);
|
|
|
|
|
resp.Accept(writer);
|
|
|
|
|
|
|
|
|
|
// Return as std::string
|
|
|
|
|
return std::string(buffer.GetString());
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // SRSUE_TTCN3_HELPERS_H
|
|
|
|
|