From abcdf78892d8a61fb1db904659bdae7e4358c16f Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 23 Jun 2020 14:29:24 +0200 Subject: library/RSL: pass lost link event to upper layers instead of failing Some tests may expect that behavior so let the test decide what to do with it. Change-Id: Idd4bdfc99514f4c439837f0ce4a20ec5ff45e86c --- library/RSL_Emulation.ttcn | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn index 66cc4dc1..2fcb96ca 100644 --- a/library/RSL_Emulation.ttcn +++ b/library/RSL_Emulation.ttcn @@ -394,6 +394,20 @@ runs on RSL_Emulation_CT return IpaStreamId { return f_streamId_by_trx(trx_nr); } +private function f_trx_conn_map_unregister(integer conn_id) +runs on RSL_Emulation_CT return IpaStreamId { + + for (var integer i := 0; i < sizeof(TrxConnMap); i := i + 1) { + if (conn_id == TrxConnMap[i]) { + TrxConnMap[i] := -1; + TrxConnNum := TrxConnNum - 1; + return f_streamId_by_trx(i); + } + } + + testcase.stop("Trying to unregister an unknown conn_id=", conn_id); +} + private function f_trx_conn_map_resolve(IpaStreamId id) runs on RSL_Emulation_CT return integer { var integer trx_nr := f_trx_by_streamId(id); @@ -498,12 +512,17 @@ function main(boolean bts_role := true) runs on RSL_Emulation_CT { /* Notify the upper layers about a new connection */ CCHAN_PT.send(ts_RSLEm_EV(RSLEM_EV_TRX_UP, sid)); } - [bts_role] IPA_PT.receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { - Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Lost IPA connection!"); - + [bts_role] IPA_PT.receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) -> value evt { + log("Lost IPA connection! (conn_id=", evt.conn_id, "): ", evt.id_resp); + /* Notify the upper layers about lost connection */ + var IpaStreamId sid := f_trx_conn_map_unregister(evt.conn_id); + CCHAN_PT.send(ts_RSLEm_EV(RSLEM_EV_TRX_DOWN, sid)); } - [not bts_role] IPA_PT.receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { - Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Lost IPA connection!"); + [not bts_role] IPA_PT.receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) -> value evt { + log("Lost IPA connection! (conn_id=", evt.conn_id, ")"); + /* Notify the upper layers about lost connection */ + var IpaStreamId sid := f_trx_conn_map_unregister(evt.conn_id); + CCHAN_PT.send(ts_RSLEm_EV(RSLEM_EV_TRX_DOWN, sid)); } [bts_role] IPA_PT.receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_ID_ACK)) { IPA_PT.send(ts_ASP_RSL_UD(ts_RSL_PAGING_LOAD_IND(23))); -- cgit v1.2.3