From 82d2fd1973682cbb01fc09487760d782d1413b67 Mon Sep 17 00:00:00 2001 From: Piotr Gawlowicz Date: Wed, 5 Apr 2023 11:40:44 +0200 Subject: [PATCH] e2_agent: add parameters for local IP and port to bind for RIC connection --- srsenb/enb.conf.example | 2 ++ srsenb/src/main.cc | 2 ++ srsgnb/hdr/stack/ric/e2_agent.h | 3 ++- srsgnb/src/stack/ric/e2_agent.cc | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/srsenb/enb.conf.example b/srsenb/enb.conf.example index 985e0fab5..45db00a7b 100644 --- a/srsenb/enb.conf.example +++ b/srsenb/enb.conf.example @@ -375,6 +375,8 @@ enable = false enable = true #ric_ip = 127.0.0.1 #ric_port = 36421 +#ric_bind_ip = 127.0.0.1 +#ric_bind_port = 36425 ##################################################################### # Expert configuration options diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index 58ac1c9a1..c60bf6c1c 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -232,6 +232,8 @@ void parse_args(all_args_t* args, int argc, char* argv[]) ("e2_agent.enable", bpo::value(&args->e2_agent.enable)->default_value(false), "Enables the E2 agent") ("e2_agent.ric_ip", bpo::value(&args->e2_agent.ric_ip)->default_value("127.0.0.1"), "RIC IP address") ("e2_agent.ric_port", bpo::value(&args->e2_agent.ric_port)->default_value(36421), "RIC port") + ("e2_agent.ric_bind_ip", bpo::value(&args->e2_agent.ric_bind_ip)->default_value("127.0.0.1"), "Local IP address to bind for RIC connection") + ("e2_agent.ric_bind_port", bpo::value(&args->e2_agent.ric_bind_port)->default_value(36425), "Local port to bind for RIC connection") /* Expert section */ ("expert.metrics_period_secs", bpo::value(&args->general.metrics_period_secs)->default_value(1.0), "Periodicity for metrics in seconds.") diff --git a/srsgnb/hdr/stack/ric/e2_agent.h b/srsgnb/hdr/stack/ric/e2_agent.h index bbe89240a..70dee9fdd 100644 --- a/srsgnb/hdr/stack/ric/e2_agent.h +++ b/srsgnb/hdr/stack/ric/e2_agent.h @@ -21,7 +21,6 @@ #include "srsran/interfaces/e2_metrics_interface.h" #include "srsran/srsran.h" static const int e2ap_ppid = 70; -static const int e2ap_port = 36421; enum e2_msg_type_t { E2_SETUP_REQUEST, @@ -36,6 +35,8 @@ struct e2_agent_args_t { bool enable; std::string ric_ip; uint32_t ric_port; + std::string ric_bind_ip; + uint32_t ric_bind_port; }; namespace srsenb { diff --git a/srsgnb/src/stack/ric/e2_agent.cc b/srsgnb/src/stack/ric/e2_agent.cc index bb683efa2..7b81ac1b3 100644 --- a/srsgnb/src/stack/ric/e2_agent.cc +++ b/srsgnb/src/stack/ric/e2_agent.cc @@ -35,7 +35,7 @@ bool e2_agent::init(e2_agent_args_t args) } // Bind socket - if (not ric_socket.bind_addr("127.0.0.1", 36425)) { + if (not ric_socket.bind_addr(args.ric_bind_ip.c_str(), args.ric_bind_port)) { ric_socket.close(); return false; }