pcu: Introduce test TC_mcs_initial_dl

Change-Id: Ida01fb066f202033507f0c6a99212a1ff9d95423
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index adbc9c8..779d430 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -1096,6 +1096,60 @@
 	f_shutdown(__BFILE__, __LINE__, final := true);
 }
 
+/* Test the initial DL CS set by VTY works fine */
+testcase TC_mcs_initial_dl() runs on RAW_PCU_Test_CT {
+	var octetstring data := f_rnd_octstring(10);
+	var CodingScheme exp_dl_cs_mcs;
+	var RlcmacDlBlock dl_block;
+	var uint32_t poll_fn;
+	var GprsMS ms;
+	var MultislotCap_GPRS_BSSGP mscap_gprs := {
+		gprsmultislotclass := '00011'B,
+		gprsextendeddynalloccap := '0'B
+	};
+	var MultislotCap_EGPRS_BSSGP mscap_egprs := {
+		egprsmultislotclass := '00011'B,
+		egprsextendeddynalloccap := '0'B
+	};
+	var MSRadioAccessCapabilityV_BSSGP ms_racap := { valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, mscap_gprs, mscap_egprs)) };
+
+	/* Initialize NS/BSSGP side */
+	f_init_bssgp();
+	/* Initialize GPRS MS side */
+	f_init_gprs_ms();
+	ms := g_ms[0]; /* We only use first MS in this test */
+
+	/* Initialize the PCU interface abstraction */
+	f_init_raw(testcasename());
+
+	/* Set initial allowed DL MCS to 3 */
+	g_mcs_initial_dl := 3;
+	exp_dl_cs_mcs := MCS_3;
+	/* Set maximum allowed DL MCS to 4 */
+	g_mcs_max_dl := 4;
+	f_pcuvty_set_allowed_cs_mcs();
+	f_pcuvty_set_link_quality_ranges();
+
+	/* Establish BSSGP connection to the PCU */
+	f_bssgp_establish();
+	f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli);
+
+	/* SGSN sends some DL data, PCU will page on CCCH (PCH) */
+	BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap));
+	f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH);
+
+	/* Wait timer X2002 and DL block is available after CCCH IMM ASS: */
+	f_sleep(X2002);
+	f_rx_rlcmac_dl_block_exp_data(dl_block, poll_fn, data, 0, exp_dl_cs_mcs);
+
+	/* ACK the DL block */
+	f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B);
+	f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc),
+			 f_dl_block_ack_fn(dl_block, poll_fn));
+
+	f_shutdown(__BFILE__, __LINE__, final := true);
+}
+
 /* Verify PCU drops TBF after some time of inactivity. */
 testcase TC_t3169() runs on RAW_PCU_Test_CT {
 	var PCUIF_info_ind info_ind;
@@ -3167,6 +3221,7 @@
 	execute( TC_dl_cs1_to_cs4() );
 	execute( TC_mcs_initial_ul() );
 	execute( TC_mcs_max_ul() );
+	execute( TC_mcs_initial_dl() );
 	execute( TC_t3169() );
 	execute( TC_t3193() );
 	execute( TC_countdown_procedure() );