Harald Welte | a0895f9 | 2018-03-08 11:51:23 +0100 | [diff] [blame] | 1 | module PCU_Tests { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2 | |
| 3 | /* "RAW" PCU tests: Talk directly to the PCU socket of OsmoPCU on the one hand side (emulating |
| 4 | the BTS/BSC side PCU socket server) and the Gb interface on the other hand side. No NS/BSSGP |
| 5 | Emulation is used; rather, we simply use the NS_CodecPort to implement both standard and non- |
| 6 | standard procedures on the NS and BSSGP level. The goal of these tests is to test exactly |
| 7 | those NS and BSSGP implementations on the BSS (PCU) side. */ |
| 8 | |
| 9 | /* (C) 2018-2019 Harald Welte <laforge@gnumonks.org> |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 10 | * (C) 2019-2020 Vadim Yanitskiy <axilirator@gmail.com> |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 11 | * All rights reserved. |
| 12 | * |
| 13 | * Released under the terms of GNU General Public License, Version 2 or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 17 | */ |
| 18 | |
| 19 | friend module PCU_Tests_NS; |
| 20 | |
| 21 | import from General_Types all; |
| 22 | import from Osmocom_Types all; |
| 23 | import from GSM_Types all; |
| 24 | import from GSM_RR_Types all; |
Vadim Yanitskiy | 150d6d1 | 2022-10-20 19:10:04 +0700 | [diff] [blame] | 25 | import from GSM_RestOctets all; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 26 | |
| 27 | import from Osmocom_VTY_Functions all; |
| 28 | import from TELNETasp_PortType all; |
| 29 | |
| 30 | import from MobileL3_GMM_SM_Types all; |
| 31 | import from RLCMAC_CSN1_Types all; |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 32 | import from RLCMAC_CSN1_Templates all; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 33 | import from RLCMAC_Types all; |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 34 | import from RLCMAC_Templates all; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 35 | |
| 36 | import from MobileL3_CommonIE_Types all; |
| 37 | import from L3_Templates all; |
| 38 | |
| 39 | import from NS_Types all; |
| 40 | import from BSSGP_Types all; |
| 41 | import from Osmocom_Gb_Types all; |
| 42 | |
| 43 | import from BSSGP_Emulation all; /* BssgpConfig */ |
| 44 | import from NS_Emulation all; /* NSConfiguration */ |
| 45 | |
| 46 | import from UD_Types all; |
| 47 | import from PCUIF_Types all; |
| 48 | import from PCUIF_CodecPort all; |
| 49 | import from PCUIF_Components all; |
| 50 | import from IPL4asp_Types all; |
| 51 | import from Native_Functions all; |
| 52 | import from SGSN_Components all; |
Pau Espin Pedrol | aedc511 | 2020-05-16 17:30:42 +0200 | [diff] [blame] | 53 | import from GPRS_Components all; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 54 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 55 | import from StatsD_Types all; |
| 56 | import from StatsD_CodecPort all; |
| 57 | import from StatsD_CodecPort_CtrlFunct all; |
| 58 | import from StatsD_Checker all; |
| 59 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 60 | import from IPA_Emulation all; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 61 | import from Osmocom_CTRL_Types all; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 62 | import from Osmocom_CTRL_Adapter all; |
| 63 | import from Osmocom_CTRL_Functions all; |
| 64 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 65 | modulepar { |
| 66 | charstring mp_pcu_sock_path := PCU_SOCK_DEFAULT; |
| 67 | |
| 68 | float X2002 := 0.2; /* Timer -2002, IMM ASSIGN confirm delay */ |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 69 | |
| 70 | charstring mp_pcu_statsd_ip := "127.0.0.1"; |
| 71 | integer mp_pcu_statsd_port := 8125; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 72 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 73 | charstring mp_ctrl_neigh_ip := ""; /* Use new PCUIF over IPA multiplex for Neigh Addr Resolution */ |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 74 | integer mp_ctrl_neigh_port := 4248; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | |
| 78 | /* FIXME: make sure to use parameters from mp_gb_cfg.cell_id in the PCU INFO IND */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 79 | friend template (value) PCUIF_info_ind ts_PCUIF_INFO_default(template (value) PCUIF_Flags flags := c_PCUIF_Flags_default) |
| 80 | := { |
Vadim Yanitskiy | c155930 | 2020-07-19 16:39:12 +0700 | [diff] [blame] | 81 | version := PCUIF_Types.mp_pcuif_version, |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 82 | flags := flags, |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 83 | trx := ts_PCUIF_InfoTrxs_def(GPRS_Components.mp_base_arfcn), |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 84 | bsic := 7, |
| 85 | mcc := 262, |
| 86 | mnc := 42, |
| 87 | mnc_3_digits := 0, |
| 88 | lac := 13135, |
| 89 | rac := 0, |
| 90 | nsei := mp_nsconfig.nsei, |
| 91 | nse_timer := { 3, 3, 3, 3, 30, 3, 10 }, |
| 92 | cell_timer := { 3, 3, 3, 3, 3, 10, 3, 10, 3, 10, 3 }, |
| 93 | cell_id := 20960, |
| 94 | repeat_time := 5 * 50, |
| 95 | repeat_count := 3, |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 96 | bvci := mp_gb_cfg.bvc[0].bvci, |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 97 | t3142 := 20, |
| 98 | t3169 := 5, |
| 99 | t3191 := 5, |
| 100 | t3193_10ms := 160, |
| 101 | t3195 := 5, |
Pau Espin Pedrol | 76de166 | 2021-03-01 17:40:58 +0100 | [diff] [blame] | 102 | n3101 := 10, |
| 103 | n3103 := 4, |
| 104 | n3105 := 8, |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 105 | cv_countdown := 15, |
| 106 | dl_tbf_ext := 250 * 10, /* ms */ |
| 107 | ul_tbf_ext := 250 * 10, /* ms */ |
| 108 | initial_cs := 2, |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 109 | initial_mcs := 1, |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 110 | nsvci := { mp_nsconfig.nsvc[0].nsvci, 0 }, |
| 111 | local_port := { mp_nsconfig.nsvc[0].provider.ip.remote_udp_port, 0 }, |
| 112 | remote_port := { mp_nsconfig.nsvc[0].provider.ip.local_udp_port, 0 }, |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 113 | remote_addr := f_PCUIF_RemoteAddr( |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 114 | f_PCUIF_AF2addr_type(mp_nsconfig.nsvc[0].provider.ip.address_family), mp_nsconfig.nsvc[0].provider.ip.local_ip) |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 115 | } |
| 116 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 117 | /* Passed in RAN-INFO message from emulated neighbor using RIM */ |
| 118 | const octetstring si1_default := '198fb100000000000000000000000000007900002b'O; |
| 119 | const octetstring si3_default := '1b753000f110236ec9033c2747407900003c0b2b2b'O; |
| 120 | const octetstring si13_default := '009000185a6fc9e08410ab2b2b2b2b2b2b2b2b2b2b'O; |
| 121 | const octetstring si_default := si1_default & si3_default & si13_default; |
| 122 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 123 | const MultislotCap_GPRS mscap_gprs_def := { |
| 124 | gprsmultislotclass := '00011'B, |
| 125 | gprsextendeddynalloccap := '0'B |
| 126 | }; |
| 127 | const MultislotCap_EGPRS mscap_egprs_def := { |
| 128 | egprsmultislotclass := '00011'B, |
| 129 | egprsextendeddynalloccap := '0'B |
| 130 | }; |
| 131 | template (value) MSRadioAccessCapabilityV ms_racap_gprs_def := { ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs_def, omit) }; |
| 132 | template (value) MSRadioAccessCapabilityV ms_racap_egprs_def := { ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs_def, mscap_egprs_def) }; |
| 133 | |
| 134 | const MultislotCap_GPRS_BSSGP bssgp_mscap_gprs_def := { |
| 135 | gprsmultislotclass := '00011'B, |
| 136 | gprsextendeddynalloccap := '0'B |
| 137 | }; |
| 138 | const MultislotCap_EGPRS_BSSGP bssgp_mscap_egprs_def := { |
| 139 | egprsmultislotclass := '00011'B, |
| 140 | egprsextendeddynalloccap := '0'B |
| 141 | }; |
| 142 | template (value) MSRadioAccessCapabilityV_BSSGP bssgp_ms_racap_gprs_def := { valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, bssgp_mscap_gprs_def, omit)) }; |
| 143 | template (value) MSRadioAccessCapabilityV_BSSGP bssgp_ms_racap_egprs_def := { valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, bssgp_mscap_gprs_def, bssgp_mscap_egprs_def)) }; |
| 144 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 145 | type record lqual_range { |
| 146 | /* component reference to the IPA_Client component used for RSL */ |
| 147 | uint8_t low, |
| 148 | uint8_t high |
| 149 | } |
| 150 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 151 | type component RAW_PCU_Test_CT extends bssgp_CT, MS_BTS_IFACE_CT, StatsD_ConnHdlr, CTRL_Adapter_CT { |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 152 | /* PCU interface abstraction component */ |
| 153 | var RAW_PCUIF_CT vc_PCUIF; |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 154 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 155 | /* StatsD */ |
| 156 | var StatsD_Checker_CT vc_STATSD; |
| 157 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 158 | /* Connection to the PCUIF component */ |
| 159 | port RAW_PCU_MSG_PT PCUIF; |
| 160 | /* VTY connection to the PCU */ |
| 161 | port TELNETasp_PT PCUVTY; |
| 162 | |
| 163 | /* Uplink CS/MCS thresholds, default from pcu_main.c: */ |
| 164 | var lqual_range g_cs_lqual_ranges[4] := {{low := 0, high := 6}, |
| 165 | {low := 5, high := 8}, |
| 166 | {low := 7, high := 13}, |
| 167 | {low := 12,high := 35}}; |
| 168 | var lqual_range g_mcs_lqual_ranges[9] := {{low := 0, high := 6}, |
| 169 | {low := 5, high := 8}, |
| 170 | {low := 7, high := 13}, |
| 171 | {low := 12,high := 15}, |
| 172 | {low := 14, high := 17}, |
| 173 | {low := 16, high := 18}, |
| 174 | {low := 17,high := 20}, |
| 175 | {low := 19, high := 24}, |
| 176 | {low := 23,high := 35}}; |
| 177 | var uint8_t g_cs_initial_dl := 1; |
| 178 | var uint8_t g_cs_initial_ul := 1; |
| 179 | var uint8_t g_mcs_initial_dl := 1; |
| 180 | var uint8_t g_mcs_initial_ul := 1; |
| 181 | var uint8_t g_cs_max_dl := 4; |
| 182 | var uint8_t g_cs_max_ul := 4; |
| 183 | var uint8_t g_mcs_max_dl := 9; |
| 184 | var uint8_t g_mcs_max_ul := 9; |
| 185 | |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 186 | var boolean g_force_two_phase_access := false; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 187 | |
| 188 | /* Guard timeout */ |
| 189 | timer g_T_guard := 60.0; |
| 190 | }; |
| 191 | |
| 192 | private altstep as_Tguard_RAW() runs on RAW_PCU_Test_CT { |
| 193 | [] g_T_guard.timeout { |
| 194 | setverdict(fail, "Timeout of T_guard"); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 195 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 196 | } |
| 197 | } |
| 198 | |
| 199 | private function f_pcuvty_set_allowed_cs_mcs() runs on RAW_PCU_Test_CT { |
| 200 | f_vty_config2(PCUVTY, {"pcu"}, "cs " & int2str(g_cs_initial_dl) & " " & int2str(g_cs_initial_ul)); |
| 201 | f_vty_config2(PCUVTY, {"pcu"}, "cs max " & int2str(g_cs_max_dl) & " " & int2str(g_cs_max_ul)); |
| 202 | |
| 203 | f_vty_config2(PCUVTY, {"pcu"}, "mcs " & int2str(g_mcs_initial_dl) & " " & int2str(g_mcs_initial_ul)); |
| 204 | f_vty_config2(PCUVTY, {"pcu"}, "mcs max " & int2str(g_mcs_max_dl) & " " & int2str(g_mcs_max_ul)); |
| 205 | } |
| 206 | |
| 207 | private function f_pcuvty_set_link_quality_ranges() runs on RAW_PCU_Test_CT { |
| 208 | var charstring cmd; |
| 209 | |
| 210 | cmd := "cs link-quality-ranges" & |
| 211 | " cs1 " & int2str(g_cs_lqual_ranges[0].high) & |
| 212 | " cs2 " & int2str(g_cs_lqual_ranges[1].low) & " " & int2str(g_cs_lqual_ranges[1].high) & |
| 213 | " cs3 " & int2str(g_cs_lqual_ranges[2].low) & " " & int2str(g_cs_lqual_ranges[2].high) & |
| 214 | " cs4 " & int2str(g_cs_lqual_ranges[3].low); |
| 215 | f_vty_config2(PCUVTY, {"pcu"}, cmd); |
| 216 | |
| 217 | cmd := "mcs link-quality-ranges" & |
| 218 | " mcs1 " & int2str(g_mcs_lqual_ranges[0].high) & |
| 219 | " mcs2 " & int2str(g_mcs_lqual_ranges[1].low) & " " & int2str(g_mcs_lqual_ranges[1].high) & |
| 220 | " mcs3 " & int2str(g_mcs_lqual_ranges[2].low) & " " & int2str(g_mcs_lqual_ranges[2].high) & |
| 221 | " mcs4 " & int2str(g_mcs_lqual_ranges[3].low) & " " & int2str(g_mcs_lqual_ranges[3].high) & |
| 222 | " mcs5 " & int2str(g_mcs_lqual_ranges[4].low) & " " & int2str(g_mcs_lqual_ranges[4].high) & |
| 223 | " mcs6 " & int2str(g_mcs_lqual_ranges[5].low) & " " & int2str(g_mcs_lqual_ranges[5].high) & |
| 224 | " mcs7 " & int2str(g_mcs_lqual_ranges[6].low) & " " & int2str(g_mcs_lqual_ranges[6].high) & |
| 225 | " mcs8 " & int2str(g_mcs_lqual_ranges[7].low) & " " & int2str(g_mcs_lqual_ranges[7].high) & |
| 226 | " mcs9 " & int2str(g_mcs_lqual_ranges[8].low); |
| 227 | f_vty_config2(PCUVTY, {"pcu"}, cmd); |
| 228 | } |
| 229 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 230 | private function f_pcuvty_flush_neigh_caches() runs on RAW_PCU_Test_CT { |
| 231 | f_pcuvty_set_neigh_caches(0, 0); |
| 232 | } |
| 233 | |
| 234 | private function f_pcuvty_set_neigh_caches(integer neigh_cache_secs := -1, integer si_cache_secs := -1) |
| 235 | runs on RAW_PCU_Test_CT { |
| 236 | if (neigh_cache_secs == -1) { |
| 237 | f_vty_config2(PCUVTY, {"pcu"}, "timer X10 default"); |
| 238 | } else { |
| 239 | f_vty_config2(PCUVTY, {"pcu"}, "timer X10 " & int2str(neigh_cache_secs)); |
| 240 | } |
| 241 | if (si_cache_secs == -1) { |
| 242 | f_vty_config2(PCUVTY, {"pcu"}, "timer X11 default"); |
| 243 | } else { |
| 244 | f_vty_config2(PCUVTY, {"pcu"}, "timer X11 " & int2str(si_cache_secs)); |
| 245 | } |
| 246 | } |
| 247 | |
Pau Espin Pedrol | e8a9444 | 2021-11-15 17:05:46 +0100 | [diff] [blame] | 248 | private function f_pcuvty_set_timer(integer t, integer val) |
| 249 | runs on RAW_PCU_Test_CT { |
| 250 | if (t >= 0) { |
| 251 | f_vty_config2(PCUVTY, {"pcu"}, "timer T" & int2str(t) & " " & int2str(val)); |
| 252 | } else { |
| 253 | f_vty_config2(PCUVTY, {"pcu"}, "timer X" & int2str(t * -1) & " " & int2str(val)); |
| 254 | } |
| 255 | } |
| 256 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 257 | private function f_init_vty(charstring id, boolean egprs_only) runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 258 | map(self:PCUVTY, system:PCUVTY); |
| 259 | f_vty_set_prompts(PCUVTY); |
| 260 | f_vty_transceive(PCUVTY, "enable"); |
| 261 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 262 | /* This will be removed soon, not needed. EGPRS support is controlled through pcu_ind flags */ |
| 263 | if (egprs_only) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 264 | f_vty_config2(PCUVTY, {"pcu"}, "egprs only"); |
| 265 | } else { |
| 266 | f_vty_config2(PCUVTY, {"pcu"}, "no egprs"); |
| 267 | } |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 268 | |
| 269 | if (g_force_two_phase_access) { |
| 270 | f_vty_config2(PCUVTY, {"pcu"}, "two-phase-access"); |
| 271 | } else { |
| 272 | f_vty_config2(PCUVTY, {"pcu"}, "no two-phase-access"); |
| 273 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 274 | } |
| 275 | |
Pau Espin Pedrol | 2456dad | 2020-04-30 20:22:38 +0200 | [diff] [blame] | 276 | function f_init_raw(charstring id, template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default) |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 277 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 278 | /* Start the guard timer */ |
| 279 | g_T_guard.start; |
| 280 | activate(as_Tguard_RAW()); |
| 281 | |
| 282 | /* Init PCU interface component */ |
Pau Espin Pedrol | 835fd30 | 2022-02-22 17:04:06 +0100 | [diff] [blame] | 283 | vc_PCUIF := RAW_PCUIF_CT.create("PCUIF") alive; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 284 | connect(vc_PCUIF:MTC, self:PCUIF); |
| 285 | map(vc_PCUIF:PCU, system:PCU); |
| 286 | |
| 287 | /* Create one BTS component (we may want more some day) */ |
Pau Espin Pedrol | 835fd30 | 2022-02-22 17:04:06 +0100 | [diff] [blame] | 288 | vc_BTS := RAW_PCU_BTS_CT.create("BTS") alive; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 289 | connect(vc_BTS:PCUIF, vc_PCUIF:BTS); |
| 290 | connect(vc_BTS:TC, self:BTS); |
| 291 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 292 | f_init_vty(id, f_pcuif_ind_flags_egprs_enabled(valueof(info_ind.flags))); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 293 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 294 | f_init_statsd(id, vc_STATSD, mp_pcu_statsd_ip, mp_pcu_statsd_port); |
| 295 | /* This is normally done in the ConnHdlr component, but here |
| 296 | * the Test_CT doubles as ConnHdlr */ |
| 297 | connect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); |
| 298 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 299 | vc_PCUIF.start(f_PCUIF_CT_handler(mp_pcu_sock_path)); |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 300 | vc_BTS.start(f_BTS_CT_handler(0, valueof(info_ind), true)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 301 | |
| 302 | /* Wait until the BTS is ready (SI13 negotiated) */ |
| 303 | BTS.receive(tr_RAW_PCU_EV(BTS_EV_SI13_NEGO)); |
| 304 | } |
| 305 | |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 306 | /* Register TLLI of each allocated GprsMS instance */ |
| 307 | private function f_multi_ms_bssgp_register() |
| 308 | runs on RAW_PCU_Test_CT { |
| 309 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 310 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, g_ms[i].tlli); |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | /* Allocate [and activate] an Uplink TBF for each allocated GprsMS instance */ |
| 315 | private function f_multi_ms_establish_tbf(boolean do_activate := false) |
| 316 | runs on RAW_PCU_Test_CT { |
| 317 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 318 | /* Establish an Uplink TBF */ |
| 319 | f_ms_establish_ul_tbf(g_ms[i]); |
| 320 | |
| 321 | /* Send a random block, so this TBF becomes "active" */ |
| 322 | if (do_activate) { |
| 323 | /* FIXME: use the new APU by Pau to get correct TRX/TS here */ |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 324 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, i mod 8); |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 325 | var octetstring dummy := f_rnd_octstring(12); |
| 326 | var RlcmacDlBlock dl_block; |
| 327 | var uint32_t poll_fn; |
| 328 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 329 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 330 | f_ms_wait_usf(g_ms[i]); |
| 331 | |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 332 | f_ms_tx_ul_data_block(g_ms[i], dummy, with_tlli := true, fn := g_ms[i].ul_tbf.start_time_fn, nr := nr); |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 333 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, poll_fn, nr := nr); |
| 334 | } |
| 335 | } |
| 336 | } |
| 337 | |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 338 | private function f_ms_establish_ul_tbf_2phase_access(inout GprsMS ms, |
| 339 | template (omit) RlcmacUlCtrlMsg pkt_res_req := omit) |
| 340 | runs on RAW_PCU_Test_CT return PollFnCtx { |
| 341 | var PollFnCtx pollctx; |
| 342 | |
| 343 | /* Single block (two phase) packet access */ |
| 344 | var uint16_t ra := bit2int(chan_req_sb); |
| 345 | if (g_force_two_phase_access) { |
| 346 | /* If 2phase access is enforced by the network, then let's |
| 347 | * request a One phase packet access, we'll receive a single block |
| 348 | * anyway |
| 349 | */ |
| 350 | ra := bit2int(chan_req_def); |
| 351 | } |
| 352 | |
| 353 | /* Establish an Uplink TBF */ |
| 354 | f_ms_use_ra(ms, ra, ra_is_11bit := 0); |
| 355 | f_ms_establish_ul_tbf(ms); |
| 356 | |
| 357 | /* Make sure we've got an Uplink TBF assignment */ |
| 358 | if (not match(ms.ul_tbf.ass.ccch, tr_PacketUlSglAssign)) { |
| 359 | setverdict(fail, "Wrong Packet Uplink Assignment received: ", ms.ul_tbf.ass.ccch, " vs exp: ", tr_PacketUlSglAssign); |
| 360 | f_shutdown(__BFILE__, __LINE__); |
| 361 | } |
| 362 | |
| 363 | /* Send PACKET RESOURCE REQUEST |
| 364 | * (see 3GPP TS 04.60 "7.1.3.1 Initiation of the Packet resource request procedure") |
| 365 | */ |
| 366 | if (istemplatekind(pkt_res_req, "omit")) { |
| 367 | pkt_res_req := ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, omit); |
| 368 | } |
| 369 | |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 370 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(valueof(pkt_res_req)), ms.ul_tbf.start_time_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 371 | /* Store 1st UlTBF context before receiving next one, will |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 372 | * overwrite the TS allocation on MS with info from new UL TBF: |
| 373 | */ |
| 374 | pollctx.tstrxbts := f_ms_tx_TsTrxBtsNum(ms); |
| 375 | f_ms_rx_pkt_ass_pacch(ms, pollctx.fn, tr_RLCMAC_UL_PACKET_ASS, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 376 | return pollctx; |
| 377 | } |
| 378 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 379 | testcase TC_pcuif_suspend() runs on RAW_PCU_Test_CT { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 380 | var octetstring ra_id := enc_RoutingAreaIdentification(mp_gb_cfg.bvc[0].cell_id.ra_id); |
Pau Espin Pedrol | 2889f87 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 381 | var GprsTlli tlli := TLLI_UNUSED; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 382 | timer T; |
| 383 | |
| 384 | /* Initialize NS/BSSGP side */ |
| 385 | f_init_bssgp(); |
| 386 | |
| 387 | /* Initialize the PCU interface abstraction */ |
| 388 | f_init_raw(testcasename()); |
| 389 | |
| 390 | /* Establish BSSGP connection to the PCU */ |
| 391 | f_bssgp_establish(); |
| 392 | |
| 393 | BTS.send(ts_PCUIF_SUSP_REQ(0, tlli, ra_id, 0)); |
| 394 | |
| 395 | T.start(2.0); |
| 396 | alt { |
Harald Welte | 9b461a9 | 2020-12-10 23:41:14 +0100 | [diff] [blame] | 397 | [] BSSGP_GLOBAL[0].receive(tr_BSSGP_SUSPEND(tlli, mp_gb_cfg.bvc[0].cell_id.ra_id)) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 398 | setverdict(pass); |
| 399 | } |
| 400 | [] T.timeout { |
| 401 | setverdict(fail, "Timeout waiting for BSSGP SUSPEND"); |
| 402 | } |
| 403 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 404 | |
| 405 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 406 | } |
| 407 | |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 408 | /* Make sure TBF is released and no data is sent for in after reciving a Suspend Request from that MS. See OS#4761 */ |
| 409 | testcase TC_pcuif_suspend_active_tbf() runs on RAW_PCU_Test_CT { |
| 410 | var octetstring ra_id := enc_RoutingAreaIdentification(mp_gb_cfg.bvc[0].cell_id.ra_id); |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 411 | var BTS_PDTCH_Block data_msg; |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 412 | var RlcmacDlBlock dl_block; |
| 413 | var octetstring data := f_rnd_octstring(10); |
| 414 | var uint32_t sched_fn; |
| 415 | var uint32_t dl_fn; |
| 416 | var GprsMS ms; |
| 417 | timer T; |
| 418 | |
| 419 | /* Initialize NS/BSSGP side */ |
| 420 | f_init_bssgp(); |
| 421 | /* Initialize GPRS MS side */ |
| 422 | f_init_gprs_ms(); |
| 423 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 424 | |
| 425 | /* Initialize the PCU interface abstraction */ |
| 426 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 427 | |
| 428 | /* Establish BSSGP connection to the PCU */ |
| 429 | f_bssgp_establish(); |
| 430 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 431 | |
| 432 | /* Establish an Uplink TBF */ |
| 433 | f_ms_establish_ul_tbf(ms); |
| 434 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 435 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 436 | f_ms_wait_usf(ms); |
| 437 | |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 438 | /* Send one UL block (with TLLI since we are in One-Phase Access |
Pau Espin Pedrol | 15b2b94 | 2022-10-28 15:08:44 +0200 | [diff] [blame] | 439 | contention resolution) and make sure it is ACKED fine */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 440 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 441 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 442 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 443 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 444 | |
| 445 | /* UL block should be received in SGSN */ |
| 446 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
| 447 | |
| 448 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 449 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 450 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 451 | |
| 452 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 453 | f_sleep(X2002); |
| 454 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 455 | |
| 456 | /* MS has moved to CS, it sent SUSP REQ to BTS and PCU gets it, TBF is freed: */ |
| 457 | BTS.send(ts_PCUIF_SUSP_REQ(0, ms.tlli, ra_id, 0)); |
| 458 | |
| 459 | T.start(2.0); |
| 460 | alt { |
| 461 | [] BSSGP_GLOBAL[0].receive(tr_BSSGP_SUSPEND(ms.tlli, mp_gb_cfg.bvc[0].cell_id.ra_id)) { |
| 462 | setverdict(pass); |
| 463 | } |
| 464 | [] T.timeout { |
| 465 | setverdict(fail, "Timeout waiting for BSSGP SUSPEND"); |
| 466 | f_shutdown(__BFILE__, __LINE__); |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | /* Make sure we don't receive data for that TBF since it was released |
| 471 | * before. Also check our TBF is not polled for UL. */ |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 472 | f_pcuif_rx_data_req_pdtch(data_msg); |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 473 | if (data_msg.dl_block == omit) { |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 474 | /* IDLE block, expected on new PCU versions */ |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 475 | } else { |
| 476 | setverdict(fail, "Unexpected dl_block", data_msg.dl_block); |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 477 | f_shutdown(__BFILE__, __LINE__); |
| 478 | } |
| 479 | |
| 480 | /* New data arrives, PCU should page the MS since no TBF active exists: */ |
| 481 | /* Send some more data, it will never reach the MS */ |
| 482 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 483 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 484 | |
| 485 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 486 | } |
| 487 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 488 | /* Test of correct Timing Advance at the time of TBF establishment |
| 489 | * (derived from timing offset of the Access Burst). */ |
| 490 | testcase TC_ta_rach_imm_ass() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 491 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 492 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 493 | /* Initialize GPRS MS side */ |
| 494 | f_init_gprs_ms(); |
| 495 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 496 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 497 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 498 | |
| 499 | /* We cannot send too many TBF requests in a short time because |
| 500 | * at some point the PCU will fail to allocate a new TBF. */ |
| 501 | for (var TimingAdvance ta := 0; ta < 64; ta := ta + 16) { |
| 502 | /* Establish an Uplink TBF (send RACH.ind with current TA) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 503 | ms.ta := ta; |
Vadim Yanitskiy | 84d1dd5 | 2020-05-28 21:09:22 +0700 | [diff] [blame] | 504 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 505 | |
| 506 | /* Make sure Timing Advance IE matches out expectations */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 507 | if (ms.ul_tbf.rr_imm_ass.payload.imm_ass.timing_advance != ta) { |
Vadim Yanitskiy | 8685b38 | 2020-05-06 16:53:26 +0700 | [diff] [blame] | 508 | setverdict(fail, "Timing Advance mismatch: ", |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 509 | ms.ul_tbf.rr_imm_ass.payload.imm_ass.timing_advance, |
Vadim Yanitskiy | 8685b38 | 2020-05-06 16:53:26 +0700 | [diff] [blame] | 510 | " vs expected ", ta); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 511 | break; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 512 | } |
| 513 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 514 | |
| 515 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 516 | } |
| 517 | |
Vadim Yanitskiy | 866f870 | 2021-05-26 14:50:27 +0200 | [diff] [blame] | 518 | /* Verify Timing Advance value indicated in Packet Uplink ACK/NACK message |
| 519 | * sent in response to the first Uplink block after resource allocation. */ |
| 520 | testcase TC_ta_ul_ack_nack_first_block() runs on RAW_PCU_Test_CT { |
| 521 | var GprsMS ms := valueof(t_GprsMS_def); |
| 522 | var PacketUlAckNack ul_ack_nack; |
| 523 | var PacketTimingAdvance pkt_ta; |
| 524 | var RlcmacDlBlock dl_block; |
| 525 | var uint32_t sched_fn; |
| 526 | |
| 527 | /* Initialize NS/BSSGP side */ |
| 528 | f_init_bssgp(); |
| 529 | |
| 530 | /* Initialize the PCU interface abstraction */ |
| 531 | f_init_raw(testcasename()); |
| 532 | |
| 533 | /* Establish BSSGP connection to the PCU */ |
| 534 | f_bssgp_establish(); |
| 535 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 536 | |
| 537 | /* Establish an Uplink TBF */ |
| 538 | f_ms_establish_ul_tbf(ms); |
| 539 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 540 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 541 | f_ms_wait_usf(ms); |
| 542 | |
Vadim Yanitskiy | 866f870 | 2021-05-26 14:50:27 +0200 | [diff] [blame] | 543 | /* In a busy network, there can be a significant delay between resource |
| 544 | * allocation (Packet Uplink Assignment above) and the actual time when |
| 545 | * the MS is allowed to transmit the first Uplink data block. */ |
| 546 | |
| 547 | /* Simulate a delay > 0 */ |
| 548 | ms.ta := 2; |
| 549 | |
Pau Espin Pedrol | 15b2b94 | 2022-10-28 15:08:44 +0200 | [diff] [blame] | 550 | /* We're in One-Phase Access contention resolution, include TLLI */ |
Vadim Yanitskiy | 866f870 | 2021-05-26 14:50:27 +0200 | [diff] [blame] | 551 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
| 552 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 553 | |
| 554 | ul_ack_nack := dl_block.ctrl.payload.u.ul_ack_nack; |
| 555 | if (ispresent(ul_ack_nack.gprs.pkt_ta)) { |
| 556 | pkt_ta := ul_ack_nack.gprs.pkt_ta; |
| 557 | } else if (ispresent(ul_ack_nack.egprs.pkt_ta)) { |
| 558 | pkt_ta := ul_ack_nack.egprs.pkt_ta; |
| 559 | } else { |
| 560 | setverdict(fail, "PacketTimingAdvance IE is not present"); |
| 561 | f_shutdown(__BFILE__, __LINE__); |
| 562 | } |
| 563 | |
| 564 | if (not ispresent(pkt_ta.val)) { |
| 565 | setverdict(fail, "Timing Advance value is not present"); |
| 566 | f_shutdown(__BFILE__, __LINE__); |
| 567 | } else if (pkt_ta.val != ms.ta) { |
| 568 | setverdict(fail, "Timing Advance mismatch: expected ", |
| 569 | ms.ta, ", but received ", pkt_ta.val); |
| 570 | f_shutdown(__BFILE__, __LINE__); |
| 571 | } |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 572 | |
| 573 | f_shutdown(__BFILE__, __LINE__, final := true); |
Vadim Yanitskiy | 866f870 | 2021-05-26 14:50:27 +0200 | [diff] [blame] | 574 | } |
| 575 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 576 | /* Verify Timing Advance value(s) indicated during the packet Downlink assignment |
| 577 | * procedure as per 3GPP TS 44.018, section 3.5.3. There seems to be a bug in the |
| 578 | * IUT that causes it to send an unreasonable Timing Advance value > 0 despite |
| 579 | * no active TBF exists at the moment of establishment (idle mode). */ |
| 580 | testcase TC_ta_idle_dl_tbf_ass() runs on RAW_PCU_Test_CT { |
Vadim Yanitskiy | 37f3333 | 2021-02-21 00:04:23 +0100 | [diff] [blame] | 581 | var GprsMS ms := valueof(t_GprsMS_def); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 582 | |
| 583 | /* Initialize NS/BSSGP side */ |
| 584 | f_init_bssgp(); |
| 585 | |
| 586 | /* Initialize the PCU interface abstraction */ |
| 587 | f_init_raw(testcasename()); |
| 588 | |
| 589 | /* Establish BSSGP connection to the PCU */ |
| 590 | f_bssgp_establish(); |
Vadim Yanitskiy | 37f3333 | 2021-02-21 00:04:23 +0100 | [diff] [blame] | 591 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 592 | |
| 593 | /* SGSN sends some DL data, PCU will initiate Packet Downlink |
| 594 | * Assignment on CCCH (PCH). We don't care about the payload. */ |
Vadim Yanitskiy | 37f3333 | 2021-02-21 00:04:23 +0100 | [diff] [blame] | 595 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, f_rnd_octstring(10))); |
| 596 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 597 | |
| 598 | /* Make sure that Timing Advance is 0 (the actual value is not known yet). |
| 599 | * As per 3GPP S 44.018, section 3.5.3.1.2, the network *shall* initiate |
| 600 | * the procedures defined in 3GPP TS 44.060 or use the polling mechanism. */ |
Vadim Yanitskiy | 37f3333 | 2021-02-21 00:04:23 +0100 | [diff] [blame] | 601 | if (ms.dl_tbf.rr_imm_ass.payload.imm_ass.timing_advance != 0) { |
Vadim Yanitskiy | 84d1dd5 | 2020-05-28 21:09:22 +0700 | [diff] [blame] | 602 | setverdict(fail, "Timing Advance value doesn't match"); |
| 603 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 604 | |
| 605 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 606 | } |
| 607 | |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 608 | /* Verify that the PCU generates idle blocks in PTCCH/D |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 609 | * while neither Uplink nor Downlink TBF is established. */ |
| 610 | testcase TC_ta_ptcch_idle() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 611 | var BTS_PTCCH_Block pcu_msg; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 612 | timer T; |
| 613 | |
| 614 | /* Initialize the PCU interface abstraction */ |
| 615 | f_init_raw(testcasename()); |
| 616 | |
| 617 | /* Sent an RTS.req for PTCCH/D */ |
| 618 | BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7, |
| 619 | sapi := PCU_IF_SAPI_PTCCH, fn := 0, |
| 620 | arfcn := 871, block_nr := 0)); |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 621 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 622 | T.start(5.0); |
| 623 | alt { |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 624 | [] BTS.receive(tr_PCUIF_DATA_PTCCH(0, |
| 625 | tr_PCUIF_DATA(0, 7, sapi := PCU_IF_SAPI_PTCCH), |
| 626 | omit)) { |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 627 | } |
| 628 | [] as_rx_ptcch(pcu_msg, tr_PTCCHDownlinkMsg) { |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 629 | setverdict(fail, "Expected IDLE block instead of PTCCH/D block"); |
| 630 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 631 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 632 | [] BTS.receive(PCUIF_Message:?) { repeat; } |
| 633 | [] T.timeout { |
| 634 | setverdict(fail, "Timeout waiting for a PTCCH/D block"); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 635 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 636 | } |
| 637 | } |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 638 | log("Decoded PTCCH/D message: ", pcu_msg.dl_block); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 639 | |
| 640 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 641 | } |
| 642 | |
| 643 | /* Test of correct Timing Advance during an active Uplink TBF. |
| 644 | * |
| 645 | * Unlike the circuit-switched domain, Uplink transmissions on PDCH time-slots |
| 646 | * are not continuous and there can be long time gaps between them. This happens |
| 647 | * due to a bursty nature of packet data. The actual Timing Advance of a MS may |
| 648 | * significantly change between such rare Uplink transmissions, so GPRS introduces |
| 649 | * additional mechanisms to control Timing Advance, and thus reduce interference |
| 650 | * between neighboring TDMA time-slots. |
| 651 | * |
| 652 | * At the moment of Uplink TBF establishment, initial Timing Advance is measured |
| 653 | * from ToA (Timing of Arrival) of an Access Burst. This is covered by another |
| 654 | * test case - TC_ta_rach_imm_ass. In response to that Access Burst the network |
| 655 | * sends Immediate Assignment on AGCH, which _may_ contain Timing Advance Index |
| 656 | * among with the initial Timing Advance value. And here PTCCH comes to play. |
| 657 | * |
| 658 | * PTCCH is a unidirectional channel on which the network can instruct a sub-set |
| 659 | * of 16 MS (whether TBFs are active or not) to adjust their Timing Advance |
| 660 | * continuously. To ensure continuous measurements of the signal propagation |
| 661 | * delay, the MSs shall transmit Access Bursts on Uplink (PTCCH/U) on sub-slots |
| 662 | * defined by an assigned Timing Advance Index (see 3GPP TS 45.002). |
| 663 | * |
| 664 | * The purpose of this test case is to verify the assignment of Timing Advance |
| 665 | * Index, and the process of Timing Advance notification on PTCCH/D. The MTC |
| 666 | * first establishes several Uplink TBFs, but does not transmit any Uplink |
| 667 | * blocks on them. During 4 TDMA multi-frame periods the MTC is sending RACH |
| 668 | * indications to the PCU, checking the correctness of two received PTCCH/D |
| 669 | * messages (period of PTCCH/D is two multi-frames). |
| 670 | */ |
| 671 | |
| 672 | /* List of ToA values for Access Bursts to be sent on PTCCH/U, |
| 673 | * each ToA (Timing of Arrival) value is in units of 1/4 of |
| 674 | * a symbol (i.e. 1 symbol is 4 QTA units). */ |
| 675 | type record length(16) of int16_t PTCCH_TAI_ToA_MAP; |
| 676 | const PTCCH_TAI_ToA_MAP ptcch_toa_map_def := { |
| 677 | 0, 0, 0, 0, |
| 678 | 0, 0, 0, 0, |
| 679 | 0, 0, 0, 0, |
| 680 | 0, 0, 0, 0 |
| 681 | }; |
| 682 | |
| 683 | private altstep as_ta_ptcch(uint8_t bts_nr := 0, uint8_t trx_nr := 0, uint8_t ts_nr := 7, |
| 684 | in PTCCH_TAI_ToA_MAP toa_map := ptcch_toa_map_def) |
| 685 | runs on RAW_PCU_Test_CT { |
| 686 | var RAW_PCU_Event event; |
| 687 | var integer ss; |
| 688 | |
| 689 | /* Send Access Bursts on PTCCH/U for every TA Index */ |
| 690 | [] BTS.receive(tr_RAW_PCU_EV(TDMA_EV_PTCCH_UL_BURST)) -> value event { |
| 691 | ss := f_tdma_ptcch_fn2ss(event.data.tdma_fn); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 692 | if (ss < 0) { /* Shall not happen */ |
| 693 | f_shutdown(__BFILE__, __LINE__); |
| 694 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 695 | |
| 696 | log("Sending an Access Burst on PTCCH/U", |
| 697 | ", sub-slot=", ss, " (TAI)", |
| 698 | ", fn=", event.data.tdma_fn, |
| 699 | ", ToA=", toa_map[ss], " (QTA)"); |
| 700 | /* TODO: do we care about RA and burst format? */ |
| 701 | BTS.send(ts_PCUIF_RACH_IND(bts_nr, trx_nr, ts_nr, |
| 702 | ra := oct2int('3A'O), |
| 703 | is_11bit := 0, |
| 704 | burst_type := BURST_TYPE_0, |
| 705 | fn := event.data.tdma_fn, |
| 706 | arfcn := 871, |
| 707 | qta := toa_map[ss], |
| 708 | sapi := PCU_IF_SAPI_PTCCH)); |
| 709 | repeat; |
| 710 | } |
| 711 | } |
| 712 | |
| 713 | private function f_TC_ta_ptcch_ul_multi_tbf(in PTCCH_TAI_ToA_MAP ptcch_toa_map, |
| 714 | template PTCCHDownlinkMsg t_ta_msg) |
| 715 | runs on RAW_PCU_Test_CT { |
| 716 | var PTCCHDownlinkMsg ta_msg; |
| 717 | var PCUIF_Message pcu_msg; |
| 718 | timer T; |
| 719 | |
| 720 | /* First, send an RTS.req for the upcoming PTCCH/D block */ |
| 721 | BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7, |
| 722 | sapi := PCU_IF_SAPI_PTCCH, fn := 0, |
| 723 | arfcn := 871, block_nr := 0)); |
| 724 | T.start(2.0); |
| 725 | alt { |
| 726 | /* Keep sending of Access Bursts during two multi-frames (period of PTCCH/D) |
| 727 | * with increasing ToA (Timing of Arrival) values: 0, 7, 14, 28, 35... */ |
| 728 | [] as_ta_ptcch(bts_nr := 0, trx_nr := 0, ts_nr := 7, toa_map := ptcch_toa_map); |
| 729 | /* In the end of 2nd multi-frame we should receive a PTCCH/D block */ |
| 730 | [] BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7, |
| 731 | sapi := PCU_IF_SAPI_PTCCH)) -> value pcu_msg { |
| 732 | ta_msg := dec_PTCCHDownlinkMsg(pcu_msg.u.data_req.data); |
| 733 | log("Rx PTCCH/D message: ", ta_msg); |
| 734 | |
| 735 | /* Make sure Timing Advance values match our expectations */ |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 736 | if (not match(ta_msg, t_ta_msg)) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 737 | setverdict(fail, "PTCCH/D message does not match: ", t_ta_msg); |
| 738 | } |
| 739 | } |
| 740 | [] BTS.receive { repeat; } |
| 741 | [] T.timeout { |
| 742 | setverdict(fail, "Timeout waiting for a PTCCH/D block"); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 743 | } |
| 744 | } |
| 745 | } |
| 746 | |
| 747 | testcase TC_ta_ptcch_ul_multi_tbf() runs on RAW_PCU_Test_CT { |
| 748 | var template PacketUlAssign t_ul_tbf_ass; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 749 | var GprsMS ms; |
| 750 | |
| 751 | /* Initialize GPRS MS side */ |
| 752 | f_init_gprs_ms(); |
| 753 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 754 | |
| 755 | /* Initialize the PCU interface abstraction */ |
| 756 | f_init_raw(testcasename()); |
| 757 | |
| 758 | /* Enable forwarding of PTCCH/U TDMA events to us */ |
| 759 | BTS.send(ts_RAW_PCU_CMD(TDMA_CMD_ENABLE_PTCCH_UL_FWD)); |
| 760 | |
| 761 | /* Establish 7 Uplink TBFs (USF flag is 3 bits long, '111'B is reserved) */ |
| 762 | for (var integer i := 0; i < 7; i := i + 1) { |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 763 | /* Establish an Uplink TBF */ |
| 764 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 765 | |
| 766 | /* We expect incremental TFI/USF assignment (dynamic allocation) */ |
| 767 | t_ul_tbf_ass := tr_PacketUlDynAssign(tfi := i, usf := i); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 768 | if (not match(ms.ul_tbf.ass.ccch, t_ul_tbf_ass)) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 769 | setverdict(fail, "Failed to match Packet Uplink Assignment for #", i); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 770 | break; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 771 | } |
| 772 | |
| 773 | /* We also expect Timing Advance Index to be a part of the assignment */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 774 | if (ms.ul_tbf.ass.ccch.dynamic.ta_index != i) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 775 | setverdict(fail, "Failed to match Timing Advance Index for #", i); |
| 776 | /* Keep going, the current OsmoPCU does not assign TA Index */ |
| 777 | } |
| 778 | } |
| 779 | |
| 780 | /* Prepare a list of ToA values for Access Bursts to be sent on PTCCH/U */ |
| 781 | var PTCCH_TAI_ToA_MAP toa_map := ptcch_toa_map_def; |
| 782 | for (var integer i := 0; i < 7; i := i + 1) { |
| 783 | /* ToA in units of 1/4 of a symbol */ |
| 784 | toa_map[i] := (i + 1) * 7 * 4; |
| 785 | } |
| 786 | |
| 787 | /* Now we have all 7 TBFs established in one-phase access mode, |
| 788 | * however we will not be sending any data on them. Instead, we |
| 789 | * will be sending RACH.ind on PTCCH/U during 4 multi-frame |
| 790 | * periods (TAI 0..8), and then will check two PTCCH/D blocks. |
| 791 | * |
| 792 | * Why not 4 TBFs at once? Because Uplink is delayed by 3 TDMA |
| 793 | * time-slots, so at the moment of scheduling a PTCCH/D block |
| 794 | * the PCU has odd number of PTCCH/U Access Bursts received. */ |
| 795 | f_TC_ta_ptcch_ul_multi_tbf(toa_map, tr_PTCCHDownlinkMsg( |
| 796 | tai0_ta := 7, tai1_ta := 14, tai2_ta := 21, |
| 797 | /* Other values are not known (yet) */ |
| 798 | tai3_ta := ?)); |
| 799 | f_TC_ta_ptcch_ul_multi_tbf(toa_map, tr_PTCCHDownlinkMsg( |
| 800 | tai0_ta := 7, tai1_ta := 14, tai2_ta := 21, |
| 801 | tai3_ta := 28, tai4_ta := 35, tai5_ta := 42, |
| 802 | /* Other values are out of our interest */ |
| 803 | tai6_ta := ?)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 804 | |
| 805 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 806 | } |
| 807 | |
| 808 | /* Default link quality adaptation (Coding Scheme) ranges (inclusive). |
| 809 | * OsmoPCU (VTY): cs link-quality-ranges cs1 6 cs2 5 8 cs3 7 13 cs4 12 |
| 810 | * |
| 811 | * NOTE: the ranges are intentionally overlapping because OsmoPCU |
| 812 | * does not change CS/MCS on the range borders (5-6, 7-8, 12-13). */ |
| 813 | private template integer CS1_lqual_dB_range := (-infinity .. 6); |
| 814 | private template integer CS2_lqual_dB_range := (5 .. 8); |
| 815 | private template integer CS3_lqual_dB_range := (7 .. 13); |
| 816 | private template integer CS4_lqual_dB_range := (12 .. infinity); |
| 817 | |
| 818 | testcase TC_cs_lqual_ul_tbf() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 819 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 820 | var GprsMS ms; |
| 821 | var uint32_t unused_fn, sched_fn; |
| 822 | var uint4_t cv; |
| 823 | |
| 824 | /* Initialize GPRS MS side */ |
| 825 | f_init_gprs_ms(); |
| 826 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 827 | |
| 828 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 829 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 830 | |
| 831 | f_pcuvty_set_allowed_cs_mcs(); |
| 832 | f_pcuvty_set_link_quality_ranges(); |
| 833 | |
| 834 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 835 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 836 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 837 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 838 | f_ms_wait_usf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 839 | |
| 840 | /* The actual / old link quality values. We need to keep track of the old |
| 841 | * (basically previous) link quality value, because OsmoPCU actually |
| 842 | * changes the coding scheme if not only the actual, but also the old |
| 843 | * value leaves the current link quality range (window). */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 844 | var integer lqual_old; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 845 | ms.lqual_cb := 0; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 846 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 847 | /* Send one UL block (with TLLI since we are in One-Phase Access |
Pau Espin Pedrol | 15b2b94 | 2022-10-28 15:08:44 +0200 | [diff] [blame] | 848 | contention resolution) and make sure it is ACKED fine. */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 849 | /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
| 850 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 851 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(16), cv := 15, with_tlli := true, fn := ms.ul_tbf.start_time_fn) |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 852 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 853 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 854 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 855 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 856 | /* 16 UL blocks (0 .. 15 dB, step = 1 cB) */ |
| 857 | for (var integer i := 150; i >= 0; i := i - 1) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 858 | /* Update the old / actual link quality */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 859 | lqual_old := ms.lqual_cb; |
| 860 | ms.lqual_cb := 150 - i; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 861 | |
| 862 | /* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 863 | log("Sending DATA.ind with link quality (dB): ", ms.lqual_cb); |
| 864 | if (i > g_bs_cv_max) { |
| 865 | cv := 15; |
| 866 | } else { |
| 867 | cv := i; |
| 868 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 869 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 870 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := cv) |
| 871 | |
| 872 | /* we will receive UL ACK/NACK from time to time. In that case, check CdCofing increases */ |
| 873 | f_rx_rlcmac_dl_block(dl_block, unused_fn); |
Vadim Yanitskiy | 7179d3e | 2022-10-04 03:27:29 +0700 | [diff] [blame] | 874 | if (match(dl_block, tr_RLCMAC_DL_DUMMY_CTRL())) { |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 875 | continue; |
| 876 | } |
| 877 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_GPRS(ul_tfi := ?)) and |
| 878 | not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 879 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 880 | f_shutdown(__BFILE__, __LINE__); |
| 881 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 882 | |
| 883 | log("Rx Packet Uplink ACK / NACK with Channel Coding Command: ", |
| 884 | dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd); |
| 885 | |
| 886 | /* Match the received Channel Coding Command. Since we are increasing |
| 887 | * the link quality value on each iteration and not decreasing, there |
| 888 | * is no need to check the both old and current link quality values. */ |
| 889 | var template ChCodingCommand ch_coding; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 890 | select (lqual_old / 10) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 891 | case (CS1_lqual_dB_range) { ch_coding := CH_CODING_CS1; } |
| 892 | case (CS2_lqual_dB_range) { ch_coding := CH_CODING_CS2; } |
| 893 | case (CS3_lqual_dB_range) { ch_coding := CH_CODING_CS3; } |
| 894 | case (CS4_lqual_dB_range) { ch_coding := CH_CODING_CS4; } |
| 895 | } |
| 896 | |
| 897 | if (not match(dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd, ch_coding)) { |
| 898 | setverdict(fail, "Channel Coding does not match our expectations: ", ch_coding); |
Pau Espin Pedrol | 1617e31 | 2020-05-22 14:41:14 +0200 | [diff] [blame] | 899 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 900 | } |
| 901 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 902 | |
| 903 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 904 | } |
| 905 | |
| 906 | /* Test the max UL CS set by VTY works fine */ |
| 907 | testcase TC_cs_initial_ul() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 908 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 909 | var ChCodingCommand last_ch_coding; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 910 | var uint32_t unused_fn, sched_fn; |
| 911 | var GprsMS ms; |
| 912 | |
| 913 | /* Initialize GPRS MS side */ |
| 914 | f_init_gprs_ms(); |
| 915 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 916 | |
| 917 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 918 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 919 | |
| 920 | /* Set initial UL CS to 3 */ |
| 921 | g_cs_initial_ul := 3; |
| 922 | f_pcuvty_set_allowed_cs_mcs(); |
| 923 | f_pcuvty_set_link_quality_ranges(); |
| 924 | |
| 925 | /* Take lqual (dB->cB) so that we stay in that CS */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 926 | ms.lqual_cb := g_cs_lqual_ranges[2].low * 10; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 927 | |
| 928 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 929 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 930 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 931 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 932 | f_ms_wait_usf(ms); |
| 933 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 934 | /* Send one UL block (with TLLI since we are in One-Phase Access |
Pau Espin Pedrol | 15b2b94 | 2022-10-28 15:08:44 +0200 | [diff] [blame] | 935 | contention resolution) and make sure it is ACKED fine. */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 936 | /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
| 937 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 938 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(16), cv := 15, with_tlli := true, fn := ms.ul_tbf.start_time_fn) |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 939 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 940 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 941 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 942 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 943 | /* Send UL blocks, until we receive UL ACK/NACK and check we are in same initial CS: */ |
| 944 | while (true) { |
| 945 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := 15); |
| 946 | f_rx_rlcmac_dl_block(dl_block, unused_fn); |
Vadim Yanitskiy | 7179d3e | 2022-10-04 03:27:29 +0700 | [diff] [blame] | 947 | if (match(dl_block, tr_RLCMAC_DL_DUMMY_CTRL())) { |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 948 | continue; |
| 949 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 950 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 951 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_GPRS(ul_tfi := ?)) and |
| 952 | not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 953 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 954 | f_shutdown(__BFILE__, __LINE__); |
| 955 | break; |
| 956 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 957 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 958 | last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 959 | break; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 960 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 961 | if (last_ch_coding != CH_CODING_CS3) { |
| 962 | setverdict(fail, "Channel Coding does not match our expectations (CS-3): ", last_ch_coding); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 963 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 964 | } |
| 965 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 966 | /* Remaining UL blocks are used to make sure regardless of initial |
| 967 | /* lqual, we can go lower at any time */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 968 | /* 0 dB, make sure we downgrade CS */ |
| 969 | ms.lqual_cb := 0; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 970 | /* 5 UL blocks, check we are in same initial CS: */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 971 | f_ms_tx_ul_data_block_multi(ms, 5); |
| 972 | /* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */ |
| 973 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 974 | last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 975 | |
| 976 | if (last_ch_coding != CH_CODING_CS1) { |
| 977 | setverdict(fail, "Channel Coding does not match our expectations (CS-1): ", last_ch_coding); |
Pau Espin Pedrol | 1617e31 | 2020-05-22 14:41:14 +0200 | [diff] [blame] | 978 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 979 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 980 | |
| 981 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 982 | } |
| 983 | |
| 984 | /* Test the max UL CS set by VTY works fine */ |
| 985 | testcase TC_cs_max_ul() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 986 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 987 | var ChCodingCommand last_ch_coding; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 988 | var uint32_t unused_fn, sched_fn; |
| 989 | var GprsMS ms; |
| 990 | |
| 991 | /* Initialize GPRS MS side */ |
| 992 | f_init_gprs_ms(); |
| 993 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 994 | |
| 995 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 996 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 997 | |
| 998 | /* Set maximum allowed UL CS to 3 */ |
| 999 | g_cs_max_ul := 3; |
| 1000 | f_pcuvty_set_allowed_cs_mcs(); |
| 1001 | f_pcuvty_set_link_quality_ranges(); |
| 1002 | |
| 1003 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1004 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1005 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 1006 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 1007 | f_ms_wait_usf(ms); |
| 1008 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1009 | /* Send one UL block (with TLLI since we are in One-Phase Access |
Pau Espin Pedrol | 15b2b94 | 2022-10-28 15:08:44 +0200 | [diff] [blame] | 1010 | contention resolution) and make sure it is ACKED fine. */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1011 | /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
| 1012 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 1013 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(16), cv := 15, with_tlli := true, fn := ms.ul_tbf.start_time_fn) |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1014 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 1015 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 1016 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1017 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1018 | ms.lqual_cb := 40*10; /* 40 dB */ |
| 1019 | f_ms_tx_ul_data_block_multi(ms, 16); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1020 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1021 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 1022 | last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1023 | |
| 1024 | if (last_ch_coding != CH_CODING_CS3) { |
| 1025 | setverdict(fail, "Channel Coding does not match our expectations (CS-3): ", last_ch_coding); |
Pau Espin Pedrol | 1617e31 | 2020-05-22 14:41:14 +0200 | [diff] [blame] | 1026 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1027 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 1028 | |
| 1029 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1030 | } |
| 1031 | |
Pau Espin Pedrol | 7512259 | 2020-11-03 15:22:59 +0100 | [diff] [blame] | 1032 | /* Test the initial DL CS set by VTY works fine */ |
| 1033 | testcase TC_cs_initial_dl() runs on RAW_PCU_Test_CT { |
| 1034 | var octetstring data := f_rnd_octstring(10); |
| 1035 | var CodingScheme exp_dl_cs_mcs; |
| 1036 | var RlcmacDlBlock dl_block; |
| 1037 | var uint32_t poll_fn; |
| 1038 | var GprsMS ms; |
| 1039 | |
| 1040 | /* Initialize NS/BSSGP side */ |
| 1041 | f_init_bssgp(); |
| 1042 | /* Initialize GPRS MS side */ |
| 1043 | f_init_gprs_ms(); |
| 1044 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1045 | |
| 1046 | /* Initialize the PCU interface abstraction */ |
| 1047 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1048 | |
| 1049 | /* Set initial allowed DL CS to 3 */ |
| 1050 | g_cs_initial_dl := 3; |
| 1051 | exp_dl_cs_mcs := CS_3; |
| 1052 | /* Set maximum allowed UL CS to 4 */ |
| 1053 | g_cs_max_dl := 4; |
| 1054 | f_pcuvty_set_allowed_cs_mcs(); |
| 1055 | f_pcuvty_set_link_quality_ranges(); |
| 1056 | |
| 1057 | /* Establish BSSGP connection to the PCU */ |
| 1058 | f_bssgp_establish(); |
| 1059 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1060 | |
| 1061 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 1062 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 1063 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1064 | |
| 1065 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1066 | f_sleep(X2002); |
| 1067 | f_rx_rlcmac_dl_block_exp_data(dl_block, poll_fn, data, 0, exp_dl_cs_mcs); |
| 1068 | |
| 1069 | /* ACK the DL block */ |
| 1070 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1071 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1072 | f_dl_block_ack_fn(dl_block, poll_fn)); |
| 1073 | |
| 1074 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1075 | } |
| 1076 | |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1077 | /* Verify scheduling of multiple Downlink data blocks, enough to reach CS4 */ |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 1078 | function f_dl_data_exp_cs(template (present) CodingScheme exp_final_cs := ?, template (omit) MSRadioAccessCapabilityV_BSSGP ms_racap := omit) runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1079 | var octetstring data := f_rnd_octstring(1400); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1080 | var RlcmacDlBlock prev_dl_block, dl_block; |
| 1081 | var uint32_t ack_fn; |
| 1082 | var uint32_t fn; |
| 1083 | var GprsMS ms; |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1084 | var integer tx_data_remain := 10; |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1085 | var integer bsn := 0; |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1086 | var boolean using_egprs := f_rlcmac_cs_mcs_is_mcs(valueof(exp_final_cs)); |
| 1087 | var integer bsn_mod; |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 1088 | var template (present) CodingScheme exp_tmp_csmcs; |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1089 | |
| 1090 | if (using_egprs) { |
| 1091 | exp_tmp_csmcs := mcs_egprs_any; |
| 1092 | bsn_mod := 2048; |
| 1093 | } else { |
| 1094 | exp_tmp_csmcs := cs_gprs_any; |
| 1095 | bsn_mod := 128; |
| 1096 | } |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1097 | |
| 1098 | /* Establish BSSGP connection to the PCU */ |
| 1099 | f_bssgp_establish(); |
| 1100 | |
| 1101 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1102 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1103 | |
| 1104 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1105 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap)); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1106 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1107 | |
| 1108 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 1109 | f_sleep(X2002); |
| 1110 | |
Pau Espin Pedrol | e3e2bf6 | 2022-11-29 14:32:48 +0100 | [diff] [blame] | 1111 | /* Skip potential dummy blocks before X2002 triggers at PCU after us: */ |
| 1112 | fn := f_rx_rlcmac_dl_block_skip_dummy(dl_block, max_dummy := 10); |
| 1113 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1114 | for (var integer i := 0; i < 800; i := i + 1) { |
| 1115 | bsn := i mod bsn_mod; |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1116 | |
Vadim Yanitskiy | 7179d3e | 2022-10-04 03:27:29 +0700 | [diff] [blame] | 1117 | if (match(dl_block, tr_RLCMAC_DL_DUMMY_CTRL)) { |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1118 | /* No more data to receive, done */ |
| 1119 | break; |
| 1120 | } |
| 1121 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1122 | f_rlcmac_dl_block_exp_data(dl_block, ?, bsn, exp_tmp_csmcs); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1123 | |
| 1124 | /* Keep Ack/Nack description updated */ |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1125 | f_dltbf_ack_block(ms.dl_tbf, dl_block); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1126 | |
| 1127 | /* TDMA frame number on which we are supposed to send the ACK */ |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1128 | if (f_dl_block_rrbp_valid(dl_block)) { |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1129 | ack_fn := f_dl_block_ack_fn(dl_block, fn); |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1130 | f_ms_tx_ul_block(ms, f_dltbf_ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf, using_egprs), ack_fn); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1131 | if (tx_data_remain != 0) { |
| 1132 | /* Submit more data from time to time to keep the TBF ongoing */ |
| 1133 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 1134 | tx_data_remain := tx_data_remain - 1; |
| 1135 | } |
| 1136 | } |
| 1137 | prev_dl_block := dl_block; |
Pau Espin Pedrol | e3e2bf6 | 2022-11-29 14:32:48 +0100 | [diff] [blame] | 1138 | f_rx_rlcmac_dl_block(dl_block, fn); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1139 | } |
| 1140 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1141 | bsn := (bsn + (bsn_mod-1)) mod bsn_mod; /* previous bsn: bsn -1 */ |
| 1142 | f_rlcmac_dl_block_exp_data(prev_dl_block, ?, bsn, exp_final_cs); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1143 | |
| 1144 | |
| 1145 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1146 | } |
| 1147 | |
| 1148 | /* Verify DL CS above "cs max" set by VTY is never used */ |
| 1149 | testcase TC_cs_max_dl() runs on RAW_PCU_Test_CT { |
| 1150 | /* Initialize NS/BSSGP side */ |
| 1151 | f_init_bssgp(); |
| 1152 | /* Initialize GPRS MS side */ |
| 1153 | f_init_gprs_ms(); |
| 1154 | |
| 1155 | /* Initialize the PCU interface abstraction */ |
| 1156 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1157 | |
| 1158 | /* Set maximum allowed DL CS to 3 */ |
| 1159 | g_cs_initial_dl := 1; |
| 1160 | g_cs_max_dl := 3; |
| 1161 | f_pcuvty_set_allowed_cs_mcs(); |
| 1162 | f_pcuvty_set_link_quality_ranges(); |
| 1163 | |
| 1164 | f_dl_data_exp_cs(f_rlcmac_block_int2cs_mcs(g_cs_max_dl, false)); |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 1165 | |
| 1166 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1167 | } |
| 1168 | |
| 1169 | /* Check DL CS4 is used in good link conditions if allowed by config */ |
| 1170 | testcase TC_dl_cs1_to_cs4() runs on RAW_PCU_Test_CT { |
| 1171 | /* Initialize NS/BSSGP side */ |
| 1172 | f_init_bssgp(); |
| 1173 | /* Initialize GPRS MS side */ |
| 1174 | f_init_gprs_ms(); |
| 1175 | |
| 1176 | /* Initialize the PCU interface abstraction */ |
| 1177 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1178 | |
| 1179 | /* Set initial DL CS to 1 & maximum allowed DL CS to 4 */ |
| 1180 | g_cs_initial_dl := 1; |
| 1181 | g_cs_max_dl := 4; |
| 1182 | f_pcuvty_set_allowed_cs_mcs(); |
| 1183 | f_pcuvty_set_link_quality_ranges(); |
| 1184 | |
| 1185 | f_dl_data_exp_cs(f_rlcmac_block_int2cs_mcs(g_cs_max_dl, false)); |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 1186 | |
| 1187 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1188 | } |
| 1189 | |
Pau Espin Pedrol | 2354d6a | 2020-11-05 18:36:59 +0100 | [diff] [blame] | 1190 | /* Test the initial UL MCS set by VTY works fine */ |
| 1191 | testcase TC_mcs_initial_ul() runs on RAW_PCU_Test_CT { |
| 1192 | var RlcmacDlBlock dl_block; |
| 1193 | var PollFnCtx pollctx; |
| 1194 | var EgprsChCodingCommand last_ch_coding; |
| 1195 | var uint32_t unused_fn, sched_fn; |
| 1196 | var GprsMS ms; |
| 1197 | var CodingScheme exp_ul_mcs; |
Pau Espin Pedrol | 2354d6a | 2020-11-05 18:36:59 +0100 | [diff] [blame] | 1198 | |
| 1199 | /* Initialize GPRS MS side */ |
| 1200 | f_init_gprs_ms(); |
| 1201 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1202 | |
| 1203 | /* Initialize the PCU interface abstraction */ |
| 1204 | f_init_raw(testcasename()); |
| 1205 | |
| 1206 | /* Set initial UL MCS to 3 */ |
| 1207 | g_mcs_initial_ul := 3; |
| 1208 | exp_ul_mcs := f_rlcmac_block_int2cs_mcs(g_mcs_initial_ul, true); |
| 1209 | f_pcuvty_set_allowed_cs_mcs(); |
| 1210 | f_pcuvty_set_link_quality_ranges(); |
| 1211 | |
| 1212 | /* Take lqual (dB->cB) so that we stay in that MCS */ |
| 1213 | ms.lqual_cb := g_mcs_lqual_ranges[2].low * 10; |
| 1214 | |
| 1215 | /* Send PACKET RESOURCE REQUEST to upgrade to EGPRS */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1216 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_egprs_def)); |
Pau Espin Pedrol | 2354d6a | 2020-11-05 18:36:59 +0100 | [diff] [blame] | 1217 | |
| 1218 | if (not match(ms.ul_tbf.tx_cs_mcs, exp_ul_mcs)) { |
| 1219 | setverdict(fail, "Wrong CS_MCS ", ms.ul_tbf.tx_cs_mcs, " received vs exp ", exp_ul_mcs); |
| 1220 | f_shutdown(__BFILE__, __LINE__); |
| 1221 | } |
| 1222 | |
| 1223 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 1224 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 1225 | |
| 1226 | /* Send UL blocks, until we receive UL ACK/NACK and check we are in same initial CS: */ |
| 1227 | while (true) { |
| 1228 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := 15); |
| 1229 | f_rx_rlcmac_dl_block(dl_block, unused_fn); |
Vadim Yanitskiy | 7179d3e | 2022-10-04 03:27:29 +0700 | [diff] [blame] | 1230 | if (match(dl_block, tr_RLCMAC_DL_DUMMY_CTRL())) { |
Pau Espin Pedrol | 2354d6a | 2020-11-05 18:36:59 +0100 | [diff] [blame] | 1231 | continue; |
| 1232 | } |
| 1233 | |
| 1234 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 1235 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 1236 | f_shutdown(__BFILE__, __LINE__); |
| 1237 | break; |
| 1238 | } |
| 1239 | |
| 1240 | last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.egprs.ch_coding_cmd; |
| 1241 | break; |
| 1242 | } |
| 1243 | if (f_rlcmac_block_EgprsChCodingCommand2cs_mcs(last_ch_coding) != exp_ul_mcs) { |
| 1244 | setverdict(fail, "Channel Coding does not match our expectations ", exp_ul_mcs, ": ", last_ch_coding); |
| 1245 | f_shutdown(__BFILE__, __LINE__); |
| 1246 | } |
| 1247 | |
| 1248 | /* Remaining UL blocks are used to make sure regardless of initial |
| 1249 | * lqual, we can go lower at any time |
| 1250 | * 0 dB, make sure we downgrade MCS */ |
| 1251 | ms.lqual_cb := 0; |
| 1252 | /* 5 UL blocks, check we are in same initial MCS: */ |
| 1253 | f_ms_tx_ul_data_block_multi(ms, 5); |
| 1254 | /* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */ |
| 1255 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 1256 | last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.egprs.ch_coding_cmd; |
| 1257 | |
| 1258 | if (last_ch_coding != CH_CODING_MCS1) { |
| 1259 | setverdict(fail, "Channel Coding does not match our expectations (MCS-1): ", last_ch_coding); |
| 1260 | f_shutdown(__BFILE__, __LINE__); |
| 1261 | } |
| 1262 | |
| 1263 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1264 | } |
| 1265 | |
Pau Espin Pedrol | db15fa7 | 2020-11-11 12:58:34 +0100 | [diff] [blame] | 1266 | /* Test the maximum UL MCS set by VTY works fine */ |
| 1267 | testcase TC_mcs_max_ul() runs on RAW_PCU_Test_CT { |
| 1268 | var RlcmacDlBlock dl_block; |
| 1269 | var EgprsChCodingCommand last_ch_coding; |
| 1270 | var PollFnCtx pollctx; |
| 1271 | var uint32_t unused_fn, sched_fn; |
| 1272 | var GprsMS ms; |
Pau Espin Pedrol | db15fa7 | 2020-11-11 12:58:34 +0100 | [diff] [blame] | 1273 | |
| 1274 | /* Initialize GPRS MS side */ |
| 1275 | f_init_gprs_ms(); |
| 1276 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1277 | |
| 1278 | /* Initialize the PCU interface abstraction */ |
| 1279 | f_init_raw(testcasename()); |
| 1280 | |
| 1281 | /* Set maximum allowed UL MCS to 5 */ |
| 1282 | g_mcs_max_ul := 5; |
| 1283 | f_pcuvty_set_allowed_cs_mcs(); |
| 1284 | f_pcuvty_set_link_quality_ranges(); |
| 1285 | |
| 1286 | /* Send PACKET RESOURCE REQUEST to upgrade to EGPRS */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1287 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_egprs_def)); |
Pau Espin Pedrol | db15fa7 | 2020-11-11 12:58:34 +0100 | [diff] [blame] | 1288 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 1289 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 1290 | |
| 1291 | ms.lqual_cb := 40*10; /* 40 dB */ |
| 1292 | f_ms_tx_ul_data_block_multi(ms, 16); |
| 1293 | |
| 1294 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 1295 | last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.egprs.ch_coding_cmd; |
| 1296 | |
| 1297 | if (last_ch_coding != CH_CODING_MCS5) { |
| 1298 | setverdict(fail, "Channel Coding does not match our expectations (MCS-5): ", last_ch_coding); |
| 1299 | f_shutdown(__BFILE__, __LINE__); |
| 1300 | } |
| 1301 | |
| 1302 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1303 | } |
| 1304 | |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 1305 | /* Test the initial DL CS set by VTY works fine */ |
| 1306 | testcase TC_mcs_initial_dl() runs on RAW_PCU_Test_CT { |
| 1307 | var octetstring data := f_rnd_octstring(10); |
| 1308 | var CodingScheme exp_dl_cs_mcs; |
| 1309 | var RlcmacDlBlock dl_block; |
| 1310 | var uint32_t poll_fn; |
| 1311 | var GprsMS ms; |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 1312 | |
| 1313 | /* Initialize NS/BSSGP side */ |
| 1314 | f_init_bssgp(); |
| 1315 | /* Initialize GPRS MS side */ |
| 1316 | f_init_gprs_ms(); |
| 1317 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1318 | |
| 1319 | /* Initialize the PCU interface abstraction */ |
| 1320 | f_init_raw(testcasename()); |
| 1321 | |
| 1322 | /* Set initial allowed DL MCS to 3 */ |
| 1323 | g_mcs_initial_dl := 3; |
| 1324 | exp_dl_cs_mcs := MCS_3; |
| 1325 | /* Set maximum allowed DL MCS to 4 */ |
| 1326 | g_mcs_max_dl := 4; |
| 1327 | f_pcuvty_set_allowed_cs_mcs(); |
| 1328 | f_pcuvty_set_link_quality_ranges(); |
| 1329 | |
| 1330 | /* Establish BSSGP connection to the PCU */ |
| 1331 | f_bssgp_establish(); |
| 1332 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1333 | |
| 1334 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1335 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, bssgp_ms_racap_egprs_def)); |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 1336 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1337 | |
| 1338 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1339 | f_sleep(X2002); |
| 1340 | f_rx_rlcmac_dl_block_exp_data(dl_block, poll_fn, data, 0, exp_dl_cs_mcs); |
| 1341 | |
| 1342 | /* ACK the DL block */ |
Pau Espin Pedrol | e8db673 | 2020-11-12 21:06:41 +0100 | [diff] [blame] | 1343 | f_dltbf_ack_block(ms.dl_tbf, dl_block, '1'B); |
| 1344 | f_ms_tx_ul_block(ms, f_dltbf_ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf, ischosen(dl_block.data_egprs)), |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 1345 | f_dl_block_ack_fn(dl_block, poll_fn)); |
| 1346 | |
| 1347 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1348 | } |
| 1349 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1350 | /* Verify DL MCS above "mcs max" set by VTY is never used */ |
| 1351 | testcase TC_mcs_max_dl() runs on RAW_PCU_Test_CT { |
| 1352 | /* Initialize NS/BSSGP side */ |
| 1353 | f_init_bssgp(); |
| 1354 | /* Initialize GPRS MS side */ |
| 1355 | f_init_gprs_ms(); |
| 1356 | |
| 1357 | /* Initialize the PCU interface abstraction */ |
| 1358 | f_init_raw(testcasename()); |
| 1359 | |
| 1360 | /* Set maximum allowed DL CS to 3 */ |
| 1361 | g_mcs_initial_dl := 1; |
| 1362 | g_mcs_max_dl := 3; |
| 1363 | f_pcuvty_set_allowed_cs_mcs(); |
| 1364 | f_pcuvty_set_link_quality_ranges(); |
| 1365 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1366 | f_dl_data_exp_cs(f_rlcmac_block_int2cs_mcs(g_mcs_max_dl, true), bssgp_ms_racap_egprs_def); |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 1367 | |
| 1368 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1369 | } |
| 1370 | |
Pau Espin Pedrol | 1451f9f | 2021-05-11 11:52:37 +0200 | [diff] [blame] | 1371 | /* Verify PCU drops TBF after some time of inactivity. */ |
| 1372 | testcase TC_t3141() runs on RAW_PCU_Test_CT { |
| 1373 | var PCUIF_info_ind info_ind; |
| 1374 | var template (value) TsTrxBtsNum nr; |
| 1375 | var BTS_PDTCH_Block data_msg; |
| 1376 | var GprsMS ms; |
| 1377 | var uint3_t rx_usf; |
| 1378 | timer T_3141 := 1.0; |
| 1379 | var boolean ul_tbf_usf_req := false; |
| 1380 | |
| 1381 | /* Initialize NS/BSSGP side */ |
| 1382 | f_init_bssgp(); |
| 1383 | /* Initialize GPRS MS side */ |
| 1384 | f_init_gprs_ms(); |
| 1385 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1386 | |
| 1387 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1388 | /* Only use 1 PDCH to simplify test: */ |
| 1389 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
| 1390 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 1391 | /* Initialize the PCU interface abstraction */ |
| 1392 | f_init_raw(testcasename(), info_ind); |
| 1393 | |
| 1394 | f_vty_config2(PCUVTY, {"pcu"}, "timer T3141 1"); |
| 1395 | |
| 1396 | /* Establish BSSGP connection to the PCU */ |
| 1397 | f_bssgp_establish(); |
| 1398 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1399 | |
| 1400 | /* Establish a one-phase access Uplink TBF */ |
| 1401 | f_ms_establish_ul_tbf(ms); |
| 1402 | |
| 1403 | T_3141.start; |
| 1404 | |
| 1405 | /* Now we wait for PCU to transmit our USF */ |
| 1406 | nr := ts_TsTrxBtsNum; |
| 1407 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1408 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1409 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1410 | block_nr := nr.blk_nr)); |
| 1411 | |
| 1412 | alt { |
| 1413 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1414 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1415 | ?)) -> value data_msg { |
| 1416 | if (ms.ul_tbf.usf[valueof(nr.ts_nr)] == USF_UNUSED) { |
| 1417 | setverdict(fail, "Unexpected ts_nr ", valueof(nr.ts_nr), " without USF allocated"); |
| 1418 | f_shutdown(__BFILE__, __LINE__); |
| 1419 | } |
| 1420 | |
| 1421 | rx_usf := f_rlcmac_dl_block_get_usf(data_msg.dl_block); |
| 1422 | if (rx_usf == ms.ul_tbf.usf[valueof(nr.ts_nr)]) { |
| 1423 | /* PCU requests our USF, transmit WITHOUT tlli to avoid contention resolution success */ |
| 1424 | ul_tbf_usf_req := true; |
| 1425 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := 15, with_tlli := false, fn := f_next_pdch_block(data_msg.raw.fn)) |
| 1426 | } else if (rx_usf == USF_UNUSED) { |
| 1427 | if (data_msg.raw.fn >= ms.ul_tbf.start_time_fn) { |
| 1428 | if (ul_tbf_usf_req) { |
| 1429 | /* TBF was dropped by T3141, success */ |
| 1430 | setverdict(pass); |
| 1431 | break; |
| 1432 | } else { |
| 1433 | log("PCU never requested USF, unexpected"); |
| 1434 | f_shutdown(__BFILE__, __LINE__); |
| 1435 | } |
| 1436 | } /* else: Keep waiting for TBF to be active by network */ |
| 1437 | } else { |
| 1438 | log("PCU requests ", rx_usf, ", we have ", ms.ul_tbf.usf[valueof(nr.ts_nr)]); |
| 1439 | f_shutdown(__BFILE__, __LINE__); |
| 1440 | } |
| 1441 | |
| 1442 | /* Make sure we don't receive a Ul ACK/NACK with TLLI set: */ |
| 1443 | if (match(data_msg.dl_block, |
| 1444 | tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, |
| 1445 | tr_UlAckNackGprs(tlli := ?, |
| 1446 | acknack_desc := ?, |
| 1447 | rel99 := *)))) |
| 1448 | { |
| 1449 | log("Received UL ACK/NACK with TLLI set"); |
| 1450 | f_shutdown(__BFILE__, __LINE__); |
| 1451 | } |
| 1452 | |
| 1453 | nr := ts_TsTrxBtsNum; |
| 1454 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1455 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1456 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1457 | block_nr := nr.blk_nr)); |
| 1458 | repeat; |
| 1459 | } |
Pau Espin Pedrol | e5fe6e7 | 2022-02-22 15:15:00 +0100 | [diff] [blame] | 1460 | [ul_tbf_usf_req] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1461 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1462 | omit)) { |
| 1463 | /* TBF was dropped by T3141, and PCU answered with an IDLE block to |
| 1464 | our last RTS.req because there's no longer any MS listening on |
| 1465 | the TS. */ |
| 1466 | setverdict(pass); |
| 1467 | break; |
| 1468 | } |
Pau Espin Pedrol | 1451f9f | 2021-05-11 11:52:37 +0200 | [diff] [blame] | 1469 | [] T_3141.timeout { |
| 1470 | log("T_3141 expired but TBF is still active, unexpected"); |
| 1471 | f_shutdown(__BFILE__, __LINE__); |
| 1472 | } |
| 1473 | [] BTS.receive { |
| 1474 | /* We should never receive non-dummy messages, aka UL ACK/NACK, |
| 1475 | * because we never sent the TLLI to the PCU */ |
| 1476 | setverdict(fail, "Unexpected BTS message"); |
| 1477 | f_shutdown(__BFILE__, __LINE__); |
| 1478 | } |
| 1479 | } |
| 1480 | |
| 1481 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1482 | } |
| 1483 | |
Pau Espin Pedrol | f30fa1d | 2021-03-03 19:55:11 +0100 | [diff] [blame] | 1484 | /* Validate what happens when RACH to get UL TBF and then PCU receives no UL |
| 1485 | * data. It should end up in N3101 reaching N3101_MAX and finally triggering |
| 1486 | * T3169. See OS#5033 */ |
| 1487 | testcase TC_n3101_max_t3169() runs on RAW_PCU_Test_CT { |
| 1488 | var PCUIF_info_ind info_ind; |
| 1489 | var template (value) TsTrxBtsNum nr; |
| 1490 | var BTS_PDTCH_Block data_msg; |
| 1491 | var GprsMS ms; |
| 1492 | var uint3_t rx_usf; |
| 1493 | const integer N3101_MAX := 9; /* N3101 shall be greater than 8 */ |
| 1494 | var integer n3101 := 0; |
| 1495 | timer T_3169 := 1.0; |
| 1496 | |
| 1497 | /* Initialize NS/BSSGP side */ |
| 1498 | f_init_bssgp(); |
| 1499 | /* Initialize GPRS MS side */ |
| 1500 | f_init_gprs_ms(); |
| 1501 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1502 | |
| 1503 | /* Initialize the PCU interface abstraction */ |
| 1504 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1505 | info_ind.n3101 := N3101_MAX; |
| 1506 | info_ind.t3169 := 1; |
| 1507 | f_init_raw(testcasename(), info_ind); |
| 1508 | |
| 1509 | /* Establish BSSGP connection to the PCU */ |
| 1510 | f_bssgp_establish(); |
| 1511 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1512 | |
| 1513 | /* Establish UL TBF */ |
| 1514 | f_ms_establish_ul_tbf(ms); |
| 1515 | |
| 1516 | /* Now we wait for PCU to transmit our USF */ |
| 1517 | nr := ts_TsTrxBtsNum; |
| 1518 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1519 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1520 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1521 | block_nr := nr.blk_nr)); |
| 1522 | |
| 1523 | alt { |
| 1524 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1525 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1526 | ?)) -> value data_msg { |
| 1527 | if (ms.ul_tbf.usf[valueof(nr.ts_nr)] == USF_UNUSED) { |
| 1528 | setverdict(fail, "Unexpected ts_nr ", valueof(nr.ts_nr), " without USF allocated"); |
| 1529 | f_shutdown(__BFILE__, __LINE__); |
| 1530 | } |
| 1531 | |
| 1532 | rx_usf := f_rlcmac_dl_block_get_usf(data_msg.dl_block); |
| 1533 | if (rx_usf == ms.ul_tbf.usf[valueof(nr.ts_nr)]) { |
| 1534 | log("PCU requests our USF ", rx_usf, ", n3101=", n3101); |
| 1535 | n3101 := n3101 + 1; |
Pau Espin Pedrol | 73c5d37 | 2021-03-24 18:48:24 +0100 | [diff] [blame] | 1536 | if (n3101 > N3101_MAX + 1) { //+1: DL<->UL FN offset |
| 1537 | setverdict(fail, "Reached ", n3101, " > ", N3101_MAX + 1, " (N3101_MAX+1) and PCU still sends us USFs"); |
Pau Espin Pedrol | f30fa1d | 2021-03-03 19:55:11 +0100 | [diff] [blame] | 1538 | f_shutdown(__BFILE__, __LINE__); |
| 1539 | } |
Pau Espin Pedrol | 73c5d37 | 2021-03-24 18:48:24 +0100 | [diff] [blame] | 1540 | } else if (rx_usf == USF_UNUSED and n3101 == N3101_MAX + 1) { |
Pau Espin Pedrol | f30fa1d | 2021-03-03 19:55:11 +0100 | [diff] [blame] | 1541 | /* If we already received USFs for us and we don't receive them anymore, that means the TBF entered T3169 */ |
| 1542 | log("PCU stopped requesting USF ", ms.ul_tbf.usf[valueof(nr.ts_nr)]); |
| 1543 | if (not T_3169.running) { |
| 1544 | log("T3169 started"); |
| 1545 | T_3169.start; |
| 1546 | } |
| 1547 | } else if(rx_usf == USF_UNUSED and n3101 > 0) { |
| 1548 | setverdict(fail, "PCU stopped requesting USFs too early: ", n3101, " < ", N3101_MAX, " (N3101_MAX)"); |
| 1549 | f_shutdown(__BFILE__, __LINE__); |
| 1550 | } else { |
| 1551 | log("PCU requests ", rx_usf, ", we have ", ms.ul_tbf.usf[valueof(nr.ts_nr)]); |
| 1552 | } |
| 1553 | nr := ts_TsTrxBtsNum; |
| 1554 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1555 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1556 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1557 | block_nr := nr.blk_nr)); |
| 1558 | repeat; |
| 1559 | } |
Pau Espin Pedrol | 907ba20 | 2021-11-12 17:25:24 +0100 | [diff] [blame] | 1560 | /* We may already receive empty (idle) blocks before our own TTCN3 timer |
| 1561 | * triggers due to the TBF being released. Keep going until our T_3169 triggers. */ |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 1562 | [n3101 == N3101_MAX + 1] as_pcuif_rx_ignore_empty(nr); |
Pau Espin Pedrol | f30fa1d | 2021-03-03 19:55:11 +0100 | [diff] [blame] | 1563 | [] T_3169.timeout { |
| 1564 | log("T_3169 expired"); |
| 1565 | /* Done in alt */ |
| 1566 | } |
| 1567 | [] BTS.receive { |
| 1568 | setverdict(fail, "Unexpected BTS message"); |
| 1569 | f_shutdown(__BFILE__, __LINE__); |
| 1570 | } |
| 1571 | } |
| 1572 | |
| 1573 | /* Now that T3169 has expired, establishing a Ul TBF should provide same |
| 1574 | /* USFs as per previous TBF since they were freed at expiration time: */ |
| 1575 | var uint3_t old_usf[8] := ms.ul_tbf.usf; |
| 1576 | var uint5_t old_tfi := ms.ul_tbf.tfi; |
| 1577 | f_ms_establish_ul_tbf(ms); |
| 1578 | if (old_tfi != ms.ul_tbf.tfi) { |
| 1579 | setverdict(fail, "Unexpected TFI change: ", ms.ul_tbf.tfi, " vs exp ", old_tfi); |
| 1580 | f_shutdown(__BFILE__, __LINE__); |
| 1581 | } |
| 1582 | for (var integer i := 0; i < 8; i := i +1) { |
| 1583 | if (ms.ul_tbf.usf[i] != old_usf[i]) { |
| 1584 | setverdict(fail, "Unexpected USF change: ", ms.ul_tbf.usf[i], " vs exp ", old_usf[i]); |
| 1585 | f_shutdown(__BFILE__, __LINE__); |
| 1586 | } |
| 1587 | } |
| 1588 | |
| 1589 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1590 | } |
| 1591 | |
Pau Espin Pedrol | cc895df | 2021-04-20 12:58:32 +0200 | [diff] [blame] | 1592 | |
| 1593 | /* Verify after N3103_MAX is reached, T3169 is started and upon timeout TBF is |
| 1594 | freed and no longer available. Trigger it by sending a few UL blocks CTRL ACKING |
| 1595 | the final UL ACK sent at us. */ |
| 1596 | testcase TC_n3103_max_t3169() runs on RAW_PCU_Test_CT { |
| 1597 | var PCUIF_info_ind info_ind; |
| 1598 | var BTS_PDTCH_Block data_msg; |
| 1599 | var RlcmacDlBlock dl_block; |
| 1600 | var uint32_t sched_fn; |
| 1601 | var template (value) TsTrxBtsNum nr; |
| 1602 | var template RlcmacDlBlock exp_ul_ack; |
| 1603 | var template UlAckNackGprs exp_ul_ack_sub; |
| 1604 | var GprsMS ms; |
| 1605 | const integer N3103_MAX := 2; /* N3103 is usually somewhere 2-5 */ |
| 1606 | var integer N3103 := 0; |
| 1607 | timer T_3169 := 1.0; |
| 1608 | |
| 1609 | /* Initialize GPRS MS side */ |
| 1610 | f_init_gprs_ms(); |
| 1611 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1612 | |
| 1613 | /* Initialize the PCU interface abstraction */ |
| 1614 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1615 | info_ind.n3103 := N3103_MAX; |
| 1616 | info_ind.t3169 := 1; |
| 1617 | f_init_raw(testcasename(), info_ind); |
| 1618 | |
| 1619 | /* Establish an Uplink TBF */ |
| 1620 | f_ms_establish_ul_tbf(ms); |
| 1621 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 1622 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 1623 | f_ms_wait_usf(ms); |
| 1624 | |
Pau Espin Pedrol | 93ae452 | 2021-05-11 15:58:26 +0200 | [diff] [blame] | 1625 | f_ms_tx_ul_data_block_multi(ms, 5, with_tlli := true); |
Pau Espin Pedrol | cc895df | 2021-04-20 12:58:32 +0200 | [diff] [blame] | 1626 | exp_ul_ack_sub := tr_UlAckNackGprs(*, tr_AckNackDescription('1'B), *); |
| 1627 | exp_ul_ack := tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, exp_ul_ack_sub); |
| 1628 | |
| 1629 | nr := ts_TsTrxBtsNum; |
| 1630 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1631 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1632 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1633 | block_nr := nr.blk_nr)); |
| 1634 | alt { |
| 1635 | [N3103 < N3103_MAX] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1636 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1637 | exp_ul_ack)) -> value data_msg { |
| 1638 | if (not f_dl_block_rrbp_valid(data_msg.dl_block)) { |
| 1639 | setverdict(fail, "Unexpected DL BLOCK has no RRBP: ", data_msg.dl_block); |
| 1640 | f_shutdown(__BFILE__, __LINE__); |
| 1641 | } |
| 1642 | |
| 1643 | nr := ts_TsTrxBtsNum; |
| 1644 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1645 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1646 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1647 | block_nr := nr.blk_nr)); |
| 1648 | N3103 := N3103 + 1; |
| 1649 | if (N3103 == N3103_MAX) { |
| 1650 | /* At this point in time (N3103_MAX reached), PCU is |
| 1651 | * moving the TBF to RELEASE state so no data/ctrl for |
| 1652 | * it is tx'ed, hence the dummy blocks: */ |
| 1653 | T_3169.start; |
| 1654 | } |
| 1655 | repeat; |
| 1656 | } |
| 1657 | [N3103 >= N3103_MAX] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1658 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1659 | exp_ul_ack)) -> value data_msg { |
| 1660 | setverdict(fail, "Unexpected UL ACK/NACK after reaching N3103_MAX"); |
| 1661 | f_shutdown(__BFILE__, __LINE__); |
| 1662 | } |
| 1663 | [] as_ms_rx_ignore_dummy(ms, nr); |
Pau Espin Pedrol | 907ba20 | 2021-11-12 17:25:24 +0100 | [diff] [blame] | 1664 | [] as_pcuif_rx_ignore_empty(nr); |
Pau Espin Pedrol | cc895df | 2021-04-20 12:58:32 +0200 | [diff] [blame] | 1665 | [T_3169.running] T_3169.timeout { |
| 1666 | log("T_3169 timeout"); |
| 1667 | /* Done in alt, wait for pending RTS initiated previously in |
| 1668 | * above case before continuing (expect /* Dummy block): */ |
| 1669 | BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1670 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
Vadim Yanitskiy | 7179d3e | 2022-10-04 03:27:29 +0700 | [diff] [blame] | 1671 | tr_RLCMAC_DL_DUMMY_CTRL)); |
Pau Espin Pedrol | cc895df | 2021-04-20 12:58:32 +0200 | [diff] [blame] | 1672 | } |
| 1673 | [] BTS.receive { |
| 1674 | setverdict(fail, "Unexpected BTS message"); |
| 1675 | f_shutdown(__BFILE__, __LINE__); |
| 1676 | } |
| 1677 | } |
| 1678 | |
| 1679 | /* Now that T3169 has expired, establishing a Ul TBF should provide same |
| 1680 | * USFs as per previous TBF since they were freed at expiration time: */ |
| 1681 | var uint3_t old_usf[8] := ms.ul_tbf.usf; |
| 1682 | var uint5_t old_tfi := ms.ul_tbf.tfi; |
| 1683 | f_ms_establish_ul_tbf(ms); |
| 1684 | if (old_tfi != ms.ul_tbf.tfi) { |
| 1685 | setverdict(fail, "Unexpected TFI change: ", ms.ul_tbf.tfi, " vs exp ", old_tfi); |
| 1686 | f_shutdown(__BFILE__, __LINE__); |
| 1687 | } |
| 1688 | for (var integer i := 0; i < 8; i := i +1) { |
| 1689 | if (ms.ul_tbf.usf[i] != old_usf[i]) { |
| 1690 | setverdict(fail, "Unexpected USF change: ", ms.ul_tbf.usf[i], " vs exp ", old_usf[i]); |
| 1691 | f_shutdown(__BFILE__, __LINE__); |
| 1692 | } |
| 1693 | } |
| 1694 | |
| 1695 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1696 | } |
| 1697 | |
Pau Espin Pedrol | 84a8c3c | 2021-03-01 17:22:29 +0100 | [diff] [blame] | 1698 | /* Verify that a Downlink TBF is kept available until T3191 fires, at which |
| 1699 | * point the TBF is no longer available. In order to get to start of T3191, we |
| 1700 | * have to wait for x2031 since that marks the IDLE TBF time, that is, the delay |
| 1701 | * until TBF release procedure starts after draining DL queue. */ |
| 1702 | testcase TC_x2031_t3191() runs on RAW_PCU_Test_CT { |
| 1703 | var PCUIF_info_ind info_ind; |
| 1704 | var RlcmacDlBlock dl_block; |
| 1705 | var octetstring data1 := f_rnd_octstring(200); |
| 1706 | var octetstring data2 := f_rnd_octstring(10); |
| 1707 | var uint32_t dl_fn; |
| 1708 | var template (value) TsTrxBtsNum nr; |
| 1709 | var BTS_PDTCH_Block data_msg; |
| 1710 | var GprsMS ms; |
| 1711 | |
| 1712 | /* Initialize NS/BSSGP side */ |
| 1713 | f_init_bssgp(); |
| 1714 | /* Initialize GPRS MS side */ |
| 1715 | f_init_gprs_ms(); |
| 1716 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1717 | |
| 1718 | /* Initialize the PCU interface abstraction */ |
| 1719 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1720 | /* Set timer to 1 sec (default 5) to speedup test: */ |
| 1721 | info_ind.t3191 := 1; |
| 1722 | f_init_raw(testcasename(), info_ind); |
| 1723 | |
| 1724 | /* Establish BSSGP connection to the PCU */ |
| 1725 | f_bssgp_establish(); |
| 1726 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1727 | |
| 1728 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 1729 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1)); |
| 1730 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1731 | |
| 1732 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1733 | f_sleep(X2002); |
| 1734 | |
| 1735 | while (true) { |
| 1736 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, ?, ?); |
| 1737 | |
| 1738 | /* Keep Ack/Nack description updated (except for last BSN) */ |
| 1739 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
| 1740 | |
| 1741 | if (f_dl_block_rrbp_valid(dl_block)) { |
| 1742 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1743 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 1744 | break; |
| 1745 | } |
| 1746 | } |
| 1747 | |
| 1748 | /* Now we wait for IDLE TBF timer (X2031) to time out and receive a FINAL ACK */ |
| 1749 | nr := ts_TsTrxBtsNum; |
| 1750 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1751 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1752 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1753 | block_nr := nr.blk_nr)); |
| 1754 | alt { |
| 1755 | [] as_ms_rx_ignore_dummy(ms, nr); |
| 1756 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1757 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1758 | ?)) -> value data_msg { |
| 1759 | if (data_msg.dl_block.data.mac_hdr.hdr_ext.fbi) { |
| 1760 | log("Received FINAL_ACK"); |
| 1761 | ms.dl_tbf.acknack_desc.final_ack := '1'B; |
| 1762 | break; |
| 1763 | } |
| 1764 | if (f_dl_block_rrbp_valid(data_msg.dl_block)) { |
| 1765 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, data_msg.dl_block); |
| 1766 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1767 | f_dl_block_ack_fn(dl_block, data_msg.raw.fn)); |
| 1768 | } |
| 1769 | nr := ts_TsTrxBtsNum; |
| 1770 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1771 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1772 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1773 | block_nr := nr.blk_nr)); |
| 1774 | repeat; |
| 1775 | } |
| 1776 | [] BTS.receive { |
| 1777 | setverdict(fail, "Unexpected BTS message"); |
| 1778 | f_shutdown(__BFILE__, __LINE__); |
| 1779 | } |
| 1780 | } |
| 1781 | |
| 1782 | /* Avoid ACKing the last RLC data block on purpose here, wait for t3191 |
| 1783 | to time out. We simply sleep instead of requesting blocks because |
| 1784 | otherwise retransmissions would keep restarting the timer. */ |
| 1785 | f_sleep(int2float(info_ind.t3191)); |
| 1786 | |
| 1787 | /* The TBF should be freed now, so new data should trigger an Assignment: */ |
| 1788 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data2)); |
| 1789 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1790 | |
| 1791 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1792 | f_sleep(X2002); |
| 1793 | /* Now that we confirmed the new assignment in the dl-tbf, lets receive the data and ack it */ |
| 1794 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data2, 0); |
| 1795 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1796 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1797 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 1798 | |
| 1799 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1800 | } |
| 1801 | |
| 1802 | /* Same as TC_zero_x2031_t3191, but this time without x2031 (immediate FINAL_ACK). */ |
| 1803 | testcase TC_zero_x2031_t3191() runs on RAW_PCU_Test_CT { |
| 1804 | var PCUIF_info_ind info_ind; |
| 1805 | var RlcmacDlBlock dl_block; |
| 1806 | var octetstring data1 := f_rnd_octstring(1400); |
| 1807 | var octetstring data2 := f_rnd_octstring(10); |
| 1808 | var uint32_t dl_fn; |
| 1809 | var GprsMS ms; |
| 1810 | |
| 1811 | /* Initialize NS/BSSGP side */ |
| 1812 | f_init_bssgp(); |
| 1813 | /* Initialize GPRS MS side */ |
| 1814 | f_init_gprs_ms(); |
| 1815 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1816 | |
| 1817 | /* Initialize the PCU interface abstraction */ |
| 1818 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1819 | /* Set timer to 1 sec (default 5) to speedup test: */ |
| 1820 | info_ind.t3191 := 1; |
| 1821 | f_init_raw(testcasename(), info_ind); |
| 1822 | |
| 1823 | f_vty_config2(PCUVTY, {"pcu"}, "timer X2031 0"); |
| 1824 | |
| 1825 | /* Establish BSSGP connection to the PCU */ |
| 1826 | f_bssgp_establish(); |
| 1827 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1828 | |
| 1829 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 1830 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1)); |
| 1831 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1832 | |
| 1833 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1834 | f_sleep(X2002); |
| 1835 | |
| 1836 | /* Send enough DL data to at least be able to DL ACK once (excl the |
| 1837 | * FINAL_ACK one), so that PCU sees we are listening in PDCH and avoids |
| 1838 | * other code paths like trying to Imm Assign on CCCH again, etc.. */ |
| 1839 | while (true) { |
| 1840 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, ?, ?); |
| 1841 | |
| 1842 | if (dl_block.data.mac_hdr.hdr_ext.fbi) { |
| 1843 | log("Received FINAL_ACK"); |
| 1844 | ms.dl_tbf.acknack_desc.final_ack := '1'B; |
| 1845 | break; |
| 1846 | } |
| 1847 | |
| 1848 | /* Keep Ack/Nack description updated (except for last BSN) */ |
| 1849 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
| 1850 | |
| 1851 | if (f_dl_block_rrbp_valid(dl_block)) { |
| 1852 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1853 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 1854 | } |
| 1855 | } |
| 1856 | |
| 1857 | /* Avoid ACKing the last RLC data block on purpose here, wait for t3191 |
| 1858 | to time out. We simply sleep instead of requesting blocks because |
| 1859 | otherwise retransmissions would keep restarting the timer. */ |
| 1860 | f_sleep(int2float(info_ind.t3191)); |
| 1861 | |
| 1862 | /* The TBF should be freed now, so new data should trigger an Assignment: */ |
| 1863 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data2)); |
| 1864 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1865 | |
| 1866 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1867 | f_sleep(X2002); |
| 1868 | /* Now that we confirmed the new assignment in the dl-tbf, lets receive the data and ack it */ |
| 1869 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data2, 0); |
| 1870 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1871 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1872 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 1873 | |
| 1874 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1875 | } |
| 1876 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1877 | /* Verify that a Downlink TBF can be assigned using PACCH shortly after the |
| 1878 | * release of prev DL TBF due to MS staying in PDCH for a while (T3192, in PCU |
| 1879 | * T3193) after DL TBF release */ |
| 1880 | testcase TC_t3193() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1881 | var RlcmacDlBlock dl_block; |
| 1882 | var octetstring data := f_rnd_octstring(10); |
| 1883 | var boolean ok; |
| 1884 | var uint32_t sched_fn; |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1885 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1886 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1887 | var AckNackDescription ack_nack_desc := valueof(t_AckNackDescription_init); |
| 1888 | |
| 1889 | /* Initialize NS/BSSGP side */ |
| 1890 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1891 | /* Initialize GPRS MS side */ |
| 1892 | f_init_gprs_ms(); |
| 1893 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1894 | |
| 1895 | /* Initialize the PCU interface abstraction */ |
| 1896 | f_init_raw(testcasename()); |
| 1897 | |
Pau Espin Pedrol | 1c6a9e4 | 2023-06-20 11:54:56 +0200 | [diff] [blame] | 1898 | /* Disable "idle DL TBF alive" timer, to make the test easier and avoid |
| 1899 | * having to keep receiving dummy LLC blocks for a while until the last |
| 1900 | * block with FBI=1 is set. This way the first and only DL block is already |
| 1901 | * the FBI one. */ |
| 1902 | f_vty_config2(PCUVTY, {"pcu"}, "timer X2031 0"); |
| 1903 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1904 | /* Establish BSSGP connection to the PCU */ |
| 1905 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 1906 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1907 | |
| 1908 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1909 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 1910 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Vadim Yanitskiy | 2e213ae | 2020-05-06 22:26:17 +0700 | [diff] [blame] | 1911 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1912 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1913 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1914 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
Pau Espin Pedrol | 1c6a9e4 | 2023-06-20 11:54:56 +0200 | [diff] [blame] | 1915 | if (dl_block.data.mac_hdr.hdr_ext.fbi == false) { |
| 1916 | setverdict(fail, "Expected DL data block with FBI=1 but got FBI=0"); |
| 1917 | f_shutdown(__BFILE__, __LINE__); |
| 1918 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1919 | |
| 1920 | /* ACK the DL block */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1921 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1922 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1923 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1924 | |
| 1925 | /* Now that final DL block is ACKED and TBF is released, T3193 in PCU |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1926 | (T3192 in MS) was started and until it fires the MS will be available |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1927 | on PDCH in case new data arrives from SGSN. Let's verify it: */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1928 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
Vadim Yanitskiy | 7431e9e | 2020-07-21 01:59:17 +0700 | [diff] [blame] | 1929 | f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1930 | |
| 1931 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1932 | |
| 1933 | /* Now that we confirmed the new assignment in the dl-tbf, lets receive the data and ack it */ |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1934 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1935 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1936 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1937 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 1938 | |
| 1939 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1940 | } |
| 1941 | |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 1942 | /* Verify after N3105_MAX is reached, T3195 is started and upon timeout TBF is |
| 1943 | freed and no longer available. Trigger it by sending DL blocks and never DL |
| 1944 | ACKing the data (which are requested through RRBP) */ |
| 1945 | testcase TC_n3105_max_t3195() runs on RAW_PCU_Test_CT { |
| 1946 | var PCUIF_info_ind info_ind; |
| 1947 | var RlcmacDlBlock dl_block; |
| 1948 | var octetstring data1 := f_rnd_octstring(1000); |
| 1949 | var octetstring data2 := f_rnd_octstring(10); |
| 1950 | var uint32_t dl_fn; |
| 1951 | var template (value) TsTrxBtsNum nr; |
| 1952 | var BTS_PDTCH_Block data_msg; |
| 1953 | var GprsMS ms; |
| 1954 | const integer N3105_MAX := 2; |
| 1955 | var integer N3105 := 0; |
| 1956 | timer T_3195 := 1.0; |
| 1957 | var integer num_poll_recv := 0; |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 1958 | var template RlcmacDlBlock dl_block_exp; |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 1959 | |
| 1960 | /* Initialize NS/BSSGP side */ |
| 1961 | f_init_bssgp(); |
| 1962 | /* Initialize GPRS MS side */ |
| 1963 | f_init_gprs_ms(); |
| 1964 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1965 | |
| 1966 | /* Initialize the PCU interface abstraction */ |
| 1967 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1968 | /* Speedup test: */ |
| 1969 | info_ind.n3105 := N3105_MAX; |
| 1970 | info_ind.t3195 := 1; |
| 1971 | f_init_raw(testcasename(), info_ind); |
| 1972 | |
| 1973 | /* Disable "MS delay release" timer, to avoid old DL data kept in cached |
| 1974 | * MS and retransmitted after the TBF is released and later on created |
| 1975 | * (because the MS is reused) */ |
| 1976 | f_vty_config2(PCUVTY, {"pcu"}, "timer X2030 0"); |
| 1977 | |
| 1978 | /* Establish BSSGP connection to the PCU */ |
| 1979 | f_bssgp_establish(); |
| 1980 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1981 | |
| 1982 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 1983 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1)); |
| 1984 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1985 | |
| 1986 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1987 | f_sleep(X2002); |
| 1988 | |
| 1989 | /* Now we go on receiving DL data and not answering RRBP: */ |
| 1990 | nr := ts_TsTrxBtsNum; |
| 1991 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1992 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1993 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1994 | block_nr := nr.blk_nr)); |
| 1995 | alt { |
| 1996 | [not T_3195.running] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1997 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1998 | tr_RLCMAC_DATA)) -> value data_msg { |
| 1999 | if (f_dl_block_rrbp_valid(data_msg.dl_block)) { |
| 2000 | if (num_poll_recv == 0) { |
| 2001 | /* ACK first one so PCU detects we are there and doesn't retransmit Imm Ass */ |
| 2002 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, data_msg.dl_block); |
| 2003 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 2004 | f_dl_block_ack_fn(data_msg.dl_block, data_msg.raw.fn)); |
| 2005 | } else { |
| 2006 | log("Ignoring RRBP ", num_poll_recv); |
| 2007 | N3105 := N3105 + 1; |
| 2008 | } |
| 2009 | num_poll_recv := num_poll_recv + 1; |
| 2010 | } |
| 2011 | |
| 2012 | nr := ts_TsTrxBtsNum; |
| 2013 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 2014 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 2015 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 2016 | block_nr := nr.blk_nr)); |
| 2017 | repeat; |
| 2018 | } |
| 2019 | /* At this point in time (N3105_MAX reached), PCU already moved TBF to |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 2020 | * RELEASE state so no data for it is tx'ed, hence the dummy/idle blocks: |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 2021 | */ |
| 2022 | [N3105 == N3105_MAX] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 2023 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
Vadim Yanitskiy | 7179d3e | 2022-10-04 03:27:29 +0700 | [diff] [blame] | 2024 | tr_RLCMAC_DL_DUMMY_CTRL)) -> value data_msg { |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 2025 | if (not T_3195.running) { |
| 2026 | T_3195.start; |
| 2027 | /* We even send some new data, nothing should be sent to MS */ |
| 2028 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1)); |
| 2029 | } |
| 2030 | nr := ts_TsTrxBtsNum; |
| 2031 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 2032 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 2033 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 2034 | block_nr := nr.blk_nr)); |
| 2035 | repeat; |
| 2036 | } |
Pau Espin Pedrol | 518e82f | 2021-11-12 17:24:33 +0100 | [diff] [blame] | 2037 | /* We may already receive idle blocks before our own TTCN3 timer |
| 2038 | * triggers due to the TBF being released. Keep going until our T_3195 triggers. */ |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 2039 | [N3105 == N3105_MAX] as_pcuif_rx_ignore_empty(nr); |
Pau Espin Pedrol | bf8c71f | 2021-04-20 12:23:28 +0200 | [diff] [blame] | 2040 | [T_3195.running] T_3195.timeout { |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 2041 | log("T_3195 timeout"); |
Pau Espin Pedrol | bf8c71f | 2021-04-20 12:23:28 +0200 | [diff] [blame] | 2042 | /* Done in alt, wait for pending RTS initiated previously in |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 2043 | * above case before continuing (expect empty block): */ |
| 2044 | dl_block_exp := omit; |
Pau Espin Pedrol | bf8c71f | 2021-04-20 12:23:28 +0200 | [diff] [blame] | 2045 | BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 2046 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 2047 | dl_block_exp)); |
| 2048 | } |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 2049 | [] BTS.receive { |
| 2050 | setverdict(fail, "Unexpected BTS message"); |
| 2051 | f_shutdown(__BFILE__, __LINE__); |
| 2052 | } |
| 2053 | } |
| 2054 | |
| 2055 | /* after T_3195 timeout, TBF is released */ |
| 2056 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data2)); |
| 2057 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 2058 | |
| 2059 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2060 | f_sleep(X2002); |
| 2061 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data2, 0); |
| 2062 | |
| 2063 | /* ACK the DL block */ |
| 2064 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 2065 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 2066 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 2067 | |
| 2068 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2069 | } |
| 2070 | |
Pau Espin Pedrol | e8a9444 | 2021-11-15 17:05:46 +0100 | [diff] [blame] | 2071 | /* Verify configured T3172 is properly transmitted as WAIT_INDICATION in Pkt Access Reject in PACCH. */ |
| 2072 | function f_TC_t3172(integer t3172_ms, BIT1 wait_ind_size) runs on RAW_PCU_Test_CT { |
| 2073 | var PCUIF_info_ind info_ind; |
| 2074 | var template IARRestOctets rest; |
| 2075 | var BIT11 ra11; |
| 2076 | var GprsMS ms; |
| 2077 | var octetstring data := f_rnd_octstring(10); |
| 2078 | var RlcmacDlBlock dl_block; |
| 2079 | var template RlcmacDlBlock rej_tmpl; |
| 2080 | var uint32_t dl_fn; |
| 2081 | var uint32_t sched_fn; |
| 2082 | var uint8_t wait_ind_val; |
| 2083 | |
| 2084 | /* Initialize NS/BSSGP side */ |
| 2085 | f_init_bssgp(); |
| 2086 | /* Initialize GPRS MS side */ |
| 2087 | f_init_gprs_ms(); |
| 2088 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2089 | |
| 2090 | info_ind := valueof(ts_PCUIF_INFO_default); |
| 2091 | |
| 2092 | /* Only the first TRX is enabled. */ |
| 2093 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 2094 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
| 2095 | |
| 2096 | /* Initialize the PCU interface abstraction */ |
| 2097 | f_init_raw(testcasename(), info_ind); |
| 2098 | |
| 2099 | f_pcuvty_set_timer(3172, t3172_ms); |
| 2100 | |
| 2101 | /* Establish BSSGP connection to the PCU */ |
| 2102 | f_bssgp_establish(); |
| 2103 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 2104 | |
| 2105 | var EGPRSPktChRequest req := { |
| 2106 | one_phase := { |
| 2107 | tag := '0'B, |
| 2108 | multislot_class := '10101'B, |
| 2109 | priority := '01'B, |
| 2110 | random_bits := '101'B |
| 2111 | } |
| 2112 | }; |
| 2113 | |
| 2114 | /* We send 7 requests, the IUT gives us all available USFs (0..6) */ |
| 2115 | for (var integer i := 0; i < 7; i := i + 1) { |
| 2116 | req.one_phase.random_bits := int2bit(f_rnd_int(8), 3); |
| 2117 | f_TC_egprs_pkt_chan_req(req, tr_IMM_TBF_ASS); |
| 2118 | } |
| 2119 | |
| 2120 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 2121 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 2122 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 2123 | |
| 2124 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2125 | f_sleep(X2002); |
| 2126 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 2127 | |
| 2128 | /* ACK the DL block */ |
| 2129 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 2130 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc, false, ts_ChannelReqDescription()), |
| 2131 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 2132 | |
| 2133 | /* Since all USF are taken, we should receive a Reject: */ |
| 2134 | |
| 2135 | if (wait_ind_size == '0'B) { |
| 2136 | wait_ind_val := t3172_ms / 1000; |
| 2137 | } else { |
| 2138 | wait_ind_val := t3172_ms / 20; |
| 2139 | } |
| 2140 | rej_tmpl := tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_ACC_REJ( |
| 2141 | tr_PacketAccessRejectStruct_TLLI(ms.tlli, |
| 2142 | wait_ind_val, |
| 2143 | wait_ind_size))); |
| 2144 | template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum; |
| 2145 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 2146 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 2147 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 2148 | block_nr := nr.blk_nr)); |
| 2149 | alt { |
| 2150 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 2151 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 2152 | rej_tmpl)); |
| 2153 | [] BTS.receive { |
| 2154 | setverdict(fail, "Unexpected BTS message"); |
| 2155 | f_shutdown(__BFILE__, __LINE__); |
| 2156 | } |
| 2157 | } |
| 2158 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2159 | } |
| 2160 | testcase TC_t3172_wait_ind_size0() runs on RAW_PCU_Test_CT { |
| 2161 | /* size=0 means value is provided in seconds. Due to value being 8 |
| 2162 | * bit, in the 20ms step case (size=1) the maximum value possible is 20 * 255 |
| 2163 | * = 5100. Hence, values above it should use size=0 to be able to |
| 2164 | * provide values in range. Let's use 6 seconds, 6000ms |
| 2165 | */ |
| 2166 | f_TC_t3172(6000, '0'B); |
| 2167 | } |
| 2168 | testcase TC_t3172_wait_ind_size1() runs on RAW_PCU_Test_CT { |
| 2169 | f_TC_t3172(3000, '1'B); |
| 2170 | } |
| 2171 | |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2172 | /* Verify PCU handles correctly Countdown Procedure based on BS_CV_MAX */ |
| 2173 | testcase TC_countdown_procedure() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2174 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2175 | var uint32_t sched_fn; |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2176 | var octetstring total_payload; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2177 | var GprsMS ms; |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2178 | |
| 2179 | /* Initialize NS/BSSGP side */ |
| 2180 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2181 | /* Initialize GPRS MS side */ |
| 2182 | f_init_gprs_ms(); |
| 2183 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2184 | |
| 2185 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2186 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2187 | |
| 2188 | /* Establish BSSGP connection to the PCU */ |
| 2189 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2190 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2191 | |
| 2192 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2193 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2194 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 2195 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 2196 | f_ms_wait_usf(ms); |
| 2197 | |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2198 | /* Send one UL block (with TLLI since we are in One-Phase Access |
Pau Espin Pedrol | 15b2b94 | 2022-10-28 15:08:44 +0200 | [diff] [blame] | 2199 | contention resolution) and make sure it is ACKED fine. */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2200 | total_payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true)); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2201 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 2202 | f_ms_tx_ul_data_block(ms, total_payload, cv := 15, with_tlli := true, fn := ms.ul_tbf.start_time_fn) |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2203 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2204 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2205 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2206 | |
| 2207 | /* Send enough blocks to test whole procedure: Until Nth block |
| 2208 | (N=BS_CV_MAX), CV=15 is sent, and then the decreasing countdown value is sent. |
| 2209 | */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2210 | total_payload := total_payload & f_ms_tx_ul_data_block_multi(ms, 20); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2211 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2212 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2213 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2214 | |
| 2215 | /* receive one message on BSSGP with all aggregated data in payload: */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2216 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id, total_payload)); |
Vadim Yanitskiy | 8e6df0c | 2020-10-18 00:13:15 +0700 | [diff] [blame] | 2217 | |
| 2218 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2219 | } |
| 2220 | |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2221 | /* Verify PCU handles correctly CS1..4 with all possible LLC payload sizes fitting alone in one RLC block */ |
| 2222 | testcase TC_ul_all_sizes() runs on RAW_PCU_Test_CT { |
| 2223 | var RlcmacDlBlock dl_block; |
| 2224 | var uint32_t dl_fn, sched_fn; |
| 2225 | var octetstring payload; |
| 2226 | var template (value) RlcmacUlBlock ul_data; |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2227 | var template (value) LlcBlockHdr blk_hdr; |
| 2228 | var template (value) LlcBlocks blocks; |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2229 | var integer blk_len; |
| 2230 | var CodingScheme tx_cs; |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2231 | var GprsMS ms; |
| 2232 | |
| 2233 | /* Initialize NS/BSSGP side */ |
| 2234 | f_init_bssgp(); |
| 2235 | /* Initialize GPRS MS side */ |
| 2236 | f_init_gprs_ms(); |
| 2237 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2238 | |
| 2239 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2240 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2241 | |
| 2242 | /* Establish BSSGP connection to the PCU */ |
| 2243 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2244 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2245 | |
| 2246 | /* Establish an Uplink TBF */ |
| 2247 | f_ms_establish_ul_tbf(ms); |
| 2248 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 2249 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 2250 | f_ms_wait_usf(ms); |
| 2251 | |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2252 | /* Send one UL block (with TLLI since we are in One-Phase Access |
Pau Espin Pedrol | 15b2b94 | 2022-10-28 15:08:44 +0200 | [diff] [blame] | 2253 | contention resolution) and make sure it is ACKED fine. */ |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2254 | payload := f_rnd_octstring(16); /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2255 | blk_hdr := t_RLCMAC_LLCBLOCK_HDR(length_ind := lengthof(payload), |
| 2256 | more := false, e := true); |
| 2257 | blocks := { t_RLCMAC_LLCBLOCK(payload, blk_hdr) }; |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2258 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2259 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := ms.ul_tbf.tx_cs_mcs, |
| 2260 | tfi := ms.ul_tbf.tfi, |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2261 | cv := 15, |
| 2262 | bsn := ms.ul_tbf.bsn, |
| 2263 | blocks := blocks, |
| 2264 | tlli := ms.tlli); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2265 | f_ultbf_inc_bsn(ms.ul_tbf); |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 2266 | f_ms_tx_ul_block(ms, ul_data, ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2267 | |
| 2268 | /* ACK and check it was received fine */ |
| 2269 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2270 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2271 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 2272 | /* receive one message on BSSGP with all aggregated data in payload: */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2273 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id, payload)); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2274 | |
| 2275 | /* Test sending LLC PDUS of incrementing size */ |
| 2276 | var integer max_size := 49; |
| 2277 | for (var integer i := 1; i <= max_size; i := i + 1) { |
| 2278 | var integer cv; |
| 2279 | /* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */ |
| 2280 | log("Sending DATA.ind with LLC payload size ", i); |
| 2281 | if (i < max_size - g_bs_cv_max) { |
| 2282 | cv := 15; |
| 2283 | } else { |
| 2284 | cv := max_size - i; |
| 2285 | } |
| 2286 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2287 | blk_len := 3 + 1 + i; /* 3 Header bytes + LI byte + payload length */ |
| 2288 | tx_cs := f_rlcmac_block_len_required_cs_mcs(blk_len, false); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2289 | payload := f_rnd_octstring(i); |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2290 | blk_hdr := t_RLCMAC_LLCBLOCK_HDR(length_ind := lengthof(payload), |
| 2291 | more := false, e := true); |
| 2292 | blocks := { t_RLCMAC_LLCBLOCK(payload, blk_hdr) }; |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2293 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2294 | ul_data := t_RLCMAC_UL_DATA(cs := tx_cs, |
| 2295 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2296 | cv := cv, |
| 2297 | bsn := ms.ul_tbf.bsn, |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2298 | blocks := blocks); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2299 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2300 | f_ms_tx_ul_block(ms, ul_data); |
| 2301 | |
| 2302 | /* receive one message on BSSGP with all aggregated data in payload: */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2303 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id, payload)); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2304 | |
| 2305 | /* we will receive UL ACK/NACK from time to time, handle it. */ |
| 2306 | f_rx_rlcmac_dl_block(dl_block, dl_fn); |
Vadim Yanitskiy | 7179d3e | 2022-10-04 03:27:29 +0700 | [diff] [blame] | 2307 | if (match(dl_block, tr_RLCMAC_DL_DUMMY_CTRL())) { |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2308 | continue; |
| 2309 | } |
| 2310 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_GPRS(ul_tfi := ?)) and |
| 2311 | not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 2312 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 2313 | f_shutdown(__BFILE__, __LINE__); |
| 2314 | } |
| 2315 | |
| 2316 | log("Rx Packet Uplink ACK / NACK"); |
| 2317 | sched_fn := f_rrbp_ack_fn(dl_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 2318 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2319 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 2320 | } |
Vadim Yanitskiy | 8e6df0c | 2020-10-18 00:13:15 +0700 | [diff] [blame] | 2321 | |
| 2322 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2323 | } |
| 2324 | |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2325 | function f_TC_ul_data_toolong_fills_padding_cs(inout GprsMS ms, CodingScheme cs, integer cv) runs on RAW_PCU_Test_CT { |
| 2326 | var octetstring payload; |
| 2327 | var template (value) RlcmacUlBlock ul_data; |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2328 | var template (value) LlcBlockHdr blk_hdr; |
| 2329 | var template (value) LlcBlocks blocks; |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2330 | var integer block_len, max_valid_data_len; |
| 2331 | timer T; |
| 2332 | |
| 2333 | block_len := f_rlcmac_cs_mcs2block_len(cs); |
| 2334 | /* We need to send with TLLI since we are in One-Phase Access Contenion |
Pau Espin Pedrol | 15b2b94 | 2022-10-28 15:08:44 +0200 | [diff] [blame] | 2335 | * resolution), so that's -4 bytes of data, -3 for headers, -1 for LI |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2336 | * indicator, -1 for spare bits octet at the end */ |
| 2337 | max_valid_data_len := block_len - 4 - 3 - 1 - 1; |
| 2338 | payload := f_rnd_octstring(max_valid_data_len + 1); /* +1 to write LLC data on last padding octet */ |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2339 | blk_hdr := t_RLCMAC_LLCBLOCK_HDR(length_ind := lengthof(payload), |
| 2340 | more := false, e := true); |
| 2341 | blocks := { t_RLCMAC_LLCBLOCK(payload, blk_hdr) }; |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2342 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := cs, |
| 2343 | tfi := ms.ul_tbf.tfi, |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2344 | cv := cv, |
| 2345 | bsn := ms.ul_tbf.bsn, |
| 2346 | blocks := blocks, |
| 2347 | tlli := ms.tlli); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2348 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2349 | f_ms_tx_data_ind(ms, enc_RlcmacUlBlock(valueof(ul_data))); |
| 2350 | |
| 2351 | T.start(0.5); |
| 2352 | alt { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2353 | [] BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id, ?)) { |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2354 | setverdict(fail, "LLC PDU in Malformed RLC block was forwarded"); |
| 2355 | f_shutdown(__BFILE__, __LINE__); |
| 2356 | } |
| 2357 | [] T.timeout { |
| 2358 | setverdict(pass); |
| 2359 | } |
| 2360 | } |
| 2361 | } |
| 2362 | /* Verify PCU finds out incorrectly formated RLC block and discards it. This |
| 2363 | blocks intentionally contain last byte of data placed in last byte of RLC |
| 2364 | containing padding/spare bits, which is incorrect. Spare bits exist and are |
| 2365 | described for CS2..4 in 3GPP TS 44.060 Table 10.2.1: "RLC data block size, |
| 2366 | discounting padding in octet" */ |
| 2367 | testcase TC_ul_data_toolong_fills_padding() runs on RAW_PCU_Test_CT { |
| 2368 | var GprsMS ms; |
| 2369 | var integer block_len, max_valid_data_len; |
| 2370 | |
| 2371 | /* Initialize NS/BSSGP side */ |
| 2372 | f_init_bssgp(); |
| 2373 | /* Initialize GPRS MS side */ |
| 2374 | f_init_gprs_ms(); |
| 2375 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2376 | |
| 2377 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2378 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2379 | |
| 2380 | /* Establish BSSGP connection to the PCU */ |
| 2381 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2382 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2383 | |
| 2384 | /* Establish an Uplink TBF */ |
| 2385 | f_ms_establish_ul_tbf(ms); |
| 2386 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 2387 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 2388 | f_ms_wait_usf(ms); |
| 2389 | |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2390 | f_TC_ul_data_toolong_fills_padding_cs(ms, CS_2, 2); |
| 2391 | f_TC_ul_data_toolong_fills_padding_cs(ms, CS_3, 1); |
| 2392 | f_TC_ul_data_toolong_fills_padding_cs(ms, CS_4, 0); |
| 2393 | |
Vadim Yanitskiy | 8e6df0c | 2020-10-18 00:13:15 +0700 | [diff] [blame] | 2394 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2395 | } |
| 2396 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2397 | /* Test scenario where MS wants to send some data on PDCH against SGSN and it is |
| 2398 | * answered, so TBFs for uplink and later for downlink are created. |
| 2399 | */ |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2400 | private function f_TC_mo_ping_pong_1phase_access(template (present) CodingScheme exp_cs_mcs := ?) runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2401 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2402 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2403 | var uint32_t sched_fn; |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2404 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2405 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2406 | |
| 2407 | /* Initialize NS/BSSGP side */ |
| 2408 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2409 | /* Initialize GPRS MS side */ |
| 2410 | f_init_gprs_ms(); |
| 2411 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2412 | |
| 2413 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2414 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2415 | |
| 2416 | /* Establish BSSGP connection to the PCU */ |
| 2417 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2418 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2419 | |
| 2420 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2421 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2422 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 2423 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 2424 | f_ms_wait_usf(ms); |
| 2425 | |
Pau Espin Pedrol | 4aac3d0 | 2020-05-13 15:13:49 +0200 | [diff] [blame] | 2426 | /* Send one UL block (with TLLI since we are in One-Phase Access |
Pau Espin Pedrol | 15b2b94 | 2022-10-28 15:08:44 +0200 | [diff] [blame] | 2427 | contention resolution) and make sure it is ACKED fine */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 2428 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2429 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2430 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2431 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2432 | |
| 2433 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2434 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2435 | |
| 2436 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2437 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 2438 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2439 | |
| 2440 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2441 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2442 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0, exp_cs_mcs); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2443 | |
| 2444 | /* ACK the DL block */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2445 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 2446 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 2447 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 2448 | |
| 2449 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2450 | } |
| 2451 | |
| 2452 | /* Test scenario where MS wants to send some data on PDCH against SGSN and it is |
| 2453 | * answered, so TBFs for uplink and later for downlink are created. |
| 2454 | */ |
| 2455 | testcase TC_mo_ping_pong() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 2456 | var template (present) CodingScheme exp_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2457 | f_TC_mo_ping_pong_1phase_access(exp_cs_mcs); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2458 | } |
| 2459 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2460 | /* Test scenario where MS wants to send some data on PDCH against SGSN and it is |
| 2461 | * answered, so TBFs for uplink and later for downlink are created. |
| 2462 | */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2463 | private function f_TC_mo_ping_pong_2phase_access(PCUIF_Flags ind_flags, |
| 2464 | template (value) MSRadioAccessCapabilityV ms_racap, |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 2465 | template (present) CodingScheme exp_ul_cs_mcs := ?, |
| 2466 | template (present) CodingScheme exp_dl_cs_mcs := ?) |
| 2467 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2468 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2469 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 2470 | var PollFnCtx pollctx; |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2471 | var uint32_t sched_fn; |
| 2472 | var uint32_t dl_fn; |
Pau Espin Pedrol | adbbe1e | 2020-05-17 00:28:01 +0200 | [diff] [blame] | 2473 | var uint32_t unused_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2474 | var GprsMS ms; |
| 2475 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2476 | /* Initialize NS/BSSGP side */ |
| 2477 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2478 | /* Initialize GPRS MS side */ |
| 2479 | f_init_gprs_ms(); |
| 2480 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2481 | |
| 2482 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2483 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(ind_flags)); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2484 | |
| 2485 | /* Establish BSSGP connection to the PCU */ |
| 2486 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2487 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2488 | |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 2489 | /* Send PACKET RESOURCE REQUEST to upgrade to EGPRS */ |
| 2490 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap)); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2491 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2492 | if (not match(ms.ul_tbf.tx_cs_mcs, exp_ul_cs_mcs)) { |
| 2493 | setverdict(fail, "Wrong CS_MCS ", ms.ul_tbf.tx_cs_mcs, " received vs exp ", exp_ul_cs_mcs); |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 2494 | f_shutdown(__BFILE__, __LINE__); |
| 2495 | } |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2496 | |
| 2497 | /* Send one UL block (without TLLI since we are in Second-Phase Access) |
| 2498 | and make sure it is ACKED fine */ |
Pau Espin Pedrol | fdbce84 | 2021-03-03 11:43:40 +0100 | [diff] [blame] | 2499 | f_ms_tx_ul_data_block_multi(ms, 1); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2500 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2501 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 2502 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2503 | |
| 2504 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2505 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2506 | |
| 2507 | /* Now SGSN sends some DL data, PCU will page on PACCH */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2508 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
Pau Espin Pedrol | ddd6c3f | 2021-03-03 12:01:20 +0100 | [diff] [blame] | 2509 | /* Sleep a bit to make sure PCU received the DL data and hence it will be prioritized by scheduler: */ |
| 2510 | f_sleep(0.5); |
Vadim Yanitskiy | 7431e9e | 2020-07-21 01:59:17 +0700 | [diff] [blame] | 2511 | f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2512 | /* DL Ass sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2513 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2514 | |
Pau Espin Pedrol | adbbe1e | 2020-05-17 00:28:01 +0200 | [diff] [blame] | 2515 | /* PCU acks the UL data after having received CV=0) */ |
| 2516 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 2517 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2518 | /* After acking the dl assignment, dl tbf goes into FLOW state and PCU will provide DL data when BTS asks for it */ |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 2519 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0, exp_dl_cs_mcs); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2520 | |
| 2521 | /* ACK the DL block */ |
Pau Espin Pedrol | e8db673 | 2020-11-12 21:06:41 +0100 | [diff] [blame] | 2522 | f_dltbf_ack_block(ms.dl_tbf, dl_block, '1'B); |
| 2523 | f_ms_tx_ul_block(ms, f_dltbf_ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf, ischosen(dl_block.data_egprs)), |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2524 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2525 | |
| 2526 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2527 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2528 | |
| 2529 | testcase TC_mo_ping_pong_with_ul_racap() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 2530 | var template (present) CodingScheme exp_ul_cs_mcs := cs_gprs_any; |
| 2531 | var template (present) CodingScheme exp_dl_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2532 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 2533 | f_TC_mo_ping_pong_2phase_access(c_PCUIF_Flags_noMCS, ms_racap_gprs_def, exp_ul_cs_mcs, exp_dl_cs_mcs); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 2534 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 2535 | var StatsDExpects expect := { |
| 2536 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 1, max := 1 }, |
| 2537 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := 0, max := 0 }, |
| 2538 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := 0, max := 0 }, |
| 2539 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := 1, max := 1 }, |
| 2540 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 1, max := 1 }, |
| 2541 | { name := "TTCN3.bts.0.immediate.assignment_ul.one_phase", mtype := "c", min := 0, max := 0 }, |
| 2542 | { name := "TTCN3.bts.0.immediate.assignment_ul.two_phase", mtype := "c", min := 1, max := 1 }, |
| 2543 | { name := "TTCN3.bts.0.immediate.assignment_ul.contention_resolution_success", mtype := "c", min := 1, max := 1 }, |
| 2544 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 }, |
| 2545 | { name := "TTCN3.bts.0.pkt.ul_assignment", mtype := "c", min := 1, max := 1 } |
| 2546 | }; |
| 2547 | f_statsd_expect(expect); |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 2548 | |
| 2549 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 2550 | } |
| 2551 | |
| 2552 | testcase TC_mo_ping_pong_with_ul_racap_egprs_only() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 2553 | var template (present) CodingScheme exp_ul_cs_mcs := mcs_egprs_any; |
| 2554 | var template (present) CodingScheme exp_dl_cs_mcs := mcs_egprs_any; |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 2555 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 2556 | f_TC_mo_ping_pong_2phase_access(c_PCUIF_Flags_default, ms_racap_egprs_def, exp_ul_cs_mcs, exp_dl_cs_mcs); |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 2557 | |
| 2558 | var StatsDExpects expect := { |
| 2559 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 1, max := 1 }, |
| 2560 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := 0, max := 0 }, |
| 2561 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := 0, max := 0 }, |
| 2562 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := 1, max := 1 }, |
| 2563 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 1, max := 1 }, |
| 2564 | { name := "TTCN3.bts.0.immediate.assignment_ul.one_phase", mtype := "c", min := 0, max := 0 }, |
| 2565 | { name := "TTCN3.bts.0.immediate.assignment_ul.two_phase", mtype := "c", min := 1, max := 1 }, |
| 2566 | { name := "TTCN3.bts.0.immediate.assignment_ul.contention_resolution_success", mtype := "c", min := 1, max := 1 }, |
| 2567 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 }, |
| 2568 | { name := "TTCN3.bts.0.pkt.ul_assignment", mtype := "c", min := 1, max := 1 } |
| 2569 | }; |
| 2570 | f_statsd_expect(expect); |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 2571 | |
| 2572 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2573 | } |
| 2574 | |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 2575 | testcase TC_force_two_phase_access() runs on RAW_PCU_Test_CT { |
| 2576 | /* Configure PCU to force two phase access */ |
| 2577 | g_force_two_phase_access := true; |
| 2578 | |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 2579 | var CodingScheme exp_ul_cs_mcs := f_rlcmac_block_int2cs_mcs(g_mcs_initial_ul, false); |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 2580 | var template (present) CodingScheme exp_dl_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 2581 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 2582 | f_TC_mo_ping_pong_2phase_access(c_PCUIF_Flags_noMCS, ms_racap_gprs_def, exp_ul_cs_mcs, exp_dl_cs_mcs); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 2583 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 2584 | var StatsDExpects expect := { |
| 2585 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 1, max := 1 }, |
| 2586 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := 0, max := 0 }, |
| 2587 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := 1, max := 1 }, |
| 2588 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := 0, max := 0 }, |
| 2589 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 1, max := 1 }, |
| 2590 | { name := "TTCN3.bts.0.immediate.assignment_ul.one_phase", mtype := "c", min := 0, max := 0 }, |
| 2591 | { name := "TTCN3.bts.0.immediate.assignment_ul.two_phase", mtype := "c", min := 1, max := 1 }, |
| 2592 | { name := "TTCN3.bts.0.immediate.assignment_ul.contention_resolution_success", mtype := "c", min := 1, max := 1 }, |
| 2593 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 }, |
| 2594 | { name := "TTCN3.bts.0.pkt.ul_assignment", mtype := "c", min := 1, max := 1 } |
| 2595 | }; |
| 2596 | f_statsd_expect(expect); |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 2597 | |
| 2598 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 2599 | } |
| 2600 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2601 | /* Test scenario where SGSN wants to send some data against MS and it is |
| 2602 | * answered by the MS on PDCH, so TBFs for downlink and later for uplink are created. |
| 2603 | */ |
Vadim Yanitskiy | c67240a | 2020-10-17 15:59:37 +0700 | [diff] [blame] | 2604 | private function f_TC_mt_ping_pong(template (omit) MSRadioAccessCapabilityV_BSSGP ms_racap := omit, |
| 2605 | template (present) CodingScheme exp_cs_mcs := ?) |
| 2606 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2607 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2608 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2609 | var uint32_t sched_fn; |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2610 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2611 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2612 | |
| 2613 | /* Initialize NS/BSSGP side */ |
| 2614 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2615 | /* Initialize GPRS MS side */ |
| 2616 | f_init_gprs_ms(); |
| 2617 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2618 | |
| 2619 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2620 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2621 | |
| 2622 | /* Establish BSSGP connection to the PCU */ |
| 2623 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2624 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2625 | |
| 2626 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2627 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap)); |
| 2628 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2629 | |
| 2630 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2631 | f_sleep(X2002); |
Pau Espin Pedrol | 3f2b5e4 | 2022-11-29 14:54:34 +0100 | [diff] [blame] | 2632 | /* Skip potential dummy blocks before X2002 triggers at PCU after us: */ |
| 2633 | dl_fn := f_rx_rlcmac_dl_block_skip_dummy(dl_block, max_dummy := 10); |
| 2634 | |
| 2635 | f_rlcmac_dl_block_exp_data(dl_block, data, 0, exp_cs_mcs); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2636 | |
Pau Espin Pedrol | 6791eb6 | 2020-05-20 18:27:10 +0200 | [diff] [blame] | 2637 | /* ACK the DL block, and request UL TBF at the same time */ |
Pau Espin Pedrol | e8db673 | 2020-11-12 21:06:41 +0100 | [diff] [blame] | 2638 | f_dltbf_ack_block(ms.dl_tbf, dl_block, '1'B); |
| 2639 | f_ms_tx_ul_block(ms, f_dltbf_ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf, ischosen(dl_block.data_egprs), c_ChReqDesc_default), |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2640 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2641 | |
Pau Espin Pedrol | 6791eb6 | 2020-05-20 18:27:10 +0200 | [diff] [blame] | 2642 | /* Expect UL ass */ |
Vadim Yanitskiy | 7431e9e | 2020-07-21 01:59:17 +0700 | [diff] [blame] | 2643 | f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_UL_PACKET_ASS); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2644 | |
Pau Espin Pedrol | 4aac3d0 | 2020-05-13 15:13:49 +0200 | [diff] [blame] | 2645 | /* Send one UL block (with TLLI since we are in One-Phase Access |
Pau Espin Pedrol | 15b2b94 | 2022-10-28 15:08:44 +0200 | [diff] [blame] | 2646 | contention resolution) and make sure it is ACKED fine */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2647 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2648 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2649 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2650 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2651 | |
| 2652 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2653 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 2654 | |
| 2655 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2656 | } |
| 2657 | |
| 2658 | testcase TC_mt_ping_pong() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 2659 | var template (present) CodingScheme exp_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2660 | f_TC_mt_ping_pong(omit, exp_cs_mcs); |
| 2661 | } |
| 2662 | |
| 2663 | /* TC_mt_ping_pong, but DL-UNITDATA contains RA Access capability with (M)CS |
| 2664 | /* information about the MS */ |
| 2665 | testcase TC_mt_ping_pong_with_dl_racap() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 2666 | var template (present) CodingScheme exp_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 2667 | f_TC_mt_ping_pong(bssgp_ms_racap_gprs_def, exp_cs_mcs); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2668 | } |
| 2669 | |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2670 | /* Verify that if PCU doesn't get one of the intermediate UL data blocks in a UL |
| 2671 | * TBF, it will request retransmission through UL ACK/NACK (with missing block |
| 2672 | * in its bitmap) when CV=0 is received (and hence it knows no more data is to |
| 2673 | * be transferred). |
| 2674 | */ |
| 2675 | testcase TC_ul_intermediate_retrans() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2676 | var RlcmacDlBlock dl_block; |
| 2677 | var template (value) RlcmacUlBlock ul_data; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2678 | var uint32_t sched_fn; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2679 | var octetstring total_payload; |
| 2680 | var octetstring payload; |
| 2681 | var octetstring lost_payload; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2682 | var uint5_t tfi; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2683 | var GprsMS ms; |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2684 | var uint32_t payload_fill_len; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2685 | |
| 2686 | /* Initialize NS/BSSGP side */ |
| 2687 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2688 | /* Initialize GPRS MS side */ |
| 2689 | f_init_gprs_ms(); |
| 2690 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2691 | |
| 2692 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2693 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2694 | |
| 2695 | /* Establish BSSGP connection to the PCU */ |
| 2696 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2697 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2698 | |
| 2699 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2700 | f_ms_establish_ul_tbf(ms); |
| 2701 | tfi := ms.ul_tbf.tfi; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2702 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 2703 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 2704 | f_ms_wait_usf(ms); |
| 2705 | |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2706 | /* Send one UL block (with TLLI since we are in One-Phase Access |
Pau Espin Pedrol | 15b2b94 | 2022-10-28 15:08:44 +0200 | [diff] [blame] | 2707 | contention resolution) and make sure it is ACKED fine. */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2708 | payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true)); /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 2709 | f_ms_tx_ul_data_block(ms, payload, cv := 15, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2710 | |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2711 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2712 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2713 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2714 | total_payload := payload; |
| 2715 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2716 | payload_fill_len := f_ultbf_payload_fill_length(ms.ul_tbf); |
| 2717 | |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2718 | /* Send 2 packets, skip 1 (inc bsn) and send another one */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2719 | payload := f_rnd_octstring(payload_fill_len); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2720 | f_ms_tx_ul_data_block(ms, payload, cv := 15); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2721 | total_payload := total_payload & payload; |
| 2722 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2723 | payload := f_rnd_octstring(payload_fill_len); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2724 | f_ms_tx_ul_data_block(ms, payload, cv := 15); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2725 | total_payload := total_payload & payload; |
| 2726 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2727 | lost_payload := f_rnd_octstring(payload_fill_len); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2728 | ms.ul_tbf.bsn := ms.ul_tbf.bsn + 1; /* LOST PAYLOAD bsn=3, will be retransmitted, next bsn is increased +2 */ |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2729 | total_payload := total_payload & lost_payload; |
| 2730 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2731 | payload := f_rnd_octstring(payload_fill_len) |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2732 | f_ms_tx_ul_data_block(ms, payload, cv := 15); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2733 | total_payload := total_payload & payload; |
| 2734 | |
| 2735 | /* Send enough blocks to finish the transmission (since we were sending BSN=15, send BS_CV_MAX packets) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2736 | total_payload := total_payload & f_ms_tx_ul_data_block_multi(ms, g_bs_cv_max); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2737 | |
| 2738 | /* On CV=0, we'll receive a UL ACK asking about missing block */ |
| 2739 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2740 | /* TODO: check ack ack bitmap (URBB) */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2741 | ul_data := t_RLCMAC_UL_DATA(cs := ms.ul_tbf.tx_cs_mcs, |
| 2742 | tfi := tfi, |
| 2743 | cv := 15, |
| 2744 | bsn := 3, |
| 2745 | blocks := {t_RLCMAC_LLCBLOCK(lost_payload)}); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2746 | f_ms_tx_ul_block(ms, ul_data); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2747 | |
| 2748 | /* Now final ack is recieved */ |
| 2749 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2750 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2751 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2752 | |
| 2753 | /* receive one message on BSSGP with all aggregated data in payload: */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2754 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id, total_payload)); |
Vadim Yanitskiy | 8e6df0c | 2020-10-18 00:13:15 +0700 | [diff] [blame] | 2755 | |
| 2756 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2757 | } |
| 2758 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2759 | /* Verify that if PCU doesn't get an ACK for first DL block after IMM ASS, it |
| 2760 | * will retry by retransmitting both the IMM ASS + DL block after poll (ack) |
| 2761 | * timeout occurs (specified by sent RRBP on DL block). */ |
| 2762 | testcase TC_imm_ass_dl_block_retrans() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2763 | var RlcmacDlBlock dl_block; |
| 2764 | var octetstring data := f_rnd_octstring(10); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2765 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2766 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2767 | |
| 2768 | /* Initialize NS/BSSGP side */ |
| 2769 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2770 | /* Initialize GPRS MS side */ |
| 2771 | f_init_gprs_ms(); |
| 2772 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2773 | |
| 2774 | /* Initialize the PCU interface abstraction */ |
| 2775 | f_init_raw(testcasename()); |
| 2776 | |
| 2777 | /* Establish BSSGP connection to the PCU */ |
| 2778 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2779 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2780 | |
| 2781 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2782 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 2783 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2784 | |
| 2785 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2786 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2787 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2788 | |
| 2789 | /* Now we don't ack the dl block (emulate MS failed receiveing IMM ASS |
| 2790 | * or GPRS DL, or DL ACK was lost for some reason). As a result, PCU |
| 2791 | * should retrigger IMM ASS + GPRS DL procedure after poll timeout. */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2792 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Vadim Yanitskiy | 2e213ae | 2020-05-06 22:26:17 +0700 | [diff] [blame] | 2793 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2794 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2795 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2796 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2797 | |
| 2798 | /* ACK the DL block */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2799 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 2800 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 2801 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 2802 | |
| 2803 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2804 | } |
| 2805 | |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2806 | /* Verify scheduling of multiple Downlink data blocks during one RRBP. */ |
| 2807 | testcase TC_dl_flow_more_blocks() runs on RAW_PCU_Test_CT { |
| 2808 | var AckNackDescription ack_nack_desc := valueof(t_AckNackDescription_init); |
| 2809 | var octetstring data := f_rnd_octstring(16); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2810 | var PacketDlAssign dl_tbf_ass; |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2811 | var RlcmacDlBlock dl_block; |
| 2812 | var uint32_t ack_fn; |
| 2813 | var uint32_t fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2814 | var GprsMS ms; |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2815 | timer T := 5.0; |
| 2816 | |
| 2817 | /* Initialize NS/BSSGP side */ |
| 2818 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2819 | /* Initialize GPRS MS side */ |
| 2820 | f_init_gprs_ms(); |
| 2821 | ms := g_ms[0]; /* We only use first MS in this test */ |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2822 | |
| 2823 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2824 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2825 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 2826 | f_statsd_reset(); |
| 2827 | |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2828 | /* Establish BSSGP connection to the PCU */ |
| 2829 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2830 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2831 | |
| 2832 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2833 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 2834 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2835 | |
| 2836 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 2837 | f_sleep(X2002); |
Pau Espin Pedrol | 45b98aa | 2022-11-29 14:50:39 +0100 | [diff] [blame] | 2838 | /* Skip potential dummy blocks before X2002 triggers at PCU after us: */ |
| 2839 | fn := f_rx_rlcmac_dl_block_skip_dummy(dl_block, max_dummy := 10); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2840 | |
| 2841 | /* Expect the first (GPRS DL) block with bsn=0 and rrbp_valid=1 */ |
Pau Espin Pedrol | 45b98aa | 2022-11-29 14:50:39 +0100 | [diff] [blame] | 2842 | f_rlcmac_dl_block_exp_data(dl_block, data, 0); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2843 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2844 | |
| 2845 | /* TDMA frame number on which we are supposed to send the ACK */ |
| 2846 | ack_fn := f_dl_block_ack_fn(dl_block, fn); |
| 2847 | |
| 2848 | /* SGSN sends more blocks during the indicated RRBP */ |
| 2849 | for (var integer bsn := 1; bsn < 63; bsn := bsn + 1) { |
| 2850 | data := f_rnd_octstring(16); /* Random LLC data */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2851 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2852 | |
| 2853 | f_rx_rlcmac_dl_block_exp_data(dl_block, fn, data, bsn); |
| 2854 | |
| 2855 | /* Make sure this block has the same TFI as was assigned |
| 2856 | * FIXME: this is only valid for GPRS, not EGPRS. */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2857 | if (dl_block.data.mac_hdr.hdr_ext.tfi != ms.dl_tbf.tfi) { |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2858 | setverdict(fail, "Rx DL data block with unexpected TFI: ", |
| 2859 | dl_block.data.mac_hdr.hdr_ext.tfi); |
| 2860 | f_shutdown(__BFILE__, __LINE__); |
| 2861 | } |
| 2862 | |
| 2863 | /* Keep Ack/Nack description updated */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2864 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2865 | |
| 2866 | /* Break if this is the end of RRBP */ |
| 2867 | if (fn == ack_fn) { |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2868 | ms.dl_tbf.acknack_desc.final_ack := '1'B; |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2869 | break; |
| 2870 | } |
| 2871 | } |
| 2872 | |
| 2873 | /* This is the end of RRBP, send Packet Downlink Ack/Nack */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2874 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), fn := fn); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2875 | |
| 2876 | /* Make sure that the next block (after the Ack) is dummy */ |
| 2877 | f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 2878 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 2879 | var StatsDExpects expect := { |
| 2880 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 0, max := 0}, |
| 2881 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 1, max := 1}, |
| 2882 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 0, max := 0}, |
| 2883 | { name := "TTCN3.bts.0.tbf.dl.alloc", mtype := "c", min := 1, max := 1}, |
| 2884 | { name := "TTCN3.bts.0.tbf.ul.alloc", mtype := "c", min := 0, max := 0}, |
Pau Espin Pedrol | 0bf74e5 | 2020-12-11 19:25:42 +0100 | [diff] [blame] | 2885 | { name := "TTCN3.bts.0.rlc.dl_payload_bytes", mtype := "c", min := 64, max := 64}, |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 2886 | { name := "TTCN3.bts.0.rlc.ul_payload_bytes", mtype := "c", min := 0, max := 0} |
| 2887 | }; |
| 2888 | f_statsd_expect(expect); |
| 2889 | |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2890 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2891 | } |
| 2892 | |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2893 | /* Verify Decoding and segmentation of UL LLC PDUs into RLC data blocks, OS#4559. |
| 2894 | * Check "GPRS from A-Z" slide "Example of LI-Field and E-Bit" page 186. |
| 2895 | * Check "3GPP TS 44.060" Annex B. */ |
| 2896 | testcase TC_ul_flow_multiple_llc_blocks() runs on RAW_PCU_Test_CT { |
| 2897 | var RlcmacDlBlock dl_block; |
| 2898 | var octetstring dataA := f_rnd_octstring(20); |
| 2899 | var octetstring dataB := f_rnd_octstring(13); |
| 2900 | var octetstring dataC := f_rnd_octstring(3); |
| 2901 | var octetstring dataD := f_rnd_octstring(12); |
| 2902 | var uint32_t sched_fn; |
| 2903 | var GprsMS ms; |
| 2904 | var template (value) RlcmacUlBlock ul_data; |
| 2905 | |
| 2906 | /* Initialize NS/BSSGP side */ |
| 2907 | f_init_bssgp(); |
| 2908 | /* Initialize GPRS MS side */ |
| 2909 | f_init_gprs_ms(); |
| 2910 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2911 | |
| 2912 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2913 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2914 | |
| 2915 | /* Establish BSSGP connection to the PCU */ |
| 2916 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2917 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2918 | |
| 2919 | /* Establish an Uplink TBF */ |
| 2920 | f_ms_establish_ul_tbf(ms); |
| 2921 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 2922 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 2923 | f_ms_wait_usf(ms); |
| 2924 | |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2925 | /* Summary of what's transmitted: |
| 2926 | * 1- UL RlcDataBlock(dataA) [BSN=0, CV=3] |
| 2927 | * 2- UL RlcDataBlock(dataA finished, dataB starts) [BSN=1, CV=2] |
| 2928 | * 3- UL RlcDataBlock(dataB finished, dataC starts and finishes, dataD starts) [BSN=2, CV=1] |
| 2929 | * 4- UL RlcDataBlock(dataD finishes) [BSN=3, CV=0] |
| 2930 | * And on SGSN we receive 4 packets, one for each LlcBlock dataA..D. |
| 2931 | * We'll also receive some UL ACK/NACK we need to reply with CTRL ACK. |
| 2932 | */ |
| 2933 | |
| 2934 | /* UL RlcDataBlock(dataA) [BSN=0, CV=3] */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2935 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := CS_1, |
| 2936 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2937 | cv := 3, |
| 2938 | bsn := ms.ul_tbf.bsn, |
| 2939 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataA, 0, 16)) }, |
| 2940 | tlli := ms.tlli); |
| 2941 | /* Indicate no llc header, meaning first LLC block doesn't finish in current |
| 2942 | * RLCMAC block being sent. */ |
| 2943 | ul_data.data.mac_hdr.e := true; |
| 2944 | f_ultbf_inc_bsn(ms.ul_tbf); |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 2945 | f_ms_tx_ul_block(ms, ul_data, ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2946 | |
| 2947 | /* UL RlcDataBlock(dataA finished, dataB starts) [BSN=1, CV=2] */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2948 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := CS_1, |
| 2949 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2950 | cv := 2, |
| 2951 | bsn := ms.ul_tbf.bsn, |
| 2952 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataA, 16, 4), |
| 2953 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 4, more := true, e := true)), |
| 2954 | t_RLCMAC_LLCBLOCK(substr(dataB, 0, 11)) |
| 2955 | }, |
| 2956 | tlli := ms.tlli); |
| 2957 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2958 | f_ms_tx_ul_block(ms, ul_data); |
| 2959 | |
| 2960 | /* UL block dataA should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2961 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id, dataA)); |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2962 | |
| 2963 | /* UL RlcDataBlock(dataB finished, dataC starts and finishes, dataD starts) [BSN=2, CV=1] */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2964 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := CS_1, |
| 2965 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2966 | cv := 1, |
| 2967 | bsn := ms.ul_tbf.bsn, |
| 2968 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataB, 11, 2), |
| 2969 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 2, more := true, e := false)), |
| 2970 | t_RLCMAC_LLCBLOCK(substr(dataC, 0, 3), |
| 2971 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 3, more := true, e := true)), |
| 2972 | t_RLCMAC_LLCBLOCK(substr(dataD, 0, 9)) |
| 2973 | }, |
| 2974 | tlli := ms.tlli); |
| 2975 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2976 | f_ms_tx_ul_block(ms, ul_data); |
| 2977 | |
| 2978 | /* UL block dataB and dataC should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2979 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id, dataB)); |
| 2980 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id, dataC)); |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2981 | |
| 2982 | /* UL RlcDataBlock(dataD finishes) [BSN=3, CV=0] */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2983 | ul_data := t_RLCMAC_UL_DATA_TLLI( |
| 2984 | cs := CS_1, |
| 2985 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2986 | cv := 0, |
| 2987 | bsn := ms.ul_tbf.bsn, |
| 2988 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataD, 9, 3), |
| 2989 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 3, more := false, e := true)) |
| 2990 | }, |
| 2991 | tlli := ms.tlli); |
| 2992 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2993 | f_ms_tx_ul_block(ms, ul_data); |
| 2994 | |
| 2995 | /* UL block dataB and dataD should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2996 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id, dataD)); |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2997 | |
| 2998 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2999 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3000 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3001 | |
| 3002 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3003 | } |
| 3004 | |
Pau Espin Pedrol | 90fdfed | 2021-03-02 17:29:32 +0100 | [diff] [blame] | 3005 | /* Validate an Imm Assignment is retransmitted if first RRBP requesting DL |
| 3006 | * ACK/NACK is not answered */ |
| 3007 | testcase TC_dl_no_ack_retrans_imm_ass() runs on RAW_PCU_Test_CT { |
| 3008 | var RlcmacDlBlock dl_block; |
| 3009 | var octetstring data1 := f_rnd_octstring(200); |
| 3010 | var octetstring data2 := f_rnd_octstring(10); |
| 3011 | var uint32_t dl_fn; |
| 3012 | var GprsMS ms; |
| 3013 | var template (value) TsTrxBtsNum nr; |
| 3014 | var BTS_PDTCH_Block data_msg; |
| 3015 | |
| 3016 | /* Initialize NS/BSSGP side */ |
| 3017 | f_init_bssgp(); |
| 3018 | /* Initialize GPRS MS side */ |
| 3019 | f_init_gprs_ms(); |
| 3020 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3021 | |
| 3022 | /* Initialize the PCU interface abstraction */ |
| 3023 | f_init_raw(testcasename()) |
| 3024 | |
| 3025 | /* Establish BSSGP connection to the PCU */ |
| 3026 | f_bssgp_establish(); |
| 3027 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3028 | |
| 3029 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 3030 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1)); |
| 3031 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 3032 | |
| 3033 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 3034 | f_sleep(X2002); |
| 3035 | |
| 3036 | /* Recv DL data until receiving RRBP to DL ACK (because it's last queued DL data) */ |
| 3037 | while (true) { |
| 3038 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, ?, ?); |
| 3039 | |
| 3040 | /* Keep Ack/Nack description updated (except for last BSN) */ |
| 3041 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
| 3042 | |
| 3043 | if (f_dl_block_rrbp_valid(dl_block)) { |
| 3044 | /* Don't transmit DL ACK here on purpose ignore it */ |
| 3045 | break; |
| 3046 | } |
| 3047 | } |
| 3048 | |
| 3049 | /* PCU starts whole process again */ |
| 3050 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 3051 | |
| 3052 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 3053 | f_sleep(X2002); |
| 3054 | |
| 3055 | /* Recv DL data until receiving RRBP to DL ACK (because it's last queued |
| 3056 | /* DL data), after that we receive only DUMMY blocks so we are done */ |
| 3057 | var boolean data_received := false; |
| 3058 | nr := ts_TsTrxBtsNum; |
| 3059 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 3060 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 3061 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 3062 | block_nr := nr.blk_nr)); |
| 3063 | alt { |
| 3064 | [data_received] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 3065 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
Vadim Yanitskiy | 7179d3e | 2022-10-04 03:27:29 +0700 | [diff] [blame] | 3066 | tr_RLCMAC_DL_DUMMY_CTRL)) { /* done */ } |
Pau Espin Pedrol | 90fdfed | 2021-03-02 17:29:32 +0100 | [diff] [blame] | 3067 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 3068 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 3069 | tr_RLCMAC_DATA)) -> value data_msg { |
| 3070 | data_received := true; |
| 3071 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, data_msg.dl_block); |
| 3072 | if (data_msg.dl_block.data.mac_hdr.hdr_ext.fbi) { |
| 3073 | log("Received FINAL_ACK"); |
| 3074 | ms.dl_tbf.acknack_desc.final_ack := '1'B; |
| 3075 | } |
| 3076 | if (f_dl_block_rrbp_valid(data_msg.dl_block)) { |
| 3077 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 3078 | f_dl_block_ack_fn(dl_block, data_msg.raw.fn)); |
| 3079 | } |
| 3080 | nr := ts_TsTrxBtsNum; |
| 3081 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 3082 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 3083 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 3084 | block_nr := nr.blk_nr)); |
| 3085 | repeat; |
| 3086 | } |
| 3087 | [] BTS.receive { |
| 3088 | setverdict(fail, "Unexpected BTS message"); |
| 3089 | f_shutdown(__BFILE__, __LINE__); |
| 3090 | } |
| 3091 | } |
| 3092 | |
| 3093 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3094 | } |
| 3095 | |
Pau Espin Pedrol | 6844c16 | 2022-04-01 15:40:06 +0200 | [diff] [blame] | 3096 | /* OS#5508: Verify scheduling of LLC frames with SAPI=1 (GMM) takes precedence |
| 3097 | * over SAPI2/7/8 which in turn take prececende over others */ |
| 3098 | testcase TC_dl_llc_sapi_priority() runs on RAW_PCU_Test_CT { |
| 3099 | var octetstring data_sapi1 := f_pad_oct('01'O, 19, 'ff'O); |
| 3100 | var octetstring data_sapi2 := f_pad_oct('02'O, 19, 'ff'O); |
| 3101 | var octetstring data_sapi7 := f_pad_oct('07'O, 19, 'ff'O); |
| 3102 | var octetstring data_sapi8 := f_pad_oct('08'O, 19, 'ff'O); |
| 3103 | var octetstring data_sapi_other := f_pad_oct('03'O, 19, 'ff'O); |
| 3104 | var RlcmacDlBlock dl_block; |
| 3105 | var uint32_t dl_fn; |
| 3106 | var GprsMS ms; |
| 3107 | var integer state := 1; |
| 3108 | |
| 3109 | /* Initialize NS/BSSGP side */ |
| 3110 | f_init_bssgp(); |
| 3111 | /* Initialize GPRS MS side */ |
| 3112 | f_init_gprs_ms(); |
| 3113 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3114 | |
| 3115 | /* Initialize the PCU interface abstraction */ |
| 3116 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 3117 | |
| 3118 | /* Lock to CS1 to keep same DL RLCMAC data block size: */ |
| 3119 | g_cs_initial_dl := 1; |
| 3120 | g_mcs_max_dl := 1; |
| 3121 | f_pcuvty_set_allowed_cs_mcs(); |
| 3122 | |
| 3123 | /* Establish BSSGP connection to the PCU */ |
| 3124 | f_bssgp_establish(); |
| 3125 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3126 | |
| 3127 | /* SGSN sends some low prio DL data, PCU will page on CCCH (PCH) */ |
| 3128 | for (var integer i := 0; i < 10; i := i + 1) { |
| 3129 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data_sapi_other)); |
| 3130 | } |
| 3131 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data_sapi2)); |
| 3132 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data_sapi7)); |
| 3133 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data_sapi8)); |
| 3134 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data_sapi1)); |
| 3135 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 3136 | |
| 3137 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 3138 | f_sleep(X2002); |
| 3139 | |
| 3140 | while (state != 0) { |
| 3141 | var OCT1 rx_sapi; |
| 3142 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, ?, ?); |
| 3143 | rx_sapi := dl_block.data.blocks[0].payload[0]; |
| 3144 | |
| 3145 | select (state) { |
| 3146 | case(1) { /* We expect the first GMM LLC frame here (SAPI=1, highest prio) */ |
| 3147 | if (rx_sapi != '01'O) { |
| 3148 | setverdict(fail, "Wrong prio: Expected LLC SAPI 1 (GMM) but got ", rx_sapi); |
| 3149 | f_shutdown(__BFILE__, __LINE__); |
| 3150 | } |
| 3151 | state := 2; |
| 3152 | } |
| 3153 | case(2) { /* We expect the second LLC frame here (SAPI=2, middle prio) */ |
| 3154 | if (rx_sapi != '02'O) { |
| 3155 | setverdict(fail, "Wrong prio: Expected LLC SAPI 2 but got ", rx_sapi); |
| 3156 | f_shutdown(__BFILE__, __LINE__); |
| 3157 | } |
| 3158 | state := 7; |
| 3159 | } |
| 3160 | case(7) { /* We expect the third LLC frame here (SAPI=7, middle prio) */ |
| 3161 | if (rx_sapi != '07'O) { |
| 3162 | setverdict(fail, "Wrong prio: Expected LLC SAPI 7 but got ", rx_sapi); |
| 3163 | f_shutdown(__BFILE__, __LINE__); |
| 3164 | } |
| 3165 | state := 8; |
| 3166 | } |
| 3167 | case(8) { /* We expect the fourth LLC frame here (SAPI=8, middle prio) */ |
| 3168 | if (rx_sapi != '08'O) { |
| 3169 | setverdict(fail, "Wrong prio: Expected LLC SAPI 8 but got ", rx_sapi); |
| 3170 | f_shutdown(__BFILE__, __LINE__); |
| 3171 | } |
| 3172 | state := 3; |
| 3173 | } |
| 3174 | case(3) { /* We expect the other LLC frame here (SAPI=3, lower prio) */ |
| 3175 | if (rx_sapi != '03'O) { |
| 3176 | setverdict(fail, "Wrong prio: Expected LLC SAPI 3 but got ", rx_sapi); |
| 3177 | f_shutdown(__BFILE__, __LINE__); |
| 3178 | } |
| 3179 | state := 0; /* Done, break */ |
| 3180 | } |
| 3181 | } |
| 3182 | /* Keep Ack/Nack description updated (except for last BSN) */ |
| 3183 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
| 3184 | |
| 3185 | if (f_dl_block_rrbp_valid(dl_block)) { |
| 3186 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 3187 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 3188 | } |
| 3189 | } |
| 3190 | |
| 3191 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3192 | } |
| 3193 | |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 3194 | /* Verify allocation and use of multislot tbf, triggered by MS class provided in SGSN. SYS#5131 */ |
| 3195 | testcase TC_dl_multislot_tbf_ms_class_from_sgsn() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3196 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 3197 | var octetstring data := f_rnd_octstring(10); |
| 3198 | var PacketDlAssign dl_tbf_ass; |
| 3199 | var RlcmacDlBlock dl_block; |
| 3200 | var uint32_t poll_fn; |
| 3201 | var uint32_t sched_fn; |
| 3202 | var GprsMS ms; |
| 3203 | timer T := 5.0; |
| 3204 | |
| 3205 | /* Initialize NS/BSSGP side */ |
| 3206 | f_init_bssgp(); |
| 3207 | /* Initialize GPRS MS side */ |
| 3208 | f_init_gprs_ms(); |
| 3209 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3210 | |
| 3211 | /* Only 1 TRX with 8 PDCH */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3212 | f_PCUIF_PDCHMask_set(info_ind, '11111111'B, 0); |
| 3213 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 3214 | |
| 3215 | /* Initialize the PCU interface abstraction */ |
| 3216 | f_init_raw(testcasename(), info_ind); |
| 3217 | |
| 3218 | /* Establish BSSGP connection to the PCU */ |
| 3219 | f_bssgp_establish(); |
| 3220 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3221 | |
| 3222 | /* Establish an Uplink TBF, this way the PCU can send DL Assignment |
| 3223 | through PDCH (no multiblock assignment possible through PCH) */ |
| 3224 | f_ms_establish_ul_tbf(ms); |
| 3225 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 3226 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 3227 | f_ms_wait_usf(ms); |
| 3228 | |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 3229 | /* Send one UL block (with TLLI since we are in One-Phase Access |
Pau Espin Pedrol | 15b2b94 | 2022-10-28 15:08:44 +0200 | [diff] [blame] | 3230 | contention resolution) and make sure it is ACKED fine */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 3231 | f_ms_tx_ul_data_block(ms, data, with_tlli := true, fn := ms.ul_tbf.start_time_fn, |
| 3232 | nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 3233 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3234 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, poll_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3235 | |
| 3236 | /* SGSN sends some DL data, PCU will assign DL TBF through PACCH */ |
| 3237 | var MultislotCap_GPRS_BSSGP mscap_gprs := { |
| 3238 | gprsmultislotclass := '10010'B, /* MS class 18, supports 8 DL and 8 UL */ |
| 3239 | gprsextendeddynalloccap := '0'B |
| 3240 | }; |
| 3241 | var MSRadioAccessCapabilityV_BSSGP ms_racap := { valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, mscap_gprs, omit)) }; |
| 3242 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap)); |
| 3243 | dl_block := f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3244 | if (f_dltbf_num_slots(ms.dl_tbf) != 8) { |
| 3245 | setverdict(fail, "Expected 8 PDCH slots allocated but got ", f_dltbf_num_slots(ms.dl_tbf)); |
| 3246 | f_shutdown(__BFILE__, __LINE__); |
| 3247 | } |
| 3248 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3249 | |
| 3250 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3251 | } |
| 3252 | |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 3253 | testcase TC_dl_multislot_tbf_ms_class_from_2phase() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3254 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 3255 | var RlcmacDlBlock dl_block; |
| 3256 | var octetstring data := f_rnd_octstring(10); |
| 3257 | var PollFnCtx pollctx; |
| 3258 | var uint32_t sched_fn; |
| 3259 | var GprsMS ms; |
| 3260 | |
| 3261 | var MultislotCap_GPRS mscap_gprs := { |
| 3262 | gprsmultislotclass := '10010'B, /* MS class 18, supports 8 DL and 8 UL */ |
| 3263 | gprsextendeddynalloccap := '0'B |
| 3264 | }; |
| 3265 | var MSRadioAccessCapabilityV ms_racap := { valueof(ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs, omit)) }; |
| 3266 | |
| 3267 | |
| 3268 | /* Initialize NS/BSSGP side */ |
| 3269 | f_init_bssgp(); |
| 3270 | /* Initialize GPRS MS side */ |
| 3271 | f_init_gprs_ms(); |
| 3272 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3273 | |
| 3274 | /* Only 1 TRX with 8 PDCH */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3275 | f_PCUIF_PDCHMask_set(info_ind, '11111111'B, 0); |
| 3276 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 3277 | |
| 3278 | /* Initialize the PCU interface abstraction */ |
| 3279 | f_init_raw(testcasename(), info_ind); |
| 3280 | |
| 3281 | /* Establish BSSGP connection to the PCU */ |
| 3282 | f_bssgp_establish(); |
| 3283 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3284 | |
| 3285 | /* Send PACKET RESOURCE REQUEST to notify the MultiSlot Class */ |
| 3286 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap)); |
| 3287 | |
| 3288 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3289 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 3290 | |
| 3291 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 3292 | dl_block := f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3293 | if (f_dltbf_num_slots(ms.dl_tbf) != 8) { |
| 3294 | setverdict(fail, "Expected 8 PDCH slot allocated but got ", f_dltbf_num_slots(ms.dl_tbf)); |
| 3295 | f_shutdown(__BFILE__, __LINE__); |
| 3296 | } |
| 3297 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3298 | |
| 3299 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3300 | } |
| 3301 | |
Pau Espin Pedrol | a9f27fa | 2020-10-30 13:16:21 +0100 | [diff] [blame] | 3302 | testcase TC_ul_multislot_tbf_ms_class_from_2phase() runs on RAW_PCU_Test_CT { |
| 3303 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 3304 | var RlcmacDlBlock dl_block; |
| 3305 | var octetstring data := f_rnd_octstring(10); |
| 3306 | var PollFnCtx pollctx; |
| 3307 | var uint32_t sched_fn; |
| 3308 | var GprsMS ms; |
| 3309 | |
| 3310 | var MultislotCap_GPRS mscap_gprs := { |
| 3311 | gprsmultislotclass := '10010'B, /* MS class 18, supports 8 DL and 8 UL */ |
| 3312 | gprsextendeddynalloccap := '0'B |
| 3313 | }; |
| 3314 | var MSRadioAccessCapabilityV ms_racap := { valueof(ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs, omit)) }; |
| 3315 | |
| 3316 | |
| 3317 | /* Initialize NS/BSSGP side */ |
| 3318 | f_init_bssgp(); |
| 3319 | /* Initialize GPRS MS side */ |
| 3320 | f_init_gprs_ms(); |
| 3321 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3322 | |
| 3323 | /* Only 1 TRX with 8 PDCH */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3324 | f_PCUIF_PDCHMask_set(info_ind, '11111111'B, 0); |
| 3325 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | a9f27fa | 2020-10-30 13:16:21 +0100 | [diff] [blame] | 3326 | |
| 3327 | /* Initialize the PCU interface abstraction */ |
| 3328 | f_init_raw(testcasename(), info_ind); |
| 3329 | |
| 3330 | /* Establish BSSGP connection to the PCU */ |
| 3331 | f_bssgp_establish(); |
| 3332 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3333 | |
| 3334 | /* Send PACKET RESOURCE REQUEST to notify the MultiSlot Class */ |
| 3335 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap)); |
| 3336 | |
| 3337 | if (f_ultbf_num_slots(ms.ul_tbf) != 8) { |
| 3338 | setverdict(fail, "Expected 8 PDCH slot allocated but got ", f_ultbf_num_slots(ms.ul_tbf)); |
| 3339 | f_shutdown(__BFILE__, __LINE__); |
| 3340 | } |
| 3341 | |
| 3342 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3343 | } |
| 3344 | |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3345 | /* Test scenario where MS wants to request a new TBF once the current one is |
| 3346 | * ending, by means of sending a Packet Resource Request on ul slot provided by |
| 3347 | * last Pkt Ul ACK's RRBP. |
| 3348 | * See 3GPP TS 44.060 sec 9.3.2.4.2 "Non-extended uplink TBF mode" */ |
| 3349 | testcase TC_ul_tbf_reestablish_with_pkt_resource_req() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3350 | var RlcmacDlBlock dl_block; |
| 3351 | var octetstring data := f_rnd_octstring(10); |
| 3352 | var uint32_t sched_fn; |
| 3353 | var uint32_t dl_fn; |
| 3354 | var template RlcmacDlBlock acknack_tmpl; |
| 3355 | var GprsMS ms; |
| 3356 | |
| 3357 | /* Initialize NS/BSSGP side */ |
| 3358 | f_init_bssgp(); |
| 3359 | /* Initialize GPRS MS side */ |
| 3360 | f_init_gprs_ms(); |
| 3361 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3362 | |
| 3363 | /* Initialize the PCU interface abstraction */ |
| 3364 | f_init_raw(testcasename()); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 3365 | f_statsd_reset(); |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3366 | |
| 3367 | /* Establish BSSGP connection to the PCU */ |
| 3368 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3369 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3370 | |
| 3371 | /* Establish an Uplink TBF */ |
| 3372 | f_ms_establish_ul_tbf(ms); |
| 3373 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 3374 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 3375 | f_ms_wait_usf(ms); |
| 3376 | |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3377 | /* Send one UL block (with TLLI since we are in One-Phase Access |
Pau Espin Pedrol | 15b2b94 | 2022-10-28 15:08:44 +0200 | [diff] [blame] | 3378 | contention resolution) and make sure it is ACKED fine */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 3379 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3380 | |
| 3381 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3382 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3383 | |
| 3384 | acknack_tmpl := tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, |
| 3385 | tr_UlAckNackGprs(ms.tlli, |
| 3386 | tr_AckNackDescription(final_ack := '1'B), |
| 3387 | tr_UlAckNackGprsAdditionsRel99(tbf_est := true))) |
| 3388 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn, acknack_tmpl); |
| 3389 | |
| 3390 | /* TODO: verify TBF_EST and FinalACK are both '1' above */ |
| 3391 | |
| 3392 | /* Send PACKET RESOURCE REQUEST to request a new UL TBF */ |
Vadim Yanitskiy | f3cb4dd | 2020-07-21 01:52:33 +0700 | [diff] [blame] | 3393 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, omit)), sched_fn); |
Vadim Yanitskiy | 7431e9e | 2020-07-21 01:59:17 +0700 | [diff] [blame] | 3394 | f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_UL_PACKET_ASS); |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3395 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3396 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3397 | |
| 3398 | /* Send one UL block (without TLLI since we are in Second-Phase Access) |
| 3399 | and make sure it is ACKED fine */ |
| 3400 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := false); /* TODO: send using cs_mcs */ |
| 3401 | |
| 3402 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3403 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3404 | |
| 3405 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn, acknack_tmpl); |
| 3406 | /* ACK the ACK */ |
| 3407 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3408 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 3409 | var StatsDExpects expect := { |
| 3410 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 1, max := 1 }, |
| 3411 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := 0, max := 0 }, |
| 3412 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := 1, max := 1 }, |
| 3413 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := 0, max := 0 }, |
| 3414 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 1, max := 1 }, |
| 3415 | { name := "TTCN3.bts.0.immediate.assignment_ul.one_phase", mtype := "c", min := 1, max := 1 }, |
| 3416 | { name := "TTCN3.bts.0.immediate.assignment_ul.two_phase", mtype := "c", min := 0, max := 0 }, |
| 3417 | { name := "TTCN3.bts.0.immediate.assignment_ul.contention_resolution_success", mtype := "c", min := 1, max := 1 }, |
| 3418 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 }, |
| 3419 | { name := "TTCN3.bts.0.pkt.ul_assignment", mtype := "c", min := 1, max := 1 } |
| 3420 | }; |
| 3421 | f_statsd_expect(expect); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 3422 | |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3423 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3424 | } |
| 3425 | |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3426 | /* Test scenario where MS wants to request a new TBF once the current one is |
| 3427 | * ending, by means of sending a Packet Resource Request on ul slot provided by |
| 3428 | * last Pkt Ul ACK's RRBP. new Pkt Ul Ass is never confirmed by the MS in this test. |
| 3429 | * See 3GPP TS 44.060 sec 9.3.2.4.2 "Non-extended uplink TBF mode" */ |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3430 | testcase TC_ul_tbf_reestablish_with_pkt_resource_req_t3168() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3431 | var PCUIF_info_ind info_ind; |
| 3432 | var RlcmacDlBlock dl_block; |
| 3433 | var octetstring data := f_rnd_octstring(10); |
| 3434 | var uint32_t sched_fn; |
| 3435 | var uint32_t dl_fn; |
| 3436 | var template (value) TsTrxBtsNum nr; |
| 3437 | var BTS_PDTCH_Block data_msg; |
| 3438 | var template RlcmacDlBlock acknack_tmpl; |
| 3439 | var GprsMS ms; |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3440 | var integer cnt_rrbp := 0; |
| 3441 | var integer cnt_dummy_after_timeout := 0; |
| 3442 | /* Maximum T3168 value = 8 * 500 ms = 4s => * 4 retrans = 16s */ |
| 3443 | timer T_3168 := 16.0 + 0.5; /* 0.5: extra offset since we cannot match exactly */ |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3444 | |
| 3445 | /* Initialize NS/BSSGP side */ |
| 3446 | f_init_bssgp(); |
| 3447 | /* Initialize GPRS MS side */ |
| 3448 | f_init_gprs_ms(); |
| 3449 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3450 | |
| 3451 | /* Initialize the PCU interface abstraction */ |
| 3452 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3453 | /* TODO: Speedup test by sending a PCU_IF_SAPI_BCCH SI13 with T3168=0 (500ms) */ |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3454 | f_init_raw(testcasename(), info_ind); |
| 3455 | |
| 3456 | /* Establish BSSGP connection to the PCU */ |
| 3457 | f_bssgp_establish(); |
| 3458 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3459 | |
| 3460 | /* Establish an Uplink TBF */ |
| 3461 | f_ms_establish_ul_tbf(ms); |
| 3462 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 3463 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 3464 | f_ms_wait_usf(ms); |
| 3465 | |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3466 | /* Send one UL block (with TLLI since we are in One-Phase Access |
Pau Espin Pedrol | 15b2b94 | 2022-10-28 15:08:44 +0200 | [diff] [blame] | 3467 | contention resolution) and make sure it is ACKED fine */ |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3468 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
| 3469 | |
| 3470 | /* UL block should be received in SGSN */ |
| 3471 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
| 3472 | |
| 3473 | acknack_tmpl := tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, |
| 3474 | tr_UlAckNackGprs(ms.tlli, |
| 3475 | tr_AckNackDescription(final_ack := '1'B), |
| 3476 | tr_UlAckNackGprsAdditionsRel99(tbf_est := true))) |
| 3477 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn, acknack_tmpl); |
| 3478 | |
| 3479 | /* TODO: verify TBF_EST and FinalACK are both '1' above */ |
| 3480 | |
| 3481 | /* Send PACKET RESOURCE REQUEST to request a new UL TBF */ |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3482 | T_3168.start; |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3483 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, omit)), sched_fn); |
| 3484 | |
| 3485 | /* Now Keep ignoring the Pkt Ul Ass on PACCH: */ |
| 3486 | /* Now we go on receiving DL data and not answering RRBP: */ |
| 3487 | nr := ts_TsTrxBtsNum; |
| 3488 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 3489 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 3490 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 3491 | block_nr := nr.blk_nr)); |
| 3492 | alt { |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3493 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3494 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 3495 | tr_RLCMAC_UL_PACKET_ASS)) -> value data_msg { |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3496 | /* We should not be receiving PKT UL ASS anymore after T3168 timeout */ |
| 3497 | if (not T_3168.running) { |
| 3498 | setverdict(fail, log2str("Unexpected PKT UL ASS after T3168 timeout: ", data_msg)); |
| 3499 | f_shutdown(__BFILE__, __LINE__); |
| 3500 | } |
| 3501 | |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3502 | if (f_dl_block_rrbp_valid(data_msg.dl_block)) { |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3503 | log("Ignoring RRBP ", cnt_rrbp); |
| 3504 | cnt_rrbp := cnt_rrbp + 1; |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3505 | } |
| 3506 | nr := ts_TsTrxBtsNum; |
| 3507 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 3508 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 3509 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 3510 | block_nr := nr.blk_nr)); |
| 3511 | repeat; |
| 3512 | } |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3513 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3514 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
Vadim Yanitskiy | 7179d3e | 2022-10-04 03:27:29 +0700 | [diff] [blame] | 3515 | tr_RLCMAC_DL_DUMMY_CTRL)) -> value data_msg { |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3516 | nr := ts_TsTrxBtsNum; |
| 3517 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 3518 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 3519 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 3520 | block_nr := nr.blk_nr)); |
| 3521 | repeat; |
| 3522 | } |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3523 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3524 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 3525 | omit)) -> value data_msg { |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3526 | |
| 3527 | /* T3168 expired and we are not receiving blocks anymore, meaning PCU released the TBF. */ |
| 3528 | break; |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3529 | } |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3530 | [] BTS.receive { |
| 3531 | setverdict(fail, "Unexpected BTS message"); |
| 3532 | f_shutdown(__BFILE__, __LINE__); |
| 3533 | } |
| 3534 | } |
| 3535 | |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3536 | /* Check that we received at least a few PKT UL ASS before T3168 expiration */ |
| 3537 | if (cnt_rrbp <= 3) { |
| 3538 | setverdict(fail, log2str("Received only ", cnt_rrbp, " before T3168 timeout!")); |
| 3539 | f_shutdown(__BFILE__, __LINE__); |
| 3540 | } |
| 3541 | |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3542 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3543 | } |
| 3544 | |
Pau Espin Pedrol | 59aa109 | 2021-11-15 18:53:34 +0100 | [diff] [blame] | 3545 | /* Test scenario where MS wants to request a new UL TBF using a DL (EGPRS) ACK/NACK |
| 3546 | * transmitted on ul slot provided by its DL TBF. |
| 3547 | * See 3GPP TS 44.060 sec 9.3.2.4.2 "Non-extended uplink TBF mode" */ |
| 3548 | function f_TC_ul_tbf_reestablish_with_pkt_dl_ack_nack(boolean use_egprs) runs on RAW_PCU_Test_CT { |
| 3549 | var GprsMS ms; |
| 3550 | var octetstring data := f_rnd_octstring(10); |
| 3551 | var RlcmacDlBlock dl_block; |
| 3552 | var template RlcmacDlBlock rej_tmpl; |
| 3553 | var uint32_t dl_fn; |
| 3554 | var uint32_t sched_fn; |
| 3555 | var template (value) MSRadioAccessCapabilityV_BSSGP racap_tmpl; |
| 3556 | |
| 3557 | if (use_egprs == true) { |
| 3558 | racap_tmpl := bssgp_ms_racap_egprs_def; |
| 3559 | } else { |
| 3560 | racap_tmpl := bssgp_ms_racap_gprs_def; |
| 3561 | } |
| 3562 | |
| 3563 | /* Initialize NS/BSSGP side */ |
| 3564 | f_init_bssgp(); |
| 3565 | /* Initialize GPRS MS side */ |
| 3566 | f_init_gprs_ms(); |
| 3567 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3568 | /* Initialize the PCU interface abstraction */ |
| 3569 | f_init_raw(testcasename()); |
| 3570 | |
| 3571 | /* Establish BSSGP connection to the PCU */ |
| 3572 | f_bssgp_establish(); |
| 3573 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3574 | |
| 3575 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 3576 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, racap_tmpl)); |
| 3577 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 3578 | |
| 3579 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 3580 | f_sleep(X2002); |
| 3581 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 3582 | |
| 3583 | /* ACK the DL block, asking for new UL TBF by including ChanReqDesc */ |
| 3584 | f_dltbf_ack_block(ms.dl_tbf, dl_block, '1'B); |
| 3585 | f_ms_tx_ul_block(ms, f_dltbf_ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf, use_egprs, ts_ChannelReqDescription()), |
| 3586 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 3587 | |
| 3588 | /* We should receive a Pkt Ul ASS */ |
| 3589 | f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_UL_PACKET_ASS); |
| 3590 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3591 | } |
| 3592 | testcase TC_ul_tbf_reestablish_with_pkt_dl_ack_nack() runs on RAW_PCU_Test_CT { |
| 3593 | f_TC_ul_tbf_reestablish_with_pkt_dl_ack_nack(false); |
| 3594 | } |
| 3595 | testcase TC_ul_tbf_reestablish_with_pkt_dl_ack_nack_egprs() runs on RAW_PCU_Test_CT { |
| 3596 | f_TC_ul_tbf_reestablish_with_pkt_dl_ack_nack(true); |
| 3597 | } |
| 3598 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3599 | /* Test CS paging over the BTS<->PCU socket. |
| 3600 | * When a (class B or C, not A) MS has an active TBF (or is on the PDCH), the MS can not react on CS paging over CCCH. |
| 3601 | * Paging should be send on the PACCH. |
| 3602 | * |
| 3603 | * 1. Send a Paging Request over PCU socket. |
| 3604 | * 2. Send a Ready-To-Send message over PCU socket |
| 3605 | * 3. Expect a Paging Frame |
| 3606 | */ |
| 3607 | testcase TC_paging_cs_from_bts() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3608 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3609 | var MobileIdentityLV mi; |
| 3610 | var octetstring mi_enc_lv; |
| 3611 | var hexstring imsi := f_gen_imsi(42); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3612 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3613 | |
| 3614 | /* Initialize NS/BSSGP side */ |
| 3615 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3616 | /* Initialize GPRS MS side */ |
| 3617 | f_init_gprs_ms(); |
| 3618 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3619 | |
| 3620 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3621 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3622 | |
| 3623 | /* Establish BSSGP connection to the PCU */ |
| 3624 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3625 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3626 | |
| 3627 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3628 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3629 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 3630 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 3631 | f_ms_wait_usf(ms); |
| 3632 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3633 | /* build mobile Identity */ |
| 3634 | mi := valueof(ts_MI_IMSI_LV(imsi)); |
| 3635 | mi_enc_lv := enc_MobileIdentityLV(mi); |
| 3636 | /* Send paging request */ |
| 3637 | BTS.send(ts_PCUIF_PAG_REQ(bts_nr := 0, id_lv := mi_enc_lv, chan_needed := 0, |
| 3638 | sapi :=PCU_IF_SAPI_PDTCH)); |
| 3639 | |
| 3640 | /* Receive it on BTS side towards MS */ |
| 3641 | f_rx_rlcmac_dl_block_exp_pkt_pag_req(dl_block); |
| 3642 | |
| 3643 | /* Make sure that Packet Paging Request contains the same IMSI */ |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3644 | var PacketPagingReq req := dl_block.ctrl.payload.u.paging; |
| 3645 | if (not f_pkt_paging_match_imsi(req, imsi, ps_domain := false)) { |
| 3646 | setverdict(fail, "Failed to match IMSI ", imsi, " in ", req); |
| 3647 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3648 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3649 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3650 | } |
| 3651 | |
| 3652 | /* Test CS paging over Gb (SGSN->PCU->BTS[PDCH]). |
| 3653 | */ |
| 3654 | private function f_tc_paging_cs_from_sgsn(Nsvci bvci, boolean use_ptmsi := false) |
| 3655 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3656 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3657 | var hexstring imsi := f_gen_imsi(42); |
| 3658 | var GsmTmsi tmsi; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3659 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3660 | |
| 3661 | /* Initialize NS/BSSGP side */ |
| 3662 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3663 | /* Initialize GPRS MS side */ |
| 3664 | f_init_gprs_ms(); |
| 3665 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3666 | |
| 3667 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3668 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3669 | |
| 3670 | /* Establish BSSGP connection to the PCU */ |
| 3671 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3672 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3673 | |
| 3674 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3675 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3676 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 3677 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 3678 | f_ms_wait_usf(ms); |
| 3679 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3680 | /* Send paging request with or without TMSI */ |
| 3681 | if (use_ptmsi) { |
| 3682 | tmsi := oct2int(f_rnd_octstring(4)); /* Random P-TMSI */ |
| 3683 | BSSGP[0].send(ts_BSSGP_CS_PAGING_PTMSI(bvci, imsi, tmsi)); |
| 3684 | } else { |
| 3685 | BSSGP[0].send(ts_BSSGP_CS_PAGING_IMSI(bvci, imsi)); |
| 3686 | } |
| 3687 | |
Pau Espin Pedrol | 00fec58 | 2022-11-29 16:03:13 +0100 | [diff] [blame] | 3688 | /* Now receive it on BTS side towards MS. |
| 3689 | * Skip any dummy blocks in case the PCUIF req arrives before the BSSP CS_PAGING: |
| 3690 | */ |
| 3691 | f_rx_rlcmac_dl_block_skip_dummy(dl_block, max_dummy := 10); |
| 3692 | |
| 3693 | if (not match(dl_block, tr_RLCMAC_PACKET_PAG_REQ())) { |
| 3694 | setverdict(fail, "Failed to match Packet Paging Request: ", |
| 3695 | dl_block, " vs ", tr_RLCMAC_PACKET_PAG_REQ()); |
| 3696 | f_shutdown(__BFILE__, __LINE__); |
| 3697 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3698 | |
| 3699 | /* Make sure that Packet Paging Request contains the same P-TMSI/IMSI */ |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3700 | var PacketPagingReq req := dl_block.ctrl.payload.u.paging; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3701 | if (use_ptmsi) { |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3702 | if (not f_pkt_paging_match_tmsi(req, tmsi, ps_domain := false)) { |
| 3703 | setverdict(fail, "Failed to match P-TMSI ", tmsi, " in ", req); |
| 3704 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3705 | } else { |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3706 | if (not f_pkt_paging_match_imsi(req, imsi, ps_domain := false)) { |
| 3707 | setverdict(fail, "Failed to match IMSI ", imsi, " in ", req); |
| 3708 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3709 | } |
| 3710 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3711 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3712 | } |
| 3713 | |
| 3714 | testcase TC_paging_cs_from_sgsn_sign_ptmsi() runs on RAW_PCU_Test_CT { |
| 3715 | f_tc_paging_cs_from_sgsn(0, true); |
| 3716 | } |
| 3717 | |
| 3718 | testcase TC_paging_cs_from_sgsn_sign() runs on RAW_PCU_Test_CT { |
| 3719 | f_tc_paging_cs_from_sgsn(0); |
| 3720 | } |
| 3721 | |
| 3722 | testcase TC_paging_cs_from_sgsn_ptp() runs on RAW_PCU_Test_CT { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3723 | f_tc_paging_cs_from_sgsn(mp_gb_cfg.bvc[0].bvci); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3724 | } |
| 3725 | |
| 3726 | /* Test PS paging over Gb (SGSN->PCU->BTS[CCCH]). |
| 3727 | */ |
| 3728 | private function f_tc_paging_ps_from_sgsn(Nsvci bvci, boolean use_ptmsi := false) |
| 3729 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3730 | var integer imsi_suff_tx := 423; |
| 3731 | var hexstring imsi := f_gen_imsi(imsi_suff_tx); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3732 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3733 | |
| 3734 | /* Initialize NS/BSSGP side */ |
| 3735 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3736 | /* Initialize GPRS MS side */ |
| 3737 | f_init_gprs_ms(); |
| 3738 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3739 | |
Oliver Smith | 61b4e73 | 2021-07-22 08:14:29 +0200 | [diff] [blame] | 3740 | f_statsd_reset(); |
| 3741 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3742 | /* Establish BSSGP connection to the PCU */ |
| 3743 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3744 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3745 | |
| 3746 | /* Send BSSGP PAGING-PS (with or without TMSI), wait for RR Paging Request Type 1. |
| 3747 | * Make sure that both paging group (IMSI suffix) and Mobile Identity match. */ |
| 3748 | if (use_ptmsi) { |
| 3749 | var OCT4 tmsi := f_rnd_octstring(4); /* Random P-TMSI */ |
| 3750 | BSSGP[0].send(ts_BSSGP_PS_PAGING_PTMSI(bvci, imsi, oct2int(tmsi))); |
| 3751 | f_pcuif_rx_pch_pag_req1(t_MI_TMSI(tmsi), imsi_suff_tx); |
| 3752 | } else { |
| 3753 | BSSGP[0].send(ts_BSSGP_PS_PAGING_IMSI(bvci, imsi)); |
| 3754 | f_pcuif_rx_pch_pag_req1(tr_MI_IMSI(imsi), imsi_suff_tx); |
| 3755 | } |
| 3756 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 3757 | var StatsDExpects expect := { |
| 3758 | { name := "TTCN3.pcu.sgsn.0.rx_paging_ps", mtype := "c", min := 1, max := 1 }, |
| 3759 | /* After the PCU receives the paging request from SGSN, |
| 3760 | * and it doesn't have any errors, PCU sends it to the |
| 3761 | * BTS to do paging over PCH. */ |
| 3762 | { name := "TTCN3.bts.0.pch.requests", mtype := "c", min := 1, max := 1 } |
| 3763 | }; |
| 3764 | f_statsd_expect(expect); |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3765 | } |
| 3766 | |
| 3767 | testcase TC_paging_ps_from_sgsn_sign_ptmsi() runs on RAW_PCU_Test_CT { |
| 3768 | /* Initialize the PCU interface abstraction */ |
| 3769 | f_init_raw(testcasename()); |
| 3770 | |
| 3771 | f_tc_paging_ps_from_sgsn(0, true); |
Oliver Smith | 61b4e73 | 2021-07-22 08:14:29 +0200 | [diff] [blame] | 3772 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3773 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3774 | } |
| 3775 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3776 | testcase TC_paging_ps_from_sgsn_sign() runs on RAW_PCU_Test_CT { |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3777 | /* Initialize the PCU interface abstraction */ |
| 3778 | f_init_raw(testcasename()); |
| 3779 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3780 | f_tc_paging_ps_from_sgsn(0); |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3781 | |
| 3782 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3783 | } |
| 3784 | |
| 3785 | testcase TC_paging_ps_from_sgsn_ptp() runs on RAW_PCU_Test_CT { |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3786 | /* Initialize the PCU interface abstraction */ |
| 3787 | f_init_raw(testcasename()); |
| 3788 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3789 | f_tc_paging_ps_from_sgsn(mp_gb_cfg.bvc[0].bvci); |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3790 | |
| 3791 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3792 | } |
| 3793 | |
Oliver Smith | e1a77c4 | 2021-07-28 13:36:09 +0200 | [diff] [blame] | 3794 | testcase TC_paging_pch_timeout() runs on RAW_PCU_Test_CT { |
| 3795 | /* Initialize the PCU interface abstraction */ |
| 3796 | f_init_raw(testcasename()); |
| 3797 | |
| 3798 | /* Set T3113 to 1s to shorten the test duration */ |
| 3799 | f_vty_config2(PCUVTY, {"pcu"}, "timer T3113 1"); |
| 3800 | |
| 3801 | /* Reset stats and send paging PS request */ |
| 3802 | f_tc_paging_ps_from_sgsn(mp_gb_cfg.bvc[0].bvci); |
| 3803 | |
| 3804 | /* Verify that counter increases when T3113 times out (MS did not start |
| 3805 | * TBF to respond to paging). */ |
| 3806 | f_sleep(1.2); |
| 3807 | var StatsDExpects expect := { |
| 3808 | { name := "TTCN3.bts.0.pch.requests.timeout", mtype := "c", min := 1, max := 1 } |
| 3809 | }; |
| 3810 | f_statsd_expect(expect); |
| 3811 | |
| 3812 | f_vty_config2(PCUVTY, {"pcu"}, "timer T3113 default"); |
| 3813 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3814 | } |
| 3815 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3816 | /* Verify osmo-pcu handles DL UNIT_DATA from SGSN with IMSI IE correctly. See OS#4729 */ |
| 3817 | testcase TC_bssgp_dl_unitdata_with_valid_imsi() runs on RAW_PCU_Test_CT { |
| 3818 | var RlcmacDlBlock dl_block; |
| 3819 | var octetstring data := f_rnd_octstring(10); |
| 3820 | var uint32_t sched_fn; |
| 3821 | var uint32_t dl_fn; |
| 3822 | var GprsMS ms; |
| 3823 | |
| 3824 | /* Initialize NS/BSSGP side */ |
| 3825 | f_init_bssgp(); |
| 3826 | /* Initialize GPRS MS side */ |
| 3827 | f_init_gprs_ms(); |
| 3828 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3829 | |
| 3830 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3831 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3832 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 3833 | f_statsd_reset(); |
| 3834 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3835 | /* Establish BSSGP connection to the PCU */ |
| 3836 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3837 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3838 | |
| 3839 | /* Establish an Uplink TBF */ |
| 3840 | f_ms_establish_ul_tbf(ms); |
| 3841 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 3842 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 3843 | f_ms_wait_usf(ms); |
| 3844 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3845 | /* Fake GMM GPRS Attach or similar, PCU doesn't care about upper layers here */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 3846 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3847 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 3848 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3849 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3850 | |
| 3851 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3852 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3853 | |
| 3854 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 3855 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi))); |
| 3856 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 3857 | |
| 3858 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 3859 | f_sleep(X2002); |
| 3860 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 3861 | |
| 3862 | /* ACK the DL block */ |
| 3863 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 3864 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 3865 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 3866 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 3867 | var StatsDExpects expect := { |
| 3868 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 1, max := 1}, |
| 3869 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 1, max := 1}, |
| 3870 | { name := "TTCN3.bts.0.tbf.dl.alloc", mtype := "c", min := 1, max := 1}, |
| 3871 | { name := "TTCN3.bts.0.tbf.ul.alloc", mtype := "c", min := 1, max := 1}, |
Pau Espin Pedrol | 0bf74e5 | 2020-12-11 19:25:42 +0100 | [diff] [blame] | 3872 | { name := "TTCN3.bts.0.rlc.dl_payload_bytes", mtype := "c", min := 10, max := 10}, |
Pau Espin Pedrol | 599d56b | 2020-11-17 12:01:46 +0100 | [diff] [blame] | 3873 | { name := "TTCN3.bts.0.rlc.ul_payload_bytes", mtype := "c", min := 26, max := 26} |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 3874 | }; |
| 3875 | f_statsd_expect(expect); |
| 3876 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3877 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3878 | } |
| 3879 | |
| 3880 | /* Verify osmo-pcu acts on incorrect IMSI IE content in DL UNIT_DATA from SGSN. See OS#4729 */ |
| 3881 | testcase TC_bssgp_dl_unitdata_with_invalid_imsi() runs on RAW_PCU_Test_CT { |
| 3882 | var RlcmacDlBlock dl_block; |
| 3883 | var octetstring data := f_rnd_octstring(10); |
| 3884 | var uint32_t sched_fn; |
| 3885 | var uint32_t dl_fn; |
| 3886 | var GprsMS ms; |
| 3887 | |
| 3888 | /* Initialize NS/BSSGP side */ |
| 3889 | f_init_bssgp(); |
| 3890 | /* Initialize GPRS MS side */ |
| 3891 | f_init_gprs_ms(); |
| 3892 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3893 | |
| 3894 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3895 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3896 | |
| 3897 | /* Establish BSSGP connection to the PCU */ |
| 3898 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3899 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3900 | |
| 3901 | /* Establish an Uplink TBF */ |
| 3902 | f_ms_establish_ul_tbf(ms); |
| 3903 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 3904 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 3905 | f_ms_wait_usf(ms); |
| 3906 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3907 | /* Fake GMM GPRS Attach or similar, PCU doesn't care about upper layers here */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 3908 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3909 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 3910 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3911 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3912 | |
| 3913 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3914 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3915 | |
| 3916 | /* Now SGSN sends some DL data with an invalid IMSI */ |
| 3917 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI('1122'H))); |
| 3918 | |
Pau Espin Pedrol | f7e947a | 2021-01-25 18:51:33 +0100 | [diff] [blame] | 3919 | BSSGP_GLOBAL[0].receive(tr_BSSGP_STATUS(omit, BSSGP_CAUSE_CONDITIONAL_IE_ERROR, ?)); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3920 | |
| 3921 | /* TODO: make sure no data is sent over PCU -> MS */ |
| 3922 | |
| 3923 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3924 | } |
| 3925 | |
Pau Espin Pedrol | 2e459d6 | 2020-11-30 19:34:16 +0100 | [diff] [blame] | 3926 | private function f_tc_dl_data_no_llc_ui_dummy(template (omit) MSRadioAccessCapabilityV_BSSGP ms_racap := omit) runs on RAW_PCU_Test_CT { |
| 3927 | var AckNackDescription ack_nack_desc := valueof(t_AckNackDescription_init); |
| 3928 | var octetstring data := f_rnd_octstring(6); |
| 3929 | var RlcmacDlBlock dl_block; |
| 3930 | var GprsMS ms; |
| 3931 | var uint32_t fn; |
| 3932 | |
| 3933 | /* Initialize NS/BSSGP side */ |
| 3934 | f_init_bssgp(); |
| 3935 | /* Initialize GPRS MS side */ |
| 3936 | f_init_gprs_ms(); |
| 3937 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3938 | |
| 3939 | /* Initialize the PCU interface abstraction */ |
| 3940 | f_init_raw(testcasename()); |
| 3941 | |
| 3942 | /* Establish BSSGP connection to the PCU */ |
| 3943 | f_bssgp_establish(); |
| 3944 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3945 | |
| 3946 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 3947 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap)); |
| 3948 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 3949 | |
| 3950 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 3951 | f_sleep(X2002); |
| 3952 | |
| 3953 | /* Expect the first (GPRS DL) block with bsn=0 and rrbp_valid=1 */ |
| 3954 | f_rx_rlcmac_dl_block_exp_data(dl_block, fn, data, 0); |
| 3955 | |
| 3956 | if (ischosen(dl_block.data_egprs)) { |
| 3957 | if (lengthof(dl_block.data_egprs.blocks) != 2) { |
| 3958 | setverdict(fail, "DL EGPRS block has unexpected number of LLC frames: ", dl_block.data_egprs); |
| 3959 | f_shutdown(__BFILE__, __LINE__); |
| 3960 | } |
| 3961 | if (dl_block.data_egprs.blocks[1].hdr.length_ind != 127) { |
| 3962 | setverdict(fail, "DL EGPRS block 2nd llc frame is not padding!: ", dl_block.data_egprs); |
| 3963 | f_shutdown(__BFILE__, __LINE__); |
| 3964 | } |
| 3965 | if (not match(dl_block.data_egprs.blocks[1].payload, |
| 3966 | f_pad_oct(''O, lengthof(dl_block.data_egprs.blocks[1].payload), '2B'O))) { |
| 3967 | setverdict(fail, "DL EGPRS block 2nd llc frame is not padding!: ", dl_block.data_egprs); |
| 3968 | f_shutdown(__BFILE__, __LINE__); |
| 3969 | } |
| 3970 | } else if (lengthof(dl_block.data.blocks) > 1) { |
| 3971 | setverdict(fail, "DL GPRS block has extra unexpected LLC frames: ", dl_block.data); |
| 3972 | f_shutdown(__BFILE__, __LINE__); |
| 3973 | } |
| 3974 | |
| 3975 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3976 | } |
| 3977 | |
| 3978 | /* Verify osmo-pcu Doesn't append LLC UI dummy frames to rlcmac blocks |
| 3979 | * containing llc data. See OS#4849 */ |
| 3980 | testcase TC_dl_gprs_data_no_llc_ui_dummy() runs on RAW_PCU_Test_CT { |
| 3981 | f_tc_dl_data_no_llc_ui_dummy(omit); |
| 3982 | } |
| 3983 | |
| 3984 | /* Verify osmo-pcu Doesn't append LLC UI dummy frames to rlcmac blocks |
| 3985 | * containing llc data. See OS#4849 */ |
| 3986 | testcase TC_dl_egprs_data_no_llc_ui_dummy() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 3987 | f_tc_dl_data_no_llc_ui_dummy(bssgp_ms_racap_egprs_def); |
Pau Espin Pedrol | 2e459d6 | 2020-11-30 19:34:16 +0100 | [diff] [blame] | 3988 | } |
| 3989 | |
Pau Espin Pedrol | 0b6b0d0 | 2022-10-25 21:21:02 +0200 | [diff] [blame] | 3990 | /* Scenario: MS creates one phase access, does contention resolution CV>0 and |
| 3991 | * finishes sending data (CV=0), which is forwarded to SGSN by PCU. PCU acks with |
| 3992 | * FINAL_ACK=1 (hence UL TBF moves to FINISHED state). Then SGSN answers and PCU |
| 3993 | * has to assign a DL TBF (through PCH because of FINISHED state, TS 44.060 9.3.3.3.2). |
| 3994 | * Make sure the assignment is not done until we receive the PKT CTRL ACK from the MS |
| 3995 | * (at that time we know the MS is listening on PCH again). OS#5700. |
| 3996 | */ |
| 3997 | testcase TC_ul_tbf_finished_pkt_dl_ass_pch() runs on RAW_PCU_Test_CT { |
| 3998 | var RlcmacDlBlock dl_block; |
| 3999 | var octetstring data := f_rnd_octstring(10); |
| 4000 | var uint32_t sched_fn; |
| 4001 | var uint32_t dl_fn; |
| 4002 | var GprsMS ms; |
| 4003 | timer T; |
| 4004 | var octetstring payload; |
| 4005 | |
| 4006 | /* Initialize NS/BSSGP side */ |
| 4007 | f_init_bssgp(); |
| 4008 | /* Initialize GPRS MS side */ |
| 4009 | f_init_gprs_ms(); |
| 4010 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4011 | |
| 4012 | /* Initialize the PCU interface abstraction */ |
| 4013 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 4014 | |
| 4015 | /* Establish BSSGP connection to the PCU */ |
| 4016 | f_bssgp_establish(); |
| 4017 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4018 | |
| 4019 | /* Establish an Uplink TBF */ |
| 4020 | f_ms_establish_ul_tbf(ms); |
| 4021 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 4022 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 4023 | f_ms_wait_usf(ms); |
| 4024 | |
Pau Espin Pedrol | 0b6b0d0 | 2022-10-25 21:21:02 +0200 | [diff] [blame] | 4025 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 4026 | contention resolution) and make sure it is ACKED fine. */ |
| 4027 | payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true)); |
| 4028 | dl_fn := f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 4029 | f_ms_tx_ul_data_block(ms, payload, cv := 1, with_tlli := true, fn := f_next_pdch_block(dl_fn)); |
| 4030 | |
| 4031 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4032 | payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, false)); |
| 4033 | f_ms_tx_ul_data_block(ms, payload, cv := 0); |
| 4034 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4035 | |
| 4036 | /* 1 UL block should be received in SGSN */ |
| 4037 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
| 4038 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 4039 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 4040 | |
| 4041 | /* UL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4042 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4043 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 4044 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 4045 | f_sleep(X2002); |
| 4046 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 4047 | |
| 4048 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4049 | } |
| 4050 | |
Pau Espin Pedrol | 99e00b4 | 2022-10-28 13:28:52 +0200 | [diff] [blame] | 4051 | /* Scenario: MS creates a UL TBF and |
| 4052 | * finishes sending data (CV=0), which is forwarded to SGSN by PCU. PCU acks with |
| 4053 | * FINAL_ACK=1 (hence UL TBF moves to FINISHED state). Then SGSN answers and PCU |
| 4054 | * has to assign a DL TBF on PCH. While the network is waiting for the MS to |
| 4055 | * move to PDCH before transmitting DL data (timer X2002), the MS finds out it |
| 4056 | * needs to send new UL data and hence sends a RACH request to create a new UL |
| 4057 | * TBF. |
| 4058 | * Make sure the the MS is assigned a DL TBF through PACCH in that case even if |
| 4059 | * no new DL data is received from the SGSN. OS#5700. |
| 4060 | * This test validates the specific case where the 2nd UL TBF is done through |
| 4061 | * 1phase-access. |
| 4062 | */ |
| 4063 | testcase TC_ul_tbf_1phase_while_dl_ass_pch() runs on RAW_PCU_Test_CT { |
| 4064 | var RlcmacDlBlock dl_block; |
| 4065 | var octetstring data := f_rnd_octstring(10); |
| 4066 | var uint32_t sched_fn; |
| 4067 | var uint32_t poll_fn; |
| 4068 | var uint32_t dl_fn; |
| 4069 | var GprsMS ms; |
| 4070 | timer T; |
| 4071 | var octetstring payload; |
| 4072 | |
| 4073 | /* Initialize NS/BSSGP side */ |
| 4074 | f_init_bssgp(); |
| 4075 | /* Initialize GPRS MS side */ |
| 4076 | f_init_gprs_ms(); |
| 4077 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4078 | |
| 4079 | /* Initialize the PCU interface abstraction */ |
| 4080 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 4081 | |
| 4082 | /* Establish BSSGP connection to the PCU */ |
| 4083 | f_bssgp_establish(); |
| 4084 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4085 | |
| 4086 | /* Establish an Uplink TBF */ |
| 4087 | f_ms_establish_ul_tbf(ms); |
| 4088 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 4089 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 4090 | f_ms_wait_usf(ms); |
| 4091 | |
Pau Espin Pedrol | 99e00b4 | 2022-10-28 13:28:52 +0200 | [diff] [blame] | 4092 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 4093 | contention resolution) and make sure it is ACKED fine. */ |
| 4094 | payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true)); |
| 4095 | dl_fn := f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 4096 | f_ms_tx_ul_data_block(ms, payload, cv := 1, with_tlli := true, fn := f_next_pdch_block(dl_fn)); |
| 4097 | |
| 4098 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4099 | payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, false)); |
| 4100 | f_ms_tx_ul_data_block(ms, payload, cv := 0); |
| 4101 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4102 | |
| 4103 | /* 1 UL block should be received in SGSN */ |
| 4104 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
| 4105 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 4106 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 4107 | |
| 4108 | /* UL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4109 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4110 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 4111 | |
| 4112 | /* Now the PCU is waiting for the MS to move to PDCH in order to send data to it (timer X2002). |
| 4113 | * The MS decides it want to send new Ul TBF so it send RACH req to ask for it: */ |
| 4114 | f_ms_establish_ul_tbf(ms); |
| 4115 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 4116 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 4117 | dl_fn := f_ms_wait_usf(ms); |
| 4118 | |
Pau Espin Pedrol | 99e00b4 | 2022-10-28 13:28:52 +0200 | [diff] [blame] | 4119 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 4120 | * contention resolution) and make sure it is ACKED fine. */ |
| 4121 | payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true)); |
Pau Espin Pedrol | 99e00b4 | 2022-10-28 13:28:52 +0200 | [diff] [blame] | 4122 | f_ms_tx_ul_data_block(ms, payload, cv := 1, with_tlli := true, fn := f_next_pdch_block(dl_fn)); |
| 4123 | |
| 4124 | /* UL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4125 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4126 | |
| 4127 | /* The PCU considers the MS to have gone over Contention Resolution |
| 4128 | * after having sent the first UL ACK/NACK to it, hence next it will try to |
| 4129 | * assign the DL-TBF to send the data it received from the SGSN previously: */ |
| 4130 | f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 4131 | /* the MS ACKs the PKT_DL_ASS: */ |
| 4132 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), poll_fn); |
| 4133 | |
| 4134 | /* We should finally receive the DL-data that was received previously from the SGSN: */ |
| 4135 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 4136 | |
| 4137 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4138 | } |
| 4139 | |
| 4140 | /* Same as TC_ul_tbf_2phase_while_dl_ass_pch, but this test validates the |
| 4141 | * specific case where the 2nd UL TBF is done through 2phase-access. */ |
| 4142 | testcase TC_ul_tbf_2phase_while_dl_ass_pch() runs on RAW_PCU_Test_CT { |
| 4143 | var RlcmacDlBlock dl_block; |
| 4144 | var octetstring data := f_rnd_octstring(10); |
| 4145 | var uint32_t sched_fn; |
| 4146 | var uint32_t poll_fn; |
| 4147 | var uint32_t dl_fn; |
| 4148 | var GprsMS ms; |
| 4149 | timer T; |
| 4150 | var octetstring payload; |
| 4151 | var PollFnCtx pollctx; |
| 4152 | |
| 4153 | /* Initialize NS/BSSGP side */ |
| 4154 | f_init_bssgp(); |
| 4155 | /* Initialize GPRS MS side */ |
| 4156 | f_init_gprs_ms(); |
| 4157 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4158 | |
| 4159 | /* Initialize the PCU interface abstraction */ |
| 4160 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 4161 | |
| 4162 | /* Establish BSSGP connection to the PCU */ |
| 4163 | f_bssgp_establish(); |
| 4164 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4165 | |
| 4166 | /* Establish an Uplink TBF */ |
| 4167 | f_ms_establish_ul_tbf(ms); |
| 4168 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 4169 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 4170 | f_ms_wait_usf(ms); |
| 4171 | |
Pau Espin Pedrol | 99e00b4 | 2022-10-28 13:28:52 +0200 | [diff] [blame] | 4172 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 4173 | contention resolution) and make sure it is ACKED fine. */ |
| 4174 | payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true)); |
| 4175 | dl_fn := f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 4176 | f_ms_tx_ul_data_block(ms, payload, cv := 1, with_tlli := true, fn := f_next_pdch_block(dl_fn)); |
| 4177 | |
| 4178 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4179 | payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, false)); |
| 4180 | f_ms_tx_ul_data_block(ms, payload, cv := 0); |
| 4181 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4182 | |
| 4183 | /* 1 UL block should be received in SGSN */ |
| 4184 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
| 4185 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 4186 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 4187 | |
| 4188 | /* UL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4189 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4190 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 4191 | |
| 4192 | /* Now the PCU is waiting for the MS to move to PDCH in order to send data to it (timer X2002). |
| 4193 | * The MS decides it want to send new Ul TBF so it send RACH req to ask for it: */ |
| 4194 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 4195 | |
| 4196 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4197 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4198 | |
| 4199 | /* Now that MS seized the UL-TBF, PCU sends DL-TBF Assignment on PACCH */ |
| 4200 | f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 4201 | /* the MS ACKs the PKT_DL_ASS: */ |
| 4202 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), poll_fn); |
| 4203 | |
| 4204 | /* We should finally receive the DL-data that was received previously from the SGSN: */ |
| 4205 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 4206 | |
| 4207 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4208 | } |
| 4209 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4210 | private function f_TC_egprs_pkt_chan_req(in EGPRSPktChRequest req, |
Vadim Yanitskiy | 4389390 | 2020-05-29 15:21:50 +0700 | [diff] [blame] | 4211 | template GsmRrMessage t_imm_ass := ?, |
| 4212 | PCUIF_BurstType bt := BURST_TYPE_1) |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4213 | runs on RAW_PCU_Test_CT { |
Vadim Yanitskiy | 4389390 | 2020-05-29 15:21:50 +0700 | [diff] [blame] | 4214 | var GsmRrMessage rr_msg; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4215 | var uint16_t ra11; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4216 | |
| 4217 | ra11 := enc_EGPRSPktChRequest2uint(req); |
| 4218 | log("Sending EGPRS Packet Channel Request (", ra11, "): ", req); |
| 4219 | |
Vadim Yanitskiy | 28d18e1 | 2020-05-29 15:25:59 +0700 | [diff] [blame] | 4220 | rr_msg := f_pcuif_tx_rach_rx_imm_ass(ra := ra11, is_11bit := 1, burst_type := bt); |
Vadim Yanitskiy | 4389390 | 2020-05-29 15:21:50 +0700 | [diff] [blame] | 4221 | if (not match(rr_msg, t_imm_ass)) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4222 | setverdict(fail, "Immediate Assignment does not match"); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 4223 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4224 | } |
| 4225 | |
| 4226 | setverdict(pass); |
| 4227 | } |
| 4228 | |
| 4229 | testcase TC_egprs_pkt_chan_req_signalling() runs on RAW_PCU_Test_CT { |
| 4230 | var template GsmRrMessage imm_ass; |
| 4231 | var template IaRestOctets rest; |
| 4232 | var template EgprsUlAss ul_ass; |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4233 | const integer num_req := 6; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4234 | |
| 4235 | /* Initialize the PCU interface abstraction */ |
| 4236 | f_init_raw(testcasename()); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4237 | f_statsd_reset(); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4238 | |
| 4239 | var EGPRSPktChRequest req := { |
| 4240 | /* NOTE: other fields are set in the loop */ |
| 4241 | signalling := { tag := '110011'B } |
| 4242 | }; |
| 4243 | |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4244 | for (var integer i := 0; i < num_req; i := i + 1) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4245 | var BIT5 ext_ra := int2bit(f_rnd_int(32), 5); |
| 4246 | req.signalling.random_bits := ext_ra; |
| 4247 | |
| 4248 | /* For signalling, do we expect Multiblock UL TBF Assignment? */ |
| 4249 | ul_ass := tr_EgprsUlAssMultiblock(ext_ra := ext_ra); |
| 4250 | rest := tr_IaRestOctets_EGPRSULAss(ul_ass); |
| 4251 | imm_ass := tr_IMM_TBF_ASS(dl := false, rest := rest); |
| 4252 | |
| 4253 | f_TC_egprs_pkt_chan_req(req, imm_ass); |
| 4254 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 4255 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 4256 | var StatsDExpects expect := { |
| 4257 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := num_req, max := num_req }, |
| 4258 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := num_req, max := num_req }, |
| 4259 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := 0, max := 0 }, |
| 4260 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := num_req, max := num_req }, |
| 4261 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := num_req, max := num_req }, |
| 4262 | { name := "TTCN3.bts.0.immediate.assignment_ul.one_phase", mtype := "c", min := 0, max := 0 }, |
| 4263 | { name := "TTCN3.bts.0.immediate.assignment_ul.two_phase", mtype := "c", min := num_req, max := num_req }, |
| 4264 | { name := "TTCN3.bts.0.immediate.assignment_ul.contention_resolution_success", mtype := "c", min := 0, max := 0 }, |
| 4265 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 } |
| 4266 | }; |
| 4267 | f_statsd_expect(expect); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4268 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 4269 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4270 | } |
| 4271 | |
| 4272 | testcase TC_egprs_pkt_chan_req_one_phase() runs on RAW_PCU_Test_CT { |
| 4273 | var template GsmRrMessage imm_ass; |
| 4274 | var template IaRestOctets rest; |
| 4275 | var template EgprsUlAss ul_ass; |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4276 | const integer num_req := 6; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4277 | |
| 4278 | /* Initialize the PCU interface abstraction */ |
| 4279 | f_init_raw(testcasename()); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4280 | f_statsd_reset(); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4281 | |
| 4282 | var EGPRSPktChRequest req := { |
| 4283 | /* NOTE: other fields are set in the loop */ |
| 4284 | one_phase := { tag := '0'B } |
| 4285 | }; |
| 4286 | |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4287 | for (var integer i := 0; i < num_req; i := i + 1) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4288 | var BIT5 ext_ra := int2bit(f_rnd_int(32), 5); |
| 4289 | var BIT5 mslot_class := int2bit(f_rnd_int(32), 5); |
| 4290 | var BIT2 priority := substr(ext_ra, 0, 2); |
| 4291 | var BIT3 rand := substr(ext_ra, 2, 3); |
| 4292 | |
| 4293 | req.one_phase.multislot_class := mslot_class; |
| 4294 | req.one_phase.priority := priority; |
| 4295 | req.one_phase.random_bits := rand; |
| 4296 | |
| 4297 | /* For one phase access, do we expect Dynamic UL TBF Assignment? */ |
| 4298 | ul_ass := tr_EgprsUlAssDynamic(ext_ra := ext_ra); |
| 4299 | rest := tr_IaRestOctets_EGPRSULAss(ul_ass); |
| 4300 | imm_ass := tr_IMM_TBF_ASS(dl := false, rest := rest); |
| 4301 | |
| 4302 | f_TC_egprs_pkt_chan_req(req, imm_ass); |
| 4303 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 4304 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 4305 | var StatsDExpects expect := { |
| 4306 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := num_req, max := num_req }, |
| 4307 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := num_req, max := num_req }, |
| 4308 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := num_req, max := num_req }, |
| 4309 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := 0, max := 0 }, |
| 4310 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := num_req, max := num_req }, |
| 4311 | { name := "TTCN3.bts.0.immediate.assignment_ul.one_phase", mtype := "c", min := num_req, max := num_req }, |
| 4312 | { name := "TTCN3.bts.0.immediate.assignment_ul.two_phase", mtype := "c", min := 0, max := 0 }, |
| 4313 | { name := "TTCN3.bts.0.immediate.assignment_ul.contention_resolution_success", mtype := "c", min := 0, max := 0 }, |
| 4314 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 } |
| 4315 | }; |
| 4316 | f_statsd_expect(expect); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4317 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 4318 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4319 | } |
| 4320 | |
| 4321 | testcase TC_egprs_pkt_chan_req_two_phase() runs on RAW_PCU_Test_CT { |
| 4322 | var template GsmRrMessage imm_ass; |
| 4323 | var template IaRestOctets rest; |
| 4324 | var template EgprsUlAss ul_ass; |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4325 | const integer num_req := 6; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4326 | |
| 4327 | /* Initialize the PCU interface abstraction */ |
| 4328 | f_init_raw(testcasename()); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4329 | f_statsd_reset(); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4330 | |
| 4331 | var EGPRSPktChRequest req := { |
| 4332 | /* NOTE: other fields are set in the loop */ |
| 4333 | two_phase := { tag := '110000'B } |
| 4334 | }; |
| 4335 | |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4336 | for (var integer i := 0; i < num_req; i := i + 1) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4337 | var BIT5 ext_ra := int2bit(f_rnd_int(32), 5); |
| 4338 | var BIT2 priority := substr(ext_ra, 0, 2); |
| 4339 | var BIT3 rand := substr(ext_ra, 2, 3); |
| 4340 | |
| 4341 | req.two_phase.priority := priority; |
| 4342 | req.two_phase.random_bits := rand; |
| 4343 | |
| 4344 | /* For two phase access, do we expect Multiblock UL TBF Assignment? */ |
| 4345 | ul_ass := tr_EgprsUlAssMultiblock(ext_ra := ext_ra); |
| 4346 | rest := tr_IaRestOctets_EGPRSULAss(ul_ass); |
| 4347 | imm_ass := tr_IMM_TBF_ASS(dl := false, rest := rest); |
| 4348 | |
| 4349 | f_TC_egprs_pkt_chan_req(req, imm_ass); |
| 4350 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 4351 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 4352 | var StatsDExpects expect := { |
| 4353 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := num_req, max := num_req }, |
| 4354 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := num_req, max := num_req }, |
| 4355 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := 0, max := 0 }, |
| 4356 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := num_req, max := num_req }, |
| 4357 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := num_req, max := num_req }, |
| 4358 | { name := "TTCN3.bts.0.immediate.assignment_ul.one_phase", mtype := "c", min := 0, max := 0 }, |
| 4359 | { name := "TTCN3.bts.0.immediate.assignment_ul.two_phase", mtype := "c", min := num_req, max := num_req }, |
| 4360 | { name := "TTCN3.bts.0.immediate.assignment_ul.contention_resolution_success", mtype := "c", min := 0, max := 0 }, |
| 4361 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 } |
| 4362 | }; |
| 4363 | f_statsd_expect(expect); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4364 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 4365 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4366 | } |
| 4367 | |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4368 | private function f_TC_egprs_pkt_chan_req_reject(bitstring ra11, uint32_t fn, |
| 4369 | template IARRestOctets rest := ?, |
Pau Espin Pedrol | a5cee4c | 2021-04-26 13:50:29 +0200 | [diff] [blame] | 4370 | PCUIF_BurstType bt := BURST_TYPE_1, |
| 4371 | template WaitIndication wi := ?) |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4372 | runs on RAW_PCU_Test_CT { |
| 4373 | var template ReqRefWaitInd tr_ref; |
| 4374 | var GsmRrMessage rr_msg; |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4375 | |
| 4376 | /* Send RACH.ind with malformed EGPRS Packet Channel Request */ |
| 4377 | BTS.send(ts_PCUIF_RACH_IND(bts_nr := 0, trx_nr := 0, ts_nr := 0, |
| 4378 | ra := bit2int(ra11), is_11bit := 1, |
| 4379 | burst_type := bt, fn := fn, |
| 4380 | arfcn := 871)); |
| 4381 | |
| 4382 | /* Abuse f_pcuif_rx_imm_ass(): wait for Immediate Assignment Reject */ |
Vadim Yanitskiy | 7466c33 | 2020-05-28 20:41:19 +0700 | [diff] [blame] | 4383 | rr_msg := f_pcuif_rx_imm_ass(t_imm_ass := tr_IMM_ASS_REJ); |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4384 | |
| 4385 | /* Just to have a short-name reference to the actual message */ |
| 4386 | var ImmediateAssignmentReject iar := rr_msg.payload.imm_ass_rej; |
| 4387 | |
| 4388 | /* Make sure that Request Reference list contains at least one entry |
| 4389 | * with our TDMA frame number, and RA is set to 'reserved' value 127. */ |
Pau Espin Pedrol | a5cee4c | 2021-04-26 13:50:29 +0200 | [diff] [blame] | 4390 | tr_ref := tr_ReqRefWaitInd(f_compute_ReqRef(127, fn), wi); |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4391 | if (not match(iar.payload, { *, tr_ref, * })) { |
| 4392 | setverdict(fail, "Request Reference list does not match"); |
| 4393 | f_shutdown(__BFILE__, __LINE__); |
| 4394 | } |
| 4395 | |
| 4396 | /* Match Feature Indicator (must indicate PS domain) */ |
| 4397 | if (not match(iar.feature_ind, FeatureIndicator:{?, false, true})) { |
| 4398 | setverdict(fail, "Feature Indicator does not match"); |
| 4399 | f_shutdown(__BFILE__, __LINE__); |
| 4400 | } |
| 4401 | |
| 4402 | /* Match IAR Rest Octets */ |
| 4403 | if (not match(iar.rest_octets, rest)) { |
| 4404 | setverdict(fail, "IAR Rest Octets does not match: ", |
| 4405 | iar.rest_octets, " vs expected ", rest); |
| 4406 | f_shutdown(__BFILE__, __LINE__); |
| 4407 | } |
| 4408 | |
| 4409 | setverdict(pass); |
| 4410 | } |
| 4411 | |
| 4412 | /* Verify the contents of RR Immediate Assignment Reject message and its |
| 4413 | * Rest Octets sent in response to EGPRS Packet Channel Request (11 bit). */ |
| 4414 | testcase TC_egprs_pkt_chan_req_reject_content() runs on RAW_PCU_Test_CT { |
| 4415 | var template IARRestOctets rest; |
| 4416 | var BIT5 ext_ra; |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4417 | const integer num_req := 6; |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4418 | |
| 4419 | /* Initialize the PCU interface abstraction */ |
| 4420 | f_init_raw(testcasename()); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4421 | f_statsd_reset(); |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4422 | |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4423 | for (var integer i := 0; i < num_req; i := i + 1) { |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4424 | ext_ra := int2bit(f_rnd_int(32), 5); /* 5 LSB's of RA11 */ |
| 4425 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(ext_ra), * }); |
| 4426 | |
| 4427 | /* Intentionally incorrect message (see table 11.2.5a.2) */ |
| 4428 | f_TC_egprs_pkt_chan_req_reject('111111'B & ext_ra, 1337 + i, rest); |
| 4429 | } |
| 4430 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 4431 | var StatsDExpects expect := { |
| 4432 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := num_req, max := num_req }, |
| 4433 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := num_req, max := num_req }, |
| 4434 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := 0, max := 0 }, |
| 4435 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := 0, max := 0 }, |
| 4436 | { name := "TTCN3.bts.0.rach.requests.unexpected", mtype := "c", min := num_req, max := num_req }, |
| 4437 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 0, max := 0 }, |
| 4438 | { name := "TTCN3.bts.0.immediate.assignment_rej", mtype := "c", min := num_req, max := num_req }, |
| 4439 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 } |
| 4440 | }; |
| 4441 | f_statsd_expect(expect); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4442 | |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4443 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4444 | } |
| 4445 | |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 4446 | /* At the moment, the IUT does not support any emergency services. Make sure |
| 4447 | * that EGPRS Packet Channel Request for an emergency call is properly rejected. */ |
| 4448 | testcase TC_egprs_pkt_chan_req_reject_emergency() runs on RAW_PCU_Test_CT { |
| 4449 | var template IARRestOctets rest; |
| 4450 | var BIT5 ext_ra; |
| 4451 | var BIT11 ra11; |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4452 | const integer num_req := 6; |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 4453 | |
| 4454 | /* Initialize the PCU interface abstraction */ |
| 4455 | f_init_raw(testcasename()); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4456 | f_statsd_reset(); |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 4457 | |
| 4458 | var EGPRSPktChRequest req := { |
| 4459 | /* NOTE: other fields are set in the loop */ |
| 4460 | emergency := { tag := '110111'B } |
| 4461 | }; |
| 4462 | |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4463 | for (var integer i := 0; i < num_req; i := i + 1) { |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 4464 | ext_ra := int2bit(f_rnd_int(32), 5); /* 5 LSB's of RA11 */ |
| 4465 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(ext_ra), * }); |
| 4466 | |
| 4467 | req.emergency.random_bits := ext_ra; |
| 4468 | ra11 := enc_EGPRSPktChRequest2bits(req); |
| 4469 | |
| 4470 | /* Intentionally incorrect message (see table 11.2.5a.2) */ |
| 4471 | f_TC_egprs_pkt_chan_req_reject(ra11, 1337 + i, rest); |
| 4472 | } |
| 4473 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 4474 | var StatsDExpects expect := { |
| 4475 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := num_req, max := num_req }, |
| 4476 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := num_req, max := num_req }, |
| 4477 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := 0, max := 0 }, |
| 4478 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := 0, max := 0 }, |
| 4479 | { name := "TTCN3.bts.0.rach.requests.unexpected", mtype := "c", min := num_req, max := num_req }, |
| 4480 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 0, max := 0 }, |
| 4481 | { name := "TTCN3.bts.0.immediate.assignment_rej", mtype := "c", min := num_req, max := num_req }, |
| 4482 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 } |
| 4483 | }; |
| 4484 | f_statsd_expect(expect); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4485 | |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 4486 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4487 | } |
| 4488 | |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 4489 | /* Make sure that IUT responds with RR Immediate Assignment Reject due to exhaustion. */ |
| 4490 | testcase TC_egprs_pkt_chan_req_reject_exhaustion() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 4491 | var PCUIF_info_ind info_ind; |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 4492 | var template IARRestOctets rest; |
| 4493 | var BIT11 ra11; |
| 4494 | |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 4495 | info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | a5cee4c | 2021-04-26 13:50:29 +0200 | [diff] [blame] | 4496 | info_ind.t3142 := 3; |
Vadim Yanitskiy | d5321fb | 2020-10-31 20:23:47 +0700 | [diff] [blame] | 4497 | |
| 4498 | /* Only the first TRX is enabled. */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4499 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 4500 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 4501 | |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 4502 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 4503 | f_init_raw(testcasename(), info_ind); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4504 | f_statsd_reset(); |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 4505 | |
| 4506 | var EGPRSPktChRequest req := { |
| 4507 | one_phase := { |
| 4508 | tag := '0'B, |
| 4509 | multislot_class := '10101'B, |
| 4510 | priority := '01'B, |
| 4511 | random_bits := '101'B |
| 4512 | } |
| 4513 | }; |
| 4514 | |
| 4515 | /* We send 7 requests, the IUT gives us all available USFs (0..6). |
| 4516 | * TODO: make it configurable: usf_max := mp_pdch_ts_num * 7. */ |
| 4517 | for (var integer i := 0; i < 7; i := i + 1) { |
| 4518 | req.one_phase.random_bits := int2bit(f_rnd_int(8), 3); |
| 4519 | f_TC_egprs_pkt_chan_req(req, tr_IMM_TBF_ASS); |
| 4520 | } |
| 4521 | |
| 4522 | ra11 := enc_EGPRSPktChRequest2bits(req); |
| 4523 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(substr(ra11, 6, 5)), * }); |
| 4524 | |
| 4525 | /* At this point, the IUT should run out of free USFs */ |
Pau Espin Pedrol | a5cee4c | 2021-04-26 13:50:29 +0200 | [diff] [blame] | 4526 | f_TC_egprs_pkt_chan_req_reject(ra11, 1870, rest, wi := info_ind.t3142); |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 4527 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 4528 | var StatsDExpects expect := { |
| 4529 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 8, max := 8 }, |
| 4530 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := 8, max := 8 }, |
| 4531 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := 8, max := 8 }, |
| 4532 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := 0, max := 0 }, |
| 4533 | { name := "TTCN3.bts.0.rach.requests.unexpected", mtype := "c", min := 0, max := 0 }, |
| 4534 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 7, max := 7 }, |
| 4535 | { name := "TTCN3.bts.0.immediate.assignment_ul.one_phase", mtype := "c", min := 7, max := 7 }, |
| 4536 | { name := "TTCN3.bts.0.immediate.assignment_ul.two_phase", mtype := "c", min := 0, max := 0 }, |
| 4537 | { name := "TTCN3.bts.0.immediate.assignment_ul.contention_resolution_success", mtype := "c", min := 0, max := 0 }, |
| 4538 | { name := "TTCN3.bts.0.immediate.assignment_rej", mtype := "c", min := 1, max := 1 }, |
| 4539 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 } |
| 4540 | }; |
| 4541 | f_statsd_expect(expect); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4542 | |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 4543 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4544 | } |
| 4545 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4546 | /* Randomly generate a set of hopping parameters for one timeslot */ |
Vadim Yanitskiy | 7a04cdd | 2020-09-07 11:43:32 +0700 | [diff] [blame] | 4547 | private function f_TC_pcuif_fh_params_gen(integer max_ma_len) |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4548 | return template (value) PCUIF_InfoTrxTs { |
Vadim Yanitskiy | 7a04cdd | 2020-09-07 11:43:32 +0700 | [diff] [blame] | 4549 | /* Pick a random MA length in range 2 .. max_ma_len */ |
| 4550 | var integer ma_len := 2 + f_rnd_int(max_ma_len - 2); |
| 4551 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4552 | return ts_PCUIF_InfoTrxTsH1(tsc := f_rnd_int(7), |
| 4553 | hsn := f_rnd_int(63), |
| 4554 | maio := f_rnd_int(63), |
| 4555 | ma := f_rnd_bitstring(ma_len)); |
| 4556 | } |
| 4557 | |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4558 | private function f_TC_pcuif_fh_check_imm_ass(in PCUIF_info_ind info_ind, |
| 4559 | in GsmRrMessage rr_msg) |
| 4560 | { |
| 4561 | var ImmediateAssignment ia := rr_msg.payload.imm_ass; |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4562 | var PCUIF_InfoTrxTs ts := info_ind.trx[0].ts[ia.pkt_chan_desc.tn]; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4563 | |
| 4564 | var template PacketChannelDescription tr_pkt_chan_desc := { |
| 4565 | channel_Type_spare := ?, |
| 4566 | tn := ?, |
| 4567 | tsc := ts.tsc, |
| 4568 | presence := '1'B, |
| 4569 | zero := omit, |
| 4570 | one := { |
| 4571 | maio := ts.maio, |
| 4572 | hsn := ts.hsn |
| 4573 | } |
| 4574 | }; |
| 4575 | |
| 4576 | if (not match(ia.pkt_chan_desc, tr_pkt_chan_desc)) { |
| 4577 | setverdict(fail, "Packet Channel Description does not match: ", |
| 4578 | ia.pkt_chan_desc, " vs ", tr_pkt_chan_desc); |
| 4579 | } |
| 4580 | |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 4581 | /* Mobile Allocation is expected to be octet-aligned */ |
| 4582 | var uint8_t ma_oct_len := (ts.ma_bit_len + 8 - 1) / 8; |
| 4583 | var template MobileAllocationLV tr_ma := { |
| 4584 | len := ma_oct_len, /* in bytes */ |
| 4585 | ma := substr(ts.ma, 0, ma_oct_len * 8) |
| 4586 | }; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4587 | |
| 4588 | if (not match(ia.mobile_allocation, tr_ma)) { |
| 4589 | setverdict(fail, "Mobile Allocation does not match: ", |
| 4590 | ia.mobile_allocation, " vs ", tr_ma); |
| 4591 | } |
| 4592 | |
| 4593 | setverdict(pass); |
| 4594 | } |
| 4595 | |
| 4596 | /* Make sure that Immediate (UL EGPRS TBF) Assignment contains hopping parameters */ |
| 4597 | testcase TC_pcuif_fh_imm_ass_ul_egprs() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 4598 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4599 | var GprsMS ms := valueof(t_GprsMS_def); |
| 4600 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4601 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4602 | info_ind.trx[0].ts[7] := f_TC_pcuif_fh_params_gen(32); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4603 | |
| 4604 | /* Initialize the PCU interface abstraction */ |
| 4605 | f_init_raw(testcasename(), info_ind); |
| 4606 | |
| 4607 | /* EGPRS Packet Channel Request (cause=Signalling) */ |
| 4608 | f_ms_use_ra(ms, bit2int('11001101010'B), ra_is_11bit := 1); |
| 4609 | |
| 4610 | /* Establish an Uplink EGPRS TBF */ |
| 4611 | f_ms_establish_ul_tbf(ms); |
| 4612 | |
| 4613 | f_TC_pcuif_fh_check_imm_ass(valueof(info_ind), ms.ul_tbf.rr_imm_ass); |
| 4614 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4615 | } |
| 4616 | |
| 4617 | /* Make sure that Immediate (UL TBF) Assignment contains hopping parameters */ |
| 4618 | testcase TC_pcuif_fh_imm_ass_ul() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 4619 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4620 | var GprsMS ms := valueof(t_GprsMS_def); |
| 4621 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4622 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4623 | info_ind.trx[0].ts[7] := f_TC_pcuif_fh_params_gen(32); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4624 | |
| 4625 | /* Initialize the PCU interface abstraction */ |
| 4626 | f_init_raw(testcasename(), info_ind); |
| 4627 | |
| 4628 | /* Establish an Uplink TBF */ |
| 4629 | f_ms_establish_ul_tbf(ms); |
| 4630 | |
| 4631 | f_TC_pcuif_fh_check_imm_ass(valueof(info_ind), ms.ul_tbf.rr_imm_ass); |
| 4632 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4633 | } |
| 4634 | |
| 4635 | /* Make sure that Immediate (DL TBF) Assignment contains hopping parameters */ |
| 4636 | testcase TC_pcuif_fh_imm_ass_dl() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 4637 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4638 | var GprsMS ms := valueof(t_GprsMS_def); |
| 4639 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4640 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4641 | info_ind.trx[0].ts[7] := f_TC_pcuif_fh_params_gen(16); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4642 | |
| 4643 | /* Initialize NS/BSSGP side */ |
| 4644 | f_init_bssgp(); |
| 4645 | |
| 4646 | /* Initialize the PCU interface abstraction */ |
| 4647 | f_init_raw(testcasename(), info_ind); |
| 4648 | |
| 4649 | /* Establish BSSGP connection to the PCU */ |
| 4650 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 4651 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4652 | |
| 4653 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 4654 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, f_rnd_octstring(12))); |
| 4655 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 4656 | |
| 4657 | f_TC_pcuif_fh_check_imm_ass(valueof(info_ind), ms.dl_tbf.rr_imm_ass); |
| 4658 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4659 | } |
| 4660 | |
| 4661 | private function f_TC_pcuif_fh_check_pkt_ass(in PCUIF_info_ind info_ind, |
| 4662 | in FrequencyParameters fp) |
| 4663 | { |
| 4664 | /* FIXME: TRX0/TS7 is a hard-coded expectation, make it configurable */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4665 | var PCUIF_InfoTrxTs ts := info_ind.trx[0].ts[7]; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4666 | |
| 4667 | /* Table 12.8.1: Frequency Parameters information elements */ |
| 4668 | var template FrequencyParameters tr_fp := { |
| 4669 | tsc := ts.tsc, |
| 4670 | presence := '10'B, /* Direct encoding 1 */ |
| 4671 | arfcn := omit, |
| 4672 | indirect := omit, |
| 4673 | direct1 := { |
| 4674 | maio := ts.maio, |
| 4675 | /* Table 12.10a.1: GPRS Mobile Allocation information elements */ |
| 4676 | mobile_allocation := { |
| 4677 | hsn := ts.hsn, |
| 4678 | rfl_number_list_present := '0'B, |
| 4679 | rfl_number_list := omit, |
| 4680 | ma_present := '0'B, /* inverted logic */ |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 4681 | ma_length := ts.ma_bit_len, |
| 4682 | ma_bitmap := substr(ts.ma, 0, ts.ma_bit_len) |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4683 | } |
| 4684 | }, |
| 4685 | direct2 := omit |
| 4686 | }; |
| 4687 | |
| 4688 | if (not match(fp, tr_fp)) { |
| 4689 | setverdict(fail, "Frequency Parameters IE does not match: ", |
| 4690 | fp, " vs ", tr_fp); |
| 4691 | } |
| 4692 | |
| 4693 | setverdict(pass); |
| 4694 | } |
| 4695 | |
| 4696 | /* Make sure that Packet Uplink Assignment contains hopping parameters */ |
| 4697 | testcase TC_pcuif_fh_pkt_ass_ul() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 4698 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4699 | var GprsMS ms := valueof(t_GprsMS_def); |
| 4700 | var uint32_t poll_fn; |
| 4701 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4702 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4703 | info_ind.trx[0].ts[7] := f_TC_pcuif_fh_params_gen(33); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4704 | |
| 4705 | /* Initialize the PCU interface abstraction */ |
| 4706 | f_init_raw(testcasename(), info_ind); |
| 4707 | |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 4708 | /* Single block (two phase) packet access */ |
| 4709 | var uint16_t ra := bit2int(chan_req_sb); |
| 4710 | f_ms_use_ra(ms, ra, ra_is_11bit := 0); |
| 4711 | |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4712 | /* Establish an Uplink TBF */ |
| 4713 | f_ms_establish_ul_tbf(ms); |
| 4714 | |
| 4715 | /* Send Packet Resource Request, so the network will allocate an Uplink resource */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 4716 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, omit)), |
| 4717 | fn := ms.ul_tbf.start_time_fn); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4718 | |
| 4719 | /* Expect an RLC/MAC block with Packet Uplink Assignment on PACCH (see 11.2.29) */ |
Pau Espin Pedrol | 46e3604 | 2020-10-29 21:27:43 +0100 | [diff] [blame] | 4720 | f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_UL_PACKET_ASS); |
| 4721 | var PacketUlAssignment ua := ms.ul_tbf.ass.pacch; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4722 | |
| 4723 | /* 3GPP TS 44.060, section 12.8 "Frequency Parameters" */ |
| 4724 | var template (omit) FrequencyParameters fp; |
| 4725 | if (ua.is_egprs == '1'B) { |
| 4726 | fp := ua.egprs.freq_par; |
| 4727 | } else { |
| 4728 | fp := ua.gprs.freq_par; |
| 4729 | } |
| 4730 | |
| 4731 | /* This is an optional IE, so it's worth to check its presence */ |
| 4732 | if (istemplatekind(fp, "omit")) { |
| 4733 | setverdict(fail, "Frequency Parameters IE is not present"); |
| 4734 | f_shutdown(__BFILE__, __LINE__); |
| 4735 | } |
| 4736 | |
| 4737 | f_TC_pcuif_fh_check_pkt_ass(valueof(info_ind), valueof(fp)); |
| 4738 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4739 | } |
| 4740 | |
| 4741 | /* Make sure that Packet Downlink Assignment contains hopping parameters */ |
| 4742 | testcase TC_pcuif_fh_pkt_ass_dl() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 4743 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4744 | var octetstring data := f_rnd_octstring(10); |
| 4745 | var GprsMS ms := valueof(t_GprsMS_def); |
| 4746 | var RlcmacDlBlock dl_block; |
| 4747 | var uint32_t poll_fn; |
| 4748 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4749 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4750 | info_ind.trx[0].ts[7] := f_TC_pcuif_fh_params_gen(33); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4751 | |
| 4752 | /* Initialize NS/BSSGP side */ |
| 4753 | f_init_bssgp(); |
| 4754 | |
| 4755 | /* Initialize the PCU interface abstraction */ |
| 4756 | f_init_raw(testcasename(), info_ind); |
| 4757 | |
| 4758 | /* Establish BSSGP connection to the PCU */ |
| 4759 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 4760 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4761 | |
| 4762 | /* Establish an Uplink TBF */ |
| 4763 | f_ms_establish_ul_tbf(ms); |
| 4764 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 4765 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 4766 | f_ms_wait_usf(ms); |
| 4767 | |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4768 | /* Send an Uplink block, so this TBF becomes "active" */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 4769 | f_ms_tx_ul_data_block(ms, data, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4770 | |
| 4771 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4772 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, poll_fn); |
| 4773 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), poll_fn); |
| 4774 | |
| 4775 | /* SGSN sends some DL data, PCU will assign Downlink resource on PACCH */ |
| 4776 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 4777 | |
| 4778 | /* Expect an RLC/MAC block with Packet Downlink Assignment on PACCH (see 11.2.29) */ |
Pau Espin Pedrol | 46e3604 | 2020-10-29 21:27:43 +0100 | [diff] [blame] | 4779 | f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 4780 | var PacketDlAssignment da := ms.dl_tbf.ass.pacch; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4781 | |
| 4782 | /* This is an optional IE, so it's worth to check its presence */ |
| 4783 | if (not ispresent(da.freq_par)) { |
| 4784 | setverdict(fail, "Frequency Parameters IE is not present"); |
| 4785 | f_shutdown(__BFILE__, __LINE__); |
| 4786 | } |
| 4787 | |
| 4788 | f_TC_pcuif_fh_check_pkt_ass(valueof(info_ind), da.freq_par); |
| 4789 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4790 | } |
| 4791 | |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 4792 | /* Check if the IUT handles subsequent INFO.ind messages */ |
| 4793 | testcase TC_pcuif_info_ind_subsequent() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 4794 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default; |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 4795 | var BTS_PDTCH_Block data_msg; |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 4796 | |
| 4797 | /* Initialize the PCU interface abstraction */ |
| 4798 | f_init_raw(testcasename(), info_ind); |
| 4799 | |
| 4800 | /* Send 16 conseqtive INFO.ind messages and check that the IUT stays alive */ |
| 4801 | for (var integer i := 0; i < 16; i := i + 1) { |
| 4802 | BTS.send(ts_PCUIF_INFO_IND(0, info_ind)); |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 4803 | f_pcuif_rx_data_req_pdtch(data_msg); |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 4804 | } |
| 4805 | |
| 4806 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4807 | } |
| 4808 | |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 4809 | /* Verify allocation of several MS along PDCH ts of several TRX. See OS#1775, SYS#5030 */ |
| 4810 | testcase TC_multitrx_multims_alloc() runs on RAW_PCU_Test_CT { |
| 4811 | var PCUIF_info_ind info_ind; |
| 4812 | var integer i; |
| 4813 | const integer num_ms := 8; |
| 4814 | |
| 4815 | /* Initialize NS/BSSGP side */ |
| 4816 | f_init_bssgp(); |
| 4817 | /* Initialize GPRS MS side */ |
| 4818 | f_init_gprs_ms(num_ms); |
| 4819 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 4820 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 4821 | /* Only the 3 first TRX are enabled. The enabled ones all have same |
| 4822 | amount of resources, hence same amount of initial resources. */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4823 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (3 .. 7)); |
| 4824 | f_PCUIF_PDCHMask_set(info_ind, '00000011'B, 0); |
| 4825 | f_PCUIF_PDCHMask_set(info_ind, '00001100'B, 1); |
| 4826 | f_PCUIF_PDCHMask_set(info_ind, '11000000'B, 2); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 4827 | |
| 4828 | /* Initialize the PCU interface abstraction */ |
| 4829 | f_init_raw(testcasename(), info_ind); |
| 4830 | |
| 4831 | /* Establish BSSGP connection to the PCU */ |
| 4832 | f_bssgp_establish(); |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 4833 | f_multi_ms_bssgp_register(); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 4834 | |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 4835 | /* Establish an Uplink TBF for each GprsMS instance */ |
| 4836 | f_multi_ms_establish_tbf(do_activate := false); |
| 4837 | |
| 4838 | /* Check if all TBFs are allocated on different TRX in an uniform way */ |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 4839 | for (i := 0; i < num_ms; i := i + 1) { |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4840 | if (g_ms[i].ul_tbf.arfcn != info_ind.trx[i mod 3].arfcn) { |
Pau Espin Pedrol | b20b7e5 | 2020-10-28 21:28:45 +0100 | [diff] [blame] | 4841 | setverdict(fail, "Got assigned ARFCN ", g_ms[i].ul_tbf.arfcn, |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4842 | " vs exp ", info_ind.trx[i mod 3].arfcn); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 4843 | f_shutdown(__BFILE__, __LINE__); |
| 4844 | } |
| 4845 | } |
| 4846 | |
| 4847 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4848 | } |
| 4849 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4850 | /* Verify concurrent PDCH use of EGPRS and GPRS (EGPRS dl rlcmac blk is |
| 4851 | * downgraded to CS1-4 so that GPRS can read the USF). |
| 4852 | * See 3GPP TS 44.060 5.2.4a "Multiplexing of GPRS, EGPRS and EGPRS2 capable mobile stations" |
| 4853 | */ |
| 4854 | testcase TC_multiplex_dl_gprs_egprs() runs on RAW_PCU_Test_CT { |
| 4855 | var PCUIF_info_ind info_ind; |
| 4856 | const integer num_ms := 2; /* 2 MS, first one is GPRS-only, second one is EGPRS */ |
| 4857 | var PollFnCtx pollctx; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4858 | var uint32_t sched_fn, dl_fn, ack_fn; |
| 4859 | var octetstring data := f_rnd_octstring(10); |
| 4860 | var RlcmacDlBlock dl_block; |
| 4861 | var integer tx_data_remain := 5; |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4862 | var integer tgt_ms, usf_ms; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4863 | var integer ms_gprs_usf_count[num_ms] := { 0, 0 }; |
| 4864 | var integer ms_egprs_usf_count[num_ms] := { 0, 0 }; |
| 4865 | |
| 4866 | /* Initialize NS/BSSGP side */ |
| 4867 | f_init_bssgp(); |
| 4868 | /* Initialize GPRS MS side */ |
| 4869 | f_init_gprs_ms(num_ms); |
| 4870 | |
| 4871 | info_ind := valueof(ts_PCUIF_INFO_default); |
| 4872 | /* Only use 1 PDCH to make sure both end up in the same slot: */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4873 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
| 4874 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4875 | |
| 4876 | /* Initialize the PCU interface abstraction */ |
| 4877 | f_init_raw(testcasename(), info_ind); |
| 4878 | |
| 4879 | /* Set Initial MCS > 4 and maintain it non-variable to simplify test */ |
| 4880 | g_mcs_initial_dl := 5; |
| 4881 | g_mcs_max_dl := 5; |
| 4882 | f_pcuvty_set_allowed_cs_mcs(); |
| 4883 | |
| 4884 | /* Establish BSSGP connection to the PCU */ |
| 4885 | f_bssgp_establish(); |
| 4886 | f_multi_ms_bssgp_register(); |
| 4887 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4888 | /* Establish UL TBF for MS0 (GPRS-only) */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4889 | pollctx := f_ms_establish_ul_tbf_2phase_access(g_ms[0], ts_RlcMacUlCtrl_PKT_RES_REQ(g_ms[0].tlli, ms_racap_gprs_def)); |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4890 | if (not match(g_ms[0].ul_tbf.tx_cs_mcs, cs_gprs_any)) { |
| 4891 | setverdict(fail, "Wrong CS_MCS ", g_ms[0].ul_tbf.tx_cs_mcs, " received vs exp ", cs_gprs_any); |
| 4892 | f_shutdown(__BFILE__, __LINE__); |
| 4893 | } |
| 4894 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4895 | f_ms_tx_ul_block(g_ms[0], ts_RLCMAC_CTRL_ACK(g_ms[0].tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4896 | |
| 4897 | /* Establish UL TBF for MS1 (EGPRS) */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4898 | pollctx := f_ms_establish_ul_tbf_2phase_access(g_ms[1], ts_RlcMacUlCtrl_PKT_RES_REQ(g_ms[1].tlli, ms_racap_egprs_def)); |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4899 | if (not match(g_ms[1].ul_tbf.tx_cs_mcs, mcs_egprs_any)) { |
| 4900 | setverdict(fail, "Wrong CS_MCS ", g_ms[1].ul_tbf.tx_cs_mcs, " received vs exp ", mcs_egprs_any); |
| 4901 | f_shutdown(__BFILE__, __LINE__); |
| 4902 | } |
| 4903 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4904 | f_ms_tx_ul_block(g_ms[1], ts_RLCMAC_CTRL_ACK(g_ms[1].tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4905 | |
| 4906 | /* Now SGSN sends some DL data to MS0, PCU will assign a GPRS DL TBF on PACCH */ |
| 4907 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[0].tlli, data)); |
| 4908 | f_sleep(0.1); |
| 4909 | f_ms_rx_pkt_ass_pacch(g_ms[0], sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 4910 | /* DL Ass sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4911 | f_ms_tx_ul_block(g_ms[0], ts_RLCMAC_CTRL_ACK(g_ms[0].tlli), sched_fn); |
| 4912 | /* After acking the dl assignment, dl tbf goes into FLOW state and PCU will provide DL data when BTS asks for it */ |
| 4913 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0, cs_gprs_any); |
| 4914 | /* ACK the DL block */ |
| 4915 | f_dltbf_ack_block(g_ms[0].dl_tbf, dl_block, '0'B); |
| 4916 | f_ms_tx_ul_block(g_ms[0], f_dltbf_ts_RLCMAC_DL_ACK_NACK(g_ms[0].dl_tbf, false), |
| 4917 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 4918 | |
| 4919 | /* Now SGSN sends some DL data to MS1, PCU will assign a EGPRS DL TBF on PACCH */ |
| 4920 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[1].tlli, data)); |
| 4921 | f_sleep(0.1); |
| 4922 | f_ms_rx_pkt_ass_pacch(g_ms[1], sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 4923 | /* DL Ass sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4924 | f_ms_tx_ul_block(g_ms[1], ts_RLCMAC_CTRL_ACK(g_ms[1].tlli), sched_fn); |
| 4925 | /* After acking the dl assignment, dl tbf goes into FLOW state and PCU will provide DL data when BTS asks for it */ |
| 4926 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0, mcs_egprs_any); |
| 4927 | /* ACK the DL block */ |
| 4928 | f_dltbf_ack_block(g_ms[1].dl_tbf, dl_block, '0'B); |
| 4929 | f_ms_tx_ul_block(g_ms[1], f_dltbf_ts_RLCMAC_DL_ACK_NACK(g_ms[1].dl_tbf, true), |
| 4930 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 4931 | |
| 4932 | data := f_rnd_octstring(1400); |
| 4933 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[0].tlli, data)); |
| 4934 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[1].tlli, data)); |
| 4935 | |
| 4936 | for (var integer i := 0; i < 800; i := i + 1) { |
| 4937 | f_rx_rlcmac_dl_block(dl_block, dl_fn); |
| 4938 | |
Vadim Yanitskiy | 7179d3e | 2022-10-04 03:27:29 +0700 | [diff] [blame] | 4939 | if (match(dl_block, tr_RLCMAC_DL_DUMMY_CTRL)) { |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4940 | /* No more data to receive, done */ |
| 4941 | break; |
| 4942 | } |
| 4943 | |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4944 | usf_ms := -1; |
| 4945 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4946 | if (ischosen(dl_block.ctrl)) { |
| 4947 | setverdict(fail, "Unexpected DL CTRL block ", dl_block); |
| 4948 | f_shutdown(__BFILE__, __LINE__); |
| 4949 | } else if (ischosen(dl_block.data_egprs)) { |
| 4950 | if (not match(dl_block.data_egprs.mac_hdr.tfi, g_ms[1].dl_tbf.tfi)) { |
| 4951 | setverdict(fail, "EGPRS DL DATA not matching EGPRS MS TFI (", g_ms[1].dl_tbf.tfi, "): ", dl_block.data_egprs.mac_hdr.tfi); |
| 4952 | f_shutdown(__BFILE__, __LINE__); |
| 4953 | } |
| 4954 | tgt_ms := 1; |
| 4955 | if (match(dl_block.data_egprs.mac_hdr.usf, g_ms[0].ul_tbf.usf[7])) { |
| 4956 | if (dl_block.data_egprs.mcs > MCS_4) { |
| 4957 | setverdict(fail, "Signalling USF ", dl_block.data_egprs.mac_hdr.usf, " for GPRS-only MS using MCS > 4: ", dl_block); |
| 4958 | f_shutdown(__BFILE__, __LINE__); |
| 4959 | } |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4960 | usf_ms := 0; |
| 4961 | ms_egprs_usf_count[usf_ms] := ms_egprs_usf_count[usf_ms] + 1; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4962 | } else { |
| 4963 | if (dl_block.data_egprs.mcs <= MCS_4) { |
| 4964 | setverdict(fail, "Using too-low MCS for EGPRS MS: ", dl_block.data_egprs.mcs); |
| 4965 | f_shutdown(__BFILE__, __LINE__); |
| 4966 | } |
| 4967 | if (match(dl_block.data_egprs.mac_hdr.usf, g_ms[1].ul_tbf.usf[7])) { |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4968 | usf_ms := 1; |
| 4969 | ms_egprs_usf_count[usf_ms] := ms_egprs_usf_count[usf_ms] + 1; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4970 | } |
| 4971 | } |
| 4972 | } else { |
| 4973 | if (not match(dl_block.data.mac_hdr.hdr_ext.tfi, g_ms[0].dl_tbf.tfi)) { |
| 4974 | setverdict(fail, "GPRS DL DATA not matching GPRS MS TFI (", g_ms[0].dl_tbf.tfi, "): ", dl_block.data.mac_hdr.hdr_ext.tfi); |
| 4975 | f_shutdown(__BFILE__, __LINE__); |
| 4976 | } |
| 4977 | tgt_ms := 0; |
| 4978 | if (match(dl_block.data.mac_hdr.mac_hdr.usf, g_ms[0].ul_tbf.usf[7])) { |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4979 | usf_ms := 0; |
| 4980 | ms_gprs_usf_count[usf_ms] := ms_gprs_usf_count[usf_ms] + 1; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4981 | } else if (match(dl_block.data.mac_hdr.mac_hdr.usf, g_ms[1].ul_tbf.usf[7])) { |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4982 | usf_ms := 1; |
| 4983 | ms_gprs_usf_count[usf_ms] := ms_gprs_usf_count[usf_ms] + 1; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4984 | } |
| 4985 | } |
| 4986 | |
| 4987 | /* Keep Ack/Nack description updated */ |
| 4988 | f_dltbf_ack_block(g_ms[tgt_ms].dl_tbf, dl_block); |
| 4989 | |
| 4990 | /* TDMA frame number on which we are supposed to send the ACK */ |
| 4991 | if (f_dl_block_rrbp_valid(dl_block)) { |
| 4992 | ack_fn := f_dl_block_ack_fn(dl_block, dl_fn); |
| 4993 | f_ms_tx_ul_block(g_ms[tgt_ms], f_dltbf_ts_RLCMAC_DL_ACK_NACK(g_ms[tgt_ms].dl_tbf, ischosen(dl_block.data_egprs)), ack_fn); |
| 4994 | if (tx_data_remain != 0) { |
| 4995 | /* Submit more data from time to time to keep the TBF ongoing */ |
| 4996 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[0].tlli, data)); |
| 4997 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[1].tlli, data)); |
| 4998 | tx_data_remain := tx_data_remain - 1; |
| 4999 | } |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 5000 | } else if (tx_data_remain != 0) { |
| 5001 | /* keep sending UL blocks when requested by USF to avoid |
| 5002 | * UL TBF timeout and hence stop receival of USFs */ |
| 5003 | if (usf_ms != -1) { |
| 5004 | f_ms_tx_ul_data_block(g_ms[usf_ms], f_rnd_octstring(10), cv := 15); |
| 5005 | } |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 5006 | } |
| 5007 | } |
| 5008 | |
| 5009 | log("results: ms_gprs_usf_count=", ms_gprs_usf_count, " / ms_egprs_usf_count=", ms_egprs_usf_count); |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 5010 | /* He we check that DL blocks scheduled at GPRS can still request UL |
| 5011 | * blocks for EGPRS MS, and the other way around. Furthermore, the 2nd |
| 5012 | * condition also ensures the downgrade to <=MCS4 condition is tested |
| 5013 | * above */ |
| 5014 | if (ms_gprs_usf_count[1] == 0 or ms_egprs_usf_count[0] == 0) { |
| 5015 | setverdict(fail, "USF exchange thresholds not met!"); |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 5016 | f_shutdown(__BFILE__, __LINE__); |
| 5017 | } |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 5018 | /* Here check for some level of fairness between them (at least ~40%): */ |
| 5019 | var integer gprs_usf_cnt := ms_gprs_usf_count[0] + ms_egprs_usf_count[0]; |
| 5020 | var integer egprs_usf_cnt := ms_gprs_usf_count[1] + ms_egprs_usf_count[1]; |
| 5021 | var integer total_usf_cnt := gprs_usf_cnt + egprs_usf_cnt; |
| 5022 | if (gprs_usf_cnt < total_usf_cnt * 4 / 10) { |
| 5023 | setverdict(fail, "USF GPRS-only MS ", gprs_usf_cnt, " < ", total_usf_cnt * 4 / 10); |
| 5024 | f_shutdown(__BFILE__, __LINE__); |
| 5025 | } |
| 5026 | if (egprs_usf_cnt < total_usf_cnt * 4 / 10) { |
| 5027 | setverdict(fail, "USF EGPRS MS ", egprs_usf_cnt, " < ", total_usf_cnt * 4 / 10); |
| 5028 | f_shutdown(__BFILE__, __LINE__); |
| 5029 | } |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 5030 | |
| 5031 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5032 | } |
| 5033 | |
| 5034 | |
Vadim Yanitskiy | dbd4b24 | 2020-10-31 05:44:58 +0700 | [diff] [blame] | 5035 | private function f_TC_paging_cs_multi_ms(template (value) TsTrxBtsNum nr, |
| 5036 | boolean exp_imsi, boolean exp_tmsi) |
| 5037 | runs on RAW_PCU_Test_CT { |
| 5038 | var bitstring mask := f_pad_bit(''B, lengthof(g_ms), '0'B); |
| 5039 | var integer pending := lengthof(g_ms); |
| 5040 | var RlcmacDlBlock dl_block; |
| 5041 | var boolean f1, f2; |
| 5042 | |
| 5043 | while (pending > 0) { |
| 5044 | var uint32_t poll_fn; |
| 5045 | |
| 5046 | /* Obtain a Downlink block and make sure it is a paging request */ |
| 5047 | f_rx_rlcmac_dl_block(dl_block, poll_fn, nr := nr); |
| 5048 | if (not match(dl_block, tr_RLCMAC_PACKET_PAG_REQ)) { |
| 5049 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5050 | break; |
| 5051 | } |
| 5052 | |
| 5053 | /* This should not happen in general, but who knows... */ |
| 5054 | var PacketPagingReq req := dl_block.ctrl.payload.u.paging; |
| 5055 | if (not ispresent(req.repeated_pageinfo)) { |
| 5056 | setverdict(fail, "Repeated Page Info IE is absent?!?"); |
| 5057 | break; |
| 5058 | } |
| 5059 | |
| 5060 | /* A single message may contain several MIs depending on their type */ |
| 5061 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 5062 | f1 := exp_imsi and f_pkt_paging_match_imsi(req, g_ms[i].imsi, |
| 5063 | ps_domain := false); |
| 5064 | f2 := exp_tmsi and f_pkt_paging_match_tmsi(req, oct2int(g_ms[i].tlli), |
| 5065 | ps_domain := false); |
| 5066 | if (not f1 and not f2) |
| 5067 | { continue; } |
| 5068 | |
| 5069 | /* Detect duplicate MIs */ |
| 5070 | if (mask[i] == '1'B) { |
| 5071 | setverdict(fail, "MS is paged twice: ", g_ms[i].imsi); |
| 5072 | continue; |
| 5073 | } |
| 5074 | |
| 5075 | mask[i] := '1'B; |
| 5076 | } |
| 5077 | |
| 5078 | pending := pending - lengthof(req.repeated_pageinfo); |
| 5079 | } |
| 5080 | |
| 5081 | for (var integer i := 0; i < lengthof(mask); i := i + 1) { |
| 5082 | if (mask[i] != '1'B) { |
| 5083 | setverdict(fail, "MS was not paged at all: ", g_ms[i].imsi); |
| 5084 | log("===== mask := ", mask); |
| 5085 | } |
| 5086 | } |
| 5087 | |
| 5088 | /* All messages must have been received by now, expect a dummy block */ |
| 5089 | f_rx_rlcmac_dl_block_exp_dummy(dl_block, nr := nr); |
| 5090 | } |
| 5091 | |
| 5092 | private function f_TC_paging_cs_multi_ms_init(BIT8 pdch_mask) |
| 5093 | runs on RAW_PCU_Test_CT { |
| 5094 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5095 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 5096 | |
| 5097 | /* Initialize NS/BSSGP side */ |
| 5098 | f_init_bssgp(); |
| 5099 | |
| 5100 | /* Explicitly set the given PDCH slot-mask to all transceivers */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 5101 | f_PCUIF_PDCHMask_set(info_ind, pdch_mask); |
Vadim Yanitskiy | dbd4b24 | 2020-10-31 05:44:58 +0700 | [diff] [blame] | 5102 | |
| 5103 | /* Allocate 56 GprsMS instances (maximum for 8 PDCH slots) */ |
| 5104 | f_init_gprs_ms(7 * 8); |
| 5105 | |
| 5106 | /* Initialize the PCU interface abstraction */ |
| 5107 | f_init_raw(testcasename(), info_ind); |
| 5108 | |
| 5109 | /* Establish BSSGP connection to the PCU */ |
| 5110 | f_bssgp_establish(); |
| 5111 | f_multi_ms_bssgp_register(); |
| 5112 | |
| 5113 | /* Establish an Uplink TBF for each GprsMS instance */ |
| 5114 | f_multi_ms_establish_tbf(do_activate := true); |
| 5115 | } |
| 5116 | |
| 5117 | testcase TC_paging_cs_multi_ms_imsi() runs on RAW_PCU_Test_CT { |
| 5118 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 5119 | |
| 5120 | /* Common part: send INFO.ind, establish TBFs... */ |
| 5121 | f_TC_paging_cs_multi_ms_init(pdch_mask := '00000001'B); |
| 5122 | |
| 5123 | /* Enqueue multiple CS PAGING requests at a time (IMSI only) */ |
| 5124 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 5125 | BSSGP[0].send(ts_BSSGP_CS_PAGING_IMSI(bvci, g_ms[i].imsi)); |
| 5126 | } |
| 5127 | |
| 5128 | /* FIXME: work around a race condition between PCUIF and BSSGP */ |
| 5129 | f_sleep(0.2); /* i.e. give the IUT some time to process everything */ |
| 5130 | |
| 5131 | /* Check what the IUT sends on PACCH, all GprsMS instances must be paged. |
| 5132 | * The IUT is expected to page on all PDCH slots of all transceivers. */ |
| 5133 | for (var integer trx_nr := 0; trx_nr < 8; trx_nr := trx_nr + 1) { |
| 5134 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, trx_nr); |
| 5135 | f_TC_paging_cs_multi_ms(nr, exp_imsi := true, exp_tmsi := false); |
| 5136 | } |
| 5137 | |
| 5138 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5139 | } |
| 5140 | |
| 5141 | testcase TC_paging_cs_multi_ms_tmsi() runs on RAW_PCU_Test_CT { |
| 5142 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 5143 | |
| 5144 | /* Common part: send INFO.ind, establish TBFs... */ |
| 5145 | f_TC_paging_cs_multi_ms_init(pdch_mask := '00000001'B); |
| 5146 | |
| 5147 | /* Enqueue multiple CS PAGING requests at a time (P-TMSI only) */ |
| 5148 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 5149 | var GsmTmsi tmsi := oct2int(g_ms[i].tlli); /* P-TMSI == TLLI */ |
| 5150 | BSSGP[0].send(ts_BSSGP_CS_PAGING_PTMSI(bvci, g_ms[i].imsi, tmsi)); |
| 5151 | } |
| 5152 | |
| 5153 | /* FIXME: work around a race condition between PCUIF and BSSGP */ |
| 5154 | f_sleep(0.2); /* i.e. give the IUT some time to process everything */ |
| 5155 | |
| 5156 | /* Check what the IUT sends on PACCH, all GprsMS instances must be paged. |
| 5157 | * The IUT is expected to page on all PDCH slots of all transceivers. */ |
| 5158 | for (var integer trx_nr := 0; trx_nr < 8; trx_nr := trx_nr + 1) { |
| 5159 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, trx_nr); |
| 5160 | f_TC_paging_cs_multi_ms(nr, exp_imsi := false, exp_tmsi := true); |
| 5161 | } |
| 5162 | |
| 5163 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5164 | } |
| 5165 | |
| 5166 | testcase TC_paging_cs_multi_ms_imsi_tmsi() runs on RAW_PCU_Test_CT { |
| 5167 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 5168 | |
| 5169 | /* Common part: send INFO.ind, establish TBFs... */ |
| 5170 | f_TC_paging_cs_multi_ms_init(pdch_mask := '00000001'B); |
| 5171 | |
| 5172 | /* Enqueue multiple CS PAGING requests at a time (IMSI & P-TMSI) */ |
| 5173 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 5174 | var GsmTmsi tmsi := oct2int(g_ms[i].tlli); /* P-TMSI == TLLI */ |
| 5175 | if (i mod 3 == 0) { /* One PDU fits: 1 IMSI and 2 P-TMSI MIs */ |
| 5176 | BSSGP[0].send(ts_BSSGP_CS_PAGING_PTMSI(bvci, g_ms[i].imsi, tmsi)); |
| 5177 | } else { |
| 5178 | BSSGP[0].send(ts_BSSGP_CS_PAGING_IMSI(bvci, g_ms[i].imsi)); |
| 5179 | } |
| 5180 | } |
| 5181 | |
| 5182 | /* FIXME: work around a race condition between PCUIF and BSSGP */ |
| 5183 | f_sleep(0.2); /* i.e. give the IUT some time to process everything */ |
| 5184 | |
| 5185 | /* Check what the IUT sends on PACCH, all GprsMS instances must be paged. |
| 5186 | * The IUT is expected to page on all PDCH slots of all transceivers. */ |
| 5187 | for (var integer trx_nr := 0; trx_nr < 8; trx_nr := trx_nr + 1) { |
| 5188 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, trx_nr); |
| 5189 | f_TC_paging_cs_multi_ms(nr, exp_imsi := true, exp_tmsi := true); |
| 5190 | } |
| 5191 | |
| 5192 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5193 | } |
| 5194 | |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5195 | private function f_skip_dummy(integer max_num_iter, out uint32_t sched_fn) |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5196 | runs on RAW_PCU_Test_CT return RlcmacDlBlock { |
| 5197 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5198 | var integer i := 0; |
| 5199 | while (true) { |
| 5200 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
Vadim Yanitskiy | 7179d3e | 2022-10-04 03:27:29 +0700 | [diff] [blame] | 5201 | if (not match(dl_block, tr_RLCMAC_DL_DUMMY_CTRL())) { |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5202 | break; |
| 5203 | } |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5204 | if (max_num_iter > 0 and i > max_num_iter) { |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5205 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5206 | f_shutdown(__BFILE__, __LINE__); |
| 5207 | } |
| 5208 | i := i + 1; |
| 5209 | } |
| 5210 | return dl_block; |
| 5211 | } |
| 5212 | |
Vadim Yanitskiy | 03f74d4 | 2023-02-10 09:22:42 +0700 | [diff] [blame] | 5213 | private const GsmMcc c_BssgpCellMcc := '623'H; /* MCC: Central African Republic */ |
| 5214 | private const GsmMnc c_BssgpCellMnc := '03'H; /* MNC: Celca (Socatel) */ |
Vadim Yanitskiy | 7295661 | 2023-02-10 08:53:51 +0700 | [diff] [blame] | 5215 | private template (value) BssgpCellId ts_BssgpCellIdDstAddr_default := { |
| 5216 | ra_id := { |
| 5217 | lai := { |
| 5218 | mcc_mnc := f_build_BcdMccMnc(c_BssgpCellMcc, c_BssgpCellMnc), |
| 5219 | lac := 423 |
| 5220 | }, |
| 5221 | rac := 2 |
| 5222 | }, |
| 5223 | cell_id := 5 |
| 5224 | } |
| 5225 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5226 | private function f_outbound_nacc_rim_tx_resp(PCUIF_info_ind info_ind) |
| 5227 | runs on RAW_PCU_Test_CT { |
Vadim Yanitskiy | 88b87a4 | 2023-02-10 08:32:48 +0700 | [diff] [blame] | 5228 | /* Source Cell Identifier IE is generated by osmo-pcu based on the INFO.ind */ |
| 5229 | var BcdMccMnc src_mcc_mnc := f_build_BcdMccMnc_int(info_ind.mcc, info_ind.mnc, info_ind.mnc_3_digits == 1); |
| 5230 | var BssgpCellId src := valueof(ts_BssgpCellId(ts_RAI(ts_LAI(src_mcc_mnc, info_ind.lac), info_ind.rac), |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5231 | info_ind.cell_id)); |
Vadim Yanitskiy | 88b87a4 | 2023-02-10 08:32:48 +0700 | [diff] [blame] | 5232 | /* Destination Cell Identifier IE is resolved by the testsuite itself (emulating BSC) */ |
Vadim Yanitskiy | 7295661 | 2023-02-10 08:53:51 +0700 | [diff] [blame] | 5233 | var BssgpCellId dst := valueof(ts_BssgpCellIdDstAddr_default); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5234 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src)); |
| 5235 | var RIM_Routing_Address dst_addr := valueof(t_RIM_Routing_Address_cid(dst)); |
| 5236 | var template (value) RAN_Information_RIM_Container res_cont := |
| 5237 | ts_RAN_Information_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 5238 | ts_RIM_Sequence_Number(2), |
| 5239 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 5240 | ts_RIM_Protocol_Version_Number(1), |
| 5241 | tsu_ApplContainer_or_ApplErrContainer_NACC(tsu_ApplContainer_NACC(dst, false, 3, si_default)), |
| 5242 | omit); |
| 5243 | RIM.send(ts_PDU_BSSGP_RAN_INFORMATION(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 5244 | ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 5245 | res_cont)); |
| 5246 | } |
| 5247 | |
| 5248 | altstep as_outbound_nacc_rim_resolve(PCUIF_info_ind info_ind, boolean do_answer := true, boolean do_repeat := false) |
| 5249 | runs on RAW_PCU_Test_CT { |
Vadim Yanitskiy | 88b87a4 | 2023-02-10 08:32:48 +0700 | [diff] [blame] | 5250 | /* Source Cell Identifier IE is generated by osmo-pcu based on the INFO.ind */ |
| 5251 | var BcdMccMnc src_mcc_mnc := f_build_BcdMccMnc_int(info_ind.mcc, info_ind.mnc, info_ind.mnc_3_digits == 1); |
| 5252 | var BssgpCellId src := valueof(ts_BssgpCellId(ts_RAI(ts_LAI(src_mcc_mnc, info_ind.lac), info_ind.rac), |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5253 | info_ind.cell_id)); |
Vadim Yanitskiy | 88b87a4 | 2023-02-10 08:32:48 +0700 | [diff] [blame] | 5254 | /* Destination Cell Identifier IE is resolved by the testsuite itself (emulating BSC) */ |
Vadim Yanitskiy | 7295661 | 2023-02-10 08:53:51 +0700 | [diff] [blame] | 5255 | var BssgpCellId dst := valueof(ts_BssgpCellIdDstAddr_default); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5256 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src)); |
| 5257 | var RIM_Routing_Address dst_addr := valueof(t_RIM_Routing_Address_cid(dst)); |
| 5258 | [] RIM.receive(tr_RAN_INFORMATION_REQUEST(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 5259 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 5260 | tr_RAN_Information_Request_RIM_Container)) { |
| 5261 | if (do_answer) { |
| 5262 | f_outbound_nacc_rim_tx_resp(info_ind); |
| 5263 | } |
| 5264 | if (do_repeat) { |
| 5265 | repeat; |
| 5266 | } |
| 5267 | } |
| 5268 | } |
| 5269 | |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 5270 | private function f_ctrl_rx_nacc_rac_ci_req(out CtrlMessage ctrl_req, |
| 5271 | PCUIF_info_ind info_ind, |
| 5272 | GsmArfcn req_arfcn, |
| 5273 | uint6_t req_bsic) |
| 5274 | runs on RAW_PCU_Test_CT { |
| 5275 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 5276 | int2str(info_ind.lac) & "." & |
| 5277 | int2str(info_ind.cell_id) & "." & |
| 5278 | int2str(req_arfcn) & "." & |
| 5279 | int2str(req_bsic); |
| 5280 | f_ipa_ctrl_wait_link_up(); |
| 5281 | IPA_CTRL.receive(tr_CtrlMsgGet(?, ctrl_var)) -> value ctrl_req; |
| 5282 | } |
| 5283 | |
| 5284 | private function f_ctrl_tx_nacc_rac_ci_rsp(in CtrlMessage ctrl_req) |
| 5285 | runs on RAW_PCU_Test_CT { |
| 5286 | var BssgpCellId addr := valueof(ts_BssgpCellIdDstAddr_default); |
| 5287 | IPA_CTRL.send(ts_CtrlMsgGetRepl(ctrl_req.cmd.id, |
| 5288 | ctrl_req.cmd.variable, |
| 5289 | hex2str(c_BssgpCellMcc) & "-" & |
| 5290 | hex2str(c_BssgpCellMnc) & "-" & |
| 5291 | int2str(addr.ra_id.lai.lac) & "-" & |
| 5292 | int2str(addr.ra_id.rac) & "-" & |
| 5293 | int2str(addr.cell_id))); |
| 5294 | } |
| 5295 | |
| 5296 | private function f_pcuif_rx_nacc_rac_ci_req(out PCUIF_Message addr_req, |
| 5297 | PCUIF_info_ind info_ind, |
| 5298 | GsmArfcn req_arfcn, |
| 5299 | uint6_t req_bsic) |
| 5300 | runs on RAW_PCU_Test_CT { |
| 5301 | BTS.receive(tr_PCUIF_NEIGH_ADDR_REQ(0, info_ind.lac, info_ind.cell_id, |
| 5302 | req_arfcn, req_bsic)) -> value addr_req; |
| 5303 | } |
| 5304 | |
| 5305 | private function f_pcuif_tx_nacc_rac_ci_rsp(in PCUIF_Message addr_req) |
| 5306 | runs on RAW_PCU_Test_CT { |
| 5307 | var BssgpCellId addr := valueof(ts_BssgpCellIdDstAddr_default); |
| 5308 | BTS.send(ts_PCUIF_NEIGH_ADDR_CNF(0, addr_req.u.container.u.neigh_addr_req, 0, |
| 5309 | str2int(hex2str(c_BssgpCellMcc)), |
| 5310 | str2int(hex2str(c_BssgpCellMnc)), |
| 5311 | lengthof(c_BssgpCellMnc) - 2, |
| 5312 | addr.ra_id.lai.lac, |
| 5313 | addr.ra_id.rac, |
| 5314 | addr.cell_id)); |
| 5315 | } |
| 5316 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5317 | private function f_handle_nacc_rac_ci_query(PCUIF_info_ind info_ind, GsmArfcn req_arfcn, uint6_t req_bsic, |
| 5318 | boolean answer := true, boolean use_old_ctrl_iface := false) |
| 5319 | runs on RAW_PCU_Test_CT { |
| 5320 | if (use_old_ctrl_iface == true) { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 5321 | var CtrlMessage ctrl_req; |
| 5322 | f_ctrl_rx_nacc_rac_ci_req(ctrl_req, info_ind, req_arfcn, req_bsic); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5323 | if (answer) { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 5324 | f_ctrl_tx_nacc_rac_ci_rsp(ctrl_req); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5325 | } |
| 5326 | } else { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 5327 | var PCUIF_Message pcuif_req; |
| 5328 | f_pcuif_rx_nacc_rac_ci_req(pcuif_req, info_ind, req_arfcn, req_bsic); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5329 | if (answer) { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 5330 | f_pcuif_tx_nacc_rac_ci_rsp(pcuif_req); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5331 | } |
| 5332 | } |
| 5333 | } |
| 5334 | |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame^] | 5335 | private function f_outbound_nacc_success_no_si(inout GprsMS ms, PCUIF_info_ind info_ind, |
| 5336 | boolean exp_rac_ci_query := true, boolean exp_si_query := true, |
| 5337 | boolean skip_final_ctrl_ack := false, |
| 5338 | boolean use_old_ctrl_iface := false, |
| 5339 | template (value) RlcmacUlCtrlMsg cell_chg_notif) |
| 5340 | runs on RAW_PCU_Test_CT { |
| 5341 | var template RlcmacDlCtrlMsg cell_chg_cont; |
| 5342 | var RlcmacDlBlock dl_block; |
| 5343 | var uint32_t sched_fn; |
| 5344 | |
| 5345 | /* Start NACC from MS side */ |
| 5346 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5347 | |
| 5348 | /* Obtain a Downlink block and make sure it is a PacketCellChangeContine. We also make sure that this |
| 5349 | * PacketCellChangeContine message does not contain any ARFCN/BSIC. */ |
| 5350 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5351 | cell_chg_cont := tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE |
| 5352 | cell_chg_cont.u.cell_chg_continue.arfcn_bsic_presence := '0'B |
| 5353 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, cell_chg_cont))) { |
| 5354 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5355 | f_shutdown(__BFILE__, __LINE__); |
| 5356 | } |
| 5357 | |
| 5358 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5359 | if (not skip_final_ctrl_ack and dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5360 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5361 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5362 | } |
| 5363 | } |
| 5364 | |
| 5365 | /* Start NACC from MS side, propose an UTRAN cell */ |
| 5366 | private function f_outbound_nacc_success_utran(inout GprsMS ms, PCUIF_info_ind info_ind, |
| 5367 | boolean exp_rac_ci_query := true, boolean exp_si_query := true, |
| 5368 | boolean skip_final_ctrl_ack := false, |
| 5369 | boolean use_old_ctrl_iface := false) |
| 5370 | runs on RAW_PCU_Test_CT { |
| 5371 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
| 5372 | var uint14_t req_uarfcn := 1234; |
| 5373 | var uint10_t req_scrambling_code := 456; |
| 5374 | |
| 5375 | /* Start NACC from MS side */ |
| 5376 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF_UTRAN(ms.ul_tbf.tfi, req_uarfcn, req_scrambling_code); |
| 5377 | f_outbound_nacc_success_no_si(ms, info_ind, exp_rac_ci_query, exp_si_query, skip_final_ctrl_ack, use_old_ctrl_iface, cell_chg_notif); |
| 5378 | } |
| 5379 | |
| 5380 | /* Start NACC from MS side, propose an E-UTRAN cell */ |
| 5381 | private function f_outbound_nacc_success_eutran(inout GprsMS ms, PCUIF_info_ind info_ind, |
| 5382 | boolean exp_rac_ci_query := true, boolean exp_si_query := true, |
| 5383 | boolean skip_final_ctrl_ack := false, |
| 5384 | boolean use_old_ctrl_iface := false) |
| 5385 | runs on RAW_PCU_Test_CT { |
| 5386 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
| 5387 | var uint16_t req_earfcn := 1234; |
| 5388 | var uint9_t phys_layer_cell_id := 456; |
| 5389 | |
| 5390 | /* Start NACC from MS side */ |
| 5391 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF_EUTRAN(ms.ul_tbf.tfi, req_earfcn, phys_layer_cell_id); |
| 5392 | f_outbound_nacc_success_no_si(ms, info_ind, exp_rac_ci_query, exp_si_query, skip_final_ctrl_ack, use_old_ctrl_iface, cell_chg_notif); |
| 5393 | } |
| 5394 | |
Philipp Maier | 58c0833 | 2023-06-30 13:26:42 +0200 | [diff] [blame] | 5395 | /* Start NACC from MS side, propose a GERAN cell */ |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame^] | 5396 | private function f_outbound_nacc_success_geran(inout GprsMS ms, PCUIF_info_ind info_ind, |
| 5397 | boolean exp_rac_ci_query := true, boolean exp_si_query := true, |
| 5398 | boolean skip_final_ctrl_ack := false, |
| 5399 | boolean use_old_ctrl_iface := false) |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5400 | runs on RAW_PCU_Test_CT { |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5401 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Philipp Maier | 58c0833 | 2023-06-30 13:26:42 +0200 | [diff] [blame] | 5402 | var template RlcmacDlCtrlMsg cell_chg_cont; |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5403 | var RlcmacDlBlock dl_block; |
| 5404 | var uint32_t sched_fn; |
| 5405 | var GsmArfcn req_arfcn := 862; |
| 5406 | var uint6_t req_bsic := 43; |
| 5407 | |
| 5408 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5409 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5410 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5411 | |
| 5412 | if (exp_rac_ci_query == true) { |
| 5413 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5414 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5415 | } |
| 5416 | |
| 5417 | if (exp_si_query == true) { |
| 5418 | /* RIM procedure: */ |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5419 | as_outbound_nacc_rim_resolve(info_ind); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5420 | } |
| 5421 | |
| 5422 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 5423 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5424 | |
Philipp Maier | 58c0833 | 2023-06-30 13:26:42 +0200 | [diff] [blame] | 5425 | /* Obtain a Downlink block and make sure it is a PacketCellChangeContinue, also verify that |
| 5426 | * the PacketCellChangeContinue message contains the ARFCN and BSIC which was proposed in |
| 5427 | * the PacketCellChangeNotification before. */ |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5428 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
Philipp Maier | 58c0833 | 2023-06-30 13:26:42 +0200 | [diff] [blame] | 5429 | cell_chg_cont := tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE |
| 5430 | cell_chg_cont.u.cell_chg_continue.arfcn_bsic_presence := '1'B |
| 5431 | cell_chg_cont.u.cell_chg_continue.arfcn := req_arfcn; |
| 5432 | cell_chg_cont.u.cell_chg_continue.bsic := req_bsic; |
| 5433 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, cell_chg_cont))) { |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5434 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5435 | f_shutdown(__BFILE__, __LINE__); |
| 5436 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5437 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 5438 | if (not skip_final_ctrl_ack and dl_block.ctrl.mac_hdr.rrbp_valid) { |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5439 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5440 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5441 | } |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5442 | } |
| 5443 | |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame^] | 5444 | type enumerated f_TC_nacc_outbound_success_ran_type { |
| 5445 | NACC_RAN_GERAN, |
| 5446 | NACC_RAN_UTRAN, |
| 5447 | NACC_RAN_EUTRAN |
| 5448 | } |
| 5449 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5450 | /* Verify PCU handles outbound Network Assisted Cell Change Cell Change (NACC, TS 44.060 sec 8.8). */ |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame^] | 5451 | function f_TC_nacc_outbound_success(f_TC_nacc_outbound_success_ran_type ran_type) runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5452 | var PollFnCtx pollctx; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5453 | var GprsMS ms; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5454 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5455 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5456 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5457 | if (use_old_ctrl_iface) { |
| 5458 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5459 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5460 | } |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5461 | |
| 5462 | /* Initialize NS/BSSGP side */ |
| 5463 | f_init_bssgp(); |
| 5464 | /* Initialize GPRS MS side */ |
| 5465 | f_init_gprs_ms(); |
| 5466 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5467 | |
| 5468 | /* Initialize the PCU interface abstraction */ |
| 5469 | f_init_raw(testcasename(), info_ind); |
| 5470 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5471 | /* Make sure we are not affected by full cache from previous tests */ |
| 5472 | f_pcuvty_flush_neigh_caches(); |
| 5473 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5474 | /* Establish BSSGP connection to the PCU */ |
| 5475 | f_bssgp_establish(); |
| 5476 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5477 | |
| 5478 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5479 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5480 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5481 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5482 | |
| 5483 | /* Start NACC from MS side */ |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame^] | 5484 | if (ran_type == NACC_RAN_GERAN) { |
| 5485 | f_outbound_nacc_success_geran(ms, info_ind, use_old_ctrl_iface := use_old_ctrl_iface); |
| 5486 | } else if (ran_type == NACC_RAN_UTRAN) { |
| 5487 | f_outbound_nacc_success_utran(ms, info_ind, use_old_ctrl_iface := use_old_ctrl_iface); |
| 5488 | } else if (ran_type == NACC_RAN_EUTRAN) { |
| 5489 | f_outbound_nacc_success_eutran(ms, info_ind, use_old_ctrl_iface := use_old_ctrl_iface); |
| 5490 | } |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5491 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5492 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5493 | } |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5494 | |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame^] | 5495 | testcase TC_nacc_outbound_success() runs on RAW_PCU_Test_CT { |
| 5496 | f_TC_nacc_outbound_success(NACC_RAN_GERAN); |
| 5497 | } |
| 5498 | |
| 5499 | testcase TC_nacc_outbound_success_utran() runs on RAW_PCU_Test_CT { |
| 5500 | f_TC_nacc_outbound_success(NACC_RAN_UTRAN); |
| 5501 | } |
| 5502 | |
| 5503 | testcase TC_nacc_outbound_success_eutran() runs on RAW_PCU_Test_CT { |
| 5504 | f_TC_nacc_outbound_success(NACC_RAN_EUTRAN); |
| 5505 | } |
| 5506 | |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 5507 | /* Verify Pkt Cell Change Continue is retransmitted if not CTRL ACKed */ |
| 5508 | testcase TC_nacc_outbound_success_no_ctrl_ack() runs on RAW_PCU_Test_CT { |
| 5509 | var PollFnCtx pollctx; |
| 5510 | var GprsMS ms; |
| 5511 | var RlcmacDlBlock dl_block; |
| 5512 | var uint32_t sched_fn; |
| 5513 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5514 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 5515 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5516 | if (use_old_ctrl_iface) { |
| 5517 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5518 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5519 | } |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 5520 | |
| 5521 | /* Initialize NS/BSSGP side */ |
| 5522 | f_init_bssgp(); |
| 5523 | /* Initialize GPRS MS side */ |
| 5524 | f_init_gprs_ms(); |
| 5525 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5526 | |
| 5527 | /* Initialize the PCU interface abstraction */ |
| 5528 | f_init_raw(testcasename(), info_ind); |
| 5529 | |
| 5530 | /* Make sure we are not affected by full cache from previous tests */ |
| 5531 | f_pcuvty_flush_neigh_caches(); |
| 5532 | |
| 5533 | /* Establish BSSGP connection to the PCU */ |
| 5534 | f_bssgp_establish(); |
| 5535 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5536 | |
| 5537 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5538 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 5539 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5540 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5541 | |
| 5542 | /* Start NACC from MS side, avoid sending final CTRL ACK */ |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame^] | 5543 | f_outbound_nacc_success_geran(ms, info_ind, skip_final_ctrl_ack := true, |
| 5544 | use_old_ctrl_iface := use_old_ctrl_iface); |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 5545 | |
| 5546 | /* Wait until we receive something non-dummy */ |
| 5547 | dl_block := f_skip_dummy(0, sched_fn); |
| 5548 | /* Make sure it is a Pkt Cell Chg Continue (retransmitted)*/ |
| 5549 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5550 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5551 | } |
| 5552 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5553 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5554 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5555 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5556 | } |
| 5557 | |
| 5558 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5559 | } |
| 5560 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5561 | /* Verify PCU handles outbound Network Assisted Cell Change Cell Change (NACC, TS 44.060 sec 8.8) twice, the second time using the caches */ |
| 5562 | testcase TC_nacc_outbound_success_twice() runs on RAW_PCU_Test_CT { |
| 5563 | var PollFnCtx pollctx; |
| 5564 | var GprsMS ms; |
| 5565 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5566 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5567 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5568 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5569 | if (use_old_ctrl_iface) { |
| 5570 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5571 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5572 | } |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5573 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5574 | /* Initialize NS/BSSGP side */ |
| 5575 | f_init_bssgp(); |
| 5576 | /* Initialize GPRS MS side */ |
| 5577 | f_init_gprs_ms(); |
| 5578 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5579 | |
| 5580 | /* Initialize the PCU interface abstraction */ |
| 5581 | f_init_raw(testcasename(), info_ind); |
| 5582 | |
| 5583 | /* Make sure we are not affected by full cache from previous tests */ |
| 5584 | f_pcuvty_flush_neigh_caches(); |
| 5585 | /* Set timeout values for caches so that entries will be in cache during second try */ |
| 5586 | f_pcuvty_set_neigh_caches(10, 10); |
| 5587 | |
| 5588 | /* Establish BSSGP connection to the PCU */ |
| 5589 | f_bssgp_establish(); |
| 5590 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5591 | |
| 5592 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5593 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5594 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5595 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5596 | |
| 5597 | /* Start NACC from MS side */ |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame^] | 5598 | f_outbound_nacc_success_geran(ms, info_ind, use_old_ctrl_iface := use_old_ctrl_iface); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5599 | |
| 5600 | /* First NACC procedure is done, let's try to start a new one now that previous queries are cached: */ |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame^] | 5601 | f_outbound_nacc_success_geran(ms, info_ind, false, false, use_old_ctrl_iface := use_old_ctrl_iface); |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5602 | |
| 5603 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5604 | } |
| 5605 | |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 5606 | /* Verify PCU handles outbound Network Assisted Cell Change Cell Change (NACC, |
| 5607 | * TS 44.060 sec 8.8) twice, the second time after caches timed out |
| 5608 | */ |
| 5609 | testcase TC_nacc_outbound_success_twice_nocache() runs on RAW_PCU_Test_CT { |
| 5610 | var PollFnCtx pollctx; |
| 5611 | var GprsMS ms; |
| 5612 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5613 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5614 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 5615 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5616 | if (use_old_ctrl_iface) { |
| 5617 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5618 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5619 | } |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 5620 | |
| 5621 | /* Initialize NS/BSSGP side */ |
| 5622 | f_init_bssgp(); |
| 5623 | /* Initialize GPRS MS side */ |
| 5624 | f_init_gprs_ms(); |
| 5625 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5626 | |
| 5627 | /* Initialize the PCU interface abstraction */ |
| 5628 | f_init_raw(testcasename(), info_ind); |
| 5629 | |
| 5630 | /* Make sure we are not affected by full cache from previous tests */ |
| 5631 | f_pcuvty_flush_neigh_caches(); |
| 5632 | /* Set timeout values for caches so that entries will be erased before the second try */ |
| 5633 | f_pcuvty_set_neigh_caches(1, 1); |
| 5634 | |
| 5635 | /* Establish BSSGP connection to the PCU */ |
| 5636 | f_bssgp_establish(); |
| 5637 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5638 | |
| 5639 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5640 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 5641 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5642 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5643 | |
| 5644 | /* Start NACC from MS side */ |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame^] | 5645 | f_outbound_nacc_success_geran(ms, info_ind, use_old_ctrl_iface := use_old_ctrl_iface); |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 5646 | |
| 5647 | /* CTRL client should have disconnected from us */ |
| 5648 | f_ipa_ctrl_wait_link_down(); |
| 5649 | /* wait for cache entries to time out */ |
| 5650 | f_sleep(2.0); |
| 5651 | /* First NACC procedure is done, let's try to start a new one now that previous queries have timed out: */ |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame^] | 5652 | f_outbound_nacc_success_geran(ms, info_ind, use_old_ctrl_iface := use_old_ctrl_iface); |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 5653 | |
| 5654 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5655 | } |
| 5656 | |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5657 | /* Verify PCU transmits Pkt Cell Change Continue if RAC+CI resolution fails during outbound NACC procedure */ |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 5658 | testcase TC_nacc_outbound_rac_ci_resolve_conn_refused() runs on RAW_PCU_Test_CT { |
| 5659 | var RlcmacDlBlock dl_block; |
| 5660 | var PollFnCtx pollctx; |
| 5661 | var uint32_t sched_fn; |
| 5662 | var GprsMS ms; |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5663 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 5664 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 5665 | var GsmArfcn req_arfcn := 862; |
| 5666 | var uint6_t req_bsic := 43; |
| 5667 | |
| 5668 | /* In here we explicitly avoid starting osmo-bsc emulation neighbor |
| 5669 | * resolution CTRL port, to trigger Conn Refused by socket: |
| 5670 | * f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5671 | */ |
| 5672 | |
| 5673 | /* Initialize NS/BSSGP side */ |
| 5674 | f_init_bssgp(); |
| 5675 | /* Initialize GPRS MS side */ |
| 5676 | f_init_gprs_ms(); |
| 5677 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5678 | |
| 5679 | /* Initialize the PCU interface abstraction */ |
| 5680 | f_init_raw(testcasename(), info_ind); |
| 5681 | |
| 5682 | /* Make sure we are not affected by full cache from previous tests */ |
| 5683 | f_pcuvty_flush_neigh_caches(); |
| 5684 | |
| 5685 | /* Establish BSSGP connection to the PCU */ |
| 5686 | f_bssgp_establish(); |
| 5687 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5688 | |
| 5689 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5690 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 5691 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5692 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5693 | |
| 5694 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5695 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5696 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 5697 | |
| 5698 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5699 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 5700 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 5701 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5702 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5703 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5704 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5705 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5706 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5707 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5708 | } |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 5709 | |
| 5710 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5711 | } |
| 5712 | |
| 5713 | /* Verify PCU transmits Pkt Cell Change Continue if RAC+CI resolution fails during outbound NACC procedure */ |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5714 | testcase TC_nacc_outbound_rac_ci_resolve_timeout() runs on RAW_PCU_Test_CT { |
| 5715 | var RlcmacDlBlock dl_block; |
| 5716 | var PollFnCtx pollctx; |
| 5717 | var uint32_t sched_fn; |
| 5718 | var GprsMS ms; |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5719 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5720 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5721 | var GsmArfcn req_arfcn := 862; |
| 5722 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5723 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5724 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5725 | if (use_old_ctrl_iface) { |
| 5726 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5727 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5728 | } |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5729 | |
| 5730 | /* Initialize NS/BSSGP side */ |
| 5731 | f_init_bssgp(); |
| 5732 | /* Initialize GPRS MS side */ |
| 5733 | f_init_gprs_ms(); |
| 5734 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5735 | |
| 5736 | /* Initialize the PCU interface abstraction */ |
| 5737 | f_init_raw(testcasename(), info_ind); |
| 5738 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5739 | /* Make sure we are not affected by full cache from previous tests */ |
| 5740 | f_pcuvty_flush_neigh_caches(); |
| 5741 | |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5742 | /* Establish BSSGP connection to the PCU */ |
| 5743 | f_bssgp_establish(); |
| 5744 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5745 | |
| 5746 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5747 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5748 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5749 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5750 | |
| 5751 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5752 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5753 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5754 | |
| 5755 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5756 | /* we receive RAC+CI resolution request, but we never answer to it, timeout should occur */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5757 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, false, use_old_ctrl_iface); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5758 | |
| 5759 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5760 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5761 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 5762 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5763 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5764 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5765 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5766 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5767 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5768 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5769 | } |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5770 | |
| 5771 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5772 | } |
| 5773 | |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 5774 | /* Verify PCU transmits Pkt Cell Change Continue if RAC+CI resolution fails during outbound NACC procedure */ |
| 5775 | testcase TC_nacc_outbound_rac_ci_resolve_fail_parse_response() runs on RAW_PCU_Test_CT { |
| 5776 | var RlcmacDlBlock dl_block; |
| 5777 | var PollFnCtx pollctx; |
| 5778 | var uint32_t sched_fn; |
| 5779 | var GprsMS ms; |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5780 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 5781 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 5782 | var GsmArfcn req_arfcn := 862; |
| 5783 | var uint6_t req_bsic := 43; |
| 5784 | |
| 5785 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5786 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5787 | |
| 5788 | /* Initialize NS/BSSGP side */ |
| 5789 | f_init_bssgp(); |
| 5790 | /* Initialize GPRS MS side */ |
| 5791 | f_init_gprs_ms(); |
| 5792 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5793 | |
| 5794 | /* Initialize the PCU interface abstraction */ |
| 5795 | f_init_raw(testcasename(), info_ind); |
| 5796 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5797 | /* Make sure we are not affected by full cache from previous tests */ |
| 5798 | f_pcuvty_flush_neigh_caches(); |
| 5799 | |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 5800 | /* Establish BSSGP connection to the PCU */ |
| 5801 | f_bssgp_establish(); |
| 5802 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5803 | |
| 5804 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5805 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 5806 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5807 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5808 | |
| 5809 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5810 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5811 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 5812 | |
| 5813 | /* osmo-pcu should now ask for resolution: */ |
| 5814 | f_ipa_ctrl_wait_link_up(); |
| 5815 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 5816 | int2str(info_ind.lac) & "." & |
| 5817 | int2str(info_ind.cell_id) & "." & |
| 5818 | int2str(req_arfcn) & "." & |
| 5819 | int2str(req_bsic); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5820 | /* we receive RAC+CI resolution request and we send incorrectly formated response */ |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 5821 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "foobar-error"); |
| 5822 | |
| 5823 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5824 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 5825 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 5826 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5827 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5828 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5829 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5830 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5831 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5832 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5833 | } |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 5834 | |
| 5835 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5836 | } |
| 5837 | |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 5838 | /* Verify PCU transmits Pkt Cell Change Continue if SI resolution fails during outbound NACC procedure */ |
| 5839 | testcase TC_nacc_outbound_si_resolve_timeout() runs on RAW_PCU_Test_CT { |
| 5840 | var RlcmacDlBlock dl_block; |
| 5841 | var PollFnCtx pollctx; |
| 5842 | var uint32_t sched_fn; |
| 5843 | var GprsMS ms; |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5844 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 5845 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 5846 | var GsmArfcn req_arfcn := 862; |
| 5847 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5848 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 5849 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5850 | if (use_old_ctrl_iface) { |
| 5851 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5852 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5853 | } |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 5854 | |
| 5855 | /* Initialize NS/BSSGP side */ |
| 5856 | f_init_bssgp(); |
| 5857 | /* Initialize GPRS MS side */ |
| 5858 | f_init_gprs_ms(); |
| 5859 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5860 | |
| 5861 | /* Initialize the PCU interface abstraction */ |
| 5862 | f_init_raw(testcasename(), info_ind); |
| 5863 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5864 | /* Make sure we are not affected by full cache from previous tests */ |
| 5865 | f_pcuvty_flush_neigh_caches(); |
| 5866 | |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 5867 | /* Establish BSSGP connection to the PCU */ |
| 5868 | f_bssgp_establish(); |
| 5869 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5870 | |
| 5871 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5872 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 5873 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5874 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5875 | |
| 5876 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5877 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5878 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 5879 | |
| 5880 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5881 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 5882 | |
| 5883 | /* RIM procedure: */ |
Vadim Yanitskiy | d8aa5e8 | 2023-02-12 17:11:42 +0700 | [diff] [blame] | 5884 | as_outbound_nacc_rim_resolve(info_ind, do_answer := false); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 5885 | /* We never answer the RIM procude -> PCU timeouts and should send Pkt Cell Chg continue */ |
| 5886 | |
| 5887 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5888 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 5889 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 5890 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5891 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5892 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5893 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5894 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5895 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5896 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5897 | } |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 5898 | |
| 5899 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5900 | } |
| 5901 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5902 | /* Test MS sending Pkt Cell Change Notify twice (duplicate msg) while waiting for CTRL resolution */ |
| 5903 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup() runs on RAW_PCU_Test_CT { |
| 5904 | var PollFnCtx pollctx; |
| 5905 | var GprsMS ms; |
| 5906 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5907 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5908 | var RlcmacDlBlock dl_block; |
| 5909 | var uint32_t sched_fn; |
| 5910 | var CtrlMessage rx_ctrl; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5911 | var charstring ctrl_var; |
| 5912 | var PCUIF_Message pcu_msg; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5913 | var GsmArfcn req_arfcn := 862; |
| 5914 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5915 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5916 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5917 | if (use_old_ctrl_iface) { |
| 5918 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5919 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5920 | } |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5921 | |
| 5922 | /* Initialize NS/BSSGP side */ |
| 5923 | f_init_bssgp(); |
| 5924 | /* Initialize GPRS MS side */ |
| 5925 | f_init_gprs_ms(); |
| 5926 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5927 | |
| 5928 | /* Initialize the PCU interface abstraction */ |
| 5929 | f_init_raw(testcasename(), info_ind); |
| 5930 | |
| 5931 | /* Make sure we are not affected by full cache from previous tests */ |
| 5932 | f_pcuvty_flush_neigh_caches(); |
| 5933 | |
| 5934 | /* Establish BSSGP connection to the PCU */ |
| 5935 | f_bssgp_establish(); |
| 5936 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5937 | |
| 5938 | /* Send PACKET RESOURCE REQUEST */ |
| 5939 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5940 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5941 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5942 | |
| 5943 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5944 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5945 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5946 | |
| 5947 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5948 | if (use_old_ctrl_iface) { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 5949 | f_ctrl_rx_nacc_rac_ci_req(rx_ctrl, info_ind, req_arfcn, req_bsic); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5950 | } else { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 5951 | f_pcuif_rx_nacc_rac_ci_req(pcu_msg, info_ind, req_arfcn, req_bsic); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5952 | } |
| 5953 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5954 | /* Before receiving CTRL response, MS retransmits Pkt cell Chg Notif */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5955 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5956 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5957 | |
| 5958 | if (use_old_ctrl_iface) { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 5959 | f_ctrl_tx_nacc_rac_ci_rsp(rx_ctrl); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5960 | } else { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 5961 | f_pcuif_tx_nacc_rac_ci_rsp(pcu_msg); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5962 | } |
| 5963 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5964 | timer T := 2.0; |
| 5965 | T.start; |
| 5966 | alt { |
| 5967 | [] as_outbound_nacc_rim_resolve(info_ind, do_repeat := true); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5968 | [use_old_ctrl_iface] IPA_CTRL.receive(tr_CtrlMsgGet(?, ctrl_var)) -> value rx_ctrl { |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5969 | setverdict(fail, "Received unexpected CTRL resolution after duplicate Pkt Cell Change Notification:", rx_ctrl); |
| 5970 | f_shutdown(__BFILE__, __LINE__); |
| 5971 | } |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5972 | [not use_old_ctrl_iface] BTS.receive(tr_PCUIF_NEIGH_ADDR_REQ(0, info_ind.lac, info_ind.cell_id, req_arfcn, req_bsic)) -> value pcu_msg { |
| 5973 | setverdict(fail, "Received unexpected PCUIF resolution after duplicate Pkt Cell Change Notification:", pcu_msg); |
| 5974 | f_shutdown(__BFILE__, __LINE__); |
| 5975 | } |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5976 | [] T.timeout { |
| 5977 | setverdict(pass); |
| 5978 | } |
| 5979 | } |
| 5980 | |
| 5981 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 5982 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5983 | |
| 5984 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5985 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5986 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5987 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5988 | f_shutdown(__BFILE__, __LINE__); |
| 5989 | } |
| 5990 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5991 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5992 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5993 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5994 | } |
| 5995 | |
| 5996 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5997 | } |
| 5998 | |
| 5999 | /* Test MS sending Pkt Cell Change Notify twice (duplicate msg) while waiting for SI resolution */ |
| 6000 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup2() runs on RAW_PCU_Test_CT { |
| 6001 | var PollFnCtx pollctx; |
| 6002 | var GprsMS ms; |
| 6003 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6004 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6005 | var RlcmacDlBlock dl_block; |
| 6006 | var uint32_t sched_fn; |
| 6007 | var CtrlMessage rx_ctrl; |
| 6008 | var GsmArfcn req_arfcn := 862; |
| 6009 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6010 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6011 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6012 | if (use_old_ctrl_iface) { |
| 6013 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6014 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6015 | } |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6016 | |
| 6017 | /* Initialize NS/BSSGP side */ |
| 6018 | f_init_bssgp(); |
| 6019 | /* Initialize GPRS MS side */ |
| 6020 | f_init_gprs_ms(); |
| 6021 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6022 | |
| 6023 | /* Initialize the PCU interface abstraction */ |
| 6024 | f_init_raw(testcasename(), info_ind); |
| 6025 | |
| 6026 | /* Make sure we are not affected by full cache from previous tests */ |
| 6027 | f_pcuvty_flush_neigh_caches(); |
| 6028 | |
| 6029 | /* Establish BSSGP connection to the PCU */ |
| 6030 | f_bssgp_establish(); |
| 6031 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6032 | |
| 6033 | /* Send PACKET RESOURCE REQUEST */ |
| 6034 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6035 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6036 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6037 | |
| 6038 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6039 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6040 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6041 | |
| 6042 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6043 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6044 | as_outbound_nacc_rim_resolve(info_ind, do_answer := false); |
| 6045 | /* Before receiving RIM response, MS retransmits Pkt cell Chg Notif */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6046 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6047 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
| 6048 | f_outbound_nacc_rim_tx_resp(info_ind); |
| 6049 | timer T := 1.0; |
| 6050 | T.start; |
| 6051 | alt { |
| 6052 | [] RIM.receive { |
| 6053 | setverdict(fail, "Received unexpected RIM message"); |
| 6054 | f_shutdown(__BFILE__, __LINE__); |
| 6055 | } |
| 6056 | [] T.timeout { |
| 6057 | setverdict(pass); |
| 6058 | } |
| 6059 | } |
| 6060 | |
| 6061 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 6062 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6063 | |
| 6064 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6065 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6066 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6067 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6068 | f_shutdown(__BFILE__, __LINE__); |
| 6069 | } |
| 6070 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6071 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6072 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6073 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6074 | } |
| 6075 | |
| 6076 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6077 | } |
| 6078 | |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6079 | /* Test MS sending Pkt Cell Change Notification twice (duplicate msg) while sending Pkt Neigh Data Change */ |
| 6080 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup3() runs on RAW_PCU_Test_CT { |
| 6081 | var PollFnCtx pollctx; |
| 6082 | var GprsMS ms; |
| 6083 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6084 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6085 | var RlcmacDlBlock dl_block; |
| 6086 | var uint32_t sched_fn; |
| 6087 | var CtrlMessage rx_ctrl; |
| 6088 | var GsmArfcn req_arfcn := 862; |
| 6089 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6090 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6091 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6092 | if (use_old_ctrl_iface) { |
| 6093 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6094 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6095 | } |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6096 | |
| 6097 | /* Initialize NS/BSSGP side */ |
| 6098 | f_init_bssgp(); |
| 6099 | /* Initialize GPRS MS side */ |
| 6100 | f_init_gprs_ms(); |
| 6101 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6102 | |
| 6103 | /* Initialize the PCU interface abstraction */ |
| 6104 | f_init_raw(testcasename(), info_ind); |
| 6105 | |
| 6106 | /* Make sure we are not affected by full cache from previous tests */ |
| 6107 | f_pcuvty_flush_neigh_caches(); |
| 6108 | |
| 6109 | /* Establish BSSGP connection to the PCU */ |
| 6110 | f_bssgp_establish(); |
| 6111 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6112 | |
| 6113 | /* Send PACKET RESOURCE REQUEST */ |
| 6114 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6115 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6116 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6117 | |
| 6118 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6119 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6120 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6121 | |
| 6122 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6123 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6124 | /* RIM procedure: */ |
| 6125 | as_outbound_nacc_rim_resolve(info_ind); |
| 6126 | |
| 6127 | /* Receive first Pkt Neigh data Change, then trigger a new Pkt Cell Change Notif: */ |
| 6128 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, single_step := true); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6129 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6130 | |
| 6131 | /* It should be ignored, let's continue fetching Pkt Neigh Data Change */ |
| 6132 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, f_ms_tx_TsTrxBtsNum(ms), 1, 16); |
| 6133 | |
| 6134 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6135 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6136 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6137 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6138 | f_shutdown(__BFILE__, __LINE__); |
| 6139 | } |
| 6140 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6141 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6142 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6143 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6144 | } |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 6145 | |
| 6146 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6147 | } |
| 6148 | |
| 6149 | /* Test MS sending Pkt Cell Change Notification twice (duplicate msg) while sending Pkt Cell Change Continue */ |
| 6150 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup4() runs on RAW_PCU_Test_CT { |
| 6151 | var PollFnCtx pollctx; |
| 6152 | var GprsMS ms; |
| 6153 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6154 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6155 | var RlcmacDlBlock dl_block; |
| 6156 | var uint32_t sched_fn; |
| 6157 | var CtrlMessage rx_ctrl; |
| 6158 | var GsmArfcn req_arfcn := 862; |
| 6159 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6160 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6161 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6162 | if (use_old_ctrl_iface) { |
| 6163 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6164 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6165 | } |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6166 | |
| 6167 | /* Initialize NS/BSSGP side */ |
| 6168 | f_init_bssgp(); |
| 6169 | /* Initialize GPRS MS side */ |
| 6170 | f_init_gprs_ms(); |
| 6171 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6172 | |
| 6173 | /* Initialize the PCU interface abstraction */ |
| 6174 | f_init_raw(testcasename(), info_ind); |
| 6175 | |
| 6176 | /* Make sure we are not affected by full cache from previous tests */ |
| 6177 | f_pcuvty_flush_neigh_caches(); |
| 6178 | |
| 6179 | /* Establish BSSGP connection to the PCU */ |
| 6180 | f_bssgp_establish(); |
| 6181 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6182 | |
| 6183 | /* Send PACKET RESOURCE REQUEST */ |
| 6184 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6185 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6186 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6187 | |
| 6188 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6189 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6190 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6191 | |
| 6192 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6193 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6194 | /* RIM procedure: */ |
| 6195 | as_outbound_nacc_rim_resolve(info_ind); |
| 6196 | |
| 6197 | /* Announce SI back to MS, continue NACC procedure */ |
| 6198 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 6199 | |
| 6200 | /* trigger a dup Pkt Cell Change Notif, it should be ignored: */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6201 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6202 | |
| 6203 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6204 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6205 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6206 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6207 | f_shutdown(__BFILE__, __LINE__); |
| 6208 | } |
| 6209 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6210 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6211 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6212 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6213 | } |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 6214 | |
| 6215 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6216 | } |
| 6217 | |
| 6218 | /* Test MS sending Pkt Cell Change Notification twice (duplicate msg) while waiting for Pkt Cell Change Continue CTRL ACK */ |
| 6219 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup5() runs on RAW_PCU_Test_CT { |
| 6220 | var PollFnCtx pollctx; |
| 6221 | var GprsMS ms; |
| 6222 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6223 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6224 | var RlcmacDlBlock dl_block; |
| 6225 | var uint32_t sched_fn; |
| 6226 | var CtrlMessage rx_ctrl; |
| 6227 | var GsmArfcn req_arfcn := 862; |
| 6228 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6229 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6230 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6231 | if (use_old_ctrl_iface) { |
| 6232 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6233 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6234 | } |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6235 | |
| 6236 | /* Initialize NS/BSSGP side */ |
| 6237 | f_init_bssgp(); |
| 6238 | /* Initialize GPRS MS side */ |
| 6239 | f_init_gprs_ms(); |
| 6240 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6241 | |
| 6242 | /* Initialize the PCU interface abstraction */ |
| 6243 | f_init_raw(testcasename(), info_ind); |
| 6244 | |
| 6245 | /* Make sure we are not affected by full cache from previous tests */ |
| 6246 | f_pcuvty_flush_neigh_caches(); |
| 6247 | |
| 6248 | /* Establish BSSGP connection to the PCU */ |
| 6249 | f_bssgp_establish(); |
| 6250 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6251 | |
| 6252 | /* Send PACKET RESOURCE REQUEST */ |
| 6253 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6254 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6255 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6256 | |
| 6257 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6258 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6259 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6260 | |
| 6261 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6262 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6263 | /* RIM procedure: */ |
| 6264 | as_outbound_nacc_rim_resolve(info_ind); |
| 6265 | |
| 6266 | /* Announce SI back to MS, continue NACC procedure */ |
| 6267 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 6268 | |
| 6269 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6270 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6271 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6272 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6273 | f_shutdown(__BFILE__, __LINE__); |
| 6274 | } |
| 6275 | /* trigger a dup Pkt Cell Change Notif, it should be ignored: */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6276 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6277 | |
| 6278 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6279 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6280 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6281 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6282 | } |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 6283 | |
| 6284 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6285 | } |
| 6286 | |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6287 | /* Test MS sending Pkt Cell Change Notify twice (different tgt cell each time) |
| 6288 | * while waiting for CTRL resolution */ |
| 6289 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice() runs on RAW_PCU_Test_CT { |
| 6290 | var PollFnCtx pollctx; |
| 6291 | var GprsMS ms; |
| 6292 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6293 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6294 | var RlcmacDlBlock dl_block; |
| 6295 | var uint32_t sched_fn; |
| 6296 | var CtrlMessage rx_ctrl; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6297 | var charstring ctrl_var; |
| 6298 | var PCUIF_Message pcu_msg; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6299 | var GsmArfcn req_arfcn := 862; |
| 6300 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6301 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6302 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6303 | if (use_old_ctrl_iface) { |
| 6304 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6305 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6306 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6307 | |
| 6308 | /* Initialize NS/BSSGP side */ |
| 6309 | f_init_bssgp(); |
| 6310 | /* Initialize GPRS MS side */ |
| 6311 | f_init_gprs_ms(); |
| 6312 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6313 | |
| 6314 | /* Initialize the PCU interface abstraction */ |
| 6315 | f_init_raw(testcasename(), info_ind); |
| 6316 | |
| 6317 | /* Make sure we are not affected by full cache from previous tests */ |
| 6318 | f_pcuvty_flush_neigh_caches(); |
| 6319 | |
| 6320 | /* Establish BSSGP connection to the PCU */ |
| 6321 | f_bssgp_establish(); |
| 6322 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6323 | |
| 6324 | /* Send PACKET RESOURCE REQUEST */ |
| 6325 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6326 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6327 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6328 | |
| 6329 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6330 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6331 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6332 | |
| 6333 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6334 | if (use_old_ctrl_iface) { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 6335 | f_ctrl_rx_nacc_rac_ci_req(rx_ctrl, info_ind, req_arfcn, req_bsic); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6336 | } else { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 6337 | f_pcuif_rx_nacc_rac_ci_req(pcu_msg, info_ind, req_arfcn, req_bsic); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6338 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6339 | /* Before receiving CTRL response, MS retransmits Pkt cell Chg Notif with different tgt arfcn */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6340 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 6341 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6342 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6343 | if (use_old_ctrl_iface) { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 6344 | f_ctrl_tx_nacc_rac_ci_rsp(rx_ctrl); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6345 | } else { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 6346 | f_pcuif_tx_nacc_rac_ci_rsp(pcu_msg); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6347 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6348 | /* We should now receive a 2nd CTRL request with the new ARFCN+BSIC */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6349 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6350 | |
| 6351 | /* And finally everything continues as usual with RIN procedure */ |
| 6352 | as_outbound_nacc_rim_resolve(info_ind); |
| 6353 | |
| 6354 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 6355 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6356 | |
| 6357 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6358 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6359 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6360 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6361 | f_shutdown(__BFILE__, __LINE__); |
| 6362 | } |
| 6363 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6364 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6365 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6366 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6367 | } |
| 6368 | |
| 6369 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6370 | } |
| 6371 | |
| 6372 | /* Test MS sending Pkt Cell Change Notify twice (different tgt cell each time) |
| 6373 | * while waiting for SI resolution */ |
| 6374 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice2() runs on RAW_PCU_Test_CT { |
| 6375 | var PollFnCtx pollctx; |
| 6376 | var GprsMS ms; |
| 6377 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6378 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6379 | var RlcmacDlBlock dl_block; |
| 6380 | var uint32_t sched_fn; |
| 6381 | var CtrlMessage rx_ctrl; |
| 6382 | var GsmArfcn req_arfcn := 862; |
| 6383 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6384 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6385 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6386 | if (use_old_ctrl_iface) { |
| 6387 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6388 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6389 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6390 | |
| 6391 | /* Initialize NS/BSSGP side */ |
| 6392 | f_init_bssgp(); |
| 6393 | /* Initialize GPRS MS side */ |
| 6394 | f_init_gprs_ms(); |
| 6395 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6396 | |
| 6397 | /* Initialize the PCU interface abstraction */ |
| 6398 | f_init_raw(testcasename(), info_ind); |
| 6399 | |
| 6400 | /* Make sure we are not affected by full cache from previous tests */ |
| 6401 | f_pcuvty_flush_neigh_caches(); |
| 6402 | |
| 6403 | /* Establish BSSGP connection to the PCU */ |
| 6404 | f_bssgp_establish(); |
| 6405 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6406 | |
| 6407 | /* Send PACKET RESOURCE REQUEST */ |
| 6408 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6409 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6410 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6411 | |
| 6412 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6413 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6414 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6415 | |
| 6416 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6417 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6418 | as_outbound_nacc_rim_resolve(info_ind, do_answer := false); |
| 6419 | /* Before receiving RIM response, MS retransmits Pkt cell Chg Notif with different tgt cell: */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6420 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 6421 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6422 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
| 6423 | f_outbound_nacc_rim_tx_resp(info_ind); |
| 6424 | |
| 6425 | /* As a result, CTRL + RIM resolution for new tgt cell should now be done: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6426 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6427 | |
| 6428 | /* And finally everything continues as usual with RIN procedure */ |
| 6429 | as_outbound_nacc_rim_resolve(info_ind); |
| 6430 | |
| 6431 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 6432 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6433 | |
| 6434 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6435 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6436 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6437 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6438 | f_shutdown(__BFILE__, __LINE__); |
| 6439 | } |
| 6440 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6441 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6442 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6443 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6444 | } |
| 6445 | |
| 6446 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6447 | } |
| 6448 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6449 | /* Test MS sending Pkt Cell Change Notify twice (different tgt cell each time) |
| 6450 | * while sending Pkt Neigh Data Change */ |
| 6451 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice3() runs on RAW_PCU_Test_CT { |
| 6452 | var PollFnCtx pollctx; |
| 6453 | var GprsMS ms; |
| 6454 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6455 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6456 | var RlcmacDlBlock dl_block; |
| 6457 | var uint32_t sched_fn; |
| 6458 | var CtrlMessage rx_ctrl; |
| 6459 | var GsmArfcn req_arfcn := 862; |
| 6460 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6461 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6462 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6463 | if (use_old_ctrl_iface) { |
| 6464 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6465 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6466 | } |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6467 | |
| 6468 | /* Initialize NS/BSSGP side */ |
| 6469 | f_init_bssgp(); |
| 6470 | /* Initialize GPRS MS side */ |
| 6471 | f_init_gprs_ms(); |
| 6472 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6473 | |
| 6474 | /* Initialize the PCU interface abstraction */ |
| 6475 | f_init_raw(testcasename(), info_ind); |
| 6476 | |
| 6477 | /* Make sure we are not affected by full cache from previous tests */ |
| 6478 | f_pcuvty_flush_neigh_caches(); |
| 6479 | |
| 6480 | /* Establish BSSGP connection to the PCU */ |
| 6481 | f_bssgp_establish(); |
| 6482 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6483 | |
| 6484 | /* Send PACKET RESOURCE REQUEST */ |
| 6485 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6486 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6487 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6488 | |
| 6489 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6490 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6491 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6492 | |
| 6493 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6494 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6495 | /* RIM procedure: */ |
| 6496 | as_outbound_nacc_rim_resolve(info_ind); |
| 6497 | |
| 6498 | /* Receive first Pkt Neigh data Change, then trigger a new Pkt Cell Change Notif (different ARFCN+BSIC): */ |
| 6499 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, single_step := true); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6500 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 6501 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6502 | |
| 6503 | /* It should trigger RAC_CI resolution to start again: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6504 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6505 | /* RIM procedure: */ |
| 6506 | as_outbound_nacc_rim_resolve(info_ind); |
| 6507 | /* Transmit SI back to MS */ |
| 6508 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 6509 | |
| 6510 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6511 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6512 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6513 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6514 | f_shutdown(__BFILE__, __LINE__); |
| 6515 | } |
| 6516 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6517 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6518 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6519 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6520 | } |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 6521 | |
| 6522 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6523 | } |
| 6524 | |
| 6525 | /* Test MS sending Pkt Cell Change Notification twice (different tgt cell) while sending Pkt Cell Change Continue */ |
| 6526 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice4() runs on RAW_PCU_Test_CT { |
| 6527 | var PollFnCtx pollctx; |
| 6528 | var GprsMS ms; |
| 6529 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6530 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6531 | var RlcmacDlBlock dl_block; |
| 6532 | var uint32_t sched_fn; |
| 6533 | var CtrlMessage rx_ctrl; |
| 6534 | var GsmArfcn req_arfcn := 862; |
| 6535 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6536 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6537 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6538 | if (use_old_ctrl_iface) { |
| 6539 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6540 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6541 | } |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6542 | |
| 6543 | /* Initialize NS/BSSGP side */ |
| 6544 | f_init_bssgp(); |
| 6545 | /* Initialize GPRS MS side */ |
| 6546 | f_init_gprs_ms(); |
| 6547 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6548 | |
| 6549 | /* Initialize the PCU interface abstraction */ |
| 6550 | f_init_raw(testcasename(), info_ind); |
| 6551 | |
| 6552 | /* Make sure we are not affected by full cache from previous tests */ |
| 6553 | f_pcuvty_flush_neigh_caches(); |
| 6554 | |
| 6555 | /* Establish BSSGP connection to the PCU */ |
| 6556 | f_bssgp_establish(); |
| 6557 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6558 | |
| 6559 | /* Send PACKET RESOURCE REQUEST */ |
| 6560 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6561 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6562 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6563 | |
| 6564 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6565 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6566 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6567 | |
| 6568 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6569 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6570 | /* RIM procedure: */ |
| 6571 | as_outbound_nacc_rim_resolve(info_ind); |
| 6572 | |
| 6573 | /* Announce SI back to MS, continue NACC procedure */ |
| 6574 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 6575 | |
| 6576 | /* trigger a Pkt Cell Change Notif with different tgt cell */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6577 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 6578 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6579 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6580 | /* It should trigger RAC_CI resolution to start again: */ |
| 6581 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
| 6582 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6583 | /* PCU TBF NACC state changed, so we should next receive a dummy block: */ |
| 6584 | f_rx_rlcmac_dl_block_exp_dummy(dl_block, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 6585 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6586 | /* RIM procedure: */ |
| 6587 | as_outbound_nacc_rim_resolve(info_ind); |
| 6588 | /* Transmit SI back to MS */ |
| 6589 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 6590 | |
| 6591 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6592 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6593 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6594 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6595 | f_shutdown(__BFILE__, __LINE__); |
| 6596 | } |
| 6597 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6598 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6599 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6600 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6601 | } |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 6602 | |
| 6603 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6604 | } |
| 6605 | |
| 6606 | /* Test MS sending Pkt Cell Change Notification twice (different tgt cell) while waiting for Pkt Cell Change Continue CTRL ACK*/ |
| 6607 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice5() runs on RAW_PCU_Test_CT { |
| 6608 | var PollFnCtx pollctx; |
| 6609 | var GprsMS ms; |
| 6610 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6611 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6612 | var RlcmacDlBlock dl_block; |
| 6613 | var uint32_t sched_fn; |
| 6614 | var CtrlMessage rx_ctrl; |
| 6615 | var GsmArfcn req_arfcn := 862; |
| 6616 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6617 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6618 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6619 | if (use_old_ctrl_iface) { |
| 6620 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6621 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6622 | } |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6623 | |
| 6624 | /* Initialize NS/BSSGP side */ |
| 6625 | f_init_bssgp(); |
| 6626 | /* Initialize GPRS MS side */ |
| 6627 | f_init_gprs_ms(); |
| 6628 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6629 | |
| 6630 | /* Initialize the PCU interface abstraction */ |
| 6631 | f_init_raw(testcasename(), info_ind); |
| 6632 | |
| 6633 | /* Make sure we are not affected by full cache from previous tests */ |
| 6634 | f_pcuvty_flush_neigh_caches(); |
| 6635 | |
| 6636 | /* Establish BSSGP connection to the PCU */ |
| 6637 | f_bssgp_establish(); |
| 6638 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6639 | |
| 6640 | /* Send PACKET RESOURCE REQUEST */ |
| 6641 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6642 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6643 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6644 | |
| 6645 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6646 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6647 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6648 | |
| 6649 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6650 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6651 | /* RIM procedure: */ |
| 6652 | as_outbound_nacc_rim_resolve(info_ind); |
| 6653 | |
| 6654 | /* Announce SI back to MS, continue NACC procedure */ |
| 6655 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 6656 | |
| 6657 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6658 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6659 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6660 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6661 | f_shutdown(__BFILE__, __LINE__); |
| 6662 | } |
| 6663 | |
| 6664 | /* trigger a Pkt Cell Change Notif with different tgt cell */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6665 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 6666 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6667 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6668 | /* It should trigger RAC_CI resolution to start again: */ |
| 6669 | /* When using new PCUIF interface for resolution, we must |
| 6670 | * PCUIF.receive() here since that's the first message in the PCUIF |
| 6671 | * queue that PCU will have sent. Calling other functions doing |
| 6672 | * PCUIF.receive() (like f_ms_tx_ul_block() below) will make them fail |
| 6673 | * due to unexpected message receive. */ |
| 6674 | if (not use_old_ctrl_iface) { |
| 6675 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
| 6676 | } |
| 6677 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6678 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6679 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6680 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6681 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6682 | } |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6683 | |
| 6684 | /* When using CTRL interface, we must schedule the ACK before (see |
| 6685 | * above) blocking here waiting for the resoltion, otherwise we'll be |
| 6686 | * too late scheduling by the time the resolution is done. */ |
| 6687 | if (use_old_ctrl_iface) { |
| 6688 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
| 6689 | } |
| 6690 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6691 | /* PCU TBF NACC state changed, so we should next receive a dummy block: */ |
| 6692 | f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 6693 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6694 | /* RIM procedure: */ |
| 6695 | as_outbound_nacc_rim_resolve(info_ind); |
| 6696 | /* Transmit SI back to MS */ |
| 6697 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 6698 | |
| 6699 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6700 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6701 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6702 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6703 | f_shutdown(__BFILE__, __LINE__); |
| 6704 | } |
| 6705 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6706 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6707 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6708 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6709 | } |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 6710 | |
| 6711 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6712 | } |
| 6713 | |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 6714 | /* Test MS sending Pkt Cell Change Notification on an MS with an existing but unassigned (no TFI) DL TBF */ |
| 6715 | testcase TC_nacc_outbound_pkt_cell_chg_notif_unassigned_dl_tbf() runs on RAW_PCU_Test_CT { |
| 6716 | var PollFnCtx pollctx; |
| 6717 | var GprsMS ms; |
| 6718 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6719 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 6720 | var RlcmacDlBlock dl_block; |
| 6721 | var uint32_t sched_fn, dl_fn; |
| 6722 | var CtrlMessage rx_ctrl; |
| 6723 | var GsmArfcn req_arfcn := 862; |
| 6724 | var uint6_t req_bsic := 43; |
| 6725 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6726 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 6727 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6728 | if (use_old_ctrl_iface) { |
| 6729 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6730 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6731 | } |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 6732 | |
| 6733 | /* Initialize NS/BSSGP side */ |
| 6734 | f_init_bssgp(); |
| 6735 | /* Initialize GPRS MS side */ |
| 6736 | f_init_gprs_ms(); |
| 6737 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6738 | |
| 6739 | /* Initialize the PCU interface abstraction */ |
| 6740 | f_init_raw(testcasename(), info_ind); |
| 6741 | |
| 6742 | /* Make sure we are not affected by full cache from previous tests */ |
| 6743 | f_pcuvty_flush_neigh_caches(); |
| 6744 | |
| 6745 | /* Establish BSSGP connection to the PCU */ |
| 6746 | f_bssgp_establish(); |
| 6747 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6748 | |
| 6749 | /* Send PACKET RESOURCE REQUEST */ |
| 6750 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6751 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6752 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6753 | |
| 6754 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6755 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6756 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 6757 | |
| 6758 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6759 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 6760 | /* RIM procedure: */ |
| 6761 | as_outbound_nacc_rim_resolve(info_ind); |
| 6762 | |
| 6763 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 6764 | /* Make sure we leave some time for SGSN->PCU data to arrive to PCU */ |
| 6765 | f_sleep(0.1); |
| 6766 | /* rx DL assignment, don't ack it yet (keep TBF in state ASSIGN): */ |
| 6767 | f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 6768 | |
| 6769 | /* NACC: scheduler selects tx Pkt Cell Neighbor Data. Receive first one: */ |
| 6770 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, single_step := true); |
| 6771 | /* ACK DL assignment (we do it here on purpose to test tx Pkt Neigh Cell |
| 6772 | * Data with unassigned DL TBF in line above): */ |
| 6773 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6774 | /* Continue receiving Pkt Cell Neighbor Data */ |
| 6775 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, f_ms_tx_TsTrxBtsNum(ms), 1, 16); |
| 6776 | |
| 6777 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6778 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6779 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6780 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6781 | f_shutdown(__BFILE__, __LINE__); |
| 6782 | } |
| 6783 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6784 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6785 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6786 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6787 | } |
| 6788 | |
| 6789 | /* Now that we confirmed the new assignment in the dl-tbf, lets receive the data and ack it */ |
| 6790 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 6791 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 6792 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 6793 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 6794 | |
| 6795 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 6796 | } |
| 6797 | |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6798 | |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 6799 | function f_do_inbound_nacc(template (value) RIM_Routing_Information tx_src_addr, template RIM_Routing_Information rx_dst_addr) |
| 6800 | runs on RAW_PCU_Test_CT |
| 6801 | { |
| 6802 | var template (value) RAN_Information_Request_RIM_Container req_cont; |
| 6803 | var template (value) PDU_BSSGP bssgp_rim_pdu; |
| 6804 | var template PDU_BSSGP bssgp_rim_pdu_expect; |
| 6805 | var template RAN_Information_RIM_Container rim_cont_expect; |
| 6806 | var RIM_Routing_Address bts_addr; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6807 | |
| 6808 | /* Send sysinfo to the PCU */ |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 6809 | var template PCUIF_Message si1_data_ind := ts_PCUIF_DATA_IND(0, 0, 0, 0, PCU_IF_SAPI_BCCH, '5506'O & si1_default, 0, 0, 0, 0, 32767); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6810 | BTS.send(si1_data_ind); |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 6811 | var template PCUIF_Message si3_data_ind := ts_PCUIF_DATA_IND(0, 0, 0, 0, PCU_IF_SAPI_BCCH, '4906'O & si3_default, 0, 0, 0, 0, 32767); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6812 | BTS.send(si3_data_ind); |
Pau Espin Pedrol | 02a6d0c | 2021-04-19 17:11:07 +0200 | [diff] [blame] | 6813 | var template PCUIF_Message si13_data_ind := ts_PCUIF_DATA_IND(0, 0, 0, 0, PCU_IF_SAPI_BCCH, '0106'O & si13_default, 0, 0, 0, 0, 32767); |
| 6814 | BTS.send(si13_data_ind); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6815 | f_sleep(1.0); |
| 6816 | |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 6817 | bts_addr := valueof(t_RIM_Routing_Address_cid(mp_gb_cfg.bvc[0].cell_id)); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6818 | |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6819 | req_cont := ts_RAN_Information_Request_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 6820 | ts_RIM_Sequence_Number(1), |
| 6821 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 6822 | ts_RIM_Protocol_Version_Number(1), |
| 6823 | tsu_RAN_Information_Request_Application_Container_NACC(mp_gb_cfg.bvc[0].cell_id), |
| 6824 | omit); |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 6825 | bssgp_rim_pdu := ts_RAN_INFORMATION_REQUEST(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, bts_addr), |
| 6826 | tx_src_addr, req_cont); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6827 | |
| 6828 | rim_cont_expect := tr_RAN_Information_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 6829 | tr_RIM_Sequence_Number(1), |
| 6830 | tr_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 6831 | tr_RIM_Protocol_Version_Number(1), |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 6832 | tru_ApplContainer_or_ApplErrContainer_NACC(tru_ApplContainer_NACC(mp_gb_cfg.bvc[0].cell_id, false, 3, si_default)), |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6833 | omit); |
| 6834 | |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 6835 | bssgp_rim_pdu_expect := tr_PDU_BSSGP_RAN_INFORMATION(rx_dst_addr, |
| 6836 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, bts_addr), |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6837 | rim_cont_expect); |
| 6838 | RIM.send(bssgp_rim_pdu); |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 6839 | timer T := 2.0; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6840 | T.start; |
| 6841 | alt { |
| 6842 | [] RIM.receive(bssgp_rim_pdu_expect) { } |
| 6843 | [] RIM.receive { |
| 6844 | setverdict(fail, "Unexpected BSSGP RIM PDU received"); |
| 6845 | } |
| 6846 | [] T.timeout { |
| 6847 | setverdict(fail, "No BSSGP RIM PDU received"); |
| 6848 | mtc.stop; |
| 6849 | } |
| 6850 | } |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 6851 | } |
| 6852 | /* Send a RIM RAN info request to the PCU and verify the response, we expect |
| 6853 | * getting the system information back which we have transfered to the PCU via |
| 6854 | * PCUIF on startup. */ |
| 6855 | testcase TC_rim_ran_info_req_single_rep() runs on RAW_PCU_Test_CT { |
| 6856 | /* Initialize NS/BSSGP side */ |
| 6857 | f_init_bssgp(); |
| 6858 | |
| 6859 | /* Initialize the PCU interface abstraction */ |
| 6860 | f_init_raw(testcasename()); |
| 6861 | |
| 6862 | /* Establish BSSGP connection to the PCU */ |
| 6863 | f_bssgp_establish(); |
| 6864 | |
| 6865 | var BssgpCellId src_cid := {ra_id := { lai := { mcc_mnc := '262F42'H, lac := 12345}, rac := 0 }, cell_id := 20962 }; |
| 6866 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src_cid)); |
| 6867 | |
| 6868 | f_do_inbound_nacc(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 6869 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr)); |
| 6870 | |
| 6871 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6872 | } |
| 6873 | |
| 6874 | /* Same as TC_rim_ran_info_req_single_rep, but using an EUTRAN eNodeB ID as |
| 6875 | * Routing information, to verify PCU handles that kind of address just fine |
| 6876 | */ |
| 6877 | testcase TC_rim_ran_info_req_single_rep_eutran() runs on RAW_PCU_Test_CT { |
| 6878 | /* Initialize NS/BSSGP side */ |
| 6879 | f_init_bssgp(); |
| 6880 | |
| 6881 | /* Initialize the PCU interface abstraction */ |
| 6882 | f_init_raw(testcasename()); |
| 6883 | |
| 6884 | /* Establish BSSGP connection to the PCU */ |
| 6885 | f_bssgp_establish(); |
| 6886 | |
| 6887 | var BssgpCellId src_cid := {ra_id := { lai := { mcc_mnc := '262F42'H, lac := 12345}, rac := 0 }, cell_id := 20962 }; |
| 6888 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_enbid(src_cid, tac := 3, gnbid := '12345678123456'O)); |
| 6889 | |
| 6890 | f_do_inbound_nacc(ts_RIM_Routing_Information(RIM_ADDR_EUTRAN_NODEB_ID, src_addr), |
| 6891 | tr_RIM_Routing_Information(RIM_ADDR_EUTRAN_NODEB_ID, src_addr)); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6892 | |
| 6893 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6894 | } |
| 6895 | |
| 6896 | /* Same as above, but in this case we simulate the rare case in which the PCU |
| 6897 | * has no system information available. We expect getting a response back but |
| 6898 | * with no system information inside. */ |
| 6899 | testcase TC_rim_ran_info_req_single_rep_no_si() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 6900 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6901 | var PCUIF_Message pcu_msg; |
| 6902 | timer T := 2.0; |
| 6903 | |
| 6904 | /* Initialize NS/BSSGP side */ |
| 6905 | f_init_bssgp(); |
| 6906 | |
| 6907 | /* Initialize the PCU interface abstraction */ |
| 6908 | f_init_raw(testcasename(), info_ind); |
| 6909 | |
| 6910 | /* Establish BSSGP connection to the PCU */ |
| 6911 | f_bssgp_establish(); |
| 6912 | |
| 6913 | /* Clear sysinfo from the PCU */ |
| 6914 | var template PCUIF_Message si1_data_ind := ts_PCUIF_DATA_IND(0, 0, 0, 0, PCU_IF_SAPI_BCCH, '01'O, 0, 0, 0, 0, 32767); |
| 6915 | BTS.send(si1_data_ind); |
| 6916 | var template PCUIF_Message si3_data_ind := ts_PCUIF_DATA_IND(0, 0, 0, 0, PCU_IF_SAPI_BCCH, '03'O, 0, 0, 0, 0, 32767); |
| 6917 | BTS.send(si3_data_ind); |
| 6918 | var template PCUIF_Message si16_data_ind := ts_PCUIF_DATA_IND(0, 0, 0, 0, PCU_IF_SAPI_BCCH, '0b'O, 0, 0, 0, 0, 32767); |
| 6919 | BTS.send(si16_data_ind); |
| 6920 | f_sleep(1.0); |
| 6921 | |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 6922 | var RIM_Routing_Address dst_addr; |
| 6923 | var RIM_Routing_Address src_addr; |
| 6924 | var template (value) RAN_Information_Request_RIM_Container req_cont; |
| 6925 | var template (value) PDU_BSSGP bssgp_rim_pdu; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6926 | var template PDU_BSSGP bssgp_rim_pdu_expect; |
| 6927 | var template RAN_Information_RIM_Container rim_cont_expect; |
| 6928 | |
| 6929 | var BssgpCellId src_cid := {ra_id := { lai := { mcc_mnc := '262F42'H, lac := 12345}, rac := 0 }, cell_id := 20962 }; |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 6930 | src_addr := valueof(t_RIM_Routing_Address_cid(src_cid)); |
| 6931 | dst_addr := valueof(t_RIM_Routing_Address_cid(mp_gb_cfg.bvc[0].cell_id)); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6932 | |
| 6933 | req_cont := ts_RAN_Information_Request_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 6934 | ts_RIM_Sequence_Number(1), |
| 6935 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 6936 | ts_RIM_Protocol_Version_Number(1), |
| 6937 | tsu_RAN_Information_Request_Application_Container_NACC(mp_gb_cfg.bvc[0].cell_id), |
| 6938 | omit); |
| 6939 | bssgp_rim_pdu := ts_RAN_INFORMATION_REQUEST(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 6940 | ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 6941 | req_cont); |
| 6942 | |
| 6943 | |
| 6944 | rim_cont_expect := tr_RAN_Information_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 6945 | tr_RIM_Sequence_Number(1), |
| 6946 | tr_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 6947 | tr_RIM_Protocol_Version_Number(1), |
| 6948 | tru_ApplContainer_or_ApplErrContainer_NACC(tru_ApplContainer_NACC(mp_gb_cfg.bvc[0].cell_id, false, 0, ''O)), |
| 6949 | omit); |
| 6950 | |
| 6951 | bssgp_rim_pdu_expect := tr_PDU_BSSGP_RAN_INFORMATION(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 6952 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 6953 | rim_cont_expect); |
| 6954 | RIM.send(bssgp_rim_pdu); |
| 6955 | T.start; |
| 6956 | alt { |
| 6957 | [] RIM.receive(bssgp_rim_pdu_expect) { } |
| 6958 | [] RIM.receive { |
| 6959 | setverdict(fail, "Unexpected BSSGP RIM PDU received"); |
| 6960 | } |
| 6961 | [] T.timeout { |
| 6962 | setverdict(fail, "No BSSGP RIM PDU received"); |
| 6963 | mtc.stop; |
| 6964 | } |
| 6965 | } |
| 6966 | |
| 6967 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6968 | } |
| 6969 | |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 6970 | /* Verify PCU schedule idle blocks (len=0) if no TBF attached to it. See OS#4772, SYS#4919 */ |
Pau Espin Pedrol | 3aa61c6 | 2021-08-25 19:24:03 +0200 | [diff] [blame] | 6971 | testcase TC_pdch_energy_saving() runs on RAW_PCU_Test_CT { |
| 6972 | var PCUIF_info_ind info_ind; |
| 6973 | var template (value) TsTrxBtsNum nr; |
| 6974 | var RlcmacDlBlock dl_block; |
| 6975 | var BTS_PDTCH_Block data_msg; |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 6976 | var integer ts; |
Pau Espin Pedrol | 3aa61c6 | 2021-08-25 19:24:03 +0200 | [diff] [blame] | 6977 | timer T; |
| 6978 | |
| 6979 | /* Initialize NS/BSSGP side */ |
| 6980 | f_init_bssgp(); |
| 6981 | |
| 6982 | info_ind := valueof(ts_PCUIF_INFO_default); |
| 6983 | /* The 2 first TRX are enabled. */ |
| 6984 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (2 .. 7)); |
| 6985 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
| 6986 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 1); |
| 6987 | |
| 6988 | /* Initialize the PCU interface abstraction */ |
| 6989 | f_init_raw(testcasename(), info_ind); |
| 6990 | |
| 6991 | /* Establish BSSGP connection to the PCU */ |
| 6992 | f_bssgp_establish(); |
| 6993 | |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 6994 | for (ts := 0; ts < 2; ts := ts + 1) { |
| 6995 | nr := ts_TsTrxBtsNum(ts_nr := 7, trx_nr := ts, bts_nr := 0, blk_nr := 0); |
Pau Espin Pedrol | 3aa61c6 | 2021-08-25 19:24:03 +0200 | [diff] [blame] | 6996 | |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 6997 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 6998 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 6999 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), block_nr := nr.blk_nr)); |
| 7000 | T.start(0.5); |
| 7001 | alt { |
| 7002 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 7003 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 7004 | omit)) -> value data_msg { |
| 7005 | setverdict(pass); |
| 7006 | T.stop; |
| 7007 | } |
| 7008 | [] as_rx_fail_dummy(nr); |
| 7009 | [] BTS.receive { |
| 7010 | setverdict(fail, "Unexpected block from BTS"); |
| 7011 | f_shutdown(__BFILE__, __LINE__); |
| 7012 | } |
| 7013 | [] T.timeout { |
| 7014 | setverdict(fail, "Expected IDLE block from BTS"); |
| 7015 | f_shutdown(__BFILE__, __LINE__); |
| 7016 | } |
| 7017 | } |
Pau Espin Pedrol | 3aa61c6 | 2021-08-25 19:24:03 +0200 | [diff] [blame] | 7018 | } |
| 7019 | |
| 7020 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 7021 | } |
| 7022 | |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 7023 | /* Test stats for available and occupied PDCHs */ |
| 7024 | testcase TC_stat_pdch_avail_occ() runs on RAW_PCU_Test_CT { |
| 7025 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 7026 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 7027 | |
| 7028 | /* Initialize NS/BSSGP side */ |
| 7029 | f_init_bssgp(); |
| 7030 | |
Oliver Smith | edcded2 | 2021-09-14 09:26:55 +0200 | [diff] [blame] | 7031 | /* Only the 4 first TRX are enabled, each with 2 PDCHs. */ |
| 7032 | f_PCUIF_PDCHMask_set(info_ind, '00000011'B, 0); |
| 7033 | f_PCUIF_PDCHMask_set(info_ind, '00001100'B, 1); |
| 7034 | f_PCUIF_PDCHMask_set(info_ind, '11000000'B, 2); |
| 7035 | f_PCUIF_PDCHMask_set(info_ind, '00110000'B, 3); |
| 7036 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (4 .. 7)); |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 7037 | |
Oliver Smith | 72d0c69 | 2021-09-08 10:03:52 +0200 | [diff] [blame] | 7038 | /* Allocate 4 GprsMS instances */ |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 7039 | f_init_gprs_ms(4); |
| 7040 | |
| 7041 | /* Initialize the PCU interface abstraction */ |
| 7042 | f_init_raw(testcasename(), info_ind); |
| 7043 | |
| 7044 | /* Reset stats */ |
| 7045 | f_statsd_reset(); |
| 7046 | |
| 7047 | /* Establish BSSGP */ |
| 7048 | f_bssgp_establish(); |
| 7049 | |
| 7050 | /* 8 PDCHs available, 0 occupied */ |
| 7051 | var StatsDExpects expect := { |
| 7052 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
Oliver Smith | 4b2a89f | 2021-09-08 11:24:39 +0200 | [diff] [blame] | 7053 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 0, max := 0 }, |
| 7054 | { name := "TTCN3.bts.0.pdch.occupied.gprs", mtype := "g", min := 0, max := 0 }, |
| 7055 | { name := "TTCN3.bts.0.pdch.occupied.egprs", mtype := "g", min := 0, max := 0 } |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 7056 | }; |
| 7057 | f_statsd_expect(expect); |
| 7058 | |
Oliver Smith | 4b2a89f | 2021-09-08 11:24:39 +0200 | [diff] [blame] | 7059 | /* Establish an Uplink TBF for each GprsMS instance (3x GPRS, 1x EGPRS) */ |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 7060 | f_multi_ms_bssgp_register(); |
Oliver Smith | 4b2a89f | 2021-09-08 11:24:39 +0200 | [diff] [blame] | 7061 | f_ms_establish_ul_tbf(g_ms[0]); |
| 7062 | f_ms_establish_ul_tbf(g_ms[1]); |
| 7063 | f_ms_establish_ul_tbf(g_ms[2]); |
| 7064 | f_ms_establish_ul_tbf_2phase_access(g_ms[3], ts_RlcMacUlCtrl_PKT_RES_REQ(g_ms[3].tlli, ms_racap_egprs_def)); |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 7065 | |
| 7066 | /* 4 PDCHs occupied */ |
| 7067 | expect := { |
| 7068 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
Oliver Smith | 4b2a89f | 2021-09-08 11:24:39 +0200 | [diff] [blame] | 7069 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 4, max := 4 }, |
| 7070 | { name := "TTCN3.bts.0.pdch.occupied.gprs", mtype := "g", min := 3, max := 3 }, |
| 7071 | { name := "TTCN3.bts.0.pdch.occupied.egprs", mtype := "g", min := 1, max := 1 } |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 7072 | }; |
| 7073 | f_statsd_expect(expect); |
| 7074 | |
| 7075 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 7076 | } |
| 7077 | |
Oliver Smith | f04762d | 2021-09-14 17:20:38 +0200 | [diff] [blame] | 7078 | /* Test stats for available and occupied PDCHs, for MS which is not known by |
| 7079 | * the PCU (e.g. because it was forgotten due to no interaction, and old DL |
| 7080 | * data arrives from SGSN) */ |
| 7081 | function f_tc_stat_pdch_avail_occ_ms_not_known(boolean egprs) runs on RAW_PCU_Test_CT { |
| 7082 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 7083 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 7084 | |
| 7085 | /* Ensure a deterministic slot allocation of 1 PDCH with MS class 1 */ |
| 7086 | const MultislotCap_GPRS_BSSGP bssgp_mscap_gprs := { |
| 7087 | gprsmultislotclass := '00001'B, |
| 7088 | gprsextendeddynalloccap := '0'B |
| 7089 | }; |
| 7090 | const MultislotCap_EGPRS_BSSGP bssgp_mscap_egprs := { |
| 7091 | egprsmultislotclass := '00001'B, |
| 7092 | egprsextendeddynalloccap := '0'B |
| 7093 | }; |
| 7094 | template (value) MSRadioAccessCapabilityV_BSSGP bssgp_ms_racap_gprs := { |
| 7095 | valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, bssgp_mscap_gprs, omit)) }; |
| 7096 | template (value) MSRadioAccessCapabilityV_BSSGP bssgp_ms_racap_egprs := { |
| 7097 | valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, bssgp_mscap_gprs, bssgp_mscap_egprs)) }; |
| 7098 | |
| 7099 | /* Initialize NS/BSSGP side */ |
| 7100 | f_init_bssgp(); |
| 7101 | |
| 7102 | /* Only the 4 first TRX are enabled, each with 2 PDCHs. */ |
| 7103 | f_PCUIF_PDCHMask_set(info_ind, '00000011'B, 0); |
| 7104 | f_PCUIF_PDCHMask_set(info_ind, '00001100'B, 1); |
| 7105 | f_PCUIF_PDCHMask_set(info_ind, '11000000'B, 2); |
| 7106 | f_PCUIF_PDCHMask_set(info_ind, '00110000'B, 3); |
| 7107 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (4 .. 7)); |
| 7108 | |
| 7109 | /* Allocate 1 GprsMS instance */ |
| 7110 | f_init_gprs_ms(1); |
| 7111 | |
| 7112 | /* Initialize the PCU interface abstraction */ |
| 7113 | f_init_raw(testcasename(), info_ind); |
| 7114 | |
| 7115 | /* Reset stats */ |
| 7116 | f_statsd_reset(); |
| 7117 | |
| 7118 | /* Establish BSSGP */ |
| 7119 | f_bssgp_establish(); |
| 7120 | |
| 7121 | /* 8 PDCHs available, 0 occupied */ |
| 7122 | var StatsDExpects expect := { |
| 7123 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
| 7124 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 0, max := 0 }, |
| 7125 | { name := "TTCN3.bts.0.pdch.occupied.gprs", mtype := "g", min := 0, max := 0 }, |
| 7126 | { name := "TTCN3.bts.0.pdch.occupied.egprs", mtype := "g", min := 0, max := 0 } |
| 7127 | }; |
| 7128 | f_statsd_expect(expect); |
| 7129 | |
| 7130 | var GprsMS ms := g_ms[0]; /* We only use first MS in this test */ |
| 7131 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 7132 | |
| 7133 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 7134 | var octetstring data := f_rnd_octstring(1400); |
| 7135 | if (egprs) { |
| 7136 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, bssgp_ms_racap_egprs)); |
| 7137 | } else { |
| 7138 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, bssgp_ms_racap_gprs)); |
| 7139 | } |
| 7140 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 7141 | |
| 7142 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 7143 | f_sleep(X2002); |
| 7144 | |
| 7145 | /* 1 PDCH occupied */ |
| 7146 | if (egprs) { |
| 7147 | expect := { |
| 7148 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
| 7149 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 1, max := 1 }, |
| 7150 | { name := "TTCN3.bts.0.pdch.occupied.gprs", mtype := "g", min := 0, max := 0 }, |
| 7151 | { name := "TTCN3.bts.0.pdch.occupied.egprs", mtype := "g", min := 1, max := 1 } |
| 7152 | }; |
| 7153 | } else { |
| 7154 | expect := { |
| 7155 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
| 7156 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 1, max := 1 }, |
| 7157 | { name := "TTCN3.bts.0.pdch.occupied.gprs", mtype := "g", min := 1, max := 1 }, |
| 7158 | { name := "TTCN3.bts.0.pdch.occupied.egprs", mtype := "g", min := 0, max := 0 } |
| 7159 | }; |
| 7160 | } |
| 7161 | f_statsd_expect(expect); |
| 7162 | |
| 7163 | /* Clean up */ |
| 7164 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 7165 | } |
| 7166 | testcase TC_stat_pdch_avail_occ_ms_not_known_gprs() runs on RAW_PCU_Test_CT { |
| 7167 | f_tc_stat_pdch_avail_occ_ms_not_known(false); |
| 7168 | } |
| 7169 | testcase TC_stat_pdch_avail_occ_ms_not_known_egprs() runs on RAW_PCU_Test_CT { |
| 7170 | f_tc_stat_pdch_avail_occ_ms_not_known(true); |
| 7171 | } |
| 7172 | |
Pau Espin Pedrol | 6eb4d25 | 2021-11-15 11:53:40 +0100 | [diff] [blame] | 7173 | /* Make sure that bts.0.pdch.all_allocated is set when we allocate all resources */ |
| 7174 | testcase TC_ratectr_all_available_allocated() runs on RAW_PCU_Test_CT { |
| 7175 | var PCUIF_info_ind info_ind; |
| 7176 | var template IARRestOctets rest; |
| 7177 | var BIT11 ra11; |
| 7178 | |
| 7179 | info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 6eb4d25 | 2021-11-15 11:53:40 +0100 | [diff] [blame] | 7180 | |
| 7181 | /* Only the first TRX is enabled. */ |
| 7182 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 7183 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
| 7184 | |
| 7185 | /* Initialize the PCU interface abstraction */ |
| 7186 | f_init_raw(testcasename(), info_ind); |
| 7187 | f_statsd_reset(); |
| 7188 | |
| 7189 | var EGPRSPktChRequest req := { |
| 7190 | one_phase := { |
| 7191 | tag := '0'B, |
| 7192 | multislot_class := '10101'B, |
| 7193 | priority := '01'B, |
| 7194 | random_bits := '101'B |
| 7195 | } |
| 7196 | }; |
| 7197 | |
| 7198 | /* We send 7 requests, the IUT gives us all available USFs (0..6) */ |
| 7199 | for (var integer i := 0; i < 7; i := i + 1) { |
| 7200 | req.one_phase.random_bits := int2bit(f_rnd_int(8), 3); |
| 7201 | f_TC_egprs_pkt_chan_req(req, tr_IMM_TBF_ASS); |
| 7202 | } |
| 7203 | |
| 7204 | ra11 := enc_EGPRSPktChRequest2bits(req); |
| 7205 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(substr(ra11, 6, 5)), * }); |
| 7206 | |
| 7207 | /* At this point, the IUT should run out of free USFs */ |
Pau Espin Pedrol | 209dc7d | 2021-11-15 16:25:08 +0100 | [diff] [blame] | 7208 | f_TC_egprs_pkt_chan_req_reject(ra11, 1870, rest); |
Pau Espin Pedrol | 6eb4d25 | 2021-11-15 11:53:40 +0100 | [diff] [blame] | 7209 | |
| 7210 | /* bts.0.pdch.all_allocated is updated once per second, wait some time to make sure it was updated. */ |
| 7211 | f_sleep(2.0); |
| 7212 | var StatsDExpects expect := { |
| 7213 | { name := "TTCN3.bts.0.pdch.all_allocated", mtype := "c", min := 1, max := 1 } |
| 7214 | }; |
| 7215 | f_statsd_expect(expect); |
| 7216 | |
| 7217 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 7218 | } |
| 7219 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7220 | control { |
| 7221 | execute( TC_pcuif_suspend() ); |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 7222 | execute( TC_pcuif_suspend_active_tbf() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7223 | execute( TC_ta_ptcch_idle() ); |
| 7224 | execute( TC_ta_rach_imm_ass() ); |
Vadim Yanitskiy | 866f870 | 2021-05-26 14:50:27 +0200 | [diff] [blame] | 7225 | execute( TC_ta_ul_ack_nack_first_block() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7226 | execute( TC_ta_idle_dl_tbf_ass() ); |
| 7227 | execute( TC_ta_ptcch_ul_multi_tbf() ); |
| 7228 | execute( TC_cs_lqual_ul_tbf() ); |
| 7229 | execute( TC_cs_initial_ul() ); |
| 7230 | execute( TC_cs_max_ul() ); |
Pau Espin Pedrol | 7512259 | 2020-11-03 15:22:59 +0100 | [diff] [blame] | 7231 | execute( TC_cs_initial_dl() ); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 7232 | execute( TC_cs_max_dl() ); |
| 7233 | execute( TC_dl_cs1_to_cs4() ); |
Pau Espin Pedrol | 2354d6a | 2020-11-05 18:36:59 +0100 | [diff] [blame] | 7234 | execute( TC_mcs_initial_ul() ); |
Pau Espin Pedrol | db15fa7 | 2020-11-11 12:58:34 +0100 | [diff] [blame] | 7235 | execute( TC_mcs_max_ul() ); |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 7236 | execute( TC_mcs_initial_dl() ); |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 7237 | execute( TC_mcs_max_dl() ); |
Pau Espin Pedrol | 1451f9f | 2021-05-11 11:52:37 +0200 | [diff] [blame] | 7238 | execute( TC_t3141() ); |
Pau Espin Pedrol | f30fa1d | 2021-03-03 19:55:11 +0100 | [diff] [blame] | 7239 | execute( TC_n3101_max_t3169() ); |
Pau Espin Pedrol | cc895df | 2021-04-20 12:58:32 +0200 | [diff] [blame] | 7240 | execute( TC_n3103_max_t3169() ); |
Pau Espin Pedrol | 84a8c3c | 2021-03-01 17:22:29 +0100 | [diff] [blame] | 7241 | execute( TC_x2031_t3191() ); |
| 7242 | execute( TC_zero_x2031_t3191() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7243 | execute( TC_t3193() ); |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 7244 | execute( TC_n3105_max_t3195() ); |
Pau Espin Pedrol | e8a9444 | 2021-11-15 17:05:46 +0100 | [diff] [blame] | 7245 | execute( TC_t3172_wait_ind_size0() ); |
| 7246 | execute( TC_t3172_wait_ind_size1() ); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 7247 | execute( TC_countdown_procedure() ); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 7248 | execute( TC_ul_all_sizes() ); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 7249 | execute( TC_ul_data_toolong_fills_padding() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7250 | execute( TC_mo_ping_pong() ); |
| 7251 | execute( TC_mo_ping_pong_with_ul_racap() ); |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 7252 | execute( TC_force_two_phase_access() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7253 | execute( TC_mt_ping_pong() ); |
| 7254 | execute( TC_mt_ping_pong_with_dl_racap() ); |
Pau Espin Pedrol | e1195bb | 2020-07-07 13:27:18 +0200 | [diff] [blame] | 7255 | execute( TC_ul_intermediate_retrans() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7256 | execute( TC_imm_ass_dl_block_retrans() ); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 7257 | execute( TC_dl_flow_more_blocks() ); |
Pau Espin Pedrol | e1195bb | 2020-07-07 13:27:18 +0200 | [diff] [blame] | 7258 | execute( TC_ul_flow_multiple_llc_blocks() ); |
Pau Espin Pedrol | 90fdfed | 2021-03-02 17:29:32 +0100 | [diff] [blame] | 7259 | execute( TC_dl_no_ack_retrans_imm_ass() ); |
Pau Espin Pedrol | 6844c16 | 2022-04-01 15:40:06 +0200 | [diff] [blame] | 7260 | execute( TC_dl_llc_sapi_priority() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7261 | execute( TC_paging_cs_from_bts() ); |
| 7262 | execute( TC_paging_cs_from_sgsn_sign_ptmsi() ); |
| 7263 | execute( TC_paging_cs_from_sgsn_sign() ); |
| 7264 | execute( TC_paging_cs_from_sgsn_ptp() ); |
| 7265 | execute( TC_paging_ps_from_sgsn_sign_ptmsi() ); |
| 7266 | execute( TC_paging_ps_from_sgsn_sign() ); |
| 7267 | execute( TC_paging_ps_from_sgsn_ptp() ); |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 7268 | execute( TC_paging_pch_timeout() ); |
| 7269 | |
Vadim Yanitskiy | dbd4b24 | 2020-10-31 05:44:58 +0700 | [diff] [blame] | 7270 | execute( TC_paging_cs_multi_ms_imsi_tmsi() ); |
| 7271 | execute( TC_paging_cs_multi_ms_imsi() ); |
| 7272 | execute( TC_paging_cs_multi_ms_tmsi() ); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 7273 | execute( TC_bssgp_dl_unitdata_with_valid_imsi() ); |
| 7274 | execute( TC_bssgp_dl_unitdata_with_invalid_imsi() ); |
Pau Espin Pedrol | 2e459d6 | 2020-11-30 19:34:16 +0100 | [diff] [blame] | 7275 | execute( TC_dl_gprs_data_no_llc_ui_dummy() ); |
| 7276 | execute( TC_dl_egprs_data_no_llc_ui_dummy() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7277 | |
Pau Espin Pedrol | 0b6b0d0 | 2022-10-25 21:21:02 +0200 | [diff] [blame] | 7278 | execute( TC_ul_tbf_finished_pkt_dl_ass_pch() ); |
Pau Espin Pedrol | 99e00b4 | 2022-10-28 13:28:52 +0200 | [diff] [blame] | 7279 | execute( TC_ul_tbf_1phase_while_dl_ass_pch() ); |
| 7280 | execute( TC_ul_tbf_2phase_while_dl_ass_pch() ); |
Pau Espin Pedrol | 0b6b0d0 | 2022-10-25 21:21:02 +0200 | [diff] [blame] | 7281 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7282 | /* EGPRS specific test cases */ |
| 7283 | execute( TC_egprs_pkt_chan_req_signalling() ); |
| 7284 | execute( TC_egprs_pkt_chan_req_one_phase() ); |
| 7285 | execute( TC_egprs_pkt_chan_req_two_phase() ); |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 7286 | execute( TC_egprs_pkt_chan_req_reject_content() ); |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 7287 | execute( TC_egprs_pkt_chan_req_reject_emergency() ); |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 7288 | execute( TC_egprs_pkt_chan_req_reject_exhaustion() ); |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 7289 | |
| 7290 | execute( TC_mo_ping_pong_with_ul_racap_egprs_only() ); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 7291 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 7292 | /* Immediate Assignment on AGCH/PCH */ |
| 7293 | execute( TC_pcuif_fh_imm_ass_ul_egprs() ); |
| 7294 | execute( TC_pcuif_fh_imm_ass_ul() ); |
| 7295 | execute( TC_pcuif_fh_imm_ass_dl() ); |
| 7296 | /* Packet Uplink/Downlink Assignment on PACCH */ |
| 7297 | execute( TC_pcuif_fh_pkt_ass_ul() ); |
| 7298 | execute( TC_pcuif_fh_pkt_ass_dl() ); |
| 7299 | execute( TC_multitrx_multims_alloc() ); |
| 7300 | execute( TC_dl_multislot_tbf_ms_class_from_sgsn() ); |
| 7301 | execute( TC_dl_multislot_tbf_ms_class_from_2phase() ); |
| 7302 | execute( TC_ul_multislot_tbf_ms_class_from_2phase() ); |
Pau Espin Pedrol | 3760457 | 2021-10-15 14:36:16 +0200 | [diff] [blame] | 7303 | execute( TC_ul_tbf_reestablish_with_pkt_resource_req() ); |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 7304 | execute( TC_ul_tbf_reestablish_with_pkt_resource_req_t3168() ); |
Pau Espin Pedrol | 59aa109 | 2021-11-15 18:53:34 +0100 | [diff] [blame] | 7305 | execute( TC_ul_tbf_reestablish_with_pkt_dl_ack_nack() ); |
| 7306 | execute( TC_ul_tbf_reestablish_with_pkt_dl_ack_nack_egprs() ); |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 7307 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 7308 | execute( TC_multiplex_dl_gprs_egprs() ); |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 7309 | |
| 7310 | execute( TC_pcuif_info_ind_subsequent() ); |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 7311 | execute( TC_nacc_outbound_success() ); |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame^] | 7312 | execute( TC_nacc_outbound_success_utran() ); |
| 7313 | execute( TC_nacc_outbound_success_eutran() ); |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 7314 | execute( TC_nacc_outbound_success_no_ctrl_ack() ); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 7315 | execute( TC_nacc_outbound_success_twice() ); |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 7316 | execute( TC_nacc_outbound_success_twice_nocache() ); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 7317 | execute( TC_nacc_outbound_rac_ci_resolve_timeout() ); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 7318 | execute( TC_nacc_outbound_si_resolve_timeout() ); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 7319 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup() ); |
| 7320 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup2() ); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 7321 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup3() ); |
| 7322 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup4() ); |
| 7323 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup5() ); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 7324 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice() ); |
| 7325 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice2() ); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 7326 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice3() ); |
| 7327 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice4() ); |
| 7328 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice5() ); |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 7329 | execute( TC_nacc_outbound_pkt_cell_chg_notif_unassigned_dl_tbf() ); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 7330 | if (mp_ctrl_neigh_ip != "") { /* PCU using old CTRL neigh addr resolution iface */ |
| 7331 | execute( TC_nacc_outbound_rac_ci_resolve_conn_refused() ); |
| 7332 | execute( TC_nacc_outbound_rac_ci_resolve_fail_parse_response() ); |
| 7333 | } |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 7334 | |
| 7335 | execute( TC_rim_ran_info_req_single_rep() ); |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 7336 | execute( TC_rim_ran_info_req_single_rep_eutran() ); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 7337 | execute( TC_rim_ran_info_req_single_rep_no_si() ); |
Pau Espin Pedrol | 3aa61c6 | 2021-08-25 19:24:03 +0200 | [diff] [blame] | 7338 | |
| 7339 | execute (TC_pdch_energy_saving() ); |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 7340 | |
| 7341 | execute( TC_stat_pdch_avail_occ() ); |
Oliver Smith | f04762d | 2021-09-14 17:20:38 +0200 | [diff] [blame] | 7342 | execute( TC_stat_pdch_avail_occ_ms_not_known_gprs() ); |
| 7343 | execute( TC_stat_pdch_avail_occ_ms_not_known_egprs() ); |
Pau Espin Pedrol | 6eb4d25 | 2021-11-15 11:53:40 +0100 | [diff] [blame] | 7344 | execute( TC_ratectr_all_available_allocated() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7345 | } |
| 7346 | |
Harald Welte | a419df2 | 2019-03-21 17:23:04 +0100 | [diff] [blame] | 7347 | } |