e2: rename class ric_client to e2_agent

master
Piotr Gawlowicz 2 years ago committed by Justin Tallon
parent f48a80a06e
commit 79c3cb600b

@ -371,7 +371,7 @@ enable = false
#ema_alpha = 0.0143 #ema_alpha = 0.0143
##################################################################### #####################################################################
[ric_client] [e2_agent]
enable = true enable = true
#ric_ip = 127.0.0.1 #ric_ip = 127.0.0.1
#ric_port = 36421 #ric_port = 36421

@ -114,7 +114,7 @@ struct all_args_t {
general_args_t general; general_args_t general;
phy_args_t phy; phy_args_t phy;
stack_args_t stack; stack_args_t stack;
ric_args_t ric_client; e2_agent_args_t e2_agent;
gnb_stack_args_t nr_stack; gnb_stack_args_t nr_stack;
}; };
@ -139,7 +139,7 @@ public:
void print_pool(); void print_pool();
bool enable_ric_client(srsenb::e2_interface_metrics* e2_metrics); bool enable_e2_agent(srsenb::e2_interface_metrics* e2_metrics);
// eNodeB metrics interface // eNodeB metrics interface
bool get_metrics(enb_metrics_t* m) override; bool get_metrics(enb_metrics_t* m) override;
@ -174,7 +174,7 @@ private:
std::unique_ptr<enb_stack_base> nr_stack = nullptr; std::unique_ptr<enb_stack_base> nr_stack = nullptr;
std::unique_ptr<srsran::radio_base> radio = nullptr; std::unique_ptr<srsran::radio_base> radio = nullptr;
std::unique_ptr<enb_phy_base> phy = nullptr; std::unique_ptr<enb_phy_base> phy = nullptr;
std::unique_ptr<ric_client> ric = nullptr; std::unique_ptr<e2_agent> _e2_agent = nullptr;
// System metrics processor. // System metrics processor.
srsran::sys_metrics_processor sys_proc; srsran::sys_metrics_processor sys_proc;

@ -190,19 +190,19 @@ void enb::start_plot()
phy->start_plot(); phy->start_plot();
} }
bool enb::enable_ric_client(srsenb::e2_interface_metrics* e2_metrics) bool enb::enable_e2_agent(srsenb::e2_interface_metrics* e2_metrics)
{ {
std::unique_ptr<srsenb::ric_client> tmp_ric_client = std::unique_ptr<srsenb::ric_client>( std::unique_ptr<srsenb::e2_agent> tmp_e2_agent = std::unique_ptr<srsenb::e2_agent>(
new srsenb::ric_client(srslog::fetch_basic_logger("RIC", log_sink, false), e2_metrics)); new srsenb::e2_agent(srslog::fetch_basic_logger("E2_AGENT", log_sink, false), e2_metrics));
if (tmp_ric_client == nullptr) { if (tmp_e2_agent == nullptr) {
srsran::console("Error creating RIC client instance.\n"); srsran::console("Error creating e2_agent instance.\n");
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
if (tmp_ric_client->init(args.ric_client)) { if (tmp_e2_agent->init(args.e2_agent)) {
srsran::console("Error initializing RIC client.\n"); srsran::console("Error initializing e2_agent client.\n");
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
ric = std::move(tmp_ric_client); _e2_agent = std::move(tmp_e2_agent);
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }
@ -275,8 +275,8 @@ void enb::tti_clock()
return; return;
} }
if (ric) { if (_e2_agent) {
ric->tic(); _e2_agent->tic();
} }
if (eutra_stack) { if (eutra_stack) {

@ -229,9 +229,9 @@ void parse_args(all_args_t* args, int argc, char* argv[])
("cfr.ema_alpha", bpo::value<float>(&args->phy.cfr_args.ema_alpha)->default_value(args->phy.cfr_args.ema_alpha), "Alpha coefficient for the power average in auto_ema mode (0 to 1)") ("cfr.ema_alpha", bpo::value<float>(&args->phy.cfr_args.ema_alpha)->default_value(args->phy.cfr_args.ema_alpha), "Alpha coefficient for the power average in auto_ema mode (0 to 1)")
/* RIC section */ /* RIC section */
("ric_client.enable", bpo::value<bool>(&args->ric_client.enable)->default_value(false), "Enables the RIC client") ("e2_agent.enable", bpo::value<bool>(&args->e2_agent.enable)->default_value(false), "Enables the E2 agent")
("ric_client.ric_ip", bpo::value<string>(&args->ric_client.ric_ip)->default_value("127.0.0.1"), "RIC IP address") ("e2_agent.ric_ip", bpo::value<string>(&args->e2_agent.ric_ip)->default_value("127.0.0.1"), "RIC IP address")
("ric_client.ric_port", bpo::value<uint32_t>(&args->ric_client.ric_port)->default_value(36421), "RIC port") ("e2_agent.ric_port", bpo::value<uint32_t>(&args->e2_agent.ric_port)->default_value(36421), "RIC port")
/* Expert section */ /* Expert section */
("expert.metrics_period_secs", bpo::value<float>(&args->general.metrics_period_secs)->default_value(1.0), "Periodicity for metrics in seconds.") ("expert.metrics_period_secs", bpo::value<float>(&args->general.metrics_period_secs)->default_value(1.0), "Periodicity for metrics in seconds.")
@ -684,7 +684,7 @@ int main(int argc, char* argv[])
metricshub.add_listener(&json_metrics); metricshub.add_listener(&json_metrics);
} }
srsenb::metrics_e2 e2_metrics(enb.get()); srsenb::metrics_e2 e2_metrics(enb.get());
if (args.ric_client.enable) { if (args.e2_agent.enable) {
metricshub.add_listener(&e2_metrics); metricshub.add_listener(&e2_metrics);
} }
@ -695,9 +695,9 @@ int main(int argc, char* argv[])
if (args.gui.enable) { if (args.gui.enable) {
enb->start_plot(); enb->start_plot();
} }
if (args.ric_client.enable) { if (args.e2_agent.enable) {
if (enb->enable_ric_client(&e2_metrics)) { if (enb->enable_e2_agent(&e2_metrics)) {
srslog::fetch_basic_logger("RIC").error("Failed to enable RIC client"); srslog::fetch_basic_logger("E2_AGENT").error("Failed to enable E2 Agent");
} }
} }
} }

@ -46,13 +46,13 @@ typedef struct {
std::vector<uint32_t> not_admitted_actions; std::vector<uint32_t> not_admitted_actions;
} ric_subscription_reponse_t; } ric_subscription_reponse_t;
class ric_client; class e2_agent;
class e2ap class e2ap
{ {
public: public:
e2ap(srslog::basic_logger& logger, e2ap(srslog::basic_logger& logger,
ric_client* _ric_client, e2_agent* _e2_agent,
srsenb::e2_interface_metrics* _gnb_metrics, srsenb::e2_interface_metrics* _gnb_metrics,
srsran::task_scheduler* _task_sched_ptr); srsran::task_scheduler* _task_sched_ptr);
~e2ap(); ~e2ap();
@ -95,7 +95,7 @@ public:
private: private:
srslog::basic_logger& logger; srslog::basic_logger& logger;
ric_client* _ric_client; e2_agent* _e2_agent;
e2sm_kpm e2sm_; e2sm_kpm e2sm_;
bool e2_established = false; bool e2_established = false;
srsran::unique_timer e2_procedure_timeout; srsran::unique_timer e2_procedure_timeout;

@ -32,21 +32,21 @@ enum e2_msg_type_t {
E2_RESET_RESPONSE E2_RESET_RESPONSE
}; };
struct ric_args_t { struct e2_agent_args_t {
bool enable; bool enable;
std::string ric_ip; std::string ric_ip;
uint32_t ric_port; uint32_t ric_port;
}; };
namespace srsenb { namespace srsenb {
class ric_client : public srsran::thread class e2_agent : public srsran::thread
{ {
public: public:
ric_client(srslog::basic_logger& logger, srsenb::e2_interface_metrics* _gnb_metrics); e2_agent(srslog::basic_logger& logger, srsenb::e2_interface_metrics* _gnb_metrics);
~ric_client() = default; ~e2_agent() = default;
// Initiate and Stop // Initiate and Stop
bool init(ric_args_t args); bool init(e2_agent_args_t args);
void stop(); void stop();
void run_thread(); void run_thread();
void tic(); void tic();

@ -15,10 +15,10 @@
#include "srsgnb/hdr/stack/ric/ric_client.h" #include "srsgnb/hdr/stack/ric/ric_client.h"
e2ap::e2ap(srslog::basic_logger& logger, e2ap::e2ap(srslog::basic_logger& logger,
ric_client* _ric_client, e2_agent* _e2_agent,
srsenb::e2_interface_metrics* _gnb_metrics, srsenb::e2_interface_metrics* _gnb_metrics,
srsran::task_scheduler* _task_sched_ptr) : srsran::task_scheduler* _task_sched_ptr) :
logger(logger), _ric_client(_ric_client), e2sm_(logger, _task_sched_ptr), task_sched_ptr(_task_sched_ptr) logger(logger), _e2_agent(_e2_agent), e2sm_(logger, _task_sched_ptr), task_sched_ptr(_task_sched_ptr)
{ {
gnb_metrics = _gnb_metrics; gnb_metrics = _gnb_metrics;
e2_procedure_timeout = task_sched_ptr->get_unique_timer(); e2_procedure_timeout = task_sched_ptr->get_unique_timer();
@ -47,8 +47,8 @@ bool e2ap::get_func_desc(uint32_t ran_func_id, RANfunction_description& fdesc)
bool e2ap::queue_send_e2ap_pdu(e2_ap_pdu_c e2ap_pdu) bool e2ap::queue_send_e2ap_pdu(e2_ap_pdu_c e2ap_pdu)
{ {
if (_ric_client) { if (_e2_agent) {
_ric_client->queue_send_e2ap_pdu(e2ap_pdu); _e2_agent->queue_send_e2ap_pdu(e2ap_pdu);
} }
return true; return true;
} }
@ -382,7 +382,7 @@ int e2ap::process_reset_request(reset_request_s reset_request)
{ {
reset_id = reset_request->transaction_id.value; reset_id = reset_request->transaction_id.value;
// TO DO: Parse and store the cause for future extension of the ric client // TODO: Parse and store the cause for future extension of the e2_agent
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }

@ -14,19 +14,15 @@
#include "srsran/asn1/e2ap.h" #include "srsran/asn1/e2ap.h"
using namespace srsenb; using namespace srsenb;
ric_client::ric_client(srslog::basic_logger& logger, e2_interface_metrics* _gnb_metrics) : e2_agent::e2_agent(srslog::basic_logger& logger, e2_interface_metrics* _gnb_metrics) :
task_sched(), task_sched(), logger(logger), rx_sockets(), thread("E2_AGENT_THREAD"), e2ap_(logger, this, _gnb_metrics, &task_sched)
logger(logger),
rx_sockets(),
thread("RIC_CLIENT_THREAD"),
e2ap_(logger, this, _gnb_metrics, &task_sched)
{ {
gnb_metrics = _gnb_metrics; gnb_metrics = _gnb_metrics;
} }
bool ric_client::init(ric_args_t args) bool e2_agent::init(e2_agent_args_t args)
{ {
printf("RIC_CLIENT: Init\n"); printf("E2_AGENT: Init\n");
using namespace srsran::net_utils; using namespace srsran::net_utils;
// Open SCTP socket // Open SCTP socket
if (not ric_socket.open_socket(addr_family::ipv4, socket_type::seqpacket, protocol_type::SCTP)) { if (not ric_socket.open_socket(addr_family::ipv4, socket_type::seqpacket, protocol_type::SCTP)) {
@ -63,19 +59,19 @@ bool ric_client::init(ric_args_t args)
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }
void ric_client::stop() void e2_agent::stop()
{ {
running = false; running = false;
wait_thread_finish(); wait_thread_finish();
} }
void ric_client::tic() void e2_agent::tic()
{ {
// get tick every 1ms to advance timers // get tick every 1ms to advance timers
task_sched.tic(); task_sched.tic();
} }
void ric_client::run_thread() void e2_agent::run_thread()
{ {
using namespace asn1::e2ap; using namespace asn1::e2ap;
@ -88,7 +84,7 @@ void ric_client::run_thread()
} }
} }
bool ric_client::send_sctp(srsran::unique_byte_buffer_t& buf) bool e2_agent::send_sctp(srsran::unique_byte_buffer_t& buf)
{ {
ssize_t ret; ssize_t ret;
ret = sctp_sendmsg(ric_socket.fd(), ret = sctp_sendmsg(ric_socket.fd(),
@ -108,7 +104,7 @@ bool ric_client::send_sctp(srsran::unique_byte_buffer_t& buf)
return true; return true;
} }
bool ric_client::send_e2_msg(e2_msg_type_t msg_type) bool e2_agent::send_e2_msg(e2_msg_type_t msg_type)
{ {
std::string message_name; std::string message_name;
e2_ap_pdu_c send_pdu; e2_ap_pdu_c send_pdu;
@ -134,14 +130,14 @@ bool ric_client::send_e2_msg(e2_msg_type_t msg_type)
return send_e2ap_pdu(send_pdu); return send_e2ap_pdu(send_pdu);
} }
bool ric_client::queue_send_e2ap_pdu(e2_ap_pdu_c e2ap_pdu) bool e2_agent::queue_send_e2ap_pdu(e2_ap_pdu_c e2ap_pdu)
{ {
auto send_e2ap_pdu_task = [this, e2ap_pdu]() { send_e2ap_pdu(e2ap_pdu); }; auto send_e2ap_pdu_task = [this, e2ap_pdu]() { send_e2ap_pdu(e2ap_pdu); };
ric_rece_task_queue.push(send_e2ap_pdu_task); ric_rece_task_queue.push(send_e2ap_pdu_task);
return true; return true;
} }
bool ric_client::send_e2ap_pdu(e2_ap_pdu_c send_pdu) bool e2_agent::send_e2ap_pdu(e2_ap_pdu_c send_pdu)
{ {
srsran::unique_byte_buffer_t buf = srsran::make_byte_buffer(); srsran::unique_byte_buffer_t buf = srsran::make_byte_buffer();
if (buf == nullptr) { if (buf == nullptr) {
@ -162,12 +158,12 @@ bool ric_client::send_e2ap_pdu(e2_ap_pdu_c send_pdu)
return true; return true;
} }
bool ric_client::handle_e2_rx_msg(srsran::unique_byte_buffer_t pdu, bool e2_agent::handle_e2_rx_msg(srsran::unique_byte_buffer_t pdu,
const sockaddr_in& from, const sockaddr_in& from,
const sctp_sndrcvinfo& sri, const sctp_sndrcvinfo& sri,
int flags) int flags)
{ {
printf("RIC_CLIENT: Received %d bytes from %s\n", pdu->N_bytes, inet_ntoa(from.sin_addr)); printf("E2_AGENT: Received %d bytes from %s\n", pdu->N_bytes, inet_ntoa(from.sin_addr));
e2_ap_pdu_c pdu_c; e2_ap_pdu_c pdu_c;
asn1::cbit_ref bref(pdu->msg, pdu->N_bytes); asn1::cbit_ref bref(pdu->msg, pdu->N_bytes);
if (pdu_c.unpack(bref) != asn1::SRSASN_SUCCESS) { if (pdu_c.unpack(bref) != asn1::SRSASN_SUCCESS) {
@ -189,7 +185,7 @@ bool ric_client::handle_e2_rx_msg(srsran::unique_byte_buffer_t pdu,
return true; return true;
} }
bool ric_client::handle_e2_init_msg(asn1::e2ap::init_msg_s& init_msg) bool e2_agent::handle_e2_init_msg(asn1::e2ap::init_msg_s& init_msg)
{ {
using namespace asn1::e2ap; using namespace asn1::e2ap;
if (init_msg.value.type() == e2_ap_elem_procs_o::init_msg_c::types_opts::ricsubscription_request) { if (init_msg.value.type() == e2_ap_elem_procs_o::init_msg_c::types_opts::ricsubscription_request) {
@ -218,7 +214,7 @@ bool ric_client::handle_e2_init_msg(asn1::e2ap::init_msg_s& init_msg)
return true; return true;
} }
bool ric_client::handle_e2_successful_outcome(asn1::e2ap::successful_outcome_s& successful_outcome) bool e2_agent::handle_e2_successful_outcome(asn1::e2ap::successful_outcome_s& successful_outcome)
{ {
using namespace asn1::e2ap; using namespace asn1::e2ap;
if (successful_outcome.value.type() == e2_ap_elem_procs_o::successful_outcome_c::types_opts::e2setup_resp) { if (successful_outcome.value.type() == e2_ap_elem_procs_o::successful_outcome_c::types_opts::e2setup_resp) {
@ -248,7 +244,7 @@ bool ric_client::handle_e2_successful_outcome(asn1::e2ap::successful_outcome_s&
return true; return true;
} }
bool ric_client::handle_e2_setup_response(e2setup_resp_s setup_response) bool e2_agent::handle_e2_setup_response(e2setup_resp_s setup_response)
{ {
if (e2ap_.process_setup_response(setup_response)) { if (e2ap_.process_setup_response(setup_response)) {
logger.error("Failed to process E2 Setup Response \n"); logger.error("Failed to process E2 Setup Response \n");
@ -257,7 +253,7 @@ bool ric_client::handle_e2_setup_response(e2setup_resp_s setup_response)
return true; return true;
} }
bool ric_client::handle_e2_unsuccessful_outcome(asn1::e2ap::unsuccessful_outcome_s& unsuccessful_outcome) bool e2_agent::handle_e2_unsuccessful_outcome(asn1::e2ap::unsuccessful_outcome_s& unsuccessful_outcome)
{ {
using namespace asn1::e2ap; using namespace asn1::e2ap;
if (unsuccessful_outcome.value.type() == e2_ap_elem_procs_o::unsuccessful_outcome_c::types_opts::e2setup_fail) { if (unsuccessful_outcome.value.type() == e2_ap_elem_procs_o::unsuccessful_outcome_c::types_opts::e2setup_fail) {
@ -294,7 +290,7 @@ bool ric_client::handle_e2_unsuccessful_outcome(asn1::e2ap::unsuccessful_outcome
return true; return true;
} }
bool ric_client::handle_ric_subscription_request(ricsubscription_request_s ric_subscription_request) bool e2_agent::handle_ric_subscription_request(ricsubscription_request_s ric_subscription_request)
{ {
logger.info("Received RIC Subscription Request from RIC ID: %i (instance id %i) to RAN Function ID: %i", logger.info("Received RIC Subscription Request from RIC ID: %i (instance id %i) to RAN Function ID: %i",
ric_subscription_request->ri_crequest_id->ric_requestor_id, ric_subscription_request->ri_crequest_id->ric_requestor_id,
@ -309,7 +305,7 @@ bool ric_client::handle_ric_subscription_request(ricsubscription_request_s ric_s
return true; return true;
} }
bool ric_client::handle_ric_subscription_delete_request(ricsubscription_delete_request_s ricsubscription_delete_request) bool e2_agent::handle_ric_subscription_delete_request(ricsubscription_delete_request_s ricsubscription_delete_request)
{ {
logger.info("Received RIC Subscription Delete request from RIC ID: %i (instance id %i) to RAN Function ID: %i", logger.info("Received RIC Subscription Delete request from RIC ID: %i (instance id %i) to RAN Function ID: %i",
ricsubscription_delete_request->ri_crequest_id->ric_requestor_id, ricsubscription_delete_request->ri_crequest_id->ric_requestor_id,
@ -324,7 +320,7 @@ bool ric_client::handle_ric_subscription_delete_request(ricsubscription_delete_r
return true; return true;
} }
bool ric_client::handle_subscription_modification_request(uint32_t ric_subscription_modification_request) bool e2_agent::handle_subscription_modification_request(uint32_t ric_subscription_modification_request)
{ {
if (e2ap_.process_subscription_modification_request(ric_subscription_modification_request)) { if (e2ap_.process_subscription_modification_request(ric_subscription_modification_request)) {
logger.error("Failed to process RIC subscription delete request \n"); logger.error("Failed to process RIC subscription delete request \n");
@ -332,7 +328,7 @@ bool ric_client::handle_subscription_modification_request(uint32_t ric_subscript
} }
return true; return true;
} }
bool ric_client::handle_subscription_modification_confirm(uint32_t ric_subscription_modification_confirm) bool e2_agent::handle_subscription_modification_confirm(uint32_t ric_subscription_modification_confirm)
{ {
if (e2ap_.process_subscription_modification_confirm(ric_subscription_modification_confirm)) { if (e2ap_.process_subscription_modification_confirm(ric_subscription_modification_confirm)) {
logger.error("Failed to process RIC subscription delete request \n"); logger.error("Failed to process RIC subscription delete request \n");
@ -340,7 +336,7 @@ bool ric_client::handle_subscription_modification_confirm(uint32_t ric_subscript
} }
return true; return true;
} }
bool ric_client::handle_subscription_modification_refuse(uint32_t ric_subscription_modification_refuse) bool e2_agent::handle_subscription_modification_refuse(uint32_t ric_subscription_modification_refuse)
{ {
if (e2ap_.process_subscription_modification_refuse(ric_subscription_modification_refuse)) { if (e2ap_.process_subscription_modification_refuse(ric_subscription_modification_refuse)) {
logger.error("Failed to process RIC subscription delete request \n"); logger.error("Failed to process RIC subscription delete request \n");
@ -349,7 +345,7 @@ bool ric_client::handle_subscription_modification_refuse(uint32_t ric_subscripti
return true; return true;
} }
bool ric_client::handle_reset_request(reset_request_s& reset_request) bool e2_agent::handle_reset_request(reset_request_s& reset_request)
{ {
printf("Received E2AP E2 Reset Request \n"); printf("Received E2AP E2 Reset Request \n");
// call process to handle reset request, if it fails log error and return false, else return true - success // call process to handle reset request, if it fails log error and return false, else return true - success
@ -367,7 +363,7 @@ bool ric_client::handle_reset_request(reset_request_s& reset_request)
return true; return true;
} }
bool ric_client::handle_reset_response(reset_resp_s& reset_response) bool e2_agent::handle_reset_response(reset_resp_s& reset_response)
{ {
printf("Received E2AP E2 Reset Response \n"); printf("Received E2AP E2 Reset Response \n");
// call process to handle reset reponse, if it fails log error, else return true - success // call process to handle reset reponse, if it fails log error, else return true - success

Loading…
Cancel
Save