Added max_s1_setup retries option to S1AP

master
Pedro Alvarez 4 years ago
parent 930e3699d0
commit e5a83474cc

@ -234,11 +234,13 @@ bool connect_to(int fd, const char* dest_addr_str, int dest_port, sockaddr_in* d
if (dest_sockaddr != nullptr) {
*dest_sockaddr = sockaddr_tmp;
}
if (connect(fd, (const struct sockaddr*)&sockaddr_tmp, sizeof(sockaddr_tmp)) == -1) {
srslog::fetch_basic_logger(LOGSERVICE).info("Failed to establish socket connection to %s", dest_addr_str);
perror("connect()");
return false;
}
return true;
}

@ -122,6 +122,7 @@ private:
rrc_interface_s1ap* rrc = nullptr;
s1ap_args_t args;
srslog::basic_logger& logger;
srslog::log_channel& alarms_channel;
srsran::task_sched_handle task_sched;
srsran::task_queue_handle mme_task_queue;
srsran::socket_manager_itf* rx_socket_handler;
@ -329,8 +330,9 @@ private:
srsran::proc_outcome_t init();
srsran::proc_outcome_t step() { return srsran::proc_outcome_t::yield; }
srsran::proc_outcome_t react(const s1setupresult& event);
void then(const srsran::proc_state_t& result) const;
void then(const srsran::proc_state_t& result);
const char* name() const { return "MME Connection"; }
uint16_t connect_count = 0;
private:
srsran::proc_outcome_t start_mme_connection();

@ -220,6 +220,7 @@ void s1ap::ue::ho_prep_proc_t::then(const srsran::proc_state_t& result)
srsran::proc_outcome_t s1ap::s1_setup_proc_t::init()
{
procInfo("Starting new MME connection.");
connect_count++;
return start_mme_connection();
}
@ -265,7 +266,7 @@ srsran::proc_outcome_t s1ap::s1_setup_proc_t::react(const srsenb::s1ap::s1_setup
return srsran::proc_outcome_t::error;
}
void s1ap::s1_setup_proc_t::then(const srsran::proc_state_t& result) const
void s1ap::s1_setup_proc_t::then(const srsran::proc_state_t& result)
{
if (result.is_error()) {
procInfo("Failed to initiate S1 connection. Attempting reconnection in %d seconds",
@ -276,7 +277,12 @@ void s1ap::s1_setup_proc_t::then(const srsran::proc_state_t& result) const
s1ap_ptr->mme_socket.close();
procInfo("S1AP socket closed.");
s1ap_ptr->mme_connect_timer.run();
if (connect_count > s1ap_ptr->args.max_s1_setup_retries) {
s1ap_ptr->alarms_channel("s1apError");
}
// Try again with in 10 seconds
} else {
connect_count = 0;
}
}
@ -287,7 +293,11 @@ void s1ap::s1_setup_proc_t::then(const srsran::proc_state_t& result) const
s1ap::s1ap(srsran::task_sched_handle task_sched_,
srslog::basic_logger& logger,
srsran::socket_manager_itf* rx_socket_handler_) :
s1setup_proc(this), logger(logger), task_sched(task_sched_), rx_socket_handler(rx_socket_handler_)
s1setup_proc(this),
logger(logger),
task_sched(task_sched_),
rx_socket_handler(rx_socket_handler_),
alarms_channel(srslog::fetch_log_channel("alarms"))
{
mme_task_queue = task_sched.make_task_queue();
}
@ -303,7 +313,7 @@ int s1ap::init(const s1ap_args_t& args_, rrc_interface_s1ap* rrc_)
mme_connect_timer = task_sched.get_unique_timer();
auto mme_connect_run = [this](uint32_t tid) {
if (s1setup_proc.is_busy()) {
logger.error("Failed to initiate S1Setup procedure.");
logger.error("Failed to initiate S1Setup procedure: procedure is busy.");
}
s1setup_proc.launch();
};
@ -321,7 +331,7 @@ int s1ap::init(const s1ap_args_t& args_, rrc_interface_s1ap* rrc_)
running = true;
// starting MME connection
if (not s1setup_proc.launch()) {
logger.error("Failed to initiate S1Setup procedure.");
logger.error("Failed to initiate S1Setup procedure: error launching procedure.");
}
return SRSRAN_SUCCESS;

Loading…
Cancel
Save