fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38036?usp=email )
Change subject: s1gw: rework f_pfcp_wait_assoc_setup() into f_ConnHdlr_pfcp_expect() ......................................................................
s1gw: rework f_pfcp_wait_assoc_setup() into f_ConnHdlr_pfcp_expect()
Generalize this function, so that it can be used to expect any PFCP PDUs, not just the Association Setup.
Change-Id: If691cb9df72672eddfbafdd8e03ae09c81b1ce71 --- M s1gw/S1GW_ConnHdlr.ttcn 1 file changed, 19 insertions(+), 20 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve
diff --git a/s1gw/S1GW_ConnHdlr.ttcn b/s1gw/S1GW_ConnHdlr.ttcn index 4505c1c..42707ec 100644 --- a/s1gw/S1GW_ConnHdlr.ttcn +++ b/s1gw/S1GW_ConnHdlr.ttcn @@ -230,40 +230,39 @@ } }
-altstep as_pfcp_handle_assoc_setup_req(template (present) PDU_PFCP exp_rx := tr_PFCP_Assoc_Setup_Req(), boolean do_repeat := false) +private function f_pfcp_handle_assoc_setup_req() runs on ConnHdlr { var PDU_PFCP rx;
- [] PFCP.receive(exp_rx) -> value rx { - var Node_ID upf_node_id := valueof(ts_PFCP_Node_ID_fqdn("\07osmocom\03org")); - PFCP.send(ts_PFCP_Assoc_Setup_Resp(rx.sequence_number, upf_node_id, - ts_PFCP_Cause(REQUEST_ACCEPTED), - 1234)); - if (do_repeat) { - repeat; - } - } + rx := f_ConnHdlr_pfcp_expect(tr_PFCP_Assoc_Setup_Req, Tval := 10.0); + PFCP.send(ts_PFCP_Assoc_Setup_Resp(rx.sequence_number, + ts_PFCP_Node_ID_fqdn("\07osmocom\03org"), + ts_PFCP_Cause(REQUEST_ACCEPTED), + 1234)); /* FIXME: request the value from PFCPEM */ }
-private function f_pfcp_wait_assoc_setup(template (present) PDU_PFCP exp_rx := tr_PFCP_Assoc_Setup_Req(), - float wait_time := 10.0) -runs on ConnHdlr +function f_ConnHdlr_pfcp_expect(template (present) PDU_PFCP exp_rx := ?, + float Tval := 2.0) +runs on ConnHdlr return PDU_PFCP { - timer T := wait_time; - T.start; + var PDU_PFCP pdu; + timer T; + + T.start(Tval); alt { - [] as_pfcp_handle_assoc_setup_req(exp_rx); - [] PFCP.receive(PDU_PFCP:?) { + [] PFCP.receive(exp_rx) -> value pdu { T.stop; } + [] PFCP.receive(PDU_PFCP:?) -> value pdu { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, - log2str("Got an unexpected PFCP message, was waiting for ", exp_rx)); + log2str("Got an unexpected PFCP PDU: ", pdu)); } [] T.timeout { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Timeout waiting for PFCP ", exp_rx)); } } - T.stop; + + return pdu; }
function f_ConnHdlr_register_pfcp() runs on ConnHdlr @@ -284,7 +283,7 @@
if (not pfcp_associated) { log("Waiting for IUT to associate over PFCP"); - f_pfcp_wait_assoc_setup(); + f_pfcp_handle_assoc_setup_req(); } } }