pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41740?usp=email )
Change subject: gbproxy: Fix several tests on titan 11 ......................................................................
gbproxy: Fix several tests on titan 11
Rework altsteps to avoid race condition showing up under titan 11.1.0. It's not really clear whether the previous implementation is actually expected/permitted by TTCN-3, where an altstep variable is initialized multiple times with different values through activate(). In any case, the new implementation is much cleaner, only requiring 1 altstep instead of N.
Related: OS#6800 Change-Id: Ib17c7dcb3d224a6b9e75ce5f9121a05126f81909 --- M gbproxy/GBProxy_Tests.ttcn M gbproxy/testenv.cfg 2 files changed, 74 insertions(+), 60 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/40/41740/1
diff --git a/gbproxy/GBProxy_Tests.ttcn b/gbproxy/GBProxy_Tests.ttcn index 7f70f96..4a9605f 100644 --- a/gbproxy/GBProxy_Tests.ttcn +++ b/gbproxy/GBProxy_Tests.ttcn @@ -2683,25 +2683,45 @@ /*********************************************************************** * BVC-RESET procedure ***********************************************************************/ -private altstep as_count_bvc_reset(integer sgsn_idx, BssgpBvci bvci, inout roro_integer roroi) -runs on test_CT { - var BSSGP_BVC_CT sgsn_bvc_ct := f_get_sgsn_bvc_ct(sgsn_idx, bvci); - [] SGSN_MGMT.receive(BssgpResetIndication:{bvci}) from sgsn_bvc_ct { - roroi[sgsn_idx] := roroi[sgsn_idx] & { bvci }; - repeat; - } -} -private altstep as_ignore_status(BSSGP_BVC_MGMT_PT pt) { -[] pt.receive(BssgpStatusIndication:?) { repeat; } -} private function f_get_sgsn_bvc_ct(integer sgsn_idx, BssgpBvci bvci) runs on test_CT return BSSGP_BVC_CT { for (var integer i := 0; i < lengthof(g_sgsn[sgsn_idx].cfg.bvc); i := i+1) { if (g_sgsn[sgsn_idx].cfg.bvc[i].bvci == bvci) { return g_sgsn[sgsn_idx].vc_BSSGP_BVC[i]; } } + log("f_get_sgsn_bvc_ct(", sgsn_idx, ", ", bvci, "): null"); return null; } + +private function f_get_sgsn_idx_bvc_ct(BSSGP_BVC_CT sgsn_bvc_ct, BssgpBvci bvci) runs on test_CT return integer { + for (var integer i := 0; i < lengthof(g_sgsn); i := i+1) { + for (var integer j := 0; j < lengthof(g_sgsn[i].vc_BSSGP_BVC); j := j+1) { + if (g_sgsn[i].cfg.bvc[j].bvci == bvci and + g_sgsn[i].vc_BSSGP_BVC[j] == sgsn_bvc_ct) { + return i; + } + } + } + log("f_get_sgsn_idx_bvc_ct(ct=", sgsn_bvc_ct, ", bvci=", bvci, "): -1"); + return -1; +} + +private altstep as_count_bvc_reset(inout roro_integer roroi) +runs on test_CT { + var BssgpResetIndication rx_bssgp_reset_ind; + var BSSGP_BVC_CT sgsn_bvc_ct; + [] SGSN_MGMT.receive(BssgpResetIndication:?) -> value rx_bssgp_reset_ind sender sgsn_bvc_ct { + var integer sgsn_idx := f_get_sgsn_idx_bvc_ct(sgsn_bvc_ct, rx_bssgp_reset_ind.bvci); + if (sgsn_idx >= 0) { + roroi[sgsn_idx] := roroi[sgsn_idx] & { rx_bssgp_reset_ind.bvci }; + } + repeat; + } +} +private altstep as_ignore_status(BSSGP_BVC_MGMT_PT pt) { +[] pt.receive(BssgpStatusIndication:?) { repeat; } +} + private function f_reset_ptp_bvc_from_pcu(integer pcu_idx, integer bvc_idx) runs on test_CT { var BSSGP_BVC_CT pcu_bvc_ct := g_pcu[pcu_idx].vc_BSSGP_BVC[bvc_idx]; @@ -2723,30 +2743,25 @@ /* expect state on both PCU and SGSN side to change */ defaults := { activate(as_ignore_status(SGSN_MGMT)) };
- /* Activate altsteps: One for each SGSN */ - for (i := 0; i < lengthof(g_sgsn); i := i+1) { - var default d := activate(as_count_bvc_reset(i, bvc_cfg.bvci, g_roroi)); - defaults := defaults & { d }; - } - + /* Activate one altestep for all SGSNs: */ + var default d := activate(as_count_bvc_reset(g_roroi)); timer T := 3.0; T.start; alt { - [] PCU_MGMT.receive(tr_BssgpStsInd(nsei_pcu, bvc_cfg.bvci, BVC_S_BLOCKED)) from pcu_bvc_ct { + [] PCU_MGMT.receive(tr_BssgpStsInd(nsei_pcu, bvc_cfg.bvci, BVC_S_BLOCKED)) -> sender pcu_bvc_ct { g_roi := g_roi & { bvc_cfg.bvci }; + log("PESPIN: append(g_roi, ", bvc_cfg.bvci, "):", g_roi); repeat; } [] T.timeout; } - - for (i := 0; i < lengthof(defaults); i := i+1) { - deactivate(defaults[i]); - } + deactivate(d);
/* Check if BVC-RESET was received at all SGSNs */ for (i := 0; i < lengthof(g_sgsn); i := i+1) { if (not ro_integer_contains(g_roroi[i], bvc_cfg.bvci)) { - setverdict(fail, "Missing SGSN[", i, "] BVC-BLOCK of BVCI=", bvc_cfg.bvci); + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, + log2str("Missing SGSN[", i, "] BVC-BLOCK of BVCI=", bvc_cfg.bvci, ", got ", g_roroi)); } }
@@ -2762,24 +2777,27 @@ f_cleanup(); }
-private altstep as_count_bvc_sts(integer sgsn_idx, BssgpBvci bvci, - template (present) BvcState exp_bvc_state, inout roro_integer roroi) +private altstep as_count_bvc_sts(template (present) BvcState exp_bvc_state, inout roro_integer roroi) runs on test_CT { - var BSSGP_BVC_CT sgsn_bvc_ct := f_get_sgsn_bvc_ct(sgsn_idx, bvci); - [] SGSN_MGMT.receive(tr_BssgpStsInd(?, bvci, exp_bvc_state)) from sgsn_bvc_ct { - roroi[sgsn_idx] := roroi[sgsn_idx] & { bvci }; + var BssgpStatusIndication rx_bssgp_st_ind; + var BSSGP_BVC_CT sgsn_bvc_ct; + [] SGSN_MGMT.receive(tr_BssgpStsInd(?, ?, exp_bvc_state)) -> value rx_bssgp_st_ind sender sgsn_bvc_ct { + var integer sgsn_idx := f_get_sgsn_idx_bvc_ct(sgsn_bvc_ct, rx_bssgp_st_ind.bvci); + if (sgsn_idx >= 0) { + roroi[sgsn_idx] := roroi[sgsn_idx] & { rx_bssgp_st_ind.bvci }; + } repeat; } }
-private altstep as_count_bvc_block(integer sgsn_idx, BssgpBvci bvci, inout roro_integer roroi) +private altstep as_count_bvc_block(inout roro_integer roroi) runs on test_CT { - [] as_count_bvc_sts(sgsn_idx, bvci, BVC_S_BLOCKED, roroi); + [] as_count_bvc_sts(BVC_S_BLOCKED, roroi); }
-private altstep as_count_bvc_unblock(integer sgsn_idx, BssgpBvci bvci, inout roro_integer roroi) +private altstep as_count_bvc_unblock(inout roro_integer roroi) runs on test_CT { - [] as_count_bvc_sts(sgsn_idx, bvci, BVC_S_UNBLOCKED, roroi); + [] as_count_bvc_sts(BVC_S_UNBLOCKED, roroi); }
/* reset the signaling BVC from one BSS; expect no signaling BVC reset on SGSN; but BVC-BLOCK for PTP */ @@ -2796,15 +2814,7 @@ PCU_MGMT.send(BssgpResetRequest:{cause:=BSSGP_CAUSE_OM_INTERVENTION}) to g_pcu[0].vc_BSSGP;
/* Activate altsteps: One for each PTP BVC and SGSN within that PCUs NSE */ - var ro_default defaults := {}; - for (var integer i := 0; i < lengthof(g_pcu[0].cfg.bvc); i := i+1) { - var BssgpBvcConfig bvcc := g_pcu[0].cfg.bvc[i]; - for (var integer j := 0; j < lengthof(g_sgsn); j := j+1) { - var default d := activate(as_count_bvc_block(j, bvcc.bvci, g_roroi)); - defaults := defaults & { d }; - } - } - + var default d := activate(as_count_bvc_block(g_roroi)); timer T := 3.0; T.start; alt { @@ -2813,10 +2823,7 @@ } [] T.timeout; } - - for (var integer i := 0; i < lengthof(defaults); i := i+1) { - deactivate(defaults[i]); - } + deactivate(d);
/* check if BVC-block was received on all expected BVC/SGSN */ for (var integer i := 0; i < lengthof(g_pcu[0].cfg.bvc); i := i+1) { @@ -2905,11 +2912,25 @@ [] pt.receive {repeat; } }
-private altstep as_count_bvc0_block(integer pcu_idx, Nsei nsei, inout ro_integer roi) +private function f_get_pcu_idx_ct(BSSGP_CT pcu_ct) runs on test_CT return integer { + for (var integer i := 0; i < lengthof(g_pcu); i := i+1) { + if (g_pcu[i].vc_BSSGP == pcu_ct) { + return i; + } + } + log("f_get_pcu_idx_ct(ct=", pcu_ct, "): -1"); + return -1; +} + +private altstep as_count_bvc0_block(inout ro_integer roi) runs on test_CT { - var BSSGP_CT pcu_ct := g_pcu[pcu_idx].vc_BSSGP; - [] PCU_MGMT.receive(BssgpResetIndication:{0}) from pcu_ct { - roi := roi & { nsei }; + var BSSGP_CT pcu_ct; + [] PCU_MGMT.receive(BssgpResetIndication:{0}) -> sender pcu_ct { + var integer pcu_idx := f_get_pcu_idx_ct(pcu_ct); + if (pcu_idx >= 0) { + var NSConfiguration nscfg := mp_nsconfig_pcu[pcu_idx]; + roi := roi & { nscfg.nsei }; + } repeat; } } @@ -2932,18 +2953,12 @@ */ var ro_default defaults := { activate(as_ignore_mgmt(PCU_MGMT)) };
- /* Activate altsteps: One for each PCU NSE */ - for (var integer i := 0; i < lengthof(g_pcu); i := i+1) { - var NSConfiguration nscfg := mp_nsconfig_pcu[i]; - var default d := activate(as_count_bvc0_block(i, nscfg.nsei, g_roi)); - defaults := defaults & { d }; - } + /* Activate one altsteps for all PCU NSE */ + var default d := activate(as_count_bvc0_block(g_roi));
f_sleep(3.0);
- for (var integer i := 0; i < lengthof(defaults); i := i+1) { - deactivate(defaults[i]); - } + deactivate(d);
/* check if BVC-block was received on all expected BVC */ for (var integer i := 0; i < lengthof(g_pcu); i := i+1) { diff --git a/gbproxy/testenv.cfg b/gbproxy/testenv.cfg index 7d3b41a..7adb482 100644 --- a/gbproxy/testenv.cfg +++ b/gbproxy/testenv.cfg @@ -1,6 +1,5 @@ [testsuite] -# Some tests fail with titan 11.1.0 (OS#6800) -titan_min=9.0.0 +titan_min=11.1.0 program=GBProxy_Tests config=GBProxy_Tests.cfg