fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42493?usp=email )
Change subject: s1gw: f_ConnHdlr_pfcp_assoc_handler(): handle already-connected case ......................................................................
s1gw: f_ConnHdlr_pfcp_assoc_handler(): handle already-connected case
Previously, f_pfcp_assoc() would skip spawning a connection handler entirely if the IUT was already PFCP-associated. This was fine for tests that only need an association to be present, but upcoming PFCP Heartbeat test cases need the emulation's Recovery Timestamp to be synced with what the IUT has stored, even when re-using an existing association.
Move the state check into f_ConnHdlr_pfcp_assoc_handler(): if the IUT is already connected, sync PFCPEM's Recovery Timestamp to the value the IUT remembers (rrts); otherwise perform the full Association Setup as before. Remove the now-redundant g_pfcp_assoc component variable from test_CT - it's not accessible by ConnHdlr(s) anyway.
Change-Id: Id9d2ebb1ddb3d3896dd24e2a37e9d21335441d52 --- M s1gw/S1GW_ConnHdlr.ttcn M s1gw/S1GW_Tests.ttcn 2 files changed, 19 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/93/42493/1
diff --git a/s1gw/S1GW_ConnHdlr.ttcn b/s1gw/S1GW_ConnHdlr.ttcn index fd171d3..297eccd 100644 --- a/s1gw/S1GW_ConnHdlr.ttcn +++ b/s1gw/S1GW_ConnHdlr.ttcn @@ -39,6 +39,9 @@ import from HTTP_Adapter all; import from HTTPmsg_Types all;
+import from S1GW_REST_Types all; +import from S1GW_REST_Functions all; + import from StatsD_Types all; import from StatsD_Checker all;
@@ -434,7 +437,17 @@
function f_ConnHdlr_pfcp_assoc_handler(charstring id) runs on ConnHdlr { - f_ConnHdlr_pfcp_assoc_setup(); + var PfcpAssocInfo assoc_info := f_REST_PfcpAssocState(); + + if (assoc_info.state == connected) { + /* IUT already connected: sync PFCPEM's RTS to match what IUT remembers */ + f_PFCPEM_set_recovery_timestamp(assoc_info.rrts); + } else { + /* IUT is not connected: perform the Association Setup procedure */ + log("Waiting for IUT to associate over PFCP"); + f_ConnHdlr_pfcp_assoc_setup(); + } + setverdict(pass); }
diff --git a/s1gw/S1GW_Tests.ttcn b/s1gw/S1GW_Tests.ttcn index f86546c..121d717 100644 --- a/s1gw/S1GW_Tests.ttcn +++ b/s1gw/S1GW_Tests.ttcn @@ -76,7 +76,6 @@ var S1AP_ServerList vc_S1APSRVs := {}; var PFCP_Emulation_CT vc_PFCP; var StatsD_Checker_CT vc_STATSD; - var PfcpAssocInfo g_pfcp_assoc; };
private altstep as_Tguard() runs on test_CT { @@ -141,16 +140,11 @@ var verdicttype verdict; var ConnHdlr vc_conn;
- g_pfcp_assoc := f_REST_PfcpAssocState(); - if (g_pfcp_assoc.state != connected) { - log("Waiting for IUT to associate over PFCP"); - vc_conn := f_ConnHdlr_spawn(refers(f_ConnHdlr_pfcp_assoc_handler), - pars := valueof(t_ConnHdlrPars)); - vc_conn.done -> value verdict; - if (verdict != pass) { - Misc_Helpers.f_shutdown(__BFILE__, __LINE__); - } - g_pfcp_assoc := f_REST_PfcpAssocState(); + vc_conn := f_ConnHdlr_spawn(refers(f_ConnHdlr_pfcp_assoc_handler), + pars := valueof(t_ConnHdlrPars)); + vc_conn.done -> value verdict; + if (verdict != pass) { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__); } }