From 49888a65dcf1f8d94411aa0724530b8c188c3237 Mon Sep 17 00:00:00 2001 From: Eric Wild Date: Wed, 30 Mar 2022 03:16:11 +0200 Subject: [PATCH] ran emulation: allow multiple reset attempts bsc-nat introduces a delay that will lead to failed tests, since the reset attempt happens too early and times out, and the tests do not retry. Change-Id: I9f6db2a24e984eef31e76f9d42a80eb6a1bb6928 --- bsc-nat/BSC_MS_ConnectionHandler.ttcn | 1 + bsc-nat/MSC_ConnectionHandler.ttcn | 1 + library/RAN_Emulation.ttcnpp | 31 +++++++++++++++++---------- msc/BSC_ConnectionHandler.ttcn | 1 + msc/MSC_Tests.ttcn | 2 ++ 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/bsc-nat/BSC_MS_ConnectionHandler.ttcn b/bsc-nat/BSC_MS_ConnectionHandler.ttcn index f011c39fe..1a3f951c0 100644 --- a/bsc-nat/BSC_MS_ConnectionHandler.ttcn +++ b/bsc-nat/BSC_MS_ConnectionHandler.ttcn @@ -74,6 +74,7 @@ const RanOps BSC_MS_RanOps := { protocol := RAN_PROTOCOL_BSSAP, transport := BSSAP_TRANSPORT_AoIP, use_osmux := false, + bssap_reset_retries := 1, sccp_addr_local := omit, sccp_addr_peer := omit } diff --git a/bsc-nat/MSC_ConnectionHandler.ttcn b/bsc-nat/MSC_ConnectionHandler.ttcn index e4d381669..fdf08de77 100644 --- a/bsc-nat/MSC_ConnectionHandler.ttcn +++ b/bsc-nat/MSC_ConnectionHandler.ttcn @@ -104,6 +104,7 @@ const RanOps MSC_RanOps := { protocol := RAN_PROTOCOL_BSSAP, transport := BSSAP_TRANSPORT_AoIP, use_osmux := false, + bssap_reset_retries := 1, sccp_addr_local := omit, sccp_addr_peer := omit } diff --git a/library/RAN_Emulation.ttcnpp b/library/RAN_Emulation.ttcnpp index d87ee9cab..e6d36e66c 100644 --- a/library/RAN_Emulation.ttcnpp +++ b/library/RAN_Emulation.ttcnpp @@ -521,20 +521,28 @@ runs on RAN_Emulation_CT return template PDU_BSSAP { function f_bssap_reset(SCCP_PAR_Address peer, SCCP_PAR_Address own) runs on RAN_Emulation_CT { timer T := 5.0; var boolean append_osmux_support := append_osmux_ie(); + var integer attempts := g_ran_ops.bssap_reset_retries; - BSSAP.send(ts_BSSAP_UNITDATA_req(peer, own, ts_BSSMAP_Reset(0, append_osmux_support))); - T.start; - alt { - [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(own, peer, tr_BSSMAP_ResetAck(append_osmux_support))) { - log("BSSMAP: Received RESET-ACK in response to RESET, we're ready to go!"); - } - [] as_reset_ack(append_osmux_support); - [] BSSAP.receive { repeat }; - [] T.timeout { - setverdict(fail, "BSSMAP: Timeout waiting for RESET-ACK after sending RESET"); - mtc.stop; + while (attempts > 0) { + attempts := attempts - 1; + + BSSAP.send(ts_BSSAP_UNITDATA_req(peer, own, ts_BSSMAP_Reset(0, append_osmux_support))); + T.start; + alt { + [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(own, peer, tr_BSSMAP_ResetAck(append_osmux_support))) { + log("BSSMAP: Received RESET-ACK in response to RESET, we're ready to go!"); + return; + } + [] as_reset_ack(append_osmux_support); + [] BSSAP.receive { repeat }; + [] T.timeout { + continue; + } } } + + setverdict(fail, "BSSMAP: Timeout waiting for RESET-ACK after sending RESET"); + mtc.stop; } private function f_bssap_l3_is_rr(PDU_BSSAP bssap) return boolean { @@ -713,6 +721,7 @@ type record RanOps { RanProtocol protocol, RAN_Transport transport, boolean use_osmux, + integer bssap_reset_retries, /* needed for performing BSSMAP RESET */ SCCP_PAR_Address sccp_addr_local optional, SCCP_PAR_Address sccp_addr_peer optional diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn index 7b3188a12..c3426a444 100644 --- a/msc/BSC_ConnectionHandler.ttcn +++ b/msc/BSC_ConnectionHandler.ttcn @@ -260,6 +260,7 @@ const RanOps BSC_RanOps := { protocol := RAN_PROTOCOL_BSSAP, transport := BSSAP_TRANSPORT_AoIP, use_osmux := false, + bssap_reset_retries := 1, sccp_addr_local := omit, sccp_addr_peer := omit } diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn index dd31dafc4..2fad7b44d 100644 --- a/msc/MSC_Tests.ttcn +++ b/msc/MSC_Tests.ttcn @@ -140,6 +140,7 @@ modulepar { charstring mp_smpp_password := "osmocom1"; charstring mp_mme_name := "mmec01.mmegi0001.mme.epc.mnc070.mcc901.3gppnetwork.org"; charstring mp_vlr_name := "vlr.example.net"; + integer mp_bssap_reset_retries := 1; RAN_Configurations mp_bssap_cfg := { { @@ -327,6 +328,7 @@ function f_init(integer num_bsc := 1, boolean sgsap := false, boolean gsup := tr if (isbound(mp_bssap_cfg[i])) { var RanOps ranops := BSC_RanOps; ranops.use_osmux := osmux; + ranops.bssap_reset_retries := mp_bssap_reset_retries; f_ran_adapter_init(g_bssap[i], mp_bssap_cfg[i], "MSC_Test_" & int2str(i), ranops); f_ran_adapter_start(g_bssap[i]); } else {