Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/14102 )

Change subject: bts: Add TC_sms_cb_cmd_cbch_sdcch{4,8}_default_only
......................................................................

bts: Add TC_sms_cb_cmd_cbch_sdcch{4,8}_default_only

Add a most basic CBCH DEFAULT message test: Ensure *only* the
default message is sent if a default is set.

Related: OS#4011
Change-Id: Iab03fa88b759759a493516d43090c4df63f7b06f
---
M bts/BTS_Tests_SMSCB.ttcn
1 file changed, 105 insertions(+), 12 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/bts/BTS_Tests_SMSCB.ttcn b/bts/BTS_Tests_SMSCB.ttcn
index 6835f02..34e17be 100644
--- a/bts/BTS_Tests_SMSCB.ttcn
+++ b/bts/BTS_Tests_SMSCB.ttcn
@@ -97,10 +97,15 @@
        mtc.stop;
 }

+private function f_cbch_fn2tb(uint32_t fn) return integer
+{
+       return (fn/51) mod 8; /* TS 05.02 Section 6.5.4 */
+}
+
 /* Verify the CBCH TB scheduling rules of TS 05.02 Section 6.5.4 */
 private function f_cbch_fn_verify(uint32_t fn, CBCH_Block cb)
 {
-       var integer tb := (fn/51) mod 8; /* TS 05.02 Section 6.5.4 */
+       var integer tb := f_cbch_fn2tb(fn);
        if (cb.block_type.seq_nr == 15 /* null */) {
                /* always permitted */
                return;
@@ -115,12 +120,8 @@
        }
 }

-/* shared function doing the heavy lifting for most CBCH tests */
-private function f_TC_smscb(CbchTestPars pars) runs on test_CT {
-       var L1ctlDlMessage dl;
-       var boolean cmd_seen_once := false;
-       var integer i, j;
-       timer T := 5.0;
+private function f_smscb_setup(inout CbchTestPars pars) runs on test_CT {
+       var integer i;

        f_cbch_compute_exp_blocks(pars);

@@ -153,6 +154,24 @@
                                        
valueof(ts_RSL_IE_CbCmdType(msg.rsl_cb_cmd, rsl_last_block));
                RSL_CCHAN.send(ts_RSL_UD(ts_RSL_SMSCB_CMD(cmd_type, 
msg.payload)));
        }
+}
+
+private function f_smscb_cleanup() runs on test_CT {
+       /* reset timeslot 0 channel combination to default */
+       f_vty_config2(BSCVTY, {"network", "bts 0", "trx 0", "timeslot 0"},
+                               "phys_chan_config CCCH+SDCCH4");
+       f_vty_config2(BSCVTY, {"network", "bts 0", "trx 0", "timeslot 6"},
+                               "phys_chan_config SDCCH8");
+}
+
+/* shared function doing the heavy lifting for most CBCH tests */
+private function f_TC_smscb(CbchTestPars pars) runs on test_CT {
+       var L1ctlDlMessage dl;
+       var integer i, j;
+       timer T := 5.0 * int2float(lengthof(pars.msgs));
+
+       f_smscb_setup(pars);
+
        T.start;
        /* Expect this to show up exactly once on the basic CBCH (four blocks) 
*/
        alt {
@@ -202,11 +221,57 @@
                }
        }

-       /* reset timeslot 0 channel combination to default */
-       f_vty_config2(BSCVTY, {"network", "bts 0", "trx 0", "timeslot 0"},
-                               "phys_chan_config CCCH+SDCCH4");
-       f_vty_config2(BSCVTY, {"network", "bts 0", "trx 0", "timeslot 6"},
-                               "phys_chan_config SDCCH8");
+       f_smscb_cleanup();
+       Misc_Helpers.f_shutdown(__BFILE__, __LINE__, pass);
+}
+
+private function f_TC_smscb_default_only(CbchTestPars pars) runs on test_CT {
+       var L1ctlDlMessage dl;
+       timer T := 5.0;
+
+       f_smscb_setup(pars);
+
+       /* ensure whatever initial NULL messages have all been drained */
+       f_sleep(5.0);
+       L1CTL.clear;
+
+       T.start;
+       alt {
+       [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_CBCH(0))) -> value dl {
+               var integer tb := f_cbch_fn2tb(dl.dl_info.frame_nr);
+               log("CBCH: ", dl);
+               var CBCH_Block cb := 
dec_CBCH_Block(dl.payload.data_ind.payload);
+               /* detect the proper CBCH messages; check frame number */
+               f_cbch_fn_verify(dl.dl_info.frame_nr, cb);
+               if (tb >= 4) {
+                       /* skip extended CBCH for now */
+                       repeat;
+               }
+               if (not match(cb, tr_CBCH_Block)) {
+                       setverdict(fail, "Illegal CBCH Block received: ", cb);
+               } else {
+                       var uint4_t rx_seq_nr := cb.block_type.seq_nr;
+                       var template CBCH_Block tr;
+                       if (rx_seq_nr < lengthof(pars.msgs[0].blocks)) {
+                               var CbchBlock b := 
pars.msgs[0].blocks[rx_seq_nr];
+                               tr := tr_CBCH_Block(b.seq_nr, b.is_last, 
b.payload);
+                       } else {
+                               tr := tr_CBCH_Block(15, ?, ?);
+                       }
+                       if (match(cb, tr)) {
+                               setverdict(pass); /* FIXME: check that all 
blocks are received? */
+                               repeat;
+                       } else {
+                               setverdict(fail, "Unexpected CBCH block ", cb, 
", expected ", tr);
+                       }
+               }
+               }
+       [] L1CTL.receive { repeat; }
+       [] T.timeout {}
+       }
+
+       f_smscb_cleanup();
+       /* don't shut down; some tests still want to continue */
 }

 private const CbchTestMsgs msgs_1m_1b_norm := {
@@ -260,6 +325,13 @@
          omit }
 }

+private const CbchTestMsgs msgs_1m_3b_default := {
+       { RSL_CB_CMD_DEFAULT, 2, 
'001000320f1141660c344dd3cba09a0c000000000000'O &
+                               '000102030405060708090a0b0c0d0e0f101213141516'O 
&
+                               '101112131415161718191a1b1c1d1e1f202223242526'O,
+         omit }
+}
+
 /* transmit single-block SMSCB COMMAND */
 testcase TC_sms_cb_cmd_sdcch4_1block() runs on test_CT {
        var CbchTestPars pars := {
@@ -356,6 +428,25 @@
        f_TC_smscb(pars);
 }

+/* set a DEFAULT message; verify it gets transmitted all the time */
+testcase TC_sms_cb_cmd_sdcch4_default_only() runs on test_CT {
+       var CbchTestPars pars := {
+               use_sdcch4 := true,
+               msgs := msgs_1m_3b_default
+       };
+       f_TC_smscb_default_only(pars);
+       Misc_Helpers.f_shutdown(__BFILE__, __LINE__, pass);
+}
+testcase TC_sms_cb_cmd_sdcch8_default_only() runs on test_CT {
+       var CbchTestPars pars := {
+               use_sdcch4 := true,
+               msgs := msgs_1m_3b_default
+       };
+       f_TC_smscb_default_only(pars);
+       Misc_Helpers.f_shutdown(__BFILE__, __LINE__, pass);
+}
+
+
 /* SMSCB TODO:
    * multiple SMS BC CMD at the same time: Ensure all of them are sent exactly 
once
    * extended CBCH vs. normal CBCH
@@ -369,6 +460,7 @@
        execute( TC_sms_cb_cmd_sdcch4_4block() );
        execute( TC_sms_cb_cmd_sdcch4_multi() );
        execute( TC_sms_cb_cmd_sdcch4_schedule() );
+       execute( TC_sms_cb_cmd_sdcch4_default_only() );
        if (false) { /* FIXME: SDCCH/8 support broken, needs trxcon + L1CTL 
work */
        execute( TC_sms_cb_cmd_sdcch8_1block() );
        execute( TC_sms_cb_cmd_sdcch8_2block() );
@@ -376,6 +468,7 @@
        execute( TC_sms_cb_cmd_sdcch8_4block() );
        execute( TC_sms_cb_cmd_sdcch8_multi() );
        execute( TC_sms_cb_cmd_sdcch8_schedule() );
+       execute( TC_sms_cb_cmd_sdcch8_default_only() );
        }
 }


--
To view, visit https://gerrit.osmocom.org/14102
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iab03fa88b759759a493516d43090c4df63f7b06f
Gerrit-Change-Number: 14102
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)

Reply via email to