From 6bbfe057afe6f23e2f325789a3dcac81065ab952 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 9 Mar 2023 02:51:46 +0100 Subject: 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 --- hnbgw/HNBGW_Tests.ttcn | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'hnbgw') diff --git a/hnbgw/HNBGW_Tests.ttcn b/hnbgw/HNBGW_Tests.ttcn index cf0cd073..71761b51 100644 --- a/hnbgw/HNBGW_Tests.ttcn +++ b/hnbgw/HNBGW_Tests.ttcn @@ -1304,10 +1304,31 @@ template GtpParameters t_GtpParameters := { } } +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 @@ friend function f_tc_ps_rab_assignment_with_pfcp(charstring id, TestHdlrParams p 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 @@ friend function f_tc_ps_rab_assignment_with_pfcp(charstring id, TestHdlrParams p 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 @@ friend function f_tc_ps_rab_assignment_with_pfcp(charstring id, TestHdlrParams p 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 @@ friend function f_tc_ps_rab_assignment_with_pfcp(charstring id, TestHdlrParams p 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); -- cgit v1.2.3