Hoernchen has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/27602 )


Change subject: ran emulation: allow multiple reset attempts
......................................................................

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
---
M bsc-nat/BSC_MS_ConnectionHandler.ttcn
M bsc-nat/MSC_ConnectionHandler.ttcn
M library/RAN_Emulation.ttcnpp
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
5 files changed, 25 insertions(+), 11 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/02/27602/1

diff --git a/bsc-nat/BSC_MS_ConnectionHandler.ttcn 
b/bsc-nat/BSC_MS_ConnectionHandler.ttcn
index f011c39..1a3f951 100644
--- a/bsc-nat/BSC_MS_ConnectionHandler.ttcn
+++ b/bsc-nat/BSC_MS_ConnectionHandler.ttcn
@@ -74,6 +74,7 @@
        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 e4d3816..fdf08de 100644
--- a/bsc-nat/MSC_ConnectionHandler.ttcn
+++ b/bsc-nat/MSC_ConnectionHandler.ttcn
@@ -104,6 +104,7 @@
        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 d87ee9c..e6d36e6 100644
--- a/library/RAN_Emulation.ttcnpp
+++ b/library/RAN_Emulation.ttcnpp
@@ -521,20 +521,28 @@
 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 @@
        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 7b3188a..c3426a4 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -260,6 +260,7 @@
        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 dd31daf..73029d8 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -140,6 +140,7 @@
        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 bssap_reset_retries := 1;

        RAN_Configurations mp_bssap_cfg := {
                {
@@ -327,6 +328,7 @@
                if (isbound(mp_bssap_cfg[i])) {
                        var RanOps ranops := BSC_RanOps;
                        ranops.use_osmux := osmux;
+                       ranops.bssap_reset_retries := 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 {

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/27602
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I9f6db2a24e984eef31e76f9d42a80eb6a1bb6928
Gerrit-Change-Number: 27602
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <[email protected]>
Gerrit-MessageType: newchange

Reply via email to