From d1ed79175b3175efa447f9b3ccacdf0c3b054c6b Mon Sep 17 00:00:00 2001 From: Piotr Gawlowicz Date: Mon, 20 Mar 2023 13:59:39 +0100 Subject: [PATCH] e2ap: parametrize subscription reponse --- srsgnb/hdr/stack/ric/e2ap.h | 10 +++++- srsgnb/src/stack/ric/e2ap.cc | 42 ++++++++++++++---------- srsgnb/src/stack/ric/ric_subscription.cc | 10 +++++- 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/srsgnb/hdr/stack/ric/e2ap.h b/srsgnb/hdr/stack/ric/e2ap.h index 3fbb1c651..698ecbac5 100644 --- a/srsgnb/hdr/stack/ric/e2ap.h +++ b/srsgnb/hdr/stack/ric/e2ap.h @@ -36,6 +36,14 @@ typedef struct { std::string response_part; } e2_node_component_t; +typedef struct { + uint32_t ric_requestor_id; + uint32_t ric_instance_id; + uint32_t ra_nfunction_id; + std::vector admitted_actions; + std::vector not_admitted_actions; +} ric_subscription_reponse_t; + class e2ap { public: @@ -44,7 +52,7 @@ public: int process_setup_response(e2setup_resp_s setup_response); int process_setup_failure(); int process_subscription_request(ricsubscription_request_s subscription_request); - e2_ap_pdu_c generate_subscription_response(); + e2_ap_pdu_c generate_subscription_response(ric_subscription_reponse_t ric_subscription_reponse); int generate_subscription_failure(); e2_ap_pdu_c generate_subscription_delete_response(); e2_ap_pdu_c generate_indication(); diff --git a/srsgnb/src/stack/ric/e2ap.cc b/srsgnb/src/stack/ric/e2ap.cc index adc2993ee..277171953 100644 --- a/srsgnb/src/stack/ric/e2ap.cc +++ b/srsgnb/src/stack/ric/e2ap.cc @@ -66,7 +66,7 @@ e2_ap_pdu_c e2ap::generate_setup_request() return pdu; } -e2_ap_pdu_c e2ap::generate_subscription_response() +e2_ap_pdu_c e2ap::generate_subscription_response(ric_subscription_reponse_t ric_subscription_reponse) { e2_ap_pdu_c pdu; successful_outcome_s& success = pdu.set_successful_outcome(); @@ -76,27 +76,33 @@ e2_ap_pdu_c e2ap::generate_subscription_response() 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 = 1021; - sub_resp->ri_crequest_id.value.ric_instance_id = 0; + 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 = 147; + 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->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); - 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.set_misc(); + action_admit_list.resize(ric_subscription_reponse.admitted_actions.size()); + for (uint32_t i = 0; i < ric_subscription_reponse.admitted_actions.size(); i++) { + action_admit_list[i].load_info_obj(ASN1_E2AP_ID_RI_CACTION_ADMITTED_ITEM); + ri_caction_admitted_item_s& a_item = action_admit_list[i]->ri_caction_admitted_item(); + a_item.ric_action_id = ric_subscription_reponse.admitted_actions[i]; + } + + if (ric_subscription_reponse.not_admitted_actions.size()) { + 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(ric_subscription_reponse.not_admitted_actions.size()); + for (uint32_t i = 0; i < ric_subscription_reponse.not_admitted_actions.size(); i++) { + action_not_admit_list[i].load_info_obj(ASN1_E2AP_ID_RI_CACTION_NOT_ADMITTED_ITEM); + ri_caction_not_admitted_item_s& not_a_item = action_not_admit_list[i]->ri_caction_not_admitted_item(); + not_a_item.ric_action_id = ric_subscription_reponse.not_admitted_actions[i]; + not_a_item.cause.set_misc(); // TODO: support cause properly + } + } return pdu; } diff --git a/srsgnb/src/stack/ric/ric_subscription.cc b/srsgnb/src/stack/ric/ric_subscription.cc index b4417c107..ac6ffaf00 100644 --- a/srsgnb/src/stack/ric/ric_subscription.cc +++ b/srsgnb/src/stack/ric/ric_subscription.cc @@ -32,7 +32,15 @@ ric_client::ric_subscription::ric_subscription(ric_client* ric_cli void ric_client::ric_subscription::start_ric_indication_reporting() { parent->logger.debug("Send RIC Subscription Response to RIC Requestor ID: %i\n", ric_requestor_id); - e2_ap_pdu_c send_pdu = parent->e2ap_.generate_subscription_response(); + 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; + + ric_subscription_reponse.admitted_actions.push_back(0); + ric_subscription_reponse.not_admitted_actions.push_back(10); + + e2_ap_pdu_c send_pdu = parent->e2ap_.generate_subscription_response(ric_subscription_reponse); parent->queue_send_e2ap_pdu(send_pdu); printf("Start sending RIC indication msgs every %i ms\n", reporting_period);