BTS_Test_ASCI: Add Talker establishment/release test

A VGCS channel is activated. The BSC sends UPLINK FREE message. The MS
sends RACH on VGCS channel. The MS receives VGCS UPLINK GRAND and
establishes layer 2. Then the BSC forces to releases the uplink. The MS
receives UPLINK FREE again.

Change-Id: Ic86bc34890c7d1e6e0b255c3d40eda3dfaa59285
Related: OS#4851
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index d92b9c6..3602746 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -7350,7 +7350,7 @@
 }
 
 /* establish one Radio Link Layer via SABM -> UA. Use l3 for contention resolution */
-private function f_est_rll_mo(uint3_t sapi, RslLinkId link_id, octetstring l3) runs on ConnHdlr {
+friend function f_est_rll_mo(uint3_t sapi, RslLinkId link_id, octetstring l3) runs on ConnHdlr {
 	timer T := 2.0;
 	/* send SABM from MS -> BTS */
 	f_tx_lapdm(ts_LAPDm_SABM(sapi, cr_MO_CMD, true, l3), link_id);
diff --git a/bts/BTS_Tests_ASCI.ttcn b/bts/BTS_Tests_ASCI.ttcn
index e0277bd..315b67f 100644
--- a/bts/BTS_Tests_ASCI.ttcn
+++ b/bts/BTS_Tests_ASCI.ttcn
@@ -290,10 +290,54 @@
 	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
 }
 
+/* A VGCS channel is activated. The BSC sends UPLINK FREE message. The MS sends RACH on VGCS channel.
+ * The MS receives VGCS UPLINK GRAND and establishes layer 2. Then the BSC forces to releases the uplink.
+ */
+private function f_TC_vgcs_talker_est_rel(charstring id) runs on ConnHdlr
+{
+	var octetstring uplink_free := '082B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B'O;
+	var octetstring l3 := '01020304'O;
+	template RslLinkId link_id := ts_RslLinkID_DCCH(0);
+	var RSL_Message rm;
+
+	/* Perform link establishment and talker detection. */
+	f_vgcs_talker_detect();
+
+	/* Establish layer 2. It also detects, if RSL Est Ind is received. */
+	f_est_rll_mo(0, valueof(link_id), l3);
+
+	/* Release link by BSC. */
+	RSL.send(ts_RSL_REL_REQ(g_chan_nr, link_id, RSL_REL_MODE_LOCAL));
+
+	log("Send UPLINK FREE.");
+	RSL.send(ts_RSL_UNITDATA_REQ(g_chan_nr, link_id, uplink_free));
+	f_l1_exp_lapdm(tr_LAPDm_Bter_UI(uplink_free));
+	log("Received UPLINK FREE.");
+
+	/* Deactivate and cleanup. */
+	f_vgcs_cleanup();
+}
+testcase TC_vgcs_talker_est_rel() runs on test_CT
+{
+	var template RSL_IE_ChannelMode ch_mode;
+	var ConnHdlrPars pars;
+	var ConnHdlr vc_conn;
+
+	f_init();
+
+	ch_mode := ts_RSL_ChanMode(RSL_CHRT_TCH_F_GROUP, RSL_CMOD_SP_GSM1);
+	pars := valueof(t_Pars(t_RslChanNr_Bm(1), ch_mode));
+	vc_conn := f_start_handler(refers(f_TC_vgcs_talker_est_rel), pars);
+	vc_conn.done;
+
+	Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+}
+
 control {
 	execute( TC_vbs_notification() );
 	execute( TC_vgcs_uplink_free_and_busy() );
 	execute( TC_vgcs_talker_fail() );
+	execute( TC_vgcs_talker_est_rel() );
 
 }