From 6cb71cc2e0af8015caf1a4af0838a8dbf6eccef1 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 11 Feb 2021 13:54:01 +0100 Subject: pcu: Convert f_handle_pkt_neighbor_cell_data impl to use alt statements Change-Id: Iac9306cdcf16d9eaa750f6ca10f0c9df6f2c7453 --- pcu/GPRS_Components.ttcn | 106 +++++++++++++++++++++++++++++++++++++++++++++++ pcu/PCU_Tests.ttcn | 78 +++------------------------------- 2 files changed, 111 insertions(+), 73 deletions(-) diff --git a/pcu/GPRS_Components.ttcn b/pcu/GPRS_Components.ttcn index 34b7e797..e59c18d6 100644 --- a/pcu/GPRS_Components.ttcn +++ b/pcu/GPRS_Components.ttcn @@ -533,6 +533,17 @@ runs on MS_BTS_IFACE_CT { } } +altstep as_ms_rx_fail_dummy(inout GprsMS ms, template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum) +runs on MS_BTS_IFACE_CT { + var BTS_PDTCH_Block data_msg; + [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, + tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), + tr_RLCMAC_DUMMY_CTRL())) -> value data_msg { + setverdict(fail, "Unexpected Dummy Ctrl block ", data_msg); + f_shutdown(__BFILE__, __LINE__); + } +} + altstep as_ms_rx_pkt_ass_pacch(inout GprsMS ms, out uint32_t poll_fn, template RlcmacDlBlock t_pkt_ass := ?, template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum, @@ -807,6 +818,101 @@ runs on MS_BTS_IFACE_CT { BTS.send(pcu_msg_cnf); } + +altstep as_ms_rx_pkt_neighbor_cell_data(inout GprsMS ms, octetstring exp_si, + inout uint5_t exp_container_idx /* := 0 */, + inout integer si_offset /* := 0 */, + template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum) +runs on MS_BTS_IFACE_CT { + var integer len; + var octetstring exp_si_chunk; + var GlobalTfi gtfi := { is_dl_tfi := false, tfi := ms.ul_tbf.tfi }; + var BTS_PDTCH_Block data_msg; + var boolean do_repeat := true; + + [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), + tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_NEIGH_CELL_DATA(gtfi, exp_container_idx)) + )) -> value data_msg { + + var PacketNeighbourCellData neigh_data := data_msg.dl_block.ctrl.payload.u.neighbour_cell_data; + var PacketNeighbourCellDataContainer cont := neigh_data.container_list[0]; + + if (cont.cd_length == 31) { /* continues on next message */ + len := lengthof(cont.container_data); + exp_si_chunk := substr(exp_si, si_offset, len); + if (cont.container_data != exp_si_chunk) { + setverdict(fail, "Rx unexpected SI chunk at offset ", si_offset, ": ", + cont.container_data, " vs exp ", exp_si_chunk); + f_shutdown(__BFILE__, __LINE__); + } + si_offset := si_offset + len; + } else if (cont.cd_length == 0) { + /* we are done */ + if (si_offset != lengthof(exp_si)) { + setverdict(fail, "Rx unexpectd SI length ", si_offset, + " vs exp ", lengthof(exp_si)); + f_shutdown(__BFILE__, __LINE__); + } + do_repeat := false; + } else { /* data length, last message */ + len := cont.cd_length; + exp_si_chunk := substr(exp_si, si_offset, len); + if (cont.container_data != exp_si_chunk) { + setverdict(fail, "Rx unexpected SI chunk at offset ", si_offset, ": ", + cont.container_data, " vs exp ", exp_si_chunk); + f_shutdown(__BFILE__, __LINE__); + } + si_offset := si_offset + len; + /* we are done */ + if (si_offset != lengthof(exp_si)) { + setverdict(fail, "Rx unexpectd SI length ", si_offset, + " vs exp ", lengthof(exp_si)); + f_shutdown(__BFILE__, __LINE__); + } + do_repeat := false; + } + + exp_container_idx := exp_container_idx + 1; + + if (do_repeat) { + BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, + sapi := PCU_IF_SAPI_PDTCH, fn := 0, + arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), + block_nr := nr.blk_nr)); + repeat; + } + } +} + +/* Handle groups of PKT NEIGHBOUR CELL DATA packets */ +function f_ms_handle_pkt_neighbor_cell_data(inout GprsMS ms, octetstring exp_si) +runs on MS_BTS_IFACE_CT { + var uint5_t exp_container_idx := 0; + var integer si_offset := 0; + var BTS_PDTCH_Block data_msg; + template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum; + + BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, + sapi := PCU_IF_SAPI_PDTCH, fn := 0, + arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), + block_nr := nr.blk_nr)); + alt { + [exp_container_idx == 0] as_ms_rx_ignore_dummy(ms, nr); + [exp_container_idx > 0] as_ms_rx_fail_dummy(ms, nr); + [] as_ms_rx_pkt_neighbor_cell_data(ms, exp_si, exp_container_idx, si_offset, nr); + [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), + tr_RLCMAC_DL_CTRL(?, ?) + )) -> value data_msg { + var GlobalTfi gtfi := { is_dl_tfi := false, tfi := ms.ul_tbf.tfi }; + setverdict(fail, "Rx unexpected DL block: ", data_msg.dl_block, " vs exp ", + tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_NEIGH_CELL_DATA(gtfi, exp_container_idx))); + f_shutdown(__BFILE__, __LINE__); + } + }; + + return; +} + //////////////////////// // Low level APIs //////////////////////// diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn index cd7a4ece..a937bf43 100644 --- a/pcu/PCU_Tests.ttcn +++ b/pcu/PCU_Tests.ttcn @@ -3544,74 +3544,6 @@ runs on RAW_PCU_Test_CT return RlcmacDlBlock { return dl_block; } -/* Handle groups of PKT NEIGHBOUR CELL DATA packets */ -private function f_handle_pkt_neighbor_cell_data(inout GprsMS ms, octetstring exp_si) -runs on RAW_PCU_Test_CT { - var RlcmacDlBlock dl_block; - var uint32_t sched_fn; - var integer i := 0; - var uint5_t exp_container_idx := 0; - var integer si_offset := 0; - var integer len; - var octetstring exp_si_chunk; - var GlobalTfi gtfi := { is_dl_tfi := false, tfi := ms.ul_tbf.tfi }; - - dl_block := f_skip_dummy(50, sched_fn); - - while (true) { - var template RlcmacDlCtrlMsg exp_msg; exp_msg := - tr_RlcMacDlCtrl_PKT_NEIGH_CELL_DATA(gtfi, exp_container_idx); - - /* Make sure last Dl block is a Pkt Neighbour Cell Data */ - if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, exp_msg))) { - setverdict(fail, "Rx unexpected DL block: ", dl_block, " vs exp ", tr_RLCMAC_DL_CTRL(?, exp_msg)); - f_shutdown(__BFILE__, __LINE__); - } - var PacketNeighbourCellData neigh_data := dl_block.ctrl.payload.u.neighbour_cell_data; - var PacketNeighbourCellDataContainer cont := neigh_data.container_list[0]; - - if (cont.cd_length == 31) { /* continues on next message */ - len := lengthof(cont.container_data); - exp_si_chunk := substr(exp_si, si_offset, len); - if (cont.container_data != exp_si_chunk) { - setverdict(fail, "Rx unexpected SI chunk at offset ", si_offset, ": ", - cont.container_data, " vs exp ", exp_si_chunk); - f_shutdown(__BFILE__, __LINE__); - } - si_offset := si_offset + len; - } else if (cont.cd_length == 0) { - /* we are done */ - if (si_offset != lengthof(exp_si)) { - setverdict(fail, "Rx unexpectd SI length ", si_offset, - " vs exp ", lengthof(exp_si)); - f_shutdown(__BFILE__, __LINE__); - } - break; - } else { /* data length, last message */ - len := cont.cd_length; - exp_si_chunk := substr(exp_si, si_offset, len); - if (cont.container_data != exp_si_chunk) { - setverdict(fail, "Rx unexpected SI chunk at offset ", si_offset, ": ", - cont.container_data, " vs exp ", exp_si_chunk); - f_shutdown(__BFILE__, __LINE__); - return; - } - si_offset := si_offset + len; - /* we are done */ - if (si_offset != lengthof(exp_si)) { - setverdict(fail, "Rx unexpectd SI length ", si_offset, - " vs exp ", lengthof(exp_si)); - f_shutdown(__BFILE__, __LINE__); - } - break; - } - - exp_container_idx := exp_container_idx + 1; - f_rx_rlcmac_dl_block(dl_block, sched_fn); - } - return; -} - private function f_outbound_nacc_rim_tx_resp(PCUIF_info_ind info_ind) runs on RAW_PCU_Test_CT { var BssgpCellId src := valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_enc_BcdMccMnc(info_ind.mcc, info_ind.mnc, info_ind.mnc_3_digits == 1), @@ -3693,7 +3625,7 @@ runs on RAW_PCU_Test_CT { } /* Announce SI back to MS, continue NACC procedure */ - f_handle_pkt_neighbor_cell_data(ms, si_default); + f_ms_handle_pkt_neighbor_cell_data(ms, si_default); /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ f_rx_rlcmac_dl_block(dl_block, sched_fn); @@ -4213,7 +4145,7 @@ testcase TC_nacc_outbound_pkt_cell_chg_notif_dup() runs on RAW_PCU_Test_CT { } /* Announce SI back to MS, continue NACC procedure */ - f_handle_pkt_neighbor_cell_data(ms, si_default); + f_ms_handle_pkt_neighbor_cell_data(ms, si_default); /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ f_rx_rlcmac_dl_block(dl_block, sched_fn); @@ -4296,7 +4228,7 @@ testcase TC_nacc_outbound_pkt_cell_chg_notif_dup2() runs on RAW_PCU_Test_CT { } /* Announce SI back to MS, continue NACC procedure */ - f_handle_pkt_neighbor_cell_data(ms, si_default); + f_ms_handle_pkt_neighbor_cell_data(ms, si_default); /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ f_rx_rlcmac_dl_block(dl_block, sched_fn); @@ -4379,7 +4311,7 @@ testcase TC_nacc_outbound_pkt_cell_chg_notif_twice() runs on RAW_PCU_Test_CT { as_outbound_nacc_rim_resolve(info_ind); /* Announce SI back to MS, continue NACC procedure */ - f_handle_pkt_neighbor_cell_data(ms, si_default); + f_ms_handle_pkt_neighbor_cell_data(ms, si_default); /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ f_rx_rlcmac_dl_block(dl_block, sched_fn); @@ -4464,7 +4396,7 @@ testcase TC_nacc_outbound_pkt_cell_chg_notif_twice2() runs on RAW_PCU_Test_CT { as_outbound_nacc_rim_resolve(info_ind); /* Announce SI back to MS, continue NACC procedure */ - f_handle_pkt_neighbor_cell_data(ms, si_default); + f_ms_handle_pkt_neighbor_cell_data(ms, si_default); /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ f_rx_rlcmac_dl_block(dl_block, sched_fn); -- cgit v1.2.3