BTS_Tests: introduce and use helper f_l1ctl_est_dchan()

This is required for the upcoming test cases running on hopping
channels.  Dealing with module / hopping parameters in every
test case is definitely not a good idea, so let's add a function.

Change-Id: Ia4f078ebbb278246ee117f580ff93f301dc60f7c
Related: SYS#4868, OS#4546
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 1582fae..1cecf4e 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -1149,7 +1149,7 @@
 	f_rsl_chan_act(g_pars.chan_mode, act_type := t_RSL_IE_ActType_HO_ASYNC);
 	/* don't perform immediate assignment here, as we're testing non-IA case */
 	/* enable dedicated mode */
-	L1CTL.send(ts_L1CTL_DM_EST_REQ_H0(g_pars.chan_nr, 7, mp_trx0_arfcn));
+	f_l1ctl_est_dchan(L1CTL, g_pars);
 
 	/* Verify that no DL SACCH is being received */
 	f_sacch_missing(?);
@@ -1167,7 +1167,7 @@
 	f_rsl_chan_act(g_pars.chan_mode, more_ies := addl_ies, act_type := t_RSL_IE_ActType_HO_ASYNC);
 	/* don't perform immediate assignment here, as we're testing non-IA case */
 	/* enable dedicated mode */
-	L1CTL.send(ts_L1CTL_DM_EST_REQ_H0(g_pars.chan_nr, 7, mp_trx0_arfcn));
+	f_l1ctl_est_dchan(L1CTL, g_pars);
 
 	/* Verify that DL SACCH is being received */
 	f_sacch_present(si5);
@@ -1205,7 +1205,7 @@
 	f_rsl_chan_act(g_pars.chan_mode, act_type := t_RSL_IE_ActType_HO_SYNC);
 	/* don't perform immediate assignment here, as we're testing non-IA case */
 	/* enable dedicated mode */
-	L1CTL.send(ts_L1CTL_DM_EST_REQ_H0(g_pars.chan_nr, 7, mp_trx0_arfcn));
+	f_l1ctl_est_dchan(L1CTL, g_pars);
 
 	/* Verify that no DL SACCH is being received */
 	f_sacch_missing(?);
@@ -1223,7 +1223,7 @@
 	f_rsl_chan_act(g_pars.chan_mode, more_ies := addl_ies, act_type := t_RSL_IE_ActType_HO_SYNC);
 	/* don't perform immediate assignment here, as we're testing non-IA case */
 	/* enable dedicated mode */
-	L1CTL.send(ts_L1CTL_DM_EST_REQ_H0(g_pars.chan_nr, 7, mp_trx0_arfcn));
+	f_l1ctl_est_dchan(L1CTL, g_pars);
 
 	/* Verify that no DL SACCH is being received */
 	f_sacch_missing(?);
@@ -1241,7 +1241,7 @@
 	f_rsl_chan_act(g_pars.chan_mode, more_ies := addl_ies, act_type := t_RSL_IE_ActType_HO_SYNC);
 	/* don't perform immediate assignment here, as we're testing non-IA case */
 	/* enable dedicated mode */
-	L1CTL.send(ts_L1CTL_DM_EST_REQ_H0(g_pars.chan_nr, 7, mp_trx0_arfcn));
+	f_l1ctl_est_dchan(L1CTL, g_pars);
 
 	/* Verify that no DL SACCH is being received */
 	f_sacch_missing(?);
@@ -1260,7 +1260,7 @@
 	f_rsl_chan_act(g_pars.chan_mode, more_ies := addl_ies, act_type := t_RSL_IE_ActType_HO_SYNC);
 	/* don't perform immediate assignment here, as we're testing non-IA case */
 	/* enable dedicated mode */
-	L1CTL.send(ts_L1CTL_DM_EST_REQ_H0(g_pars.chan_nr, 7, mp_trx0_arfcn));
+	f_l1ctl_est_dchan(L1CTL, g_pars);
 
 	/* Verify that DL SACCH is being received */
 	f_sacch_present(si5);
@@ -1626,7 +1626,7 @@
 
 	/* Switch the MS side (e.g. trxcon) to a dedicated channel without
 	 * waiting for Immediate Assignment and sending Access Burst */
-	L1CTL.send(ts_L1CTL_DM_EST_REQ_H0(g_pars.chan_nr, 7, mp_trx0_arfcn));
+	f_l1ctl_est_dchan(L1CTL, g_pars);
 
 	/* Send handover Access Burst */
 	fn := f_L1CTL_RACH(L1CTL, ho_ref, chan_nr := g_pars.chan_nr);
@@ -1990,6 +1990,21 @@
 	return fn;
 }
 
+/* Tune to a dedicated channel: L1CTL only */
+private function f_l1ctl_est_dchan(L1CTL_PT pt, ConnHdlrPars pars) {
+	if (not ispresent(pars.maio_hsn)) {
+		pt.send(ts_L1CTL_DM_EST_REQ_H0(pars.chan_nr,
+						7 /* TODO: mp_tsc */,
+						mp_trx0_arfcn));
+	} else {
+		pt.send(ts_L1CTL_DM_EST_REQ_H1(pars.chan_nr,
+						7 /* TODO: mp_tsc */,
+						pars.maio_hsn.hsn,
+						pars.maio_hsn.maio,
+						pars.ma));
+	}
+}
+
 /* Establish dedicated channel: L1CTL + RSL side */
 private function f_est_dchan(boolean encr_enable := false, RSL_IE_List more_ies := {}) runs on ConnHdlr {
 	var GsmFrameNumber fn;