From c63abcd0f279326229999d872de4fa8404e48289 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Fri, 2 Apr 2021 15:57:42 +0200 Subject: [PATCH 1/2] nsa: x2ap: hack: exit gNB if connection to eNB failed Exit gNB if connection to eNB failed - to be modified if needed. We may want to try to connect over and over again until we succeed but the modifications to the code to get this behavior are complex. Exit on error is a simple solution. --- openair2/X2AP/x2ap_eNB.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openair2/X2AP/x2ap_eNB.c b/openair2/X2AP/x2ap_eNB.c index 321190015d..0474d417df 100644 --- a/openair2/X2AP/x2ap_eNB.c +++ b/openair2/X2AP/x2ap_eNB.c @@ -130,6 +130,18 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa DevAssert(x2ap_enb_data_p != NULL); dump_trees(); + /* gNB: exit if connection to eNB failed - to be modified if needed. + * We may want to try to connect over and over again until we succeed + * but the modifications to the code to get this behavior are complex. + * Exit on error is a simple solution that can be caught by a script + * for example. + */ + if (instance_p->cell_type == CELL_MACRO_GNB + && sctp_new_association_resp->sctp_state == SCTP_STATE_UNREACHABLE) { + X2AP_ERROR("association with eNB failed, is it running? If no, run it first. If yes, check IP addresses in your configuration file.\n"); + exit(1); + } + if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { X2AP_WARN("Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", sctp_new_association_resp->sctp_state, From 80cc9b445cf635f15df13c983ab00a63aacdb426 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Wed, 7 Apr 2021 13:30:53 +0200 Subject: [PATCH 2/2] Add script file for (re)starting gNB automatically --- ci-scripts/auto_start_gnb.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 ci-scripts/auto_start_gnb.sh diff --git a/ci-scripts/auto_start_gnb.sh b/ci-scripts/auto_start_gnb.sh new file mode 100644 index 0000000000..86ffc66d18 --- /dev/null +++ b/ci-scripts/auto_start_gnb.sh @@ -0,0 +1,7 @@ +#!/bin/bash +while true +do + echo "gNB will be started automatically..." + sleep 1 + sudo .././cmake_targets/ran_build/build/nr-softmodem -E -O ../targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf +done