e2ap: register actions is SM

master
Piotr Gawlowicz 2 years ago committed by Justin Tallon
parent 406ca4ac12
commit d1ba988e27

@ -28,6 +28,12 @@ struct RIC_event_trigger_definition {
uint64_t report_period; uint64_t report_period;
}; };
struct E2AP_RIC_action {
uint16_t ric_action_id;
asn1::e2ap::ri_caction_type_e ric_action_type;
uint32_t sm_local_ric_action_id;
};
class e2sm class e2sm
{ {
public: public:
@ -44,13 +50,20 @@ public:
virtual bool generate_ran_function_description(RANfunction_description& desc, srsran::unique_byte_buffer_t& buf) = 0; virtual bool generate_ran_function_description(RANfunction_description& desc, srsran::unique_byte_buffer_t& buf) = 0;
virtual bool process_ric_event_trigger_definition(asn1::e2ap::ricsubscription_request_s subscription_request, virtual bool process_ric_event_trigger_definition(asn1::e2ap::ricsubscription_request_s subscription_request,
RIC_event_trigger_definition& event_def) = 0; RIC_event_trigger_definition& event_def) = 0;
virtual bool process_ric_action_definition(asn1::e2ap::ri_caction_to_be_setup_item_s ric_action) = 0; virtual bool process_ric_action_definition(asn1::e2ap::ri_caction_to_be_setup_item_s ric_action,
E2AP_RIC_action& action_entry) = 0;
virtual bool remove_ric_action_definition(E2AP_RIC_action& action_entry) = 0;
protected:
uint32_t _generate_local_action_id() { return _registered_action_id_gen++; };
private: private:
const std::string _short_name; const std::string _short_name;
const std::string _oid; const std::string _oid;
const std::string _func_description; const std::string _func_description;
const uint32_t _revision; const uint32_t _revision;
uint32_t _registered_action_id_gen = 1000;
}; };
struct RANfunction_description { struct RANfunction_description {

@ -48,13 +48,16 @@ public:
virtual bool generate_ran_function_description(RANfunction_description& desc, srsran::unique_byte_buffer_t& buf); virtual bool generate_ran_function_description(RANfunction_description& desc, srsran::unique_byte_buffer_t& buf);
virtual bool process_ric_event_trigger_definition(asn1::e2ap::ricsubscription_request_s subscription_request, virtual bool process_ric_event_trigger_definition(asn1::e2ap::ricsubscription_request_s subscription_request,
RIC_event_trigger_definition& event_def); RIC_event_trigger_definition& event_def);
virtual bool process_ric_action_definition(asn1::e2ap::ri_caction_to_be_setup_item_s ric_action); virtual bool process_ric_action_definition(asn1::e2ap::ri_caction_to_be_setup_item_s ric_action,
E2AP_RIC_action& action_entry);
virtual bool remove_ric_action_definition(E2AP_RIC_action& action_entry);
bool generate_indication_header(E2SM_KPM_RIC_ind_header hdr, srsran::unique_byte_buffer_t& buf); bool generate_indication_header(E2SM_KPM_RIC_ind_header hdr, srsran::unique_byte_buffer_t& buf);
bool generate_indication_message(E2SM_KPM_RIC_ind_message msg, srsran::unique_byte_buffer_t& buf); bool generate_indication_message(E2SM_KPM_RIC_ind_message msg, srsran::unique_byte_buffer_t& buf);
private: private:
srslog::basic_logger& logger; srslog::basic_logger& logger;
std::vector<std::string> supported_meas_types; std::vector<std::string> supported_meas_types;
std::map<uint32_t, asn1::e2sm_kpm::e2_sm_kpm_action_definition_s> registered_actions;
}; };
#endif /*E2SM_KPM*/ #endif /*E2SM_KPM*/

@ -47,7 +47,7 @@ private:
uint32_t reporting_period = 0; // ms uint32_t reporting_period = 0; // ms
srsran::unique_timer reporting_timer; // for RIC indication reporting srsran::unique_timer reporting_timer; // for RIC indication reporting
std::vector<uint32_t> admitted_actions; std::vector<E2AP_RIC_action> admitted_actions;
std::vector<uint32_t> not_admitted_actions; std::vector<uint32_t> not_admitted_actions;
}; };

@ -103,7 +103,8 @@ bool e2sm_kpm::process_ric_event_trigger_definition(asn1::e2ap::ricsubscription_
return true; return true;
} }
bool e2sm_kpm::process_ric_action_definition(asn1::e2ap::ri_caction_to_be_setup_item_s ric_action) bool e2sm_kpm::process_ric_action_definition(asn1::e2ap::ri_caction_to_be_setup_item_s ric_action,
E2AP_RIC_action& action_entry)
{ {
using namespace asn1::e2sm_kpm; using namespace asn1::e2sm_kpm;
e2_sm_kpm_action_definition_s e2sm_kpm_action_def; e2_sm_kpm_action_definition_s e2sm_kpm_action_def;
@ -171,7 +172,9 @@ bool e2sm_kpm::process_ric_action_definition(asn1::e2ap::ri_caction_to_be_setup_
} }
} }
} }
action_entry.sm_local_ric_action_id = _generate_local_action_id();
registered_actions.insert(std::pair<uint32_t, asn1::e2sm_kpm::e2_sm_kpm_action_definition_s>(
action_entry.sm_local_ric_action_id, e2sm_kpm_action_def));
break; break;
default: default:
logger.info("Unknown RIC style type %i -> do not admit action %i (type %i)", logger.info("Unknown RIC style type %i -> do not admit action %i (type %i)",
@ -184,6 +187,15 @@ bool e2sm_kpm::process_ric_action_definition(asn1::e2ap::ri_caction_to_be_setup_
return true; return true;
} }
bool e2sm_kpm::remove_ric_action_definition(E2AP_RIC_action& action_entry)
{
if (registered_actions.count(action_entry.sm_local_ric_action_id)) {
registered_actions.erase(action_entry.sm_local_ric_action_id);
return true;
}
return false;
}
bool e2sm_kpm::generate_indication_header(E2SM_KPM_RIC_ind_header hdr, srsran::unique_byte_buffer_t& buf) bool e2sm_kpm::generate_indication_header(E2SM_KPM_RIC_ind_header hdr, srsran::unique_byte_buffer_t& buf)
{ {
using namespace asn1::e2sm_kpm; using namespace asn1::e2sm_kpm;

@ -28,6 +28,7 @@ ric_client::ric_subscription::ric_subscription(ric_client* ric_cli
RANfunction_description ran_func_desc; RANfunction_description ran_func_desc;
if (!parent->e2ap_.get_func_desc(ra_nfunction_id, ran_func_desc)) { if (!parent->e2ap_.get_func_desc(ra_nfunction_id, ran_func_desc)) {
parent->logger.debug("Cannot find RAN function with ID: %i\n", ra_nfunction_id);
return; return;
} }
@ -45,19 +46,31 @@ ric_client::ric_subscription::ric_subscription(ric_client* ric_cli
for (uint32_t i = 0; i < action_list.size(); i++) { for (uint32_t i = 0; i < action_list.size(); i++) {
ri_caction_to_be_setup_item_s action_item = action_list[i]->ri_caction_to_be_setup_item(); ri_caction_to_be_setup_item_s action_item = action_list[i]->ri_caction_to_be_setup_item();
if (ran_func_desc.sm_ptr->process_ric_action_definition(action_item)) { E2AP_RIC_action admitted_action;
parent->logger.debug("Admitted action %i (type: %i)\n", action_item.ric_action_id, action_item.ric_action_type); admitted_action.ric_action_id = action_item.ric_action_id;
admitted_actions.push_back(action_item.ric_action_id); admitted_action.ric_action_type = action_item.ric_action_type;
if (ran_func_desc.sm_ptr->process_ric_action_definition(action_item, admitted_action)) {
parent->logger.debug("Admitted action %i (type: %i), mapped to SM local action ID: %i",
admitted_action.ric_action_id,
admitted_action.ric_action_type,
admitted_action.sm_local_ric_action_id);
printf("Admitted action %i, mapped to SM local action ID: %i\n",
action_item.ric_action_id,
admitted_action.sm_local_ric_action_id);
admitted_actions.push_back(admitted_action);
if (action_item.ric_subsequent_action_present) { if (action_item.ric_subsequent_action_present) {
parent->logger.debug("--Action %i (type: %i) contains subsequent action of type %i with wait time: %i\n", parent->logger.debug("--Action %i (type: %i) contains subsequent action of type %i with wait time: %i",
action_item.ric_action_id, action_item.ric_action_id,
action_item.ric_action_type, action_item.ric_action_type,
action_item.ric_subsequent_action.ric_subsequent_action_type, action_item.ric_subsequent_action.ric_subsequent_action_type,
action_item.ric_subsequent_action.ric_time_to_wait); action_item.ric_subsequent_action.ric_time_to_wait);
} else { } else {
parent->logger.debug( parent->logger.debug(
"Not admitted action %i (type: %i)\n", action_item.ric_action_id, action_item.ric_action_type); "Not admitted action %i (type: %i)", action_item.ric_action_id, action_item.ric_action_type);
not_admitted_actions.push_back(action_item.ric_action_id); not_admitted_actions.push_back(action_item.ric_action_id);
} }
} }
@ -73,7 +86,7 @@ void ric_client::ric_subscription::start_subscription()
ric_subscription_reponse.ra_nfunction_id = ra_nfunction_id; ric_subscription_reponse.ra_nfunction_id = ra_nfunction_id;
for (auto& action : admitted_actions) { for (auto& action : admitted_actions) {
ric_subscription_reponse.admitted_actions.push_back(action); ric_subscription_reponse.admitted_actions.push_back(action.ric_action_id);
} }
for (auto& action : not_admitted_actions) { for (auto& action : not_admitted_actions) {
@ -98,6 +111,16 @@ void ric_client::ric_subscription::delete_subscription()
reporting_timer.stop(); reporting_timer.stop();
} }
// remove registered actions from SM
RANfunction_description ran_func_desc;
if (!parent->e2ap_.get_func_desc(ra_nfunction_id, ran_func_desc)) {
parent->logger.debug("Cannot find RAN function with ID: %i\n", ra_nfunction_id);
return;
}
for (auto& action : admitted_actions) {
ran_func_desc.sm_ptr->remove_ric_action_definition(action);
}
parent->logger.debug("Send RIC Subscription Delete Response to RIC Requestor ID: %i\n", ric_requestor_id); parent->logger.debug("Send RIC Subscription Delete Response to RIC Requestor ID: %i\n", ric_requestor_id);
e2_ap_pdu_c send_pdu = e2_ap_pdu_c send_pdu =
parent->e2ap_.generate_subscription_delete_response(ric_requestor_id, ric_instance_id, ra_nfunction_id); parent->e2ap_.generate_subscription_delete_response(ric_requestor_id, ric_instance_id, ra_nfunction_id);

Loading…
Cancel
Save