bts: Add TC_sacch_chan_act() to test SACCH INFO at RSL CHAN ACT

According to 3GPP Ts 48.058, every logical channel can receive some
specific SACCH filling at the time of RSL channel activation.  This
overrides the global SACCH FILLING.

Related: OS#3750
Change-Id: I8adb371a7e0b80792dd2fa35e5204802068df5ba
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 5b69b5d..0ee3cd4 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -497,7 +497,7 @@
 	var RSL_Message rx := f_rsl_transceive_ret(tx, exp_rx, id, ignore_other);
 }
 
-function f_rsl_chan_act(RSL_IE_ChannelMode mode, boolean encr_enable := false)
+function f_rsl_chan_act(RSL_IE_ChannelMode mode, boolean encr_enable := false, RSL_IE_List more_ies := {})
 runs on ConnHdlr {
 	var RSL_Message ch_act := valueof(ts_RSL_CHAN_ACT(g_chan_nr, mode));
 	if (encr_enable) {
@@ -507,6 +507,7 @@
 		ch_act.ies := ch_act.ies & { valueof(t_RSL_IE(RSL_IE_ENCR_INFO, RSL_IE_Body:{encr_info :=
 encr_info})) };
 	}
+	ch_act.ies := ch_act.ies & more_ies;
 	f_rsl_transceive(ch_act, tr_RSL_CHAN_ACT_ACK(g_chan_nr), "RSL CHAN ACT");
 }
 
@@ -960,7 +961,52 @@
 	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
-/* TODO: Test for SACCH information present in RSL CHAN ACT (overrides FILLING) */
+/* Test for SACCH information present in RSL CHAN ACT (overrides FILLING) */
+private function f_TC_sacch_chan_act(charstring id) runs on ConnHdlr {
+	var octetstring si5 := f_rnd_octstring(19);
+	var octetstring si6 := f_rnd_octstring(19);
+	var octetstring si5_specific := f_rnd_octstring(19);
+	var octetstring si6_specific := 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 channel with different SACCH filling */
+	var RSL_SacchInfo sacch_info := valueof(ts_RSL_SacchInfo({
+				ts_RSL_SacchInfoElem(RSL_SYSTEM_INFO_5, si5_specific),
+				ts_RSL_SacchInfoElem(RSL_SYSTEM_INFO_6, si6_specific)
+				}));
+	var RSL_IE_List addl_ies := { valueof(t_RSL_IE(RSL_IE_SACCH_INFO,
+							RSL_IE_Body:{sacch_info := sacch_info})) };
+	f_est_dchan(more_ies := addl_ies);
+
+	/* check that SACCH actually are received as expected */
+	f_sacch_present(si5_specific);
+	f_sacch_present(si6_specific);
+
+	/* release the channel */
+	f_rsl_chan_deact();
+	f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
+}
+testcase TC_sacch_chan_act() 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_chan_act), pars);
+		vc_conn.done;
+	}
+	/* TODO: do the above in parallel, rather than sequentially? */
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+}
+
 /* TODO: Test for SACCH transmission rules in the context of special CHAN ACT (HO) */
 
 
@@ -1386,7 +1432,7 @@
 }
 
 /* Establish dedicated channel: L1CTL + RSL side */
-private function f_est_dchan(boolean encr_enable := false) runs on ConnHdlr {
+private function f_est_dchan(boolean encr_enable := false, RSL_IE_List more_ies := {}) runs on ConnHdlr {
 	var GsmFrameNumber fn;
 	var ImmediateAssignment imm_ass;
 	var integer ra := 23;
@@ -1395,7 +1441,7 @@
 	fn := f_rach_req_wait_chan_rqd(ra);
 
 	/* Activate channel on BTS side */
-	f_rsl_chan_act(g_pars.chan_mode, encr_enable);
+	f_rsl_chan_act(g_pars.chan_mode, encr_enable, more_ies);
 
 	/* Send IMM.ASS via CCHAN */
 	var ChannelDescription ch_desc := {
@@ -4418,6 +4464,7 @@
 	execute( TC_sacch_info_mod() );
 	execute( TC_sacch_multi() );
 	execute( TC_sacch_multi_chg() );
+	execute( TC_sacch_chan_act() );
 	execute( TC_rach_content() );
 	execute( TC_rach_count() );
 	execute( TC_rach_max_ta() );