summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-09-14 20:35:28 +0200
committerfixeria <axilirator@gmail.com>2019-09-27 03:17:50 +0000
commit0eb26621d8e0e66fb4effb03b99d3ba7d0f28c6a (patch)
tree9d95f78024a017f9559b296b4b91bf065040a9c6
parent3e1d31808e13b7d106a9675ddb7b0b42602ab9e4 (diff)
PCU_Tests_RAW.ttcn: add test case for UL link quality adaptation
This change introduces a new test case TC_cs_lqual_ul_tbf, which is aimed to test the feedback of OsmoPCU on changing link quality measurements in Uplink Data blocks during an active TBF. Change-Id: Ia78d93e43a3c41b0b30e70df20a2da31077fd05f Related: SYS#4607
-rw-r--r--library/RLCMAC_Types.ttcn2
-rw-r--r--pcu/PCU_Tests_RAW.ttcn101
2 files changed, 102 insertions, 1 deletions
diff --git a/library/RLCMAC_Types.ttcn b/library/RLCMAC_Types.ttcn
index f3deafc..39c0c97 100644
--- a/library/RLCMAC_Types.ttcn
+++ b/library/RLCMAC_Types.ttcn
@@ -312,7 +312,7 @@ uint3_t usf) := {
mac_hdr := {
payload_type := (MAC_PT_RLCMAC_NO_OPT, MAC_PT_RLCMAC_OPT),
rrbp:= ?,
- rrbp_valid := true,
+ rrbp_valid := ?,
usf := ?
},
opt := *,
diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index fa464a3..7e6611d 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -21,6 +21,9 @@ import from Osmocom_Types all;
import from GSM_Types all;
import from GSM_RR_Types all;
+import from RLCMAC_CSN1_Types all;
+import from RLCMAC_Types all;
+
import from NS_Types all;
import from BSSGP_Types all;
import from Osmocom_Gb_Types all;
@@ -596,6 +599,103 @@ testcase TC_ta_rach_imm_ass() runs on RAW_PCU_Test_CT {
}
}
+/* Default link quality adaptation (Coding Scheme) ranges:
+/* CS1: ... 6 dB, CS2: 5 .. 8 dB, CS3: 7 .. 13 db, CS4: 12 ... dB */
+private template integer CS1_lqual_dB_range := (-infinity .. 6);
+private template integer CS2_lqual_dB_range := (5 .. 8);
+private template integer CS3_lqual_dB_range := (7 .. 13);
+private template integer CS4_lqual_dB_range := (12 .. infinity);
+
+testcase TC_cs_lqual_ul_tbf() runs on RAW_PCU_Test_CT {
+ var PacketUlAssign ul_tbf_ass;
+ var RlcmacDlBlock dl_block;
+ var PCUIF_Message pcu_msg;
+ var GsmRrMessage rr_msg;
+ var octetstring data;
+ var boolean ok;
+
+ /* Initialize the PCU interface abstraction */
+ f_init_raw(testcasename());
+
+ /* Establish an Uplink TBF */
+ ok := f_establish_tbf(rr_msg);
+ if (not ok) {
+ setverdict(fail, "Failed to establish an Uplink TBF");
+ mtc.stop;
+ }
+
+ /* Make sure we received an UL TBF Assignment */
+ /* TODO: check if we got single or dynamic assignment */
+ if (match(rr_msg, tr_IMM_TBF_ASS(dl := false, rest := tr_IaRestOctets_ULAss(?)))) {
+ ul_tbf_ass := rr_msg.payload.imm_ass.rest_octets.hh.pa.uldl.ass.ul;
+ log("Rx Uplink TBF assignment: ", ul_tbf_ass);
+ setverdict(pass);
+ } else {
+ setverdict(fail, "Failed to match UL TBF Assignment");
+ mtc.stop;
+ }
+
+ var template (value) RlcmacUlBlock ul_data := t_RLCMAC_UL_DATA(
+ tfi := ul_tbf_ass.dynamic.tfi_assignment,
+ cv := 15, /* 15 UL blocks to be sent (to be overridden in loop) */
+ bsn := 0, /* TODO: what should be here? */
+ blocks := { /* To be generated in loop */ });
+
+ /* HACK: patch missing TLLI; otherwise OsmoPCU rejects DATA.req */
+ ul_data.data.tlli := '00000001'O;
+
+ /* 16 UL blocks (0 .. 32 dB, step = 2 dB) */
+ for (var integer i := 0; i < 16; i := i + 1) {
+ /* Prepare a new UL block (CV, random payload) */
+ ul_data.data.mac_hdr.countdown := (15 - i);
+ ul_data.data.blocks := { valueof(t_RLCMAC_LLCBLOCK(f_rnd_octstring(10))) };
+
+ /* Encode the payload of DATA.ind */
+ data := enc_RlcmacUlBlock(valueof(ul_data));
+ data := f_pad_oct(data, 23, '00'O); /* CS-1 */
+
+ /* Link quality in dB and our CS1-4 expectations */
+ var integer lqual := i * 2;
+
+ /* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */
+ log("Sending DATA.ind with link quality (dB): ", lqual);
+ BTS.send(ts_PCUIF_DATA_IND(bts_nr := 0, trx_nr := 0, ts_nr := 7, block_nr := 0,
+ sapi := PCU_IF_SAPI_PDTCH, data := data,
+ fn := 0, arfcn := 871, lqual_cb := lqual * 10));
+ BTS.receive(tr_RAW_PCU_EV(TDMA_EV_PDTCH_BLOCK_SENT));
+
+ /* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */
+ BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
+ sapi := PCU_IF_SAPI_PDTCH, fn := 0,
+ arfcn := 871, block_nr := 0));
+ BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
+ sapi := PCU_IF_SAPI_PDTCH)) -> value pcu_msg;
+ dl_block := dec_RlcmacDlBlock(pcu_msg.u.data_req.data);
+ if (not match(dl_block, tr_RLCMAC_ACK_NACK(ul_tfi := ?, tlli := ?))) {
+ setverdict(fail, "Failed to match Packet Uplink ACK / NACK");
+ mtc.stop;
+ }
+
+ log("Rx Packet Uplink ACK / NACK with Channel Coding Command: ",
+ dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd);
+
+ /* Match the received Channel Coding Command */
+ var template ChCodingCommand ch_coding;
+ select (lqual) {
+ case (CS1_lqual_dB_range) { ch_coding := CH_CODING_CS1; }
+ case (CS2_lqual_dB_range) { ch_coding := CH_CODING_CS2; }
+ case (CS3_lqual_dB_range) { ch_coding := CH_CODING_CS3; }
+ case (CS4_lqual_dB_range) { ch_coding := CH_CODING_CS4; }
+ }
+
+ if (not match(dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd, ch_coding)) {
+ setverdict(fail, "Channel Coding does not match our expectations: ", ch_coding);
+ } else {
+ setverdict(pass);
+ }
+ }
+}
+
control {
execute( TC_ns_reset() );
@@ -609,6 +709,7 @@ control {
execute( TC_pcuif_suspend() );
execute( TC_ta_rach_imm_ass() );
+ execute( TC_cs_lqual_ul_tbf() );
}