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 "OCTET_STRING.h"
27 #include "asn_application.h"
28 #include "E2SM-KPM-IndicationMessage.h"
29 #include "E2SM-KPM-RANfunction-Description.h"
30 #include "E2SM-KPM-IndicationHeader-Format1.h"
31 #include "E2SM-KPM-IndicationHeader.h"
33 #include "RICsubscriptionRequest.h"
34 #include "RICsubscriptionResponse.h"
35 #include "RICactionType.h"
36 #include "ProtocolIE-Field.h"
37 #include "ProtocolIE-SingleContainer.h"
38 #include "InitiatingMessage.h"
41 #include "kpm_callbacks.hpp"
42 #include "encode_kpm.hpp"
44 #include "encode_e2apv1.hpp"
46 #include <nlohmann/json.hpp>
50 #include "viavi_connector.hpp"
52 #include "e2sim_defs.h"
53 using json = nlohmann::json;
61 int main(int argc, char* argv[]) {
63 LOG_I("Starting KPM simulator");
65 uint8_t *nrcellid_buf = (uint8_t*)calloc(1,5);
66 nrcellid_buf[0] = 0x22;
67 nrcellid_buf[1] = 0x5B;
68 nrcellid_buf[2] = 0xD6;
69 nrcellid_buf[3] = 0x00;
70 nrcellid_buf[4] = 0x70;
72 asn_codec_ctx_t *opt_cod;
74 E2SM_KPM_RANfunction_Description_t *ranfunc_desc =
75 (E2SM_KPM_RANfunction_Description_t*)calloc(1,sizeof(E2SM_KPM_RANfunction_Description_t));
76 encode_kpm_function_description(ranfunc_desc);
78 uint8_t e2smbuffer[8192] = {0, };
79 size_t e2smbuffer_size = 8192;
82 asn_encode_to_buffer(opt_cod,
83 ATS_ALIGNED_BASIC_PER,
84 &asn_DEF_E2SM_KPM_RANfunction_Description,
85 ranfunc_desc, e2smbuffer, e2smbuffer_size);
87 if(er.encoded == -1) {
88 LOG_I("Failed to serialize function description data. Detail: %s.", asn_DEF_E2SM_KPM_RANfunction_Description.name);
89 } else if(er.encoded > e2smbuffer_size) {
90 LOG_I("Buffer of size %zu is too small for %s, need %zu", e2smbuffer_size, asn_DEF_E2SM_KPM_RANfunction_Description.name, er.encoded);
93 uint8_t *ranfuncdesc = (uint8_t*)calloc(1,er.encoded);
94 memcpy(ranfuncdesc, e2smbuffer, er.encoded);
96 OCTET_STRING_t *ranfunc_ostr = (OCTET_STRING_t*)calloc(1,sizeof(OCTET_STRING_t));
97 ranfunc_ostr->buf = (uint8_t*)calloc(1,er.encoded);
98 ranfunc_ostr->size = er.encoded;
99 memcpy(ranfunc_ostr->buf,e2smbuffer,er.encoded);
101 e2sim.register_e2sm(0,ranfunc_ostr);
102 e2sim.register_subscription_callback(0,&callback_kpm_subscription_request);
104 e2sim.run_loop(argc, argv);
108 void get_cell_id(uint8_t *nrcellid_buf, char *cid_return_buf) {
110 uint8_t nr0 = nrcellid_buf[0] >> 4;
111 uint8_t nr1 = nrcellid_buf[0] << 4;
114 uint8_t nr2 = nrcellid_buf[1] >> 4;
115 uint8_t nr3 = nrcellid_buf[1] << 4;
118 uint8_t nr4 = nrcellid_buf[2] >> 4;
119 uint8_t nr5 = nrcellid_buf[2] << 4;
122 uint8_t nr6 = nrcellid_buf[3] >> 4;
123 uint8_t nr7 = nrcellid_buf[3] << 4;
126 uint8_t nr8 = nrcellid_buf[4] >> 4;
128 sprintf(cid_return_buf, "373437%d%d%d%d%d%d%d%d%d", nr0,nr1,nr2,nr3,nr4,nr5,nr6,nr7,nr8);
132 void run_report_loop(long requestorId, long instanceId, long ranFunctionId, long actionId)
134 std::filebuf reports_json;
135 std::streambuf *input_filebuf = &reports_json;
137 std::unique_ptr<viavi::RICTesterReceiver> viavi_connector;
138 if (!reports_json.open("/playpen/src/reports.json", std::ios::in)) {
139 std::cerr << "Can't open reports.json, enabling VIAVI connector instead..." << endl;
140 viavi_connector.reset(new viavi::RICTesterReceiver {3001, nullptr});
141 input_filebuf = viavi_connector->get_data_filebuf();
144 std::istream input {input_filebuf};
150 while ( getline(input, str) ) {
157 uint8_t *plmnid_buf = (uint8_t*)"747";
158 uint8_t *sst_buf = (uint8_t*)"1";
159 uint8_t *sd_buf = (uint8_t*)"100";
162 LOG_I("Current line: %s", str.c_str());
167 all_ues_json = json::parse(str);
170 LOG_I("Exception on reading json");
176 std::string first_key = all_ues_json.begin().key();
177 LOG_I("First key is %s\n", first_key.c_str());
179 if (first_key.compare("ueMeasReport") == 0) {
181 json::json_pointer du_id(std::string("/ueMeasReport/du-id"));
182 int duid = all_ues_json[du_id].get<int>();
184 LOG_I("Start sending UE measurement reports with DU id %d", duid);
186 int numMeasReports = (all_ues_json["/ueMeasReport/ueMeasReportList"_json_pointer]).size();
188 for (int i = 0; i < numMeasReports; i++) {
197 json::json_pointer p001(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/ue-id");
198 ueId = all_ues_json[p001].get<std::string>();
200 LOG_I("Preparing report data for UE %d with id %s", i, ueId);
202 json::json_pointer p0(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/throughput");
203 tput = all_ues_json[p0].get<float>();
205 json::json_pointer p00(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/prb_usage");
206 prb_usage = all_ues_json[p00].get<int>();
208 json::json_pointer p1(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/nrCellIdentity");
209 nextCellId = all_ues_json[p1].get<int>();
211 json::json_pointer p2(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/servingCellRfReport/rsrp");
212 nextRsrp = all_ues_json[p2].get<int>();
214 json::json_pointer p3(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/servingCellRfReport/rsrq");
215 nextRsrq = all_ues_json[p3].get<int>();
217 json::json_pointer p4(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/servingCellRfReport/rssinr");
218 nextRssinr = all_ues_json[p4].get<int>();
220 json::json_pointer p5(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/neighbourCellList");
222 uint8_t crnti_buf[3] = {0, };
224 if (ueId.find("Pedestrian") != string::npos) {
225 std::string ind = ueId.substr(11);
226 int indval = std::stoi(ind);
229 crnti_buf[1] = indval;
232 crnti_buf[0] = indval/10;
233 crnti_buf[1] = indval % 10;
236 } else if (ueId.find("Car") != string::npos) {
241 std::string serving_str = "{\"rsrp\": " + std::to_string(nextRsrp) + ", \"rsrq\": " +
242 std::to_string(nextRsrq) + ", \"rssinr\": " + std::to_string(nextRssinr) + "}";
243 const uint8_t *serving_buf = reinterpret_cast<const uint8_t*>(serving_str.c_str());
245 int numNeighborCells = (all_ues_json[p5]).size();
247 std::string neighbor_str = "[";
254 for (int j = 0; j < numNeighborCells; j++) {
255 json::json_pointer p8(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i) +"/neighbourCellList/" + std::to_string(j) + "/nbCellIdentity");
256 nextNbCell = all_ues_json[p8].get<int>();
257 json::json_pointer p9(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i)
258 +"/neighbourCellList/" + std::to_string(j) + "/nbCellRfReport/rsrp");
259 nextNbRsrp = all_ues_json[p9].get<int>();
261 json::json_pointer p10(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i)
262 +"/neighbourCellList/" + std::to_string(j) + "/nbCellRfReport/rsrq");
263 nextNbRsrq = all_ues_json[p10].get<int>();
265 json::json_pointer p11(std::string("/ueMeasReport/ueMeasReportList/") + std::to_string(i)
266 +"/neighbourCellList/" + std::to_string(j) + "/nbCellRfReport/rssinr");
267 nextNbRssinr = all_ues_json[p11].get<int>();
274 uint8_t neighbor_cellid_buf[6] = {0, };
275 neighbor_cellid_buf[0] = 0x22;
276 neighbor_cellid_buf[1] = 0x5B;
277 neighbor_cellid_buf[2] = 0xD6;
278 neighbor_cellid_buf[3] = nextNbCell;
279 neighbor_cellid_buf[4] = 0x70;
281 char cid_buf[25] = {0, };
282 get_cell_id(neighbor_cellid_buf,cid_buf);
285 neighbor_str += "{\"CID\" : \"" + std::string(cid_buf) + "\", \"Cell-RF\" : {\"rsrp\": " + std::to_string(nextNbRsrp) +
286 ", \"rsrq\": " + std::to_string(nextNbRsrq) + ", \"rssinr\": " + std::to_string(nextNbRssinr) + "}}";
292 LOG_I("This is neighbor str %s\n", neighbor_str.c_str());
294 const uint8_t *neighbor_buf = reinterpret_cast<const uint8_t*>(neighbor_str.c_str());
297 uint8_t nrcellid_buf[6] = {0, };
298 nrcellid_buf[0] = 0x22;
299 nrcellid_buf[1] = 0x5B;
300 nrcellid_buf[2] = 0xD6;
301 nrcellid_buf[3] = nextCellId;
302 nrcellid_buf[4] = 0x70;
304 uint8_t gnbid_buf[4] = {0, };
309 uint8_t cuupid_buf[2] = {0, };
310 cuupid_buf[0] = 20000;
312 uint8_t duid_buf[2] = {0, };
315 uint8_t *cuupname_buf = (uint8_t*)"GNBCUUP5";
318 E2SM_KPM_IndicationMessage_t *ind_msg_cucp_ue =
319 (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t));
321 ue_meas_kpm_report_indication_message_initialized(ind_msg_cucp_ue, nrcellid_buf, crnti_buf, serving_buf, neighbor_buf);
323 uint8_t e2sm_message_buf_cucp_ue[8192] = {0, };
324 size_t e2sm_message_buf_size_cucp_ue = 8192;
326 asn_codec_ctx_t *opt_cod;
328 asn_enc_rval_t er_message_cucp_ue = asn_encode_to_buffer(opt_cod,
329 ATS_ALIGNED_BASIC_PER,
330 &asn_DEF_E2SM_KPM_IndicationMessage,
331 ind_msg_cucp_ue, e2sm_message_buf_cucp_ue, e2sm_message_buf_size_cucp_ue);
333 if(er_message_cucp_ue.encoded == -1) {
334 LOG_I("Failed to serialize message data. Detail: %s.\n", asn_DEF_E2SM_KPM_IndicationMessage.name);
336 } else if(er_message_cucp_ue.encoded > e2sm_message_buf_size_cucp_ue) {
337 LOG_I("Buffer of size %zu is too small for %s, need %zu\n", e2sm_message_buf_size_cucp_ue, asn_DEF_E2SM_KPM_IndicationMessage.name, er_message_cucp_ue.encoded);
340 LOG_I("Encoded UE indication message succesfully, size in bytes: %d", er_message_cucp_ue.encoded)
343 ASN_STRUCT_FREE(asn_DEF_E2SM_KPM_IndicationMessage, ind_msg_cucp_ue);
345 E2SM_KPM_IndicationHeader_t* ind_header_cucp_ue =
346 (E2SM_KPM_IndicationHeader_t*)calloc(1,sizeof(E2SM_KPM_IndicationHeader_t));
347 kpm_report_indication_header_initialized(ind_header_cucp_ue, plmnid_buf, sst_buf, sd_buf, fqival, qcival, nrcellid_buf, gnbid_buf, 0, cuupid_buf, duid_buf, cuupname_buf);
349 asn_codec_ctx_t *opt_cod1;
350 uint8_t e2sm_header_buf_cucp_ue[8192] = {0, };
351 size_t e2sm_header_buf_size_cucp_ue = 8192;
353 asn_enc_rval_t er_header_cucp_ue = asn_encode_to_buffer(opt_cod1,
354 ATS_ALIGNED_BASIC_PER,
355 &asn_DEF_E2SM_KPM_IndicationHeader,
356 ind_header_cucp_ue, e2sm_header_buf_cucp_ue, e2sm_header_buf_size_cucp_ue);
358 if(er_header_cucp_ue.encoded == -1) {
359 LOG_I("Failed to serialize data. Detail: %s.\n", asn_DEF_E2SM_KPM_IndicationHeader.name);
361 } else if(er_header_cucp_ue.encoded > e2sm_header_buf_size_cucp_ue) {
362 LOG_I("Buffer of size %zu is too small for %s, need %zu\n", e2sm_header_buf_size_cucp_ue, asn_DEF_E2SM_KPM_IndicationHeader.name, er_header_cucp_ue.encoded);
365 LOG_I("Encoded UE indication header succesfully, size in bytes: %d", er_header_cucp_ue.encoded);
366 for(int i = 0; i < er_header_cucp_ue.encoded; i ++) {
367 printf("%x ", e2sm_header_buf_cucp_ue[i]);
373 ASN_STRUCT_FREE(asn_DEF_E2SM_KPM_IndicationHeader, ind_header_cucp_ue);
375 E2AP_PDU *pdu_cucp_ue = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU));
377 encoding::generate_e2apv1_indication_request_parameterized(pdu_cucp_ue, requestorId,
378 instanceId, ranFunctionId,
379 actionId, seqNum, e2sm_header_buf_cucp_ue,
380 er_header_cucp_ue.encoded, e2sm_message_buf_cucp_ue,
381 er_message_cucp_ue.encoded);
383 e2sim.encode_and_send_sctp_data(pdu_cucp_ue);
384 LOG_I("Measurement report for UE %d has been sent\n", i);
386 std::this_thread::sleep_for (std::chrono::milliseconds(50));
388 } else if (first_key.compare("cellMeasReport") == 0) {
390 json::json_pointer du_id(std::string("/cellMeasReport/du-id"));
391 int duid = all_ues_json[du_id].get<int>();
393 LOG_I("Start sending Cell measurement reports with DU id %d", duid);
395 int numMeasReports = (all_ues_json["/cellMeasReport/cellMeasReportList"_json_pointer]).size();
397 for (int i = 0; i < numMeasReports; i++) {
406 json::json_pointer p00(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/nrCellIdentity");
407 cellid = all_ues_json[p00].get<int>();
409 LOG_I("Preparing report data for Cell %d with id %d", i, cellid);
411 json::json_pointer p0(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/pdcpByteMeasReport/pdcpBytesDl");
412 bytes_dl = all_ues_json[p0].get<float>();
414 json::json_pointer p1(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/pdcpByteMeasReport/pdcpBytesUl");
415 bytes_ul = all_ues_json[p1].get<float>();
417 json::json_pointer p2(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/prbMeasReport/availPrbDl");
418 prb_dl = all_ues_json[p2].get<int>();
420 json::json_pointer p3(std::string("/cellMeasReport/cellMeasReportList/") + std::to_string(i) +"/prbMeasReport/availPrbUl");
421 prb_ul = all_ues_json[p3].get<int>();
424 uint8_t *sst_buf = (uint8_t*)"1";
425 uint8_t *sd_buf = (uint8_t*)"100";
426 uint8_t *plmnid_buf = (uint8_t*)"747";
428 uint8_t nrcellid_buf[6] = {0, };
429 nrcellid_buf[0] = 0x22;
430 nrcellid_buf[1] = 0x5B;
431 nrcellid_buf[2] = 0xD6;
432 nrcellid_buf[3] = cellid;
433 nrcellid_buf[4] = 0x70;
435 uint8_t gnbid_buf[4] = {0, };
440 uint8_t cuupid_buf[2] = {0, };
441 cuupid_buf[0] = 20000;
443 uint8_t duid_buf[2] = {0, };
446 uint8_t *cuupname_buf = (uint8_t*)"GNBCUUP5";
448 //Encoding Style 1 Message Body
450 LOG_I("Encoding Style 1 Message body");
451 asn_codec_ctx_t *opt_cod2;
453 E2SM_KPM_IndicationMessage_t *ind_message_style1 =
454 (E2SM_KPM_IndicationMessage_t*)calloc(1,sizeof(E2SM_KPM_IndicationMessage_t));
455 E2AP_PDU *pdu_style1 = (E2AP_PDU*)calloc(1,sizeof(E2AP_PDU));
458 long *l_dl_prbs = (long*)calloc(1, sizeof(long));
459 long *l_ul_prbs = (long*)calloc(1, sizeof(long));
460 *l_dl_prbs = (long)prb_dl;
461 *l_ul_prbs = (long)prb_ul;
463 cell_meas_kpm_report_indication_message_style_1_initialized(ind_message_style1, fiveqi,
464 prb_dl, prb_ul, nrcellid_buf, l_dl_prbs, l_ul_prbs);
466 uint8_t e2sm_message_buf_style1[8192] = {0, };
467 size_t e2sm_message_buf_size_style1 = 8192;
469 asn_enc_rval_t er_message_style1 = asn_encode_to_buffer(opt_cod2,
470 ATS_ALIGNED_BASIC_PER,
471 &asn_DEF_E2SM_KPM_IndicationMessage,
473 e2sm_message_buf_style1, e2sm_message_buf_size_style1);
475 if(er_message_style1.encoded == -1) {
476 LOG_I("Failed to serialize data. Detail: %s.\n", asn_DEF_E2SM_KPM_IndicationMessage.name);
478 } else if(er_message_style1.encoded > e2sm_message_buf_size_style1) {
479 LOG_I("Buffer of size %zu is too small for %s, need %zu\n", e2sm_message_buf_size_style1, asn_DEF_E2SM_KPM_IndicationMessage.name, er_message_style1.encoded);
482 LOG_I("Encoded Cell indication message succesfully, size in bytes: %d", er_message_style1.encoded)
485 ASN_STRUCT_FREE(asn_DEF_E2SM_KPM_IndicationMessage, ind_message_style1);
487 uint8_t *cpid_buf2 = (uint8_t*)"CPID";
489 E2SM_KPM_IndicationHeader_t* ind_header_style1 =
490 (E2SM_KPM_IndicationHeader_t*)calloc(1,sizeof(E2SM_KPM_IndicationHeader_t));
491 kpm_report_indication_header_initialized(ind_header_style1, plmnid_buf, sst_buf, sd_buf, fqival, qcival, nrcellid_buf, gnbid_buf, 0, cuupid_buf, duid_buf, cuupname_buf);
493 uint8_t e2sm_header_buf_style1[8192] = {0, };
494 size_t e2sm_header_buf_size_style1 = 8192;
496 asn_enc_rval_t er_header_style1 = asn_encode_to_buffer(opt_cod2,
497 ATS_ALIGNED_BASIC_PER,
498 &asn_DEF_E2SM_KPM_IndicationHeader,
500 e2sm_header_buf_style1, e2sm_header_buf_size_style1);
502 if(er_header_style1.encoded == -1) {
503 LOG_I("Failed to serialize data. Detail: %s.\n", asn_DEF_E2SM_KPM_IndicationHeader.name);
505 } else if(er_header_style1.encoded > e2sm_header_buf_size_style1) {
506 LOG_I("Buffer of size %zu is too small for %s, need %zu\n", e2sm_header_buf_size_style1, asn_DEF_E2SM_KPM_IndicationHeader.name, er_header_style1.encoded);
509 LOG_I("Encoded Cell indication header succesfully, size in bytes: %d", er_header_style1.encoded)
512 ASN_STRUCT_FREE(asn_DEF_E2SM_KPM_IndicationHeader, ind_header_style1);
514 encoding::generate_e2apv1_indication_request_parameterized(pdu_style1, requestorId,
515 instanceId, ranFunctionId,
516 actionId, seqNum, e2sm_header_buf_style1,
517 er_header_style1.encoded,
518 e2sm_message_buf_style1, er_message_style1.encoded);
520 e2sim.encode_and_send_sctp_data(pdu_style1);
522 LOG_I("Measurement report for Cell %d has been sent\n", i);
523 std::this_thread::sleep_for (std::chrono::milliseconds(50));
532 void callback_kpm_subscription_request(E2AP_PDU_t *sub_req_pdu) {
534 fprintf(stderr, "[%s:%d]Calling callback_kpm_subscription_request");
536 //Record RIC Request ID
537 //Go through RIC action to be Setup List
538 //Find first entry with REPORT action Type
540 //Encode subscription response
542 RICsubscriptionRequest_t orig_req =
543 sub_req_pdu->choice.initiatingMessage->value.choice.RICsubscriptionRequest;
545 RICsubscriptionResponse_IEs_t *ricreqid =
546 (RICsubscriptionResponse_IEs_t*)calloc(1, sizeof(RICsubscriptionResponse_IEs_t));
548 int count = orig_req.protocolIEs.list.count;
549 int size = orig_req.protocolIEs.list.size;
551 RICsubscriptionRequest_IEs_t **ies = (RICsubscriptionRequest_IEs_t**)orig_req.protocolIEs.list.array;
553 RICsubscriptionRequest_IEs__value_PR pres;
559 std::vector<long> actionIdsAccept;
560 std::vector<long> actionIdsReject;
562 for (int i=0; i < count; i++) {
563 RICsubscriptionRequest_IEs_t *next_ie = ies[i];
564 pres = next_ie->value.present;
566 LOG_I("The next present value %d\n", pres);
569 case RICsubscriptionRequest_IEs__value_PR_RICrequestID:
571 LOG_I("in case request id");
572 RICrequestID_t reqId = next_ie->value.choice.RICrequestID;
573 long requestorId = reqId.ricRequestorID;
574 long instanceId = reqId.ricInstanceID;
575 LOG_I("requestorId %d\n", requestorId);
576 LOG_I("instanceId %d\n", instanceId);
577 reqRequestorId = requestorId;
578 reqInstanceId = instanceId;
582 case RICsubscriptionRequest_IEs__value_PR_RANfunctionID:
584 LOG_I("in case ran func id");
587 case RICsubscriptionRequest_IEs__value_PR_RICsubscriptionDetails:
589 RICsubscriptionDetails_t subDetails = next_ie->value.choice.RICsubscriptionDetails;
590 RICeventTriggerDefinition_t triggerDef = subDetails.ricEventTriggerDefinition;
591 RICactions_ToBeSetup_List_t actionList = subDetails.ricAction_ToBeSetup_List;
592 //We are ignoring the trigger definition
594 //We identify the first action whose type is REPORT
595 //That is the only one accepted; all others are rejected
597 int actionCount = actionList.list.count;
598 LOG_I("Action count%d\n", actionCount);
600 auto **item_array = actionList.list.array;
602 bool foundAction = false;
604 for (int i=0; i < actionCount; i++) {
606 auto *next_item = item_array[i];
607 RICactionID_t actionId = ((RICaction_ToBeSetup_ItemIEs*)next_item)->value.choice.RICaction_ToBeSetup_Item.ricActionID;
608 RICactionType_t actionType = ((RICaction_ToBeSetup_ItemIEs*)next_item)->value.choice.RICaction_ToBeSetup_Item.ricActionType;
610 if (!foundAction && actionType == RICactionType_report) {
611 reqActionId = actionId;
612 actionIdsAccept.push_back(reqActionId);
615 reqActionId = actionId;
616 actionIdsReject.push_back(reqActionId);
630 LOG_I("After Processing Subscription Request");
632 LOG_I("requestorId %d\n", reqRequestorId);
633 LOG_I("instanceId %d\n", reqInstanceId);
636 for (int i=0; i < actionIdsAccept.size(); i++) {
637 LOG_I("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 encoding::generate_e2apv1_subscription_response_success(e2ap_pdu, accept_array, reject_array, accept_size, reject_size, reqRequestorId, reqInstanceId);
650 LOG_I("Encode and sending E2AP subscription success response via SCTP");
651 e2sim.encode_and_send_sctp_data(e2ap_pdu);
655 run_report_loop(reqRequestorId, reqInstanceId, funcId, reqActionId);