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


Change subject: hnbgw: add f_bssap_expect()
......................................................................

hnbgw: add f_bssap_expect()

End the guessing when seeing "timeout of T_guard": set a precise failure
verdict when an expected RANAP/SCCP ("BSSAP") message did not arrive as
expected.

Change-Id: I51c60ed8fcef83c98e6c62c9f62a8c3c665de860
---
M hnbgw/HNBGW_Tests.ttcn
1 file changed, 40 insertions(+), 41 deletions(-)



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

diff --git a/hnbgw/HNBGW_Tests.ttcn b/hnbgw/HNBGW_Tests.ttcn
index 1215e64..c2612e2 100644
--- a/hnbgw/HNBGW_Tests.ttcn
+++ b/hnbgw/HNBGW_Tests.ttcn
@@ -474,6 +474,26 @@
        }
 }

+private function f_bssap_expect(template (present) RANAP_PDU exp_rx) runs on 
ConnHdlr return RANAP_PDU {
+       var RANAP_PDU rx;
+       timer T := 5.0;
+
+       alt {
+       [] BSSAP.receive(exp_rx) -> value rx {
+               setverdict(pass);
+               }
+       [] BSSAP.receive(RANAP_PDU:?) {
+               setverdict(fail, "Got an unexpected RANAP message on BSSAP 
port, was waiting for ", exp_rx);
+               mtc.stop;
+               }
+       [] T.timeout {
+               setverdict(fail, "Timeout waiting for RANAP on BSSAP port: ", 
exp_rx);
+               mtc.stop;
+               }
+       }
+       return rx;
+}
+
 /* send RANAP on Iuh and expect it to show up on Iu */
 function f_iuh2iu(template (present) RANAP_PDU tx, template RANAP_PDU exp_rx 
:= omit)
 runs on ConnHdlr return RANAP_PDU {
@@ -485,17 +505,8 @@
        }

        RUA.send(tx);
-       T.start;

-       alt {
-       [] BSSAP.receive(exp_rx) -> value rx {
-               setverdict(pass);
-               }
-       [] T.timeout {
-               setverdict(fail, "Timeout waiting for Iu ", exp_rx);
-               }
-       }
-       return rx;
+       return f_bssap_expect(exp_rx);
 }

 /* send RANAP on Iu and expect it to show up on Iuh */
@@ -562,16 +573,7 @@
        }

        /* expect to receive it on the Iu side */
-       T.start;
-       alt {
-       [] BSSAP.receive(exp_rx) -> value rx {
-               setverdict(pass);
-               }
-       [] T.timeout {
-               setverdict(fail, "Timeout waiting for Iu ", exp_rx);
-               }
-       }
-       return rx;
+       return f_bssap_expect(exp_rx);
 }

 /* 3GPP TS 48.006 9.2 Connection release:
@@ -602,17 +604,10 @@
        RUA.send(RUA_Disc_Req:{tx, cause});

        /* expect to receive it on the Iu side */
-       T.start;
-       alt {
-       [] BSSAP.receive(exp_rx) -> value rx {
-               }
-       [] T.timeout {
-               setverdict(fail, "Timeout waiting for Iu ", exp_rx);
-               return rx;
-               }
-       }
+       rx := f_bssap_expect(exp_rx);

        /* expect disconnect on the Iu side */
+       T.start;
        alt {
        [] BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_IND) {
                setverdict(pass);
@@ -971,13 +966,11 @@
        var MgcpCommand mgcp_cmd;
        var RANAP_PDU tx;
        var template RAB_SetupOrModifiedList rab_smdl;
-       timer T := 5.0;

        /* Send back RAB Assignment Response via Iuh */
        rab_smdl := ts_RAB_SMdL(t_RAB_id(23), f_ts_RAB_TLA(pars.hnb_rtp_ip), 
t_RAB_binding_port(pars.hnb_rtp_port));
        tx := valueof(ts_RANAP_RabAssResp(rab_smdl));
        RUA.send(tx);
-       T.start;

        interleave {
        /* Expect MDCX with IP/port from RAB Assignment Response */
@@ -1002,14 +995,7 @@
        rab_smdl := ts_RAB_SMdL(t_RAB_id(23), 
f_ts_RAB_TLA(pars.mgw_conn_2.mgw_rtp_ip), 
t_RAB_binding_port(pars.mgw_conn_2.mgw_rtp_port));
        tx := valueof(ts_RANAP_RabAssResp(rab_smdl));

-       alt {
-       [] BSSAP.receive(tx) {
-               setverdict(pass);
-               }
-       [] T.timeout {
-               setverdict(fail, "Timeout waiting for Iuh ", tx);
-               }
-       }
+       f_bssap_expect(tx);
 }

 private altstep as_mgcp_dlcx(inout TestHdlrParams pars) runs on ConnHdlr {
@@ -1398,7 +1384,7 @@
        PFCP.send(r);

        rab_smdl := ts_RAB_SMdL_ps(t_RAB_id(23), 
f_ts_RAB_TLA(gtp_pars.core.local.addr), gtp_pars.core.local.teid);
-       BSSAP.receive(tr_RANAP_RabAssResp(rab_smdl));
+       f_bssap_expect(tr_RANAP_RabAssResp(rab_smdl));

        f_sleep(2.0);
        tx := valueof(ts_RANAP_IuReleaseCommand(ts_RanapCause_om_intervention));
@@ -1464,7 +1450,7 @@
        RUA.send(tx);

        /* Expect on IuPS: unmodified RAB Assignment Response */
-       BSSAP.receive(tr_RANAP_RabAssResp(rab_smdl));
+       f_bssap_expect(tr_RANAP_RabAssResp(rab_smdl));

        f_sleep(2.0);
        tx := valueof(ts_RANAP_IuReleaseCommand(ts_RanapCause_om_intervention));

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/31767
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: I51c60ed8fcef83c98e6c62c9f62a8c3c665de860
Gerrit-Change-Number: 31767
Gerrit-PatchSet: 1
Gerrit-Owner: neels <[email protected]>
Gerrit-MessageType: newchange

Reply via email to