pcu: Introduce test TC_cs_max_dl and TC_dl_cs1_to_cs4
Change-Id: If847d091f3f4e6a7c77fbadc7280423637c50b35
diff --git a/pcu/GPRS_Components.ttcn b/pcu/GPRS_Components.ttcn
index 7093f31..1cbca4c 100644
--- a/pcu/GPRS_Components.ttcn
+++ b/pcu/GPRS_Components.ttcn
@@ -949,19 +949,12 @@
}
}
-/* High level (task specific) helper for receiving and matching GPRS/EGPRS data blocks */
-function f_rx_rlcmac_dl_block_exp_data(out RlcmacDlBlock dl_block, out uint32_t dl_fn,
+/* High level (task specific) helper for matching GPRS/EGPRS data blocks */
+function f_rlcmac_dl_block_exp_data(in RlcmacDlBlock dl_block,
template (present) octetstring data := ?,
template (present) uint7_t exp_bsn := ?,
- template (present) CodingScheme exp_cs := ?,
- template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum)
+ template (present) CodingScheme exp_cs := ?)
runs on MS_BTS_IFACE_CT {
- /* FIXME: ideally we should use an alt statement with timeout here, rather than
- * having +100500 layers of abstraction. This would facilitate developing the
- * multi-TBF/-TRX/-BTS tests, where you cannot expect that the first received
- * block is exactly what you need. */
- f_rx_rlcmac_dl_block(dl_block, dl_fn, nr := nr);
-
/* Make sure it's either GPRS or EGPRS data block */
if (not match(dl_block, tr_RLCMAC_DATA)) {
setverdict(fail, "Failed to match DL DATA: ", dl_block, " vs ", tr_RLCMAC_DATA);
@@ -979,6 +972,22 @@
}
}
+/* High level (task specific) helper for receiving and matching GPRS/EGPRS data blocks */
+function f_rx_rlcmac_dl_block_exp_data(out RlcmacDlBlock dl_block, out uint32_t dl_fn,
+ template (present) octetstring data := ?,
+ template (present) uint7_t exp_bsn := ?,
+ template (present) CodingScheme exp_cs := ?,
+ template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum)
+runs on MS_BTS_IFACE_CT {
+ /* FIXME: ideally we should use an alt statement with timeout here, rather than
+ * having +100500 layers of abstraction. This would facilitate developing the
+ * multi-TBF/-TRX/-BTS tests, where you cannot expect that the first received
+ * block is exactly what you need. */
+ f_rx_rlcmac_dl_block(dl_block, dl_fn, nr := nr);
+
+ f_rlcmac_dl_block_exp_data(dl_block, data, exp_bsn, exp_cs);
+}
+
function f_dl_block_ack_fn(in RlcmacDlBlock dl_block, uint32_t dl_fn)
runs on MS_BTS_IFACE_CT return uint32_t {
var boolean rrbp_valid;
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index aa4d28d..4df040e 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -867,6 +867,101 @@
f_shutdown(__BFILE__, __LINE__, final := true);
}
+/* Verify scheduling of multiple Downlink data blocks, enough to reach CS4 */
+function f_dl_data_exp_cs(template CodingScheme exp_cs := ?) runs on RAW_PCU_Test_CT {
+ var octetstring data := f_rnd_octstring(1000);
+ var RlcmacDlBlock prev_dl_block, dl_block;
+ var uint32_t ack_fn;
+ var uint32_t fn;
+ var GprsMS ms;
+ var integer tx_data_remain := 5;
+ var integer bsn := 0;
+
+ /* Establish BSSGP connection to the PCU */
+ f_bssgp_establish();
+
+ ms := g_ms[0]; /* We only use first MS in this test */
+ 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));
+ 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);
+
+ for (var integer i := 0; i < 250; i := i + 1) {
+ bsn := i mod 128;
+ f_rx_rlcmac_dl_block(dl_block, fn);
+
+ if (match(dl_block, tr_RLCMAC_DUMMY_CTRL)) {
+ /* No more data to receive, done */
+ break;
+ }
+
+ f_rlcmac_dl_block_exp_data(dl_block, ?, bsn, cs_gprs_any);
+
+ /* Keep Ack/Nack description updated */
+ f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block);
+
+ /* TDMA frame number on which we are supposed to send the ACK */
+ if (dl_block.data.mac_hdr.mac_hdr.rrbp_valid) {
+ ack_fn := f_dl_block_ack_fn(dl_block, fn);
+ f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), ack_fn);
+ if (tx_data_remain != 0) {
+ /* Submit more data from time to time to keep the TBF ongoing */
+ BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data));
+ tx_data_remain := tx_data_remain - 1;
+ }
+ }
+ prev_dl_block := dl_block;
+ }
+
+ bsn := (bsn + 127) mod 128; /* previous bsn: bsn -1 */
+ f_rlcmac_dl_block_exp_data(prev_dl_block, ?, bsn, exp_cs);
+
+
+ f_shutdown(__BFILE__, __LINE__, final := true);
+}
+
+/* Verify DL CS above "cs max" set by VTY is never used */
+testcase TC_cs_max_dl() runs on RAW_PCU_Test_CT {
+ /* Initialize NS/BSSGP side */
+ f_init_bssgp();
+ /* Initialize GPRS MS side */
+ f_init_gprs_ms();
+
+ /* Initialize the PCU interface abstraction */
+ f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS));
+
+ /* Set maximum allowed DL CS to 3 */
+ g_cs_initial_dl := 1;
+ g_cs_max_dl := 3;
+ f_pcuvty_set_allowed_cs_mcs();
+ f_pcuvty_set_link_quality_ranges();
+
+ f_dl_data_exp_cs(f_rlcmac_block_int2cs_mcs(g_cs_max_dl, false));
+}
+
+/* Check DL CS4 is used in good link conditions if allowed by config */
+testcase TC_dl_cs1_to_cs4() runs on RAW_PCU_Test_CT {
+ /* Initialize NS/BSSGP side */
+ f_init_bssgp();
+ /* Initialize GPRS MS side */
+ f_init_gprs_ms();
+
+ /* Initialize the PCU interface abstraction */
+ f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS));
+
+ /* Set initial DL CS to 1 & maximum allowed DL CS to 4 */
+ g_cs_initial_dl := 1;
+ g_cs_max_dl := 4;
+ f_pcuvty_set_allowed_cs_mcs();
+ f_pcuvty_set_link_quality_ranges();
+
+ f_dl_data_exp_cs(f_rlcmac_block_int2cs_mcs(g_cs_max_dl, false));
+}
+
/* Verify PCU drops TBF after some time of inactivity. */
testcase TC_t3169() runs on RAW_PCU_Test_CT {
var PCUIF_info_ind info_ind;
@@ -2915,6 +3010,8 @@
execute( TC_cs_initial_ul() );
execute( TC_cs_max_ul() );
execute( TC_cs_initial_dl() );
+ execute( TC_cs_max_dl() );
+ execute( TC_dl_cs1_to_cs4() );
execute( TC_t3169() );
execute( TC_t3193() );
execute( TC_countdown_procedure() );