diff options
-rw-r--r-- | pcu/PCU_Tests.ttcn | 242 |
1 files changed, 219 insertions, 23 deletions
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn index 0b887db7..f7687f5e 100644 --- a/pcu/PCU_Tests.ttcn +++ b/pcu/PCU_Tests.ttcn @@ -57,6 +57,7 @@ import from StatsD_CodecPort_CtrlFunct all; import from StatsD_Checker all; import from IPA_Emulation all; +import from Osmocom_CTRL_Types all; import from Osmocom_CTRL_Adapter all; import from Osmocom_CTRL_Functions all; @@ -3611,6 +3612,55 @@ runs on RAW_PCU_Test_CT { 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), + info_ind.lac), + info_ind.rac), + info_ind.cell_id)); + var BssgpCellId dst := valueof(ts_BssgpCellId(ts_RAI(ts_LAI('023F43'H, /* Decided by test itself (emulating BSC) */ + 423), + 2), + 5)); + var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src)); + var RIM_Routing_Address dst_addr := valueof(t_RIM_Routing_Address_cid(dst)); + var template (value) RAN_Information_RIM_Container res_cont := + ts_RAN_Information_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), + ts_RIM_Sequence_Number(2), + ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), + ts_RIM_Protocol_Version_Number(1), + tsu_ApplContainer_or_ApplErrContainer_NACC(tsu_ApplContainer_NACC(dst, false, 3, si_default)), + omit); + RIM.send(ts_PDU_BSSGP_RAN_INFORMATION(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), + ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), + res_cont)); +} + +altstep as_outbound_nacc_rim_resolve(PCUIF_info_ind info_ind, boolean do_answer := true, boolean do_repeat := false) +runs on RAW_PCU_Test_CT { + /* RIM procedure: */ + 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), + info_ind.lac), + info_ind.rac), + info_ind.cell_id)); + var BssgpCellId dst := valueof(ts_BssgpCellId(ts_RAI(ts_LAI('023F43'H, /* Decided by test itself (emulating BSC) */ + 423), + 2), + 5)); + var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src)); + var RIM_Routing_Address dst_addr := valueof(t_RIM_Routing_Address_cid(dst)); + [] RIM.receive(tr_RAN_INFORMATION_REQUEST(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), + tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), + tr_RAN_Information_Request_RIM_Container)) { + if (do_answer) { + f_outbound_nacc_rim_tx_resp(info_ind); + } + if (do_repeat) { + repeat; + } + } +} + /* Start NACC from MS side */ private function f_outbound_nacc_success(inout GprsMS ms, PCUIF_info_ind info_ind, boolean exp_rac_ci_query := true, boolean exp_si_query := true, @@ -3639,29 +3689,7 @@ runs on RAW_PCU_Test_CT { if (exp_si_query == true) { /* RIM procedure: */ - 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), /* '262F42'H */ - info_ind.lac), - info_ind.rac), - info_ind.cell_id)); - var BssgpCellId dst := valueof(ts_BssgpCellId(ts_RAI(ts_LAI('023F43'H, /* Decided by test itself (emulating BSC) */ - 423), - 2), - 5)); - var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src)); - var RIM_Routing_Address dst_addr := valueof(t_RIM_Routing_Address_cid(dst)); - var template (value) RAN_Information_RIM_Container res_cont; - res_cont := ts_RAN_Information_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), - ts_RIM_Sequence_Number(2), - ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), - ts_RIM_Protocol_Version_Number(1), - tsu_ApplContainer_or_ApplErrContainer_NACC(tsu_ApplContainer_NACC(dst, false, 3, si_default)), - omit); - RIM.receive(tr_RAN_INFORMATION_REQUEST(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), - tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), - tr_RAN_Information_Request_RIM_Container)); - RIM.send(ts_PDU_BSSGP_RAN_INFORMATION(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), - ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), - res_cont)); + as_outbound_nacc_rim_resolve(info_ind); } /* Announce SI back to MS, continue NACC procedure */ @@ -4119,6 +4147,172 @@ testcase TC_nacc_outbound_si_resolve_timeout() runs on RAW_PCU_Test_CT { f_shutdown(__BFILE__, __LINE__, final := true); } +/* Test MS sending Pkt Cell Change Notify twice (duplicate msg) while waiting for CTRL resolution */ +testcase TC_nacc_outbound_pkt_cell_chg_notif_dup() runs on RAW_PCU_Test_CT { + var PollFnCtx pollctx; + var GprsMS ms; + var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); + var template (value) RlcmacUlCtrlMsg cell_chf_notif; + var RlcmacDlBlock dl_block; + var uint32_t sched_fn; + var CtrlMessage rx_ctrl; + var GsmArfcn req_arfcn := 862; + var uint6_t req_bsic := 43; + + /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ + f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); + + /* Initialize NS/BSSGP side */ + f_init_bssgp(); + /* Initialize GPRS MS side */ + f_init_gprs_ms(); + ms := g_ms[0]; /* We only use first MS in this test */ + + /* Initialize the PCU interface abstraction */ + f_init_raw(testcasename(), info_ind); + + /* Make sure we are not affected by full cache from previous tests */ + f_pcuvty_flush_neigh_caches(); + + /* Establish BSSGP connection to the PCU */ + f_bssgp_establish(); + f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); + + /* Send PACKET RESOURCE REQUEST */ + pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); + /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ + f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); + + /* Start NACC from MS side */ + cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); + f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); + + /* osmo-pcu should now ask for resolution: */ + f_ipa_ctrl_wait_link_up(); + var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & + int2str(info_ind.lac) & "." & + int2str(info_ind.cell_id) & "." & + int2str(req_arfcn) & "." & + int2str(req_bsic); + IPA_CTRL.receive(tr_CtrlMsgGet(?, ctrl_var)) -> value rx_ctrl; + /* Before receiving CTRL response, MS retransmits Pkt cell Chg Notif */ + f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); + f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ + IPA_CTRL.send(ts_CtrlMsgGetRepl(rx_ctrl.cmd.id, valueof(ctrl_var), valueof("023-43-423-2-5"))); + timer T := 2.0; + T.start; + alt { + [] as_outbound_nacc_rim_resolve(info_ind, do_repeat := true); + [] IPA_CTRL.receive(tr_CtrlMsgGet(?, ctrl_var)) -> value rx_ctrl { + setverdict(fail, "Received unexpected CTRL resolution after duplicate Pkt Cell Change Notification:", rx_ctrl); + f_shutdown(__BFILE__, __LINE__); + } + [] T.timeout { + setverdict(pass); + } + } + + /* Announce SI back to MS, continue NACC procedure */ + f_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); + if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { + setverdict(fail, "Rx unexpected DL block: ", dl_block); + f_shutdown(__BFILE__, __LINE__); + } + /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ + if (dl_block.ctrl.mac_hdr.rrbp_valid) { + sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); + f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); + } + + f_shutdown(__BFILE__, __LINE__, final := true); +} + +/* Test MS sending Pkt Cell Change Notify twice (duplicate msg) while waiting for SI resolution */ +testcase TC_nacc_outbound_pkt_cell_chg_notif_dup2() runs on RAW_PCU_Test_CT { + var PollFnCtx pollctx; + var GprsMS ms; + var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); + var template (value) RlcmacUlCtrlMsg cell_chf_notif; + var RlcmacDlBlock dl_block; + var uint32_t sched_fn; + var CtrlMessage rx_ctrl; + var GsmArfcn req_arfcn := 862; + var uint6_t req_bsic := 43; + + /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ + f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); + + /* Initialize NS/BSSGP side */ + f_init_bssgp(); + /* Initialize GPRS MS side */ + f_init_gprs_ms(); + ms := g_ms[0]; /* We only use first MS in this test */ + + /* Initialize the PCU interface abstraction */ + f_init_raw(testcasename(), info_ind); + + /* Make sure we are not affected by full cache from previous tests */ + f_pcuvty_flush_neigh_caches(); + + /* Establish BSSGP connection to the PCU */ + f_bssgp_establish(); + f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); + + /* Send PACKET RESOURCE REQUEST */ + pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); + /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ + f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); + + /* Start NACC from MS side */ + cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); + f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); + + /* osmo-pcu should now ask for resolution: */ + f_ipa_ctrl_wait_link_up(); + var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & + int2str(info_ind.lac) & "." & + int2str(info_ind.cell_id) & "." & + int2str(req_arfcn) & "." & + int2str(req_bsic); + f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); + as_outbound_nacc_rim_resolve(info_ind, do_answer := false); + /* Before receiving RIM response, MS retransmits Pkt cell Chg Notif */ + f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); + f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ + f_outbound_nacc_rim_tx_resp(info_ind); + timer T := 1.0; + T.start; + alt { + [] RIM.receive { + setverdict(fail, "Received unexpected RIM message"); + f_shutdown(__BFILE__, __LINE__); + } + [] T.timeout { + setverdict(pass); + } + } + + /* Announce SI back to MS, continue NACC procedure */ + f_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); + if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { + setverdict(fail, "Rx unexpected DL block: ", dl_block); + f_shutdown(__BFILE__, __LINE__); + } + /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ + if (dl_block.ctrl.mac_hdr.rrbp_valid) { + sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); + f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); + } + + f_shutdown(__BFILE__, __LINE__, final := true); +} + /* Send a RIM RAN info request to the PCU and verify the response, we expect * getting the system information back which we have transfered to the PCU via * PCUIF on startup. */ @@ -4346,6 +4540,8 @@ control { execute( TC_nacc_outbound_rac_ci_resolve_timeout() ); execute( TC_nacc_outbound_rac_ci_resolve_fail_parse_response() ); execute( TC_nacc_outbound_si_resolve_timeout() ); + execute( TC_nacc_outbound_pkt_cell_chg_notif_dup() ); + execute( TC_nacc_outbound_pkt_cell_chg_notif_dup2() ); execute( TC_rim_ran_info_req_single_rep() ); execute( TC_rim_ran_info_req_single_rep_no_si() ); |