diff --git a/srsgnb/hdr/stack/ric/e2ap.h b/srsgnb/hdr/stack/ric/e2ap.h index de66d9516..c539de8ba 100644 --- a/srsgnb/hdr/stack/ric/e2ap.h +++ b/srsgnb/hdr/stack/ric/e2ap.h @@ -58,6 +58,7 @@ public: e2_ap_pdu_c generate_subscription_response(ric_subscription_reponse_t ric_subscription_reponse); e2_ap_pdu_c generate_subscription_failure(ric_subscription_reponse_t ric_subscription_reponse); e2_ap_pdu_c generate_subscription_delete_response(ric_subscription_reponse_t ric_subscription_reponse); + e2_ap_pdu_c generate_subscription_delete_failure(ric_subscription_reponse_t ric_subscription_reponse); e2_ap_pdu_c generate_indication(ric_indication_t& ric_indication); e2_ap_pdu_c generate_reset_request(); e2_ap_pdu_c generate_reset_response(); diff --git a/srsgnb/src/stack/ric/e2ap.cc b/srsgnb/src/stack/ric/e2ap.cc index 426280666..a2527d68a 100644 --- a/srsgnb/src/stack/ric/e2ap.cc +++ b/srsgnb/src/stack/ric/e2ap.cc @@ -153,6 +153,29 @@ e2_ap_pdu_c e2ap::generate_subscription_delete_response(ric_subscription_reponse return pdu; } +e2_ap_pdu_c e2ap::generate_subscription_delete_failure(ric_subscription_reponse_t ric_subscription_reponse) +{ + e2_ap_pdu_c pdu; + unsuccessful_outcome_s& failure = pdu.set_unsuccessful_outcome(); + failure.load_info_obj(ASN1_E2AP_ID_RICSUBSCRIPTION); + failure.crit = asn1::crit_opts::reject; + ricsubscription_delete_fail_s& sub_resp = failure.value.ricsubscription_delete_fail(); + + 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 = ric_subscription_reponse.ric_requestor_id; + sub_resp->ri_crequest_id.value.ric_instance_id = ric_subscription_reponse.ric_instance_id; + + 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 = ric_subscription_reponse.ra_nfunction_id; + + sub_resp->cause->set_misc(); // TODO: set the cause and crit_diagnostics properly + sub_resp->crit_diagnostics_present = false; + + return pdu; +} + int e2ap::process_setup_response(e2setup_resp_s setup_response) { if (setup_procedure_transaction_id == setup_response->transaction_id.value.value) { diff --git a/srsgnb/src/stack/ric/ric_subscription.cc b/srsgnb/src/stack/ric/ric_subscription.cc index e95e78b22..22e37149e 100644 --- a/srsgnb/src/stack/ric/ric_subscription.cc +++ b/srsgnb/src/stack/ric/ric_subscription.cc @@ -127,18 +127,24 @@ void ric_client::ric_subscription::delete_subscription() reporting_timer.stop(); } + ric_subscription_reponse_t ric_subscription_reponse; + ric_subscription_reponse.ric_requestor_id = ric_requestor_id; + ric_subscription_reponse.ric_instance_id = ric_instance_id; + ric_subscription_reponse.ra_nfunction_id = ra_nfunction_id; + // remove registered actions from SM if (sm_ptr) { for (auto& action : admitted_actions) { sm_ptr->remove_ric_action_definition(action); } + } else { + e2_ap_pdu_c send_pdu = parent->e2ap_.generate_subscription_delete_failure(ric_subscription_reponse); + parent->queue_send_e2ap_pdu(send_pdu); + return; } parent->logger.debug("Send RIC Subscription Delete Response to RIC Requestor ID: %i\n", ric_requestor_id); - ric_subscription_reponse_t ric_subscription_reponse; - ric_subscription_reponse.ric_requestor_id = ric_requestor_id; - ric_subscription_reponse.ric_instance_id = ric_instance_id; - ric_subscription_reponse.ra_nfunction_id = ra_nfunction_id; + e2_ap_pdu_c send_pdu = parent->e2ap_.generate_subscription_delete_response(ric_subscription_reponse); parent->queue_send_e2ap_pdu(send_pdu); }