X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=e2sim%2Fe2sm_examples%2Fkpm_e2sm%2Fsrc%2Fkpm%2Fkpm_callbacks.cpp;h=26958b69ab56898bbca26cf59a028d7ff5552851;hb=88de94233a1b3b09cc91e3b557c825ac1a80dacb;hp=3f0d0134d9aa3a672d3a84786fa25212326281e3;hpb=a9733dbcc47e93a3b2843056f1d587196296c324;p=sim%2Fe2-interface.git 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 3f0d013..26958b6 100644 --- a/e2sim/e2sm_examples/kpm_e2sm/src/kpm/kpm_callbacks.cpp +++ b/e2sim/e2sm_examples/kpm_e2sm/src/kpm/kpm_callbacks.cpp @@ -29,6 +29,8 @@ extern "C" { #include "E2SM-KPM-IndicationMessage.h" #include "FQIPERSlicesPerPlmnListItem.h" #include "E2SM-KPM-RANfunction-Description.h" + #include "E2SM-KPM-IndicationHeader-Format1.h" + #include "E2SM-KPM-IndicationHeader.h" #include "Timestamp.h" #include "E2AP-PDU.h" #include "RICsubscriptionRequest.h" @@ -46,7 +48,9 @@ extern "C" { #include #include +#include +#include "viavi_connector.hpp" using json = nlohmann::json; @@ -58,15 +62,28 @@ E2Sim e2sim; int main(int argc, char* argv[]) { - asn_codec_ctx_t *opt_cod; + fprintf(stderr, "Starting KPM processor sim"); + + fprintf(stderr, "JSON Test\n"); + + uint8_t *nrcellid_buf = (uint8_t*)calloc(1,5); + nrcellid_buf[0] = 0x22; + nrcellid_buf[1] = 0x5B; + nrcellid_buf[2] = 0xD6; + nrcellid_buf[3] = 0x00; + nrcellid_buf[4] = 0x70; + + + asn_codec_ctx_t *opt_cod; + E2SM_KPM_RANfunction_Description_t *ranfunc_desc = (E2SM_KPM_RANfunction_Description_t*)calloc(1,sizeof(E2SM_KPM_RANfunction_Description_t)); encode_kpm_function_description(ranfunc_desc); - + uint8_t e2smbuffer[8192]; size_t e2smbuffer_size = 8192; - + asn_enc_rval_t er = asn_encode_to_buffer(opt_cod, ATS_ALIGNED_BASIC_PER, @@ -76,12 +93,12 @@ int main(int argc, char* argv[]) { fprintf(stderr, "er encded is %d\n", er.encoded); fprintf(stderr, "after encoding message\n"); fprintf(stderr, "here is encoded message %s\n", e2smbuffer); - + uint8_t *ranfuncdesc = (uint8_t*)calloc(1,er.encoded); memcpy(ranfuncdesc, e2smbuffer, er.encoded); - + printf("this is the char array %s\n", (char*)ranfuncdesc); - + OCTET_STRING_t *ranfunc_ostr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t)); ranfunc_ostr->buf = (uint8_t*)calloc(1,er.encoded); ranfunc_ostr->size = er.encoded; @@ -100,440 +117,591 @@ int main(int argc, char* argv[]) { printf("value of this index is %d\n", ranfuncdesc[100]); printf("value of this index is %d\n", ranfuncdesc[101]); - e2sim.register_e2sm(1,ranfunc_ostr); - e2sim.register_subscription_callback(1,&callback_kpm_subscription_request); + e2sim.register_e2sm(0,ranfunc_ostr); + e2sim.register_subscription_callback(0,&callback_kpm_subscription_request); e2sim.run_loop(argc, argv); } -void run_report_loop(long requestorId, long instanceId, long ranFunctionId, long actionId) { +void get_cell_id(uint8_t *nrcellid_buf, char *cid_return_buf) { - //Process simulation file + uint8_t nr0 = nrcellid_buf[0] >> 4; + uint8_t nr1 = nrcellid_buf[0] << 4; + nr1 = nr1 >> 4; - ifstream simfile; - string line; - - long seqNum = 1; - - simfile.open("simulation.txt", ios::in); - - cout << "step1" << endl; - - std::ifstream ue_stream("ueMeasReport.txt"); - std::ifstream cell_stream("cellMeasReport.txt"); - - json all_ues_json; - - ue_stream >> all_ues_json; - - json all_cells_json; - - cell_stream >> all_cells_json; - - asn_codec_ctx_t *opt_cod; - - cout << "UE RF Measurements" << endl; - cout << "******************" << endl; - - int numMeasReports = (all_ues_json["/ueMeasReport/ueMeasReportList"_json_pointer]).size(); - - for (int i = 0; i < numMeasReports; i++) { - int nextCellId; - int nextRsrp; - int nextRsrq; - int nextRssinr; - cout << "UE number " + i << endl; - cout << "**********" << endl; - json::json_pointer p1(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/nrCellIdentity"); - nextCellId = all_ues_json[p1].get(); - cout << "Serving Cell " << nextCellId << endl; - - json::json_pointer p2(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/servingCellRfReport/rsrp"); - nextRsrp = all_ues_json[p2].get(); - cout << " RSRP " << nextRsrp << endl; - json::json_pointer p3(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/servingCellRfReport/rsrq"); - nextRsrq = all_ues_json[p3].get(); - cout << " RSRQ " << nextRsrq << endl; - json::json_pointer p4(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/servingCellRfReport/rssinr"); - nextRssinr = all_ues_json[p4].get(); - cout << " RSSINR " << nextRssinr << endl; - - json::json_pointer p5(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/neighbourCellList"); - - int numNeighborCells = (all_ues_json[p5]).size(); - - - //REPORT Message 3 -- Encode and send OCUCP user-level report - - E2SM_KPM_IndicationMessage_t *ind_msg3 = - (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t)); - E2AP_PDU *pdu3 = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU)); - - uint8_t *crnti_buf = (uint8_t*)calloc(1,2); - - if (nextCellId == 0) { - uint8_t *buf2 = (uint8_t*)"12"; - memcpy(crnti_buf, buf2, 2); - } else if (nextCellId == 1) { - uint8_t *buf2 = (uint8_t*)"22"; - memcpy(crnti_buf, buf2, 2); - } + uint8_t nr2 = nrcellid_buf[1] >> 4; + uint8_t nr3 = nrcellid_buf[1] << 4; + nr3 = nr3 >> 4; - std::string serving_str = "{\"rsrp\": " + std::to_string(nextRsrp) + ", \"rsrq\": " + - std::to_string(nextRsrq) + ", \"rssinr\": " + std::to_string(nextRssinr) + "}"; - const uint8_t *serving_buf = reinterpret_cast(serving_str.c_str()); - - std::string neighbor_str = "["; - - int nextNbCell; - int nextNbRsrp; - int nextNbRsrq; - int nextNbRssinr; - - for (int j = 0; j < numNeighborCells; j++) { - json::json_pointer p8(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/neighbourCellList/" + std::to_string(j) + "/nbCellIdentity"); - nextNbCell = all_ues_json[p8].get(); - cout << "Neighbor Cell " << all_ues_json[p8] << endl; - json::json_pointer p9(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) - +"/neighbourCellList/" + std::to_string(j) + "/nbCellRfReport/rsrp"); - nextNbRsrp = all_ues_json[p9].get(); - cout << " RSRP " << nextNbRsrp << endl; - - json::json_pointer p10(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) - +"/neighbourCellList/" + std::to_string(j) + "/nbCellRfReport/rsrq"); - nextNbRsrq = all_ues_json[p10].get(); - cout << " RSRQ " << nextNbRsrq << endl; - - json::json_pointer p11(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) - +"/neighbourCellList/" + std::to_string(j) + "/nbCellRfReport/rssinr"); - nextNbRssinr = all_ues_json[p11].get(); - cout << " RSSINR " << nextNbRssinr << endl; - - if (j != 0) { - neighbor_str += ","; + uint8_t nr4 = nrcellid_buf[2] >> 4; + uint8_t nr5 = nrcellid_buf[2] << 4; + nr5 = nr5 >> 4; - } + uint8_t nr6 = nrcellid_buf[3] >> 4; + uint8_t nr7 = nrcellid_buf[3] << 4; + nr7 = nr7 >> 4; - neighbor_str += "{\"CID\" : \"" + std::to_string(nextNbCell) + "\", \"Cell-RF\" : \"{\"rsrp\": " + std::to_string(nextNbRsrp) + - ", \"rsrq\": " + std::to_string(nextNbRsrq) + ", \"rssinr\": " + std::to_string(nextNbRssinr) + "}}"; - - } + uint8_t nr8 = nrcellid_buf[4] >> 4; + + sprintf(cid_return_buf, "373437%d%d%d%d%d%d%d%d%d", nr0,nr1,nr2,nr3,nr4,nr5,nr6,nr7,nr8); - neighbor_str += "]"; - - const uint8_t *neighbor_buf = reinterpret_cast(neighbor_str.c_str()); - - printf("Neighbor string\n%s", neighbor_buf); +} - uint8_t *plmnid_buf = (uint8_t*)"747"; - uint8_t *nrcellid_buf = (uint8_t*)"12340"; - - encode_kpm_report_rancontainer_cucp_parameterized(ind_msg3, plmnid_buf, nrcellid_buf, crnti_buf, serving_buf, neighbor_buf); - - uint8_t e2smbuffer3[8192]; - size_t e2smbuffer_size3 = 8192; +void run_report_loop(long requestorId, long instanceId, long ranFunctionId, long actionId) +{ + std::filebuf reports_json; + std::streambuf *input_filebuf = &reports_json; - - asn_enc_rval_t er3 = asn_encode_to_buffer(opt_cod, - ATS_ALIGNED_BASIC_PER, - &asn_DEF_E2SM_KPM_IndicationMessage, - ind_msg3, e2smbuffer3, e2smbuffer_size3); - - fprintf(stderr, "er encded is %d\n", er3.encoded); - fprintf(stderr, "after encoding message\n"); - uint8_t *e2smheader_buf3 = (uint8_t*)"header"; - - e2sim.generate_e2apv1_indication_request_parameterized(pdu3, requestorId, - instanceId, ranFunctionId, - actionId, seqNum, e2smheader_buf3, 6, e2smbuffer3, er3.encoded); - - e2sim.encode_and_send_sctp_data(pdu3); - - seqNum++; - + 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(); } + std::istream input {input_filebuf}; - cout << "Cell Measurements" << endl; - cout << "******************" << endl; - - int numCellMeasReports = (all_cells_json["/cellMeasReport/cellMeasReportList"_json_pointer]).size(); + long seqNum = 1; - uint8_t *sst_buf = (uint8_t*)"1"; - uint8_t *sd_buf = (uint8_t*)"100"; - uint8_t *plmnid_buf = (uint8_t*)"747"; + std::string str; - for (int i = 0; i < numCellMeasReports; i++) { - - int nextCellId; - int nextPdcpBytesDL; - int nextPdcpBytesUL; - int nextPRBBytesDL; - int nextPRBBytesUL; - - json::json_pointer p1(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/nrCellIdentity"); - nextCellId = all_cells_json[p1].get(); - cout << std::string("Cell number ") << nextCellId << endl; - - cout << "**********" << endl; - - json::json_pointer p2(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/pdcpByteMeasReport/pdcpBytesDl"); - nextPdcpBytesDL = all_cells_json[p2].get(); - cout << std::string(" PDCP Bytes DL ") << nextPdcpBytesDL << endl; - - json::json_pointer p3(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/pdcpByteMeasReport/pdcpBytesUl"); - nextPdcpBytesUL = all_cells_json[p3].get(); - cout << std::string(" PDCP Bytes UL ") << nextPdcpBytesUL << endl; - - uint8_t *buf = (uint8_t*)"GNBCUUP5"; - - int bytes_dl = nextPdcpBytesDL; - - int bytes_ul = nextPdcpBytesUL; - - // int bytes_dl = 3905; - // int bytes_ul = 1609321; - - E2SM_KPM_IndicationMessage_t *ind_msg2 = - (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t)); - E2AP_PDU *pdu2 = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU)); - - encode_kpm_report_style5_parameterized(ind_msg2 , buf, bytes_dl, bytes_ul, sst_buf, sd_buf, plmnid_buf); - - uint8_t e2smbuffer2[8192]; - size_t e2smbuffer_size2 = 8192; - - asn_enc_rval_t er2 = asn_encode_to_buffer(opt_cod, - ATS_ALIGNED_BASIC_PER, - &asn_DEF_E2SM_KPM_IndicationMessage, - ind_msg2, e2smbuffer2, e2smbuffer_size2); - - fprintf(stderr, "er encded is %d\n", er2.encoded); - fprintf(stderr, "after encoding message\n"); - uint8_t *e2smheader_buf2 = (uint8_t*)"header"; - - e2sim.generate_e2apv1_indication_request_parameterized(pdu2, requestorId, - instanceId, ranFunctionId, - actionId, seqNum, e2smheader_buf2, 6, e2smbuffer2, er2.encoded); - - e2sim.encode_and_send_sctp_data(pdu2); - - seqNum++; - - - - json::json_pointer p4(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/prbMeasReport/availPrbDl"); - nextPRBBytesDL = all_cells_json[p4].get(); - cout << std::string(" PRB Bytes DL ") << all_cells_json[p4] << endl; + while ( getline(input, str) ) { - json::json_pointer p5(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/prbMeasReport/availPrbUl"); - nextPRBBytesUL = all_cells_json[p5].get(); - cout << std::string(" PRB Bytes UL ") << all_cells_json[p5] << endl; + json all_ues_json; + long fqival = 9; + long qcival = 9; - //REPORT Message 1 -- Encode and send ODU cell-level report - - E2SM_KPM_IndicationMessage_t *ind_msg1 = - (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t)); - E2AP_PDU *pdu = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU)); - - long fiveqi = 7; - - uint8_t *nrcellid_buf = (uint8_t*)"12340"; - long dl_prbs = nextPRBBytesDL; - long ul_prbs = nextPRBBytesUL; - - encode_kpm_report_style1_parameterized(ind_msg1, fiveqi, dl_prbs, ul_prbs, sst_buf, sd_buf, plmnid_buf, nrcellid_buf, &dl_prbs, &ul_prbs); - - uint8_t e2smbuffer[8192]; - size_t e2smbuffer_size = 8192; - - asn_enc_rval_t er = asn_encode_to_buffer(opt_cod, - ATS_ALIGNED_BASIC_PER, - &asn_DEF_E2SM_KPM_IndicationMessage, - ind_msg1, e2smbuffer, e2smbuffer_size); - - fprintf(stderr, "er encded is %d\n", er.encoded); - fprintf(stderr, "after encoding message\n"); - uint8_t *e2smheader_buf = (uint8_t*)"header"; - - uint8_t *cpid_buf = (uint8_t*)"CPID"; - - fprintf(stderr, "About to encode Indication\n"); - e2sim.generate_e2apv1_indication_request_parameterized(pdu, requestorId, - instanceId, ranFunctionId, - actionId, seqNum, e2smheader_buf, 6, e2smbuffer, er.encoded); - - e2sim.encode_and_send_sctp_data(pdu); - - seqNum++; + uint8_t *plmnid_buf = (uint8_t*)"747"; + uint8_t *sst_buf = (uint8_t*)"1"; + uint8_t *sd_buf = (uint8_t*)"100"; - } - - - /* - if (simfile.is_open()) { - while (getline(simfile, line)) { - cout << line << "\n"; + fprintf(stderr,"De line is %s\n", str.c_str()); - //REPORT Message 1 -- Encode and send ODU cell-level report + bool valid = false; - E2SM_KPM_IndicationMessage_t *ind_msg1 = - (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t)); - E2AP_PDU *pdu = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU)); - - long fiveqi = 7; - uint8_t *sst_buf = (uint8_t*)"1"; - uint8_t *sd_buf = (uint8_t*)"100"; - uint8_t *plmnid_buf = (uint8_t*)"747"; - uint8_t *nrcellid_buf = (uint8_t*)"12340"; - long dl_prbs = 100; - long ul_prbs = 50; - - encode_kpm_report_style1_parameterized(ind_msg1, fiveqi, dl_prbs, ul_prbs, sst_buf, sd_buf, plmnid_buf, nrcellid_buf, &dl_prbs, &ul_prbs); - - uint8_t e2smbuffer[8192]; - size_t e2smbuffer_size = 8192; - asn_codec_ctx_t *opt_cod; - - asn_enc_rval_t er = asn_encode_to_buffer(opt_cod, - ATS_ALIGNED_BASIC_PER, - &asn_DEF_E2SM_KPM_IndicationMessage, - ind_msg1, e2smbuffer, e2smbuffer_size); - - fprintf(stderr, "er encded is %d\n", er.encoded); - fprintf(stderr, "after encoding message\n"); - uint8_t *e2smheader_buf = (uint8_t*)"header"; + try { + all_ues_json = json::parse(str); - uint8_t *cpid_buf = (uint8_t*)"CPID"; - - fprintf(stderr, "About to encode Indication\n"); - generate_e2apv1_indication_request_parameterized(pdu, requestorId, - instanceId, ranFunctionId, - actionId, seqNum, e2smheader_buf, 6, e2smbuffer, er.encoded); - - encode_and_send_sctp_data(pdu, socket_fd); - - seqNum++; - - //REPORT Message 2 -- Encode and send OCUUP cell-level report - - uint8_t *buf = (uint8_t*)"GNBCUUP5"; - - int bytes_dl = 40000; - int bytes_ul = 50000; - - E2SM_KPM_IndicationMessage_t *ind_msg2 = - (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t)); - E2AP_PDU *pdu2 = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU)); - - encode_kpm_report_style5_parameterized(ind_msg2 , buf, bytes_dl, bytes_ul, sst_buf, sd_buf, plmnid_buf); + valid = true; + } catch (...) { + fprintf(stderr, "Exception on reading json\n"); + } - uint8_t e2smbuffer2[8192]; - size_t e2smbuffer_size2 = 8192; + if (valid) { + fprintf(stderr, "key is valid\n"); - asn_enc_rval_t er2 = asn_encode_to_buffer(opt_cod, - ATS_ALIGNED_BASIC_PER, - &asn_DEF_E2SM_KPM_IndicationMessage, - ind_msg2, e2smbuffer2, e2smbuffer_size2); + std::string first_key = all_ues_json.begin().key(); + fprintf(stderr, "first key is %s\n", first_key.c_str()); - fprintf(stderr, "er encded is %d\n", er2.encoded); - fprintf(stderr, "after encoding message\n"); - uint8_t *e2smheader_buf2 = (uint8_t*)"header"; - - generate_e2apv1_indication_request_parameterized(pdu2, requestorId, - instanceId, ranFunctionId, - actionId, seqNum, e2smheader_buf2, 6, e2smbuffer2, er2.encoded); + if (first_key.compare("ueMeasReport") == 0) { + + fprintf(stderr, "it is equal to ue meas report\n"); - encode_and_send_sctp_data(pdu2, socket_fd); + int numMeasReports = (all_ues_json["/ueMeasReport/ueMeasReportList"_json_pointer]).size(); + - seqNum++; - - //REPORT Message 3 -- Encode and send OCUCP user-level report - - E2SM_KPM_IndicationMessage_t *ind_msg3 = - (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t)); - E2AP_PDU *pdu3 = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU)); - - uint8_t *crnti_buf = (uint8_t*)"12"; - // uint8_t *serving_buf = (uint8_t*)"RSRP10"; - //uint8_t *neighbor_buf = (uint8_t*)"-10,-15"; - int rsrpServ = 10; - int rsrqServ = 0; - int rssinrServ = 0; - - std::string serving_str = "{\"rsrp\": " + std::to_string(rsrpServ) + ", \"rsrq\": " + - std::to_string(rsrqServ) + ", \"rssinr\": " + std::to_string(rssinrServ) + "}"; - const uint8_t *serving_buf = reinterpret_cast(serving_str.c_str()); - - - neighbor_cell_entry n_entries[3]; - n_entries[0] = {"123", 10, 0, 0}; - n_entries[1] = {"456", 10, 0, 0}; - n_entries[2] = {"789", 10, 0, 0}; - - std::string neighbor_str = "["; - - for (int i=0; i < sizeof(n_entries)/sizeof(n_entries[0]); i++) { - - if (i != 0) { - neighbor_str += ","; + for (int i = 0; i < numMeasReports; i++) { + int nextCellId; + int nextRsrp; + int nextRsrq; + int nextRssinr; + float tput; + int prb_usage; + std::string ueId; + + fprintf(stderr,"UE number %d\n", i); + + json::json_pointer p001(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/ue-id"); + ueId = all_ues_json[p001].get(); + fprintf(stderr, "UEID %s\n", ueId.c_str()); + + json::json_pointer p0(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/throughput"); + tput = all_ues_json[p0].get(); + fprintf(stderr, "Throughput %f\n", tput); + + json::json_pointer p00(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/prb_usage"); + prb_usage = all_ues_json[p00].get(); + fprintf(stderr, "Throughput %d\n", prb_usage); + + json::json_pointer p1(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/nrCellIdentity"); + nextCellId = all_ues_json[p1].get(); + fprintf(stderr, "Serving Cell %d\n",nextCellId); + + json::json_pointer p2(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/servingCellRfReport/rsrp"); + nextRsrp = all_ues_json[p2].get(); + fprintf(stderr," RSRP %d\n", nextRsrp); + + json::json_pointer p3(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/servingCellRfReport/rsrq"); + nextRsrq = all_ues_json[p3].get(); + fprintf(stderr," RSRQ %d\n",nextRsrq); + + json::json_pointer p4(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/servingCellRfReport/rssinr"); + nextRssinr = all_ues_json[p4].get(); + fprintf(stderr," RSSINR %d\n", nextRssinr); + + json::json_pointer p5(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/neighbourCellList"); + + uint8_t *crnti_buf = (uint8_t*)calloc(1,2); + + if (ueId.find("Pedestrian") != string::npos) { + std::string ind = ueId.substr(11); + fprintf(stderr, "ind is %s\n", ind.c_str()); + + int indval = std::stoi(ind); + + if (indval < 10) { + crnti_buf[1] = indval; + crnti_buf[0] = 0; + } else { + crnti_buf[0] = indval/10; + crnti_buf[1] = indval % 10; + } + + } else if (ueId.find("Car") != string::npos) { + crnti_buf[0] = 4; + crnti_buf[1] = 1; + } + + // uint8_t *buf2 = (uint8_t*)"12"; + + std::string serving_str = "{\"rsrp\": " + std::to_string(nextRsrp) + ", \"rsrq\": " + + std::to_string(nextRsrq) + ", \"rssinr\": " + std::to_string(nextRssinr) + "}"; + const uint8_t *serving_buf = reinterpret_cast(serving_str.c_str()); + + int numNeighborCells = (all_ues_json[p5]).size(); + + std::string neighbor_str = "["; + + int nextNbCell; + int nextNbRsrp; + int nextNbRsrq; + int nextNbRssinr; + + for (int j = 0; j < numNeighborCells; j++) { + json::json_pointer p8(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/neighbourCellList/" + std::to_string(j) + "/nbCellIdentity"); + nextNbCell = all_ues_json[p8].get(); + //cout << "Neighbor Cell " << all_ues_json[p8] << endl; + json::json_pointer p9(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) + +"/neighbourCellList/" + std::to_string(j) + "/nbCellRfReport/rsrp"); + nextNbRsrp = all_ues_json[p9].get(); + //cout << " RSRP " << nextNbRsrp << endl; + + json::json_pointer p10(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) + +"/neighbourCellList/" + std::to_string(j) + "/nbCellRfReport/rsrq"); + nextNbRsrq = all_ues_json[p10].get(); + //cout << " RSRQ " << nextNbRsrq << endl; + + json::json_pointer p11(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) + +"/neighbourCellList/" + std::to_string(j) + "/nbCellRfReport/rssinr"); + nextNbRssinr = all_ues_json[p11].get(); + //cout << " RSSINR " << nextNbRssinr << endl; + + if (j != 0) { + neighbor_str += ","; + + } + + + uint8_t *neighbor_cellid_buf = (uint8_t*)calloc(1,5); + neighbor_cellid_buf[0] = 0x22; + neighbor_cellid_buf[1] = 0x5B; + neighbor_cellid_buf[2] = 0xD6; + neighbor_cellid_buf[3] = nextNbCell; + neighbor_cellid_buf[4] = 0x70; + + char *cid_buf = (char*)calloc(1,24); + get_cell_id(neighbor_cellid_buf,cid_buf); + + + neighbor_str += "{\"CID\" : \"" + std::string(cid_buf) + "\", \"Cell-RF\" : {\"rsrp\": " + std::to_string(nextNbRsrp) + + ", \"rsrq\": " + std::to_string(nextNbRsrq) + ", \"rssinr\": " + std::to_string(nextNbRssinr) + "}}"; + + } + + neighbor_str += "]"; + + fprintf(stderr,"This is neighbor str %s\n", neighbor_str.c_str()); + + //Creating UE-level RAN-Container CUCP message + + fprintf(stderr,"Creating UE-level RAN-Container CUCP message\n"); + + const uint8_t *neighbor_buf = reinterpret_cast(neighbor_str.c_str()); + + + uint8_t *nrcellid_buf = (uint8_t*)calloc(1,5); + nrcellid_buf[0] = 0x22; + nrcellid_buf[1] = 0x5B; + nrcellid_buf[2] = 0xD6; + nrcellid_buf[3] = nextCellId; + nrcellid_buf[4] = 0x70; + + uint8_t *gnbid_buf = (uint8_t*)calloc(1,3); + gnbid_buf[0] = 0x22; + gnbid_buf[1] = 0x5B; + gnbid_buf[2] = 0xD6; + + uint8_t cuupid_buf[1]; + cuupid_buf[0] = 20000; + + uint8_t duid_buf[1]; + duid_buf[0] = 20000; + + uint8_t *cuupname_buf = (uint8_t*)"GNBCUUP5"; + + + E2SM_KPM_IndicationMessage_t *ind_msg_cucp_ue = + (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t)); + + encode_kpm_report_rancontainer_cucp_parameterized(ind_msg_cucp_ue, plmnid_buf, nrcellid_buf, crnti_buf, serving_buf, neighbor_buf); + + uint8_t e2sm_message_buf_cucp_ue[8192]; + size_t e2sm_message_buf_size_cucp_ue = 8192; + + asn_codec_ctx_t *opt_cod; + + + asn_enc_rval_t er_message_cucp_ue = asn_encode_to_buffer(opt_cod, + ATS_ALIGNED_BASIC_PER, + &asn_DEF_E2SM_KPM_IndicationMessage, + ind_msg_cucp_ue, e2sm_message_buf_cucp_ue, e2sm_message_buf_size_cucp_ue); + + fprintf(stderr, "er encded is %d\n", er_message_cucp_ue.encoded); + fprintf(stderr, "after encoding message\n"); + + E2SM_KPM_IndicationHeader_t* ind_header_cucp_ue = + (E2SM_KPM_IndicationHeader_t*)calloc(1,sizeof(E2SM_KPM_IndicationHeader_t)); + encode_e2sm_kpm_indication_header(ind_header_cucp_ue, plmnid_buf, sst_buf, sd_buf, fqival, qcival, nrcellid_buf, gnbid_buf, 0, cuupid_buf, duid_buf, cuupname_buf); + fprintf(stderr, "Now printing xer outside of function call\n"); + xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationHeader, ind_header_cucp_ue); + + uint8_t e2sm_header_buf_cucp_ue[8192]; + size_t e2sm_header_buf_size_cucp_ue = 8192; + + asn_enc_rval_t er_header_cucp_ue = asn_encode_to_buffer(opt_cod, + ATS_ALIGNED_BASIC_PER, + &asn_DEF_E2SM_KPM_IndicationHeader, + ind_header_cucp_ue, e2sm_header_buf_cucp_ue, e2sm_header_buf_size_cucp_ue); + + fprintf(stderr, "er encded is %d\n", er_header_cucp_ue.encoded); + fprintf(stderr, "error buf is %s\n", (char*)e2sm_header_buf_cucp_ue); + fprintf(stderr, "after encoding header\n"); + + E2AP_PDU *pdu_cucp_ue = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU)); + + encoding::generate_e2apv1_indication_request_parameterized(pdu_cucp_ue, requestorId, + instanceId, ranFunctionId, + actionId, seqNum, e2sm_header_buf_cucp_ue, + er_header_cucp_ue.encoded, e2sm_message_buf_cucp_ue, + er_message_cucp_ue.encoded); + + + e2sim.encode_and_send_sctp_data(pdu_cucp_ue); + + seqNum++; + + std::this_thread::sleep_for (std::chrono::milliseconds(50)); + + //Creating UE-level RAN-Container CUUP message + + fprintf(stderr,"Creating UE-level RAN-Container CUUP message\n"); + + E2SM_KPM_IndicationMessage_t *ind_msg_cuup_ue = + (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t)); + + long bytes = (long)(tput * 100); + + encode_kpm_report_rancontainer_cuup_parameterized(ind_msg_cuup_ue, plmnid_buf, nrcellid_buf, crnti_buf, bytes, 0); + + uint8_t e2sm_message_buf_cuup_ue[8192]; + size_t e2sm_message_buf_size_cuup_ue = 8192; + + asn_codec_ctx_t *opt_cod2; + + + asn_enc_rval_t er_message_cuup_ue = asn_encode_to_buffer(opt_cod2, + ATS_ALIGNED_BASIC_PER, + &asn_DEF_E2SM_KPM_IndicationMessage, + ind_msg_cuup_ue, e2sm_message_buf_cuup_ue, e2sm_message_buf_size_cuup_ue); + + fprintf(stderr, "er encded is %d\n", er_message_cuup_ue.encoded); + fprintf(stderr, "after encoding message\n"); + + E2SM_KPM_IndicationHeader_t* ind_header_cuup_ue = + (E2SM_KPM_IndicationHeader_t*)calloc(1,sizeof(E2SM_KPM_IndicationHeader_t)); + encode_e2sm_kpm_indication_header(ind_header_cuup_ue, plmnid_buf, sst_buf, sd_buf, fqival, qcival, nrcellid_buf, gnbid_buf, 0, cuupid_buf, duid_buf, cuupname_buf); + + uint8_t e2sm_header_buf_cuup_ue[8192]; + size_t e2sm_header_buf_size_cuup_ue = 8192; + + asn_enc_rval_t er_header_cuup_ue = asn_encode_to_buffer(opt_cod, + ATS_ALIGNED_BASIC_PER, + &asn_DEF_E2SM_KPM_IndicationHeader, + ind_header_cuup_ue, e2sm_header_buf_cuup_ue, e2sm_header_buf_size_cuup_ue); + + + E2AP_PDU *pdu_cuup_ue = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU)); + + encoding::generate_e2apv1_indication_request_parameterized(pdu_cuup_ue, requestorId, + instanceId, ranFunctionId, + actionId, seqNum, e2sm_header_buf_cuup_ue, + er_header_cuup_ue.encoded, + e2sm_message_buf_cuup_ue, er_message_cuup_ue.encoded); + + e2sim.encode_and_send_sctp_data(pdu_cuup_ue); + + seqNum++; + + std::this_thread::sleep_for (std::chrono::milliseconds(50)); + + //Creating UE-level RAN-Container DU message + + fprintf(stderr,"Creating UE-level RAN-Container DU message\n"); + + E2SM_KPM_IndicationMessage_t *ind_message_du_ue = + (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t)); + + encode_kpm_report_rancontainer_du_parameterized(ind_message_du_ue, + plmnid_buf, nrcellid_buf, crnti_buf, prb_usage, 0); + + uint8_t e2sm_message_buf_du_ue[8192]; + size_t e2sm_message_buf_size_du_ue = 8192; + + asn_codec_ctx_t *opt_cod3; + + + asn_enc_rval_t er_message_du_ue = asn_encode_to_buffer(opt_cod3, + ATS_ALIGNED_BASIC_PER, + &asn_DEF_E2SM_KPM_IndicationMessage, + ind_message_du_ue, + e2sm_message_buf_du_ue, + e2sm_message_buf_size_du_ue); + + fprintf(stderr, "er encded is %d\n", er_message_du_ue.encoded); + fprintf(stderr, "after encoding message\n"); + + E2SM_KPM_IndicationHeader_t* ind_header_du_ue = + (E2SM_KPM_IndicationHeader_t*)calloc(1,sizeof(E2SM_KPM_IndicationHeader_t)); + encode_e2sm_kpm_indication_header(ind_header_du_ue, plmnid_buf, sst_buf, sd_buf, fqival, qcival, nrcellid_buf, gnbid_buf, 0, cuupid_buf, duid_buf, cuupname_buf); + + uint8_t e2sm_header_buf_du_ue[8192]; + size_t e2sm_header_buf_size_du_ue = 8192; + + asn_enc_rval_t er_header_du_ue = asn_encode_to_buffer(opt_cod, + ATS_ALIGNED_BASIC_PER, + &asn_DEF_E2SM_KPM_IndicationHeader, + ind_header_du_ue, e2sm_header_buf_du_ue, + e2sm_header_buf_size_du_ue); + + + E2AP_PDU *pdu_du_ue = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU)); + + encoding::generate_e2apv1_indication_request_parameterized(pdu_du_ue, requestorId, + instanceId, ranFunctionId, + actionId, seqNum, + e2sm_header_buf_du_ue, er_header_du_ue.encoded, + e2sm_message_buf_du_ue, er_message_du_ue.encoded); + + e2sim.encode_and_send_sctp_data(pdu_du_ue); + + seqNum++; + + std::this_thread::sleep_for (std::chrono::milliseconds(50)); + + fprintf(stderr, "done with ue meas report\n"); } - neighbor_str += "{\"CID\" : \"" + std::string(n_entries[i].cellid) + "\", \"Cell-RF\" : \"{\"rsrp\": " + std::to_string(n_entries[i].rsrp) + - ", \"rsrq\": " + std::to_string(n_entries[i].rsrq) + ", \"rssinr\": " + std::to_string(n_entries[i].rsrp) + "}}"; - } - - neighbor_str += "]"; - - const uint8_t *neighbor_buf = reinterpret_cast(neighbor_str.c_str()); - - printf("Neighbor string\n%s", neighbor_buf); - - encode_kpm_report_rancontainer_cucp_parameterized(ind_msg3, plmnid_buf, nrcellid_buf, crnti_buf, serving_buf, neighbor_buf); - - uint8_t e2smbuffer3[8192]; - size_t e2smbuffer_size3 = 8192; - - asn_enc_rval_t er3 = asn_encode_to_buffer(opt_cod, - ATS_ALIGNED_BASIC_PER, - &asn_DEF_E2SM_KPM_IndicationMessage, - ind_msg3, e2smbuffer3, e2smbuffer_size3); - - fprintf(stderr, "er encded is %d\n", er3.encoded); - fprintf(stderr, "after encoding message\n"); - uint8_t *e2smheader_buf3 = (uint8_t*)"header"; - - generate_e2apv1_indication_request_parameterized(pdu3, requestorId, - instanceId, ranFunctionId, - actionId, seqNum, e2smheader_buf3, 6, e2smbuffer3, er3.encoded); - - encode_and_send_sctp_data(pdu3, socket_fd); - - seqNum++; - - //Encode and send OCUUP user-level report - - - - //Encode and send ODU user-level report - - + + } else if (first_key.compare("cellMeasReport") == 0) { - + fprintf(stderr, "it is equal to cell meas report\n"); + + int numMeasReports = (all_ues_json["/cellMeasReport/cellMeasReportList"_json_pointer]).size(); + + for (int i = 0; i < numMeasReports; i++) { + int nextCellId; + + float bytes_dl; + float bytes_ul; + int prb_dl; + int prb_ul; + int cellid; + + fprintf(stderr,"UE number %d\n", i); + + json::json_pointer p00(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/nrCellIdentity"); + cellid = all_ues_json[p00].get(); + fprintf(stderr, "Cell ID %d\n", cellid); + + json::json_pointer p0(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/pdcpByteMeasReport/pdcpBytesDl"); + bytes_dl = all_ues_json[p0].get(); + fprintf(stderr, "Bytes DL %f\n", bytes_dl); + + json::json_pointer p1(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/pdcpByteMeasReport/pdcpBytesUl"); + bytes_ul = all_ues_json[p1].get(); + fprintf(stderr, "Bytes UL %f\n", bytes_ul); + + json::json_pointer p2(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/prbMeasReport/availPrbDl"); + prb_dl = all_ues_json[p2].get(); + fprintf(stderr, "Avail PRB DL %d\n", prb_dl); + + json::json_pointer p3(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/prbMeasReport/availPrbUl"); + prb_ul = all_ues_json[p3].get(); + fprintf(stderr, "Avail PRB UL %d\n", prb_ul); + + + uint8_t *sst_buf = (uint8_t*)"1"; + uint8_t *sd_buf = (uint8_t*)"100"; + uint8_t *plmnid_buf = (uint8_t*)"747"; + + uint8_t *nrcellid_buf = (uint8_t*)calloc(1,5); + nrcellid_buf[0] = 0x22; + nrcellid_buf[1] = 0x5B; + nrcellid_buf[2] = 0xD6; + nrcellid_buf[3] = cellid; + nrcellid_buf[4] = 0x70; + + uint8_t *gnbid_buf = (uint8_t*)calloc(1,3); + gnbid_buf[0] = 0x22; + gnbid_buf[1] = 0x5B; + gnbid_buf[2] = 0xD6; + + uint8_t cuupid_buf[1]; + cuupid_buf[0] = 20000; + + uint8_t duid_buf[1]; + duid_buf[0] = 20000; + + uint8_t *cuupname_buf = (uint8_t*)"GNBCUUP5"; + + + //Encoding Style 5 Message Body + + fprintf(stderr, "Encoding Style 5 Message body\n"); + + asn_codec_ctx_t *opt_cod; + + E2SM_KPM_IndicationMessage_t *ind_msg_style5 = + (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t)); + E2AP_PDU *pdu_style5 = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU)); + + encode_kpm_report_style5_parameterized(ind_msg_style5 , cuupname_buf, bytes_dl, bytes_ul, sst_buf, sd_buf, plmnid_buf); + + uint8_t e2sm_message_buf_style5[8192]; + size_t e2sm_message_buf_size_style5 = 8192; + + asn_enc_rval_t er_message_style5 = asn_encode_to_buffer(opt_cod, + ATS_ALIGNED_BASIC_PER, + &asn_DEF_E2SM_KPM_IndicationMessage, + ind_msg_style5, e2sm_message_buf_style5, e2sm_message_buf_size_style5); + + fprintf(stderr, "er encded is %d\n", er_message_style5.encoded); + fprintf(stderr, "after encoding message\n"); + + int seqNum0 = 1; + + + E2SM_KPM_IndicationHeader_t* ind_header_style5 = + (E2SM_KPM_IndicationHeader_t*)calloc(1,sizeof(E2SM_KPM_IndicationHeader_t)); + encode_e2sm_kpm_indication_header(ind_header_style5, plmnid_buf, sst_buf, sd_buf, fqival, qcival, nrcellid_buf, gnbid_buf, 0, cuupid_buf, duid_buf, cuupname_buf); + + uint8_t e2sm_header_buf_style5[8192]; + size_t e2sm_header_buf_size_style5 = 8192; + + asn_enc_rval_t er_header_style5 = asn_encode_to_buffer(opt_cod, + ATS_ALIGNED_BASIC_PER, + &asn_DEF_E2SM_KPM_IndicationHeader, + ind_header_style5, + e2sm_header_buf_style5, e2sm_header_buf_size_style5); + + + encoding::generate_e2apv1_indication_request_parameterized(pdu_style5, requestorId, + instanceId, ranFunctionId, + actionId, seqNum0, e2sm_header_buf_style5, + er_header_style5.encoded, e2sm_message_buf_style5, + er_message_style5.encoded); + + e2sim.encode_and_send_sctp_data(pdu_style5); + + seqNum++; + + std::this_thread::sleep_for (std::chrono::milliseconds(50)); + + + //Encoding Style 1 Message Body + + fprintf(stderr, "Encoding Style 1 Message body\n"); + asn_codec_ctx_t *opt_cod2; + + + E2SM_KPM_IndicationMessage_t *ind_message_style1 = + (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t)); + E2AP_PDU *pdu_style1 = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU)); + + long fiveqi = 7; + + + + long l_dl_prbs = prb_dl; + long l_ul_prbs = prb_ul; + + encode_kpm_report_style1_parameterized(ind_message_style1, fiveqi, + prb_dl, prb_ul, sst_buf, sd_buf, + plmnid_buf, nrcellid_buf, &l_dl_prbs, &l_ul_prbs); + + uint8_t e2sm_message_buf_style1[8192]; + size_t e2sm_message_buf_size_style1 = 8192; + + asn_enc_rval_t er_message_style1 = asn_encode_to_buffer(opt_cod2, + ATS_ALIGNED_BASIC_PER, + &asn_DEF_E2SM_KPM_IndicationMessage, + ind_message_style1, + e2sm_message_buf_style1, e2sm_message_buf_size_style1); + + fprintf(stderr, "er encded is %d\n", er_message_style1.encoded); + fprintf(stderr, "after encoding message\n"); + + + uint8_t *cpid_buf2 = (uint8_t*)"CPID"; + + fprintf(stderr, "About to encode Indication\n"); + + E2SM_KPM_IndicationHeader_t* ind_header_style1 = + (E2SM_KPM_IndicationHeader_t*)calloc(1,sizeof(E2SM_KPM_IndicationHeader_t)); + encode_e2sm_kpm_indication_header(ind_header_style1, plmnid_buf, sst_buf, sd_buf, fqival, qcival, nrcellid_buf, gnbid_buf, 0, cuupid_buf, duid_buf, cuupname_buf); + + uint8_t e2sm_header_buf_style1[8192]; + size_t e2sm_header_buf_size_style1 = 8192; + + asn_enc_rval_t er_header_style1 = asn_encode_to_buffer(opt_cod, + ATS_ALIGNED_BASIC_PER, + &asn_DEF_E2SM_KPM_IndicationHeader, + ind_header_style1, + e2sm_header_buf_style1, e2sm_header_buf_size_style1); + + encoding::generate_e2apv1_indication_request_parameterized(pdu_style1, requestorId, + instanceId, ranFunctionId, + actionId, seqNum, e2sm_header_buf_style1, + er_header_style1.encoded, + e2sm_message_buf_style1, er_message_style1.encoded); + + e2sim.encode_and_send_sctp_data(pdu_style1); + seqNum++; + std::this_thread::sleep_for (std::chrono::milliseconds(50)); + + } + } } - - simfile.close(); - } - */ - } + void callback_kpm_subscription_request(E2AP_PDU_t *sub_req_pdu) { + fprintf(stderr, "Calling callback_kpm_subscription_request\n"); //Record RIC Request ID //Go through RIC action to be Setup List @@ -568,11 +736,12 @@ void callback_kpm_subscription_request(E2AP_PDU_t *sub_req_pdu) { RICsubscriptionRequest_IEs_t *next_ie = ies[i]; pres = next_ie->value.present; - fprintf(stderr, "next present value %d\n", pres); + fprintf(stderr, "The next present value %d\n", pres); switch(pres) { case RICsubscriptionRequest_IEs__value_PR_RICrequestID: { + fprintf(stderr,"in case request id\n"); RICrequestID_t reqId = next_ie->value.choice.RICrequestID; long requestorId = reqId.ricRequestorID; long instanceId = reqId.ricInstanceID; @@ -584,13 +753,19 @@ void callback_kpm_subscription_request(E2AP_PDU_t *sub_req_pdu) { break; } case RICsubscriptionRequest_IEs__value_PR_RANfunctionID: - break; + { + fprintf(stderr,"in case ran func id\n"); + break; + } case RICsubscriptionRequest_IEs__value_PR_RICsubscriptionDetails: { - RICsubscriptionDetails_t subDetails = next_ie->value.choice.RICsubscriptionDetails; + fprintf(stderr,"in case subscription details\n"); + RICsubscriptionDetails_t subDetails = next_ie->value.choice.RICsubscriptionDetails; + fprintf(stderr,"in case subscription details 1\n"); RICeventTriggerDefinition_t triggerDef = subDetails.ricEventTriggerDefinition; + fprintf(stderr,"in case subscription details 2\n"); RICactions_ToBeSetup_List_t actionList = subDetails.ricAction_ToBeSetup_List; - + fprintf(stderr,"in case subscription details 3\n"); //We are ignoring the trigger definition //We identify the first action whose type is REPORT @@ -623,6 +798,11 @@ void callback_kpm_subscription_request(E2AP_PDU_t *sub_req_pdu) { break; } + default: + { + fprintf(stderr,"in case default\n"); + break; + } } } @@ -645,7 +825,7 @@ void callback_kpm_subscription_request(E2AP_PDU_t *sub_req_pdu) { int accept_size = actionIdsAccept.size(); int reject_size = actionIdsReject.size(); - e2sim.generate_e2apv1_subscription_response_success(e2ap_pdu, accept_array, reject_array, accept_size, reject_size, reqRequestorId, reqInstanceId); + encoding::generate_e2apv1_subscription_response_success(e2ap_pdu, accept_array, reject_array, accept_size, reject_size, reqRequestorId, reqInstanceId); e2sim.encode_and_send_sctp_data(e2ap_pdu); @@ -653,7 +833,7 @@ void callback_kpm_subscription_request(E2AP_PDU_t *sub_req_pdu) { // std::thread loop_thread; - long funcId = 1; + long funcId = 0; run_report_loop(reqRequestorId, reqInstanceId, funcId, reqActionId);