X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=e2sim%2Fe2sm_examples%2Fkpm_e2sm%2Fsrc%2Fkpm%2Fencode_kpm.cpp;h=b3a04658053206ddd9a1f6185897b7a5b36510f2;hb=3dacb077c9e7d0c998bb9a76804c95aced032b80;hp=97917e0535304bb22ff93d6dd065507b91d5bdb1;hpb=dbf44578ca278e8176ea18d21446c877c71e064e;p=sim%2Fe2-interface.git diff --git a/e2sim/e2sm_examples/kpm_e2sm/src/kpm/encode_kpm.cpp b/e2sim/e2sm_examples/kpm_e2sm/src/kpm/encode_kpm.cpp old mode 100644 new mode 100755 index 97917e0..b3a0465 --- a/e2sim/e2sm_examples/kpm_e2sm/src/kpm/encode_kpm.cpp +++ b/e2sim/e2sm_examples/kpm_e2sm/src/kpm/encode_kpm.cpp @@ -158,7 +158,7 @@ void encode_kpm_function_description(E2SM_KPM_RANfunction_Description_t* ranfunc memcpy(report_style6->ric_ReportStyle_Name.buf, buf10, strlen((char*)buf10)); report_style6->ric_ReportStyle_Name.size = strlen((char*)buf10); report_style6->ric_IndicationHeaderFormat_Type = 1; - report_style6->ric_IndicationMessageFormat_Type = 1; + report_style6->ric_IndicationMessageFormat_Type = 1; ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List = @@ -172,14 +172,17 @@ void encode_kpm_function_description(E2SM_KPM_RANfunction_Description_t* ranfunc ASN_SEQUENCE_ADD(&ranfunc_desc->e2SM_KPM_RANfunction_Item.ric_ReportStyle_List->list, report_style6); xer_fprint(stderr, &asn_DEF_E2SM_KPM_RANfunction_Description, ranfunc_desc); -} +} -void encode_e2sm_kpm_indication_header(E2SM_KPM_IndicationHeader_t *ihead) { +void encode_e2sm_kpm_indication_header(E2SM_KPM_IndicationHeader_t *ihead, uint8_t *plmnid_buf, uint8_t *sst_buf, uint8_t *sd_buf, + long fqival, long qcival, uint8_t *nrcellid_buf, uint8_t *gnbid_buf, int gnbid_unused, + uint8_t *cuupid_buf, uint8_t *duid_buf, uint8_t *cuupname_buf) { - uint8_t *plmnid_buf = (uint8_t*)"747"; - uint8_t *sst_buf = (uint8_t*)"1"; - uint8_t *sd_buf = (uint8_t*)"100"; + + //uint8_t *plmnid_buf = (uint8_t*)"747"; + //uint8_t *sst_buf = (uint8_t*)"1"; + //uint8_t *sd_buf = (uint8_t*)"100"; E2SM_KPM_IndicationHeader_Format1_t* ind_header = (E2SM_KPM_IndicationHeader_Format1_t*)calloc(1,sizeof(E2SM_KPM_IndicationHeader_Format1_t)); @@ -189,8 +192,8 @@ void encode_e2sm_kpm_indication_header(E2SM_KPM_IndicationHeader_t *ihead) { plmnid->size = 3; memcpy(plmnid->buf, plmnid_buf, plmnid->size); - long fqival = 9; - long qcival = 9; + // long fqival = 9; + // long qcival = 9; OCTET_STRING_t *sst = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t)); sst->size = 6; @@ -213,73 +216,90 @@ void encode_e2sm_kpm_indication_header(E2SM_KPM_IndicationHeader_t *ihead) { snssai->sD->buf = (uint8_t*)calloc(1,3); snssai->sD->size = 3; memcpy(snssai->sD->buf, sd_buf, 3); - - - ind_header->pLMN_Identity = plmnid; - ind_header->fiveQI = &fqival; - + BIT_STRING_t *nrcellid = (BIT_STRING_t*)calloc(1, sizeof(BIT_STRING_t));; nrcellid->buf = (uint8_t*)calloc(1,5); nrcellid->size = 5; + memcpy(nrcellid->buf, nrcellid_buf, 5); + /* nrcellid->buf[0] = 0x22; nrcellid->buf[1] = 0x5B; nrcellid->buf[2] = 0xD6; nrcellid->buf[3] = 0x00; nrcellid->buf[4] = 0x70; - + */ nrcellid->bits_unused = 4; BIT_STRING_t *gnb_bstring = (BIT_STRING_t*)calloc(1, sizeof(BIT_STRING_t));; gnb_bstring->buf = (uint8_t*)calloc(1,4); gnb_bstring->size = 4; + memcpy(gnb_bstring->buf, gnbid_buf, 4); + /* gnb_bstring->buf[0] = 0xB5; gnb_bstring->buf[1] = 0xC6; gnb_bstring->buf[2] = 0x77; gnb_bstring->buf[3] = 0x88; + */ - gnb_bstring->bits_unused = 3; + gnb_bstring->bits_unused = gnbid_unused; INTEGER_t *cuup_id = (INTEGER_t*)calloc(1, sizeof(INTEGER_t)); - uint8_t buffer[1]; - buffer[0] = 20000; + // uint8_t buffer[1]; + // buffer[0] = 20000; cuup_id->buf = (uint8_t*)calloc(1,1); - memcpy(cuup_id->buf, buffer, 1); + memcpy(cuup_id->buf, cuupid_buf, 1); cuup_id->size = 1; - + + INTEGER_t *du_id = (INTEGER_t*)calloc(1, sizeof(INTEGER_t)); + // uint8_t buffer_duid[1]; + // buffer_duid[0] = 20000; + du_id->buf = (uint8_t*)calloc(1,1); + memcpy(du_id->buf, duid_buf, 1); + du_id->size = 1; + + + // uint8_t *buf5 = (uint8_t*)"GNBCUUP5"; + OCTET_STRING_t *cuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t)); + cuupname->size = 8; + cuupname->buf = (uint8_t*)calloc(1,8); + memcpy(cuupname->buf, cuupname_buf, cuupname->size); + + ind_header->id_GlobalKPMnode_ID = (GlobalKPMnode_ID*)calloc(1,sizeof(GlobalKPMnode_ID)); ind_header->id_GlobalKPMnode_ID->present = GlobalKPMnode_ID_PR_gNB; ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.gnb_id.present = GNB_ID_Choice_PR_gnb_ID; ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.gnb_id.choice.gnb_ID = *gnb_bstring; ind_header->id_GlobalKPMnode_ID->choice.gNB.global_gNB_ID.plmn_id = *plmnid; ind_header->id_GlobalKPMnode_ID->choice.gNB.gNB_CU_UP_ID = cuup_id; + + ind_header->nRCGI = (NRCGI*)calloc(1,sizeof(NRCGI)); ind_header->nRCGI->pLMN_Identity = *plmnid; ind_header->nRCGI->nRCellIdentity = *nrcellid; - ind_header->sliceID = snssai; - ind_header->qci = &qcival; - // ind_header->message_Type = ; - // ind_header->gNB_DU_ID = ; - - - uint8_t *buf5 = (uint8_t*)"GNBCUUP5"; - OCTET_STRING_t *cuupname = (OCTET_STRING_t*)calloc(1, sizeof(OCTET_STRING_t)); - cuupname->size = 8; - cuupname->buf = (uint8_t*)calloc(1,8); - memcpy(cuupname->buf, buf5, cuupname->size); - + ind_header->pLMN_Identity = plmnid; + // memcpy(ind_header->fiveQI, &fqival, 4); + ind_header->sliceID = snssai; + // memcpy(ind_header->qci, &qcival, 4); + + ind_header->gNB_Name = (GNB_Name*)calloc(1,sizeof(GNB_Name)); ind_header->gNB_Name->present = GNB_Name_PR_gNB_CU_UP_Name; ind_header->gNB_Name->choice.gNB_CU_UP_Name = *cuupname; - - - // ind_header->global_GNB_ID = (GlobalgNB_ID*)calloc(1,sizeof(GlobalgNB_ID)); - // ind_header->global_GNB_ID->plmn_id = *plmnid; - // ind_header->global_GNB_ID->gnb_id.present = GNB_ID_Choice_PR_gnb_ID; - // ind_header->global_GNB_ID->gnb_id.choice.gnb_ID = *gnb_bstring; - + + + ind_header->global_GNB_ID = (GlobalgNB_ID*)calloc(1,sizeof(GlobalgNB_ID)); + ind_header->global_GNB_ID->plmn_id = *plmnid; + ind_header->global_GNB_ID->gnb_id.present = GNB_ID_Choice_PR_gnb_ID; + ind_header->global_GNB_ID->gnb_id.choice.gnb_ID = *gnb_bstring; + + + // long msg_type = 2; + // ind_header->message_Type = &msg_type; + ind_header->gNB_DU_ID = du_id; + ihead->present = E2SM_KPM_IndicationHeader_PR_indicationHeader_Format1; ihead->choice.indicationHeader_Format1 = *ind_header; @@ -486,7 +506,8 @@ void encode_kpm_ocucp_user_level(RAN_Container_t *ranco, NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t)); - int nrcellid_size = strlen((char*)nrcellid_buf); + // int nrcellid_size = strlen((char*)nrcellid_buf); + int nrcellid_size = 5; nrcellid->buf = (uint8_t*)calloc(1, nrcellid_size); memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size); nrcellid->size = 5; @@ -661,7 +682,8 @@ void encode_kpm_odu_user_level(RAN_Container_t *ranco, NRCellIdentity_t *nrcellid = (NRCellIdentity_t*)calloc(1,sizeof(NRCellIdentity_t)); - int nrcellid_size = strlen((char*)nrcellid_buf); + // int nrcellid_size = strlen((char*)nrcellid_buf); + int nrcellid_size = 5; nrcellid->buf = (uint8_t*)calloc(1,nrcellid_size); memcpy(nrcellid->buf, nrcellid_buf, nrcellid_size); nrcellid->size = nrcellid_size; @@ -728,6 +750,9 @@ void encode_kpm_report_rancontainer_du_parameterized(E2SM_KPM_IndicationMessage_ RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t)); encode_kpm_odu_user_level(ranco,plmnid_buf,nrcellid_buf,crnti_buf,prb_usage_dl,prb_usage_ul); + printf("After creating RAN container, xer printing it\n"); + xer_fprint(stderr, &asn_DEF_RAN_Container, ranco); + PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t)); ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list); containers_list->theRANContainer = ranco; @@ -744,14 +769,14 @@ void encode_kpm_report_rancontainer_du_parameterized(E2SM_KPM_IndicationMessage_ indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format; - char *error_buf = (char*)calloc(300, sizeof(char)); + char error_buf[300] = {0, }; size_t errlen; asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen); printf("error length %d\n", errlen); printf("error buf %s\n", error_buf); - // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage); + xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage); asn_codec_ctx_t *opt_cod; @@ -785,6 +810,10 @@ void encode_kpm_report_rancontainer_cucp_parameterized(E2SM_KPM_IndicationMessag nrcellid_buf, crnti_buf, serving_buf, neighbor_buf); + printf("After creating RAN container, xer printing it\n"); + xer_fprint(stderr, &asn_DEF_RAN_Container, ranco); + + PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t)); ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list); containers_list->theRANContainer = ranco; @@ -801,7 +830,7 @@ void encode_kpm_report_rancontainer_cucp_parameterized(E2SM_KPM_IndicationMessag indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format; - char *error_buf = (char*)calloc(300, sizeof(char)); + char error_buf[300] = {0, }; size_t errlen; asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen); @@ -851,7 +880,7 @@ void encode_kpm_report_rancontainer_cucp(E2SM_KPM_IndicationMessage_t* indicatio indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format; - char *error_buf = (char*)calloc(300, sizeof(char)); + char error_buf[300] = {0, }; size_t errlen; asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen); @@ -890,6 +919,9 @@ void encode_kpm_report_rancontainer_cuup_parameterized(E2SM_KPM_IndicationMessag RAN_Container_t *ranco = (RAN_Container_t*)calloc(1,sizeof(RAN_Container_t)); encode_kpm_ocuup_user_level(ranco,plmnid_buf,nrcellid_buf,crnti_buf,pdcp_bytesdl,pdcp_bytesul); + fprintf(stderr, "After creating RAN container, xer printing it\n"); + xer_fprint(stderr, &asn_DEF_RAN_Container, ranco); + PM_Containers_List_t *containers_list = (PM_Containers_List_t*)calloc(1, sizeof(PM_Containers_List_t)); ASN_STRUCT_RESET(asn_DEF_PM_Containers_List, containers_list); containers_list->theRANContainer = ranco; @@ -906,14 +938,14 @@ void encode_kpm_report_rancontainer_cuup_parameterized(E2SM_KPM_IndicationMessag indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format; - char *error_buf = (char*)calloc(300, sizeof(char)); + char error_buf[300] = {0, }; size_t errlen; asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen); printf("error length %d\n", errlen); printf("error buf %s\n", error_buf); - // xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage); + xer_fprint(stderr, &asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage); asn_codec_ctx_t *opt_cod; @@ -1036,7 +1068,7 @@ void encode_kpm_report_rancontainer_cuup(E2SM_KPM_IndicationMessage_t* indicatio indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format; - char *error_buf = (char*)calloc(300, sizeof(char)); + char error_buf[300] = {0, }; size_t errlen; asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen); @@ -1183,7 +1215,7 @@ void encode_kpm_report_style1_parameterized(E2SM_KPM_IndicationMessage_t* indica indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format; - char *error_buf = (char*)calloc(300, sizeof(char)); + char error_buf[300] = {0, }; size_t errlen; asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen); @@ -1326,7 +1358,7 @@ void encode_kpm_report_style1(E2SM_KPM_IndicationMessage_t* indicationmessage) { indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format; - char *error_buf = (char*)calloc(300, sizeof(char)); + char error_buf[300] = {0, }; size_t errlen; asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen); @@ -1585,7 +1617,7 @@ void encode_kpm_report_style5_parameterized(E2SM_KPM_IndicationMessage_t* indica indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format; - char *error_buf = (char*)calloc(300, sizeof(char)); + char error_buf[300] = {0, }; size_t errlen; asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen); @@ -1755,7 +1787,7 @@ void encode_kpm_report_style5(E2SM_KPM_IndicationMessage_t* indicationmessage) { indicationmessage->indicationMessage.choice.indicationMessage_Format1 = *format; - char *error_buf = (char*)calloc(300, sizeof(char)); + char error_buf[300] = {0, }; size_t errlen; asn_check_constraints(&asn_DEF_E2SM_KPM_IndicationMessage, indicationmessage, error_buf, &errlen);