From 0c7d499250ec0cf32685d585ae9280d431c57fdd Mon Sep 17 00:00:00 2001 From: Piotr Gawlowicz Date: Wed, 22 Mar 2023 15:43:48 +0100 Subject: [PATCH] e2ap: add RIC indication SN --- srsgnb/hdr/stack/ric/e2sm.h | 2 ++ srsgnb/hdr/stack/ric/ric_subscription.h | 3 +++ srsgnb/src/stack/ric/e2ap.cc | 6 ++++++ srsgnb/src/stack/ric/ric_subscription.cc | 12 ++++++++++++ 4 files changed, 23 insertions(+) diff --git a/srsgnb/hdr/stack/ric/e2sm.h b/srsgnb/hdr/stack/ric/e2sm.h index 54df1a31b..242936812 100644 --- a/srsgnb/hdr/stack/ric/e2sm.h +++ b/srsgnb/hdr/stack/ric/e2sm.h @@ -39,6 +39,8 @@ typedef struct { uint32_t ric_instance_id; uint32_t ra_nfunction_id; uint32_t ri_caction_id; + bool ri_indication_sn_present; + uint32_t ri_indication_sn; ri_cind_type_e indication_type; srsran::unique_byte_buffer_t ri_cind_hdr; srsran::unique_byte_buffer_t ri_cind_msg; diff --git a/srsgnb/hdr/stack/ric/ric_subscription.h b/srsgnb/hdr/stack/ric/ric_subscription.h index 85782d7aa..b3c0381ad 100644 --- a/srsgnb/hdr/stack/ric/ric_subscription.h +++ b/srsgnb/hdr/stack/ric/ric_subscription.h @@ -38,6 +38,7 @@ public: private: void send_ric_indication(); + uint32_t _generate_ric_indication_sn(); ric_client* parent = nullptr; bool initialized = false; @@ -52,6 +53,8 @@ private: std::vector admitted_actions; std::vector not_admitted_actions; + + uint32_t _ric_indication_sn_gen = 0; }; } // namespace srsenb diff --git a/srsgnb/src/stack/ric/e2ap.cc b/srsgnb/src/stack/ric/e2ap.cc index 034f07f5d..667d365c5 100644 --- a/srsgnb/src/stack/ric/e2ap.cc +++ b/srsgnb/src/stack/ric/e2ap.cc @@ -207,6 +207,12 @@ e2_ap_pdu_c e2ap::generate_indication(ric_indication_t& ric_indication) indication->ri_caction_id.crit = asn1::crit_opts::reject; indication->ri_caction_id.value = ric_indication.ri_caction_id; + if (ric_indication.ri_indication_sn_present) { + indication->ri_cind_sn_present = true; + indication->ri_cind_sn.crit = asn1::crit_opts::reject; + indication->ri_cind_sn->value = ric_indication.ri_indication_sn; + } + indication->ri_cind_type.crit = asn1::crit_opts::reject; indication->ri_cind_type.value = ric_indication.indication_type; diff --git a/srsgnb/src/stack/ric/ric_subscription.cc b/srsgnb/src/stack/ric/ric_subscription.cc index 24dcef893..7d1a2ad5f 100644 --- a/srsgnb/src/stack/ric/ric_subscription.cc +++ b/srsgnb/src/stack/ric/ric_subscription.cc @@ -140,6 +140,16 @@ void ric_client::ric_subscription::delete_subscription() parent->queue_send_e2ap_pdu(send_pdu); } +uint32_t ric_client::ric_subscription::_generate_ric_indication_sn() +{ + uint32_t sn = _ric_indication_sn_gen; + _ric_indication_sn_gen++; + if (_ric_indication_sn_gen > 65535) { + _ric_indication_sn_gen = 0; + } + return sn; +}; + void ric_client::ric_subscription::send_ric_indication() { if (sm_ptr == nullptr) { @@ -154,6 +164,8 @@ void ric_client::ric_subscription::send_ric_indication() ric_indication.ric_instance_id = ric_instance_id; ric_indication.ra_nfunction_id = ra_nfunction_id; ric_indication.ri_caction_id = action.ric_action_id; + ric_indication.ri_indication_sn_present = true; + ric_indication.ri_indication_sn = _generate_ric_indication_sn(); sm_ptr->execute_action_fill_ric_indication(action, ric_indication); e2_ap_pdu_c send_pdu = parent->e2ap_.generate_indication(ric_indication);