e2ap: send metrics to all registred e2am instances

master
Piotr Gawlowicz 2 years ago committed by Justin Tallon
parent 9d7bfcc9c9
commit d5d876ecb0

@ -10,6 +10,7 @@
*
*/
#include "srsgnb/hdr/stack/ric/e2sm.h"
#include "srsran/common/common.h"
#include "srsran/common/interfaces_common.h"
#include "srsran/interfaces/enb_metrics_interface.h"
@ -24,6 +25,9 @@ class e2_interface_metrics
{
public:
virtual bool pull_metrics(enb_metrics_t* m) = 0;
virtual bool register_e2sm(e2sm* sm) = 0;
virtual bool unregister_e2sm(e2sm* sm) = 0;
};
} // namespace srsenb

@ -36,11 +36,15 @@ public:
bool pull_metrics(enb_metrics_t* m) override;
void stop(){};
bool register_e2sm(e2sm* sm) override;
bool unregister_e2sm(e2sm* sm) override;
private:
std::atomic<bool> do_print = {false};
uint8_t n_reports = 0;
std::queue<enb_metrics_t> metrics_queue;
enb_metrics_interface* enb = nullptr;
std::vector<e2sm*> e2sm_vec;
};
} // namespace srsenb

@ -23,6 +23,27 @@ void metrics_e2::set_metrics(const enb_metrics_t& m, const uint32_t period_usec)
} else {
metrics_queue.push(m);
}
// send new enb metrics to all registered SMs
for (auto sm_ : e2sm_vec) {
sm_->receive_e2_metrics_callback(m);
}
}
bool metrics_e2::register_e2sm(e2sm* sm)
{
e2sm_vec.push_back(sm);
return true;
}
bool metrics_e2::unregister_e2sm(e2sm* sm)
{
auto it = std::find(e2sm_vec.begin(), e2sm_vec.end(), sm);
if (it != e2sm_vec.end()) {
e2sm_vec.erase(it);
return true;
}
return false;
}
bool metrics_e2::pull_metrics(enb_metrics_t* m)

@ -13,12 +13,14 @@
#include "srsran/asn1/e2ap.h"
#include "srsran/common/byte_buffer.h"
#include "srsran/interfaces/enb_metrics_interface.h"
#include "srsran/srsran.h"
#ifndef SRSRAN_E2SM_H
#define SRSRAN_E2SM_H
using namespace asn1::e2ap;
using namespace srsenb;
struct RANfunction_description;
@ -67,6 +69,8 @@ public:
virtual bool remove_ric_action_definition(E2AP_RIC_action_t& action_entry) = 0;
virtual bool execute_action_fill_ric_indication(E2AP_RIC_action_t& action_entry, ric_indication_t& ric_indication) = 0;
virtual void receive_e2_metrics_callback(const enb_metrics_t& m) = 0;
protected:
uint32_t _generate_local_action_id() { return _registered_action_id_gen++; };

@ -55,6 +55,8 @@ public:
virtual bool remove_ric_action_definition(E2AP_RIC_action_t& action_entry);
virtual bool execute_action_fill_ric_indication(E2AP_RIC_action_t& action_entry, ric_indication_t& ric_indication);
virtual void receive_e2_metrics_callback(const enb_metrics_t& m);
private:
bool _process_ric_action_definition_format1(e2_sm_kpm_action_definition_format1_s& action_definition_format1);
bool _process_ric_action_definition_format2(e2_sm_kpm_action_definition_format2_s& action_definition_format2);
@ -77,6 +79,8 @@ private:
std::map<uint32_t, e2_sm_kpm_action_definition_s> registered_actions;
srsran_random_t random_gen;
enb_metrics_t last_enb_metrics;
};
#endif /*E2SM_KPM*/

@ -10,6 +10,9 @@ e2ap::e2ap(srslog::basic_logger& logger,
gnb_metrics = _gnb_metrics;
e2_procedure_timeout = task_sched_ptr->get_unique_timer();
// register SM to receive enb metrics
gnb_metrics->register_e2sm(&e2sm_);
// add SMs to map
uint32_t local_ran_function_id = 147;
RANfunction_description add_func;

@ -33,6 +33,15 @@ e2sm_kpm::e2sm_kpm(srslog::basic_logger& logger_) : e2sm(short_name, oid, func_d
}
}
void e2sm_kpm::receive_e2_metrics_callback(const enb_metrics_t& m)
{
last_enb_metrics = m;
logger.debug("e2sm_kpm received new enb metrics, CPU0 Load: %.1f", last_enb_metrics.sys.cpu_load[0]);
// TODO: for INSERT type of reporting check if a specified metrics exceeds predefined thresholds,
// if so then send RIC indication throught proper subscription
}
bool e2sm_kpm::generate_ran_function_description(RANfunction_description& desc, ra_nfunction_item_s& ran_func)
{
desc.function_shortname = short_name;

Loading…
Cancel
Save