1 /*****************************************************************************
3 # Copyright 2020 AT&T Intellectual Property *
5 # Licensed under the Apache License, Version 2.0 (the "License"); *
6 # you may not use this file except in compliance with the License. *
7 # You may obtain a copy of the License at *
9 # http://www.apache.org/licenses/LICENSE-2.0 *
11 # Unless required by applicable law or agreed to in writing, software *
12 # distributed under the License is distributed on an "AS IS" BASIS, *
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 # See the License for the specific language governing permissions and *
15 # limitations under the License. *
17 ******************************************************************************/
26 #include "OCUCP-PF-Container.h"
27 #include "OCTET_STRING.h"
28 #include "asn_application.h"
29 #include "E2SM-KPM-IndicationMessage.h"
30 #include "FQIPERSlicesPerPlmnListItem.h"
31 #include "E2SM-KPM-RANfunction-Description.h"
32 #include "Timestamp.h"
34 #include "RICsubscriptionRequest.h"
35 #include "RICsubscriptionResponse.h"
36 #include "RICactionType.h"
37 #include "ProtocolIE-Field.h"
38 #include "ProtocolIE-SingleContainer.h"
39 #include "InitiatingMessage.h"
42 #include "kpm_callbacks.hpp"
43 #include "encode_kpm.hpp"
45 #include "encode_e2apv1.hpp"
47 #include <nlohmann/json.hpp>
51 using json = nlohmann::json;
59 int main(int argc, char* argv[]) {
61 asn_codec_ctx_t *opt_cod;
63 E2SM_KPM_RANfunction_Description_t *ranfunc_desc =
64 (E2SM_KPM_RANfunction_Description_t*)calloc(1,sizeof(E2SM_KPM_RANfunction_Description_t));
65 encode_kpm_function_description(ranfunc_desc);
67 uint8_t e2smbuffer[8192];
68 size_t e2smbuffer_size = 8192;
71 asn_encode_to_buffer(opt_cod,
72 ATS_ALIGNED_BASIC_PER,
73 &asn_DEF_E2SM_KPM_RANfunction_Description,
74 ranfunc_desc, e2smbuffer, e2smbuffer_size);
76 fprintf(stderr, "er encded is %d\n", er.encoded);
77 fprintf(stderr, "after encoding message\n");
78 fprintf(stderr, "here is encoded message %s\n", e2smbuffer);
80 uint8_t *ranfuncdesc = (uint8_t*)calloc(1,er.encoded);
81 memcpy(ranfuncdesc, e2smbuffer, er.encoded);
83 printf("this is the char array %s\n", (char*)ranfuncdesc);
85 OCTET_STRING_t *ranfunc_ostr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
86 ranfunc_ostr->buf = (uint8_t*)calloc(1,er.encoded);
87 ranfunc_ostr->size = er.encoded;
88 memcpy(ranfunc_ostr->buf,e2smbuffer,er.encoded);
90 printf("!!!lenth of ranfuncdesc is %d\n", strlen((char*)ranfuncdesc));
91 printf("value of this index is %d\n", ranfuncdesc[0]);
92 printf("value of this index is %d\n", ranfuncdesc[1]);
93 printf("value of this index is %d\n", ranfuncdesc[2]);
94 printf("value of this index is %d\n", ranfuncdesc[3]);
95 printf("value of this index is %d\n", ranfuncdesc[4]);
96 printf("value of this index is %d\n", ranfuncdesc[5]);
97 printf("value of this index is %d\n", ranfuncdesc[6]);
98 printf("value of this index is %d\n", ranfuncdesc[10]);
99 printf("value of this index is %d\n", ranfuncdesc[15]);
100 printf("value of this index is %d\n", ranfuncdesc[100]);
101 printf("value of this index is %d\n", ranfuncdesc[101]);
103 e2sim.register_e2sm(1,ranfunc_ostr);
104 e2sim.register_subscription_callback(1,&callback_kpm_subscription_request);
106 e2sim.run_loop(argc, argv);
110 void run_report_loop(long requestorId, long instanceId, long ranFunctionId, long actionId) {
112 //Process simulation file
119 simfile.open("simulation.txt", ios::in);
121 cout << "step1" << endl;
123 std::ifstream ue_stream("ueMeasReport.txt");
124 std::ifstream cell_stream("cellMeasReport.txt");
128 ue_stream >> all_ues_json;
132 cell_stream >> all_cells_json;
134 asn_codec_ctx_t *opt_cod;
136 cout << "UE RF Measurements" << endl;
137 cout << "******************" << endl;
139 int numMeasReports = (all_ues_json["/ueMeasReport/ueMeasReportList"_json_pointer]).size();
141 for (int i = 0; i < numMeasReports; i++) {
146 cout << "UE number " + i << endl;
147 cout << "**********" << endl;
148 json::json_pointer p1(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/nrCellIdentity");
149 nextCellId = all_ues_json[p1].get<int>();
150 cout << "Serving Cell " << nextCellId << endl;
152 json::json_pointer p2(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/servingCellRfReport/rsrp");
153 nextRsrp = all_ues_json[p2].get<int>();
154 cout << " RSRP " << nextRsrp << endl;
155 json::json_pointer p3(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/servingCellRfReport/rsrq");
156 nextRsrq = all_ues_json[p3].get<int>();
157 cout << " RSRQ " << nextRsrq << endl;
158 json::json_pointer p4(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/servingCellRfReport/rssinr");
159 nextRssinr = all_ues_json[p4].get<int>();
160 cout << " RSSINR " << nextRssinr << endl;
162 json::json_pointer p5(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/neighbourCellList");
164 int numNeighborCells = (all_ues_json[p5]).size();
167 //REPORT Message 3 -- Encode and send OCUCP user-level report
169 E2SM_KPM_IndicationMessage_t *ind_msg3 =
170 (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t));
171 E2AP_PDU *pdu3 = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU));
173 uint8_t *crnti_buf = (uint8_t*)calloc(1,2);
175 if (nextCellId == 0) {
176 uint8_t *buf2 = (uint8_t*)"12";
177 memcpy(crnti_buf, buf2, 2);
178 } else if (nextCellId == 1) {
179 uint8_t *buf2 = (uint8_t*)"22";
180 memcpy(crnti_buf, buf2, 2);
183 std::string serving_str = "{\"rsrp\": " + std::to_string(nextRsrp) + ", \"rsrq\": " +
184 std::to_string(nextRsrq) + ", \"rssinr\": " + std::to_string(nextRssinr) + "}";
185 const uint8_t *serving_buf = reinterpret_cast<const uint8_t*>(serving_str.c_str());
187 std::string neighbor_str = "[";
194 for (int j = 0; j < numNeighborCells; j++) {
195 json::json_pointer p8(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/neighbourCellList/" + std::to_string(j) + "/nbCellIdentity");
196 nextNbCell = all_ues_json[p8].get<int>();
197 cout << "Neighbor Cell " << all_ues_json[p8] << endl;
198 json::json_pointer p9(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i)
199 +"/neighbourCellList/" + std::to_string(j) + "/nbCellRfReport/rsrp");
200 nextNbRsrp = all_ues_json[p9].get<int>();
201 cout << " RSRP " << nextNbRsrp << endl;
203 json::json_pointer p10(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i)
204 +"/neighbourCellList/" + std::to_string(j) + "/nbCellRfReport/rsrq");
205 nextNbRsrq = all_ues_json[p10].get<int>();
206 cout << " RSRQ " << nextNbRsrq << endl;
208 json::json_pointer p11(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i)
209 +"/neighbourCellList/" + std::to_string(j) + "/nbCellRfReport/rssinr");
210 nextNbRssinr = all_ues_json[p11].get<int>();
211 cout << " RSSINR " << nextNbRssinr << endl;
218 neighbor_str += "{\"CID\" : \"" + std::to_string(nextNbCell) + "\", \"Cell-RF\" : \"{\"rsrp\": " + std::to_string(nextNbRsrp) +
219 ", \"rsrq\": " + std::to_string(nextNbRsrq) + ", \"rssinr\": " + std::to_string(nextNbRssinr) + "}}";
225 const uint8_t *neighbor_buf = reinterpret_cast<const uint8_t*>(neighbor_str.c_str());
227 printf("Neighbor string\n%s", neighbor_buf);
229 uint8_t *plmnid_buf = (uint8_t*)"747";
230 uint8_t *nrcellid_buf = (uint8_t*)"12340";
232 encode_kpm_report_rancontainer_cucp_parameterized(ind_msg3, plmnid_buf, nrcellid_buf, crnti_buf, serving_buf, neighbor_buf);
234 uint8_t e2smbuffer3[8192];
235 size_t e2smbuffer_size3 = 8192;
238 asn_enc_rval_t er3 = asn_encode_to_buffer(opt_cod,
239 ATS_ALIGNED_BASIC_PER,
240 &asn_DEF_E2SM_KPM_IndicationMessage,
241 ind_msg3, e2smbuffer3, e2smbuffer_size3);
243 fprintf(stderr, "er encded is %d\n", er3.encoded);
244 fprintf(stderr, "after encoding message\n");
245 uint8_t *e2smheader_buf3 = (uint8_t*)"header";
247 e2sim.generate_e2apv1_indication_request_parameterized(pdu3, requestorId,
248 instanceId, ranFunctionId,
249 actionId, seqNum, e2smheader_buf3, 6, e2smbuffer3, er3.encoded);
251 e2sim.encode_and_send_sctp_data(pdu3);
258 cout << "Cell Measurements" << endl;
259 cout << "******************" << endl;
261 int numCellMeasReports = (all_cells_json["/cellMeasReport/cellMeasReportList"_json_pointer]).size();
263 uint8_t *sst_buf = (uint8_t*)"1";
264 uint8_t *sd_buf = (uint8_t*)"100";
265 uint8_t *plmnid_buf = (uint8_t*)"747";
267 for (int i = 0; i < numCellMeasReports; i++) {
275 json::json_pointer p1(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/nrCellIdentity");
276 nextCellId = all_cells_json[p1].get<int>();
277 cout << std::string("Cell number ") << nextCellId << endl;
279 cout << "**********" << endl;
281 json::json_pointer p2(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/pdcpByteMeasReport/pdcpBytesDl");
282 nextPdcpBytesDL = all_cells_json[p2].get<int>();
283 cout << std::string(" PDCP Bytes DL ") << nextPdcpBytesDL << endl;
285 json::json_pointer p3(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/pdcpByteMeasReport/pdcpBytesUl");
286 nextPdcpBytesUL = all_cells_json[p3].get<int>();
287 cout << std::string(" PDCP Bytes UL ") << nextPdcpBytesUL << endl;
289 uint8_t *buf = (uint8_t*)"GNBCUUP5";
291 int bytes_dl = nextPdcpBytesDL;
293 int bytes_ul = nextPdcpBytesUL;
295 // int bytes_dl = 3905;
296 // int bytes_ul = 1609321;
298 E2SM_KPM_IndicationMessage_t *ind_msg2 =
299 (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t));
300 E2AP_PDU *pdu2 = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU));
302 encode_kpm_report_style5_parameterized(ind_msg2 , buf, bytes_dl, bytes_ul, sst_buf, sd_buf, plmnid_buf);
304 uint8_t e2smbuffer2[8192];
305 size_t e2smbuffer_size2 = 8192;
307 asn_enc_rval_t er2 = asn_encode_to_buffer(opt_cod,
308 ATS_ALIGNED_BASIC_PER,
309 &asn_DEF_E2SM_KPM_IndicationMessage,
310 ind_msg2, e2smbuffer2, e2smbuffer_size2);
312 fprintf(stderr, "er encded is %d\n", er2.encoded);
313 fprintf(stderr, "after encoding message\n");
314 uint8_t *e2smheader_buf2 = (uint8_t*)"header";
316 e2sim.generate_e2apv1_indication_request_parameterized(pdu2, requestorId,
317 instanceId, ranFunctionId,
318 actionId, seqNum, e2smheader_buf2, 6, e2smbuffer2, er2.encoded);
320 e2sim.encode_and_send_sctp_data(pdu2);
326 json::json_pointer p4(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/prbMeasReport/availPrbDl");
327 nextPRBBytesDL = all_cells_json[p4].get<int>();
328 cout << std::string(" PRB Bytes DL ") << all_cells_json[p4] << endl;
330 json::json_pointer p5(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/prbMeasReport/availPrbUl");
331 nextPRBBytesUL = all_cells_json[p5].get<int>();
332 cout << std::string(" PRB Bytes UL ") << all_cells_json[p5] << endl;
335 //REPORT Message 1 -- Encode and send ODU cell-level report
337 E2SM_KPM_IndicationMessage_t *ind_msg1 =
338 (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t));
339 E2AP_PDU *pdu = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU));
343 uint8_t *nrcellid_buf = (uint8_t*)"12340";
344 long dl_prbs = nextPRBBytesDL;
345 long ul_prbs = nextPRBBytesUL;
347 encode_kpm_report_style1_parameterized(ind_msg1, fiveqi, dl_prbs, ul_prbs, sst_buf, sd_buf, plmnid_buf, nrcellid_buf, &dl_prbs, &ul_prbs);
349 uint8_t e2smbuffer[8192];
350 size_t e2smbuffer_size = 8192;
352 asn_enc_rval_t er = asn_encode_to_buffer(opt_cod,
353 ATS_ALIGNED_BASIC_PER,
354 &asn_DEF_E2SM_KPM_IndicationMessage,
355 ind_msg1, e2smbuffer, e2smbuffer_size);
357 fprintf(stderr, "er encded is %d\n", er.encoded);
358 fprintf(stderr, "after encoding message\n");
359 uint8_t *e2smheader_buf = (uint8_t*)"header";
361 uint8_t *cpid_buf = (uint8_t*)"CPID";
363 fprintf(stderr, "About to encode Indication\n");
364 e2sim.generate_e2apv1_indication_request_parameterized(pdu, requestorId,
365 instanceId, ranFunctionId,
366 actionId, seqNum, e2smheader_buf, 6, e2smbuffer, er.encoded);
368 e2sim.encode_and_send_sctp_data(pdu);
376 if (simfile.is_open()) {
378 while (getline(simfile, line)) {
379 cout << line << "\n";
381 //REPORT Message 1 -- Encode and send ODU cell-level report
383 E2SM_KPM_IndicationMessage_t *ind_msg1 =
384 (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t));
385 E2AP_PDU *pdu = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU));
388 uint8_t *sst_buf = (uint8_t*)"1";
389 uint8_t *sd_buf = (uint8_t*)"100";
390 uint8_t *plmnid_buf = (uint8_t*)"747";
391 uint8_t *nrcellid_buf = (uint8_t*)"12340";
395 encode_kpm_report_style1_parameterized(ind_msg1, fiveqi, dl_prbs, ul_prbs, sst_buf, sd_buf, plmnid_buf, nrcellid_buf, &dl_prbs, &ul_prbs);
397 uint8_t e2smbuffer[8192];
398 size_t e2smbuffer_size = 8192;
399 asn_codec_ctx_t *opt_cod;
401 asn_enc_rval_t er = asn_encode_to_buffer(opt_cod,
402 ATS_ALIGNED_BASIC_PER,
403 &asn_DEF_E2SM_KPM_IndicationMessage,
404 ind_msg1, e2smbuffer, e2smbuffer_size);
406 fprintf(stderr, "er encded is %d\n", er.encoded);
407 fprintf(stderr, "after encoding message\n");
408 uint8_t *e2smheader_buf = (uint8_t*)"header";
410 uint8_t *cpid_buf = (uint8_t*)"CPID";
412 fprintf(stderr, "About to encode Indication\n");
413 generate_e2apv1_indication_request_parameterized(pdu, requestorId,
414 instanceId, ranFunctionId,
415 actionId, seqNum, e2smheader_buf, 6, e2smbuffer, er.encoded);
417 encode_and_send_sctp_data(pdu, socket_fd);
421 //REPORT Message 2 -- Encode and send OCUUP cell-level report
423 uint8_t *buf = (uint8_t*)"GNBCUUP5";
425 int bytes_dl = 40000;
426 int bytes_ul = 50000;
428 E2SM_KPM_IndicationMessage_t *ind_msg2 =
429 (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t));
430 E2AP_PDU *pdu2 = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU));
432 encode_kpm_report_style5_parameterized(ind_msg2 , buf, bytes_dl, bytes_ul, sst_buf, sd_buf, plmnid_buf);
434 uint8_t e2smbuffer2[8192];
435 size_t e2smbuffer_size2 = 8192;
438 asn_enc_rval_t er2 = asn_encode_to_buffer(opt_cod,
439 ATS_ALIGNED_BASIC_PER,
440 &asn_DEF_E2SM_KPM_IndicationMessage,
441 ind_msg2, e2smbuffer2, e2smbuffer_size2);
443 fprintf(stderr, "er encded is %d\n", er2.encoded);
444 fprintf(stderr, "after encoding message\n");
445 uint8_t *e2smheader_buf2 = (uint8_t*)"header";
447 generate_e2apv1_indication_request_parameterized(pdu2, requestorId,
448 instanceId, ranFunctionId,
449 actionId, seqNum, e2smheader_buf2, 6, e2smbuffer2, er2.encoded);
451 encode_and_send_sctp_data(pdu2, socket_fd);
455 //REPORT Message 3 -- Encode and send OCUCP user-level report
457 E2SM_KPM_IndicationMessage_t *ind_msg3 =
458 (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t));
459 E2AP_PDU *pdu3 = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU));
461 uint8_t *crnti_buf = (uint8_t*)"12";
462 // uint8_t *serving_buf = (uint8_t*)"RSRP10";
463 //uint8_t *neighbor_buf = (uint8_t*)"-10,-15";
468 std::string serving_str = "{\"rsrp\": " + std::to_string(rsrpServ) + ", \"rsrq\": " +
469 std::to_string(rsrqServ) + ", \"rssinr\": " + std::to_string(rssinrServ) + "}";
470 const uint8_t *serving_buf = reinterpret_cast<const uint8_t*>(serving_str.c_str());
473 neighbor_cell_entry n_entries[3];
474 n_entries[0] = {"123", 10, 0, 0};
475 n_entries[1] = {"456", 10, 0, 0};
476 n_entries[2] = {"789", 10, 0, 0};
478 std::string neighbor_str = "[";
480 for (int i=0; i < sizeof(n_entries)/sizeof(n_entries[0]); i++) {
485 neighbor_str += "{\"CID\" : \"" + std::string(n_entries[i].cellid) + "\", \"Cell-RF\" : \"{\"rsrp\": " + std::to_string(n_entries[i].rsrp) +
486 ", \"rsrq\": " + std::to_string(n_entries[i].rsrq) + ", \"rssinr\": " + std::to_string(n_entries[i].rsrp) + "}}";
491 const uint8_t *neighbor_buf = reinterpret_cast<const uint8_t*>(neighbor_str.c_str());
493 printf("Neighbor string\n%s", neighbor_buf);
495 encode_kpm_report_rancontainer_cucp_parameterized(ind_msg3, plmnid_buf, nrcellid_buf, crnti_buf, serving_buf, neighbor_buf);
497 uint8_t e2smbuffer3[8192];
498 size_t e2smbuffer_size3 = 8192;
500 asn_enc_rval_t er3 = asn_encode_to_buffer(opt_cod,
501 ATS_ALIGNED_BASIC_PER,
502 &asn_DEF_E2SM_KPM_IndicationMessage,
503 ind_msg3, e2smbuffer3, e2smbuffer_size3);
505 fprintf(stderr, "er encded is %d\n", er3.encoded);
506 fprintf(stderr, "after encoding message\n");
507 uint8_t *e2smheader_buf3 = (uint8_t*)"header";
509 generate_e2apv1_indication_request_parameterized(pdu3, requestorId,
510 instanceId, ranFunctionId,
511 actionId, seqNum, e2smheader_buf3, 6, e2smbuffer3, er3.encoded);
513 encode_and_send_sctp_data(pdu3, socket_fd);
517 //Encode and send OCUUP user-level report
521 //Encode and send ODU user-level report
535 void callback_kpm_subscription_request(E2AP_PDU_t *sub_req_pdu) {
538 //Record RIC Request ID
539 //Go through RIC action to be Setup List
540 //Find first entry with REPORT action Type
542 //Encode subscription response
544 RICsubscriptionRequest_t orig_req =
545 sub_req_pdu->choice.initiatingMessage->value.choice.RICsubscriptionRequest;
547 RICsubscriptionResponse_IEs_t *ricreqid =
548 (RICsubscriptionResponse_IEs_t*)calloc(1, sizeof(RICsubscriptionResponse_IEs_t));
550 int count = orig_req.protocolIEs.list.count;
551 int size = orig_req.protocolIEs.list.size;
553 RICsubscriptionRequest_IEs_t **ies = (RICsubscriptionRequest_IEs_t**)orig_req.protocolIEs.list.array;
555 fprintf(stderr, "count%d\n", count);
556 fprintf(stderr, "size%d\n", size);
558 RICsubscriptionRequest_IEs__value_PR pres;
564 std::vector<long> actionIdsAccept;
565 std::vector<long> actionIdsReject;
567 for (int i=0; i < count; i++) {
568 RICsubscriptionRequest_IEs_t *next_ie = ies[i];
569 pres = next_ie->value.present;
571 fprintf(stderr, "next present value %d\n", pres);
574 case RICsubscriptionRequest_IEs__value_PR_RICrequestID:
576 RICrequestID_t reqId = next_ie->value.choice.RICrequestID;
577 long requestorId = reqId.ricRequestorID;
578 long instanceId = reqId.ricInstanceID;
579 fprintf(stderr, "requestorId %d\n", requestorId);
580 fprintf(stderr, "instanceId %d\n", instanceId);
581 reqRequestorId = requestorId;
582 reqInstanceId = instanceId;
586 case RICsubscriptionRequest_IEs__value_PR_RANfunctionID:
588 case RICsubscriptionRequest_IEs__value_PR_RICsubscriptionDetails:
590 RICsubscriptionDetails_t subDetails = next_ie->value.choice.RICsubscriptionDetails;
591 RICeventTriggerDefinition_t triggerDef = subDetails.ricEventTriggerDefinition;
592 RICactions_ToBeSetup_List_t actionList = subDetails.ricAction_ToBeSetup_List;
594 //We are ignoring the trigger definition
596 //We identify the first action whose type is REPORT
597 //That is the only one accepted; all others are rejected
599 int actionCount = actionList.list.count;
600 fprintf(stderr, "action count%d\n", actionCount);
602 auto **item_array = actionList.list.array;
604 bool foundAction = false;
606 for (int i=0; i < actionCount; i++) {
608 auto *next_item = item_array[i];
609 RICactionID_t actionId = ((RICaction_ToBeSetup_ItemIEs*)next_item)->value.choice.RICaction_ToBeSetup_Item.ricActionID;
610 RICactionType_t actionType = ((RICaction_ToBeSetup_ItemIEs*)next_item)->value.choice.RICaction_ToBeSetup_Item.ricActionType;
612 if (!foundAction && actionType == RICactionType_report) {
613 reqActionId = actionId;
614 actionIdsAccept.push_back(reqActionId);
615 printf("adding accept\n");
618 reqActionId = actionId;
619 printf("adding reject\n");
620 actionIdsReject.push_back(reqActionId);
630 fprintf(stderr, "After Processing Subscription Request\n");
632 fprintf(stderr, "requestorId %d\n", reqRequestorId);
633 fprintf(stderr, "instanceId %d\n", reqInstanceId);
636 for (int i=0; i < actionIdsAccept.size(); i++) {
637 fprintf(stderr, "Action ID %d %ld\n", i, actionIdsAccept.at(i));
641 E2AP_PDU *e2ap_pdu = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU));
643 long *accept_array = &actionIdsAccept[0];
644 long *reject_array = &actionIdsReject[0];
645 int accept_size = actionIdsAccept.size();
646 int reject_size = actionIdsReject.size();
648 e2sim.generate_e2apv1_subscription_response_success(e2ap_pdu, accept_array, reject_array, accept_size, reject_size, reqRequestorId, reqInstanceId);
650 e2sim.encode_and_send_sctp_data(e2ap_pdu);
652 //Start thread for sending REPORT messages
654 // std::thread loop_thread;
658 run_report_loop(reqRequestorId, reqInstanceId, funcId, reqActionId);
660 // loop_thread = std::thread(&run_report_loop);