pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41781?usp=email )
Change subject: bts: Validate no PDTCH/PTCCH block gaps in TC_pcu_rts_req ......................................................................
bts: Validate no PDTCH/PTCCH block gaps in TC_pcu_rts_req
Change-Id: I0bf3540523c231ed7172cab720163816d5d81e26 --- M bts/BTS_Tests.ttcn M library/GSM_Types.ttcn 2 files changed, 40 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/81/41781/1
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn index 7bac7ee..592e58f 100644 --- a/bts/BTS_Tests.ttcn +++ b/bts/BTS_Tests.ttcn @@ -6110,7 +6110,8 @@
/* test for periodic RTS_REQ; check number of FN expired and number of RTS_IND per SAPI */ testcase TC_pcu_rts_req() runs on test_CT { - var integer first_fn, last_fn; + var integer pdtch_first_fn, pdtch_last_fn; + var integer ptcch_first_fn, ptcch_last_fn; var integer num_rts_pdtch := 0; var integer num_rts_ptcch := 0; var float test_duration := 5.0; @@ -6125,18 +6126,34 @@ alt { [] as_pcuif_msg(msg, tr_PCUIF_RTS_REQ(0, 0, 7, PCU_IF_SAPI_PDTCH, ?, ?)) { num_rts_pdtch := num_rts_pdtch + 1; - if (not isbound(first_fn)) { - first_fn := msg.u.rts_req.fn; + if (isbound(pdtch_first_fn)) { + var integer exp_fn := f_next_pdtch_block(pdtch_last_fn); + if (msg.u.rts_req.fn != exp_fn) { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, + log2str("Rx RTS.req for PDTCH FN ", msg.u.rts_req.fn, + " vs exp ", exp_fn, " (last_fn " , pdtch_last_fn, ")")); + } + pdtch_last_fn := msg.u.rts_req.fn; + } else { + pdtch_first_fn := msg.u.rts_req.fn; + pdtch_last_fn := msg.u.rts_req.fn; } - last_fn := msg.u.rts_req.fn; repeat; } [] as_pcuif_msg(msg, tr_PCUIF_RTS_REQ(0, 0, 7, PCU_IF_SAPI_PTCCH, ?, ?)) { num_rts_ptcch := num_rts_ptcch + 1; - if (not isbound(first_fn)) { - first_fn := msg.u.rts_req.fn; + if (isbound(ptcch_first_fn)) { + var integer exp_fn := f_next_ptcch_dl_block(ptcch_last_fn); + if (msg.u.rts_req.fn != exp_fn) { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, + log2str("Rx RTS.req for PTTCH FN ", msg.u.rts_req.fn, + " vs exp ", exp_fn, " (last_fn " , ptcch_last_fn, ")")); + } + ptcch_last_fn := msg.u.rts_req.fn; + } else { + ptcch_first_fn := msg.u.rts_req.fn; + ptcch_last_fn := msg.u.rts_req.fn; } - last_fn := msg.u.rts_req.fn; repeat; } [] as_pcuif_msg(msg, tr_PCUIF_RTS_REQ) { @@ -6148,9 +6165,8 @@ } [] T.timeout {} } - var integer fn_expired := last_fn - first_fn; - log(fn_expired, " fn expired with num_rts_pdtch=", num_rts_pdtch, - ", num_rts_ptcch=", num_rts_ptcch); + var integer fn_expired := f_max(pdtch_last_fn, ptcch_last_fn) - f_min(pdtch_first_fn, ptcch_first_fn); + log(fn_expired, " fn expired with num_rts_pdtch=", num_rts_pdtch, ", num_rts_ptcch=", num_rts_ptcch);
/* verify the number of frames expired matches our expectation */ const float c_GSM_FN_DURATION_MS := 4.61538; @@ -6164,7 +6180,7 @@ var float ptcch_expected := int2float(fn_expired) / 52.0 * 0.5; var template integer t_ptcch_exp := f_tolerance(float2int(ptcch_expected), 1, 100000, 1); if (not match(num_rts_ptcch, t_ptcch_exp)) { - setverdict(fail, "Number of RTS.ind for PTCCH (", num_rts_ptcch, ") not matching ", + setverdict(fail, "Number of RTS.req for PTCCH (", num_rts_ptcch, ") not matching ", t_ptcch_exp); }
@@ -6172,7 +6188,7 @@ var float pdtch_expected := int2float(fn_expired) / 52.0 * 12.0; var template integer t_pdtch_exp := f_tolerance(float2int(pdtch_expected), 1, 100000, 2); if (not match(num_rts_pdtch, t_pdtch_exp)) { - setverdict(fail, "Number of RTS.ind for PDTCH (", num_rts_pdtch, ") not matching ", + setverdict(fail, "Number of RTS.req for PDTCH (", num_rts_pdtch, ") not matching ", t_pdtch_exp); }
diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn index 8333e58..b3b6dc9 100644 --- a/library/GSM_Types.ttcn +++ b/library/GSM_Types.ttcn @@ -547,4 +547,16 @@ return fn mod GsmMaxFrameNumber; }
+private function ptcch_fn2bn(GsmFrameNumber fn) return uint32_t { + return (fn mod 416) / 104; +} +function f_next_ptcch_dl_block(GsmFrameNumber fn) return GsmFrameNumber +{ + var uint32_t bn := ptcch_fn2bn(fn) + 1; + fn := fn - (fn mod 416); + fn := fn + bn * 104 + 12; + return fn mod GsmMaxFrameNumber; +} + + } with { encode "RAW"; variant "FIELDORDER(msb)" }