X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fe2-interface.git;a=blobdiff_plain;f=e2sim%2Fe2sm_examples%2Fkpm_e2sm%2Fsrc%2Fkpm%2Fkpm_callbacks.cpp;h=26958b69ab56898bbca26cf59a028d7ff5552851;hp=18081f38223a7283a2ef0fb82faea883bfecdeaf;hb=88de94233a1b3b09cc91e3b557c825ac1a80dacb;hpb=a8f2a19da36d7401beefce321f30ceb0982ed342 diff --git a/e2sim/e2sm_examples/kpm_e2sm/src/kpm/kpm_callbacks.cpp b/e2sim/e2sm_examples/kpm_e2sm/src/kpm/kpm_callbacks.cpp index 18081f3..26958b6 100644 --- a/e2sim/e2sm_examples/kpm_e2sm/src/kpm/kpm_callbacks.cpp +++ b/e2sim/e2sm_examples/kpm_e2sm/src/kpm/kpm_callbacks.cpp @@ -50,6 +50,8 @@ extern "C" { #include #include +#include "viavi_connector.hpp" + using json = nlohmann::json; using namespace std; @@ -146,12 +148,19 @@ void get_cell_id(uint8_t *nrcellid_buf, char *cid_return_buf) { } -void run_report_loop(long requestorId, long instanceId, long ranFunctionId, long actionId) { +void run_report_loop(long requestorId, long instanceId, long ranFunctionId, long actionId) +{ + std::filebuf reports_json; + std::streambuf *input_filebuf = &reports_json; - std::ifstream input("/playpen/src/reports.json"); - bool x = input.good(); + std::unique_ptr viavi_connector; + if (!reports_json.open("/playpen/src/reports.json", std::ios::in)) { + std::cerr << "Can't open reports.json, enabling VIAVI connector instead..." << endl; + viavi_connector.reset(new viavi::RICTesterReceiver {3001, nullptr}); + input_filebuf = viavi_connector->get_data_filebuf(); + } - fprintf(stderr, "%s\n", x ? "true" : "false"); + std::istream input {input_filebuf}; long seqNum = 1;