bsc: Introduce test TC_chan_rel_sccp_tiar_timeout

Verify SCCP T(iar) timeout triggers release of established channel.

Change-Id: Ic2724f62689b99c33e2e5c3a0c2fd022178a788c
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 9c8d68d..d020d95 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -97,6 +97,11 @@
 	/* Osmux is enabled through VTY */
 	var boolean g_osmux_enabled := false;
 
+	/*Configure T(tias) over VTY, seconds */
+	var integer g_bsc_sccp_timer_ias :=  7 * 60;
+	/*Configure T(tiar) over VTY, seconds */
+	var integer g_bsc_sccp_timer_iar := 15 * 60;
+
 	/* global test case guard timer */
 	timer T_guard := 30.0;
 
@@ -332,6 +337,8 @@
 	map(self:BSCVTY, system:BSCVTY);
 	f_vty_set_prompts(BSCVTY);
 	f_vty_transceive(BSCVTY, "enable");
+	f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias),
+			  "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)});
 }
 
 /* global initialization function
@@ -1064,6 +1071,23 @@
 	setverdict(pass);
 }
 
+/* Verify T(iar) triggers and releases the channel */
+testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT {
+	var DchanTuple dt;
+
+	/* Set T(iar) in BSC low enough that it will trigger before other side
+	   has time to keep alive with a T(ias). Keep recommended ratio of
+	   T(iar) >= T(ias)*2 */
+	g_bsc_sccp_timer_ias := 2;
+	g_bsc_sccp_timer_iar := 5;
+
+	f_init(1);
+
+	dt := f_est_dchan('23'O, 23, '00010203040506'O);
+	f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false);
+	setverdict(pass);
+}
+
 /* Test behavior if RSL EST IND for non-active channel */
 testcase TC_rll_est_ind_inact_lchan() runs on test_CT {
 	timer T := 2.0;
@@ -3632,6 +3656,15 @@
 	f_vty_transceive(BSCVTY, "end");
 }
 
+private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {})
+{
+	f_vty_enter_cfg_cs7_inst(pt, 0);
+	for (var integer i := 0; i < sizeof(cmds); i := i+1) {
+		f_vty_transceive(pt, cmds[i]);
+	}
+	f_vty_transceive(pt, "end");
+}
+
 private function f_probe_for_handover(charstring log_label,
 				      charstring log_descr,
 				      charstring handover_vty_cmd,
@@ -4419,6 +4452,7 @@
 	execute( TC_chan_rel_hard_rlsd() );
 	execute( TC_chan_rel_hard_rlsd_ms_dead() );
 	execute( TC_chan_rel_a_reset() );
+	execute( TC_chan_rel_sccp_tiar_timeout() );
 
 	execute( TC_outbound_connect() );