diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn index 5bb5fa7bf..24187b704 100644 --- a/pcu/PCU_Tests_RAW.ttcn +++ b/pcu/PCU_Tests_RAW.ttcn @@ -1058,7 +1058,7 @@ testcase TC_cs_lqual_ul_tbf() runs on RAW_PCU_Test_CT { 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) */ + cv := 15, /* 16 UL blocks to be sent (to be overridden in loop) */ bsn := 0, /* TODO: what should be here? */ blocks := { /* To be generated in loop */ }); @@ -1111,6 +1111,154 @@ testcase TC_cs_lqual_ul_tbf() runs on RAW_PCU_Test_CT { } } +/* Test the max UL CS set by VTY works fine */ +testcase TC_cs_initial_ul() runs on RAW_PCU_Test_CT { + var GsmRrMessage rr_imm_ass; + var PacketUlAssign ul_tbf_ass; + var RlcmacDlBlock dl_block; + var boolean ok; + var integer lqual_cb; + var ChCodingCommand last_ch_coding; + + /* Initialize the PCU interface abstraction */ + f_init_raw(testcasename()); + + /* Set initial UL CS to 3 */ + g_cs_initial_ul := 3; + f_pcuvty_set_allowed_cs_mcs(); + f_pcuvty_set_link_quality_ranges(); + + /* Take lqual (dB->cB) so that we stay in that CS */ + lqual_cb := g_cs_lqual_ranges[2].low * 10; + + /* Establish an Uplink TBF */ + ok := f_establish_tbf(rr_imm_ass); + if (not ok) { + setverdict(fail, "Failed to establish TBF"); + mtc.stop; + } + + ok := f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass); + if (not ok) { + setverdict(fail, "Immediate Assignment not an Uplink TBF"); + mtc.stop; + } + + var template (value) RlcmacUlBlock ul_data := t_RLCMAC_UL_DATA( + tfi := ul_tbf_ass.dynamic.tfi_assignment, + cv := 3, /* 8 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; + + /* 3 UL blocks, check we are in same initial CS: */ + for (var integer i := 0; i < 3; i := i + 1) { + /* Prepare a new UL block (CV, random payload) */ + ul_data.data.mac_hdr.countdown := (7 - i); + ul_data.data.blocks := { valueof(t_RLCMAC_LLCBLOCK(f_rnd_octstring(10))) }; + + /* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */ + f_tx_rlcmac_ul_block(ul_data, lqual_cb); + + /* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */ + f_rx_rlcmac_dl_block_exp_ack_nack(dl_block); + last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd; + } + + if (last_ch_coding != CH_CODING_CS3) { + setverdict(fail, "Channel Coding does not match our expectations (CS-3): ", last_ch_coding); + mtc.stop; + } + + setverdict(pass); + + /* Remaining UL blocks are used to make sure regardless of initial + /* lqual, we can go lower at any time */ + + /* 5 UL blocks, check we are in same initial CS: */ + for (var integer i := 3; i < 8; i := i + 1) { + /* Prepare a new UL block (CV, random payload) */ + ul_data.data.mac_hdr.countdown := (7 - i); + ul_data.data.blocks := { valueof(t_RLCMAC_LLCBLOCK(f_rnd_octstring(10))) }; + + /* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */ + f_tx_rlcmac_ul_block(ul_data, 0); /* 0 dB, make sure we downgrade CS */ + + /* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */ + f_rx_rlcmac_dl_block_exp_ack_nack(dl_block); + + last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd; + } + + if (last_ch_coding != CH_CODING_CS1) { + setverdict(fail, "Channel Coding does not match our expectations (CS-1): ", last_ch_coding); + } else { + setverdict(pass); + } +} + +/* Test the max UL CS set by VTY works fine */ +testcase TC_cs_max_ul() runs on RAW_PCU_Test_CT { + var GsmRrMessage rr_imm_ass; + var PacketUlAssign ul_tbf_ass; + var RlcmacDlBlock dl_block; + var boolean ok; + var ChCodingCommand last_ch_coding; + + /* Initialize the PCU interface abstraction */ + f_init_raw(testcasename()); + + /* Set maximum allowed UL CS to 3 */ + g_cs_max_ul := 3; + f_pcuvty_set_allowed_cs_mcs(); + f_pcuvty_set_link_quality_ranges(); + + /* Establish an Uplink TBF */ + ok := f_establish_tbf(rr_imm_ass); + if (not ok) { + setverdict(fail, "Failed to establish TBF"); + mtc.stop; + } + + ok := f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass); + if (not ok) { + setverdict(fail, "Immediate Assignment not an Uplink TBF"); + mtc.stop; + } + + var template (value) RlcmacUlBlock ul_data := t_RLCMAC_UL_DATA( + tfi := ul_tbf_ass.dynamic.tfi_assignment, + cv := 15, /* 16 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 */ + 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))) }; + + /* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */ + f_tx_rlcmac_ul_block(ul_data, 40*10); /* 40 dB */ + + /* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */ + f_rx_rlcmac_dl_block_exp_ack_nack(dl_block); + + last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd; + } + + if (last_ch_coding != CH_CODING_CS3) { + setverdict(fail, "Channel Coding does not match our expectations (CS-3): ", last_ch_coding); + } else { + setverdict(pass); + } +} + /* Verify PCU drops TBF after some time of inactivity. */ testcase TC_t3169() runs on RAW_PCU_Test_CT { var PCUIF_info_ind info_ind; @@ -1233,6 +1381,8 @@ control { execute( TC_ta_rach_imm_ass() ); execute( TC_ta_ptcch_ul_multi_tbf() ); execute( TC_cs_lqual_ul_tbf() ); + execute( TC_cs_initial_ul() ); + execute( TC_cs_max_ul() ); execute( TC_t3169() ); execute( TC_mo_ping_pong() ); }