diff --git a/srsgnb/hdr/stack/ric/e2ap.h b/srsgnb/hdr/stack/ric/e2ap.h index a47156802..3fbb1c651 100644 --- a/srsgnb/hdr/stack/ric/e2ap.h +++ b/srsgnb/hdr/stack/ric/e2ap.h @@ -46,6 +46,7 @@ public: int process_subscription_request(ricsubscription_request_s subscription_request); e2_ap_pdu_c generate_subscription_response(); int generate_subscription_failure(); + e2_ap_pdu_c generate_subscription_delete_response(); e2_ap_pdu_c generate_indication(); e2_ap_pdu_c generate_reset_request(); e2_ap_pdu_c generate_reset_response(); diff --git a/srsgnb/hdr/stack/ric/ric_client.h b/srsgnb/hdr/stack/ric/ric_client.h index adc1f6520..2d9d645c5 100644 --- a/srsgnb/hdr/stack/ric/ric_client.h +++ b/srsgnb/hdr/stack/ric/ric_client.h @@ -23,7 +23,14 @@ static const int e2ap_ppid = 70; static const int e2ap_port = 36421; -enum e2_msg_type_t { E2_SETUP_REQUEST, E2_SUB_RESPONSE, E2_INDICATION, E2_RESET, E2_RESET_RESPONSE }; +enum e2_msg_type_t { + E2_SETUP_REQUEST, + E2_SUB_RESPONSE, + E2_SUB_DEL_RESPONSE, + E2_INDICATION, + E2_RESET, + E2_RESET_RESPONSE +}; namespace srsenb { class ric_client : public srsran::thread @@ -49,6 +56,7 @@ public: bool handle_e2_unsuccessful_outcome(asn1::e2ap::unsuccessful_outcome_s& unsuccessful_outcome); bool handle_e2_setup_response(e2setup_resp_s setup_response); bool handle_ric_subscription_request(ricsubscription_request_s ric_subscription_request); + bool handle_ric_subscription_delete_request(ricsubscription_delete_request_s ricsubscription_delete_request); bool handle_reset_response(reset_resp_s& reset_response); bool handle_reset_request(reset_request_s& reset_request); diff --git a/srsgnb/src/stack/ric/e2ap.cc b/srsgnb/src/stack/ric/e2ap.cc index 75136d614..adc2993ee 100644 --- a/srsgnb/src/stack/ric/e2ap.cc +++ b/srsgnb/src/stack/ric/e2ap.cc @@ -96,7 +96,25 @@ e2_ap_pdu_c e2ap::generate_subscription_response() 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(); + not_a_item.cause.set_misc(); + + return pdu; +} + +e2_ap_pdu_c e2ap::generate_subscription_delete_response() +{ + e2_ap_pdu_c pdu; + successful_outcome_s& success = pdu.set_successful_outcome(); + success.load_info_obj(ASN1_E2AP_ID_RICSUBSCRIPTION_DELETE); + success.crit = asn1::crit_opts::reject; + ricsubscription_delete_resp_s& sub_resp = success.value.ricsubscription_delete_resp(); + + sub_resp->ri_crequest_id.crit = asn1::crit_opts::reject; + sub_resp->ri_crequest_id->ric_requestor_id = 1021; + sub_resp->ri_crequest_id->ric_instance_id = 0; + + sub_resp->ra_nfunction_id.crit = asn1::crit_opts::reject; + sub_resp->ra_nfunction_id->value = 147; return pdu; } diff --git a/srsgnb/src/stack/ric/ric_client.cc b/srsgnb/src/stack/ric/ric_client.cc index e2dbff5a6..0bdc7f853 100644 --- a/srsgnb/src/stack/ric/ric_client.cc +++ b/srsgnb/src/stack/ric/ric_client.cc @@ -118,6 +118,10 @@ bool ric_client::send_e2_msg(e2_msg_type_t msg_type) send_pdu = e2ap_.generate_subscription_response(); message_name = "E2 SUBSCRIPTION RESPONSE"; break; + case e2_msg_type_t::E2_SUB_DEL_RESPONSE: + send_pdu = e2ap_.generate_subscription_delete_response(); + message_name = "E2 SUBSCRIPTION DELETE RESPONSE"; + break; case e2_msg_type_t::E2_INDICATION: send_pdu = e2ap_.generate_indication(); message_name = "E2 INDICATION"; @@ -183,7 +187,7 @@ bool ric_client::handle_e2_init_msg(asn1::e2ap::init_msg_s& init_msg) handle_ric_subscription_request(init_msg.value.ricsubscription_request()); } else if (init_msg.value.type() == e2_ap_elem_procs_o::init_msg_c::types_opts::ricsubscription_delete_request) { logger.info("Received E2AP RIC Subscription Delete Request"); - // handle_ric_subscription_delete_request(init_msg.value.ricsubscription_delete_request()); + handle_ric_subscription_delete_request(init_msg.value.ricsubscription_delete_request()); } else if (init_msg.value.type() == e2_ap_elem_procs_o::init_msg_c::types_opts::ri_cctrl_request) { logger.info("Received E2AP RIC Control Request"); // handle_ri_cctrl_request(init_msg.value.ri_cctrl_request()); @@ -270,6 +274,14 @@ bool ric_client::handle_ric_subscription_request(ricsubscription_request_s ric_s return true; } +bool ric_client::handle_ric_subscription_delete_request(ricsubscription_delete_request_s ricsubscription_delete_request) +{ + auto send_resp = [this]() { send_e2_msg(E2_SUB_DEL_RESPONSE); }; + ric_rece_task_queue.push(send_resp); + + return true; +} + bool ric_client::handle_reset_request(reset_request_s& reset_request) { printf("Received E2AP E2 Reset Request \n");