diff --git a/srsgnb/hdr/stack/ric/e2ap.h b/srsgnb/hdr/stack/ric/e2ap.h index d17b4e231..4e0612650 100644 --- a/srsgnb/hdr/stack/ric/e2ap.h +++ b/srsgnb/hdr/stack/ric/e2ap.h @@ -58,10 +58,10 @@ private: srslog::basic_logger& logger; e2sm_kpm e2sm_; bool setup_response_received = false; - bool pending_subscription_request = false; - int setup_procedure_transaction_id = 0; - uint64_t plmn_id = 3617847; - uint64_t gnb_id = 381210353; + bool pending_subscription_request = false; + int setup_procedure_transaction_id = 0; + uint64_t plmn_id = 0x05f510; + uint64_t gnb_id = 1; global_ric_id_t global_ric_id = {}; std::map ran_functions; srsenb::e2_interface_metrics* gnb_metrics = nullptr; diff --git a/srsgnb/src/stack/ric/e2ap.cc b/srsgnb/src/stack/ric/e2ap.cc index 88b3ebf9a..9f2f34cb7 100644 --- a/srsgnb/src/stack/ric/e2ap.cc +++ b/srsgnb/src/stack/ric/e2ap.cc @@ -21,7 +21,7 @@ e2_ap_pdu_c e2ap::generate_setup_request() auto& gnb_ = setup->global_e2node_id.value.set_gnb(); gnb_.global_g_nb_id.plmn_id.from_number(plmn_id); - gnb_.global_g_nb_id.gnb_id.gnb_id().from_number(gnb_id); + gnb_.global_g_nb_id.gnb_id.gnb_id().from_number(gnb_id, 28); // TODO: to keep flexric happy, provide them feedback setup->ra_nfunctions_added.crit = asn1::crit_opts::reject; auto& list = setup->ra_nfunctions_added.value; @@ -29,15 +29,15 @@ e2_ap_pdu_c e2ap::generate_setup_request() setup->ra_nfunctions_added.id = ASN1_E2AP_ID_RA_NFUNCTIONS_ADDED; asn1::protocol_ie_single_container_s item; item.load_info_obj(ASN1_E2AP_ID_RA_NFUNCTION_ITEM); - item.value().ra_nfunction_item().ran_function_id = 0; - item.value().ra_nfunction_item().ran_function_revision = 1; + item.value().ra_nfunction_item().ran_function_id = 147; + item.value().ra_nfunction_item().ran_function_revision = 0; // pack E2SM-KPM-PDU into ran function definition // add function to map RANfunction_description add_func; add_func.function_desc = "KPM monitor"; add_func.function_shortname = "ORAN-E2SM-KPM"; - add_func.function_e2_sm_oid = "OID123"; + add_func.function_e2_sm_oid = "1.3.6.1.4.1.53148.1.2.2.2"; add_func.function_instance = 0; ran_functions[item.value().ra_nfunction_item().ran_function_id] = add_func; @@ -45,9 +45,13 @@ e2_ap_pdu_c e2ap::generate_setup_request() srsran::unique_byte_buffer_t buf = srsran::make_byte_buffer(); e2sm_.generate_ran_function_description(item.value().ra_nfunction_item().ran_function_id, add_func, buf); ran_func_def.resize(buf->N_bytes); + buf->msg[1] = 0x30; // TODO: needed to keep wireshak happy, need better fix std::copy(buf->msg, buf->msg + buf->N_bytes, ran_func_def.data()); - item.value().ra_nfunction_item().ran_function_oid.resize(1); + std::string oid_str = "ORAN-E2SM-KPM"; + item.value().ra_nfunction_item().ran_function_oid.resize(oid_str.size()); + item.value().ra_nfunction_item().ran_function_oid.from_string(oid_str); + setup->ra_nfunctions_added.value.push_back(item); setup->e2node_component_cfg_addition.crit = asn1::crit_opts::reject; @@ -67,20 +71,33 @@ e2_ap_pdu_c e2ap::generate_subscription_response() e2_ap_pdu_c pdu; successful_outcome_s& success = pdu.set_successful_outcome(); success.load_info_obj(ASN1_E2AP_ID_RICSUBSCRIPTION); + success.crit = asn1::crit_opts::reject; ricsubscription_resp_s& sub_resp = success.value.ricsubscription_resp(); sub_resp->ri_crequest_id.crit = asn1::crit_opts::reject; sub_resp->ri_crequest_id.id = ASN1_E2AP_ID_RI_CREQUEST_ID; - sub_resp->ri_crequest_id.value.ric_requestor_id = 123; - sub_resp->ri_crequest_id.value.ric_instance_id = 21; + sub_resp->ri_crequest_id.value.ric_requestor_id = 1021; + sub_resp->ri_crequest_id.value.ric_instance_id = 0; sub_resp->ra_nfunction_id.crit = asn1::crit_opts::reject; sub_resp->ra_nfunction_id.id = ASN1_E2AP_ID_RA_NFUNCTION_ID; + sub_resp->ra_nfunction_id->value = 147; + sub_resp->ri_cactions_admitted.crit = asn1::crit_opts::reject; auto& action_admit_list = sub_resp->ri_cactions_admitted.value; action_admit_list.resize(1); action_admit_list[0].load_info_obj(ASN1_E2AP_ID_RI_CACTION_ADMITTED_ITEM); - action_admit_list[0].value().ri_caction_admitted_item().ric_action_id = 1; + ri_caction_admitted_item_s& a_item = action_admit_list[0]->ri_caction_admitted_item(); + a_item.ric_action_id = 0; + + sub_resp->ri_cactions_not_admitted.crit = asn1::crit_opts::reject; + auto& action_not_admit_list = sub_resp->ri_cactions_not_admitted.value; + action_not_admit_list.resize(1); + action_not_admit_list[0].load_info_obj(ASN1_E2AP_ID_RI_CACTION_NOT_ADMITTED_ITEM); + ri_caction_not_admitted_item_s& not_a_item = action_not_admit_list[0]->ri_caction_not_admitted_item(); + not_a_item.ric_action_id = 10; + not_a_item.cause.misc(); + return pdu; } diff --git a/srsgnb/src/stack/ric/e2sm_kpm.cc b/srsgnb/src/stack/ric/e2sm_kpm.cc index e2f6396e4..46b898174 100644 --- a/srsgnb/src/stack/ric/e2sm_kpm.cc +++ b/srsgnb/src/stack/ric/e2sm_kpm.cc @@ -8,12 +8,13 @@ bool e2sm_kpm::generate_ran_function_description(int f { using namespace asn1::e2sm_kpm; e2_sm_kpm_ra_nfunction_description_s e2sm_kpm_ra_nfunction_description; - e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_instance_present = true; - e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_instance = desc.function_instance; + e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_instance_present = false; + // e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_instance = desc.function_instance; e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_short_name.from_string(desc.function_shortname); e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_e2_sm_oid.from_string(desc.function_e2_sm_oid); e2sm_kpm_ra_nfunction_description.ran_function_name.ran_function_description.from_string(desc.function_desc); + /* e2sm_kpm_ra_nfunction_description.e2_sm_kpm_ra_nfunction_item.ric_event_trigger_style_list.resize(1); auto& ric_event_trigger_style_list_item = e2sm_kpm_ra_nfunction_description.e2_sm_kpm_ra_nfunction_item.ric_event_trigger_style_list[0]; @@ -56,7 +57,7 @@ bool e2sm_kpm::generate_ran_function_description(int f }; ric_report_style_list_item.ric_report_style_name.from_string("Periodic report"); } - + */ logger.info("Generating RAN function description"); asn1::bit_ref bref(buf->msg, buf->get_tailroom()); if (e2sm_kpm_ra_nfunction_description.pack(bref) != asn1::SRSASN_SUCCESS) { diff --git a/srsgnb/src/stack/ric/ric_client.cc b/srsgnb/src/stack/ric/ric_client.cc index 490a5e35c..af2478e33 100644 --- a/srsgnb/src/stack/ric/ric_client.cc +++ b/srsgnb/src/stack/ric/ric_client.cc @@ -54,7 +54,7 @@ bool ric_client::init() rx_sockets.add_socket_handler(ric_socket.fd(), srsran::make_sctp_sdu_handler(logger, ric_rece_task_queue, rx_callback)); - printf("SCTP socket connected with RIC. fd=%d", ric_socket.fd()); + printf("SCTP socket connected with RIC. fd=%d \n", ric_socket.fd()); running = true; start(0); return SRSRAN_SUCCESS; @@ -135,7 +135,7 @@ bool ric_client::send_e2_msg(e2_msg_type_t msg_type) } asn1::bit_ref bref(buf->msg, buf->get_tailroom()); if (send_pdu.pack(bref) != asn1::SRSASN_SUCCESS) { - logger.error("Failed to pack TX E2 PDU"); + logger.error("Failed to pack TX E2 PDU: %s", message_name); return false; } buf->N_bytes = bref.distance_bytes();