From c3f4dfd19462f3d3f8113a840901e9c898264eff Mon Sep 17 00:00:00 2001 From: Piotr Gawlowicz Date: Fri, 17 Mar 2023 14:48:09 +0100 Subject: [PATCH] use ric_client configuration (ip, port) --- srsenb/enb.conf.example | 6 ++++++ srsenb/hdr/enb.h | 6 ------ srsenb/src/enb.cc | 2 +- srsenb/src/main.cc | 2 +- srsgnb/hdr/stack/ric/ric_client.h | 8 +++++++- srsgnb/src/stack/ric/ric_client.cc | 4 ++-- 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/srsenb/enb.conf.example b/srsenb/enb.conf.example index ba5abc8fa..e34503e16 100644 --- a/srsenb/enb.conf.example +++ b/srsenb/enb.conf.example @@ -370,6 +370,12 @@ enable = false #auto_target_papr = 8 #ema_alpha = 0.0143 +##################################################################### +[ric_client] +enable = true +#ric_ip = 127.0.0.1 +#ric_port = 36421 + ##################################################################### # Expert configuration options # diff --git a/srsenb/hdr/enb.h b/srsenb/hdr/enb.h index 2dc511f38..8fed379aa 100644 --- a/srsenb/hdr/enb.h +++ b/srsenb/hdr/enb.h @@ -104,12 +104,6 @@ struct general_args_t { uint32_t rlf_release_timer_ms; }; -struct ric_args_t { - bool enable; - std::string ric_ip; - uint32_t ric_port; -}; - struct all_args_t { enb_args_t enb; enb_files_t enb_files; diff --git a/srsenb/src/enb.cc b/srsenb/src/enb.cc index 2294e3f11..04697a0f4 100644 --- a/srsenb/src/enb.cc +++ b/srsenb/src/enb.cc @@ -198,7 +198,7 @@ bool enb::enable_ric_client(srsenb::e2_interface_metrics* e2_metrics) srsran::console("Error creating RIC client instance.\n"); return SRSRAN_ERROR; } - if (tmp_ric_client->init()) { + if (tmp_ric_client->init(args.ric_client)) { srsran::console("Error initializing RIC client.\n"); return SRSRAN_ERROR; } diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index e40a3c7de..39b2f177f 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -231,7 +231,7 @@ void parse_args(all_args_t* args, int argc, char* argv[]) /* RIC section */ ("ric_client.enable", bpo::value(&args->ric_client.enable)->default_value(false), "Enables the RIC client") ("ric_client.ric_ip", bpo::value(&args->ric_client.ric_ip)->default_value("127.0.0.1"), "RIC IP address") - ("ric_client.ric_port", bpo::value(&args->ric_client.ric_port)->default_value(36422), "RIC port") + ("ric_client.ric_port", bpo::value(&args->ric_client.ric_port)->default_value(36421), "RIC port") /* Expert section */ ("expert.metrics_period_secs", bpo::value(&args->general.metrics_period_secs)->default_value(1.0), "Periodicity for metrics in seconds.") ("expert.metrics_csv_enable", bpo::value(&args->general.metrics_csv_enable)->default_value(false), "Write metrics to CSV file.") diff --git a/srsgnb/hdr/stack/ric/ric_client.h b/srsgnb/hdr/stack/ric/ric_client.h index 2d9d645c5..4e289f631 100644 --- a/srsgnb/hdr/stack/ric/ric_client.h +++ b/srsgnb/hdr/stack/ric/ric_client.h @@ -32,6 +32,12 @@ enum e2_msg_type_t { E2_RESET_RESPONSE }; +struct ric_args_t { + bool enable; + std::string ric_ip; + uint32_t ric_port; +}; + namespace srsenb { class ric_client : public srsran::thread { @@ -39,7 +45,7 @@ public: ric_client(srslog::basic_logger& logger, srsenb::e2_interface_metrics* _gnb_metrics); // Initiate and Stop - bool init(); + bool init(ric_args_t args); void stop(); void run_thread(); diff --git a/srsgnb/src/stack/ric/ric_client.cc b/srsgnb/src/stack/ric/ric_client.cc index 0bdc7f853..8fa6c7b86 100644 --- a/srsgnb/src/stack/ric/ric_client.cc +++ b/srsgnb/src/stack/ric/ric_client.cc @@ -21,7 +21,7 @@ ric_client::ric_client(srslog::basic_logger& logger, e2_interface_metrics* _gnb_ gnb_metrics = _gnb_metrics; } -bool ric_client::init() +bool ric_client::init(ric_args_t args) { printf("RIC_CLIENT: Init\n"); using namespace srsran::net_utils; @@ -42,7 +42,7 @@ bool ric_client::init() } // Connect to the AMF address - if (not ric_socket.connect_to("127.0.0.1", e2ap_port, &ric_addr)) { + if (not ric_socket.connect_to(args.ric_ip.c_str(), args.ric_port, &ric_addr)) { return false; } // Assign a handler to rx RIC packets