fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20884 )

Change subject: BTS_Tests/DTX: get rid of f_g_chan_is_{tchf,tchh,sdcch4,sdcch8}
......................................................................

BTS_Tests/DTX: get rid of f_g_chan_is_{tchf,tchh,sdcch4,sdcch8}

TTCN-3 offers templates and pattern matching, so no need to match
against all possible variants of the RSL channel number.

Change-Id: I104595c4a96617f8000f803d19a890cff0b02744
Related: OS#4801
---
M bts/BTS_Tests.ttcn
1 file changed, 14 insertions(+), 44 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 9935014..fa6ca0c 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -6705,35 +6705,6 @@
 /***********************************************************************
  * DTX Related (see GSM 05.08, section 8.3)
  ***********************************************************************/
-
-/* XXX These functions must be kept in sync with g_AllChannels defined on 
test_CT. */
-private function f_g_chan_is_tchf() runs on ConnHdlr return boolean {
-       return (g_chan_nr == valueof(ts_RslChanNr_Bm(1)) or
-               g_chan_nr == valueof(ts_RslChanNr_Bm(2)) or
-               g_chan_nr == valueof(ts_RslChanNr_Bm(3)) or
-               g_chan_nr == valueof(ts_RslChanNr_Bm(4)));
-}
-private function f_g_chan_is_tchh() runs on ConnHdlr return boolean {
-       return (g_chan_nr == valueof(ts_RslChanNr_Lm(5,0)) or
-               g_chan_nr == valueof(ts_RslChanNr_Lm(5,1)));
-}
-private function f_g_chan_is_sdcch4() runs on ConnHdlr return boolean {
-       return (g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,0)) or
-               g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,1)) or
-               g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,2)) or
-               g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,3)));
-}
-private function f_g_chan_is_sdcch8() runs on ConnHdlr return boolean {
-       return (g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,0)) or
-               g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,1)) or
-               g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,2)) or
-               g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,3)) or
-               g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,4)) or
-               g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,5)) or
-               g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,6)) or
-               g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,7)));
-}
-
 private function f_test_l2_fill_frames(boolean dtxd) runs on ConnHdlr {
        var L1ctlDlMessage dl;
        var octetstring l2_fill_frame := 
'0303012B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B'O;
@@ -6780,7 +6751,7 @@
                }

                if (dtxd) {
-                       if (not f_g_chan_is_tchf()) {
+                       if (not match(g_chan_nr, t_RslChanNr_Bm(?))) {
                                T.stop;
                                f_rsl_chan_deact();
                                f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
@@ -6832,20 +6803,19 @@
                        }
                        if (fn > first_fn + frame_dtx_tchf_mod) {
                                T.stop;
-                               if (f_g_chan_is_tchf()) {
-                                       /* Without DTX we can expect 25 fill 
frames for every 104 frames.
-                                        * (24 FACCH + 1 SACCH filling) */
-                                        expected_fill_frames := 25;
-                               } else if (f_g_chan_is_tchh()) {
-                                       /* We can expect 2 fill frames for 
every 104 frames. */
-                                        expected_fill_frames := 2;
-                               } else if (f_g_chan_is_sdcch4() or 
f_g_chan_is_sdcch8()) {
-                                       /* We can expect 5 fill frames for 
every 104 frames. */
-                                        expected_fill_frames := 5;
-                               } else {
-                                       f_rsl_chan_deact();
-                                       f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
-                                       Misc_Helpers.f_shutdown(__BFILE__, 
__LINE__, fail, "Unknown channel type");
+
+                               select (g_chan_nr) {
+                               /* TCH/F: we expect 25 fill frames (24 FACCH + 
1 SACCH) for every 104 frames. */
+                               case (t_RslChanNr_Bm(?)) { expected_fill_frames 
:= 25; }
+                               /* TCH/H: we expect 2 fill frames for every 104 
frames. */
+                               case (t_RslChanNr_Lm(?, ?)) { 
expected_fill_frames := 2; }
+                               /* SDCCH: we expect 5 fill frames for every 104 
frames. */
+                               case (t_RslChanNr_SDCCH4(?, ?)) { 
expected_fill_frames := 5; }
+                               case (t_RslChanNr_SDCCH8(?, ?)) { 
expected_fill_frames := 5; }
+                               case else {
+                                       /* This shall not happen, just to be 
sure */
+                                       Misc_Helpers.f_shutdown(__BFILE__, 
__LINE__);
+                                       }
                                }

                                f_rsl_chan_deact();

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20884
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I104595c4a96617f8000f803d19a890cff0b02744
Gerrit-Change-Number: 20884
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to