<p>laforge <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22229">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  daniel: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gbproxy: Refactor f_TC_{suspend,resume}<br><br>Move the entire body inside the loop to a separate function.  This<br>will be useful when adding pooling support next.<br><br>Change-Id: Ia0f9d9128754c2196ab026623f1b6a254a958d2f<br>---<br>M gbproxy/GBProxy_Tests.ttcn<br>1 file changed, 56 insertions(+), 53 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/gbproxy/GBProxy_Tests.ttcn b/gbproxy/GBProxy_Tests.ttcn</span><br><span>index 9168fa3..6f5b326 100644</span><br><span>--- a/gbproxy/GBProxy_Tests.ttcn</span><br><span>+++ b/gbproxy/GBProxy_Tests.ttcn</span><br><span>@@ -1066,37 +1066,39 @@</span><br><span>        f_cleanup();</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+private function f_suspend_one(integer sgsn_idx, integer pcu_idx, integer bvc_idx, integer suffix)</span><br><span style="color: hsl(120, 100%, 40%);">+runs on GlobalTest_CT</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+   var RoutingAreaIdentification ra_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id.ra_id;</span><br><span style="color: hsl(120, 100%, 40%);">+ var OCT4 tlli := f_gprs_tlli_random();</span><br><span style="color: hsl(120, 100%, 40%);">+        var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_SUSPEND(tlli, ra_id);</span><br><span style="color: hsl(120, 100%, 40%);">+       /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(120, 100%, 40%);">+        var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id);</span><br><span style="color: hsl(120, 100%, 40%);">+     f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       pdu_tx := ts_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(suffix, 1));</span><br><span style="color: hsl(120, 100%, 40%);">+      /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(120, 100%, 40%);">+        pdu_rx := tr_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(suffix, 1));</span><br><span style="color: hsl(120, 100%, 40%);">+      f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       pdu_tx := ts_BSSGP_SUSPEND(tlli, ra_id);</span><br><span style="color: hsl(120, 100%, 40%);">+      /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(120, 100%, 40%);">+        pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id);</span><br><span style="color: hsl(120, 100%, 40%);">+      f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       /* These messages are simple passed through so just also test sending NACK */</span><br><span style="color: hsl(120, 100%, 40%);">+ pdu_tx := ts_BSSGP_SUSPEND_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);</span><br><span style="color: hsl(120, 100%, 40%);">+ /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(120, 100%, 40%);">+        pdu_rx := tr_BSSGP_SUSPEND_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);</span><br><span style="color: hsl(120, 100%, 40%);">+ f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> private function f_TC_suspend() runs on GlobalTest_CT {</span><br><span>        var integer i;</span><br><span> </span><br><span>   /* TODO: Generate RA ID for each ConnHdlr */</span><br><span style="color: hsl(0, 100%, 40%);">-    var RoutingAreaIdentification   ra_id := g_pcu[0].cfg.bvc[0].cell_id.ra_id;</span><br><span>  for (i := 0; i < 10; i := i+1) {</span><br><span style="color: hsl(0, 100%, 40%);">-             var OCT4 tlli := f_gprs_tlli_random();</span><br><span style="color: hsl(0, 100%, 40%);">-          var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_SUSPEND(tlli, ra_id);</span><br><span style="color: hsl(0, 100%, 40%);">-         /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(0, 100%, 40%);">-          var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-               f_global_pcu2sgsn(pdu_tx, pdu_rx);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-              pdu_tx := ts_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(i, 1));</span><br><span style="color: hsl(0, 100%, 40%);">-             /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(0, 100%, 40%);">-          pdu_rx := tr_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(i, 1));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-             f_global_sgsn2pcu(pdu_tx, pdu_rx);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-              pdu_tx := ts_BSSGP_SUSPEND(tlli, ra_id);</span><br><span style="color: hsl(0, 100%, 40%);">-                /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(0, 100%, 40%);">-          pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-                f_global_pcu2sgsn(pdu_tx, pdu_rx);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-              /* These messages are simple passed through so just also test sending NACK */</span><br><span style="color: hsl(0, 100%, 40%);">-           pdu_tx := ts_BSSGP_SUSPEND_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);</span><br><span style="color: hsl(0, 100%, 40%);">-           /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(0, 100%, 40%);">-          pdu_rx := tr_BSSGP_SUSPEND_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-           f_global_sgsn2pcu(pdu_tx, pdu_rx);</span><br><span style="color: hsl(120, 100%, 40%);">+            f_suspend_one(0, 0, 0, i);</span><br><span>   }</span><br><span>    setverdict(pass);</span><br><span> }</span><br><span>@@ -1108,37 +1110,38 @@</span><br><span>     f_cleanup();</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+private function f_resume_one(integer sgsn_idx, integer pcu_idx, integer bvc_idx, integer suffix)</span><br><span style="color: hsl(120, 100%, 40%);">+runs on GlobalTest_CT</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+    var RoutingAreaIdentification   ra_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id.ra_id;</span><br><span style="color: hsl(120, 100%, 40%);">+       var OCT4 tlli := f_gprs_tlli_random();</span><br><span style="color: hsl(120, 100%, 40%);">+        var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1));</span><br><span style="color: hsl(120, 100%, 40%);">+    /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(120, 100%, 40%);">+        var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1));</span><br><span style="color: hsl(120, 100%, 40%);">+  f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       pdu_tx := ts_BSSGP_RESUME_ACK(tlli, ra_id);</span><br><span style="color: hsl(120, 100%, 40%);">+   /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(120, 100%, 40%);">+        pdu_rx := tr_BSSGP_RESUME_ACK(tlli, ra_id);</span><br><span style="color: hsl(120, 100%, 40%);">+   f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       pdu_tx := ts_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1));</span><br><span style="color: hsl(120, 100%, 40%);">+   /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(120, 100%, 40%);">+        pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1));</span><br><span style="color: hsl(120, 100%, 40%);">+   f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       /* These messages are simple passed through so just also test sending NACK */</span><br><span style="color: hsl(120, 100%, 40%);">+ pdu_tx := ts_BSSGP_RESUME_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);</span><br><span style="color: hsl(120, 100%, 40%);">+  /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(120, 100%, 40%);">+        pdu_rx := tr_BSSGP_RESUME_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);</span><br><span style="color: hsl(120, 100%, 40%);">+  f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> private function f_TC_resume() runs on GlobalTest_CT {</span><br><span>         var integer i;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-      /* TODO: Generate RA ID for each ConnHdlr */</span><br><span style="color: hsl(0, 100%, 40%);">-    var RoutingAreaIdentification   ra_id := g_pcu[0].cfg.bvc[0].cell_id.ra_id;</span><br><span>  for (i := 0; i < 10; i := i+1) {</span><br><span style="color: hsl(0, 100%, 40%);">-             var OCT4 tlli := f_gprs_tlli_random();</span><br><span style="color: hsl(0, 100%, 40%);">-          var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RESUME(tlli, ra_id, int2oct(i, 1));</span><br><span style="color: hsl(0, 100%, 40%);">-           /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(0, 100%, 40%);">-          var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(i, 1));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-         f_global_pcu2sgsn(pdu_tx, pdu_rx);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-              pdu_tx := ts_BSSGP_RESUME_ACK(tlli, ra_id);</span><br><span style="color: hsl(0, 100%, 40%);">-             /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(0, 100%, 40%);">-          pdu_rx := tr_BSSGP_RESUME_ACK(tlli, ra_id);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-             f_global_sgsn2pcu(pdu_tx, pdu_rx);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-              pdu_tx := ts_BSSGP_RESUME(tlli, ra_id, int2oct(i, 1));</span><br><span style="color: hsl(0, 100%, 40%);">-          /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(0, 100%, 40%);">-          pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(i, 1));</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-          f_global_pcu2sgsn(pdu_tx, pdu_rx);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-              /* These messages are simple passed through so just also test sending NACK */</span><br><span style="color: hsl(0, 100%, 40%);">-           pdu_tx := ts_BSSGP_RESUME_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);</span><br><span style="color: hsl(0, 100%, 40%);">-            /* we cannot use pdu_tx as there are some subtle differences in the length field :/ */</span><br><span style="color: hsl(0, 100%, 40%);">-          pdu_rx := tr_BSSGP_RESUME_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-            f_global_sgsn2pcu(pdu_tx, pdu_rx);</span><br><span style="color: hsl(120, 100%, 40%);">+            f_resume_one(0, 0, 0, i);</span><br><span>    }</span><br><span>    setverdict(pass);</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22229">change 22229</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/c/osmo-ttcn3-hacks/+/22229"/><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-Change-Id: Ia0f9d9128754c2196ab026623f1b6a254a958d2f </div>
<div style="display:none"> Gerrit-Change-Number: 22229 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>