pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42153?usp=email )


Change subject: 5gc: Split f_start_handleri_with_pars() into multiple helpers
......................................................................

5gc: Split f_start_handleri_with_pars() into multiple helpers

This allows initializing multiple ConnHldr and then connecting them and
starting them later. This is similar to what is is done eg. in
MSC_Tests.

Change-Id: Ic60009c5f7fcdc43f6e13f9ea469bfaddc639c33
---
M 5gc/C5G_Tests.ttcn
1 file changed, 20 insertions(+), 8 deletions(-)



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

diff --git a/5gc/C5G_Tests.ttcn b/5gc/C5G_Tests.ttcn
index b5a572a..3844f95 100644
--- a/5gc/C5G_Tests.ttcn
+++ b/5gc/C5G_Tests.ttcn
@@ -196,21 +196,21 @@
 }

 /* generate parameters for a connection handler */
-private function f_init_pars(integer ue_idx := 0)
+private function f_init_pars(integer ue_idx := 0, integer c5g_idx := 0)
 runs on MTC_CT return ConnHdlrPars {
        var ConnHdlrPars pars := {
                ngran_pars := g_ngran_pars,
                ue_pars := valueof(ts_UeParams(ue_idx)),
-               c5g_idx := 0,
+               c5g_idx := c5g_idx,
                kset_id := valueof(cs_NAS_KeySetIdentifier_lv(tsc_NasKsi_NoKey, 
'0'B)),
                exp_CoreNetworkAssistanceInformationForInactive := false
        };
        return pars;
 }

-/* start a connection handler with given parameters */
-private function f_start_handler_with_pars(void_fn fn, ConnHdlrPars pars, 
integer ngap_idx := 0)
-runs on MTC_CT return ConnHdlr {
+private function f_start_handler_create(integer ngap_idx := 0)
+runs on MTC_CT return ConnHdlr
+{
        var ConnHdlr vc_conn;
        var charstring id := testcasename() & int2str(ngap_idx);

@@ -223,14 +223,26 @@
        connect(vc_conn:GTP1U[0], vc_GTP1U:CLIENT);
        connect(vc_conn:GTP1U_PROC[0], vc_GTP1U:CLIENT_PROC);

-       /* We cannot use vc_conn.start(f_init_handler(fn, id, pars)); as we 
cannot have
-        * a stand-alone 'derefers()' call, see 
https://www.eclipse.org/forums/index.php/t/1091364/ */
+       return vc_conn;
+}
+
+private function f_start_handler_run(ConnHdlr vc_conn, void_fn fn, 
ConnHdlrPars pars) runs on MTC_CT
+{
        vc_conn.start(f_init_handler(fn, pars));
+}
+
+/* start a connection handler with given parameters */
+private function f_start_handler_with_pars(void_fn fn, ConnHdlrPars pars, 
integer ngap_idx := 0)
+runs on MTC_CT return ConnHdlr {
+       var ConnHdlr vc_conn;
+       vc_conn := f_start_handler_create(ngap_idx);
+       f_start_handler_run(vc_conn, fn, pars);
+
        return vc_conn;
 }

 /* altstep for the global guard timer */
-private altstep as_Tguard()runs on MTC_CT {
+private altstep as_Tguard() runs on MTC_CT {
        [] g_Tguard.timeout {
                Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Tguard 
timeout");
        }

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

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ic60009c5f7fcdc43f6e13f9ea469bfaddc639c33
Gerrit-Change-Number: 42153
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to