bts: Add TC_sacch_multi_chg

Change-Id: I0b002488729f30cc8d0ff6f4ca16637c35ee956f
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index bc295c7..ecb5497 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -637,6 +637,7 @@
 	f_shutdown();
 }
 
+/* verify that given SACCH payload is present */
 private function f_sacch_present(template octetstring l3_exp) runs on ConnHdlr {
 	var L1ctlDlMessage dl;
 	/* check that the specified SI5 value is actually sent */
@@ -660,6 +661,30 @@
 	}
 }
 
+/* verify that given SACCH payload is not present */
+private function f_sacch_missing(template octetstring l3_exp) runs on ConnHdlr {
+	var L1ctlDlMessage dl;
+	/* check that the specified SI5 value is actually sent */
+	timer T_sacch := 3.0;
+	L1CTL.clear;
+	T_sacch.start;
+	alt {
+	[] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(0))) -> value dl {
+		var octetstring l3 := substr(dl.payload.data_ind.payload, 4, 19);
+		if (match(l3, l3_exp)) {
+			setverdict(fail, "Received unexpected SACCH ", dl);
+			self.stop;
+		} else {
+			repeat;
+		}
+		}
+	[] L1CTL.receive { repeat; }
+	[] T_sacch.timeout {
+		setverdict(pass);
+		}
+	}
+}
+
 /* Test for default SACCH FILL transmitted in DL SACCH (all channel types) */
 private function f_TC_sacch_filling(charstring id) runs on ConnHdlr {
 	/* Set a known default SACCH filling for SI5 */
@@ -785,6 +810,52 @@
 	f_shutdown();
 }
 
+/* Test if SACH information is modified as expected */
+private function f_TC_sacch_multi_chg(charstring id) runs on ConnHdlr {
+	var octetstring si5 := f_rnd_octstring(19);
+	var octetstring si6 := f_rnd_octstring(19);
+
+	/* First, configure both SI5 and SI6 to be transmitted */
+	RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5));
+	RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_6, si6));
+
+	f_l1_tune(L1CTL);
+	RSL.clear;
+
+	/* activate the logical channel */
+	f_est_dchan();
+	L1CTL.clear;
+
+	/* check that SACCH actually are received as expected */
+	f_sacch_present(si5);
+	f_sacch_present(si6);
+
+	/* disable SI6 */
+	RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_6, ''O));
+
+	/* check that SI5 is still transmitted */
+	f_sacch_present(si5);
+	/* check if SI6 is now gone */
+	f_sacch_missing(si6);
+
+	/* release the channel */
+	f_rsl_chan_deact();
+	f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
+}
+testcase TC_sacch_multi_chg() runs on test_CT {
+	var ConnHdlr vc_conn;
+	var ConnHdlrPars pars;
+	f_init();
+	for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) {
+		pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN));
+		log(testcasename(), ": Starting for ", g_AllChannels[i]);
+		vc_conn := f_start_handler(refers(f_TC_sacch_multi_chg), pars);
+		vc_conn.done;
+	}
+	/* TODO: do the above in parallel, rather than sequentially? */
+	f_shutdown();
+}
+
 /* TODO: Test for SACCH information present in RSL CHAN ACT (overrides FILLING) */
 /* TODO: Test for SACCH transmission rules in the context of special CHAN ACT (HO) */
 
@@ -2578,6 +2649,7 @@
 	execute( TC_sacch_filling() );
 	execute( TC_sacch_info_mod() );
 	execute( TC_sacch_multi() );
+	execute( TC_sacch_multi_chg() );
 	execute( TC_rach_content() );
 	execute( TC_rach_count() );
 	execute( TC_rach_max_ta() );