pcu: Introduce test TC_multitrx_multims_alloc

Related: OS#1775
Change-Id: I6b20fded6b2a1896fb7ec47c7c5dcbdcbe27f771
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index ea3e6ba..1c46151 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -2472,6 +2472,52 @@
 	f_shutdown(__BFILE__, __LINE__, final := true);
 }
 
+/* Verify allocation of several MS along PDCH ts of several TRX. See OS#1775, SYS#5030 */
+testcase TC_multitrx_multims_alloc() runs on RAW_PCU_Test_CT {
+	var PCUIF_info_ind info_ind;
+	var integer i;
+	const integer num_ms := 8;
+
+	/* Initialize NS/BSSGP side */
+	f_init_bssgp();
+	/* Initialize GPRS MS side */
+	f_init_gprs_ms(num_ms);
+
+	info_ind := valueof(ts_PCUIF_INFO_default);
+	/* Only the 3 first TRX are enabled. The enabled ones all have same
+	   amount of resources, hence same amount of initial resources. */
+	for (i := 0; i < lengthof(info_ind.trx.v10); i := i + 1) {
+		info_ind.trx.v10[i].pdch_mask := '00000000'B;
+	}
+	info_ind.trx.v10[0].pdch_mask := '00000011'B;
+	info_ind.trx.v10[1].pdch_mask := '00001100'B;
+	info_ind.trx.v10[2].pdch_mask := '11000000'B;
+
+	/* Initialize the PCU interface abstraction */
+	f_init_raw(testcasename(), info_ind);
+
+	/* Establish BSSGP connection to the PCU */
+	f_bssgp_establish();
+	for (i := 0; i < num_ms; i := i + 1) {
+		f_bssgp_client_llgmm_assign(TLLI_UNUSED, g_ms[i].tlli);
+	}
+
+	/* Establish an Uplink TBF for each MS. They should be allocated on
+	  different TRX in an uniform way. */
+	for (i := 0; i < num_ms; i := i + 1) {
+		f_ms_establish_ul_tbf(g_ms[i]);
+
+		var uint10_t arfcn := g_ms[i].ul_tbf.rr_imm_ass.payload.imm_ass.pkt_chan_desc.zero.arfcn;
+		if (arfcn != info_ind.trx.v10[i mod 3].arfcn) {
+			setverdict(fail, "Got assigned ARFCN ", arfcn, " vs exp ",
+				   info_ind.trx.v10[i mod 3].arfcn);
+			f_shutdown(__BFILE__, __LINE__);
+		}
+	}
+
+	f_shutdown(__BFILE__, __LINE__, final := true);
+}
+
 control {
 	execute( TC_pcuif_suspend() );
 	execute( TC_ta_ptcch_idle() );
@@ -2524,6 +2570,7 @@
 		/* Packet Uplink/Downlink Assignment on PACCH */
 		execute( TC_pcuif_fh_pkt_ass_ul() );
 		execute( TC_pcuif_fh_pkt_ass_dl() );
+		execute( TC_multitrx_multims_alloc() );
 	}
 
 	execute( TC_pcuif_info_ind_subsequent() );