<p>Harald Welte <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/10414">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">update DTX fill frame test expectations<br><br>Fix an off-by-one in frame number comparison: Ensure that we<br>won't stop testing until after fn + 104 has been received.<br><br>The DTX test case would never pass since the alt statement<br>was always repeated even if enough frames had been received.<br>Fix this by moving code which runs before frame fn + 104 is<br>received into an 'else' cause.<br><br>We receive SACCH frames in DTX mode so we must account for them.<br>Introduce separate counters for SACCH and non-SACCH fill frames<br>to make test failure diagnosis easier. Note that we cannot expect<br>a specific amount of SACCH frames during a particular test run<br>since their amount depends on what the current frame number window<br>happens to be. We can however add the counters for SACCH and<br>non-SACCH fill frames and obtain a meaningful result.<br><br>Change-Id: Ie573b54ab5654f027c470aa7a565d2b5b97dc74b<br>Related: OS#1950<br>---<br>M bts/BTS_Tests.ttcn<br>1 file changed, 47 insertions(+), 19 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn</span><br><span>index fd2e50f..67f302f 100644</span><br><span>--- a/bts/BTS_Tests.ttcn</span><br><span>+++ b/bts/BTS_Tests.ttcn</span><br><span>@@ -3836,10 +3836,16 @@</span><br><span>    var octetstring l2_fill_frame_sacch := substr(l2_fill_frame, 0, lengthof(l2_fill_frame) - 2);</span><br><span>        var GsmFrameNumber first_fn;</span><br><span>         var boolean is_first_frame := true;</span><br><span style="color: hsl(0, 100%, 40%);">-     var integer nfill_frames := 0;</span><br><span style="color: hsl(0, 100%, 40%);">-  const integer dtx_tchf_mod := 104;</span><br><span style="color: hsl(120, 100%, 40%);">+    var integer nfill_frames_sacch := 0;</span><br><span style="color: hsl(120, 100%, 40%);">+  var integer nfill_frames_nonsacch := 0;</span><br><span style="color: hsl(120, 100%, 40%);">+       var integer expected_fill_frames := 10000; /* initial value causes test failure if not overridden */</span><br><span>         /* Frames numbers (mod 104) for which a fill frame is expected on TCHF if DTX is enabled. */</span><br><span>         var Integers required_tdma_frames_dtx_tchf := { 52, 53, 54, 55, 56, 57, 58, 59 };</span><br><span style="color: hsl(120, 100%, 40%);">+     const integer frame_dtx_tchf_mod := 104;</span><br><span style="color: hsl(120, 100%, 40%);">+      /* Frame numbers (mod 104) for which a fill frame is expected at the L1SAP level,</span><br><span style="color: hsl(120, 100%, 40%);">+      * which operates in terms of blocks rather than frames. */</span><br><span style="color: hsl(120, 100%, 40%);">+   var Integers required_tdma_blocks_dtx_tchf := { 52, 56 };</span><br><span style="color: hsl(120, 100%, 40%);">+     const integer block_dtx_tchf_mod := 26;</span><br><span>      timer T := 5.0;</span><br><span> </span><br><span>  f_l1_tune(L1CTL);</span><br><span>@@ -3876,32 +3882,51 @@</span><br><span>                          f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);</span><br><span>                                setverdict(fail, "Received fill frame on non-TCH/F channel; DTX is only allowed on TCH/F!");</span><br><span>                       }</span><br><span style="color: hsl(0, 100%, 40%);">-                       if (fn >= first_fn + dtx_tchf_mod) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       if (fn > first_fn + frame_dtx_tchf_mod) {</span><br><span>                                 T.stop;</span><br><span>                              f_rsl_chan_deact();</span><br><span>                          f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);</span><br><span style="color: hsl(0, 100%, 40%);">-                           /* With DTX enabled we can expect at least 1 fill frame every 104 frames. */</span><br><span style="color: hsl(0, 100%, 40%);">-                            if (nfill_frames < 1) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                      setverdict(fail);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                           /* With DTX enabled we can expect at least 3 fill frames for every 104 frames.</span><br><span style="color: hsl(120, 100%, 40%);">+                                 * 2 SACCH, 1 TCH/F */</span><br><span style="color: hsl(120, 100%, 40%);">+                                expected_fill_frames := 3;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                          if (nfill_frames_sacch + nfill_frames_nonsacch < expected_fill_frames) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                   log("received only ", nfill_frames_sacch, "+", nfill_frames_nonsacch,</span><br><span style="color: hsl(120, 100%, 40%);">+                                         " (SACCH+other) out of ", expected_fill_frames, " expected fill frames");</span><br><span style="color: hsl(120, 100%, 40%);">+                                     setverdict(fail, "Not enough fill frames received");</span><br><span>                               } else {</span><br><span>                                     setverdict(pass);</span><br><span>                            }</span><br><span style="color: hsl(0, 100%, 40%);">-                       }</span><br><span style="color: hsl(0, 100%, 40%);">-                       for (var integer i := 0; i < lengthof(required_tdma_frames_dtx_tchf); i := i + 1) {</span><br><span style="color: hsl(0, 100%, 40%);">-                          if (fn mod dtx_tchf_mod == required_tdma_frames_dtx_tchf[i]) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                  nfill_frames := nfill_frames + 1;</span><br><span style="color: hsl(120, 100%, 40%);">+                     } else {</span><br><span style="color: hsl(120, 100%, 40%);">+                              if (dl.dl_info.link_id.c == SACCH) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                  nfill_frames_sacch := nfill_frames_sacch + 1;</span><br><span>                                        repeat;</span><br><span>                              }</span><br><span style="color: hsl(120, 100%, 40%);">+                             /* On DTX TCH/F channels, fill frames occur only for specific frame numbers mod 104.</span><br><span style="color: hsl(120, 100%, 40%);">+                           * Furthermore, the L1SAP layer gives us frame numbers for the start of a block so</span><br><span style="color: hsl(120, 100%, 40%);">+                             * we should only see the subset of frames numbers which correspond to a block boundary.</span><br><span style="color: hsl(120, 100%, 40%);">+                               * TCH/F blocks are defined to start at 0,4,8,13,17,21 (modulo 26) */</span><br><span style="color: hsl(120, 100%, 40%);">+                         for (var integer i := 0; i < lengthof(required_tdma_blocks_dtx_tchf); i := i + 1) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                        if (fn mod frame_dtx_tchf_mod == required_tdma_blocks_dtx_tchf[i]) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                          nfill_frames_nonsacch := nfill_frames_nonsacch + 1;</span><br><span style="color: hsl(120, 100%, 40%);">+                                           repeat;</span><br><span style="color: hsl(120, 100%, 40%);">+                                       }</span><br><span style="color: hsl(120, 100%, 40%);">+                             }</span><br><span style="color: hsl(120, 100%, 40%);">+                             log("Received DTX TCH fill frame with bad frame number: ", fn,</span><br><span style="color: hsl(120, 100%, 40%);">+                                  " (mod ", frame_dtx_tchf_mod, ": ", fn mod frame_dtx_tchf_mod, ")",</span><br><span style="color: hsl(120, 100%, 40%);">+                             " (mod ", block_dtx_tchf_mod, ": ", fn mod block_dtx_tchf_mod, ")");</span><br><span style="color: hsl(120, 100%, 40%);">+                                f_rsl_chan_deact();</span><br><span style="color: hsl(120, 100%, 40%);">+                           f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);</span><br><span style="color: hsl(120, 100%, 40%);">+                         setverdict(fail, "Unexpected L2 fill frame received on Um");</span><br><span>                       }</span><br><span style="color: hsl(0, 100%, 40%);">-                       log("Received DTX TCH fill frame with bad frame number: ", fn,</span><br><span style="color: hsl(0, 100%, 40%);">-                            " (mod ", dtx_tchf_mod, ": ", fn mod dtx_tchf_mod, ")");</span><br><span style="color: hsl(0, 100%, 40%);">-                      f_rsl_chan_deact();</span><br><span style="color: hsl(0, 100%, 40%);">-                     f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);</span><br><span style="color: hsl(0, 100%, 40%);">-                   setverdict(fail, "Unexpected L2 fill frame received on Um");</span><br><span>               } else {</span><br><span style="color: hsl(0, 100%, 40%);">-                        nfill_frames := nfill_frames + 1;</span><br><span style="color: hsl(0, 100%, 40%);">-                       if (fn >= first_fn + dtx_tchf_mod) {</span><br><span style="color: hsl(0, 100%, 40%);">-                         var integer expected_fill_frames;</span><br><span style="color: hsl(120, 100%, 40%);">+                     if (dl.dl_info.link_id.c == SACCH) {</span><br><span style="color: hsl(120, 100%, 40%);">+                          nfill_frames_sacch := nfill_frames_sacch + 1;</span><br><span style="color: hsl(120, 100%, 40%);">+                 } else {</span><br><span style="color: hsl(120, 100%, 40%);">+                              nfill_frames_nonsacch := nfill_frames_nonsacch + 1;</span><br><span style="color: hsl(120, 100%, 40%);">+                   }</span><br><span style="color: hsl(120, 100%, 40%);">+                     if (fn > first_fn + frame_dtx_tchf_mod) {</span><br><span>                                 T.stop;</span><br><span>                              if (f_g_chan_is_tchf()) {</span><br><span>                                    /* Without DTX we can expect 25 fill frames for every 104 frames.</span><br><span>@@ -3921,9 +3946,12 @@</span><br><span> </span><br><span>                               f_rsl_chan_deact();</span><br><span>                          f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);</span><br><span style="color: hsl(0, 100%, 40%);">-                           if (nfill_frames >= expected_fill_frames) {</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+                              if (nfill_frames_sacch + nfill_frames_nonsacch >= expected_fill_frames) {</span><br><span>                                         setverdict(pass);</span><br><span>                            } else {</span><br><span style="color: hsl(120, 100%, 40%);">+                                      log("received only ", nfill_frames_sacch, "+", nfill_frames_nonsacch,</span><br><span style="color: hsl(120, 100%, 40%);">+                                         " (SACCH+other) out of ", expected_fill_frames, " expected fill frames");</span><br><span>                                    setverdict(fail, "Not enough fill frames received");</span><br><span>                               }</span><br><span>                    } else {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10414">change 10414</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/10414"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-ttcn3-hacks </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ie573b54ab5654f027c470aa7a565d2b5b97dc74b </div>
<div style="display:none"> Gerrit-Change-Number: 10414 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Stefan Sperling <ssperling@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Stefan Sperling <ssperling@sysmocom.de> </div>