neels has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/31766 )

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

hnbgw: add f_pfcp_expect()

End the guessing when seeing "timeout of T_guard": set a precise failure
verdict when an expected PFCP message did not arrive as expected.

Change-Id: I2117475b695d486b1204d61e5bb21120a6187354
---
M hnbgw/HNBGW_Tests.ttcn
1 file changed, 38 insertions(+), 6 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  neels: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/hnbgw/HNBGW_Tests.ttcn b/hnbgw/HNBGW_Tests.ttcn
index cf0cd07..71761b5 100644
--- a/hnbgw/HNBGW_Tests.ttcn
+++ b/hnbgw/HNBGW_Tests.ttcn
@@ -1304,10 +1304,31 @@
        }
 }

+private function f_pfcp_expect(template (present) PDU_PFCP exp_rx) runs on 
ConnHdlr return PDU_PFCP
+{
+       var PDU_PFCP rx;
+       timer T := 5.0;
+       T.start;
+       alt {
+       [] PFCP.receive(exp_rx) -> value rx {
+                       setverdict(pass);
+               }
+       [] PFCP.receive(PDU_PFCP:?) {
+                       setverdict(fail, "Got an unexpected PFCP message, was 
waiting for ", exp_rx);
+                       mtc.stop;
+               }
+       [] T.timeout {
+                       setverdict(fail, "Timeout waiting for PFCP ", exp_rx);
+                       mtc.stop;
+               }
+       }
+       T.stop;
+       return rx;
+}
+
 friend function f_tc_ps_rab_assignment_with_pfcp(charstring id, TestHdlrParams 
pars) runs on ConnHdlr {
        var RANAP_PDU tx;
        var RANAP_PDU rx;
-       timer T := 5.0;

        f_init_handler(pars);

@@ -1316,7 +1337,7 @@
        var PDU_PFCP m;
        var Node_ID upf_node_id := 
valueof(ts_PFCP_Node_ID_fqdn("\07osmocom\03org"));

-       PFCP.receive(tr_PFCP_Assoc_Setup_Req()) -> value m;
+       m := f_pfcp_expect(tr_PFCP_Assoc_Setup_Req())
        PFCP.send(ts_PFCP_Assoc_Setup_Resp(m.sequence_number, upf_node_id,
                                           ts_PFCP_Cause(REQUEST_ACCEPTED), 
1234));

@@ -1332,7 +1353,7 @@
        BSSAP.send(tx);

        /* Expect PFCP Session Establishment Request. */
-       PFCP.receive(tr_PFCP_Session_Est_Req()) -> value m;
+       m := f_pfcp_expect(tr_PFCP_Session_Est_Req());
        var F_SEID hnbgw_f_seid := 
m.message_body.pfcp_session_establishment_request.CP_F_SEID;
        var PFCP_Session_Establishment_Request serq := 
m.message_body.pfcp_session_establishment_request;

@@ -1371,9 +1392,8 @@
                                   gtp_pars.access.remote.teid);
        tx := valueof(ts_RANAP_RabAssResp(rab_smdl));
        RUA.send(tx);
-       T.start;

-       PFCP.receive(tr_PFCP_Session_Mod_Req(up_f_seid.seid)) -> value m;
+       m := f_pfcp_expect(tr_PFCP_Session_Mod_Req(up_f_seid.seid));
        r := ts_PFCP_Session_Mod_Resp(m.sequence_number, hnbgw_f_seid.seid);
        PFCP.send(r);

@@ -1387,7 +1407,7 @@
        tx := valueof(ts_RANAP_IuReleaseComplete());
        f_iuh2iu(tx);

-       PFCP.receive(tr_PFCP_Session_Del_Req(up_f_seid.seid)) -> value m;
+       m := f_pfcp_expect(tr_PFCP_Session_Del_Req(up_f_seid.seid));
        PFCP.send(ts_PFCP_Session_Del_Resp(m.sequence_number, 
hnbgw_f_seid.seid));

        f_sleep(2.0);

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/31766
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: I2117475b695d486b1204d61e5bb21120a6187354
Gerrit-Change-Number: 31766
Gerrit-PatchSet: 3
Gerrit-Owner: neels <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: neels <[email protected]>
Gerrit-MessageType: merged

Reply via email to