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) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 449 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 450 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 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)); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 483 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 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))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 596 | f_ms_exp_dl_tbf_ass_ccch(ms); |
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) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 1062 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 1063 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 7512259 | 2020-11-03 15:22:59 +0100 | [diff] [blame] | 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) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 1105 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 1106 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 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) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 1335 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, bssgp_ms_racap_egprs_def, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 1336 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 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) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 1729 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 1730 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 84a8c3c | 2021-03-01 17:22:29 +0100 | [diff] [blame] | 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)); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 1789 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 84a8c3c | 2021-03-01 17:22:29 +0100 | [diff] [blame] | 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) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 1830 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 1831 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 84a8c3c | 2021-03-01 17:22:29 +0100 | [diff] [blame] | 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)); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 1864 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 84a8c3c | 2021-03-01 17:22:29 +0100 | [diff] [blame] | 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) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 1909 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 1910 | f_ms_exp_dl_tbf_ass_ccch(ms); |
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) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 1983 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 1984 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 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 */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 2056 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data2, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 2057 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 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) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 2121 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 2122 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | e8a9444 | 2021-11-15 17:05:46 +0100 | [diff] [blame] | 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) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 2437 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 2438 | f_ms_exp_dl_tbf_ass_ccch(ms); |
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) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 2627 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 2628 | f_ms_exp_dl_tbf_ass_ccch(ms); |
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) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 2782 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 2783 | f_ms_exp_dl_tbf_ass_ccch(ms); |
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. */ |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 2792 | f_ms_exp_dl_tbf_ass_ccch(ms); |
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) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 2833 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 2834 | f_ms_exp_dl_tbf_ass_ccch(ms); |
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) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 3030 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 3031 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 90fdfed | 2021-03-02 17:29:32 +0100 | [diff] [blame] | 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 */ |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 3050 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 90fdfed | 2021-03-02 17:29:32 +0100 | [diff] [blame] | 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) { |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 3129 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data_sapi_other, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Pau Espin Pedrol | 6844c16 | 2022-04-01 15:40:06 +0200 | [diff] [blame] | 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)); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 3135 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 6844c16 | 2022-04-01 15:40:06 +0200 | [diff] [blame] | 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; |
Pau Espin Pedrol | 1de8df7 | 2023-07-28 16:23:48 +0200 | [diff] [blame] | 3201 | var uint32_t dl_fn; |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 3202 | var uint32_t sched_fn; |
| 3203 | var GprsMS ms; |
| 3204 | timer T := 5.0; |
| 3205 | |
| 3206 | /* Initialize NS/BSSGP side */ |
| 3207 | f_init_bssgp(); |
| 3208 | /* Initialize GPRS MS side */ |
| 3209 | f_init_gprs_ms(); |
| 3210 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3211 | |
| 3212 | /* Only 1 TRX with 8 PDCH */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3213 | f_PCUIF_PDCHMask_set(info_ind, '11111111'B, 0); |
| 3214 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 3215 | |
| 3216 | /* Initialize the PCU interface abstraction */ |
| 3217 | f_init_raw(testcasename(), info_ind); |
| 3218 | |
| 3219 | /* Establish BSSGP connection to the PCU */ |
| 3220 | f_bssgp_establish(); |
| 3221 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3222 | |
| 3223 | /* Establish an Uplink TBF, this way the PCU can send DL Assignment |
| 3224 | through PDCH (no multiblock assignment possible through PCH) */ |
| 3225 | f_ms_establish_ul_tbf(ms); |
| 3226 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 3227 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
Pau Espin Pedrol | 1de8df7 | 2023-07-28 16:23:48 +0200 | [diff] [blame] | 3228 | dl_fn := f_ms_wait_usf(ms, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3229 | sched_fn := f_next_pdch_block(dl_fn); |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 3230 | |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 3231 | /* 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] | 3232 | contention resolution) and make sure it is ACKED fine */ |
Pau Espin Pedrol | 1de8df7 | 2023-07-28 16:23:48 +0200 | [diff] [blame] | 3233 | f_ms_tx_ul_data_block(ms, data, with_tlli := true, fn := sched_fn, |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 3234 | nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 3235 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3236 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, poll_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3237 | |
| 3238 | /* SGSN sends some DL data, PCU will assign DL TBF through PACCH */ |
| 3239 | var MultislotCap_GPRS_BSSGP mscap_gprs := { |
| 3240 | gprsmultislotclass := '10010'B, /* MS class 18, supports 8 DL and 8 UL */ |
| 3241 | gprsextendeddynalloccap := '0'B |
| 3242 | }; |
| 3243 | var MSRadioAccessCapabilityV_BSSGP ms_racap := { valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, mscap_gprs, omit)) }; |
| 3244 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap)); |
| 3245 | dl_block := f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3246 | if (f_dltbf_num_slots(ms.dl_tbf) != 8) { |
| 3247 | setverdict(fail, "Expected 8 PDCH slots allocated but got ", f_dltbf_num_slots(ms.dl_tbf)); |
| 3248 | f_shutdown(__BFILE__, __LINE__); |
| 3249 | } |
| 3250 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3251 | |
| 3252 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3253 | } |
| 3254 | |
Pau Espin Pedrol | 85ad3d0 | 2023-07-28 15:00:19 +0200 | [diff] [blame] | 3255 | /* Test DL TBF assignment over PACCH if Multislot class is unknown both at PCU |
| 3256 | * and SGSN (eg. because MS started 1-phase access and SGSN answered back). |
| 3257 | * Since the msclass is unknown, it shouldn't assign multiple timeslots since |
| 3258 | * the MS may not support it. Related OS#6118. */ |
| 3259 | testcase TC_dl_multislot_tbf_ms_class_unknown() runs on RAW_PCU_Test_CT |
| 3260 | { |
| 3261 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 3262 | var RlcmacDlBlock dl_block; |
| 3263 | var octetstring payload; |
| 3264 | var template (value) LlcBlockHdr blk_hdr; |
| 3265 | var template (value) LlcBlocks blocks; |
| 3266 | var uint32_t sched_fn; |
| 3267 | var uint32_t dl_fn; |
| 3268 | var template RlcmacDlBlock acknack_tmpl; |
| 3269 | var GprsMS ms; |
| 3270 | var octetstring data := f_rnd_octstring(10); |
| 3271 | |
| 3272 | /* Initialize NS/BSSGP side */ |
| 3273 | f_init_bssgp(); |
| 3274 | |
| 3275 | /* Only 1 TRX with 8 PDCH */ |
| 3276 | f_PCUIF_PDCHMask_set(info_ind, '11111111'B, 0); |
| 3277 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 3278 | |
| 3279 | /* Initialize GPRS MS side */ |
| 3280 | f_init_gprs_ms(); |
| 3281 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3282 | |
| 3283 | /* Initialize the PCU interface abstraction */ |
| 3284 | f_init_raw(testcasename(), info_ind); |
| 3285 | |
| 3286 | /* Establish BSSGP connection to the PCU */ |
| 3287 | f_bssgp_establish(); |
| 3288 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3289 | |
| 3290 | /* Establish an Uplink TBF. 1 TS is assigned over AGCH. */ |
| 3291 | f_ms_establish_ul_tbf(ms); |
| 3292 | |
| 3293 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 3294 | dl_fn := f_ms_wait_usf(ms, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3295 | sched_fn := f_next_pdch_block(dl_fn); |
| 3296 | |
| 3297 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 3298 | * contention resolution) and make sure it is ACKED fine. */ |
| 3299 | payload := f_rnd_octstring(16); /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
| 3300 | blk_hdr := t_RLCMAC_LLCBLOCK_HDR(length_ind := lengthof(payload), |
| 3301 | more := false, e := true); |
| 3302 | blocks := { t_RLCMAC_LLCBLOCK(payload, blk_hdr) }; |
| 3303 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
| 3304 | f_ms_tx_ul_data_blocks_gprs(ms, blocks, cv := 15, with_tlli := true, fn := sched_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3305 | |
| 3306 | /* UL block should be received in SGSN */ |
| 3307 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
| 3308 | |
| 3309 | acknack_tmpl := tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, |
| 3310 | tr_UlAckNackGprs(ms.tlli, |
| 3311 | tr_AckNackDescription(final_ack := '0'B))) |
| 3312 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn, acknack_tmpl, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3313 | |
| 3314 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, racap := omit)); |
| 3315 | dl_block := f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3316 | if (f_dltbf_num_slots(ms.dl_tbf) != 1) { |
| 3317 | setverdict(fail, "Expected 1 PDCH slots allocated but got ", f_dltbf_num_slots(ms.dl_tbf)); |
| 3318 | f_shutdown(__BFILE__, __LINE__); |
| 3319 | } |
| 3320 | |
| 3321 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3322 | } |
| 3323 | |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 3324 | 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] | 3325 | 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] | 3326 | var RlcmacDlBlock dl_block; |
| 3327 | var octetstring data := f_rnd_octstring(10); |
| 3328 | var PollFnCtx pollctx; |
| 3329 | var uint32_t sched_fn; |
| 3330 | var GprsMS ms; |
| 3331 | |
| 3332 | var MultislotCap_GPRS mscap_gprs := { |
| 3333 | gprsmultislotclass := '10010'B, /* MS class 18, supports 8 DL and 8 UL */ |
| 3334 | gprsextendeddynalloccap := '0'B |
| 3335 | }; |
| 3336 | var MSRadioAccessCapabilityV ms_racap := { valueof(ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs, omit)) }; |
| 3337 | |
| 3338 | |
| 3339 | /* Initialize NS/BSSGP side */ |
| 3340 | f_init_bssgp(); |
| 3341 | /* Initialize GPRS MS side */ |
| 3342 | f_init_gprs_ms(); |
| 3343 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3344 | |
| 3345 | /* Only 1 TRX with 8 PDCH */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3346 | f_PCUIF_PDCHMask_set(info_ind, '11111111'B, 0); |
| 3347 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 3348 | |
| 3349 | /* Initialize the PCU interface abstraction */ |
| 3350 | f_init_raw(testcasename(), info_ind); |
| 3351 | |
| 3352 | /* Establish BSSGP connection to the PCU */ |
| 3353 | f_bssgp_establish(); |
| 3354 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3355 | |
| 3356 | /* Send PACKET RESOURCE REQUEST to notify the MultiSlot Class */ |
| 3357 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap)); |
| 3358 | |
| 3359 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3360 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 3361 | |
| 3362 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 3363 | dl_block := f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3364 | if (f_dltbf_num_slots(ms.dl_tbf) != 8) { |
| 3365 | setverdict(fail, "Expected 8 PDCH slot allocated but got ", f_dltbf_num_slots(ms.dl_tbf)); |
| 3366 | f_shutdown(__BFILE__, __LINE__); |
| 3367 | } |
| 3368 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3369 | |
| 3370 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3371 | } |
| 3372 | |
Pau Espin Pedrol | a9f27fa | 2020-10-30 13:16:21 +0100 | [diff] [blame] | 3373 | testcase TC_ul_multislot_tbf_ms_class_from_2phase() runs on RAW_PCU_Test_CT { |
| 3374 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 3375 | var RlcmacDlBlock dl_block; |
| 3376 | var octetstring data := f_rnd_octstring(10); |
| 3377 | var PollFnCtx pollctx; |
| 3378 | var uint32_t sched_fn; |
| 3379 | var GprsMS ms; |
| 3380 | |
| 3381 | var MultislotCap_GPRS mscap_gprs := { |
| 3382 | gprsmultislotclass := '10010'B, /* MS class 18, supports 8 DL and 8 UL */ |
| 3383 | gprsextendeddynalloccap := '0'B |
| 3384 | }; |
| 3385 | var MSRadioAccessCapabilityV ms_racap := { valueof(ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs, omit)) }; |
| 3386 | |
| 3387 | |
| 3388 | /* Initialize NS/BSSGP side */ |
| 3389 | f_init_bssgp(); |
| 3390 | /* Initialize GPRS MS side */ |
| 3391 | f_init_gprs_ms(); |
| 3392 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3393 | |
| 3394 | /* Only 1 TRX with 8 PDCH */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3395 | f_PCUIF_PDCHMask_set(info_ind, '11111111'B, 0); |
| 3396 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | a9f27fa | 2020-10-30 13:16:21 +0100 | [diff] [blame] | 3397 | |
| 3398 | /* Initialize the PCU interface abstraction */ |
| 3399 | f_init_raw(testcasename(), info_ind); |
| 3400 | |
| 3401 | /* Establish BSSGP connection to the PCU */ |
| 3402 | f_bssgp_establish(); |
| 3403 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3404 | |
| 3405 | /* Send PACKET RESOURCE REQUEST to notify the MultiSlot Class */ |
| 3406 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap)); |
| 3407 | |
| 3408 | if (f_ultbf_num_slots(ms.ul_tbf) != 8) { |
| 3409 | setverdict(fail, "Expected 8 PDCH slot allocated but got ", f_ultbf_num_slots(ms.ul_tbf)); |
| 3410 | f_shutdown(__BFILE__, __LINE__); |
| 3411 | } |
| 3412 | |
| 3413 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3414 | } |
| 3415 | |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3416 | /* Test scenario where MS wants to request a new TBF once the current one is |
| 3417 | * ending, by means of sending a Packet Resource Request on ul slot provided by |
| 3418 | * last Pkt Ul ACK's RRBP. |
| 3419 | * See 3GPP TS 44.060 sec 9.3.2.4.2 "Non-extended uplink TBF mode" */ |
| 3420 | 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] | 3421 | var RlcmacDlBlock dl_block; |
| 3422 | var octetstring data := f_rnd_octstring(10); |
| 3423 | var uint32_t sched_fn; |
| 3424 | var uint32_t dl_fn; |
| 3425 | var template RlcmacDlBlock acknack_tmpl; |
| 3426 | var GprsMS ms; |
| 3427 | |
| 3428 | /* Initialize NS/BSSGP side */ |
| 3429 | f_init_bssgp(); |
| 3430 | /* Initialize GPRS MS side */ |
| 3431 | f_init_gprs_ms(); |
| 3432 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3433 | |
| 3434 | /* Initialize the PCU interface abstraction */ |
| 3435 | f_init_raw(testcasename()); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 3436 | f_statsd_reset(); |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3437 | |
| 3438 | /* Establish BSSGP connection to the PCU */ |
| 3439 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3440 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3441 | |
| 3442 | /* Establish an Uplink TBF */ |
| 3443 | f_ms_establish_ul_tbf(ms); |
| 3444 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 3445 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 3446 | f_ms_wait_usf(ms); |
| 3447 | |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3448 | /* 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] | 3449 | contention resolution) and make sure it is ACKED fine */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 3450 | 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] | 3451 | |
| 3452 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3453 | 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] | 3454 | |
| 3455 | acknack_tmpl := tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, |
| 3456 | tr_UlAckNackGprs(ms.tlli, |
| 3457 | tr_AckNackDescription(final_ack := '1'B), |
| 3458 | tr_UlAckNackGprsAdditionsRel99(tbf_est := true))) |
| 3459 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn, acknack_tmpl); |
| 3460 | |
| 3461 | /* TODO: verify TBF_EST and FinalACK are both '1' above */ |
| 3462 | |
| 3463 | /* Send PACKET RESOURCE REQUEST to request a new UL TBF */ |
Vadim Yanitskiy | f3cb4dd | 2020-07-21 01:52:33 +0700 | [diff] [blame] | 3464 | 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] | 3465 | 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] | 3466 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3467 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3468 | |
| 3469 | /* Send one UL block (without TLLI since we are in Second-Phase Access) |
| 3470 | and make sure it is ACKED fine */ |
| 3471 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := false); /* TODO: send using cs_mcs */ |
| 3472 | |
| 3473 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3474 | 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] | 3475 | |
| 3476 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn, acknack_tmpl); |
| 3477 | /* ACK the ACK */ |
| 3478 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3479 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 3480 | var StatsDExpects expect := { |
| 3481 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 1, max := 1 }, |
| 3482 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := 0, max := 0 }, |
| 3483 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := 1, max := 1 }, |
| 3484 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := 0, max := 0 }, |
| 3485 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 1, max := 1 }, |
| 3486 | { name := "TTCN3.bts.0.immediate.assignment_ul.one_phase", mtype := "c", min := 1, max := 1 }, |
| 3487 | { name := "TTCN3.bts.0.immediate.assignment_ul.two_phase", mtype := "c", min := 0, max := 0 }, |
| 3488 | { name := "TTCN3.bts.0.immediate.assignment_ul.contention_resolution_success", mtype := "c", min := 1, max := 1 }, |
| 3489 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 }, |
| 3490 | { name := "TTCN3.bts.0.pkt.ul_assignment", mtype := "c", min := 1, max := 1 } |
| 3491 | }; |
| 3492 | f_statsd_expect(expect); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 3493 | |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3494 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3495 | } |
| 3496 | |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3497 | /* Test scenario where MS wants to request a new TBF once the current one is |
| 3498 | * ending, by means of sending a Packet Resource Request on ul slot provided by |
| 3499 | * last Pkt Ul ACK's RRBP. new Pkt Ul Ass is never confirmed by the MS in this test. |
| 3500 | * 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] | 3501 | 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] | 3502 | var PCUIF_info_ind info_ind; |
| 3503 | var RlcmacDlBlock dl_block; |
| 3504 | var octetstring data := f_rnd_octstring(10); |
| 3505 | var uint32_t sched_fn; |
| 3506 | var uint32_t dl_fn; |
| 3507 | var template (value) TsTrxBtsNum nr; |
| 3508 | var BTS_PDTCH_Block data_msg; |
| 3509 | var template RlcmacDlBlock acknack_tmpl; |
| 3510 | var GprsMS ms; |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3511 | var integer cnt_rrbp := 0; |
| 3512 | var integer cnt_dummy_after_timeout := 0; |
| 3513 | /* Maximum T3168 value = 8 * 500 ms = 4s => * 4 retrans = 16s */ |
| 3514 | 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] | 3515 | |
| 3516 | /* Initialize NS/BSSGP side */ |
| 3517 | f_init_bssgp(); |
| 3518 | /* Initialize GPRS MS side */ |
| 3519 | f_init_gprs_ms(); |
| 3520 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3521 | |
| 3522 | /* Initialize the PCU interface abstraction */ |
| 3523 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3524 | /* 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] | 3525 | f_init_raw(testcasename(), info_ind); |
| 3526 | |
| 3527 | /* Establish BSSGP connection to the PCU */ |
| 3528 | f_bssgp_establish(); |
| 3529 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3530 | |
| 3531 | /* Establish an Uplink TBF */ |
| 3532 | f_ms_establish_ul_tbf(ms); |
| 3533 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 3534 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 3535 | f_ms_wait_usf(ms); |
| 3536 | |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3537 | /* 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] | 3538 | contention resolution) and make sure it is ACKED fine */ |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3539 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
| 3540 | |
| 3541 | /* UL block should be received in SGSN */ |
| 3542 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
| 3543 | |
| 3544 | acknack_tmpl := tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, |
| 3545 | tr_UlAckNackGprs(ms.tlli, |
| 3546 | tr_AckNackDescription(final_ack := '1'B), |
| 3547 | tr_UlAckNackGprsAdditionsRel99(tbf_est := true))) |
| 3548 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn, acknack_tmpl); |
| 3549 | |
| 3550 | /* TODO: verify TBF_EST and FinalACK are both '1' above */ |
| 3551 | |
| 3552 | /* Send PACKET RESOURCE REQUEST to request a new UL TBF */ |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3553 | T_3168.start; |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3554 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, omit)), sched_fn); |
| 3555 | |
| 3556 | /* Now Keep ignoring the Pkt Ul Ass on PACCH: */ |
| 3557 | /* Now we go on receiving DL data and not answering RRBP: */ |
| 3558 | nr := ts_TsTrxBtsNum; |
| 3559 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 3560 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 3561 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 3562 | block_nr := nr.blk_nr)); |
| 3563 | alt { |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3564 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3565 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 3566 | tr_RLCMAC_UL_PACKET_ASS)) -> value data_msg { |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3567 | /* We should not be receiving PKT UL ASS anymore after T3168 timeout */ |
| 3568 | if (not T_3168.running) { |
| 3569 | setverdict(fail, log2str("Unexpected PKT UL ASS after T3168 timeout: ", data_msg)); |
| 3570 | f_shutdown(__BFILE__, __LINE__); |
| 3571 | } |
| 3572 | |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3573 | if (f_dl_block_rrbp_valid(data_msg.dl_block)) { |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3574 | log("Ignoring RRBP ", cnt_rrbp); |
| 3575 | cnt_rrbp := cnt_rrbp + 1; |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3576 | } |
| 3577 | nr := ts_TsTrxBtsNum; |
| 3578 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 3579 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 3580 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 3581 | block_nr := nr.blk_nr)); |
| 3582 | repeat; |
| 3583 | } |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3584 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3585 | 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] | 3586 | tr_RLCMAC_DL_DUMMY_CTRL)) -> value data_msg { |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3587 | nr := ts_TsTrxBtsNum; |
| 3588 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 3589 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 3590 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 3591 | block_nr := nr.blk_nr)); |
| 3592 | repeat; |
| 3593 | } |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3594 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3595 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 3596 | omit)) -> value data_msg { |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3597 | |
| 3598 | /* T3168 expired and we are not receiving blocks anymore, meaning PCU released the TBF. */ |
| 3599 | break; |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3600 | } |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3601 | [] BTS.receive { |
| 3602 | setverdict(fail, "Unexpected BTS message"); |
| 3603 | f_shutdown(__BFILE__, __LINE__); |
| 3604 | } |
| 3605 | } |
| 3606 | |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 3607 | /* Check that we received at least a few PKT UL ASS before T3168 expiration */ |
| 3608 | if (cnt_rrbp <= 3) { |
| 3609 | setverdict(fail, log2str("Received only ", cnt_rrbp, " before T3168 timeout!")); |
| 3610 | f_shutdown(__BFILE__, __LINE__); |
| 3611 | } |
| 3612 | |
Pau Espin Pedrol | d658f34 | 2021-10-15 14:52:22 +0200 | [diff] [blame] | 3613 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3614 | } |
| 3615 | |
Pau Espin Pedrol | 59aa109 | 2021-11-15 18:53:34 +0100 | [diff] [blame] | 3616 | /* Test scenario where MS wants to request a new UL TBF using a DL (EGPRS) ACK/NACK |
| 3617 | * transmitted on ul slot provided by its DL TBF. |
| 3618 | * See 3GPP TS 44.060 sec 9.3.2.4.2 "Non-extended uplink TBF mode" */ |
| 3619 | function f_TC_ul_tbf_reestablish_with_pkt_dl_ack_nack(boolean use_egprs) runs on RAW_PCU_Test_CT { |
| 3620 | var GprsMS ms; |
| 3621 | var octetstring data := f_rnd_octstring(10); |
| 3622 | var RlcmacDlBlock dl_block; |
| 3623 | var template RlcmacDlBlock rej_tmpl; |
| 3624 | var uint32_t dl_fn; |
| 3625 | var uint32_t sched_fn; |
| 3626 | var template (value) MSRadioAccessCapabilityV_BSSGP racap_tmpl; |
| 3627 | |
| 3628 | if (use_egprs == true) { |
| 3629 | racap_tmpl := bssgp_ms_racap_egprs_def; |
| 3630 | } else { |
| 3631 | racap_tmpl := bssgp_ms_racap_gprs_def; |
| 3632 | } |
| 3633 | |
| 3634 | /* Initialize NS/BSSGP side */ |
| 3635 | f_init_bssgp(); |
| 3636 | /* Initialize GPRS MS side */ |
| 3637 | f_init_gprs_ms(); |
| 3638 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3639 | /* Initialize the PCU interface abstraction */ |
| 3640 | f_init_raw(testcasename()); |
| 3641 | |
| 3642 | /* Establish BSSGP connection to the PCU */ |
| 3643 | f_bssgp_establish(); |
| 3644 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3645 | |
| 3646 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 3647 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, racap_tmpl, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 3648 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 59aa109 | 2021-11-15 18:53:34 +0100 | [diff] [blame] | 3649 | |
| 3650 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 3651 | f_sleep(X2002); |
| 3652 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 3653 | |
| 3654 | /* ACK the DL block, asking for new UL TBF by including ChanReqDesc */ |
| 3655 | f_dltbf_ack_block(ms.dl_tbf, dl_block, '1'B); |
| 3656 | f_ms_tx_ul_block(ms, f_dltbf_ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf, use_egprs, ts_ChannelReqDescription()), |
| 3657 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 3658 | |
| 3659 | /* We should receive a Pkt Ul ASS */ |
| 3660 | f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_UL_PACKET_ASS); |
| 3661 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3662 | } |
| 3663 | testcase TC_ul_tbf_reestablish_with_pkt_dl_ack_nack() runs on RAW_PCU_Test_CT { |
| 3664 | f_TC_ul_tbf_reestablish_with_pkt_dl_ack_nack(false); |
| 3665 | } |
| 3666 | testcase TC_ul_tbf_reestablish_with_pkt_dl_ack_nack_egprs() runs on RAW_PCU_Test_CT { |
| 3667 | f_TC_ul_tbf_reestablish_with_pkt_dl_ack_nack(true); |
| 3668 | } |
| 3669 | |
Pau Espin Pedrol | e8e3b96 | 2023-07-24 16:43:26 +0200 | [diff] [blame] | 3670 | /* Test UL data blocks BSN 0..127 and then continue again at BSN 0... up to 300 |
| 3671 | * BSNs in total to test several wrap arounds. */ |
| 3672 | testcase TC_ul_tbf_bsn_wraparound_gprs() runs on RAW_PCU_Test_CT |
| 3673 | { |
| 3674 | var PCUIF_info_ind info_ind; |
| 3675 | var RlcmacDlBlock dl_block; |
| 3676 | var octetstring payload; |
Pau Espin Pedrol | e8e3b96 | 2023-07-24 16:43:26 +0200 | [diff] [blame] | 3677 | var template (value) LlcBlockHdr blk_hdr; |
| 3678 | var template (value) LlcBlocks blocks; |
| 3679 | var uint32_t sched_fn; |
| 3680 | var uint32_t dl_fn; |
| 3681 | var template (value) TsTrxBtsNum nr; |
| 3682 | var BTS_PDTCH_Block data_msg; |
| 3683 | var template RlcmacDlBlock acknack_tmpl; |
| 3684 | var GprsMS ms; |
| 3685 | var integer blocks_sent := 0; |
| 3686 | var integer blocks_received := 0; |
| 3687 | const integer target_bsn_set := 300; |
| 3688 | |
| 3689 | /* Initialize NS/BSSGP side */ |
| 3690 | f_init_bssgp(); |
| 3691 | /* Initialize GPRS MS side */ |
| 3692 | f_init_gprs_ms(); |
| 3693 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3694 | |
| 3695 | /* Initialize the PCU interface abstraction */ |
| 3696 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 3697 | f_init_raw(testcasename(), info_ind); |
| 3698 | |
| 3699 | /* Establish BSSGP connection to the PCU */ |
| 3700 | f_bssgp_establish(); |
| 3701 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3702 | |
| 3703 | /* Establish an Uplink TBF */ |
| 3704 | f_ms_establish_ul_tbf(ms); |
| 3705 | |
| 3706 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 3707 | dl_fn := f_ms_wait_usf(ms); |
| 3708 | sched_fn := f_next_pdch_block(dl_fn); |
| 3709 | |
| 3710 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 3711 | contention resolution) and make sure it is ACKED fine. */ |
| 3712 | payload := f_rnd_octstring(16); /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
| 3713 | blk_hdr := t_RLCMAC_LLCBLOCK_HDR(length_ind := lengthof(payload), |
| 3714 | more := false, e := true); |
| 3715 | blocks := { t_RLCMAC_LLCBLOCK(payload, blk_hdr) }; |
| 3716 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
Pau Espin Pedrol | bd849cc | 2023-07-28 14:54:46 +0200 | [diff] [blame] | 3717 | f_ms_tx_ul_data_blocks_gprs(ms, blocks, cv := 15, with_tlli := true, fn := sched_fn); |
Pau Espin Pedrol | e8e3b96 | 2023-07-24 16:43:26 +0200 | [diff] [blame] | 3718 | blocks_sent := blocks_sent + 1; |
| 3719 | |
| 3720 | /* UL block should be received in SGSN */ |
| 3721 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
| 3722 | |
| 3723 | acknack_tmpl := tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, |
| 3724 | tr_UlAckNackGprs(ms.tlli, |
| 3725 | tr_AckNackDescription(final_ack := '0'B))) |
| 3726 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn, acknack_tmpl); |
| 3727 | |
Pau Espin Pedrol | e8e3b96 | 2023-07-24 16:43:26 +0200 | [diff] [blame] | 3728 | nr := f_ms_tx_TsTrxBtsNum(ms); |
| 3729 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 3730 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 3731 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 3732 | block_nr := nr.blk_nr)); |
| 3733 | alt { |
| 3734 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 3735 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 3736 | tr_RLCMAC_UL_ACK_NACK_GPRS)) -> value data_msg { |
| 3737 | |
| 3738 | if (f_dl_block_rrbp_valid(data_msg.dl_block)) { |
| 3739 | var uint32_t ack_fn := f_dl_block_ack_fn(data_msg.dl_block, data_msg.raw.fn) |
| 3740 | log("ACKING FN ", data_msg.raw.fn, " on FN ", ack_fn); |
| 3741 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), ack_fn); |
| 3742 | } |
Pau Espin Pedrol | bd849cc | 2023-07-28 14:54:46 +0200 | [diff] [blame] | 3743 | f_ms_tx_ul_data_blocks_gprs(ms, blocks); |
Pau Espin Pedrol | e8e3b96 | 2023-07-24 16:43:26 +0200 | [diff] [blame] | 3744 | blocks_sent := blocks_sent + 1; |
| 3745 | |
| 3746 | if (blocks_sent == target_bsn_set) { |
| 3747 | break; |
| 3748 | } |
| 3749 | |
| 3750 | nr := f_ms_tx_TsTrxBtsNum(ms); |
| 3751 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 3752 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 3753 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 3754 | block_nr := nr.blk_nr)); |
| 3755 | repeat; |
| 3756 | } |
| 3757 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 3758 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 3759 | tr_RLCMAC_DL_DUMMY_CTRL)) -> value data_msg { |
| 3760 | |
Pau Espin Pedrol | bd849cc | 2023-07-28 14:54:46 +0200 | [diff] [blame] | 3761 | f_ms_tx_ul_data_blocks_gprs(ms, blocks); |
Pau Espin Pedrol | e8e3b96 | 2023-07-24 16:43:26 +0200 | [diff] [blame] | 3762 | blocks_sent := blocks_sent + 1; |
| 3763 | |
| 3764 | if (blocks_sent == target_bsn_set) { |
| 3765 | break; |
| 3766 | } |
| 3767 | |
| 3768 | nr := f_ms_tx_TsTrxBtsNum(ms); |
| 3769 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 3770 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 3771 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 3772 | block_nr := nr.blk_nr)); |
| 3773 | repeat; |
| 3774 | } |
| 3775 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 3776 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 3777 | omit)) -> value data_msg { |
| 3778 | nr := f_ms_tx_TsTrxBtsNum(ms); |
| 3779 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 3780 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 3781 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 3782 | block_nr := nr.blk_nr)); |
| 3783 | repeat; |
| 3784 | } |
| 3785 | [] BTS.receive { |
| 3786 | setverdict(fail, "Unexpected BTS message"); |
| 3787 | f_shutdown(__BFILE__, __LINE__); |
| 3788 | } |
| 3789 | [] BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)) { |
| 3790 | blocks_received := blocks_received + 1; |
| 3791 | repeat; |
| 3792 | } |
| 3793 | } |
| 3794 | |
| 3795 | /* Validate most part of them were accepted and forwarded: */ |
| 3796 | if (blocks_received < target_bsn_set * 95 / 100) { |
| 3797 | setverdict(fail, "Forwarded ", blocks_received, " out of ", target_bsn_set, " transmitted"); |
| 3798 | f_shutdown(__BFILE__, __LINE__); |
| 3799 | } |
| 3800 | log("Forwarded ", blocks_received, " out of ", target_bsn_set, " transmitted"); |
| 3801 | |
| 3802 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3803 | } |
| 3804 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3805 | /* Test CS paging over the BTS<->PCU socket. |
| 3806 | * 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. |
| 3807 | * Paging should be send on the PACCH. |
| 3808 | * |
| 3809 | * 1. Send a Paging Request over PCU socket. |
| 3810 | * 2. Send a Ready-To-Send message over PCU socket |
| 3811 | * 3. Expect a Paging Frame |
| 3812 | */ |
| 3813 | 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] | 3814 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3815 | var MobileIdentityLV mi; |
| 3816 | var octetstring mi_enc_lv; |
| 3817 | var hexstring imsi := f_gen_imsi(42); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3818 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3819 | |
| 3820 | /* Initialize NS/BSSGP side */ |
| 3821 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3822 | /* Initialize GPRS MS side */ |
| 3823 | f_init_gprs_ms(); |
| 3824 | 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] | 3825 | |
| 3826 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3827 | 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] | 3828 | |
| 3829 | /* Establish BSSGP connection to the PCU */ |
| 3830 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3831 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3832 | |
| 3833 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3834 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3835 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 3836 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 3837 | f_ms_wait_usf(ms); |
| 3838 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3839 | /* build mobile Identity */ |
| 3840 | mi := valueof(ts_MI_IMSI_LV(imsi)); |
| 3841 | mi_enc_lv := enc_MobileIdentityLV(mi); |
| 3842 | /* Send paging request */ |
| 3843 | BTS.send(ts_PCUIF_PAG_REQ(bts_nr := 0, id_lv := mi_enc_lv, chan_needed := 0, |
| 3844 | sapi :=PCU_IF_SAPI_PDTCH)); |
| 3845 | |
| 3846 | /* Receive it on BTS side towards MS */ |
| 3847 | f_rx_rlcmac_dl_block_exp_pkt_pag_req(dl_block); |
| 3848 | |
| 3849 | /* Make sure that Packet Paging Request contains the same IMSI */ |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3850 | var PacketPagingReq req := dl_block.ctrl.payload.u.paging; |
| 3851 | if (not f_pkt_paging_match_imsi(req, imsi, ps_domain := false)) { |
| 3852 | setverdict(fail, "Failed to match IMSI ", imsi, " in ", req); |
| 3853 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3854 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3855 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3856 | } |
| 3857 | |
| 3858 | /* Test CS paging over Gb (SGSN->PCU->BTS[PDCH]). |
| 3859 | */ |
| 3860 | private function f_tc_paging_cs_from_sgsn(Nsvci bvci, boolean use_ptmsi := false) |
| 3861 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3862 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3863 | var hexstring imsi := f_gen_imsi(42); |
| 3864 | var GsmTmsi tmsi; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3865 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3866 | |
| 3867 | /* Initialize NS/BSSGP side */ |
| 3868 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3869 | /* Initialize GPRS MS side */ |
| 3870 | f_init_gprs_ms(); |
| 3871 | 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] | 3872 | |
| 3873 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3874 | 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] | 3875 | |
| 3876 | /* Establish BSSGP connection to the PCU */ |
| 3877 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3878 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3879 | |
| 3880 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3881 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3882 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 3883 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 3884 | f_ms_wait_usf(ms); |
| 3885 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3886 | /* Send paging request with or without TMSI */ |
| 3887 | if (use_ptmsi) { |
| 3888 | tmsi := oct2int(f_rnd_octstring(4)); /* Random P-TMSI */ |
| 3889 | BSSGP[0].send(ts_BSSGP_CS_PAGING_PTMSI(bvci, imsi, tmsi)); |
| 3890 | } else { |
| 3891 | BSSGP[0].send(ts_BSSGP_CS_PAGING_IMSI(bvci, imsi)); |
| 3892 | } |
| 3893 | |
Pau Espin Pedrol | 00fec58 | 2022-11-29 16:03:13 +0100 | [diff] [blame] | 3894 | /* Now receive it on BTS side towards MS. |
| 3895 | * Skip any dummy blocks in case the PCUIF req arrives before the BSSP CS_PAGING: |
| 3896 | */ |
| 3897 | f_rx_rlcmac_dl_block_skip_dummy(dl_block, max_dummy := 10); |
| 3898 | |
| 3899 | if (not match(dl_block, tr_RLCMAC_PACKET_PAG_REQ())) { |
| 3900 | setverdict(fail, "Failed to match Packet Paging Request: ", |
| 3901 | dl_block, " vs ", tr_RLCMAC_PACKET_PAG_REQ()); |
| 3902 | f_shutdown(__BFILE__, __LINE__); |
| 3903 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3904 | |
| 3905 | /* Make sure that Packet Paging Request contains the same P-TMSI/IMSI */ |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3906 | var PacketPagingReq req := dl_block.ctrl.payload.u.paging; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3907 | if (use_ptmsi) { |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3908 | if (not f_pkt_paging_match_tmsi(req, tmsi, ps_domain := false)) { |
| 3909 | setverdict(fail, "Failed to match P-TMSI ", tmsi, " in ", req); |
| 3910 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3911 | } else { |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3912 | if (not f_pkt_paging_match_imsi(req, imsi, ps_domain := false)) { |
| 3913 | setverdict(fail, "Failed to match IMSI ", imsi, " in ", req); |
| 3914 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3915 | } |
| 3916 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3917 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3918 | } |
| 3919 | |
| 3920 | testcase TC_paging_cs_from_sgsn_sign_ptmsi() runs on RAW_PCU_Test_CT { |
| 3921 | f_tc_paging_cs_from_sgsn(0, true); |
| 3922 | } |
| 3923 | |
| 3924 | testcase TC_paging_cs_from_sgsn_sign() runs on RAW_PCU_Test_CT { |
| 3925 | f_tc_paging_cs_from_sgsn(0); |
| 3926 | } |
| 3927 | |
| 3928 | 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] | 3929 | 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] | 3930 | } |
| 3931 | |
| 3932 | /* Test PS paging over Gb (SGSN->PCU->BTS[CCCH]). |
| 3933 | */ |
| 3934 | private function f_tc_paging_ps_from_sgsn(Nsvci bvci, boolean use_ptmsi := false) |
| 3935 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3936 | var integer imsi_suff_tx := 423; |
| 3937 | var hexstring imsi := f_gen_imsi(imsi_suff_tx); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3938 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3939 | |
| 3940 | /* Initialize NS/BSSGP side */ |
| 3941 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3942 | /* Initialize GPRS MS side */ |
| 3943 | f_init_gprs_ms(); |
| 3944 | 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] | 3945 | |
Oliver Smith | 61b4e73 | 2021-07-22 08:14:29 +0200 | [diff] [blame] | 3946 | f_statsd_reset(); |
| 3947 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3948 | /* Establish BSSGP connection to the PCU */ |
| 3949 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3950 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3951 | |
| 3952 | /* Send BSSGP PAGING-PS (with or without TMSI), wait for RR Paging Request Type 1. |
| 3953 | * Make sure that both paging group (IMSI suffix) and Mobile Identity match. */ |
| 3954 | if (use_ptmsi) { |
| 3955 | var OCT4 tmsi := f_rnd_octstring(4); /* Random P-TMSI */ |
| 3956 | BSSGP[0].send(ts_BSSGP_PS_PAGING_PTMSI(bvci, imsi, oct2int(tmsi))); |
| 3957 | f_pcuif_rx_pch_pag_req1(t_MI_TMSI(tmsi), imsi_suff_tx); |
| 3958 | } else { |
| 3959 | BSSGP[0].send(ts_BSSGP_PS_PAGING_IMSI(bvci, imsi)); |
| 3960 | f_pcuif_rx_pch_pag_req1(tr_MI_IMSI(imsi), imsi_suff_tx); |
| 3961 | } |
| 3962 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 3963 | var StatsDExpects expect := { |
| 3964 | { name := "TTCN3.pcu.sgsn.0.rx_paging_ps", mtype := "c", min := 1, max := 1 }, |
| 3965 | /* After the PCU receives the paging request from SGSN, |
| 3966 | * and it doesn't have any errors, PCU sends it to the |
| 3967 | * BTS to do paging over PCH. */ |
| 3968 | { name := "TTCN3.bts.0.pch.requests", mtype := "c", min := 1, max := 1 } |
| 3969 | }; |
| 3970 | f_statsd_expect(expect); |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3971 | } |
| 3972 | |
| 3973 | testcase TC_paging_ps_from_sgsn_sign_ptmsi() runs on RAW_PCU_Test_CT { |
| 3974 | /* Initialize the PCU interface abstraction */ |
| 3975 | f_init_raw(testcasename()); |
| 3976 | |
| 3977 | f_tc_paging_ps_from_sgsn(0, true); |
Oliver Smith | 61b4e73 | 2021-07-22 08:14:29 +0200 | [diff] [blame] | 3978 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3979 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3980 | } |
| 3981 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3982 | 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] | 3983 | /* Initialize the PCU interface abstraction */ |
| 3984 | f_init_raw(testcasename()); |
| 3985 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3986 | f_tc_paging_ps_from_sgsn(0); |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3987 | |
| 3988 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3989 | } |
| 3990 | |
| 3991 | 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] | 3992 | /* Initialize the PCU interface abstraction */ |
| 3993 | f_init_raw(testcasename()); |
| 3994 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3995 | f_tc_paging_ps_from_sgsn(mp_gb_cfg.bvc[0].bvci); |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3996 | |
| 3997 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3998 | } |
| 3999 | |
Oliver Smith | e1a77c4 | 2021-07-28 13:36:09 +0200 | [diff] [blame] | 4000 | testcase TC_paging_pch_timeout() runs on RAW_PCU_Test_CT { |
| 4001 | /* Initialize the PCU interface abstraction */ |
| 4002 | f_init_raw(testcasename()); |
| 4003 | |
| 4004 | /* Set T3113 to 1s to shorten the test duration */ |
| 4005 | f_vty_config2(PCUVTY, {"pcu"}, "timer T3113 1"); |
| 4006 | |
| 4007 | /* Reset stats and send paging PS request */ |
| 4008 | f_tc_paging_ps_from_sgsn(mp_gb_cfg.bvc[0].bvci); |
| 4009 | |
| 4010 | /* Verify that counter increases when T3113 times out (MS did not start |
| 4011 | * TBF to respond to paging). */ |
| 4012 | f_sleep(1.2); |
| 4013 | var StatsDExpects expect := { |
| 4014 | { name := "TTCN3.bts.0.pch.requests.timeout", mtype := "c", min := 1, max := 1 } |
| 4015 | }; |
| 4016 | f_statsd_expect(expect); |
| 4017 | |
| 4018 | f_vty_config2(PCUVTY, {"pcu"}, "timer T3113 default"); |
| 4019 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4020 | } |
| 4021 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 4022 | /* Verify osmo-pcu handles DL UNIT_DATA from SGSN with IMSI IE correctly. See OS#4729 */ |
| 4023 | testcase TC_bssgp_dl_unitdata_with_valid_imsi() runs on RAW_PCU_Test_CT { |
| 4024 | var RlcmacDlBlock dl_block; |
| 4025 | var octetstring data := f_rnd_octstring(10); |
| 4026 | var uint32_t sched_fn; |
| 4027 | var uint32_t dl_fn; |
| 4028 | var GprsMS ms; |
| 4029 | |
| 4030 | /* Initialize NS/BSSGP side */ |
| 4031 | f_init_bssgp(); |
| 4032 | /* Initialize GPRS MS side */ |
| 4033 | f_init_gprs_ms(); |
| 4034 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4035 | |
| 4036 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 4037 | 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] | 4038 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 4039 | f_statsd_reset(); |
| 4040 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 4041 | /* Establish BSSGP connection to the PCU */ |
| 4042 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 4043 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 4044 | |
| 4045 | /* Establish an Uplink TBF */ |
| 4046 | f_ms_establish_ul_tbf(ms); |
| 4047 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 4048 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 4049 | f_ms_wait_usf(ms); |
| 4050 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 4051 | /* 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] | 4052 | 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] | 4053 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4054 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4055 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4056 | |
| 4057 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 4058 | 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] | 4059 | |
| 4060 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 4061 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 4062 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 4063 | |
| 4064 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 4065 | f_sleep(X2002); |
| 4066 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 4067 | |
| 4068 | /* ACK the DL block */ |
| 4069 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 4070 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 4071 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 4072 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 4073 | var StatsDExpects expect := { |
| 4074 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 1, max := 1}, |
| 4075 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 1, max := 1}, |
| 4076 | { name := "TTCN3.bts.0.tbf.dl.alloc", mtype := "c", min := 1, max := 1}, |
| 4077 | { 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] | 4078 | { 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] | 4079 | { 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] | 4080 | }; |
| 4081 | f_statsd_expect(expect); |
| 4082 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 4083 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4084 | } |
| 4085 | |
| 4086 | /* Verify osmo-pcu acts on incorrect IMSI IE content in DL UNIT_DATA from SGSN. See OS#4729 */ |
| 4087 | testcase TC_bssgp_dl_unitdata_with_invalid_imsi() runs on RAW_PCU_Test_CT { |
| 4088 | var RlcmacDlBlock dl_block; |
| 4089 | var octetstring data := f_rnd_octstring(10); |
| 4090 | var uint32_t sched_fn; |
| 4091 | var uint32_t dl_fn; |
| 4092 | var GprsMS ms; |
| 4093 | |
| 4094 | /* Initialize NS/BSSGP side */ |
| 4095 | f_init_bssgp(); |
| 4096 | /* Initialize GPRS MS side */ |
| 4097 | f_init_gprs_ms(); |
| 4098 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4099 | |
| 4100 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 4101 | 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] | 4102 | |
| 4103 | /* Establish BSSGP connection to the PCU */ |
| 4104 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 4105 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 4106 | |
| 4107 | /* Establish an Uplink TBF */ |
| 4108 | f_ms_establish_ul_tbf(ms); |
| 4109 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 4110 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 4111 | f_ms_wait_usf(ms); |
| 4112 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 4113 | /* 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] | 4114 | 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] | 4115 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4116 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4117 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4118 | |
| 4119 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 4120 | 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] | 4121 | |
| 4122 | /* Now SGSN sends some DL data with an invalid IMSI */ |
| 4123 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI('1122'H))); |
| 4124 | |
Pau Espin Pedrol | f7e947a | 2021-01-25 18:51:33 +0100 | [diff] [blame] | 4125 | 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] | 4126 | |
| 4127 | /* TODO: make sure no data is sent over PCU -> MS */ |
| 4128 | |
| 4129 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4130 | } |
| 4131 | |
Pau Espin Pedrol | 2e459d6 | 2020-11-30 19:34:16 +0100 | [diff] [blame] | 4132 | private function f_tc_dl_data_no_llc_ui_dummy(template (omit) MSRadioAccessCapabilityV_BSSGP ms_racap := omit) runs on RAW_PCU_Test_CT { |
| 4133 | var AckNackDescription ack_nack_desc := valueof(t_AckNackDescription_init); |
| 4134 | var octetstring data := f_rnd_octstring(6); |
| 4135 | var RlcmacDlBlock dl_block; |
| 4136 | var GprsMS ms; |
| 4137 | var uint32_t fn; |
| 4138 | |
| 4139 | /* Initialize NS/BSSGP side */ |
| 4140 | f_init_bssgp(); |
| 4141 | /* Initialize GPRS MS side */ |
| 4142 | f_init_gprs_ms(); |
| 4143 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4144 | |
| 4145 | /* Initialize the PCU interface abstraction */ |
| 4146 | f_init_raw(testcasename()); |
| 4147 | |
| 4148 | /* Establish BSSGP connection to the PCU */ |
| 4149 | f_bssgp_establish(); |
| 4150 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4151 | |
| 4152 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 4153 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 4154 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 2e459d6 | 2020-11-30 19:34:16 +0100 | [diff] [blame] | 4155 | |
| 4156 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 4157 | f_sleep(X2002); |
| 4158 | |
| 4159 | /* Expect the first (GPRS DL) block with bsn=0 and rrbp_valid=1 */ |
| 4160 | f_rx_rlcmac_dl_block_exp_data(dl_block, fn, data, 0); |
| 4161 | |
| 4162 | if (ischosen(dl_block.data_egprs)) { |
| 4163 | if (lengthof(dl_block.data_egprs.blocks) != 2) { |
| 4164 | setverdict(fail, "DL EGPRS block has unexpected number of LLC frames: ", dl_block.data_egprs); |
| 4165 | f_shutdown(__BFILE__, __LINE__); |
| 4166 | } |
| 4167 | if (dl_block.data_egprs.blocks[1].hdr.length_ind != 127) { |
| 4168 | setverdict(fail, "DL EGPRS block 2nd llc frame is not padding!: ", dl_block.data_egprs); |
| 4169 | f_shutdown(__BFILE__, __LINE__); |
| 4170 | } |
| 4171 | if (not match(dl_block.data_egprs.blocks[1].payload, |
| 4172 | f_pad_oct(''O, lengthof(dl_block.data_egprs.blocks[1].payload), '2B'O))) { |
| 4173 | setverdict(fail, "DL EGPRS block 2nd llc frame is not padding!: ", dl_block.data_egprs); |
| 4174 | f_shutdown(__BFILE__, __LINE__); |
| 4175 | } |
| 4176 | } else if (lengthof(dl_block.data.blocks) > 1) { |
| 4177 | setverdict(fail, "DL GPRS block has extra unexpected LLC frames: ", dl_block.data); |
| 4178 | f_shutdown(__BFILE__, __LINE__); |
| 4179 | } |
| 4180 | |
| 4181 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4182 | } |
| 4183 | |
| 4184 | /* Verify osmo-pcu Doesn't append LLC UI dummy frames to rlcmac blocks |
| 4185 | * containing llc data. See OS#4849 */ |
| 4186 | testcase TC_dl_gprs_data_no_llc_ui_dummy() runs on RAW_PCU_Test_CT { |
| 4187 | f_tc_dl_data_no_llc_ui_dummy(omit); |
| 4188 | } |
| 4189 | |
| 4190 | /* Verify osmo-pcu Doesn't append LLC UI dummy frames to rlcmac blocks |
| 4191 | * containing llc data. See OS#4849 */ |
| 4192 | 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] | 4193 | 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] | 4194 | } |
| 4195 | |
Pau Espin Pedrol | 0b6b0d0 | 2022-10-25 21:21:02 +0200 | [diff] [blame] | 4196 | /* Scenario: MS creates one phase access, does contention resolution CV>0 and |
| 4197 | * finishes sending data (CV=0), which is forwarded to SGSN by PCU. PCU acks with |
| 4198 | * FINAL_ACK=1 (hence UL TBF moves to FINISHED state). Then SGSN answers and PCU |
| 4199 | * has to assign a DL TBF (through PCH because of FINISHED state, TS 44.060 9.3.3.3.2). |
| 4200 | * Make sure the assignment is not done until we receive the PKT CTRL ACK from the MS |
| 4201 | * (at that time we know the MS is listening on PCH again). OS#5700. |
| 4202 | */ |
| 4203 | testcase TC_ul_tbf_finished_pkt_dl_ass_pch() runs on RAW_PCU_Test_CT { |
| 4204 | var RlcmacDlBlock dl_block; |
| 4205 | var octetstring data := f_rnd_octstring(10); |
| 4206 | var uint32_t sched_fn; |
| 4207 | var uint32_t dl_fn; |
| 4208 | var GprsMS ms; |
| 4209 | timer T; |
| 4210 | var octetstring payload; |
| 4211 | |
| 4212 | /* Initialize NS/BSSGP side */ |
| 4213 | f_init_bssgp(); |
| 4214 | /* Initialize GPRS MS side */ |
| 4215 | f_init_gprs_ms(); |
| 4216 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4217 | |
| 4218 | /* Initialize the PCU interface abstraction */ |
| 4219 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 4220 | |
| 4221 | /* Establish BSSGP connection to the PCU */ |
| 4222 | f_bssgp_establish(); |
| 4223 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4224 | |
| 4225 | /* Establish an Uplink TBF */ |
| 4226 | f_ms_establish_ul_tbf(ms); |
| 4227 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 4228 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 4229 | f_ms_wait_usf(ms); |
| 4230 | |
Pau Espin Pedrol | 0b6b0d0 | 2022-10-25 21:21:02 +0200 | [diff] [blame] | 4231 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 4232 | contention resolution) and make sure it is ACKED fine. */ |
| 4233 | payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true)); |
| 4234 | dl_fn := f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 4235 | f_ms_tx_ul_data_block(ms, payload, cv := 1, with_tlli := true, fn := f_next_pdch_block(dl_fn)); |
| 4236 | |
| 4237 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4238 | payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, false)); |
| 4239 | f_ms_tx_ul_data_block(ms, payload, cv := 0); |
| 4240 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4241 | |
| 4242 | /* 1 UL block should be received in SGSN */ |
| 4243 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
| 4244 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 4245 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Pau Espin Pedrol | 0b6b0d0 | 2022-10-25 21:21:02 +0200 | [diff] [blame] | 4246 | |
| 4247 | /* UL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4248 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 4249 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 0b6b0d0 | 2022-10-25 21:21:02 +0200 | [diff] [blame] | 4250 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 4251 | f_sleep(X2002); |
| 4252 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 4253 | |
| 4254 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4255 | } |
| 4256 | |
Pau Espin Pedrol | 99e00b4 | 2022-10-28 13:28:52 +0200 | [diff] [blame] | 4257 | /* Scenario: MS creates a UL TBF and |
| 4258 | * finishes sending data (CV=0), which is forwarded to SGSN by PCU. PCU acks with |
| 4259 | * FINAL_ACK=1 (hence UL TBF moves to FINISHED state). Then SGSN answers and PCU |
| 4260 | * has to assign a DL TBF on PCH. While the network is waiting for the MS to |
| 4261 | * move to PDCH before transmitting DL data (timer X2002), the MS finds out it |
| 4262 | * needs to send new UL data and hence sends a RACH request to create a new UL |
| 4263 | * TBF. |
| 4264 | * Make sure the the MS is assigned a DL TBF through PACCH in that case even if |
| 4265 | * no new DL data is received from the SGSN. OS#5700. |
| 4266 | * This test validates the specific case where the 2nd UL TBF is done through |
| 4267 | * 1phase-access. |
| 4268 | */ |
| 4269 | testcase TC_ul_tbf_1phase_while_dl_ass_pch() runs on RAW_PCU_Test_CT { |
| 4270 | var RlcmacDlBlock dl_block; |
| 4271 | var octetstring data := f_rnd_octstring(10); |
| 4272 | var uint32_t sched_fn; |
| 4273 | var uint32_t poll_fn; |
| 4274 | var uint32_t dl_fn; |
| 4275 | var GprsMS ms; |
| 4276 | timer T; |
| 4277 | var octetstring payload; |
| 4278 | |
| 4279 | /* Initialize NS/BSSGP side */ |
| 4280 | f_init_bssgp(); |
| 4281 | /* Initialize GPRS MS side */ |
| 4282 | f_init_gprs_ms(); |
| 4283 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4284 | |
| 4285 | /* Initialize the PCU interface abstraction */ |
| 4286 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 4287 | |
| 4288 | /* Establish BSSGP connection to the PCU */ |
| 4289 | f_bssgp_establish(); |
| 4290 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4291 | |
| 4292 | /* Establish an Uplink TBF */ |
| 4293 | f_ms_establish_ul_tbf(ms); |
| 4294 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 4295 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 4296 | f_ms_wait_usf(ms); |
| 4297 | |
Pau Espin Pedrol | 99e00b4 | 2022-10-28 13:28:52 +0200 | [diff] [blame] | 4298 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 4299 | contention resolution) and make sure it is ACKED fine. */ |
| 4300 | payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true)); |
| 4301 | dl_fn := f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 4302 | f_ms_tx_ul_data_block(ms, payload, cv := 1, with_tlli := true, fn := f_next_pdch_block(dl_fn)); |
| 4303 | |
| 4304 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4305 | payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, false)); |
| 4306 | f_ms_tx_ul_data_block(ms, payload, cv := 0); |
| 4307 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4308 | |
| 4309 | /* 1 UL block should be received in SGSN */ |
| 4310 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
| 4311 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 4312 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Pau Espin Pedrol | 99e00b4 | 2022-10-28 13:28:52 +0200 | [diff] [blame] | 4313 | |
| 4314 | /* UL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4315 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 4316 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 99e00b4 | 2022-10-28 13:28:52 +0200 | [diff] [blame] | 4317 | |
| 4318 | /* Now the PCU is waiting for the MS to move to PDCH in order to send data to it (timer X2002). |
| 4319 | * The MS decides it want to send new Ul TBF so it send RACH req to ask for it: */ |
| 4320 | f_ms_establish_ul_tbf(ms); |
| 4321 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 4322 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 4323 | dl_fn := f_ms_wait_usf(ms); |
| 4324 | |
Pau Espin Pedrol | 99e00b4 | 2022-10-28 13:28:52 +0200 | [diff] [blame] | 4325 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 4326 | * contention resolution) and make sure it is ACKED fine. */ |
| 4327 | 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] | 4328 | f_ms_tx_ul_data_block(ms, payload, cv := 1, with_tlli := true, fn := f_next_pdch_block(dl_fn)); |
| 4329 | |
| 4330 | /* UL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4331 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4332 | |
| 4333 | /* The PCU considers the MS to have gone over Contention Resolution |
| 4334 | * after having sent the first UL ACK/NACK to it, hence next it will try to |
| 4335 | * assign the DL-TBF to send the data it received from the SGSN previously: */ |
| 4336 | f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 4337 | /* the MS ACKs the PKT_DL_ASS: */ |
| 4338 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), poll_fn); |
| 4339 | |
| 4340 | /* We should finally receive the DL-data that was received previously from the SGSN: */ |
| 4341 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 4342 | |
| 4343 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4344 | } |
| 4345 | |
| 4346 | /* Same as TC_ul_tbf_2phase_while_dl_ass_pch, but this test validates the |
| 4347 | * specific case where the 2nd UL TBF is done through 2phase-access. */ |
| 4348 | testcase TC_ul_tbf_2phase_while_dl_ass_pch() runs on RAW_PCU_Test_CT { |
| 4349 | var RlcmacDlBlock dl_block; |
| 4350 | var octetstring data := f_rnd_octstring(10); |
| 4351 | var uint32_t sched_fn; |
| 4352 | var uint32_t poll_fn; |
| 4353 | var uint32_t dl_fn; |
| 4354 | var GprsMS ms; |
| 4355 | timer T; |
| 4356 | var octetstring payload; |
| 4357 | var PollFnCtx pollctx; |
| 4358 | |
| 4359 | /* Initialize NS/BSSGP side */ |
| 4360 | f_init_bssgp(); |
| 4361 | /* Initialize GPRS MS side */ |
| 4362 | f_init_gprs_ms(); |
| 4363 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4364 | |
| 4365 | /* Initialize the PCU interface abstraction */ |
| 4366 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 4367 | |
| 4368 | /* Establish BSSGP connection to the PCU */ |
| 4369 | f_bssgp_establish(); |
| 4370 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4371 | |
| 4372 | /* Establish an Uplink TBF */ |
| 4373 | f_ms_establish_ul_tbf(ms); |
| 4374 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 4375 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 4376 | f_ms_wait_usf(ms); |
| 4377 | |
Pau Espin Pedrol | 99e00b4 | 2022-10-28 13:28:52 +0200 | [diff] [blame] | 4378 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 4379 | contention resolution) and make sure it is ACKED fine. */ |
| 4380 | payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true)); |
| 4381 | dl_fn := f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 4382 | f_ms_tx_ul_data_block(ms, payload, cv := 1, with_tlli := true, fn := f_next_pdch_block(dl_fn)); |
| 4383 | |
| 4384 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4385 | payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, false)); |
| 4386 | f_ms_tx_ul_data_block(ms, payload, cv := 0); |
| 4387 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 4388 | |
| 4389 | /* 1 UL block should be received in SGSN */ |
| 4390 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
| 4391 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 4392 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Pau Espin Pedrol | 99e00b4 | 2022-10-28 13:28:52 +0200 | [diff] [blame] | 4393 | |
| 4394 | /* UL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4395 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 4396 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Pau Espin Pedrol | 99e00b4 | 2022-10-28 13:28:52 +0200 | [diff] [blame] | 4397 | |
| 4398 | /* Now the PCU is waiting for the MS to move to PDCH in order to send data to it (timer X2002). |
| 4399 | * The MS decides it want to send new Ul TBF so it send RACH req to ask for it: */ |
| 4400 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 4401 | |
| 4402 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4403 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4404 | |
| 4405 | /* Now that MS seized the UL-TBF, PCU sends DL-TBF Assignment on PACCH */ |
| 4406 | f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 4407 | /* the MS ACKs the PKT_DL_ASS: */ |
| 4408 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), poll_fn); |
| 4409 | |
| 4410 | /* We should finally receive the DL-data that was received previously from the SGSN: */ |
| 4411 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 4412 | |
| 4413 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4414 | } |
| 4415 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4416 | private function f_TC_egprs_pkt_chan_req(in EGPRSPktChRequest req, |
Vadim Yanitskiy | 4389390 | 2020-05-29 15:21:50 +0700 | [diff] [blame] | 4417 | template GsmRrMessage t_imm_ass := ?, |
| 4418 | PCUIF_BurstType bt := BURST_TYPE_1) |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4419 | runs on RAW_PCU_Test_CT { |
Vadim Yanitskiy | 4389390 | 2020-05-29 15:21:50 +0700 | [diff] [blame] | 4420 | var GsmRrMessage rr_msg; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4421 | var uint16_t ra11; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4422 | |
| 4423 | ra11 := enc_EGPRSPktChRequest2uint(req); |
| 4424 | log("Sending EGPRS Packet Channel Request (", ra11, "): ", req); |
| 4425 | |
Vadim Yanitskiy | 28d18e1 | 2020-05-29 15:25:59 +0700 | [diff] [blame] | 4426 | 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] | 4427 | if (not match(rr_msg, t_imm_ass)) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4428 | setverdict(fail, "Immediate Assignment does not match"); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 4429 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4430 | } |
| 4431 | |
| 4432 | setverdict(pass); |
| 4433 | } |
| 4434 | |
| 4435 | testcase TC_egprs_pkt_chan_req_signalling() runs on RAW_PCU_Test_CT { |
| 4436 | var template GsmRrMessage imm_ass; |
| 4437 | var template IaRestOctets rest; |
| 4438 | var template EgprsUlAss ul_ass; |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4439 | const integer num_req := 6; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4440 | |
| 4441 | /* Initialize the PCU interface abstraction */ |
| 4442 | f_init_raw(testcasename()); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4443 | f_statsd_reset(); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4444 | |
| 4445 | var EGPRSPktChRequest req := { |
| 4446 | /* NOTE: other fields are set in the loop */ |
| 4447 | signalling := { tag := '110011'B } |
| 4448 | }; |
| 4449 | |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4450 | for (var integer i := 0; i < num_req; i := i + 1) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4451 | var BIT5 ext_ra := int2bit(f_rnd_int(32), 5); |
| 4452 | req.signalling.random_bits := ext_ra; |
| 4453 | |
| 4454 | /* For signalling, do we expect Multiblock UL TBF Assignment? */ |
| 4455 | ul_ass := tr_EgprsUlAssMultiblock(ext_ra := ext_ra); |
| 4456 | rest := tr_IaRestOctets_EGPRSULAss(ul_ass); |
| 4457 | imm_ass := tr_IMM_TBF_ASS(dl := false, rest := rest); |
| 4458 | |
| 4459 | f_TC_egprs_pkt_chan_req(req, imm_ass); |
| 4460 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 4461 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 4462 | var StatsDExpects expect := { |
| 4463 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := num_req, max := num_req }, |
| 4464 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := num_req, max := num_req }, |
| 4465 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := 0, max := 0 }, |
| 4466 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := num_req, max := num_req }, |
| 4467 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := num_req, max := num_req }, |
| 4468 | { name := "TTCN3.bts.0.immediate.assignment_ul.one_phase", mtype := "c", min := 0, max := 0 }, |
| 4469 | { name := "TTCN3.bts.0.immediate.assignment_ul.two_phase", mtype := "c", min := num_req, max := num_req }, |
| 4470 | { name := "TTCN3.bts.0.immediate.assignment_ul.contention_resolution_success", mtype := "c", min := 0, max := 0 }, |
| 4471 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 } |
| 4472 | }; |
| 4473 | f_statsd_expect(expect); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4474 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 4475 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4476 | } |
| 4477 | |
| 4478 | testcase TC_egprs_pkt_chan_req_one_phase() runs on RAW_PCU_Test_CT { |
| 4479 | var template GsmRrMessage imm_ass; |
| 4480 | var template IaRestOctets rest; |
| 4481 | var template EgprsUlAss ul_ass; |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4482 | const integer num_req := 6; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4483 | |
| 4484 | /* Initialize the PCU interface abstraction */ |
| 4485 | f_init_raw(testcasename()); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4486 | f_statsd_reset(); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4487 | |
| 4488 | var EGPRSPktChRequest req := { |
| 4489 | /* NOTE: other fields are set in the loop */ |
| 4490 | one_phase := { tag := '0'B } |
| 4491 | }; |
| 4492 | |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4493 | for (var integer i := 0; i < num_req; i := i + 1) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4494 | var BIT5 ext_ra := int2bit(f_rnd_int(32), 5); |
| 4495 | var BIT5 mslot_class := int2bit(f_rnd_int(32), 5); |
| 4496 | var BIT2 priority := substr(ext_ra, 0, 2); |
| 4497 | var BIT3 rand := substr(ext_ra, 2, 3); |
| 4498 | |
| 4499 | req.one_phase.multislot_class := mslot_class; |
| 4500 | req.one_phase.priority := priority; |
| 4501 | req.one_phase.random_bits := rand; |
| 4502 | |
| 4503 | /* For one phase access, do we expect Dynamic UL TBF Assignment? */ |
| 4504 | ul_ass := tr_EgprsUlAssDynamic(ext_ra := ext_ra); |
| 4505 | rest := tr_IaRestOctets_EGPRSULAss(ul_ass); |
| 4506 | imm_ass := tr_IMM_TBF_ASS(dl := false, rest := rest); |
| 4507 | |
| 4508 | f_TC_egprs_pkt_chan_req(req, imm_ass); |
| 4509 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 4510 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 4511 | var StatsDExpects expect := { |
| 4512 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := num_req, max := num_req }, |
| 4513 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := num_req, max := num_req }, |
| 4514 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := num_req, max := num_req }, |
| 4515 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := 0, max := 0 }, |
| 4516 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := num_req, max := num_req }, |
| 4517 | { name := "TTCN3.bts.0.immediate.assignment_ul.one_phase", mtype := "c", min := num_req, max := num_req }, |
| 4518 | { name := "TTCN3.bts.0.immediate.assignment_ul.two_phase", mtype := "c", min := 0, max := 0 }, |
| 4519 | { name := "TTCN3.bts.0.immediate.assignment_ul.contention_resolution_success", mtype := "c", min := 0, max := 0 }, |
| 4520 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 } |
| 4521 | }; |
| 4522 | f_statsd_expect(expect); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4523 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 4524 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4525 | } |
| 4526 | |
| 4527 | testcase TC_egprs_pkt_chan_req_two_phase() runs on RAW_PCU_Test_CT { |
| 4528 | var template GsmRrMessage imm_ass; |
| 4529 | var template IaRestOctets rest; |
| 4530 | var template EgprsUlAss ul_ass; |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4531 | const integer num_req := 6; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4532 | |
| 4533 | /* Initialize the PCU interface abstraction */ |
| 4534 | f_init_raw(testcasename()); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4535 | f_statsd_reset(); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4536 | |
| 4537 | var EGPRSPktChRequest req := { |
| 4538 | /* NOTE: other fields are set in the loop */ |
| 4539 | two_phase := { tag := '110000'B } |
| 4540 | }; |
| 4541 | |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4542 | for (var integer i := 0; i < num_req; i := i + 1) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4543 | var BIT5 ext_ra := int2bit(f_rnd_int(32), 5); |
| 4544 | var BIT2 priority := substr(ext_ra, 0, 2); |
| 4545 | var BIT3 rand := substr(ext_ra, 2, 3); |
| 4546 | |
| 4547 | req.two_phase.priority := priority; |
| 4548 | req.two_phase.random_bits := rand; |
| 4549 | |
| 4550 | /* For two phase access, do we expect Multiblock UL TBF Assignment? */ |
| 4551 | ul_ass := tr_EgprsUlAssMultiblock(ext_ra := ext_ra); |
| 4552 | rest := tr_IaRestOctets_EGPRSULAss(ul_ass); |
| 4553 | imm_ass := tr_IMM_TBF_ASS(dl := false, rest := rest); |
| 4554 | |
| 4555 | f_TC_egprs_pkt_chan_req(req, imm_ass); |
| 4556 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 4557 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 4558 | var StatsDExpects expect := { |
| 4559 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := num_req, max := num_req }, |
| 4560 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := num_req, max := num_req }, |
| 4561 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := 0, max := 0 }, |
| 4562 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := num_req, max := num_req }, |
| 4563 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := num_req, max := num_req }, |
| 4564 | { name := "TTCN3.bts.0.immediate.assignment_ul.one_phase", mtype := "c", min := 0, max := 0 }, |
| 4565 | { name := "TTCN3.bts.0.immediate.assignment_ul.two_phase", mtype := "c", min := num_req, max := num_req }, |
| 4566 | { name := "TTCN3.bts.0.immediate.assignment_ul.contention_resolution_success", mtype := "c", min := 0, max := 0 }, |
| 4567 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 } |
| 4568 | }; |
| 4569 | f_statsd_expect(expect); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4570 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 4571 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 4572 | } |
| 4573 | |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4574 | private function f_TC_egprs_pkt_chan_req_reject(bitstring ra11, uint32_t fn, |
| 4575 | template IARRestOctets rest := ?, |
Pau Espin Pedrol | a5cee4c | 2021-04-26 13:50:29 +0200 | [diff] [blame] | 4576 | PCUIF_BurstType bt := BURST_TYPE_1, |
| 4577 | template WaitIndication wi := ?) |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4578 | runs on RAW_PCU_Test_CT { |
| 4579 | var template ReqRefWaitInd tr_ref; |
| 4580 | var GsmRrMessage rr_msg; |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4581 | |
| 4582 | /* Send RACH.ind with malformed EGPRS Packet Channel Request */ |
| 4583 | BTS.send(ts_PCUIF_RACH_IND(bts_nr := 0, trx_nr := 0, ts_nr := 0, |
| 4584 | ra := bit2int(ra11), is_11bit := 1, |
| 4585 | burst_type := bt, fn := fn, |
| 4586 | arfcn := 871)); |
| 4587 | |
| 4588 | /* Abuse f_pcuif_rx_imm_ass(): wait for Immediate Assignment Reject */ |
Vadim Yanitskiy | 7466c33 | 2020-05-28 20:41:19 +0700 | [diff] [blame] | 4589 | 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] | 4590 | |
| 4591 | /* Just to have a short-name reference to the actual message */ |
| 4592 | var ImmediateAssignmentReject iar := rr_msg.payload.imm_ass_rej; |
| 4593 | |
| 4594 | /* Make sure that Request Reference list contains at least one entry |
| 4595 | * 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] | 4596 | tr_ref := tr_ReqRefWaitInd(f_compute_ReqRef(127, fn), wi); |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4597 | if (not match(iar.payload, { *, tr_ref, * })) { |
| 4598 | setverdict(fail, "Request Reference list does not match"); |
| 4599 | f_shutdown(__BFILE__, __LINE__); |
| 4600 | } |
| 4601 | |
| 4602 | /* Match Feature Indicator (must indicate PS domain) */ |
| 4603 | if (not match(iar.feature_ind, FeatureIndicator:{?, false, true})) { |
| 4604 | setverdict(fail, "Feature Indicator does not match"); |
| 4605 | f_shutdown(__BFILE__, __LINE__); |
| 4606 | } |
| 4607 | |
| 4608 | /* Match IAR Rest Octets */ |
| 4609 | if (not match(iar.rest_octets, rest)) { |
| 4610 | setverdict(fail, "IAR Rest Octets does not match: ", |
| 4611 | iar.rest_octets, " vs expected ", rest); |
| 4612 | f_shutdown(__BFILE__, __LINE__); |
| 4613 | } |
| 4614 | |
| 4615 | setverdict(pass); |
| 4616 | } |
| 4617 | |
| 4618 | /* Verify the contents of RR Immediate Assignment Reject message and its |
| 4619 | * Rest Octets sent in response to EGPRS Packet Channel Request (11 bit). */ |
| 4620 | testcase TC_egprs_pkt_chan_req_reject_content() runs on RAW_PCU_Test_CT { |
| 4621 | var template IARRestOctets rest; |
| 4622 | var BIT5 ext_ra; |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4623 | const integer num_req := 6; |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4624 | |
| 4625 | /* Initialize the PCU interface abstraction */ |
| 4626 | f_init_raw(testcasename()); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4627 | f_statsd_reset(); |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4628 | |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4629 | for (var integer i := 0; i < num_req; i := i + 1) { |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4630 | ext_ra := int2bit(f_rnd_int(32), 5); /* 5 LSB's of RA11 */ |
| 4631 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(ext_ra), * }); |
| 4632 | |
| 4633 | /* Intentionally incorrect message (see table 11.2.5a.2) */ |
| 4634 | f_TC_egprs_pkt_chan_req_reject('111111'B & ext_ra, 1337 + i, rest); |
| 4635 | } |
| 4636 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 4637 | var StatsDExpects expect := { |
| 4638 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := num_req, max := num_req }, |
| 4639 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := num_req, max := num_req }, |
| 4640 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := 0, max := 0 }, |
| 4641 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := 0, max := 0 }, |
| 4642 | { name := "TTCN3.bts.0.rach.requests.unexpected", mtype := "c", min := num_req, max := num_req }, |
| 4643 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 0, max := 0 }, |
| 4644 | { name := "TTCN3.bts.0.immediate.assignment_rej", mtype := "c", min := num_req, max := num_req }, |
| 4645 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 } |
| 4646 | }; |
| 4647 | f_statsd_expect(expect); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4648 | |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 4649 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4650 | } |
| 4651 | |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 4652 | /* At the moment, the IUT does not support any emergency services. Make sure |
| 4653 | * that EGPRS Packet Channel Request for an emergency call is properly rejected. */ |
| 4654 | testcase TC_egprs_pkt_chan_req_reject_emergency() runs on RAW_PCU_Test_CT { |
| 4655 | var template IARRestOctets rest; |
| 4656 | var BIT5 ext_ra; |
| 4657 | var BIT11 ra11; |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4658 | const integer num_req := 6; |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 4659 | |
| 4660 | /* Initialize the PCU interface abstraction */ |
| 4661 | f_init_raw(testcasename()); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4662 | f_statsd_reset(); |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 4663 | |
| 4664 | var EGPRSPktChRequest req := { |
| 4665 | /* NOTE: other fields are set in the loop */ |
| 4666 | emergency := { tag := '110111'B } |
| 4667 | }; |
| 4668 | |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4669 | for (var integer i := 0; i < num_req; i := i + 1) { |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 4670 | ext_ra := int2bit(f_rnd_int(32), 5); /* 5 LSB's of RA11 */ |
| 4671 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(ext_ra), * }); |
| 4672 | |
| 4673 | req.emergency.random_bits := ext_ra; |
| 4674 | ra11 := enc_EGPRSPktChRequest2bits(req); |
| 4675 | |
| 4676 | /* Intentionally incorrect message (see table 11.2.5a.2) */ |
| 4677 | f_TC_egprs_pkt_chan_req_reject(ra11, 1337 + i, rest); |
| 4678 | } |
| 4679 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 4680 | var StatsDExpects expect := { |
| 4681 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := num_req, max := num_req }, |
| 4682 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := num_req, max := num_req }, |
| 4683 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := 0, max := 0 }, |
| 4684 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := 0, max := 0 }, |
| 4685 | { name := "TTCN3.bts.0.rach.requests.unexpected", mtype := "c", min := num_req, max := num_req }, |
| 4686 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 0, max := 0 }, |
| 4687 | { name := "TTCN3.bts.0.immediate.assignment_rej", mtype := "c", min := num_req, max := num_req }, |
| 4688 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 } |
| 4689 | }; |
| 4690 | f_statsd_expect(expect); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4691 | |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 4692 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4693 | } |
| 4694 | |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 4695 | /* Make sure that IUT responds with RR Immediate Assignment Reject due to exhaustion. */ |
| 4696 | 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] | 4697 | var PCUIF_info_ind info_ind; |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 4698 | var template IARRestOctets rest; |
| 4699 | var BIT11 ra11; |
| 4700 | |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 4701 | info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | a5cee4c | 2021-04-26 13:50:29 +0200 | [diff] [blame] | 4702 | info_ind.t3142 := 3; |
Vadim Yanitskiy | d5321fb | 2020-10-31 20:23:47 +0700 | [diff] [blame] | 4703 | |
| 4704 | /* Only the first TRX is enabled. */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4705 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 4706 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 4707 | |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 4708 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 4709 | f_init_raw(testcasename(), info_ind); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4710 | f_statsd_reset(); |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 4711 | |
| 4712 | var EGPRSPktChRequest req := { |
| 4713 | one_phase := { |
| 4714 | tag := '0'B, |
| 4715 | multislot_class := '10101'B, |
| 4716 | priority := '01'B, |
| 4717 | random_bits := '101'B |
| 4718 | } |
| 4719 | }; |
| 4720 | |
| 4721 | /* We send 7 requests, the IUT gives us all available USFs (0..6). |
| 4722 | * TODO: make it configurable: usf_max := mp_pdch_ts_num * 7. */ |
| 4723 | for (var integer i := 0; i < 7; i := i + 1) { |
| 4724 | req.one_phase.random_bits := int2bit(f_rnd_int(8), 3); |
| 4725 | f_TC_egprs_pkt_chan_req(req, tr_IMM_TBF_ASS); |
| 4726 | } |
| 4727 | |
| 4728 | ra11 := enc_EGPRSPktChRequest2bits(req); |
| 4729 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(substr(ra11, 6, 5)), * }); |
| 4730 | |
| 4731 | /* At this point, the IUT should run out of free USFs */ |
Pau Espin Pedrol | a5cee4c | 2021-04-26 13:50:29 +0200 | [diff] [blame] | 4732 | 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] | 4733 | |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 4734 | var StatsDExpects expect := { |
| 4735 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 8, max := 8 }, |
| 4736 | { name := "TTCN3.bts.0.rach.requests.11bit", mtype := "c", min := 8, max := 8 }, |
| 4737 | { name := "TTCN3.bts.0.rach.requests.one_phase", mtype := "c", min := 8, max := 8 }, |
| 4738 | { name := "TTCN3.bts.0.rach.requests.two_phase", mtype := "c", min := 0, max := 0 }, |
| 4739 | { name := "TTCN3.bts.0.rach.requests.unexpected", mtype := "c", min := 0, max := 0 }, |
| 4740 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 7, max := 7 }, |
| 4741 | { name := "TTCN3.bts.0.immediate.assignment_ul.one_phase", mtype := "c", min := 7, max := 7 }, |
| 4742 | { name := "TTCN3.bts.0.immediate.assignment_ul.two_phase", mtype := "c", min := 0, max := 0 }, |
| 4743 | { name := "TTCN3.bts.0.immediate.assignment_ul.contention_resolution_success", mtype := "c", min := 0, max := 0 }, |
| 4744 | { name := "TTCN3.bts.0.immediate.assignment_rej", mtype := "c", min := 1, max := 1 }, |
| 4745 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 0, max := 0 } |
| 4746 | }; |
| 4747 | f_statsd_expect(expect); |
Pau Espin Pedrol | 023330d | 2021-11-08 14:10:21 +0100 | [diff] [blame] | 4748 | |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 4749 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4750 | } |
| 4751 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4752 | /* Randomly generate a set of hopping parameters for one timeslot */ |
Vadim Yanitskiy | 7a04cdd | 2020-09-07 11:43:32 +0700 | [diff] [blame] | 4753 | private function f_TC_pcuif_fh_params_gen(integer max_ma_len) |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4754 | return template (value) PCUIF_InfoTrxTs { |
Vadim Yanitskiy | 7a04cdd | 2020-09-07 11:43:32 +0700 | [diff] [blame] | 4755 | /* Pick a random MA length in range 2 .. max_ma_len */ |
| 4756 | var integer ma_len := 2 + f_rnd_int(max_ma_len - 2); |
| 4757 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4758 | return ts_PCUIF_InfoTrxTsH1(tsc := f_rnd_int(7), |
| 4759 | hsn := f_rnd_int(63), |
| 4760 | maio := f_rnd_int(63), |
| 4761 | ma := f_rnd_bitstring(ma_len)); |
| 4762 | } |
| 4763 | |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4764 | private function f_TC_pcuif_fh_check_imm_ass(in PCUIF_info_ind info_ind, |
| 4765 | in GsmRrMessage rr_msg) |
| 4766 | { |
| 4767 | var ImmediateAssignment ia := rr_msg.payload.imm_ass; |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4768 | 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] | 4769 | |
| 4770 | var template PacketChannelDescription tr_pkt_chan_desc := { |
| 4771 | channel_Type_spare := ?, |
| 4772 | tn := ?, |
| 4773 | tsc := ts.tsc, |
| 4774 | presence := '1'B, |
| 4775 | zero := omit, |
| 4776 | one := { |
| 4777 | maio := ts.maio, |
| 4778 | hsn := ts.hsn |
| 4779 | } |
| 4780 | }; |
| 4781 | |
| 4782 | if (not match(ia.pkt_chan_desc, tr_pkt_chan_desc)) { |
| 4783 | setverdict(fail, "Packet Channel Description does not match: ", |
| 4784 | ia.pkt_chan_desc, " vs ", tr_pkt_chan_desc); |
| 4785 | } |
| 4786 | |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 4787 | /* Mobile Allocation is expected to be octet-aligned */ |
| 4788 | var uint8_t ma_oct_len := (ts.ma_bit_len + 8 - 1) / 8; |
| 4789 | var template MobileAllocationLV tr_ma := { |
| 4790 | len := ma_oct_len, /* in bytes */ |
| 4791 | ma := substr(ts.ma, 0, ma_oct_len * 8) |
| 4792 | }; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4793 | |
| 4794 | if (not match(ia.mobile_allocation, tr_ma)) { |
| 4795 | setverdict(fail, "Mobile Allocation does not match: ", |
| 4796 | ia.mobile_allocation, " vs ", tr_ma); |
| 4797 | } |
| 4798 | |
| 4799 | setverdict(pass); |
| 4800 | } |
| 4801 | |
| 4802 | /* Make sure that Immediate (UL EGPRS TBF) Assignment contains hopping parameters */ |
| 4803 | 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] | 4804 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4805 | var GprsMS ms := valueof(t_GprsMS_def); |
| 4806 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4807 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4808 | 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] | 4809 | |
| 4810 | /* Initialize the PCU interface abstraction */ |
| 4811 | f_init_raw(testcasename(), info_ind); |
| 4812 | |
| 4813 | /* EGPRS Packet Channel Request (cause=Signalling) */ |
| 4814 | f_ms_use_ra(ms, bit2int('11001101010'B), ra_is_11bit := 1); |
| 4815 | |
| 4816 | /* Establish an Uplink EGPRS TBF */ |
| 4817 | f_ms_establish_ul_tbf(ms); |
| 4818 | |
| 4819 | f_TC_pcuif_fh_check_imm_ass(valueof(info_ind), ms.ul_tbf.rr_imm_ass); |
| 4820 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4821 | } |
| 4822 | |
| 4823 | /* Make sure that Immediate (UL TBF) Assignment contains hopping parameters */ |
| 4824 | 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] | 4825 | 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] | 4826 | var GprsMS ms := valueof(t_GprsMS_def); |
| 4827 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4828 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4829 | 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] | 4830 | |
| 4831 | /* Initialize the PCU interface abstraction */ |
| 4832 | f_init_raw(testcasename(), info_ind); |
| 4833 | |
| 4834 | /* Establish an Uplink TBF */ |
| 4835 | f_ms_establish_ul_tbf(ms); |
| 4836 | |
| 4837 | f_TC_pcuif_fh_check_imm_ass(valueof(info_ind), ms.ul_tbf.rr_imm_ass); |
| 4838 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4839 | } |
| 4840 | |
| 4841 | /* Make sure that Immediate (DL TBF) Assignment contains hopping parameters */ |
| 4842 | 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] | 4843 | 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] | 4844 | var GprsMS ms := valueof(t_GprsMS_def); |
| 4845 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4846 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4847 | 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] | 4848 | |
| 4849 | /* Initialize NS/BSSGP side */ |
| 4850 | f_init_bssgp(); |
| 4851 | |
| 4852 | /* Initialize the PCU interface abstraction */ |
| 4853 | f_init_raw(testcasename(), info_ind); |
| 4854 | |
| 4855 | /* Establish BSSGP connection to the PCU */ |
| 4856 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 4857 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4858 | |
| 4859 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 4860 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, f_rnd_octstring(12))); |
Philipp Maier | 4222f47 | 2023-08-22 17:28:00 +0200 | [diff] [blame] | 4861 | |
| 4862 | /* The PCU will send an IMMEDIATE ASSIGNMENT message on the AGCH. It |
| 4863 | * should be noted that IMMEDIATE ASSIGNMENT messages for DL TBFs are |
| 4864 | * commonly sent on the PCH. However in this case the IMSI is not |
| 4865 | * known to the PCU and hence no paging group can be calculated. The |
| 4866 | * PCU is then forced to use the AGCH. |
| 4867 | * |
| 4868 | * As a background information to this it should be noted that this |
| 4869 | * works because the IMSI is commonly unknown during a GMM ATTACH |
| 4870 | * REQUEST. In this phase the MS is in non-DRX mode, which means that |
| 4871 | * it listens on all CCCH blocks (PCH and AGCH) |
| 4872 | * |
| 4873 | * See also: 3gpp TS 44.060, section 5.5.1.5 and |
| 4874 | * 3gpp TS 45.002, section 6.5.3, 6.5.6 |
| 4875 | */ |
| 4876 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_AGCH_2); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4877 | |
| 4878 | f_TC_pcuif_fh_check_imm_ass(valueof(info_ind), ms.dl_tbf.rr_imm_ass); |
| 4879 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4880 | } |
| 4881 | |
| 4882 | private function f_TC_pcuif_fh_check_pkt_ass(in PCUIF_info_ind info_ind, |
| 4883 | in FrequencyParameters fp) |
| 4884 | { |
| 4885 | /* FIXME: TRX0/TS7 is a hard-coded expectation, make it configurable */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4886 | var PCUIF_InfoTrxTs ts := info_ind.trx[0].ts[7]; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4887 | |
| 4888 | /* Table 12.8.1: Frequency Parameters information elements */ |
| 4889 | var template FrequencyParameters tr_fp := { |
| 4890 | tsc := ts.tsc, |
| 4891 | presence := '10'B, /* Direct encoding 1 */ |
| 4892 | arfcn := omit, |
| 4893 | indirect := omit, |
| 4894 | direct1 := { |
| 4895 | maio := ts.maio, |
| 4896 | /* Table 12.10a.1: GPRS Mobile Allocation information elements */ |
| 4897 | mobile_allocation := { |
| 4898 | hsn := ts.hsn, |
| 4899 | rfl_number_list_present := '0'B, |
| 4900 | rfl_number_list := omit, |
| 4901 | ma_present := '0'B, /* inverted logic */ |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 4902 | ma_length := ts.ma_bit_len, |
| 4903 | ma_bitmap := substr(ts.ma, 0, ts.ma_bit_len) |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4904 | } |
| 4905 | }, |
| 4906 | direct2 := omit |
| 4907 | }; |
| 4908 | |
| 4909 | if (not match(fp, tr_fp)) { |
| 4910 | setverdict(fail, "Frequency Parameters IE does not match: ", |
| 4911 | fp, " vs ", tr_fp); |
| 4912 | } |
| 4913 | |
| 4914 | setverdict(pass); |
| 4915 | } |
| 4916 | |
| 4917 | /* Make sure that Packet Uplink Assignment contains hopping parameters */ |
| 4918 | 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] | 4919 | 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] | 4920 | var GprsMS ms := valueof(t_GprsMS_def); |
| 4921 | var uint32_t poll_fn; |
| 4922 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4923 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4924 | 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] | 4925 | |
| 4926 | /* Initialize the PCU interface abstraction */ |
| 4927 | f_init_raw(testcasename(), info_ind); |
| 4928 | |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 4929 | /* Single block (two phase) packet access */ |
| 4930 | var uint16_t ra := bit2int(chan_req_sb); |
| 4931 | f_ms_use_ra(ms, ra, ra_is_11bit := 0); |
| 4932 | |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4933 | /* Establish an Uplink TBF */ |
| 4934 | f_ms_establish_ul_tbf(ms); |
| 4935 | |
| 4936 | /* 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] | 4937 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, omit)), |
| 4938 | fn := ms.ul_tbf.start_time_fn); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4939 | |
| 4940 | /* 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] | 4941 | f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_UL_PACKET_ASS); |
| 4942 | var PacketUlAssignment ua := ms.ul_tbf.ass.pacch; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4943 | |
| 4944 | /* 3GPP TS 44.060, section 12.8 "Frequency Parameters" */ |
| 4945 | var template (omit) FrequencyParameters fp; |
| 4946 | if (ua.is_egprs == '1'B) { |
| 4947 | fp := ua.egprs.freq_par; |
| 4948 | } else { |
| 4949 | fp := ua.gprs.freq_par; |
| 4950 | } |
| 4951 | |
| 4952 | /* This is an optional IE, so it's worth to check its presence */ |
| 4953 | if (istemplatekind(fp, "omit")) { |
| 4954 | setverdict(fail, "Frequency Parameters IE is not present"); |
| 4955 | f_shutdown(__BFILE__, __LINE__); |
| 4956 | } |
| 4957 | |
| 4958 | f_TC_pcuif_fh_check_pkt_ass(valueof(info_ind), valueof(fp)); |
| 4959 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4960 | } |
| 4961 | |
| 4962 | /* Make sure that Packet Downlink Assignment contains hopping parameters */ |
| 4963 | 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] | 4964 | 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] | 4965 | var octetstring data := f_rnd_octstring(10); |
| 4966 | var GprsMS ms := valueof(t_GprsMS_def); |
| 4967 | var RlcmacDlBlock dl_block; |
| 4968 | var uint32_t poll_fn; |
| 4969 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 4970 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4971 | 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] | 4972 | |
| 4973 | /* Initialize NS/BSSGP side */ |
| 4974 | f_init_bssgp(); |
| 4975 | |
| 4976 | /* Initialize the PCU interface abstraction */ |
| 4977 | f_init_raw(testcasename(), info_ind); |
| 4978 | |
| 4979 | /* Establish BSSGP connection to the PCU */ |
| 4980 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 4981 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4982 | |
| 4983 | /* Establish an Uplink TBF */ |
| 4984 | f_ms_establish_ul_tbf(ms); |
| 4985 | |
Pau Espin Pedrol | 7e50fa2 | 2023-06-26 16:50:22 +0200 | [diff] [blame] | 4986 | /* Wait until PCU starts requesting for UL block on this TBF: */ |
| 4987 | f_ms_wait_usf(ms); |
| 4988 | |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 4989 | /* Send an Uplink block, so this TBF becomes "active" */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 4990 | 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] | 4991 | |
| 4992 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4993 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, poll_fn); |
| 4994 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), poll_fn); |
| 4995 | |
| 4996 | /* SGSN sends some DL data, PCU will assign Downlink resource on PACCH */ |
| 4997 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 4998 | |
| 4999 | /* 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] | 5000 | f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 5001 | var PacketDlAssignment da := ms.dl_tbf.ass.pacch; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 5002 | |
| 5003 | /* This is an optional IE, so it's worth to check its presence */ |
| 5004 | if (not ispresent(da.freq_par)) { |
| 5005 | setverdict(fail, "Frequency Parameters IE is not present"); |
| 5006 | f_shutdown(__BFILE__, __LINE__); |
| 5007 | } |
| 5008 | |
| 5009 | f_TC_pcuif_fh_check_pkt_ass(valueof(info_ind), da.freq_par); |
| 5010 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5011 | } |
| 5012 | |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 5013 | /* Check if the IUT handles subsequent INFO.ind messages */ |
| 5014 | 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] | 5015 | 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] | 5016 | var BTS_PDTCH_Block data_msg; |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 5017 | |
| 5018 | /* Initialize the PCU interface abstraction */ |
| 5019 | f_init_raw(testcasename(), info_ind); |
| 5020 | |
| 5021 | /* Send 16 conseqtive INFO.ind messages and check that the IUT stays alive */ |
| 5022 | for (var integer i := 0; i < 16; i := i + 1) { |
| 5023 | BTS.send(ts_PCUIF_INFO_IND(0, info_ind)); |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 5024 | f_pcuif_rx_data_req_pdtch(data_msg); |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 5025 | } |
| 5026 | |
| 5027 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5028 | } |
| 5029 | |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 5030 | /* Verify allocation of several MS along PDCH ts of several TRX. See OS#1775, SYS#5030 */ |
| 5031 | testcase TC_multitrx_multims_alloc() runs on RAW_PCU_Test_CT { |
| 5032 | var PCUIF_info_ind info_ind; |
| 5033 | var integer i; |
| 5034 | const integer num_ms := 8; |
| 5035 | |
| 5036 | /* Initialize NS/BSSGP side */ |
| 5037 | f_init_bssgp(); |
| 5038 | /* Initialize GPRS MS side */ |
| 5039 | f_init_gprs_ms(num_ms); |
| 5040 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 5041 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 5042 | /* Only the 3 first TRX are enabled. The enabled ones all have same |
| 5043 | amount of resources, hence same amount of initial resources. */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 5044 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (3 .. 7)); |
| 5045 | f_PCUIF_PDCHMask_set(info_ind, '00000011'B, 0); |
| 5046 | f_PCUIF_PDCHMask_set(info_ind, '00001100'B, 1); |
| 5047 | f_PCUIF_PDCHMask_set(info_ind, '11000000'B, 2); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 5048 | |
| 5049 | /* Initialize the PCU interface abstraction */ |
| 5050 | f_init_raw(testcasename(), info_ind); |
| 5051 | |
| 5052 | /* Establish BSSGP connection to the PCU */ |
| 5053 | f_bssgp_establish(); |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 5054 | f_multi_ms_bssgp_register(); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 5055 | |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 5056 | /* Establish an Uplink TBF for each GprsMS instance */ |
| 5057 | f_multi_ms_establish_tbf(do_activate := false); |
| 5058 | |
| 5059 | /* 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] | 5060 | for (i := 0; i < num_ms; i := i + 1) { |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 5061 | 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] | 5062 | setverdict(fail, "Got assigned ARFCN ", g_ms[i].ul_tbf.arfcn, |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 5063 | " vs exp ", info_ind.trx[i mod 3].arfcn); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 5064 | f_shutdown(__BFILE__, __LINE__); |
| 5065 | } |
| 5066 | } |
| 5067 | |
| 5068 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5069 | } |
| 5070 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 5071 | /* Verify concurrent PDCH use of EGPRS and GPRS (EGPRS dl rlcmac blk is |
| 5072 | * downgraded to CS1-4 so that GPRS can read the USF). |
| 5073 | * See 3GPP TS 44.060 5.2.4a "Multiplexing of GPRS, EGPRS and EGPRS2 capable mobile stations" |
| 5074 | */ |
| 5075 | testcase TC_multiplex_dl_gprs_egprs() runs on RAW_PCU_Test_CT { |
| 5076 | var PCUIF_info_ind info_ind; |
| 5077 | const integer num_ms := 2; /* 2 MS, first one is GPRS-only, second one is EGPRS */ |
| 5078 | var PollFnCtx pollctx; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 5079 | var uint32_t sched_fn, dl_fn, ack_fn; |
| 5080 | var octetstring data := f_rnd_octstring(10); |
| 5081 | var RlcmacDlBlock dl_block; |
| 5082 | var integer tx_data_remain := 5; |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 5083 | var integer tgt_ms, usf_ms; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 5084 | var integer ms_gprs_usf_count[num_ms] := { 0, 0 }; |
| 5085 | var integer ms_egprs_usf_count[num_ms] := { 0, 0 }; |
| 5086 | |
| 5087 | /* Initialize NS/BSSGP side */ |
| 5088 | f_init_bssgp(); |
| 5089 | /* Initialize GPRS MS side */ |
| 5090 | f_init_gprs_ms(num_ms); |
| 5091 | |
| 5092 | info_ind := valueof(ts_PCUIF_INFO_default); |
| 5093 | /* 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] | 5094 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
| 5095 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 5096 | |
| 5097 | /* Initialize the PCU interface abstraction */ |
| 5098 | f_init_raw(testcasename(), info_ind); |
| 5099 | |
| 5100 | /* Set Initial MCS > 4 and maintain it non-variable to simplify test */ |
| 5101 | g_mcs_initial_dl := 5; |
| 5102 | g_mcs_max_dl := 5; |
| 5103 | f_pcuvty_set_allowed_cs_mcs(); |
| 5104 | |
| 5105 | /* Establish BSSGP connection to the PCU */ |
| 5106 | f_bssgp_establish(); |
| 5107 | f_multi_ms_bssgp_register(); |
| 5108 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 5109 | /* Establish UL TBF for MS0 (GPRS-only) */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5110 | 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] | 5111 | if (not match(g_ms[0].ul_tbf.tx_cs_mcs, cs_gprs_any)) { |
| 5112 | setverdict(fail, "Wrong CS_MCS ", g_ms[0].ul_tbf.tx_cs_mcs, " received vs exp ", cs_gprs_any); |
| 5113 | f_shutdown(__BFILE__, __LINE__); |
| 5114 | } |
| 5115 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5116 | f_ms_tx_ul_block(g_ms[0], ts_RLCMAC_CTRL_ACK(g_ms[0].tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5117 | |
| 5118 | /* Establish UL TBF for MS1 (EGPRS) */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5119 | 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] | 5120 | if (not match(g_ms[1].ul_tbf.tx_cs_mcs, mcs_egprs_any)) { |
| 5121 | setverdict(fail, "Wrong CS_MCS ", g_ms[1].ul_tbf.tx_cs_mcs, " received vs exp ", mcs_egprs_any); |
| 5122 | f_shutdown(__BFILE__, __LINE__); |
| 5123 | } |
| 5124 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5125 | f_ms_tx_ul_block(g_ms[1], ts_RLCMAC_CTRL_ACK(g_ms[1].tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5126 | |
| 5127 | /* Now SGSN sends some DL data to MS0, PCU will assign a GPRS DL TBF on PACCH */ |
| 5128 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[0].tlli, data)); |
| 5129 | f_sleep(0.1); |
| 5130 | f_ms_rx_pkt_ass_pacch(g_ms[0], sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 5131 | /* DL Ass sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5132 | f_ms_tx_ul_block(g_ms[0], ts_RLCMAC_CTRL_ACK(g_ms[0].tlli), sched_fn); |
| 5133 | /* After acking the dl assignment, dl tbf goes into FLOW state and PCU will provide DL data when BTS asks for it */ |
| 5134 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0, cs_gprs_any); |
| 5135 | /* ACK the DL block */ |
| 5136 | f_dltbf_ack_block(g_ms[0].dl_tbf, dl_block, '0'B); |
| 5137 | f_ms_tx_ul_block(g_ms[0], f_dltbf_ts_RLCMAC_DL_ACK_NACK(g_ms[0].dl_tbf, false), |
| 5138 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 5139 | |
| 5140 | /* Now SGSN sends some DL data to MS1, PCU will assign a EGPRS DL TBF on PACCH */ |
| 5141 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[1].tlli, data)); |
| 5142 | f_sleep(0.1); |
| 5143 | f_ms_rx_pkt_ass_pacch(g_ms[1], sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 5144 | /* DL Ass sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5145 | f_ms_tx_ul_block(g_ms[1], ts_RLCMAC_CTRL_ACK(g_ms[1].tlli), sched_fn); |
| 5146 | /* After acking the dl assignment, dl tbf goes into FLOW state and PCU will provide DL data when BTS asks for it */ |
| 5147 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0, mcs_egprs_any); |
| 5148 | /* ACK the DL block */ |
| 5149 | f_dltbf_ack_block(g_ms[1].dl_tbf, dl_block, '0'B); |
| 5150 | f_ms_tx_ul_block(g_ms[1], f_dltbf_ts_RLCMAC_DL_ACK_NACK(g_ms[1].dl_tbf, true), |
| 5151 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 5152 | |
| 5153 | data := f_rnd_octstring(1400); |
| 5154 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[0].tlli, data)); |
| 5155 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[1].tlli, data)); |
| 5156 | |
| 5157 | for (var integer i := 0; i < 800; i := i + 1) { |
| 5158 | f_rx_rlcmac_dl_block(dl_block, dl_fn); |
| 5159 | |
Vadim Yanitskiy | 7179d3e | 2022-10-04 03:27:29 +0700 | [diff] [blame] | 5160 | if (match(dl_block, tr_RLCMAC_DL_DUMMY_CTRL)) { |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 5161 | /* No more data to receive, done */ |
| 5162 | break; |
| 5163 | } |
| 5164 | |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 5165 | usf_ms := -1; |
| 5166 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 5167 | if (ischosen(dl_block.ctrl)) { |
| 5168 | setverdict(fail, "Unexpected DL CTRL block ", dl_block); |
| 5169 | f_shutdown(__BFILE__, __LINE__); |
| 5170 | } else if (ischosen(dl_block.data_egprs)) { |
| 5171 | if (not match(dl_block.data_egprs.mac_hdr.tfi, g_ms[1].dl_tbf.tfi)) { |
| 5172 | setverdict(fail, "EGPRS DL DATA not matching EGPRS MS TFI (", g_ms[1].dl_tbf.tfi, "): ", dl_block.data_egprs.mac_hdr.tfi); |
| 5173 | f_shutdown(__BFILE__, __LINE__); |
| 5174 | } |
| 5175 | tgt_ms := 1; |
| 5176 | if (match(dl_block.data_egprs.mac_hdr.usf, g_ms[0].ul_tbf.usf[7])) { |
| 5177 | if (dl_block.data_egprs.mcs > MCS_4) { |
| 5178 | setverdict(fail, "Signalling USF ", dl_block.data_egprs.mac_hdr.usf, " for GPRS-only MS using MCS > 4: ", dl_block); |
| 5179 | f_shutdown(__BFILE__, __LINE__); |
| 5180 | } |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 5181 | usf_ms := 0; |
| 5182 | 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] | 5183 | } else { |
| 5184 | if (dl_block.data_egprs.mcs <= MCS_4) { |
| 5185 | setverdict(fail, "Using too-low MCS for EGPRS MS: ", dl_block.data_egprs.mcs); |
| 5186 | f_shutdown(__BFILE__, __LINE__); |
| 5187 | } |
| 5188 | 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] | 5189 | usf_ms := 1; |
| 5190 | 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] | 5191 | } |
| 5192 | } |
| 5193 | } else { |
| 5194 | if (not match(dl_block.data.mac_hdr.hdr_ext.tfi, g_ms[0].dl_tbf.tfi)) { |
| 5195 | setverdict(fail, "GPRS DL DATA not matching GPRS MS TFI (", g_ms[0].dl_tbf.tfi, "): ", dl_block.data.mac_hdr.hdr_ext.tfi); |
| 5196 | f_shutdown(__BFILE__, __LINE__); |
| 5197 | } |
| 5198 | tgt_ms := 0; |
| 5199 | 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] | 5200 | usf_ms := 0; |
| 5201 | 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] | 5202 | } 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] | 5203 | usf_ms := 1; |
| 5204 | 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] | 5205 | } |
| 5206 | } |
| 5207 | |
| 5208 | /* Keep Ack/Nack description updated */ |
| 5209 | f_dltbf_ack_block(g_ms[tgt_ms].dl_tbf, dl_block); |
| 5210 | |
| 5211 | /* TDMA frame number on which we are supposed to send the ACK */ |
| 5212 | if (f_dl_block_rrbp_valid(dl_block)) { |
| 5213 | ack_fn := f_dl_block_ack_fn(dl_block, dl_fn); |
| 5214 | 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); |
| 5215 | if (tx_data_remain != 0) { |
| 5216 | /* Submit more data from time to time to keep the TBF ongoing */ |
| 5217 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[0].tlli, data)); |
| 5218 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[1].tlli, data)); |
| 5219 | tx_data_remain := tx_data_remain - 1; |
| 5220 | } |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 5221 | } else if (tx_data_remain != 0) { |
| 5222 | /* keep sending UL blocks when requested by USF to avoid |
| 5223 | * UL TBF timeout and hence stop receival of USFs */ |
| 5224 | if (usf_ms != -1) { |
| 5225 | f_ms_tx_ul_data_block(g_ms[usf_ms], f_rnd_octstring(10), cv := 15); |
| 5226 | } |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 5227 | } |
| 5228 | } |
| 5229 | |
| 5230 | 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] | 5231 | /* He we check that DL blocks scheduled at GPRS can still request UL |
| 5232 | * blocks for EGPRS MS, and the other way around. Furthermore, the 2nd |
| 5233 | * condition also ensures the downgrade to <=MCS4 condition is tested |
| 5234 | * above */ |
| 5235 | if (ms_gprs_usf_count[1] == 0 or ms_egprs_usf_count[0] == 0) { |
| 5236 | setverdict(fail, "USF exchange thresholds not met!"); |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 5237 | f_shutdown(__BFILE__, __LINE__); |
| 5238 | } |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 5239 | /* Here check for some level of fairness between them (at least ~40%): */ |
| 5240 | var integer gprs_usf_cnt := ms_gprs_usf_count[0] + ms_egprs_usf_count[0]; |
| 5241 | var integer egprs_usf_cnt := ms_gprs_usf_count[1] + ms_egprs_usf_count[1]; |
| 5242 | var integer total_usf_cnt := gprs_usf_cnt + egprs_usf_cnt; |
| 5243 | if (gprs_usf_cnt < total_usf_cnt * 4 / 10) { |
| 5244 | setverdict(fail, "USF GPRS-only MS ", gprs_usf_cnt, " < ", total_usf_cnt * 4 / 10); |
| 5245 | f_shutdown(__BFILE__, __LINE__); |
| 5246 | } |
| 5247 | if (egprs_usf_cnt < total_usf_cnt * 4 / 10) { |
| 5248 | setverdict(fail, "USF EGPRS MS ", egprs_usf_cnt, " < ", total_usf_cnt * 4 / 10); |
| 5249 | f_shutdown(__BFILE__, __LINE__); |
| 5250 | } |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 5251 | |
| 5252 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5253 | } |
| 5254 | |
| 5255 | |
Vadim Yanitskiy | dbd4b24 | 2020-10-31 05:44:58 +0700 | [diff] [blame] | 5256 | private function f_TC_paging_cs_multi_ms(template (value) TsTrxBtsNum nr, |
| 5257 | boolean exp_imsi, boolean exp_tmsi) |
| 5258 | runs on RAW_PCU_Test_CT { |
| 5259 | var bitstring mask := f_pad_bit(''B, lengthof(g_ms), '0'B); |
| 5260 | var integer pending := lengthof(g_ms); |
| 5261 | var RlcmacDlBlock dl_block; |
| 5262 | var boolean f1, f2; |
| 5263 | |
| 5264 | while (pending > 0) { |
| 5265 | var uint32_t poll_fn; |
| 5266 | |
| 5267 | /* Obtain a Downlink block and make sure it is a paging request */ |
| 5268 | f_rx_rlcmac_dl_block(dl_block, poll_fn, nr := nr); |
| 5269 | if (not match(dl_block, tr_RLCMAC_PACKET_PAG_REQ)) { |
| 5270 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5271 | break; |
| 5272 | } |
| 5273 | |
| 5274 | /* This should not happen in general, but who knows... */ |
| 5275 | var PacketPagingReq req := dl_block.ctrl.payload.u.paging; |
| 5276 | if (not ispresent(req.repeated_pageinfo)) { |
| 5277 | setverdict(fail, "Repeated Page Info IE is absent?!?"); |
| 5278 | break; |
| 5279 | } |
| 5280 | |
| 5281 | /* A single message may contain several MIs depending on their type */ |
| 5282 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 5283 | f1 := exp_imsi and f_pkt_paging_match_imsi(req, g_ms[i].imsi, |
| 5284 | ps_domain := false); |
| 5285 | f2 := exp_tmsi and f_pkt_paging_match_tmsi(req, oct2int(g_ms[i].tlli), |
| 5286 | ps_domain := false); |
| 5287 | if (not f1 and not f2) |
| 5288 | { continue; } |
| 5289 | |
| 5290 | /* Detect duplicate MIs */ |
| 5291 | if (mask[i] == '1'B) { |
| 5292 | setverdict(fail, "MS is paged twice: ", g_ms[i].imsi); |
| 5293 | continue; |
| 5294 | } |
| 5295 | |
| 5296 | mask[i] := '1'B; |
| 5297 | } |
| 5298 | |
| 5299 | pending := pending - lengthof(req.repeated_pageinfo); |
| 5300 | } |
| 5301 | |
| 5302 | for (var integer i := 0; i < lengthof(mask); i := i + 1) { |
| 5303 | if (mask[i] != '1'B) { |
| 5304 | setverdict(fail, "MS was not paged at all: ", g_ms[i].imsi); |
| 5305 | log("===== mask := ", mask); |
| 5306 | } |
| 5307 | } |
| 5308 | |
| 5309 | /* All messages must have been received by now, expect a dummy block */ |
| 5310 | f_rx_rlcmac_dl_block_exp_dummy(dl_block, nr := nr); |
| 5311 | } |
| 5312 | |
| 5313 | private function f_TC_paging_cs_multi_ms_init(BIT8 pdch_mask) |
| 5314 | runs on RAW_PCU_Test_CT { |
| 5315 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5316 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 5317 | |
| 5318 | /* Initialize NS/BSSGP side */ |
| 5319 | f_init_bssgp(); |
| 5320 | |
| 5321 | /* Explicitly set the given PDCH slot-mask to all transceivers */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 5322 | f_PCUIF_PDCHMask_set(info_ind, pdch_mask); |
Vadim Yanitskiy | dbd4b24 | 2020-10-31 05:44:58 +0700 | [diff] [blame] | 5323 | |
| 5324 | /* Allocate 56 GprsMS instances (maximum for 8 PDCH slots) */ |
| 5325 | f_init_gprs_ms(7 * 8); |
| 5326 | |
| 5327 | /* Initialize the PCU interface abstraction */ |
| 5328 | f_init_raw(testcasename(), info_ind); |
| 5329 | |
| 5330 | /* Establish BSSGP connection to the PCU */ |
| 5331 | f_bssgp_establish(); |
| 5332 | f_multi_ms_bssgp_register(); |
| 5333 | |
| 5334 | /* Establish an Uplink TBF for each GprsMS instance */ |
| 5335 | f_multi_ms_establish_tbf(do_activate := true); |
| 5336 | } |
| 5337 | |
| 5338 | testcase TC_paging_cs_multi_ms_imsi() runs on RAW_PCU_Test_CT { |
| 5339 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 5340 | |
| 5341 | /* Common part: send INFO.ind, establish TBFs... */ |
| 5342 | f_TC_paging_cs_multi_ms_init(pdch_mask := '00000001'B); |
| 5343 | |
| 5344 | /* Enqueue multiple CS PAGING requests at a time (IMSI only) */ |
| 5345 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 5346 | BSSGP[0].send(ts_BSSGP_CS_PAGING_IMSI(bvci, g_ms[i].imsi)); |
| 5347 | } |
| 5348 | |
| 5349 | /* FIXME: work around a race condition between PCUIF and BSSGP */ |
| 5350 | f_sleep(0.2); /* i.e. give the IUT some time to process everything */ |
| 5351 | |
| 5352 | /* Check what the IUT sends on PACCH, all GprsMS instances must be paged. |
| 5353 | * The IUT is expected to page on all PDCH slots of all transceivers. */ |
| 5354 | for (var integer trx_nr := 0; trx_nr < 8; trx_nr := trx_nr + 1) { |
| 5355 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, trx_nr); |
| 5356 | f_TC_paging_cs_multi_ms(nr, exp_imsi := true, exp_tmsi := false); |
| 5357 | } |
| 5358 | |
| 5359 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5360 | } |
| 5361 | |
| 5362 | testcase TC_paging_cs_multi_ms_tmsi() runs on RAW_PCU_Test_CT { |
| 5363 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 5364 | |
| 5365 | /* Common part: send INFO.ind, establish TBFs... */ |
| 5366 | f_TC_paging_cs_multi_ms_init(pdch_mask := '00000001'B); |
| 5367 | |
| 5368 | /* Enqueue multiple CS PAGING requests at a time (P-TMSI only) */ |
| 5369 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 5370 | var GsmTmsi tmsi := oct2int(g_ms[i].tlli); /* P-TMSI == TLLI */ |
| 5371 | BSSGP[0].send(ts_BSSGP_CS_PAGING_PTMSI(bvci, g_ms[i].imsi, tmsi)); |
| 5372 | } |
| 5373 | |
| 5374 | /* FIXME: work around a race condition between PCUIF and BSSGP */ |
| 5375 | f_sleep(0.2); /* i.e. give the IUT some time to process everything */ |
| 5376 | |
| 5377 | /* Check what the IUT sends on PACCH, all GprsMS instances must be paged. |
| 5378 | * The IUT is expected to page on all PDCH slots of all transceivers. */ |
| 5379 | for (var integer trx_nr := 0; trx_nr < 8; trx_nr := trx_nr + 1) { |
| 5380 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, trx_nr); |
| 5381 | f_TC_paging_cs_multi_ms(nr, exp_imsi := false, exp_tmsi := true); |
| 5382 | } |
| 5383 | |
| 5384 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5385 | } |
| 5386 | |
| 5387 | testcase TC_paging_cs_multi_ms_imsi_tmsi() runs on RAW_PCU_Test_CT { |
| 5388 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 5389 | |
| 5390 | /* Common part: send INFO.ind, establish TBFs... */ |
| 5391 | f_TC_paging_cs_multi_ms_init(pdch_mask := '00000001'B); |
| 5392 | |
| 5393 | /* Enqueue multiple CS PAGING requests at a time (IMSI & P-TMSI) */ |
| 5394 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 5395 | var GsmTmsi tmsi := oct2int(g_ms[i].tlli); /* P-TMSI == TLLI */ |
| 5396 | if (i mod 3 == 0) { /* One PDU fits: 1 IMSI and 2 P-TMSI MIs */ |
| 5397 | BSSGP[0].send(ts_BSSGP_CS_PAGING_PTMSI(bvci, g_ms[i].imsi, tmsi)); |
| 5398 | } else { |
| 5399 | BSSGP[0].send(ts_BSSGP_CS_PAGING_IMSI(bvci, g_ms[i].imsi)); |
| 5400 | } |
| 5401 | } |
| 5402 | |
| 5403 | /* FIXME: work around a race condition between PCUIF and BSSGP */ |
| 5404 | f_sleep(0.2); /* i.e. give the IUT some time to process everything */ |
| 5405 | |
| 5406 | /* Check what the IUT sends on PACCH, all GprsMS instances must be paged. |
| 5407 | * The IUT is expected to page on all PDCH slots of all transceivers. */ |
| 5408 | for (var integer trx_nr := 0; trx_nr < 8; trx_nr := trx_nr + 1) { |
| 5409 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, trx_nr); |
| 5410 | f_TC_paging_cs_multi_ms(nr, exp_imsi := true, exp_tmsi := true); |
| 5411 | } |
| 5412 | |
| 5413 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5414 | } |
| 5415 | |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5416 | 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] | 5417 | runs on RAW_PCU_Test_CT return RlcmacDlBlock { |
| 5418 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5419 | var integer i := 0; |
| 5420 | while (true) { |
| 5421 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
Vadim Yanitskiy | 7179d3e | 2022-10-04 03:27:29 +0700 | [diff] [blame] | 5422 | if (not match(dl_block, tr_RLCMAC_DL_DUMMY_CTRL())) { |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5423 | break; |
| 5424 | } |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5425 | if (max_num_iter > 0 and i > max_num_iter) { |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5426 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5427 | f_shutdown(__BFILE__, __LINE__); |
| 5428 | } |
| 5429 | i := i + 1; |
| 5430 | } |
| 5431 | return dl_block; |
| 5432 | } |
| 5433 | |
Vadim Yanitskiy | 03f74d4 | 2023-02-10 09:22:42 +0700 | [diff] [blame] | 5434 | private const GsmMcc c_BssgpCellMcc := '623'H; /* MCC: Central African Republic */ |
| 5435 | private const GsmMnc c_BssgpCellMnc := '03'H; /* MNC: Celca (Socatel) */ |
Vadim Yanitskiy | 7295661 | 2023-02-10 08:53:51 +0700 | [diff] [blame] | 5436 | private template (value) BssgpCellId ts_BssgpCellIdDstAddr_default := { |
| 5437 | ra_id := { |
| 5438 | lai := { |
| 5439 | mcc_mnc := f_build_BcdMccMnc(c_BssgpCellMcc, c_BssgpCellMnc), |
| 5440 | lac := 423 |
| 5441 | }, |
| 5442 | rac := 2 |
| 5443 | }, |
| 5444 | cell_id := 5 |
| 5445 | } |
| 5446 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5447 | private function f_outbound_nacc_rim_tx_resp(PCUIF_info_ind info_ind) |
| 5448 | runs on RAW_PCU_Test_CT { |
Vadim Yanitskiy | 88b87a4 | 2023-02-10 08:32:48 +0700 | [diff] [blame] | 5449 | /* Source Cell Identifier IE is generated by osmo-pcu based on the INFO.ind */ |
| 5450 | var BcdMccMnc src_mcc_mnc := f_build_BcdMccMnc_int(info_ind.mcc, info_ind.mnc, info_ind.mnc_3_digits == 1); |
| 5451 | 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] | 5452 | info_ind.cell_id)); |
Vadim Yanitskiy | 88b87a4 | 2023-02-10 08:32:48 +0700 | [diff] [blame] | 5453 | /* Destination Cell Identifier IE is resolved by the testsuite itself (emulating BSC) */ |
Vadim Yanitskiy | 7295661 | 2023-02-10 08:53:51 +0700 | [diff] [blame] | 5454 | var BssgpCellId dst := valueof(ts_BssgpCellIdDstAddr_default); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5455 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src)); |
| 5456 | var RIM_Routing_Address dst_addr := valueof(t_RIM_Routing_Address_cid(dst)); |
| 5457 | var template (value) RAN_Information_RIM_Container res_cont := |
| 5458 | ts_RAN_Information_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 5459 | ts_RIM_Sequence_Number(2), |
| 5460 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 5461 | ts_RIM_Protocol_Version_Number(1), |
| 5462 | tsu_ApplContainer_or_ApplErrContainer_NACC(tsu_ApplContainer_NACC(dst, false, 3, si_default)), |
| 5463 | omit); |
| 5464 | RIM.send(ts_PDU_BSSGP_RAN_INFORMATION(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 5465 | ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 5466 | res_cont)); |
| 5467 | } |
| 5468 | |
| 5469 | altstep as_outbound_nacc_rim_resolve(PCUIF_info_ind info_ind, boolean do_answer := true, boolean do_repeat := false) |
| 5470 | runs on RAW_PCU_Test_CT { |
Vadim Yanitskiy | 88b87a4 | 2023-02-10 08:32:48 +0700 | [diff] [blame] | 5471 | /* Source Cell Identifier IE is generated by osmo-pcu based on the INFO.ind */ |
| 5472 | var BcdMccMnc src_mcc_mnc := f_build_BcdMccMnc_int(info_ind.mcc, info_ind.mnc, info_ind.mnc_3_digits == 1); |
| 5473 | 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] | 5474 | info_ind.cell_id)); |
Vadim Yanitskiy | 88b87a4 | 2023-02-10 08:32:48 +0700 | [diff] [blame] | 5475 | /* Destination Cell Identifier IE is resolved by the testsuite itself (emulating BSC) */ |
Vadim Yanitskiy | 7295661 | 2023-02-10 08:53:51 +0700 | [diff] [blame] | 5476 | var BssgpCellId dst := valueof(ts_BssgpCellIdDstAddr_default); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5477 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src)); |
| 5478 | var RIM_Routing_Address dst_addr := valueof(t_RIM_Routing_Address_cid(dst)); |
| 5479 | [] RIM.receive(tr_RAN_INFORMATION_REQUEST(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 5480 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 5481 | tr_RAN_Information_Request_RIM_Container)) { |
| 5482 | if (do_answer) { |
| 5483 | f_outbound_nacc_rim_tx_resp(info_ind); |
| 5484 | } |
| 5485 | if (do_repeat) { |
| 5486 | repeat; |
| 5487 | } |
| 5488 | } |
| 5489 | } |
| 5490 | |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 5491 | private function f_ctrl_rx_nacc_rac_ci_req(out CtrlMessage ctrl_req, |
| 5492 | PCUIF_info_ind info_ind, |
| 5493 | GsmArfcn req_arfcn, |
| 5494 | uint6_t req_bsic) |
| 5495 | runs on RAW_PCU_Test_CT { |
| 5496 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 5497 | int2str(info_ind.lac) & "." & |
| 5498 | int2str(info_ind.cell_id) & "." & |
| 5499 | int2str(req_arfcn) & "." & |
| 5500 | int2str(req_bsic); |
| 5501 | f_ipa_ctrl_wait_link_up(); |
| 5502 | IPA_CTRL.receive(tr_CtrlMsgGet(?, ctrl_var)) -> value ctrl_req; |
| 5503 | } |
| 5504 | |
| 5505 | private function f_ctrl_tx_nacc_rac_ci_rsp(in CtrlMessage ctrl_req) |
| 5506 | runs on RAW_PCU_Test_CT { |
| 5507 | var BssgpCellId addr := valueof(ts_BssgpCellIdDstAddr_default); |
| 5508 | IPA_CTRL.send(ts_CtrlMsgGetRepl(ctrl_req.cmd.id, |
| 5509 | ctrl_req.cmd.variable, |
| 5510 | hex2str(c_BssgpCellMcc) & "-" & |
| 5511 | hex2str(c_BssgpCellMnc) & "-" & |
| 5512 | int2str(addr.ra_id.lai.lac) & "-" & |
| 5513 | int2str(addr.ra_id.rac) & "-" & |
| 5514 | int2str(addr.cell_id))); |
| 5515 | } |
| 5516 | |
| 5517 | private function f_pcuif_rx_nacc_rac_ci_req(out PCUIF_Message addr_req, |
| 5518 | PCUIF_info_ind info_ind, |
| 5519 | GsmArfcn req_arfcn, |
| 5520 | uint6_t req_bsic) |
| 5521 | runs on RAW_PCU_Test_CT { |
| 5522 | BTS.receive(tr_PCUIF_NEIGH_ADDR_REQ(0, info_ind.lac, info_ind.cell_id, |
| 5523 | req_arfcn, req_bsic)) -> value addr_req; |
| 5524 | } |
| 5525 | |
| 5526 | private function f_pcuif_tx_nacc_rac_ci_rsp(in PCUIF_Message addr_req) |
| 5527 | runs on RAW_PCU_Test_CT { |
| 5528 | var BssgpCellId addr := valueof(ts_BssgpCellIdDstAddr_default); |
| 5529 | BTS.send(ts_PCUIF_NEIGH_ADDR_CNF(0, addr_req.u.container.u.neigh_addr_req, 0, |
| 5530 | str2int(hex2str(c_BssgpCellMcc)), |
| 5531 | str2int(hex2str(c_BssgpCellMnc)), |
| 5532 | lengthof(c_BssgpCellMnc) - 2, |
| 5533 | addr.ra_id.lai.lac, |
| 5534 | addr.ra_id.rac, |
| 5535 | addr.cell_id)); |
| 5536 | } |
| 5537 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5538 | private function f_handle_nacc_rac_ci_query(PCUIF_info_ind info_ind, GsmArfcn req_arfcn, uint6_t req_bsic, |
| 5539 | boolean answer := true, boolean use_old_ctrl_iface := false) |
| 5540 | runs on RAW_PCU_Test_CT { |
| 5541 | if (use_old_ctrl_iface == true) { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 5542 | var CtrlMessage ctrl_req; |
| 5543 | 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] | 5544 | if (answer) { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 5545 | f_ctrl_tx_nacc_rac_ci_rsp(ctrl_req); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5546 | } |
| 5547 | } else { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 5548 | var PCUIF_Message pcuif_req; |
| 5549 | 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] | 5550 | if (answer) { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 5551 | f_pcuif_tx_nacc_rac_ci_rsp(pcuif_req); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5552 | } |
| 5553 | } |
| 5554 | } |
| 5555 | |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame] | 5556 | private function f_outbound_nacc_success_no_si(inout GprsMS ms, PCUIF_info_ind info_ind, |
| 5557 | boolean exp_rac_ci_query := true, boolean exp_si_query := true, |
| 5558 | boolean skip_final_ctrl_ack := false, |
| 5559 | boolean use_old_ctrl_iface := false, |
| 5560 | template (value) RlcmacUlCtrlMsg cell_chg_notif) |
| 5561 | runs on RAW_PCU_Test_CT { |
| 5562 | var template RlcmacDlCtrlMsg cell_chg_cont; |
| 5563 | var RlcmacDlBlock dl_block; |
| 5564 | var uint32_t sched_fn; |
| 5565 | |
| 5566 | /* Start NACC from MS side */ |
| 5567 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chg_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5568 | |
| 5569 | /* Obtain a Downlink block and make sure it is a PacketCellChangeContine. We also make sure that this |
| 5570 | * PacketCellChangeContine message does not contain any ARFCN/BSIC. */ |
| 5571 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5572 | cell_chg_cont := tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE |
| 5573 | cell_chg_cont.u.cell_chg_continue.arfcn_bsic_presence := '0'B |
| 5574 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, cell_chg_cont))) { |
| 5575 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5576 | f_shutdown(__BFILE__, __LINE__); |
| 5577 | } |
| 5578 | |
| 5579 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5580 | if (not skip_final_ctrl_ack and dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5581 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5582 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5583 | } |
| 5584 | } |
| 5585 | |
| 5586 | /* Start NACC from MS side, propose an UTRAN cell */ |
| 5587 | private function f_outbound_nacc_success_utran(inout GprsMS ms, PCUIF_info_ind info_ind, |
| 5588 | boolean exp_rac_ci_query := true, boolean exp_si_query := true, |
| 5589 | boolean skip_final_ctrl_ack := false, |
| 5590 | boolean use_old_ctrl_iface := false) |
| 5591 | runs on RAW_PCU_Test_CT { |
| 5592 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
| 5593 | var uint14_t req_uarfcn := 1234; |
| 5594 | var uint10_t req_scrambling_code := 456; |
| 5595 | |
| 5596 | /* Start NACC from MS side */ |
| 5597 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF_UTRAN(ms.ul_tbf.tfi, req_uarfcn, req_scrambling_code); |
| 5598 | 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); |
| 5599 | } |
| 5600 | |
| 5601 | /* Start NACC from MS side, propose an E-UTRAN cell */ |
| 5602 | private function f_outbound_nacc_success_eutran(inout GprsMS ms, PCUIF_info_ind info_ind, |
| 5603 | boolean exp_rac_ci_query := true, boolean exp_si_query := true, |
| 5604 | boolean skip_final_ctrl_ack := false, |
| 5605 | boolean use_old_ctrl_iface := false) |
| 5606 | runs on RAW_PCU_Test_CT { |
| 5607 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
| 5608 | var uint16_t req_earfcn := 1234; |
| 5609 | var uint9_t phys_layer_cell_id := 456; |
| 5610 | |
| 5611 | /* Start NACC from MS side */ |
| 5612 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF_EUTRAN(ms.ul_tbf.tfi, req_earfcn, phys_layer_cell_id); |
| 5613 | 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); |
| 5614 | } |
| 5615 | |
Philipp Maier | 58c0833 | 2023-06-30 13:26:42 +0200 | [diff] [blame] | 5616 | /* Start NACC from MS side, propose a GERAN cell */ |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame] | 5617 | private function f_outbound_nacc_success_geran(inout GprsMS ms, PCUIF_info_ind info_ind, |
| 5618 | boolean exp_rac_ci_query := true, boolean exp_si_query := true, |
| 5619 | boolean skip_final_ctrl_ack := false, |
| 5620 | boolean use_old_ctrl_iface := false) |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5621 | runs on RAW_PCU_Test_CT { |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5622 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Philipp Maier | 58c0833 | 2023-06-30 13:26:42 +0200 | [diff] [blame] | 5623 | var template RlcmacDlCtrlMsg cell_chg_cont; |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5624 | var RlcmacDlBlock dl_block; |
| 5625 | var uint32_t sched_fn; |
| 5626 | var GsmArfcn req_arfcn := 862; |
| 5627 | var uint6_t req_bsic := 43; |
| 5628 | |
| 5629 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5630 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5631 | 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] | 5632 | |
| 5633 | if (exp_rac_ci_query == true) { |
| 5634 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5635 | 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] | 5636 | } |
| 5637 | |
| 5638 | if (exp_si_query == true) { |
| 5639 | /* RIM procedure: */ |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5640 | as_outbound_nacc_rim_resolve(info_ind); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5641 | } |
| 5642 | |
| 5643 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 5644 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5645 | |
Philipp Maier | 58c0833 | 2023-06-30 13:26:42 +0200 | [diff] [blame] | 5646 | /* Obtain a Downlink block and make sure it is a PacketCellChangeContinue, also verify that |
| 5647 | * the PacketCellChangeContinue message contains the ARFCN and BSIC which was proposed in |
| 5648 | * the PacketCellChangeNotification before. */ |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5649 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
Philipp Maier | 58c0833 | 2023-06-30 13:26:42 +0200 | [diff] [blame] | 5650 | cell_chg_cont := tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE |
| 5651 | cell_chg_cont.u.cell_chg_continue.arfcn_bsic_presence := '1'B |
| 5652 | cell_chg_cont.u.cell_chg_continue.arfcn := req_arfcn; |
| 5653 | cell_chg_cont.u.cell_chg_continue.bsic := req_bsic; |
| 5654 | 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] | 5655 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5656 | f_shutdown(__BFILE__, __LINE__); |
| 5657 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5658 | /* 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] | 5659 | 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] | 5660 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5661 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5662 | } |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5663 | } |
| 5664 | |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame] | 5665 | type enumerated f_TC_nacc_outbound_success_ran_type { |
| 5666 | NACC_RAN_GERAN, |
| 5667 | NACC_RAN_UTRAN, |
| 5668 | NACC_RAN_EUTRAN |
| 5669 | } |
| 5670 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5671 | /* 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] | 5672 | 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] | 5673 | var PollFnCtx pollctx; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5674 | var GprsMS ms; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5675 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5676 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5677 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5678 | if (use_old_ctrl_iface) { |
| 5679 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5680 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5681 | } |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5682 | |
| 5683 | /* Initialize NS/BSSGP side */ |
| 5684 | f_init_bssgp(); |
| 5685 | /* Initialize GPRS MS side */ |
| 5686 | f_init_gprs_ms(); |
| 5687 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5688 | |
| 5689 | /* Initialize the PCU interface abstraction */ |
| 5690 | f_init_raw(testcasename(), info_ind); |
| 5691 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5692 | /* Make sure we are not affected by full cache from previous tests */ |
| 5693 | f_pcuvty_flush_neigh_caches(); |
| 5694 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5695 | /* Establish BSSGP connection to the PCU */ |
| 5696 | f_bssgp_establish(); |
| 5697 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5698 | |
| 5699 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5700 | 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] | 5701 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5702 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5703 | |
| 5704 | /* Start NACC from MS side */ |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame] | 5705 | if (ran_type == NACC_RAN_GERAN) { |
| 5706 | f_outbound_nacc_success_geran(ms, info_ind, use_old_ctrl_iface := use_old_ctrl_iface); |
| 5707 | } else if (ran_type == NACC_RAN_UTRAN) { |
| 5708 | f_outbound_nacc_success_utran(ms, info_ind, use_old_ctrl_iface := use_old_ctrl_iface); |
| 5709 | } else if (ran_type == NACC_RAN_EUTRAN) { |
| 5710 | f_outbound_nacc_success_eutran(ms, info_ind, use_old_ctrl_iface := use_old_ctrl_iface); |
| 5711 | } |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5712 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5713 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5714 | } |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5715 | |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame] | 5716 | testcase TC_nacc_outbound_success() runs on RAW_PCU_Test_CT { |
| 5717 | f_TC_nacc_outbound_success(NACC_RAN_GERAN); |
| 5718 | } |
| 5719 | |
| 5720 | testcase TC_nacc_outbound_success_utran() runs on RAW_PCU_Test_CT { |
| 5721 | f_TC_nacc_outbound_success(NACC_RAN_UTRAN); |
| 5722 | } |
| 5723 | |
| 5724 | testcase TC_nacc_outbound_success_eutran() runs on RAW_PCU_Test_CT { |
| 5725 | f_TC_nacc_outbound_success(NACC_RAN_EUTRAN); |
| 5726 | } |
| 5727 | |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 5728 | /* Verify Pkt Cell Change Continue is retransmitted if not CTRL ACKed */ |
| 5729 | testcase TC_nacc_outbound_success_no_ctrl_ack() runs on RAW_PCU_Test_CT { |
| 5730 | var PollFnCtx pollctx; |
| 5731 | var GprsMS ms; |
| 5732 | var RlcmacDlBlock dl_block; |
| 5733 | var uint32_t sched_fn; |
| 5734 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5735 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 5736 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5737 | if (use_old_ctrl_iface) { |
| 5738 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5739 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5740 | } |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 5741 | |
| 5742 | /* Initialize NS/BSSGP side */ |
| 5743 | f_init_bssgp(); |
| 5744 | /* Initialize GPRS MS side */ |
| 5745 | f_init_gprs_ms(); |
| 5746 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5747 | |
| 5748 | /* Initialize the PCU interface abstraction */ |
| 5749 | f_init_raw(testcasename(), info_ind); |
| 5750 | |
| 5751 | /* Make sure we are not affected by full cache from previous tests */ |
| 5752 | f_pcuvty_flush_neigh_caches(); |
| 5753 | |
| 5754 | /* Establish BSSGP connection to the PCU */ |
| 5755 | f_bssgp_establish(); |
| 5756 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5757 | |
| 5758 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5759 | 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] | 5760 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5761 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5762 | |
| 5763 | /* Start NACC from MS side, avoid sending final CTRL ACK */ |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame] | 5764 | f_outbound_nacc_success_geran(ms, info_ind, skip_final_ctrl_ack := true, |
| 5765 | use_old_ctrl_iface := use_old_ctrl_iface); |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 5766 | |
| 5767 | /* Wait until we receive something non-dummy */ |
| 5768 | dl_block := f_skip_dummy(0, sched_fn); |
| 5769 | /* Make sure it is a Pkt Cell Chg Continue (retransmitted)*/ |
| 5770 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5771 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5772 | } |
| 5773 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5774 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5775 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5776 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5777 | } |
| 5778 | |
| 5779 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5780 | } |
| 5781 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5782 | /* Verify PCU handles outbound Network Assisted Cell Change Cell Change (NACC, TS 44.060 sec 8.8) twice, the second time using the caches */ |
| 5783 | testcase TC_nacc_outbound_success_twice() runs on RAW_PCU_Test_CT { |
| 5784 | var PollFnCtx pollctx; |
| 5785 | var GprsMS ms; |
| 5786 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5787 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5788 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5789 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5790 | if (use_old_ctrl_iface) { |
| 5791 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5792 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5793 | } |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5794 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5795 | /* Initialize NS/BSSGP side */ |
| 5796 | f_init_bssgp(); |
| 5797 | /* Initialize GPRS MS side */ |
| 5798 | f_init_gprs_ms(); |
| 5799 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5800 | |
| 5801 | /* Initialize the PCU interface abstraction */ |
| 5802 | f_init_raw(testcasename(), info_ind); |
| 5803 | |
| 5804 | /* Make sure we are not affected by full cache from previous tests */ |
| 5805 | f_pcuvty_flush_neigh_caches(); |
| 5806 | /* Set timeout values for caches so that entries will be in cache during second try */ |
| 5807 | f_pcuvty_set_neigh_caches(10, 10); |
| 5808 | |
| 5809 | /* Establish BSSGP connection to the PCU */ |
| 5810 | f_bssgp_establish(); |
| 5811 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5812 | |
| 5813 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5814 | 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] | 5815 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5816 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5817 | |
| 5818 | /* Start NACC from MS side */ |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame] | 5819 | 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] | 5820 | |
| 5821 | /* 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] | 5822 | 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] | 5823 | |
| 5824 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5825 | } |
| 5826 | |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 5827 | /* Verify PCU handles outbound Network Assisted Cell Change Cell Change (NACC, |
| 5828 | * TS 44.060 sec 8.8) twice, the second time after caches timed out |
| 5829 | */ |
| 5830 | testcase TC_nacc_outbound_success_twice_nocache() runs on RAW_PCU_Test_CT { |
| 5831 | var PollFnCtx pollctx; |
| 5832 | var GprsMS ms; |
| 5833 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5834 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5835 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 5836 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5837 | if (use_old_ctrl_iface) { |
| 5838 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5839 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5840 | } |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 5841 | |
| 5842 | /* Initialize NS/BSSGP side */ |
| 5843 | f_init_bssgp(); |
| 5844 | /* Initialize GPRS MS side */ |
| 5845 | f_init_gprs_ms(); |
| 5846 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5847 | |
| 5848 | /* Initialize the PCU interface abstraction */ |
| 5849 | f_init_raw(testcasename(), info_ind); |
| 5850 | |
| 5851 | /* Make sure we are not affected by full cache from previous tests */ |
| 5852 | f_pcuvty_flush_neigh_caches(); |
| 5853 | /* Set timeout values for caches so that entries will be erased before the second try */ |
| 5854 | f_pcuvty_set_neigh_caches(1, 1); |
| 5855 | |
| 5856 | /* Establish BSSGP connection to the PCU */ |
| 5857 | f_bssgp_establish(); |
| 5858 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5859 | |
| 5860 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5861 | 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] | 5862 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5863 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5864 | |
| 5865 | /* Start NACC from MS side */ |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame] | 5866 | 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] | 5867 | |
| 5868 | /* CTRL client should have disconnected from us */ |
| 5869 | f_ipa_ctrl_wait_link_down(); |
| 5870 | /* wait for cache entries to time out */ |
| 5871 | f_sleep(2.0); |
| 5872 | /* 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] | 5873 | 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] | 5874 | |
| 5875 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5876 | } |
| 5877 | |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5878 | /* 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] | 5879 | testcase TC_nacc_outbound_rac_ci_resolve_conn_refused() runs on RAW_PCU_Test_CT { |
| 5880 | var RlcmacDlBlock dl_block; |
| 5881 | var PollFnCtx pollctx; |
| 5882 | var uint32_t sched_fn; |
| 5883 | var GprsMS ms; |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5884 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 5885 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 5886 | var GsmArfcn req_arfcn := 862; |
| 5887 | var uint6_t req_bsic := 43; |
| 5888 | |
| 5889 | /* In here we explicitly avoid starting osmo-bsc emulation neighbor |
| 5890 | * resolution CTRL port, to trigger Conn Refused by socket: |
| 5891 | * f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5892 | */ |
| 5893 | |
| 5894 | /* Initialize NS/BSSGP side */ |
| 5895 | f_init_bssgp(); |
| 5896 | /* Initialize GPRS MS side */ |
| 5897 | f_init_gprs_ms(); |
| 5898 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5899 | |
| 5900 | /* Initialize the PCU interface abstraction */ |
| 5901 | f_init_raw(testcasename(), info_ind); |
| 5902 | |
| 5903 | /* Make sure we are not affected by full cache from previous tests */ |
| 5904 | f_pcuvty_flush_neigh_caches(); |
| 5905 | |
| 5906 | /* Establish BSSGP connection to the PCU */ |
| 5907 | f_bssgp_establish(); |
| 5908 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5909 | |
| 5910 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5911 | 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] | 5912 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5913 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5914 | |
| 5915 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5916 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5917 | 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] | 5918 | |
| 5919 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5920 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 5921 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 5922 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5923 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5924 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5925 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5926 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5927 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5928 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5929 | } |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 5930 | |
| 5931 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5932 | } |
| 5933 | |
| 5934 | /* 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] | 5935 | testcase TC_nacc_outbound_rac_ci_resolve_timeout() runs on RAW_PCU_Test_CT { |
| 5936 | var RlcmacDlBlock dl_block; |
| 5937 | var PollFnCtx pollctx; |
| 5938 | var uint32_t sched_fn; |
| 5939 | var GprsMS ms; |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5940 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5941 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5942 | var GsmArfcn req_arfcn := 862; |
| 5943 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5944 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5945 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5946 | if (use_old_ctrl_iface) { |
| 5947 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5948 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5949 | } |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5950 | |
| 5951 | /* Initialize NS/BSSGP side */ |
| 5952 | f_init_bssgp(); |
| 5953 | /* Initialize GPRS MS side */ |
| 5954 | f_init_gprs_ms(); |
| 5955 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5956 | |
| 5957 | /* Initialize the PCU interface abstraction */ |
| 5958 | f_init_raw(testcasename(), info_ind); |
| 5959 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5960 | /* Make sure we are not affected by full cache from previous tests */ |
| 5961 | f_pcuvty_flush_neigh_caches(); |
| 5962 | |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5963 | /* Establish BSSGP connection to the PCU */ |
| 5964 | f_bssgp_establish(); |
| 5965 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5966 | |
| 5967 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 5968 | 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] | 5969 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5970 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5971 | |
| 5972 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 5973 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5974 | 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] | 5975 | |
| 5976 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5977 | /* 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] | 5978 | 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] | 5979 | |
| 5980 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5981 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5982 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 5983 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5984 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5985 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 5986 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5987 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5988 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5989 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5990 | } |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5991 | |
| 5992 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5993 | } |
| 5994 | |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 5995 | /* Verify PCU transmits Pkt Cell Change Continue if RAC+CI resolution fails during outbound NACC procedure */ |
| 5996 | testcase TC_nacc_outbound_rac_ci_resolve_fail_parse_response() runs on RAW_PCU_Test_CT { |
| 5997 | var RlcmacDlBlock dl_block; |
| 5998 | var PollFnCtx pollctx; |
| 5999 | var uint32_t sched_fn; |
| 6000 | var GprsMS ms; |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6001 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 6002 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 6003 | var GsmArfcn req_arfcn := 862; |
| 6004 | var uint6_t req_bsic := 43; |
| 6005 | |
| 6006 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6007 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6008 | |
| 6009 | /* Initialize NS/BSSGP side */ |
| 6010 | f_init_bssgp(); |
| 6011 | /* Initialize GPRS MS side */ |
| 6012 | f_init_gprs_ms(); |
| 6013 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6014 | |
| 6015 | /* Initialize the PCU interface abstraction */ |
| 6016 | f_init_raw(testcasename(), info_ind); |
| 6017 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 6018 | /* Make sure we are not affected by full cache from previous tests */ |
| 6019 | f_pcuvty_flush_neigh_caches(); |
| 6020 | |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 6021 | /* Establish BSSGP connection to the PCU */ |
| 6022 | f_bssgp_establish(); |
| 6023 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6024 | |
| 6025 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 6026 | 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] | 6027 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6028 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6029 | |
| 6030 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6031 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6032 | 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] | 6033 | |
| 6034 | /* osmo-pcu should now ask for resolution: */ |
| 6035 | f_ipa_ctrl_wait_link_up(); |
| 6036 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 6037 | int2str(info_ind.lac) & "." & |
| 6038 | int2str(info_ind.cell_id) & "." & |
| 6039 | int2str(req_arfcn) & "." & |
| 6040 | int2str(req_bsic); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6041 | /* 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] | 6042 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "foobar-error"); |
| 6043 | |
| 6044 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 6045 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 6046 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 6047 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6048 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6049 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 6050 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6051 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6052 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6053 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6054 | } |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 6055 | |
| 6056 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6057 | } |
| 6058 | |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 6059 | /* Verify PCU transmits Pkt Cell Change Continue if SI resolution fails during outbound NACC procedure */ |
| 6060 | testcase TC_nacc_outbound_si_resolve_timeout() runs on RAW_PCU_Test_CT { |
| 6061 | var RlcmacDlBlock dl_block; |
| 6062 | var PollFnCtx pollctx; |
| 6063 | var uint32_t sched_fn; |
| 6064 | var GprsMS ms; |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6065 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 6066 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 6067 | var GsmArfcn req_arfcn := 862; |
| 6068 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6069 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 6070 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6071 | if (use_old_ctrl_iface) { |
| 6072 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6073 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6074 | } |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 6075 | |
| 6076 | /* Initialize NS/BSSGP side */ |
| 6077 | f_init_bssgp(); |
| 6078 | /* Initialize GPRS MS side */ |
| 6079 | f_init_gprs_ms(); |
| 6080 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6081 | |
| 6082 | /* Initialize the PCU interface abstraction */ |
| 6083 | f_init_raw(testcasename(), info_ind); |
| 6084 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 6085 | /* Make sure we are not affected by full cache from previous tests */ |
| 6086 | f_pcuvty_flush_neigh_caches(); |
| 6087 | |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 6088 | /* Establish BSSGP connection to the PCU */ |
| 6089 | f_bssgp_establish(); |
| 6090 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6091 | |
| 6092 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 6093 | 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] | 6094 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6095 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6096 | |
| 6097 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6098 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6099 | 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] | 6100 | |
| 6101 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6102 | 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] | 6103 | |
| 6104 | /* RIM procedure: */ |
Vadim Yanitskiy | d8aa5e8 | 2023-02-12 17:11:42 +0700 | [diff] [blame] | 6105 | as_outbound_nacc_rim_resolve(info_ind, do_answer := false); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 6106 | /* We never answer the RIM procude -> PCU timeouts and should send Pkt Cell Chg continue */ |
| 6107 | |
| 6108 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 6109 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 6110 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 6111 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6112 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6113 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 6114 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6115 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6116 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6117 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6118 | } |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 6119 | |
| 6120 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6121 | } |
| 6122 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6123 | /* Test MS sending Pkt Cell Change Notify twice (duplicate msg) while waiting for CTRL resolution */ |
| 6124 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup() runs on RAW_PCU_Test_CT { |
| 6125 | var PollFnCtx pollctx; |
| 6126 | var GprsMS ms; |
| 6127 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6128 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6129 | var RlcmacDlBlock dl_block; |
| 6130 | var uint32_t sched_fn; |
| 6131 | var CtrlMessage rx_ctrl; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6132 | var charstring ctrl_var; |
| 6133 | var PCUIF_Message pcu_msg; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6134 | var GsmArfcn req_arfcn := 862; |
| 6135 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6136 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6137 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6138 | if (use_old_ctrl_iface) { |
| 6139 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6140 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6141 | } |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6142 | |
| 6143 | /* Initialize NS/BSSGP side */ |
| 6144 | f_init_bssgp(); |
| 6145 | /* Initialize GPRS MS side */ |
| 6146 | f_init_gprs_ms(); |
| 6147 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6148 | |
| 6149 | /* Initialize the PCU interface abstraction */ |
| 6150 | f_init_raw(testcasename(), info_ind); |
| 6151 | |
| 6152 | /* Make sure we are not affected by full cache from previous tests */ |
| 6153 | f_pcuvty_flush_neigh_caches(); |
| 6154 | |
| 6155 | /* Establish BSSGP connection to the PCU */ |
| 6156 | f_bssgp_establish(); |
| 6157 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6158 | |
| 6159 | /* Send PACKET RESOURCE REQUEST */ |
| 6160 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6161 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6162 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6163 | |
| 6164 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6165 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6166 | 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] | 6167 | |
| 6168 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6169 | if (use_old_ctrl_iface) { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 6170 | 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] | 6171 | } else { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 6172 | 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] | 6173 | } |
| 6174 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6175 | /* Before receiving CTRL response, MS retransmits Pkt cell Chg Notif */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6176 | 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] | 6177 | 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] | 6178 | |
| 6179 | if (use_old_ctrl_iface) { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 6180 | f_ctrl_tx_nacc_rac_ci_rsp(rx_ctrl); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6181 | } else { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 6182 | f_pcuif_tx_nacc_rac_ci_rsp(pcu_msg); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6183 | } |
| 6184 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6185 | timer T := 2.0; |
| 6186 | T.start; |
| 6187 | alt { |
| 6188 | [] as_outbound_nacc_rim_resolve(info_ind, do_repeat := true); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6189 | [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] | 6190 | setverdict(fail, "Received unexpected CTRL resolution after duplicate Pkt Cell Change Notification:", rx_ctrl); |
| 6191 | f_shutdown(__BFILE__, __LINE__); |
| 6192 | } |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6193 | [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 { |
| 6194 | setverdict(fail, "Received unexpected PCUIF resolution after duplicate Pkt Cell Change Notification:", pcu_msg); |
| 6195 | f_shutdown(__BFILE__, __LINE__); |
| 6196 | } |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6197 | [] T.timeout { |
| 6198 | setverdict(pass); |
| 6199 | } |
| 6200 | } |
| 6201 | |
| 6202 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 6203 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6204 | |
| 6205 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6206 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6207 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6208 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6209 | f_shutdown(__BFILE__, __LINE__); |
| 6210 | } |
| 6211 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6212 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6213 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6214 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6215 | } |
| 6216 | |
| 6217 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6218 | } |
| 6219 | |
| 6220 | /* Test MS sending Pkt Cell Change Notify twice (duplicate msg) while waiting for SI resolution */ |
| 6221 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup2() runs on RAW_PCU_Test_CT { |
| 6222 | var PollFnCtx pollctx; |
| 6223 | var GprsMS ms; |
| 6224 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6225 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6226 | var RlcmacDlBlock dl_block; |
| 6227 | var uint32_t sched_fn; |
| 6228 | var CtrlMessage rx_ctrl; |
| 6229 | var GsmArfcn req_arfcn := 862; |
| 6230 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6231 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6232 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6233 | if (use_old_ctrl_iface) { |
| 6234 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6235 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6236 | } |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6237 | |
| 6238 | /* Initialize NS/BSSGP side */ |
| 6239 | f_init_bssgp(); |
| 6240 | /* Initialize GPRS MS side */ |
| 6241 | f_init_gprs_ms(); |
| 6242 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6243 | |
| 6244 | /* Initialize the PCU interface abstraction */ |
| 6245 | f_init_raw(testcasename(), info_ind); |
| 6246 | |
| 6247 | /* Make sure we are not affected by full cache from previous tests */ |
| 6248 | f_pcuvty_flush_neigh_caches(); |
| 6249 | |
| 6250 | /* Establish BSSGP connection to the PCU */ |
| 6251 | f_bssgp_establish(); |
| 6252 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6253 | |
| 6254 | /* Send PACKET RESOURCE REQUEST */ |
| 6255 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6256 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6257 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6258 | |
| 6259 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6260 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6261 | 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] | 6262 | |
| 6263 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6264 | 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] | 6265 | as_outbound_nacc_rim_resolve(info_ind, do_answer := false); |
| 6266 | /* Before receiving RIM response, MS retransmits Pkt cell Chg Notif */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6267 | 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] | 6268 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
| 6269 | f_outbound_nacc_rim_tx_resp(info_ind); |
| 6270 | timer T := 1.0; |
| 6271 | T.start; |
| 6272 | alt { |
| 6273 | [] RIM.receive { |
| 6274 | setverdict(fail, "Received unexpected RIM message"); |
| 6275 | f_shutdown(__BFILE__, __LINE__); |
| 6276 | } |
| 6277 | [] T.timeout { |
| 6278 | setverdict(pass); |
| 6279 | } |
| 6280 | } |
| 6281 | |
| 6282 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 6283 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6284 | |
| 6285 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6286 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6287 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6288 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6289 | f_shutdown(__BFILE__, __LINE__); |
| 6290 | } |
| 6291 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6292 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6293 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6294 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6295 | } |
| 6296 | |
| 6297 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6298 | } |
| 6299 | |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6300 | /* Test MS sending Pkt Cell Change Notification twice (duplicate msg) while sending Pkt Neigh Data Change */ |
| 6301 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup3() runs on RAW_PCU_Test_CT { |
| 6302 | var PollFnCtx pollctx; |
| 6303 | var GprsMS ms; |
| 6304 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6305 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6306 | var RlcmacDlBlock dl_block; |
| 6307 | var uint32_t sched_fn; |
| 6308 | var CtrlMessage rx_ctrl; |
| 6309 | var GsmArfcn req_arfcn := 862; |
| 6310 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6311 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6312 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6313 | if (use_old_ctrl_iface) { |
| 6314 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6315 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6316 | } |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6317 | |
| 6318 | /* Initialize NS/BSSGP side */ |
| 6319 | f_init_bssgp(); |
| 6320 | /* Initialize GPRS MS side */ |
| 6321 | f_init_gprs_ms(); |
| 6322 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6323 | |
| 6324 | /* Initialize the PCU interface abstraction */ |
| 6325 | f_init_raw(testcasename(), info_ind); |
| 6326 | |
| 6327 | /* Make sure we are not affected by full cache from previous tests */ |
| 6328 | f_pcuvty_flush_neigh_caches(); |
| 6329 | |
| 6330 | /* Establish BSSGP connection to the PCU */ |
| 6331 | f_bssgp_establish(); |
| 6332 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6333 | |
| 6334 | /* Send PACKET RESOURCE REQUEST */ |
| 6335 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6336 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6337 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6338 | |
| 6339 | /* Start NACC from MS side */ |
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, req_bsic); |
| 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 | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6342 | |
| 6343 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6344 | 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] | 6345 | /* RIM procedure: */ |
| 6346 | as_outbound_nacc_rim_resolve(info_ind); |
| 6347 | |
| 6348 | /* Receive first Pkt Neigh data Change, then trigger a new Pkt Cell Change Notif: */ |
| 6349 | 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] | 6350 | 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] | 6351 | |
| 6352 | /* It should be ignored, let's continue fetching Pkt Neigh Data Change */ |
| 6353 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, f_ms_tx_TsTrxBtsNum(ms), 1, 16); |
| 6354 | |
| 6355 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6356 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6357 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6358 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6359 | f_shutdown(__BFILE__, __LINE__); |
| 6360 | } |
| 6361 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6362 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6363 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6364 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6365 | } |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 6366 | |
| 6367 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6368 | } |
| 6369 | |
| 6370 | /* Test MS sending Pkt Cell Change Notification twice (duplicate msg) while sending Pkt Cell Change Continue */ |
| 6371 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup4() runs on RAW_PCU_Test_CT { |
| 6372 | var PollFnCtx pollctx; |
| 6373 | var GprsMS ms; |
| 6374 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6375 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6376 | var RlcmacDlBlock dl_block; |
| 6377 | var uint32_t sched_fn; |
| 6378 | var CtrlMessage rx_ctrl; |
| 6379 | var GsmArfcn req_arfcn := 862; |
| 6380 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6381 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6382 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6383 | if (use_old_ctrl_iface) { |
| 6384 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6385 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6386 | } |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6387 | |
| 6388 | /* Initialize NS/BSSGP side */ |
| 6389 | f_init_bssgp(); |
| 6390 | /* Initialize GPRS MS side */ |
| 6391 | f_init_gprs_ms(); |
| 6392 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6393 | |
| 6394 | /* Initialize the PCU interface abstraction */ |
| 6395 | f_init_raw(testcasename(), info_ind); |
| 6396 | |
| 6397 | /* Make sure we are not affected by full cache from previous tests */ |
| 6398 | f_pcuvty_flush_neigh_caches(); |
| 6399 | |
| 6400 | /* Establish BSSGP connection to the PCU */ |
| 6401 | f_bssgp_establish(); |
| 6402 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6403 | |
| 6404 | /* Send PACKET RESOURCE REQUEST */ |
| 6405 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6406 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6407 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6408 | |
| 6409 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6410 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6411 | 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] | 6412 | |
| 6413 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6414 | 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] | 6415 | /* RIM procedure: */ |
| 6416 | as_outbound_nacc_rim_resolve(info_ind); |
| 6417 | |
| 6418 | /* Announce SI back to MS, continue NACC procedure */ |
| 6419 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 6420 | |
| 6421 | /* trigger a dup Pkt Cell Change Notif, it should be ignored: */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6422 | 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] | 6423 | |
| 6424 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6425 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6426 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6427 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6428 | f_shutdown(__BFILE__, __LINE__); |
| 6429 | } |
| 6430 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6431 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6432 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6433 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6434 | } |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 6435 | |
| 6436 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6437 | } |
| 6438 | |
| 6439 | /* Test MS sending Pkt Cell Change Notification twice (duplicate msg) while waiting for Pkt Cell Change Continue CTRL ACK */ |
| 6440 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup5() runs on RAW_PCU_Test_CT { |
| 6441 | var PollFnCtx pollctx; |
| 6442 | var GprsMS ms; |
| 6443 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6444 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6445 | var RlcmacDlBlock dl_block; |
| 6446 | var uint32_t sched_fn; |
| 6447 | var CtrlMessage rx_ctrl; |
| 6448 | var GsmArfcn req_arfcn := 862; |
| 6449 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6450 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6451 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6452 | if (use_old_ctrl_iface) { |
| 6453 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6454 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6455 | } |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6456 | |
| 6457 | /* Initialize NS/BSSGP side */ |
| 6458 | f_init_bssgp(); |
| 6459 | /* Initialize GPRS MS side */ |
| 6460 | f_init_gprs_ms(); |
| 6461 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6462 | |
| 6463 | /* Initialize the PCU interface abstraction */ |
| 6464 | f_init_raw(testcasename(), info_ind); |
| 6465 | |
| 6466 | /* Make sure we are not affected by full cache from previous tests */ |
| 6467 | f_pcuvty_flush_neigh_caches(); |
| 6468 | |
| 6469 | /* Establish BSSGP connection to the PCU */ |
| 6470 | f_bssgp_establish(); |
| 6471 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6472 | |
| 6473 | /* Send PACKET RESOURCE REQUEST */ |
| 6474 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6475 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6476 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6477 | |
| 6478 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6479 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6480 | 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] | 6481 | |
| 6482 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6483 | 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] | 6484 | /* RIM procedure: */ |
| 6485 | as_outbound_nacc_rim_resolve(info_ind); |
| 6486 | |
| 6487 | /* Announce SI back to MS, continue NACC procedure */ |
| 6488 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 6489 | |
| 6490 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6491 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6492 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6493 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6494 | f_shutdown(__BFILE__, __LINE__); |
| 6495 | } |
| 6496 | /* trigger a dup Pkt Cell Change Notif, it should be ignored: */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6497 | 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] | 6498 | |
| 6499 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6500 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6501 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6502 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6503 | } |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 6504 | |
| 6505 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6506 | } |
| 6507 | |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6508 | /* Test MS sending Pkt Cell Change Notify twice (different tgt cell each time) |
| 6509 | * while waiting for CTRL resolution */ |
| 6510 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice() runs on RAW_PCU_Test_CT { |
| 6511 | var PollFnCtx pollctx; |
| 6512 | var GprsMS ms; |
| 6513 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6514 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6515 | var RlcmacDlBlock dl_block; |
| 6516 | var uint32_t sched_fn; |
| 6517 | var CtrlMessage rx_ctrl; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6518 | var charstring ctrl_var; |
| 6519 | var PCUIF_Message pcu_msg; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6520 | var GsmArfcn req_arfcn := 862; |
| 6521 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6522 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6523 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6524 | if (use_old_ctrl_iface) { |
| 6525 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6526 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6527 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6528 | |
| 6529 | /* Initialize NS/BSSGP side */ |
| 6530 | f_init_bssgp(); |
| 6531 | /* Initialize GPRS MS side */ |
| 6532 | f_init_gprs_ms(); |
| 6533 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6534 | |
| 6535 | /* Initialize the PCU interface abstraction */ |
| 6536 | f_init_raw(testcasename(), info_ind); |
| 6537 | |
| 6538 | /* Make sure we are not affected by full cache from previous tests */ |
| 6539 | f_pcuvty_flush_neigh_caches(); |
| 6540 | |
| 6541 | /* Establish BSSGP connection to the PCU */ |
| 6542 | f_bssgp_establish(); |
| 6543 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6544 | |
| 6545 | /* Send PACKET RESOURCE REQUEST */ |
| 6546 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6547 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6548 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6549 | |
| 6550 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6551 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6552 | 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] | 6553 | |
| 6554 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6555 | if (use_old_ctrl_iface) { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 6556 | 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] | 6557 | } else { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 6558 | 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] | 6559 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6560 | /* 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] | 6561 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 6562 | 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] | 6563 | 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] | 6564 | if (use_old_ctrl_iface) { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 6565 | f_ctrl_tx_nacc_rac_ci_rsp(rx_ctrl); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6566 | } else { |
Vadim Yanitskiy | 8a15b45 | 2023-02-13 01:39:57 +0700 | [diff] [blame] | 6567 | f_pcuif_tx_nacc_rac_ci_rsp(pcu_msg); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6568 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6569 | /* 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] | 6570 | 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] | 6571 | |
| 6572 | /* And finally everything continues as usual with RIN procedure */ |
| 6573 | as_outbound_nacc_rim_resolve(info_ind); |
| 6574 | |
| 6575 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 6576 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6577 | |
| 6578 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6579 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6580 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6581 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6582 | f_shutdown(__BFILE__, __LINE__); |
| 6583 | } |
| 6584 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6585 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6586 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6587 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6588 | } |
| 6589 | |
| 6590 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6591 | } |
| 6592 | |
| 6593 | /* Test MS sending Pkt Cell Change Notify twice (different tgt cell each time) |
| 6594 | * while waiting for SI resolution */ |
| 6595 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice2() runs on RAW_PCU_Test_CT { |
| 6596 | var PollFnCtx pollctx; |
| 6597 | var GprsMS ms; |
| 6598 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6599 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6600 | var RlcmacDlBlock dl_block; |
| 6601 | var uint32_t sched_fn; |
| 6602 | var CtrlMessage rx_ctrl; |
| 6603 | var GsmArfcn req_arfcn := 862; |
| 6604 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6605 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6606 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6607 | if (use_old_ctrl_iface) { |
| 6608 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6609 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6610 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6611 | |
| 6612 | /* Initialize NS/BSSGP side */ |
| 6613 | f_init_bssgp(); |
| 6614 | /* Initialize GPRS MS side */ |
| 6615 | f_init_gprs_ms(); |
| 6616 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6617 | |
| 6618 | /* Initialize the PCU interface abstraction */ |
| 6619 | f_init_raw(testcasename(), info_ind); |
| 6620 | |
| 6621 | /* Make sure we are not affected by full cache from previous tests */ |
| 6622 | f_pcuvty_flush_neigh_caches(); |
| 6623 | |
| 6624 | /* Establish BSSGP connection to the PCU */ |
| 6625 | f_bssgp_establish(); |
| 6626 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6627 | |
| 6628 | /* Send PACKET RESOURCE REQUEST */ |
| 6629 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6630 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6631 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6632 | |
| 6633 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6634 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6635 | 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] | 6636 | |
| 6637 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6638 | 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] | 6639 | as_outbound_nacc_rim_resolve(info_ind, do_answer := false); |
| 6640 | /* 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] | 6641 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 6642 | 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] | 6643 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
| 6644 | f_outbound_nacc_rim_tx_resp(info_ind); |
| 6645 | |
| 6646 | /* 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] | 6647 | 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] | 6648 | |
| 6649 | /* And finally everything continues as usual with RIN procedure */ |
| 6650 | as_outbound_nacc_rim_resolve(info_ind); |
| 6651 | |
| 6652 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 6653 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6654 | |
| 6655 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6656 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6657 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6658 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6659 | f_shutdown(__BFILE__, __LINE__); |
| 6660 | } |
| 6661 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6662 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6663 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6664 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6665 | } |
| 6666 | |
| 6667 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6668 | } |
| 6669 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6670 | /* Test MS sending Pkt Cell Change Notify twice (different tgt cell each time) |
| 6671 | * while sending Pkt Neigh Data Change */ |
| 6672 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice3() runs on RAW_PCU_Test_CT { |
| 6673 | var PollFnCtx pollctx; |
| 6674 | var GprsMS ms; |
| 6675 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6676 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6677 | var RlcmacDlBlock dl_block; |
| 6678 | var uint32_t sched_fn; |
| 6679 | var CtrlMessage rx_ctrl; |
| 6680 | var GsmArfcn req_arfcn := 862; |
| 6681 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6682 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6683 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6684 | if (use_old_ctrl_iface) { |
| 6685 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6686 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6687 | } |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6688 | |
| 6689 | /* Initialize NS/BSSGP side */ |
| 6690 | f_init_bssgp(); |
| 6691 | /* Initialize GPRS MS side */ |
| 6692 | f_init_gprs_ms(); |
| 6693 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6694 | |
| 6695 | /* Initialize the PCU interface abstraction */ |
| 6696 | f_init_raw(testcasename(), info_ind); |
| 6697 | |
| 6698 | /* Make sure we are not affected by full cache from previous tests */ |
| 6699 | f_pcuvty_flush_neigh_caches(); |
| 6700 | |
| 6701 | /* Establish BSSGP connection to the PCU */ |
| 6702 | f_bssgp_establish(); |
| 6703 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6704 | |
| 6705 | /* Send PACKET RESOURCE REQUEST */ |
| 6706 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6707 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6708 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6709 | |
| 6710 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6711 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6712 | 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] | 6713 | |
| 6714 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6715 | 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] | 6716 | /* RIM procedure: */ |
| 6717 | as_outbound_nacc_rim_resolve(info_ind); |
| 6718 | |
| 6719 | /* Receive first Pkt Neigh data Change, then trigger a new Pkt Cell Change Notif (different ARFCN+BSIC): */ |
| 6720 | 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] | 6721 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 6722 | 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] | 6723 | |
| 6724 | /* It should trigger RAC_CI resolution to start again: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6725 | 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] | 6726 | /* RIM procedure: */ |
| 6727 | as_outbound_nacc_rim_resolve(info_ind); |
| 6728 | /* Transmit SI back to MS */ |
| 6729 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 6730 | |
| 6731 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6732 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6733 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6734 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6735 | f_shutdown(__BFILE__, __LINE__); |
| 6736 | } |
| 6737 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6738 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6739 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6740 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6741 | } |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 6742 | |
| 6743 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6744 | } |
| 6745 | |
| 6746 | /* Test MS sending Pkt Cell Change Notification twice (different tgt cell) while sending Pkt Cell Change Continue */ |
| 6747 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice4() runs on RAW_PCU_Test_CT { |
| 6748 | var PollFnCtx pollctx; |
| 6749 | var GprsMS ms; |
| 6750 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6751 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6752 | var RlcmacDlBlock dl_block; |
| 6753 | var uint32_t sched_fn; |
| 6754 | var CtrlMessage rx_ctrl; |
| 6755 | var GsmArfcn req_arfcn := 862; |
| 6756 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6757 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6758 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6759 | if (use_old_ctrl_iface) { |
| 6760 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6761 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6762 | } |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6763 | |
| 6764 | /* Initialize NS/BSSGP side */ |
| 6765 | f_init_bssgp(); |
| 6766 | /* Initialize GPRS MS side */ |
| 6767 | f_init_gprs_ms(); |
| 6768 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6769 | |
| 6770 | /* Initialize the PCU interface abstraction */ |
| 6771 | f_init_raw(testcasename(), info_ind); |
| 6772 | |
| 6773 | /* Make sure we are not affected by full cache from previous tests */ |
| 6774 | f_pcuvty_flush_neigh_caches(); |
| 6775 | |
| 6776 | /* Establish BSSGP connection to the PCU */ |
| 6777 | f_bssgp_establish(); |
| 6778 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6779 | |
| 6780 | /* Send PACKET RESOURCE REQUEST */ |
| 6781 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6782 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6783 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6784 | |
| 6785 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6786 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6787 | 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] | 6788 | |
| 6789 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6790 | 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] | 6791 | /* RIM procedure: */ |
| 6792 | as_outbound_nacc_rim_resolve(info_ind); |
| 6793 | |
| 6794 | /* Announce SI back to MS, continue NACC procedure */ |
| 6795 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 6796 | |
| 6797 | /* trigger a Pkt Cell Change Notif with different tgt cell */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6798 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 6799 | 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] | 6800 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6801 | /* It should trigger RAC_CI resolution to start again: */ |
| 6802 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
| 6803 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6804 | /* PCU TBF NACC state changed, so we should next receive a dummy block: */ |
| 6805 | f_rx_rlcmac_dl_block_exp_dummy(dl_block, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 6806 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6807 | /* RIM procedure: */ |
| 6808 | as_outbound_nacc_rim_resolve(info_ind); |
| 6809 | /* Transmit SI back to MS */ |
| 6810 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 6811 | |
| 6812 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6813 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6814 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6815 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6816 | f_shutdown(__BFILE__, __LINE__); |
| 6817 | } |
| 6818 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6819 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6820 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6821 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6822 | } |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 6823 | |
| 6824 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6825 | } |
| 6826 | |
| 6827 | /* Test MS sending Pkt Cell Change Notification twice (different tgt cell) while waiting for Pkt Cell Change Continue CTRL ACK*/ |
| 6828 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice5() runs on RAW_PCU_Test_CT { |
| 6829 | var PollFnCtx pollctx; |
| 6830 | var GprsMS ms; |
| 6831 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6832 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6833 | var RlcmacDlBlock dl_block; |
| 6834 | var uint32_t sched_fn; |
| 6835 | var CtrlMessage rx_ctrl; |
| 6836 | var GsmArfcn req_arfcn := 862; |
| 6837 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6838 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6839 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6840 | if (use_old_ctrl_iface) { |
| 6841 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6842 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6843 | } |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6844 | |
| 6845 | /* Initialize NS/BSSGP side */ |
| 6846 | f_init_bssgp(); |
| 6847 | /* Initialize GPRS MS side */ |
| 6848 | f_init_gprs_ms(); |
| 6849 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6850 | |
| 6851 | /* Initialize the PCU interface abstraction */ |
| 6852 | f_init_raw(testcasename(), info_ind); |
| 6853 | |
| 6854 | /* Make sure we are not affected by full cache from previous tests */ |
| 6855 | f_pcuvty_flush_neigh_caches(); |
| 6856 | |
| 6857 | /* Establish BSSGP connection to the PCU */ |
| 6858 | f_bssgp_establish(); |
| 6859 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6860 | |
| 6861 | /* Send PACKET RESOURCE REQUEST */ |
| 6862 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6863 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6864 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6865 | |
| 6866 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6867 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6868 | 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] | 6869 | |
| 6870 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6871 | 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] | 6872 | /* RIM procedure: */ |
| 6873 | as_outbound_nacc_rim_resolve(info_ind); |
| 6874 | |
| 6875 | /* Announce SI back to MS, continue NACC procedure */ |
| 6876 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 6877 | |
| 6878 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6879 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6880 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6881 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6882 | f_shutdown(__BFILE__, __LINE__); |
| 6883 | } |
| 6884 | |
| 6885 | /* trigger a Pkt Cell Change Notif with different tgt cell */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6886 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 6887 | 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] | 6888 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6889 | /* It should trigger RAC_CI resolution to start again: */ |
| 6890 | /* When using new PCUIF interface for resolution, we must |
| 6891 | * PCUIF.receive() here since that's the first message in the PCUIF |
| 6892 | * queue that PCU will have sent. Calling other functions doing |
| 6893 | * PCUIF.receive() (like f_ms_tx_ul_block() below) will make them fail |
| 6894 | * due to unexpected message receive. */ |
| 6895 | if (not use_old_ctrl_iface) { |
| 6896 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
| 6897 | } |
| 6898 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6899 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6900 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6901 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6902 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6903 | } |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6904 | |
| 6905 | /* When using CTRL interface, we must schedule the ACK before (see |
| 6906 | * above) blocking here waiting for the resoltion, otherwise we'll be |
| 6907 | * too late scheduling by the time the resolution is done. */ |
| 6908 | if (use_old_ctrl_iface) { |
| 6909 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
| 6910 | } |
| 6911 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6912 | /* PCU TBF NACC state changed, so we should next receive a dummy block: */ |
| 6913 | f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 6914 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6915 | /* RIM procedure: */ |
| 6916 | as_outbound_nacc_rim_resolve(info_ind); |
| 6917 | /* Transmit SI back to MS */ |
| 6918 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 6919 | |
| 6920 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6921 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 6922 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 6923 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 6924 | f_shutdown(__BFILE__, __LINE__); |
| 6925 | } |
| 6926 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6927 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 6928 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 6929 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6930 | } |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 6931 | |
| 6932 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6933 | } |
| 6934 | |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 6935 | /* Test MS sending Pkt Cell Change Notification on an MS with an existing but unassigned (no TFI) DL TBF */ |
| 6936 | testcase TC_nacc_outbound_pkt_cell_chg_notif_unassigned_dl_tbf() runs on RAW_PCU_Test_CT { |
| 6937 | var PollFnCtx pollctx; |
| 6938 | var GprsMS ms; |
| 6939 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6940 | var template (value) RlcmacUlCtrlMsg cell_chg_notif; |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 6941 | var RlcmacDlBlock dl_block; |
| 6942 | var uint32_t sched_fn, dl_fn; |
| 6943 | var CtrlMessage rx_ctrl; |
| 6944 | var GsmArfcn req_arfcn := 862; |
| 6945 | var uint6_t req_bsic := 43; |
| 6946 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6947 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 6948 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6949 | if (use_old_ctrl_iface) { |
| 6950 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 6951 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 6952 | } |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 6953 | |
| 6954 | /* Initialize NS/BSSGP side */ |
| 6955 | f_init_bssgp(); |
| 6956 | /* Initialize GPRS MS side */ |
| 6957 | f_init_gprs_ms(); |
| 6958 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 6959 | |
| 6960 | /* Initialize the PCU interface abstraction */ |
| 6961 | f_init_raw(testcasename(), info_ind); |
| 6962 | |
| 6963 | /* Make sure we are not affected by full cache from previous tests */ |
| 6964 | f_pcuvty_flush_neigh_caches(); |
| 6965 | |
| 6966 | /* Establish BSSGP connection to the PCU */ |
| 6967 | f_bssgp_establish(); |
| 6968 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6969 | |
| 6970 | /* Send PACKET RESOURCE REQUEST */ |
| 6971 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 6972 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 6973 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 6974 | |
| 6975 | /* Start NACC from MS side */ |
Philipp Maier | 7d187ae | 2023-06-20 14:38:24 +0200 | [diff] [blame] | 6976 | cell_chg_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 6977 | 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] | 6978 | |
| 6979 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6980 | 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] | 6981 | /* RIM procedure: */ |
| 6982 | as_outbound_nacc_rim_resolve(info_ind); |
| 6983 | |
| 6984 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 6985 | /* Make sure we leave some time for SGSN->PCU data to arrive to PCU */ |
| 6986 | f_sleep(0.1); |
| 6987 | /* rx DL assignment, don't ack it yet (keep TBF in state ASSIGN): */ |
| 6988 | f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 6989 | |
| 6990 | /* NACC: scheduler selects tx Pkt Cell Neighbor Data. Receive first one: */ |
| 6991 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, single_step := true); |
| 6992 | /* ACK DL assignment (we do it here on purpose to test tx Pkt Neigh Cell |
| 6993 | * Data with unassigned DL TBF in line above): */ |
| 6994 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 6995 | /* Continue receiving Pkt Cell Neighbor Data */ |
| 6996 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, f_ms_tx_TsTrxBtsNum(ms), 1, 16); |
| 6997 | |
| 6998 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 6999 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 7000 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 7001 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 7002 | f_shutdown(__BFILE__, __LINE__); |
| 7003 | } |
| 7004 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 7005 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 7006 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 7007 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 7008 | } |
| 7009 | |
| 7010 | /* Now that we confirmed the new assignment in the dl-tbf, lets receive the data and ack it */ |
| 7011 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 7012 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 7013 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 7014 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Pau Espin Pedrol | 002658a | 2023-04-12 18:13:56 +0200 | [diff] [blame] | 7015 | |
| 7016 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 7017 | } |
| 7018 | |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 7019 | |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 7020 | function f_do_inbound_nacc(template (value) RIM_Routing_Information tx_src_addr, template RIM_Routing_Information rx_dst_addr) |
| 7021 | runs on RAW_PCU_Test_CT |
| 7022 | { |
| 7023 | var template (value) RAN_Information_Request_RIM_Container req_cont; |
| 7024 | var template (value) PDU_BSSGP bssgp_rim_pdu; |
| 7025 | var template PDU_BSSGP bssgp_rim_pdu_expect; |
| 7026 | var template RAN_Information_RIM_Container rim_cont_expect; |
| 7027 | var RIM_Routing_Address bts_addr; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 7028 | |
| 7029 | /* Send sysinfo to the PCU */ |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 7030 | 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] | 7031 | BTS.send(si1_data_ind); |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 7032 | 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] | 7033 | BTS.send(si3_data_ind); |
Pau Espin Pedrol | 02a6d0c | 2021-04-19 17:11:07 +0200 | [diff] [blame] | 7034 | 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); |
| 7035 | BTS.send(si13_data_ind); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 7036 | f_sleep(1.0); |
| 7037 | |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 7038 | 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] | 7039 | |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 7040 | req_cont := ts_RAN_Information_Request_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 7041 | ts_RIM_Sequence_Number(1), |
| 7042 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 7043 | ts_RIM_Protocol_Version_Number(1), |
| 7044 | tsu_RAN_Information_Request_Application_Container_NACC(mp_gb_cfg.bvc[0].cell_id), |
| 7045 | omit); |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 7046 | bssgp_rim_pdu := ts_RAN_INFORMATION_REQUEST(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, bts_addr), |
| 7047 | tx_src_addr, req_cont); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 7048 | |
| 7049 | rim_cont_expect := tr_RAN_Information_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 7050 | tr_RIM_Sequence_Number(1), |
| 7051 | tr_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 7052 | tr_RIM_Protocol_Version_Number(1), |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 7053 | 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] | 7054 | omit); |
| 7055 | |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 7056 | bssgp_rim_pdu_expect := tr_PDU_BSSGP_RAN_INFORMATION(rx_dst_addr, |
| 7057 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, bts_addr), |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 7058 | rim_cont_expect); |
| 7059 | RIM.send(bssgp_rim_pdu); |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 7060 | timer T := 2.0; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 7061 | T.start; |
| 7062 | alt { |
| 7063 | [] RIM.receive(bssgp_rim_pdu_expect) { } |
| 7064 | [] RIM.receive { |
| 7065 | setverdict(fail, "Unexpected BSSGP RIM PDU received"); |
| 7066 | } |
| 7067 | [] T.timeout { |
| 7068 | setverdict(fail, "No BSSGP RIM PDU received"); |
| 7069 | mtc.stop; |
| 7070 | } |
| 7071 | } |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 7072 | } |
| 7073 | /* Send a RIM RAN info request to the PCU and verify the response, we expect |
| 7074 | * getting the system information back which we have transfered to the PCU via |
| 7075 | * PCUIF on startup. */ |
| 7076 | testcase TC_rim_ran_info_req_single_rep() runs on RAW_PCU_Test_CT { |
| 7077 | /* Initialize NS/BSSGP side */ |
| 7078 | f_init_bssgp(); |
| 7079 | |
| 7080 | /* Initialize the PCU interface abstraction */ |
| 7081 | f_init_raw(testcasename()); |
| 7082 | |
| 7083 | /* Establish BSSGP connection to the PCU */ |
| 7084 | f_bssgp_establish(); |
| 7085 | |
| 7086 | var BssgpCellId src_cid := {ra_id := { lai := { mcc_mnc := '262F42'H, lac := 12345}, rac := 0 }, cell_id := 20962 }; |
| 7087 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src_cid)); |
| 7088 | |
| 7089 | f_do_inbound_nacc(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 7090 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr)); |
| 7091 | |
| 7092 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 7093 | } |
| 7094 | |
| 7095 | /* Same as TC_rim_ran_info_req_single_rep, but using an EUTRAN eNodeB ID as |
| 7096 | * Routing information, to verify PCU handles that kind of address just fine |
| 7097 | */ |
| 7098 | testcase TC_rim_ran_info_req_single_rep_eutran() runs on RAW_PCU_Test_CT { |
| 7099 | /* Initialize NS/BSSGP side */ |
| 7100 | f_init_bssgp(); |
| 7101 | |
| 7102 | /* Initialize the PCU interface abstraction */ |
| 7103 | f_init_raw(testcasename()); |
| 7104 | |
| 7105 | /* Establish BSSGP connection to the PCU */ |
| 7106 | f_bssgp_establish(); |
| 7107 | |
| 7108 | var BssgpCellId src_cid := {ra_id := { lai := { mcc_mnc := '262F42'H, lac := 12345}, rac := 0 }, cell_id := 20962 }; |
| 7109 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_enbid(src_cid, tac := 3, gnbid := '12345678123456'O)); |
| 7110 | |
| 7111 | f_do_inbound_nacc(ts_RIM_Routing_Information(RIM_ADDR_EUTRAN_NODEB_ID, src_addr), |
| 7112 | tr_RIM_Routing_Information(RIM_ADDR_EUTRAN_NODEB_ID, src_addr)); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 7113 | |
| 7114 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 7115 | } |
| 7116 | |
| 7117 | /* Same as above, but in this case we simulate the rare case in which the PCU |
| 7118 | * has no system information available. We expect getting a response back but |
| 7119 | * with no system information inside. */ |
| 7120 | 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] | 7121 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 7122 | var PCUIF_Message pcu_msg; |
| 7123 | timer T := 2.0; |
| 7124 | |
| 7125 | /* Initialize NS/BSSGP side */ |
| 7126 | f_init_bssgp(); |
| 7127 | |
| 7128 | /* Initialize the PCU interface abstraction */ |
| 7129 | f_init_raw(testcasename(), info_ind); |
| 7130 | |
| 7131 | /* Establish BSSGP connection to the PCU */ |
| 7132 | f_bssgp_establish(); |
| 7133 | |
| 7134 | /* Clear sysinfo from the PCU */ |
| 7135 | 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); |
| 7136 | BTS.send(si1_data_ind); |
| 7137 | 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); |
| 7138 | BTS.send(si3_data_ind); |
| 7139 | 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); |
| 7140 | BTS.send(si16_data_ind); |
| 7141 | f_sleep(1.0); |
| 7142 | |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 7143 | var RIM_Routing_Address dst_addr; |
| 7144 | var RIM_Routing_Address src_addr; |
| 7145 | var template (value) RAN_Information_Request_RIM_Container req_cont; |
| 7146 | var template (value) PDU_BSSGP bssgp_rim_pdu; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 7147 | var template PDU_BSSGP bssgp_rim_pdu_expect; |
| 7148 | var template RAN_Information_RIM_Container rim_cont_expect; |
| 7149 | |
| 7150 | 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] | 7151 | src_addr := valueof(t_RIM_Routing_Address_cid(src_cid)); |
| 7152 | 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] | 7153 | |
| 7154 | req_cont := ts_RAN_Information_Request_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 7155 | ts_RIM_Sequence_Number(1), |
| 7156 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 7157 | ts_RIM_Protocol_Version_Number(1), |
| 7158 | tsu_RAN_Information_Request_Application_Container_NACC(mp_gb_cfg.bvc[0].cell_id), |
| 7159 | omit); |
| 7160 | bssgp_rim_pdu := ts_RAN_INFORMATION_REQUEST(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 7161 | ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 7162 | req_cont); |
| 7163 | |
| 7164 | |
| 7165 | rim_cont_expect := tr_RAN_Information_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 7166 | tr_RIM_Sequence_Number(1), |
| 7167 | tr_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 7168 | tr_RIM_Protocol_Version_Number(1), |
| 7169 | tru_ApplContainer_or_ApplErrContainer_NACC(tru_ApplContainer_NACC(mp_gb_cfg.bvc[0].cell_id, false, 0, ''O)), |
| 7170 | omit); |
| 7171 | |
| 7172 | bssgp_rim_pdu_expect := tr_PDU_BSSGP_RAN_INFORMATION(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 7173 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 7174 | rim_cont_expect); |
| 7175 | RIM.send(bssgp_rim_pdu); |
| 7176 | T.start; |
| 7177 | alt { |
| 7178 | [] RIM.receive(bssgp_rim_pdu_expect) { } |
| 7179 | [] RIM.receive { |
| 7180 | setverdict(fail, "Unexpected BSSGP RIM PDU received"); |
| 7181 | } |
| 7182 | [] T.timeout { |
| 7183 | setverdict(fail, "No BSSGP RIM PDU received"); |
| 7184 | mtc.stop; |
| 7185 | } |
| 7186 | } |
| 7187 | |
| 7188 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 7189 | } |
| 7190 | |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 7191 | /* 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] | 7192 | testcase TC_pdch_energy_saving() runs on RAW_PCU_Test_CT { |
| 7193 | var PCUIF_info_ind info_ind; |
| 7194 | var template (value) TsTrxBtsNum nr; |
| 7195 | var RlcmacDlBlock dl_block; |
| 7196 | var BTS_PDTCH_Block data_msg; |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 7197 | var integer ts; |
Pau Espin Pedrol | 3aa61c6 | 2021-08-25 19:24:03 +0200 | [diff] [blame] | 7198 | timer T; |
| 7199 | |
| 7200 | /* Initialize NS/BSSGP side */ |
| 7201 | f_init_bssgp(); |
| 7202 | |
| 7203 | info_ind := valueof(ts_PCUIF_INFO_default); |
| 7204 | /* The 2 first TRX are enabled. */ |
| 7205 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (2 .. 7)); |
| 7206 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
| 7207 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 1); |
| 7208 | |
| 7209 | /* Initialize the PCU interface abstraction */ |
| 7210 | f_init_raw(testcasename(), info_ind); |
| 7211 | |
| 7212 | /* Establish BSSGP connection to the PCU */ |
| 7213 | f_bssgp_establish(); |
| 7214 | |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 7215 | for (ts := 0; ts < 2; ts := ts + 1) { |
| 7216 | 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] | 7217 | |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame] | 7218 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 7219 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 7220 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), block_nr := nr.blk_nr)); |
| 7221 | T.start(0.5); |
| 7222 | alt { |
| 7223 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 7224 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 7225 | omit)) -> value data_msg { |
| 7226 | setverdict(pass); |
| 7227 | T.stop; |
| 7228 | } |
| 7229 | [] as_rx_fail_dummy(nr); |
| 7230 | [] BTS.receive { |
| 7231 | setverdict(fail, "Unexpected block from BTS"); |
| 7232 | f_shutdown(__BFILE__, __LINE__); |
| 7233 | } |
| 7234 | [] T.timeout { |
| 7235 | setverdict(fail, "Expected IDLE block from BTS"); |
| 7236 | f_shutdown(__BFILE__, __LINE__); |
| 7237 | } |
| 7238 | } |
Pau Espin Pedrol | 3aa61c6 | 2021-08-25 19:24:03 +0200 | [diff] [blame] | 7239 | } |
| 7240 | |
| 7241 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 7242 | } |
| 7243 | |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 7244 | /* Test stats for available and occupied PDCHs */ |
| 7245 | testcase TC_stat_pdch_avail_occ() runs on RAW_PCU_Test_CT { |
| 7246 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 7247 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 7248 | |
| 7249 | /* Initialize NS/BSSGP side */ |
| 7250 | f_init_bssgp(); |
| 7251 | |
Oliver Smith | edcded2 | 2021-09-14 09:26:55 +0200 | [diff] [blame] | 7252 | /* Only the 4 first TRX are enabled, each with 2 PDCHs. */ |
| 7253 | f_PCUIF_PDCHMask_set(info_ind, '00000011'B, 0); |
| 7254 | f_PCUIF_PDCHMask_set(info_ind, '00001100'B, 1); |
| 7255 | f_PCUIF_PDCHMask_set(info_ind, '11000000'B, 2); |
| 7256 | f_PCUIF_PDCHMask_set(info_ind, '00110000'B, 3); |
| 7257 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (4 .. 7)); |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 7258 | |
Oliver Smith | 72d0c69 | 2021-09-08 10:03:52 +0200 | [diff] [blame] | 7259 | /* Allocate 4 GprsMS instances */ |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 7260 | f_init_gprs_ms(4); |
| 7261 | |
| 7262 | /* Initialize the PCU interface abstraction */ |
| 7263 | f_init_raw(testcasename(), info_ind); |
| 7264 | |
| 7265 | /* Reset stats */ |
| 7266 | f_statsd_reset(); |
| 7267 | |
| 7268 | /* Establish BSSGP */ |
| 7269 | f_bssgp_establish(); |
| 7270 | |
| 7271 | /* 8 PDCHs available, 0 occupied */ |
| 7272 | var StatsDExpects expect := { |
| 7273 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
Oliver Smith | 4b2a89f | 2021-09-08 11:24:39 +0200 | [diff] [blame] | 7274 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 0, max := 0 }, |
| 7275 | { name := "TTCN3.bts.0.pdch.occupied.gprs", mtype := "g", min := 0, max := 0 }, |
| 7276 | { 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] | 7277 | }; |
| 7278 | f_statsd_expect(expect); |
| 7279 | |
Oliver Smith | 4b2a89f | 2021-09-08 11:24:39 +0200 | [diff] [blame] | 7280 | /* Establish an Uplink TBF for each GprsMS instance (3x GPRS, 1x EGPRS) */ |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 7281 | f_multi_ms_bssgp_register(); |
Oliver Smith | 4b2a89f | 2021-09-08 11:24:39 +0200 | [diff] [blame] | 7282 | f_ms_establish_ul_tbf(g_ms[0]); |
| 7283 | f_ms_establish_ul_tbf(g_ms[1]); |
| 7284 | f_ms_establish_ul_tbf(g_ms[2]); |
| 7285 | 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] | 7286 | |
| 7287 | /* 4 PDCHs occupied */ |
| 7288 | expect := { |
| 7289 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
Oliver Smith | 4b2a89f | 2021-09-08 11:24:39 +0200 | [diff] [blame] | 7290 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 4, max := 4 }, |
| 7291 | { name := "TTCN3.bts.0.pdch.occupied.gprs", mtype := "g", min := 3, max := 3 }, |
| 7292 | { 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] | 7293 | }; |
| 7294 | f_statsd_expect(expect); |
| 7295 | |
| 7296 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 7297 | } |
| 7298 | |
Oliver Smith | f04762d | 2021-09-14 17:20:38 +0200 | [diff] [blame] | 7299 | /* Test stats for available and occupied PDCHs, for MS which is not known by |
| 7300 | * the PCU (e.g. because it was forgotten due to no interaction, and old DL |
| 7301 | * data arrives from SGSN) */ |
| 7302 | function f_tc_stat_pdch_avail_occ_ms_not_known(boolean egprs) runs on RAW_PCU_Test_CT { |
| 7303 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 7304 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 7305 | |
| 7306 | /* Ensure a deterministic slot allocation of 1 PDCH with MS class 1 */ |
| 7307 | const MultislotCap_GPRS_BSSGP bssgp_mscap_gprs := { |
| 7308 | gprsmultislotclass := '00001'B, |
| 7309 | gprsextendeddynalloccap := '0'B |
| 7310 | }; |
| 7311 | const MultislotCap_EGPRS_BSSGP bssgp_mscap_egprs := { |
| 7312 | egprsmultislotclass := '00001'B, |
| 7313 | egprsextendeddynalloccap := '0'B |
| 7314 | }; |
| 7315 | template (value) MSRadioAccessCapabilityV_BSSGP bssgp_ms_racap_gprs := { |
| 7316 | valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, bssgp_mscap_gprs, omit)) }; |
| 7317 | template (value) MSRadioAccessCapabilityV_BSSGP bssgp_ms_racap_egprs := { |
| 7318 | valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, bssgp_mscap_gprs, bssgp_mscap_egprs)) }; |
| 7319 | |
| 7320 | /* Initialize NS/BSSGP side */ |
| 7321 | f_init_bssgp(); |
| 7322 | |
| 7323 | /* Only the 4 first TRX are enabled, each with 2 PDCHs. */ |
| 7324 | f_PCUIF_PDCHMask_set(info_ind, '00000011'B, 0); |
| 7325 | f_PCUIF_PDCHMask_set(info_ind, '00001100'B, 1); |
| 7326 | f_PCUIF_PDCHMask_set(info_ind, '11000000'B, 2); |
| 7327 | f_PCUIF_PDCHMask_set(info_ind, '00110000'B, 3); |
| 7328 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (4 .. 7)); |
| 7329 | |
| 7330 | /* Allocate 1 GprsMS instance */ |
| 7331 | f_init_gprs_ms(1); |
| 7332 | |
| 7333 | /* Initialize the PCU interface abstraction */ |
| 7334 | f_init_raw(testcasename(), info_ind); |
| 7335 | |
| 7336 | /* Reset stats */ |
| 7337 | f_statsd_reset(); |
| 7338 | |
| 7339 | /* Establish BSSGP */ |
| 7340 | f_bssgp_establish(); |
| 7341 | |
| 7342 | /* 8 PDCHs available, 0 occupied */ |
| 7343 | var StatsDExpects expect := { |
| 7344 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
| 7345 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 0, max := 0 }, |
| 7346 | { name := "TTCN3.bts.0.pdch.occupied.gprs", mtype := "g", min := 0, max := 0 }, |
| 7347 | { name := "TTCN3.bts.0.pdch.occupied.egprs", mtype := "g", min := 0, max := 0 } |
| 7348 | }; |
| 7349 | f_statsd_expect(expect); |
| 7350 | |
| 7351 | var GprsMS ms := g_ms[0]; /* We only use first MS in this test */ |
| 7352 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 7353 | |
| 7354 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 7355 | var octetstring data := f_rnd_octstring(1400); |
| 7356 | if (egprs) { |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 7357 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, bssgp_ms_racap_egprs, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Oliver Smith | f04762d | 2021-09-14 17:20:38 +0200 | [diff] [blame] | 7358 | } else { |
Philipp Maier | 1ec31b3 | 2023-09-22 12:59:10 +0200 | [diff] [blame^] | 7359 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, bssgp_ms_racap_gprs, imsi := ts_BSSGP_IMSI(ms.imsi))); |
Oliver Smith | f04762d | 2021-09-14 17:20:38 +0200 | [diff] [blame] | 7360 | } |
Philipp Maier | 8e1a5ee | 2023-07-18 15:47:16 +0200 | [diff] [blame] | 7361 | f_ms_exp_dl_tbf_ass_ccch(ms); |
Oliver Smith | f04762d | 2021-09-14 17:20:38 +0200 | [diff] [blame] | 7362 | |
| 7363 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 7364 | f_sleep(X2002); |
| 7365 | |
| 7366 | /* 1 PDCH occupied */ |
| 7367 | if (egprs) { |
| 7368 | expect := { |
| 7369 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
| 7370 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 1, max := 1 }, |
| 7371 | { name := "TTCN3.bts.0.pdch.occupied.gprs", mtype := "g", min := 0, max := 0 }, |
| 7372 | { name := "TTCN3.bts.0.pdch.occupied.egprs", mtype := "g", min := 1, max := 1 } |
| 7373 | }; |
| 7374 | } else { |
| 7375 | expect := { |
| 7376 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
| 7377 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 1, max := 1 }, |
| 7378 | { name := "TTCN3.bts.0.pdch.occupied.gprs", mtype := "g", min := 1, max := 1 }, |
| 7379 | { name := "TTCN3.bts.0.pdch.occupied.egprs", mtype := "g", min := 0, max := 0 } |
| 7380 | }; |
| 7381 | } |
| 7382 | f_statsd_expect(expect); |
| 7383 | |
| 7384 | /* Clean up */ |
| 7385 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 7386 | } |
| 7387 | testcase TC_stat_pdch_avail_occ_ms_not_known_gprs() runs on RAW_PCU_Test_CT { |
| 7388 | f_tc_stat_pdch_avail_occ_ms_not_known(false); |
| 7389 | } |
| 7390 | testcase TC_stat_pdch_avail_occ_ms_not_known_egprs() runs on RAW_PCU_Test_CT { |
| 7391 | f_tc_stat_pdch_avail_occ_ms_not_known(true); |
| 7392 | } |
| 7393 | |
Pau Espin Pedrol | 6eb4d25 | 2021-11-15 11:53:40 +0100 | [diff] [blame] | 7394 | /* Make sure that bts.0.pdch.all_allocated is set when we allocate all resources */ |
| 7395 | testcase TC_ratectr_all_available_allocated() runs on RAW_PCU_Test_CT { |
| 7396 | var PCUIF_info_ind info_ind; |
| 7397 | var template IARRestOctets rest; |
| 7398 | var BIT11 ra11; |
| 7399 | |
| 7400 | info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 6eb4d25 | 2021-11-15 11:53:40 +0100 | [diff] [blame] | 7401 | |
| 7402 | /* Only the first TRX is enabled. */ |
| 7403 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 7404 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
| 7405 | |
| 7406 | /* Initialize the PCU interface abstraction */ |
| 7407 | f_init_raw(testcasename(), info_ind); |
| 7408 | f_statsd_reset(); |
| 7409 | |
| 7410 | var EGPRSPktChRequest req := { |
| 7411 | one_phase := { |
| 7412 | tag := '0'B, |
| 7413 | multislot_class := '10101'B, |
| 7414 | priority := '01'B, |
| 7415 | random_bits := '101'B |
| 7416 | } |
| 7417 | }; |
| 7418 | |
| 7419 | /* We send 7 requests, the IUT gives us all available USFs (0..6) */ |
| 7420 | for (var integer i := 0; i < 7; i := i + 1) { |
| 7421 | req.one_phase.random_bits := int2bit(f_rnd_int(8), 3); |
| 7422 | f_TC_egprs_pkt_chan_req(req, tr_IMM_TBF_ASS); |
| 7423 | } |
| 7424 | |
| 7425 | ra11 := enc_EGPRSPktChRequest2bits(req); |
| 7426 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(substr(ra11, 6, 5)), * }); |
| 7427 | |
| 7428 | /* At this point, the IUT should run out of free USFs */ |
Pau Espin Pedrol | 209dc7d | 2021-11-15 16:25:08 +0100 | [diff] [blame] | 7429 | f_TC_egprs_pkt_chan_req_reject(ra11, 1870, rest); |
Pau Espin Pedrol | 6eb4d25 | 2021-11-15 11:53:40 +0100 | [diff] [blame] | 7430 | |
| 7431 | /* bts.0.pdch.all_allocated is updated once per second, wait some time to make sure it was updated. */ |
| 7432 | f_sleep(2.0); |
| 7433 | var StatsDExpects expect := { |
| 7434 | { name := "TTCN3.bts.0.pdch.all_allocated", mtype := "c", min := 1, max := 1 } |
| 7435 | }; |
| 7436 | f_statsd_expect(expect); |
| 7437 | |
| 7438 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 7439 | } |
| 7440 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7441 | control { |
| 7442 | execute( TC_pcuif_suspend() ); |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 7443 | execute( TC_pcuif_suspend_active_tbf() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7444 | execute( TC_ta_ptcch_idle() ); |
| 7445 | execute( TC_ta_rach_imm_ass() ); |
Vadim Yanitskiy | 866f870 | 2021-05-26 14:50:27 +0200 | [diff] [blame] | 7446 | execute( TC_ta_ul_ack_nack_first_block() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7447 | execute( TC_ta_idle_dl_tbf_ass() ); |
| 7448 | execute( TC_ta_ptcch_ul_multi_tbf() ); |
| 7449 | execute( TC_cs_lqual_ul_tbf() ); |
| 7450 | execute( TC_cs_initial_ul() ); |
| 7451 | execute( TC_cs_max_ul() ); |
Pau Espin Pedrol | 7512259 | 2020-11-03 15:22:59 +0100 | [diff] [blame] | 7452 | execute( TC_cs_initial_dl() ); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 7453 | execute( TC_cs_max_dl() ); |
| 7454 | execute( TC_dl_cs1_to_cs4() ); |
Pau Espin Pedrol | 2354d6a | 2020-11-05 18:36:59 +0100 | [diff] [blame] | 7455 | execute( TC_mcs_initial_ul() ); |
Pau Espin Pedrol | db15fa7 | 2020-11-11 12:58:34 +0100 | [diff] [blame] | 7456 | execute( TC_mcs_max_ul() ); |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 7457 | execute( TC_mcs_initial_dl() ); |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 7458 | execute( TC_mcs_max_dl() ); |
Pau Espin Pedrol | 1451f9f | 2021-05-11 11:52:37 +0200 | [diff] [blame] | 7459 | execute( TC_t3141() ); |
Pau Espin Pedrol | f30fa1d | 2021-03-03 19:55:11 +0100 | [diff] [blame] | 7460 | execute( TC_n3101_max_t3169() ); |
Pau Espin Pedrol | cc895df | 2021-04-20 12:58:32 +0200 | [diff] [blame] | 7461 | execute( TC_n3103_max_t3169() ); |
Pau Espin Pedrol | 84a8c3c | 2021-03-01 17:22:29 +0100 | [diff] [blame] | 7462 | execute( TC_x2031_t3191() ); |
| 7463 | execute( TC_zero_x2031_t3191() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7464 | execute( TC_t3193() ); |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 7465 | execute( TC_n3105_max_t3195() ); |
Pau Espin Pedrol | e8a9444 | 2021-11-15 17:05:46 +0100 | [diff] [blame] | 7466 | execute( TC_t3172_wait_ind_size0() ); |
| 7467 | execute( TC_t3172_wait_ind_size1() ); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 7468 | execute( TC_countdown_procedure() ); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 7469 | execute( TC_ul_all_sizes() ); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 7470 | execute( TC_ul_data_toolong_fills_padding() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7471 | execute( TC_mo_ping_pong() ); |
| 7472 | execute( TC_mo_ping_pong_with_ul_racap() ); |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 7473 | execute( TC_force_two_phase_access() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7474 | execute( TC_mt_ping_pong() ); |
| 7475 | execute( TC_mt_ping_pong_with_dl_racap() ); |
Pau Espin Pedrol | e1195bb | 2020-07-07 13:27:18 +0200 | [diff] [blame] | 7476 | execute( TC_ul_intermediate_retrans() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7477 | execute( TC_imm_ass_dl_block_retrans() ); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 7478 | execute( TC_dl_flow_more_blocks() ); |
Pau Espin Pedrol | e1195bb | 2020-07-07 13:27:18 +0200 | [diff] [blame] | 7479 | execute( TC_ul_flow_multiple_llc_blocks() ); |
Pau Espin Pedrol | 90fdfed | 2021-03-02 17:29:32 +0100 | [diff] [blame] | 7480 | execute( TC_dl_no_ack_retrans_imm_ass() ); |
Pau Espin Pedrol | 6844c16 | 2022-04-01 15:40:06 +0200 | [diff] [blame] | 7481 | execute( TC_dl_llc_sapi_priority() ); |
Pau Espin Pedrol | e8e3b96 | 2023-07-24 16:43:26 +0200 | [diff] [blame] | 7482 | execute( TC_ul_tbf_bsn_wraparound_gprs()); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7483 | execute( TC_paging_cs_from_bts() ); |
| 7484 | execute( TC_paging_cs_from_sgsn_sign_ptmsi() ); |
| 7485 | execute( TC_paging_cs_from_sgsn_sign() ); |
| 7486 | execute( TC_paging_cs_from_sgsn_ptp() ); |
| 7487 | execute( TC_paging_ps_from_sgsn_sign_ptmsi() ); |
| 7488 | execute( TC_paging_ps_from_sgsn_sign() ); |
| 7489 | execute( TC_paging_ps_from_sgsn_ptp() ); |
Pau Espin Pedrol | 1538c3b | 2021-11-16 19:19:07 +0100 | [diff] [blame] | 7490 | execute( TC_paging_pch_timeout() ); |
| 7491 | |
Vadim Yanitskiy | dbd4b24 | 2020-10-31 05:44:58 +0700 | [diff] [blame] | 7492 | execute( TC_paging_cs_multi_ms_imsi_tmsi() ); |
| 7493 | execute( TC_paging_cs_multi_ms_imsi() ); |
| 7494 | execute( TC_paging_cs_multi_ms_tmsi() ); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 7495 | execute( TC_bssgp_dl_unitdata_with_valid_imsi() ); |
| 7496 | execute( TC_bssgp_dl_unitdata_with_invalid_imsi() ); |
Pau Espin Pedrol | 2e459d6 | 2020-11-30 19:34:16 +0100 | [diff] [blame] | 7497 | execute( TC_dl_gprs_data_no_llc_ui_dummy() ); |
| 7498 | execute( TC_dl_egprs_data_no_llc_ui_dummy() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7499 | |
Pau Espin Pedrol | 0b6b0d0 | 2022-10-25 21:21:02 +0200 | [diff] [blame] | 7500 | execute( TC_ul_tbf_finished_pkt_dl_ass_pch() ); |
Pau Espin Pedrol | 99e00b4 | 2022-10-28 13:28:52 +0200 | [diff] [blame] | 7501 | execute( TC_ul_tbf_1phase_while_dl_ass_pch() ); |
| 7502 | execute( TC_ul_tbf_2phase_while_dl_ass_pch() ); |
Pau Espin Pedrol | 0b6b0d0 | 2022-10-25 21:21:02 +0200 | [diff] [blame] | 7503 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7504 | /* EGPRS specific test cases */ |
| 7505 | execute( TC_egprs_pkt_chan_req_signalling() ); |
| 7506 | execute( TC_egprs_pkt_chan_req_one_phase() ); |
| 7507 | execute( TC_egprs_pkt_chan_req_two_phase() ); |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 7508 | execute( TC_egprs_pkt_chan_req_reject_content() ); |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 7509 | execute( TC_egprs_pkt_chan_req_reject_emergency() ); |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 7510 | execute( TC_egprs_pkt_chan_req_reject_exhaustion() ); |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 7511 | |
| 7512 | execute( TC_mo_ping_pong_with_ul_racap_egprs_only() ); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 7513 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 7514 | /* Immediate Assignment on AGCH/PCH */ |
| 7515 | execute( TC_pcuif_fh_imm_ass_ul_egprs() ); |
| 7516 | execute( TC_pcuif_fh_imm_ass_ul() ); |
| 7517 | execute( TC_pcuif_fh_imm_ass_dl() ); |
| 7518 | /* Packet Uplink/Downlink Assignment on PACCH */ |
| 7519 | execute( TC_pcuif_fh_pkt_ass_ul() ); |
| 7520 | execute( TC_pcuif_fh_pkt_ass_dl() ); |
| 7521 | execute( TC_multitrx_multims_alloc() ); |
| 7522 | execute( TC_dl_multislot_tbf_ms_class_from_sgsn() ); |
Pau Espin Pedrol | 85ad3d0 | 2023-07-28 15:00:19 +0200 | [diff] [blame] | 7523 | execute( TC_dl_multislot_tbf_ms_class_unknown() ); |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 7524 | execute( TC_dl_multislot_tbf_ms_class_from_2phase() ); |
| 7525 | execute( TC_ul_multislot_tbf_ms_class_from_2phase() ); |
Pau Espin Pedrol | 3760457 | 2021-10-15 14:36:16 +0200 | [diff] [blame] | 7526 | execute( TC_ul_tbf_reestablish_with_pkt_resource_req() ); |
Pau Espin Pedrol | 9584ef2 | 2023-06-12 14:21:28 +0200 | [diff] [blame] | 7527 | execute( TC_ul_tbf_reestablish_with_pkt_resource_req_t3168() ); |
Pau Espin Pedrol | 59aa109 | 2021-11-15 18:53:34 +0100 | [diff] [blame] | 7528 | execute( TC_ul_tbf_reestablish_with_pkt_dl_ack_nack() ); |
| 7529 | execute( TC_ul_tbf_reestablish_with_pkt_dl_ack_nack_egprs() ); |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 7530 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 7531 | execute( TC_multiplex_dl_gprs_egprs() ); |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 7532 | |
| 7533 | execute( TC_pcuif_info_ind_subsequent() ); |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 7534 | execute( TC_nacc_outbound_success() ); |
Philipp Maier | e640d8f | 2023-06-30 14:43:01 +0200 | [diff] [blame] | 7535 | execute( TC_nacc_outbound_success_utran() ); |
| 7536 | execute( TC_nacc_outbound_success_eutran() ); |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 7537 | execute( TC_nacc_outbound_success_no_ctrl_ack() ); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 7538 | execute( TC_nacc_outbound_success_twice() ); |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 7539 | execute( TC_nacc_outbound_success_twice_nocache() ); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 7540 | execute( TC_nacc_outbound_rac_ci_resolve_timeout() ); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 7541 | execute( TC_nacc_outbound_si_resolve_timeout() ); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 7542 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup() ); |
| 7543 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup2() ); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 7544 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup3() ); |
| 7545 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup4() ); |
| 7546 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup5() ); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 7547 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice() ); |
| 7548 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice2() ); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 7549 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice3() ); |
| 7550 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice4() ); |
| 7551 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice5() ); |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 7552 | execute( TC_nacc_outbound_pkt_cell_chg_notif_unassigned_dl_tbf() ); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 7553 | if (mp_ctrl_neigh_ip != "") { /* PCU using old CTRL neigh addr resolution iface */ |
| 7554 | execute( TC_nacc_outbound_rac_ci_resolve_conn_refused() ); |
| 7555 | execute( TC_nacc_outbound_rac_ci_resolve_fail_parse_response() ); |
| 7556 | } |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 7557 | |
| 7558 | execute( TC_rim_ran_info_req_single_rep() ); |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 7559 | execute( TC_rim_ran_info_req_single_rep_eutran() ); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 7560 | execute( TC_rim_ran_info_req_single_rep_no_si() ); |
Pau Espin Pedrol | 3aa61c6 | 2021-08-25 19:24:03 +0200 | [diff] [blame] | 7561 | |
| 7562 | execute (TC_pdch_energy_saving() ); |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 7563 | |
| 7564 | execute( TC_stat_pdch_avail_occ() ); |
Oliver Smith | f04762d | 2021-09-14 17:20:38 +0200 | [diff] [blame] | 7565 | execute( TC_stat_pdch_avail_occ_ms_not_known_gprs() ); |
| 7566 | execute( TC_stat_pdch_avail_occ_ms_not_known_egprs() ); |
Pau Espin Pedrol | 6eb4d25 | 2021-11-15 11:53:40 +0100 | [diff] [blame] | 7567 | execute( TC_ratectr_all_available_allocated() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 7568 | } |
| 7569 | |
Harald Welte | a419df2 | 2019-03-21 17:23:04 +0100 | [diff] [blame] | 7570 | } |