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; |
| 25 | |
| 26 | import from Osmocom_VTY_Functions all; |
| 27 | import from TELNETasp_PortType all; |
| 28 | |
| 29 | import from MobileL3_GMM_SM_Types all; |
| 30 | import from RLCMAC_CSN1_Types all; |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 31 | import from RLCMAC_CSN1_Templates all; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 32 | import from RLCMAC_Types all; |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 33 | import from RLCMAC_Templates all; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 34 | |
| 35 | import from MobileL3_CommonIE_Types all; |
| 36 | import from L3_Templates all; |
| 37 | |
| 38 | import from NS_Types all; |
| 39 | import from BSSGP_Types all; |
| 40 | import from Osmocom_Gb_Types all; |
| 41 | |
| 42 | import from BSSGP_Emulation all; /* BssgpConfig */ |
| 43 | import from NS_Emulation all; /* NSConfiguration */ |
| 44 | |
| 45 | import from UD_Types all; |
| 46 | import from PCUIF_Types all; |
| 47 | import from PCUIF_CodecPort all; |
| 48 | import from PCUIF_Components all; |
| 49 | import from IPL4asp_Types all; |
| 50 | import from Native_Functions all; |
| 51 | import from SGSN_Components all; |
Pau Espin Pedrol | aedc511 | 2020-05-16 17:30:42 +0200 | [diff] [blame] | 52 | import from GPRS_Components all; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 53 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 54 | import from StatsD_Types all; |
| 55 | import from StatsD_CodecPort all; |
| 56 | import from StatsD_CodecPort_CtrlFunct all; |
| 57 | import from StatsD_Checker all; |
| 58 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 59 | import from IPA_Emulation all; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 60 | import from Osmocom_CTRL_Types all; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 61 | import from Osmocom_CTRL_Adapter all; |
| 62 | import from Osmocom_CTRL_Functions all; |
| 63 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 64 | modulepar { |
| 65 | charstring mp_pcu_sock_path := PCU_SOCK_DEFAULT; |
| 66 | |
| 67 | float X2002 := 0.2; /* Timer -2002, IMM ASSIGN confirm delay */ |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 68 | |
| 69 | charstring mp_pcu_statsd_ip := "127.0.0.1"; |
| 70 | integer mp_pcu_statsd_port := 8125; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 71 | |
| 72 | charstring mp_ctrl_neigh_ip := "127.0.0.1"; |
| 73 | integer mp_ctrl_neigh_port := 4248; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | |
| 77 | /* 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] | 78 | friend template (value) PCUIF_info_ind ts_PCUIF_INFO_default(template (value) PCUIF_Flags flags := c_PCUIF_Flags_default) |
| 79 | := { |
Vadim Yanitskiy | c155930 | 2020-07-19 16:39:12 +0700 | [diff] [blame] | 80 | version := PCUIF_Types.mp_pcuif_version, |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 81 | flags := flags, |
Pau Espin Pedrol | 2aead38 | 2020-10-29 20:46:47 +0100 | [diff] [blame] | 82 | trx := f_PCUIF_ver_INFO_Trxs(GPRS_Components.mp_base_arfcn), |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 83 | bsic := 7, |
| 84 | mcc := 262, |
| 85 | mnc := 42, |
| 86 | mnc_3_digits := 0, |
| 87 | lac := 13135, |
| 88 | rac := 0, |
| 89 | nsei := mp_nsconfig.nsei, |
| 90 | nse_timer := { 3, 3, 3, 3, 30, 3, 10 }, |
| 91 | cell_timer := { 3, 3, 3, 3, 3, 10, 3, 10, 3, 10, 3 }, |
| 92 | cell_id := 20960, |
| 93 | repeat_time := 5 * 50, |
| 94 | repeat_count := 3, |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 95 | bvci := mp_gb_cfg.bvc[0].bvci, |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 96 | t3142 := 20, |
| 97 | t3169 := 5, |
| 98 | t3191 := 5, |
| 99 | t3193_10ms := 160, |
| 100 | t3195 := 5, |
| 101 | t3101 := 10, |
| 102 | t3103 := 4, |
| 103 | t3105 := 8, |
| 104 | cv_countdown := 15, |
| 105 | dl_tbf_ext := 250 * 10, /* ms */ |
| 106 | ul_tbf_ext := 250 * 10, /* ms */ |
| 107 | initial_cs := 2, |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 108 | initial_mcs := 1, |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 109 | nsvci := { mp_nsconfig.nsvc[0].nsvci, 0 }, |
| 110 | local_port := { mp_nsconfig.nsvc[0].provider.ip.remote_udp_port, 0 }, |
| 111 | remote_port := { mp_nsconfig.nsvc[0].provider.ip.local_udp_port, 0 }, |
Alexander Couzens | 1e5dc48 | 2020-07-28 15:38:46 +0200 | [diff] [blame] | 112 | remote_addr := f_PCUIF_ver_INFO_RemoteAddr( |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 113 | 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] | 114 | } |
| 115 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 116 | /* Passed in RAN-INFO message from emulated neighbor using RIM */ |
| 117 | const octetstring si1_default := '198fb100000000000000000000000000007900002b'O; |
| 118 | const octetstring si3_default := '1b753000f110236ec9033c2747407900003c0b2b2b'O; |
| 119 | const octetstring si13_default := '009000185a6fc9e08410ab2b2b2b2b2b2b2b2b2b2b'O; |
| 120 | const octetstring si_default := si1_default & si3_default & si13_default; |
| 121 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 122 | const MultislotCap_GPRS mscap_gprs_def := { |
| 123 | gprsmultislotclass := '00011'B, |
| 124 | gprsextendeddynalloccap := '0'B |
| 125 | }; |
| 126 | const MultislotCap_EGPRS mscap_egprs_def := { |
| 127 | egprsmultislotclass := '00011'B, |
| 128 | egprsextendeddynalloccap := '0'B |
| 129 | }; |
| 130 | template (value) MSRadioAccessCapabilityV ms_racap_gprs_def := { ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs_def, omit) }; |
| 131 | template (value) MSRadioAccessCapabilityV ms_racap_egprs_def := { ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs_def, mscap_egprs_def) }; |
| 132 | |
| 133 | const MultislotCap_GPRS_BSSGP bssgp_mscap_gprs_def := { |
| 134 | gprsmultislotclass := '00011'B, |
| 135 | gprsextendeddynalloccap := '0'B |
| 136 | }; |
| 137 | const MultislotCap_EGPRS_BSSGP bssgp_mscap_egprs_def := { |
| 138 | egprsmultislotclass := '00011'B, |
| 139 | egprsextendeddynalloccap := '0'B |
| 140 | }; |
| 141 | template (value) MSRadioAccessCapabilityV_BSSGP bssgp_ms_racap_gprs_def := { valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, bssgp_mscap_gprs_def, omit)) }; |
| 142 | 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)) }; |
| 143 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 144 | type record lqual_range { |
| 145 | /* component reference to the IPA_Client component used for RSL */ |
| 146 | uint8_t low, |
| 147 | uint8_t high |
| 148 | } |
| 149 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 150 | 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] | 151 | /* PCU interface abstraction component */ |
| 152 | var RAW_PCUIF_CT vc_PCUIF; |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 153 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 154 | /* StatsD */ |
| 155 | var StatsD_Checker_CT vc_STATSD; |
| 156 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 157 | /* Connection to the PCUIF component */ |
| 158 | port RAW_PCU_MSG_PT PCUIF; |
| 159 | /* VTY connection to the PCU */ |
| 160 | port TELNETasp_PT PCUVTY; |
| 161 | |
| 162 | /* Uplink CS/MCS thresholds, default from pcu_main.c: */ |
| 163 | var lqual_range g_cs_lqual_ranges[4] := {{low := 0, high := 6}, |
| 164 | {low := 5, high := 8}, |
| 165 | {low := 7, high := 13}, |
| 166 | {low := 12,high := 35}}; |
| 167 | var lqual_range g_mcs_lqual_ranges[9] := {{low := 0, high := 6}, |
| 168 | {low := 5, high := 8}, |
| 169 | {low := 7, high := 13}, |
| 170 | {low := 12,high := 15}, |
| 171 | {low := 14, high := 17}, |
| 172 | {low := 16, high := 18}, |
| 173 | {low := 17,high := 20}, |
| 174 | {low := 19, high := 24}, |
| 175 | {low := 23,high := 35}}; |
| 176 | var uint8_t g_cs_initial_dl := 1; |
| 177 | var uint8_t g_cs_initial_ul := 1; |
| 178 | var uint8_t g_mcs_initial_dl := 1; |
| 179 | var uint8_t g_mcs_initial_ul := 1; |
| 180 | var uint8_t g_cs_max_dl := 4; |
| 181 | var uint8_t g_cs_max_ul := 4; |
| 182 | var uint8_t g_mcs_max_dl := 9; |
| 183 | var uint8_t g_mcs_max_ul := 9; |
| 184 | |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 185 | var boolean g_force_two_phase_access := false; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 186 | |
| 187 | /* Guard timeout */ |
| 188 | timer g_T_guard := 60.0; |
| 189 | }; |
| 190 | |
| 191 | private altstep as_Tguard_RAW() runs on RAW_PCU_Test_CT { |
| 192 | [] g_T_guard.timeout { |
| 193 | setverdict(fail, "Timeout of T_guard"); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 194 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 195 | } |
| 196 | } |
| 197 | |
| 198 | private function f_pcuvty_set_allowed_cs_mcs() runs on RAW_PCU_Test_CT { |
| 199 | f_vty_config2(PCUVTY, {"pcu"}, "cs " & int2str(g_cs_initial_dl) & " " & int2str(g_cs_initial_ul)); |
| 200 | f_vty_config2(PCUVTY, {"pcu"}, "cs max " & int2str(g_cs_max_dl) & " " & int2str(g_cs_max_ul)); |
| 201 | |
| 202 | f_vty_config2(PCUVTY, {"pcu"}, "mcs " & int2str(g_mcs_initial_dl) & " " & int2str(g_mcs_initial_ul)); |
| 203 | f_vty_config2(PCUVTY, {"pcu"}, "mcs max " & int2str(g_mcs_max_dl) & " " & int2str(g_mcs_max_ul)); |
| 204 | } |
| 205 | |
| 206 | private function f_pcuvty_set_link_quality_ranges() runs on RAW_PCU_Test_CT { |
| 207 | var charstring cmd; |
| 208 | |
| 209 | cmd := "cs link-quality-ranges" & |
| 210 | " cs1 " & int2str(g_cs_lqual_ranges[0].high) & |
| 211 | " cs2 " & int2str(g_cs_lqual_ranges[1].low) & " " & int2str(g_cs_lqual_ranges[1].high) & |
| 212 | " cs3 " & int2str(g_cs_lqual_ranges[2].low) & " " & int2str(g_cs_lqual_ranges[2].high) & |
| 213 | " cs4 " & int2str(g_cs_lqual_ranges[3].low); |
| 214 | f_vty_config2(PCUVTY, {"pcu"}, cmd); |
| 215 | |
| 216 | cmd := "mcs link-quality-ranges" & |
| 217 | " mcs1 " & int2str(g_mcs_lqual_ranges[0].high) & |
| 218 | " mcs2 " & int2str(g_mcs_lqual_ranges[1].low) & " " & int2str(g_mcs_lqual_ranges[1].high) & |
| 219 | " mcs3 " & int2str(g_mcs_lqual_ranges[2].low) & " " & int2str(g_mcs_lqual_ranges[2].high) & |
| 220 | " mcs4 " & int2str(g_mcs_lqual_ranges[3].low) & " " & int2str(g_mcs_lqual_ranges[3].high) & |
| 221 | " mcs5 " & int2str(g_mcs_lqual_ranges[4].low) & " " & int2str(g_mcs_lqual_ranges[4].high) & |
| 222 | " mcs6 " & int2str(g_mcs_lqual_ranges[5].low) & " " & int2str(g_mcs_lqual_ranges[5].high) & |
| 223 | " mcs7 " & int2str(g_mcs_lqual_ranges[6].low) & " " & int2str(g_mcs_lqual_ranges[6].high) & |
| 224 | " mcs8 " & int2str(g_mcs_lqual_ranges[7].low) & " " & int2str(g_mcs_lqual_ranges[7].high) & |
| 225 | " mcs9 " & int2str(g_mcs_lqual_ranges[8].low); |
| 226 | f_vty_config2(PCUVTY, {"pcu"}, cmd); |
| 227 | } |
| 228 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 229 | private function f_pcuvty_flush_neigh_caches() runs on RAW_PCU_Test_CT { |
| 230 | f_pcuvty_set_neigh_caches(0, 0); |
| 231 | } |
| 232 | |
| 233 | private function f_pcuvty_set_neigh_caches(integer neigh_cache_secs := -1, integer si_cache_secs := -1) |
| 234 | runs on RAW_PCU_Test_CT { |
| 235 | if (neigh_cache_secs == -1) { |
| 236 | f_vty_config2(PCUVTY, {"pcu"}, "timer X10 default"); |
| 237 | } else { |
| 238 | f_vty_config2(PCUVTY, {"pcu"}, "timer X10 " & int2str(neigh_cache_secs)); |
| 239 | } |
| 240 | if (si_cache_secs == -1) { |
| 241 | f_vty_config2(PCUVTY, {"pcu"}, "timer X11 default"); |
| 242 | } else { |
| 243 | f_vty_config2(PCUVTY, {"pcu"}, "timer X11 " & int2str(si_cache_secs)); |
| 244 | } |
| 245 | } |
| 246 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 247 | 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] | 248 | map(self:PCUVTY, system:PCUVTY); |
| 249 | f_vty_set_prompts(PCUVTY); |
| 250 | f_vty_transceive(PCUVTY, "enable"); |
| 251 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 252 | /* This will be removed soon, not needed. EGPRS support is controlled through pcu_ind flags */ |
| 253 | if (egprs_only) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 254 | f_vty_config2(PCUVTY, {"pcu"}, "egprs only"); |
| 255 | } else { |
| 256 | f_vty_config2(PCUVTY, {"pcu"}, "no egprs"); |
| 257 | } |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 258 | |
| 259 | if (g_force_two_phase_access) { |
| 260 | f_vty_config2(PCUVTY, {"pcu"}, "two-phase-access"); |
| 261 | } else { |
| 262 | f_vty_config2(PCUVTY, {"pcu"}, "no two-phase-access"); |
| 263 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 264 | } |
| 265 | |
Pau Espin Pedrol | 2456dad | 2020-04-30 20:22:38 +0200 | [diff] [blame] | 266 | 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] | 267 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 268 | /* Start the guard timer */ |
| 269 | g_T_guard.start; |
| 270 | activate(as_Tguard_RAW()); |
| 271 | |
| 272 | /* Init PCU interface component */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 273 | vc_PCUIF := RAW_PCUIF_CT.create("PCUIF"); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 274 | connect(vc_PCUIF:MTC, self:PCUIF); |
| 275 | map(vc_PCUIF:PCU, system:PCU); |
| 276 | |
| 277 | /* Create one BTS component (we may want more some day) */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 278 | vc_BTS := RAW_PCU_BTS_CT.create("BTS"); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 279 | connect(vc_BTS:PCUIF, vc_PCUIF:BTS); |
| 280 | connect(vc_BTS:TC, self:BTS); |
| 281 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 282 | 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] | 283 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 284 | f_init_statsd(id, vc_STATSD, mp_pcu_statsd_ip, mp_pcu_statsd_port); |
| 285 | /* This is normally done in the ConnHdlr component, but here |
| 286 | * the Test_CT doubles as ConnHdlr */ |
| 287 | connect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); |
| 288 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 289 | vc_PCUIF.start(f_PCUIF_CT_handler(mp_pcu_sock_path)); |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 290 | 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] | 291 | |
| 292 | /* Wait until the BTS is ready (SI13 negotiated) */ |
| 293 | BTS.receive(tr_RAW_PCU_EV(BTS_EV_SI13_NEGO)); |
| 294 | } |
| 295 | |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 296 | /* Register TLLI of each allocated GprsMS instance */ |
| 297 | private function f_multi_ms_bssgp_register() |
| 298 | runs on RAW_PCU_Test_CT { |
| 299 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 300 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, g_ms[i].tlli); |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | /* Allocate [and activate] an Uplink TBF for each allocated GprsMS instance */ |
| 305 | private function f_multi_ms_establish_tbf(boolean do_activate := false) |
| 306 | runs on RAW_PCU_Test_CT { |
| 307 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 308 | /* Establish an Uplink TBF */ |
| 309 | f_ms_establish_ul_tbf(g_ms[i]); |
| 310 | |
| 311 | /* Send a random block, so this TBF becomes "active" */ |
| 312 | if (do_activate) { |
| 313 | /* 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] | 314 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, i mod 8); |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 315 | var octetstring dummy := f_rnd_octstring(12); |
| 316 | var RlcmacDlBlock dl_block; |
| 317 | var uint32_t poll_fn; |
| 318 | |
| 319 | f_ms_tx_ul_data_block(g_ms[i], dummy, with_tlli := true, nr := nr); |
| 320 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, poll_fn, nr := nr); |
| 321 | } |
| 322 | } |
| 323 | } |
| 324 | |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 325 | private function f_ms_establish_ul_tbf_2phase_access(inout GprsMS ms, |
| 326 | template (omit) RlcmacUlCtrlMsg pkt_res_req := omit) |
| 327 | runs on RAW_PCU_Test_CT return PollFnCtx { |
| 328 | var PollFnCtx pollctx; |
| 329 | |
| 330 | /* Single block (two phase) packet access */ |
| 331 | var uint16_t ra := bit2int(chan_req_sb); |
| 332 | if (g_force_two_phase_access) { |
| 333 | /* If 2phase access is enforced by the network, then let's |
| 334 | * request a One phase packet access, we'll receive a single block |
| 335 | * anyway |
| 336 | */ |
| 337 | ra := bit2int(chan_req_def); |
| 338 | } |
| 339 | |
| 340 | /* Establish an Uplink TBF */ |
| 341 | f_ms_use_ra(ms, ra, ra_is_11bit := 0); |
| 342 | f_ms_establish_ul_tbf(ms); |
| 343 | |
| 344 | /* Make sure we've got an Uplink TBF assignment */ |
| 345 | if (not match(ms.ul_tbf.ass.ccch, tr_PacketUlSglAssign)) { |
| 346 | setverdict(fail, "Wrong Packet Uplink Assignment received: ", ms.ul_tbf.ass.ccch, " vs exp: ", tr_PacketUlSglAssign); |
| 347 | f_shutdown(__BFILE__, __LINE__); |
| 348 | } |
| 349 | |
| 350 | /* Send PACKET RESOURCE REQUEST |
| 351 | * (see 3GPP TS 04.60 "7.1.3.1 Initiation of the Packet resource request procedure") |
| 352 | */ |
| 353 | if (istemplatekind(pkt_res_req, "omit")) { |
| 354 | pkt_res_req := ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, omit); |
| 355 | } |
| 356 | |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 357 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(valueof(pkt_res_req)), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 358 | /* Store 1st UlTBF context before receiving next one, will |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 359 | * overwrite the TS allocation on MS with info from new UL TBF: |
| 360 | */ |
| 361 | pollctx.tstrxbts := f_ms_tx_TsTrxBtsNum(ms); |
| 362 | f_ms_rx_pkt_ass_pacch(ms, pollctx.fn, tr_RLCMAC_UL_PACKET_ASS, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 363 | return pollctx; |
| 364 | } |
| 365 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 366 | testcase TC_pcuif_suspend() runs on RAW_PCU_Test_CT { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 367 | 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] | 368 | var GprsTlli tlli := TLLI_UNUSED; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 369 | timer T; |
| 370 | |
| 371 | /* Initialize NS/BSSGP side */ |
| 372 | f_init_bssgp(); |
| 373 | |
| 374 | /* Initialize the PCU interface abstraction */ |
| 375 | f_init_raw(testcasename()); |
| 376 | |
| 377 | /* Establish BSSGP connection to the PCU */ |
| 378 | f_bssgp_establish(); |
| 379 | |
| 380 | BTS.send(ts_PCUIF_SUSP_REQ(0, tlli, ra_id, 0)); |
| 381 | |
| 382 | T.start(2.0); |
| 383 | alt { |
Harald Welte | 9b461a9 | 2020-12-10 23:41:14 +0100 | [diff] [blame] | 384 | [] 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] | 385 | setverdict(pass); |
| 386 | } |
| 387 | [] T.timeout { |
| 388 | setverdict(fail, "Timeout waiting for BSSGP SUSPEND"); |
| 389 | } |
| 390 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 391 | |
| 392 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 393 | } |
| 394 | |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 395 | /* Make sure TBF is released and no data is sent for in after reciving a Suspend Request from that MS. See OS#4761 */ |
| 396 | testcase TC_pcuif_suspend_active_tbf() runs on RAW_PCU_Test_CT { |
| 397 | var octetstring ra_id := enc_RoutingAreaIdentification(mp_gb_cfg.bvc[0].cell_id.ra_id); |
| 398 | var RlcmacDlBlock dl_block; |
| 399 | var octetstring data := f_rnd_octstring(10); |
| 400 | var uint32_t sched_fn; |
| 401 | var uint32_t dl_fn; |
| 402 | var GprsMS ms; |
| 403 | timer T; |
| 404 | |
| 405 | /* Initialize NS/BSSGP side */ |
| 406 | f_init_bssgp(); |
| 407 | /* Initialize GPRS MS side */ |
| 408 | f_init_gprs_ms(); |
| 409 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 410 | |
| 411 | /* Initialize the PCU interface abstraction */ |
| 412 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 413 | |
| 414 | /* Establish BSSGP connection to the PCU */ |
| 415 | f_bssgp_establish(); |
| 416 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 417 | |
| 418 | /* Establish an Uplink TBF */ |
| 419 | f_ms_establish_ul_tbf(ms); |
| 420 | |
| 421 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 422 | contention resoultion) and make sure it is ACKED fine */ |
| 423 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true); |
| 424 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 425 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 426 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 427 | |
| 428 | /* UL block should be received in SGSN */ |
| 429 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
| 430 | |
| 431 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 432 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 433 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 434 | |
| 435 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 436 | f_sleep(X2002); |
| 437 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 438 | |
| 439 | /* MS has moved to CS, it sent SUSP REQ to BTS and PCU gets it, TBF is freed: */ |
| 440 | BTS.send(ts_PCUIF_SUSP_REQ(0, ms.tlli, ra_id, 0)); |
| 441 | |
| 442 | T.start(2.0); |
| 443 | alt { |
| 444 | [] BSSGP_GLOBAL[0].receive(tr_BSSGP_SUSPEND(ms.tlli, mp_gb_cfg.bvc[0].cell_id.ra_id)) { |
| 445 | setverdict(pass); |
| 446 | } |
| 447 | [] T.timeout { |
| 448 | setverdict(fail, "Timeout waiting for BSSGP SUSPEND"); |
| 449 | f_shutdown(__BFILE__, __LINE__); |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | /* Make sure we don't receive data for that TBF since it was released |
| 454 | * before. Also check our TBF is not polled for UL. */ |
| 455 | f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 456 | if (dl_block.ctrl.mac_hdr.usf != USF_UNUSED) { |
| 457 | setverdict(fail, "Unexpected USF ", dl_block.ctrl.mac_hdr.usf); |
| 458 | f_shutdown(__BFILE__, __LINE__); |
| 459 | } |
| 460 | |
| 461 | /* New data arrives, PCU should page the MS since no TBF active exists: */ |
| 462 | /* Send some more data, it will never reach the MS */ |
| 463 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 464 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 465 | |
| 466 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 467 | } |
| 468 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 469 | /* Test of correct Timing Advance at the time of TBF establishment |
| 470 | * (derived from timing offset of the Access Burst). */ |
| 471 | 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] | 472 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 473 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 474 | /* Initialize GPRS MS side */ |
| 475 | f_init_gprs_ms(); |
| 476 | 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] | 477 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 478 | 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] | 479 | |
| 480 | /* We cannot send too many TBF requests in a short time because |
| 481 | * at some point the PCU will fail to allocate a new TBF. */ |
| 482 | for (var TimingAdvance ta := 0; ta < 64; ta := ta + 16) { |
| 483 | /* Establish an Uplink TBF (send RACH.ind with current TA) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 484 | ms.ta := ta; |
Vadim Yanitskiy | 84d1dd5 | 2020-05-28 21:09:22 +0700 | [diff] [blame] | 485 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 486 | |
| 487 | /* Make sure Timing Advance IE matches out expectations */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 488 | 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] | 489 | setverdict(fail, "Timing Advance mismatch: ", |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 490 | ms.ul_tbf.rr_imm_ass.payload.imm_ass.timing_advance, |
Vadim Yanitskiy | 8685b38 | 2020-05-06 16:53:26 +0700 | [diff] [blame] | 491 | " vs expected ", ta); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 492 | break; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 493 | } |
| 494 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 495 | |
| 496 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 497 | } |
| 498 | |
| 499 | /* Verify Timing Advance value(s) indicated during the packet Downlink assignment |
| 500 | * procedure as per 3GPP TS 44.018, section 3.5.3. There seems to be a bug in the |
| 501 | * IUT that causes it to send an unreasonable Timing Advance value > 0 despite |
| 502 | * no active TBF exists at the moment of establishment (idle mode). */ |
| 503 | testcase TC_ta_idle_dl_tbf_ass() runs on RAW_PCU_Test_CT { |
Vadim Yanitskiy | 84d1dd5 | 2020-05-28 21:09:22 +0700 | [diff] [blame] | 504 | var OCT4 tlli := f_rnd_octstring(4); |
| 505 | var GsmRrMessage rr_imm_ass; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 506 | |
| 507 | /* Initialize NS/BSSGP side */ |
| 508 | f_init_bssgp(); |
| 509 | |
| 510 | /* Initialize the PCU interface abstraction */ |
| 511 | f_init_raw(testcasename()); |
| 512 | |
| 513 | /* Establish BSSGP connection to the PCU */ |
| 514 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 515 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 516 | |
| 517 | /* SGSN sends some DL data, PCU will initiate Packet Downlink |
| 518 | * Assignment on CCCH (PCH). We don't care about the payload. */ |
Vadim Yanitskiy | 84d1dd5 | 2020-05-28 21:09:22 +0700 | [diff] [blame] | 519 | BSSGP[0].send(ts_BSSGP_DL_UD(tlli, f_rnd_octstring(10))); |
| 520 | rr_imm_ass := f_pcuif_rx_imm_ass(PCU_IF_SAPI_PCH, tr_IMM_TBF_ASS(dl := true)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 521 | |
| 522 | /* Make sure that Timing Advance is 0 (the actual value is not known yet). |
| 523 | * As per 3GPP S 44.018, section 3.5.3.1.2, the network *shall* initiate |
| 524 | * the procedures defined in 3GPP TS 44.060 or use the polling mechanism. */ |
Vadim Yanitskiy | 84d1dd5 | 2020-05-28 21:09:22 +0700 | [diff] [blame] | 525 | if (rr_imm_ass.payload.imm_ass.timing_advance != 0) { |
| 526 | setverdict(fail, "Timing Advance value doesn't match"); |
| 527 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 528 | |
| 529 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 530 | } |
| 531 | |
| 532 | /* Verify that the PCU generates valid PTCCH/D messages |
| 533 | * while neither Uplink nor Downlink TBF is established. */ |
| 534 | testcase TC_ta_ptcch_idle() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 535 | var BTS_PTCCH_Block pcu_msg; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 536 | timer T; |
| 537 | |
| 538 | /* Initialize the PCU interface abstraction */ |
| 539 | f_init_raw(testcasename()); |
| 540 | |
| 541 | /* Sent an RTS.req for PTCCH/D */ |
| 542 | BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7, |
| 543 | sapi := PCU_IF_SAPI_PTCCH, fn := 0, |
| 544 | arfcn := 871, block_nr := 0)); |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 545 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 546 | T.start(5.0); |
| 547 | alt { |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 548 | /* Make sure the message is encoded correctly |
| 549 | * TODO: do we expect all TA values to be equal '1111111'B? */ |
| 550 | [] as_rx_ptcch(pcu_msg, tr_PTCCHDownlinkMsg); |
| 551 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 552 | [] BTS.receive(PCUIF_Message:?) { repeat; } |
| 553 | [] T.timeout { |
| 554 | setverdict(fail, "Timeout waiting for a PTCCH/D block"); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 555 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 556 | } |
| 557 | } |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 558 | log("Decoded PTCCH/D message: ", pcu_msg.dl_block); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 559 | |
| 560 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 561 | } |
| 562 | |
| 563 | /* Test of correct Timing Advance during an active Uplink TBF. |
| 564 | * |
| 565 | * Unlike the circuit-switched domain, Uplink transmissions on PDCH time-slots |
| 566 | * are not continuous and there can be long time gaps between them. This happens |
| 567 | * due to a bursty nature of packet data. The actual Timing Advance of a MS may |
| 568 | * significantly change between such rare Uplink transmissions, so GPRS introduces |
| 569 | * additional mechanisms to control Timing Advance, and thus reduce interference |
| 570 | * between neighboring TDMA time-slots. |
| 571 | * |
| 572 | * At the moment of Uplink TBF establishment, initial Timing Advance is measured |
| 573 | * from ToA (Timing of Arrival) of an Access Burst. This is covered by another |
| 574 | * test case - TC_ta_rach_imm_ass. In response to that Access Burst the network |
| 575 | * sends Immediate Assignment on AGCH, which _may_ contain Timing Advance Index |
| 576 | * among with the initial Timing Advance value. And here PTCCH comes to play. |
| 577 | * |
| 578 | * PTCCH is a unidirectional channel on which the network can instruct a sub-set |
| 579 | * of 16 MS (whether TBFs are active or not) to adjust their Timing Advance |
| 580 | * continuously. To ensure continuous measurements of the signal propagation |
| 581 | * delay, the MSs shall transmit Access Bursts on Uplink (PTCCH/U) on sub-slots |
| 582 | * defined by an assigned Timing Advance Index (see 3GPP TS 45.002). |
| 583 | * |
| 584 | * The purpose of this test case is to verify the assignment of Timing Advance |
| 585 | * Index, and the process of Timing Advance notification on PTCCH/D. The MTC |
| 586 | * first establishes several Uplink TBFs, but does not transmit any Uplink |
| 587 | * blocks on them. During 4 TDMA multi-frame periods the MTC is sending RACH |
| 588 | * indications to the PCU, checking the correctness of two received PTCCH/D |
| 589 | * messages (period of PTCCH/D is two multi-frames). |
| 590 | */ |
| 591 | |
| 592 | /* List of ToA values for Access Bursts to be sent on PTCCH/U, |
| 593 | * each ToA (Timing of Arrival) value is in units of 1/4 of |
| 594 | * a symbol (i.e. 1 symbol is 4 QTA units). */ |
| 595 | type record length(16) of int16_t PTCCH_TAI_ToA_MAP; |
| 596 | const PTCCH_TAI_ToA_MAP ptcch_toa_map_def := { |
| 597 | 0, 0, 0, 0, |
| 598 | 0, 0, 0, 0, |
| 599 | 0, 0, 0, 0, |
| 600 | 0, 0, 0, 0 |
| 601 | }; |
| 602 | |
| 603 | private altstep as_ta_ptcch(uint8_t bts_nr := 0, uint8_t trx_nr := 0, uint8_t ts_nr := 7, |
| 604 | in PTCCH_TAI_ToA_MAP toa_map := ptcch_toa_map_def) |
| 605 | runs on RAW_PCU_Test_CT { |
| 606 | var RAW_PCU_Event event; |
| 607 | var integer ss; |
| 608 | |
| 609 | /* Send Access Bursts on PTCCH/U for every TA Index */ |
| 610 | [] BTS.receive(tr_RAW_PCU_EV(TDMA_EV_PTCCH_UL_BURST)) -> value event { |
| 611 | ss := f_tdma_ptcch_fn2ss(event.data.tdma_fn); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 612 | if (ss < 0) { /* Shall not happen */ |
| 613 | f_shutdown(__BFILE__, __LINE__); |
| 614 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 615 | |
| 616 | log("Sending an Access Burst on PTCCH/U", |
| 617 | ", sub-slot=", ss, " (TAI)", |
| 618 | ", fn=", event.data.tdma_fn, |
| 619 | ", ToA=", toa_map[ss], " (QTA)"); |
| 620 | /* TODO: do we care about RA and burst format? */ |
| 621 | BTS.send(ts_PCUIF_RACH_IND(bts_nr, trx_nr, ts_nr, |
| 622 | ra := oct2int('3A'O), |
| 623 | is_11bit := 0, |
| 624 | burst_type := BURST_TYPE_0, |
| 625 | fn := event.data.tdma_fn, |
| 626 | arfcn := 871, |
| 627 | qta := toa_map[ss], |
| 628 | sapi := PCU_IF_SAPI_PTCCH)); |
| 629 | repeat; |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | private function f_TC_ta_ptcch_ul_multi_tbf(in PTCCH_TAI_ToA_MAP ptcch_toa_map, |
| 634 | template PTCCHDownlinkMsg t_ta_msg) |
| 635 | runs on RAW_PCU_Test_CT { |
| 636 | var PTCCHDownlinkMsg ta_msg; |
| 637 | var PCUIF_Message pcu_msg; |
| 638 | timer T; |
| 639 | |
| 640 | /* First, send an RTS.req for the upcoming PTCCH/D block */ |
| 641 | BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7, |
| 642 | sapi := PCU_IF_SAPI_PTCCH, fn := 0, |
| 643 | arfcn := 871, block_nr := 0)); |
| 644 | T.start(2.0); |
| 645 | alt { |
| 646 | /* Keep sending of Access Bursts during two multi-frames (period of PTCCH/D) |
| 647 | * with increasing ToA (Timing of Arrival) values: 0, 7, 14, 28, 35... */ |
| 648 | [] as_ta_ptcch(bts_nr := 0, trx_nr := 0, ts_nr := 7, toa_map := ptcch_toa_map); |
| 649 | /* In the end of 2nd multi-frame we should receive a PTCCH/D block */ |
| 650 | [] BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7, |
| 651 | sapi := PCU_IF_SAPI_PTCCH)) -> value pcu_msg { |
| 652 | ta_msg := dec_PTCCHDownlinkMsg(pcu_msg.u.data_req.data); |
| 653 | log("Rx PTCCH/D message: ", ta_msg); |
| 654 | |
| 655 | /* Make sure Timing Advance values match our expectations */ |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 656 | if (not match(ta_msg, t_ta_msg)) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 657 | setverdict(fail, "PTCCH/D message does not match: ", t_ta_msg); |
| 658 | } |
| 659 | } |
| 660 | [] BTS.receive { repeat; } |
| 661 | [] T.timeout { |
| 662 | setverdict(fail, "Timeout waiting for a PTCCH/D block"); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 663 | } |
| 664 | } |
| 665 | } |
| 666 | |
| 667 | testcase TC_ta_ptcch_ul_multi_tbf() runs on RAW_PCU_Test_CT { |
| 668 | var template PacketUlAssign t_ul_tbf_ass; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 669 | var GprsMS ms; |
| 670 | |
| 671 | /* Initialize GPRS MS side */ |
| 672 | f_init_gprs_ms(); |
| 673 | 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] | 674 | |
| 675 | /* Initialize the PCU interface abstraction */ |
| 676 | f_init_raw(testcasename()); |
| 677 | |
| 678 | /* Enable forwarding of PTCCH/U TDMA events to us */ |
| 679 | BTS.send(ts_RAW_PCU_CMD(TDMA_CMD_ENABLE_PTCCH_UL_FWD)); |
| 680 | |
| 681 | /* Establish 7 Uplink TBFs (USF flag is 3 bits long, '111'B is reserved) */ |
| 682 | for (var integer i := 0; i < 7; i := i + 1) { |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 683 | /* Establish an Uplink TBF */ |
| 684 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 685 | |
| 686 | /* We expect incremental TFI/USF assignment (dynamic allocation) */ |
| 687 | t_ul_tbf_ass := tr_PacketUlDynAssign(tfi := i, usf := i); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 688 | 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] | 689 | setverdict(fail, "Failed to match Packet Uplink Assignment for #", i); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 690 | break; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 691 | } |
| 692 | |
| 693 | /* 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] | 694 | if (ms.ul_tbf.ass.ccch.dynamic.ta_index != i) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 695 | setverdict(fail, "Failed to match Timing Advance Index for #", i); |
| 696 | /* Keep going, the current OsmoPCU does not assign TA Index */ |
| 697 | } |
| 698 | } |
| 699 | |
| 700 | /* Prepare a list of ToA values for Access Bursts to be sent on PTCCH/U */ |
| 701 | var PTCCH_TAI_ToA_MAP toa_map := ptcch_toa_map_def; |
| 702 | for (var integer i := 0; i < 7; i := i + 1) { |
| 703 | /* ToA in units of 1/4 of a symbol */ |
| 704 | toa_map[i] := (i + 1) * 7 * 4; |
| 705 | } |
| 706 | |
| 707 | /* Now we have all 7 TBFs established in one-phase access mode, |
| 708 | * however we will not be sending any data on them. Instead, we |
| 709 | * will be sending RACH.ind on PTCCH/U during 4 multi-frame |
| 710 | * periods (TAI 0..8), and then will check two PTCCH/D blocks. |
| 711 | * |
| 712 | * Why not 4 TBFs at once? Because Uplink is delayed by 3 TDMA |
| 713 | * time-slots, so at the moment of scheduling a PTCCH/D block |
| 714 | * the PCU has odd number of PTCCH/U Access Bursts received. */ |
| 715 | f_TC_ta_ptcch_ul_multi_tbf(toa_map, tr_PTCCHDownlinkMsg( |
| 716 | tai0_ta := 7, tai1_ta := 14, tai2_ta := 21, |
| 717 | /* Other values are not known (yet) */ |
| 718 | tai3_ta := ?)); |
| 719 | f_TC_ta_ptcch_ul_multi_tbf(toa_map, tr_PTCCHDownlinkMsg( |
| 720 | tai0_ta := 7, tai1_ta := 14, tai2_ta := 21, |
| 721 | tai3_ta := 28, tai4_ta := 35, tai5_ta := 42, |
| 722 | /* Other values are out of our interest */ |
| 723 | tai6_ta := ?)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 724 | |
| 725 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 726 | } |
| 727 | |
| 728 | /* Default link quality adaptation (Coding Scheme) ranges (inclusive). |
| 729 | * OsmoPCU (VTY): cs link-quality-ranges cs1 6 cs2 5 8 cs3 7 13 cs4 12 |
| 730 | * |
| 731 | * NOTE: the ranges are intentionally overlapping because OsmoPCU |
| 732 | * does not change CS/MCS on the range borders (5-6, 7-8, 12-13). */ |
| 733 | private template integer CS1_lqual_dB_range := (-infinity .. 6); |
| 734 | private template integer CS2_lqual_dB_range := (5 .. 8); |
| 735 | private template integer CS3_lqual_dB_range := (7 .. 13); |
| 736 | private template integer CS4_lqual_dB_range := (12 .. infinity); |
| 737 | |
| 738 | 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] | 739 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 740 | var GprsMS ms; |
| 741 | var uint32_t unused_fn, sched_fn; |
| 742 | var uint4_t cv; |
| 743 | |
| 744 | /* Initialize GPRS MS side */ |
| 745 | f_init_gprs_ms(); |
| 746 | 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] | 747 | |
| 748 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 749 | 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] | 750 | |
| 751 | f_pcuvty_set_allowed_cs_mcs(); |
| 752 | f_pcuvty_set_link_quality_ranges(); |
| 753 | |
| 754 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 755 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 756 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 757 | |
| 758 | /* The actual / old link quality values. We need to keep track of the old |
| 759 | * (basically previous) link quality value, because OsmoPCU actually |
| 760 | * changes the coding scheme if not only the actual, but also the old |
| 761 | * value leaves the current link quality range (window). */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 762 | var integer lqual_old; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 763 | ms.lqual_cb := 0; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 764 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 765 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 766 | contention resoultion) and make sure it is ACKED fine. */ |
| 767 | /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
| 768 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
| 769 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(16), cv := 15, with_tlli := true) |
| 770 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 771 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 772 | 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] | 773 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 774 | /* 16 UL blocks (0 .. 15 dB, step = 1 cB) */ |
| 775 | for (var integer i := 150; i >= 0; i := i - 1) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 776 | /* Update the old / actual link quality */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 777 | lqual_old := ms.lqual_cb; |
| 778 | ms.lqual_cb := 150 - i; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 779 | |
| 780 | /* 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] | 781 | log("Sending DATA.ind with link quality (dB): ", ms.lqual_cb); |
| 782 | if (i > g_bs_cv_max) { |
| 783 | cv := 15; |
| 784 | } else { |
| 785 | cv := i; |
| 786 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 787 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 788 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := cv) |
| 789 | |
| 790 | /* we will receive UL ACK/NACK from time to time. In that case, check CdCofing increases */ |
| 791 | f_rx_rlcmac_dl_block(dl_block, unused_fn); |
| 792 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 793 | continue; |
| 794 | } |
| 795 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_GPRS(ul_tfi := ?)) and |
| 796 | not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 797 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 798 | f_shutdown(__BFILE__, __LINE__); |
| 799 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 800 | |
| 801 | log("Rx Packet Uplink ACK / NACK with Channel Coding Command: ", |
| 802 | dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd); |
| 803 | |
| 804 | /* Match the received Channel Coding Command. Since we are increasing |
| 805 | * the link quality value on each iteration and not decreasing, there |
| 806 | * is no need to check the both old and current link quality values. */ |
| 807 | var template ChCodingCommand ch_coding; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 808 | select (lqual_old / 10) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 809 | case (CS1_lqual_dB_range) { ch_coding := CH_CODING_CS1; } |
| 810 | case (CS2_lqual_dB_range) { ch_coding := CH_CODING_CS2; } |
| 811 | case (CS3_lqual_dB_range) { ch_coding := CH_CODING_CS3; } |
| 812 | case (CS4_lqual_dB_range) { ch_coding := CH_CODING_CS4; } |
| 813 | } |
| 814 | |
| 815 | if (not match(dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd, ch_coding)) { |
| 816 | setverdict(fail, "Channel Coding does not match our expectations: ", ch_coding); |
Pau Espin Pedrol | 1617e31 | 2020-05-22 14:41:14 +0200 | [diff] [blame] | 817 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 818 | } |
| 819 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 820 | |
| 821 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 822 | } |
| 823 | |
| 824 | /* Test the max UL CS set by VTY works fine */ |
| 825 | testcase TC_cs_initial_ul() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 826 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 827 | var ChCodingCommand last_ch_coding; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 828 | var uint32_t unused_fn, sched_fn; |
| 829 | var GprsMS ms; |
| 830 | |
| 831 | /* Initialize GPRS MS side */ |
| 832 | f_init_gprs_ms(); |
| 833 | 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] | 834 | |
| 835 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 836 | 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] | 837 | |
| 838 | /* Set initial UL CS to 3 */ |
| 839 | g_cs_initial_ul := 3; |
| 840 | f_pcuvty_set_allowed_cs_mcs(); |
| 841 | f_pcuvty_set_link_quality_ranges(); |
| 842 | |
| 843 | /* Take lqual (dB->cB) so that we stay in that CS */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 844 | ms.lqual_cb := g_cs_lqual_ranges[2].low * 10; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 845 | |
| 846 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 847 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 848 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 849 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 850 | contention resoultion) and make sure it is ACKED fine. */ |
| 851 | /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
| 852 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
| 853 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(16), cv := 15, with_tlli := true) |
| 854 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 855 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 856 | 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] | 857 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 858 | /* Send UL blocks, until we receive UL ACK/NACK and check we are in same initial CS: */ |
| 859 | while (true) { |
| 860 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := 15); |
| 861 | f_rx_rlcmac_dl_block(dl_block, unused_fn); |
| 862 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 863 | continue; |
| 864 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 865 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 866 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_GPRS(ul_tfi := ?)) and |
| 867 | not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 868 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 869 | f_shutdown(__BFILE__, __LINE__); |
| 870 | break; |
| 871 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 872 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 873 | 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] | 874 | break; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 875 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 876 | if (last_ch_coding != CH_CODING_CS3) { |
| 877 | 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] | 878 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 879 | } |
| 880 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 881 | /* Remaining UL blocks are used to make sure regardless of initial |
| 882 | /* lqual, we can go lower at any time */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 883 | /* 0 dB, make sure we downgrade CS */ |
| 884 | ms.lqual_cb := 0; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 885 | /* 5 UL blocks, check we are in same initial CS: */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 886 | f_ms_tx_ul_data_block_multi(ms, 5); |
| 887 | /* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */ |
| 888 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 889 | 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] | 890 | |
| 891 | if (last_ch_coding != CH_CODING_CS1) { |
| 892 | 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] | 893 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 894 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 895 | |
| 896 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 897 | } |
| 898 | |
| 899 | /* Test the max UL CS set by VTY works fine */ |
| 900 | testcase TC_cs_max_ul() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 901 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 902 | var ChCodingCommand last_ch_coding; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 903 | var uint32_t unused_fn, sched_fn; |
| 904 | var GprsMS ms; |
| 905 | |
| 906 | /* Initialize GPRS MS side */ |
| 907 | f_init_gprs_ms(); |
| 908 | 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] | 909 | |
| 910 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 911 | 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] | 912 | |
| 913 | /* Set maximum allowed UL CS to 3 */ |
| 914 | g_cs_max_ul := 3; |
| 915 | f_pcuvty_set_allowed_cs_mcs(); |
| 916 | f_pcuvty_set_link_quality_ranges(); |
| 917 | |
| 918 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 919 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 920 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 921 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 922 | contention resoultion) and make sure it is ACKED fine. */ |
| 923 | /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
| 924 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
| 925 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(16), cv := 15, with_tlli := true) |
| 926 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 927 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 928 | 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] | 929 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 930 | ms.lqual_cb := 40*10; /* 40 dB */ |
| 931 | f_ms_tx_ul_data_block_multi(ms, 16); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 932 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 933 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 934 | 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] | 935 | |
| 936 | if (last_ch_coding != CH_CODING_CS3) { |
| 937 | 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] | 938 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 939 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 940 | |
| 941 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 942 | } |
| 943 | |
Pau Espin Pedrol | 7512259 | 2020-11-03 15:22:59 +0100 | [diff] [blame] | 944 | /* Test the initial DL CS set by VTY works fine */ |
| 945 | testcase TC_cs_initial_dl() runs on RAW_PCU_Test_CT { |
| 946 | var octetstring data := f_rnd_octstring(10); |
| 947 | var CodingScheme exp_dl_cs_mcs; |
| 948 | var RlcmacDlBlock dl_block; |
| 949 | var uint32_t poll_fn; |
| 950 | var GprsMS ms; |
| 951 | |
| 952 | /* Initialize NS/BSSGP side */ |
| 953 | f_init_bssgp(); |
| 954 | /* Initialize GPRS MS side */ |
| 955 | f_init_gprs_ms(); |
| 956 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 957 | |
| 958 | /* Initialize the PCU interface abstraction */ |
| 959 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 960 | |
| 961 | /* Set initial allowed DL CS to 3 */ |
| 962 | g_cs_initial_dl := 3; |
| 963 | exp_dl_cs_mcs := CS_3; |
| 964 | /* Set maximum allowed UL CS to 4 */ |
| 965 | g_cs_max_dl := 4; |
| 966 | f_pcuvty_set_allowed_cs_mcs(); |
| 967 | f_pcuvty_set_link_quality_ranges(); |
| 968 | |
| 969 | /* Establish BSSGP connection to the PCU */ |
| 970 | f_bssgp_establish(); |
| 971 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 972 | |
| 973 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 974 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 975 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 976 | |
| 977 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 978 | f_sleep(X2002); |
| 979 | f_rx_rlcmac_dl_block_exp_data(dl_block, poll_fn, data, 0, exp_dl_cs_mcs); |
| 980 | |
| 981 | /* ACK the DL block */ |
| 982 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 983 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 984 | f_dl_block_ack_fn(dl_block, poll_fn)); |
| 985 | |
| 986 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 987 | } |
| 988 | |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 989 | /* Verify scheduling of multiple Downlink data blocks, enough to reach CS4 */ |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 990 | 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] | 991 | var octetstring data := f_rnd_octstring(1400); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 992 | var RlcmacDlBlock prev_dl_block, dl_block; |
| 993 | var uint32_t ack_fn; |
| 994 | var uint32_t fn; |
| 995 | var GprsMS ms; |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 996 | var integer tx_data_remain := 10; |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 997 | var integer bsn := 0; |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 998 | var boolean using_egprs := f_rlcmac_cs_mcs_is_mcs(valueof(exp_final_cs)); |
| 999 | var integer bsn_mod; |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 1000 | var template (present) CodingScheme exp_tmp_csmcs; |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1001 | |
| 1002 | if (using_egprs) { |
| 1003 | exp_tmp_csmcs := mcs_egprs_any; |
| 1004 | bsn_mod := 2048; |
| 1005 | } else { |
| 1006 | exp_tmp_csmcs := cs_gprs_any; |
| 1007 | bsn_mod := 128; |
| 1008 | } |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1009 | |
| 1010 | /* Establish BSSGP connection to the PCU */ |
| 1011 | f_bssgp_establish(); |
| 1012 | |
| 1013 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1014 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1015 | |
| 1016 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1017 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap)); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1018 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1019 | |
| 1020 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 1021 | f_sleep(X2002); |
| 1022 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1023 | for (var integer i := 0; i < 800; i := i + 1) { |
| 1024 | bsn := i mod bsn_mod; |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1025 | f_rx_rlcmac_dl_block(dl_block, fn); |
| 1026 | |
| 1027 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL)) { |
| 1028 | /* No more data to receive, done */ |
| 1029 | break; |
| 1030 | } |
| 1031 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1032 | 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] | 1033 | |
| 1034 | /* Keep Ack/Nack description updated */ |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1035 | f_dltbf_ack_block(ms.dl_tbf, dl_block); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1036 | |
| 1037 | /* 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] | 1038 | if (f_dl_block_rrbp_valid(dl_block)) { |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1039 | ack_fn := f_dl_block_ack_fn(dl_block, fn); |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1040 | 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] | 1041 | if (tx_data_remain != 0) { |
| 1042 | /* Submit more data from time to time to keep the TBF ongoing */ |
| 1043 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 1044 | tx_data_remain := tx_data_remain - 1; |
| 1045 | } |
| 1046 | } |
| 1047 | prev_dl_block := dl_block; |
| 1048 | } |
| 1049 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1050 | bsn := (bsn + (bsn_mod-1)) mod bsn_mod; /* previous bsn: bsn -1 */ |
| 1051 | 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] | 1052 | |
| 1053 | |
| 1054 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1055 | } |
| 1056 | |
| 1057 | /* Verify DL CS above "cs max" set by VTY is never used */ |
| 1058 | testcase TC_cs_max_dl() runs on RAW_PCU_Test_CT { |
| 1059 | /* Initialize NS/BSSGP side */ |
| 1060 | f_init_bssgp(); |
| 1061 | /* Initialize GPRS MS side */ |
| 1062 | f_init_gprs_ms(); |
| 1063 | |
| 1064 | /* Initialize the PCU interface abstraction */ |
| 1065 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1066 | |
| 1067 | /* Set maximum allowed DL CS to 3 */ |
| 1068 | g_cs_initial_dl := 1; |
| 1069 | g_cs_max_dl := 3; |
| 1070 | f_pcuvty_set_allowed_cs_mcs(); |
| 1071 | f_pcuvty_set_link_quality_ranges(); |
| 1072 | |
| 1073 | f_dl_data_exp_cs(f_rlcmac_block_int2cs_mcs(g_cs_max_dl, false)); |
| 1074 | } |
| 1075 | |
| 1076 | /* Check DL CS4 is used in good link conditions if allowed by config */ |
| 1077 | testcase TC_dl_cs1_to_cs4() runs on RAW_PCU_Test_CT { |
| 1078 | /* Initialize NS/BSSGP side */ |
| 1079 | f_init_bssgp(); |
| 1080 | /* Initialize GPRS MS side */ |
| 1081 | f_init_gprs_ms(); |
| 1082 | |
| 1083 | /* Initialize the PCU interface abstraction */ |
| 1084 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1085 | |
| 1086 | /* Set initial DL CS to 1 & maximum allowed DL CS to 4 */ |
| 1087 | g_cs_initial_dl := 1; |
| 1088 | g_cs_max_dl := 4; |
| 1089 | f_pcuvty_set_allowed_cs_mcs(); |
| 1090 | f_pcuvty_set_link_quality_ranges(); |
| 1091 | |
| 1092 | f_dl_data_exp_cs(f_rlcmac_block_int2cs_mcs(g_cs_max_dl, false)); |
| 1093 | } |
| 1094 | |
Pau Espin Pedrol | 2354d6a | 2020-11-05 18:36:59 +0100 | [diff] [blame] | 1095 | /* Test the initial UL MCS set by VTY works fine */ |
| 1096 | testcase TC_mcs_initial_ul() runs on RAW_PCU_Test_CT { |
| 1097 | var RlcmacDlBlock dl_block; |
| 1098 | var PollFnCtx pollctx; |
| 1099 | var EgprsChCodingCommand last_ch_coding; |
| 1100 | var uint32_t unused_fn, sched_fn; |
| 1101 | var GprsMS ms; |
| 1102 | var CodingScheme exp_ul_mcs; |
Pau Espin Pedrol | 2354d6a | 2020-11-05 18:36:59 +0100 | [diff] [blame] | 1103 | |
| 1104 | /* Initialize GPRS MS side */ |
| 1105 | f_init_gprs_ms(); |
| 1106 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1107 | |
| 1108 | /* Initialize the PCU interface abstraction */ |
| 1109 | f_init_raw(testcasename()); |
| 1110 | |
| 1111 | /* Set initial UL MCS to 3 */ |
| 1112 | g_mcs_initial_ul := 3; |
| 1113 | exp_ul_mcs := f_rlcmac_block_int2cs_mcs(g_mcs_initial_ul, true); |
| 1114 | f_pcuvty_set_allowed_cs_mcs(); |
| 1115 | f_pcuvty_set_link_quality_ranges(); |
| 1116 | |
| 1117 | /* Take lqual (dB->cB) so that we stay in that MCS */ |
| 1118 | ms.lqual_cb := g_mcs_lqual_ranges[2].low * 10; |
| 1119 | |
| 1120 | /* Send PACKET RESOURCE REQUEST to upgrade to EGPRS */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1121 | 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] | 1122 | |
| 1123 | if (not match(ms.ul_tbf.tx_cs_mcs, exp_ul_mcs)) { |
| 1124 | setverdict(fail, "Wrong CS_MCS ", ms.ul_tbf.tx_cs_mcs, " received vs exp ", exp_ul_mcs); |
| 1125 | f_shutdown(__BFILE__, __LINE__); |
| 1126 | } |
| 1127 | |
| 1128 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 1129 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 1130 | |
| 1131 | /* Send UL blocks, until we receive UL ACK/NACK and check we are in same initial CS: */ |
| 1132 | while (true) { |
| 1133 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := 15); |
| 1134 | f_rx_rlcmac_dl_block(dl_block, unused_fn); |
| 1135 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 1136 | continue; |
| 1137 | } |
| 1138 | |
| 1139 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 1140 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 1141 | f_shutdown(__BFILE__, __LINE__); |
| 1142 | break; |
| 1143 | } |
| 1144 | |
| 1145 | last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.egprs.ch_coding_cmd; |
| 1146 | break; |
| 1147 | } |
| 1148 | if (f_rlcmac_block_EgprsChCodingCommand2cs_mcs(last_ch_coding) != exp_ul_mcs) { |
| 1149 | setverdict(fail, "Channel Coding does not match our expectations ", exp_ul_mcs, ": ", last_ch_coding); |
| 1150 | f_shutdown(__BFILE__, __LINE__); |
| 1151 | } |
| 1152 | |
| 1153 | /* Remaining UL blocks are used to make sure regardless of initial |
| 1154 | * lqual, we can go lower at any time |
| 1155 | * 0 dB, make sure we downgrade MCS */ |
| 1156 | ms.lqual_cb := 0; |
| 1157 | /* 5 UL blocks, check we are in same initial MCS: */ |
| 1158 | f_ms_tx_ul_data_block_multi(ms, 5); |
| 1159 | /* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */ |
| 1160 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 1161 | last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.egprs.ch_coding_cmd; |
| 1162 | |
| 1163 | if (last_ch_coding != CH_CODING_MCS1) { |
| 1164 | setverdict(fail, "Channel Coding does not match our expectations (MCS-1): ", last_ch_coding); |
| 1165 | f_shutdown(__BFILE__, __LINE__); |
| 1166 | } |
| 1167 | |
| 1168 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1169 | } |
| 1170 | |
Pau Espin Pedrol | db15fa7 | 2020-11-11 12:58:34 +0100 | [diff] [blame] | 1171 | /* Test the maximum UL MCS set by VTY works fine */ |
| 1172 | testcase TC_mcs_max_ul() runs on RAW_PCU_Test_CT { |
| 1173 | var RlcmacDlBlock dl_block; |
| 1174 | var EgprsChCodingCommand last_ch_coding; |
| 1175 | var PollFnCtx pollctx; |
| 1176 | var uint32_t unused_fn, sched_fn; |
| 1177 | var GprsMS ms; |
Pau Espin Pedrol | db15fa7 | 2020-11-11 12:58:34 +0100 | [diff] [blame] | 1178 | |
| 1179 | /* Initialize GPRS MS side */ |
| 1180 | f_init_gprs_ms(); |
| 1181 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1182 | |
| 1183 | /* Initialize the PCU interface abstraction */ |
| 1184 | f_init_raw(testcasename()); |
| 1185 | |
| 1186 | /* Set maximum allowed UL MCS to 5 */ |
| 1187 | g_mcs_max_ul := 5; |
| 1188 | f_pcuvty_set_allowed_cs_mcs(); |
| 1189 | f_pcuvty_set_link_quality_ranges(); |
| 1190 | |
| 1191 | /* Send PACKET RESOURCE REQUEST to upgrade to EGPRS */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1192 | 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] | 1193 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 1194 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 1195 | |
| 1196 | ms.lqual_cb := 40*10; /* 40 dB */ |
| 1197 | f_ms_tx_ul_data_block_multi(ms, 16); |
| 1198 | |
| 1199 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 1200 | last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.egprs.ch_coding_cmd; |
| 1201 | |
| 1202 | if (last_ch_coding != CH_CODING_MCS5) { |
| 1203 | setverdict(fail, "Channel Coding does not match our expectations (MCS-5): ", last_ch_coding); |
| 1204 | f_shutdown(__BFILE__, __LINE__); |
| 1205 | } |
| 1206 | |
| 1207 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1208 | } |
| 1209 | |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 1210 | /* Test the initial DL CS set by VTY works fine */ |
| 1211 | testcase TC_mcs_initial_dl() runs on RAW_PCU_Test_CT { |
| 1212 | var octetstring data := f_rnd_octstring(10); |
| 1213 | var CodingScheme exp_dl_cs_mcs; |
| 1214 | var RlcmacDlBlock dl_block; |
| 1215 | var uint32_t poll_fn; |
| 1216 | var GprsMS ms; |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 1217 | |
| 1218 | /* Initialize NS/BSSGP side */ |
| 1219 | f_init_bssgp(); |
| 1220 | /* Initialize GPRS MS side */ |
| 1221 | f_init_gprs_ms(); |
| 1222 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1223 | |
| 1224 | /* Initialize the PCU interface abstraction */ |
| 1225 | f_init_raw(testcasename()); |
| 1226 | |
| 1227 | /* Set initial allowed DL MCS to 3 */ |
| 1228 | g_mcs_initial_dl := 3; |
| 1229 | exp_dl_cs_mcs := MCS_3; |
| 1230 | /* Set maximum allowed DL MCS to 4 */ |
| 1231 | g_mcs_max_dl := 4; |
| 1232 | f_pcuvty_set_allowed_cs_mcs(); |
| 1233 | f_pcuvty_set_link_quality_ranges(); |
| 1234 | |
| 1235 | /* Establish BSSGP connection to the PCU */ |
| 1236 | f_bssgp_establish(); |
| 1237 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1238 | |
| 1239 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1240 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, bssgp_ms_racap_egprs_def)); |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 1241 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1242 | |
| 1243 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1244 | f_sleep(X2002); |
| 1245 | f_rx_rlcmac_dl_block_exp_data(dl_block, poll_fn, data, 0, exp_dl_cs_mcs); |
| 1246 | |
| 1247 | /* ACK the DL block */ |
Pau Espin Pedrol | e8db673 | 2020-11-12 21:06:41 +0100 | [diff] [blame] | 1248 | f_dltbf_ack_block(ms.dl_tbf, dl_block, '1'B); |
| 1249 | 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] | 1250 | f_dl_block_ack_fn(dl_block, poll_fn)); |
| 1251 | |
| 1252 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1253 | } |
| 1254 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1255 | /* Verify DL MCS above "mcs max" set by VTY is never used */ |
| 1256 | testcase TC_mcs_max_dl() runs on RAW_PCU_Test_CT { |
| 1257 | /* Initialize NS/BSSGP side */ |
| 1258 | f_init_bssgp(); |
| 1259 | /* Initialize GPRS MS side */ |
| 1260 | f_init_gprs_ms(); |
| 1261 | |
| 1262 | /* Initialize the PCU interface abstraction */ |
| 1263 | f_init_raw(testcasename()); |
| 1264 | |
| 1265 | /* Set maximum allowed DL CS to 3 */ |
| 1266 | g_mcs_initial_dl := 1; |
| 1267 | g_mcs_max_dl := 3; |
| 1268 | f_pcuvty_set_allowed_cs_mcs(); |
| 1269 | f_pcuvty_set_link_quality_ranges(); |
| 1270 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1271 | f_dl_data_exp_cs(f_rlcmac_block_int2cs_mcs(g_mcs_max_dl, true), bssgp_ms_racap_egprs_def); |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1272 | } |
| 1273 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1274 | /* Verify PCU drops TBF after some time of inactivity. */ |
| 1275 | testcase TC_t3169() runs on RAW_PCU_Test_CT { |
| 1276 | var PCUIF_info_ind info_ind; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1277 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1278 | var uint32_t unused_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1279 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1280 | |
| 1281 | /* Initialize NS/BSSGP side */ |
| 1282 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1283 | /* Initialize GPRS MS side */ |
| 1284 | f_init_gprs_ms(); |
| 1285 | 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] | 1286 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 1287 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1288 | /* Set timer to 1 sec (default 5) to speedup test: */ |
| 1289 | info_ind.t3169 := 1; |
| 1290 | |
| 1291 | /* Initialize the PCU interface abstraction */ |
| 1292 | f_init_raw(testcasename(), info_ind); |
| 1293 | |
| 1294 | /* Establish BSSGP connection to the PCU */ |
| 1295 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 1296 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1297 | |
| 1298 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1299 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1300 | |
Pau Espin Pedrol | 4aac3d0 | 2020-05-13 15:13:49 +0200 | [diff] [blame] | 1301 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 1302 | contention resoultion) and make sure it is ACKED fine */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1303 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := 1, with_tlli := true) |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1304 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1305 | /* UL block should NOT be received in SGSN, since we didn't get CV=0 */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1306 | |
| 1307 | /* Wait until T3169 fires (plus 1 extra sec to make sure) */ |
| 1308 | f_sleep(int2float(info_ind.t3169) + 1.0); |
| 1309 | |
| 1310 | /* Send an UL block once again, the TBF should be gone by now so no ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1311 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := 0) |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1312 | f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 1313 | |
| 1314 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1315 | } |
| 1316 | |
| 1317 | /* Verify that a Downlink TBF can be assigned using PACCH shortly after the |
| 1318 | * release of prev DL TBF due to MS staying in PDCH for a while (T3192, in PCU |
| 1319 | * T3193) after DL TBF release */ |
| 1320 | testcase TC_t3193() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1321 | var RlcmacDlBlock dl_block; |
| 1322 | var octetstring data := f_rnd_octstring(10); |
| 1323 | var boolean ok; |
| 1324 | var uint32_t sched_fn; |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1325 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1326 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1327 | var AckNackDescription ack_nack_desc := valueof(t_AckNackDescription_init); |
| 1328 | |
| 1329 | /* Initialize NS/BSSGP side */ |
| 1330 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1331 | /* Initialize GPRS MS side */ |
| 1332 | f_init_gprs_ms(); |
| 1333 | 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] | 1334 | |
| 1335 | /* Initialize the PCU interface abstraction */ |
| 1336 | f_init_raw(testcasename()); |
| 1337 | |
| 1338 | /* Establish BSSGP connection to the PCU */ |
| 1339 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 1340 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1341 | |
| 1342 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1343 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 1344 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Vadim Yanitskiy | 2e213ae | 2020-05-06 22:26:17 +0700 | [diff] [blame] | 1345 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1346 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1347 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1348 | 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] | 1349 | |
| 1350 | /* ACK the DL block */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1351 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1352 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1353 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1354 | |
| 1355 | /* 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] | 1356 | (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] | 1357 | 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] | 1358 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
Vadim Yanitskiy | 7431e9e | 2020-07-21 01:59:17 +0700 | [diff] [blame] | 1359 | 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] | 1360 | |
| 1361 | 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] | 1362 | |
| 1363 | /* 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] | 1364 | 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] | 1365 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1366 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1367 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 1368 | |
| 1369 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1370 | } |
| 1371 | |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 1372 | /* Verify PCU handles correctly Countdown Procedure based on BS_CV_MAX */ |
| 1373 | testcase TC_countdown_procedure() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 1374 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 1375 | var uint32_t sched_fn; |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 1376 | var octetstring total_payload; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1377 | var GprsMS ms; |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 1378 | |
| 1379 | /* Initialize NS/BSSGP side */ |
| 1380 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1381 | /* Initialize GPRS MS side */ |
| 1382 | f_init_gprs_ms(); |
| 1383 | 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] | 1384 | |
| 1385 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 1386 | 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] | 1387 | |
| 1388 | /* Establish BSSGP connection to the PCU */ |
| 1389 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 1390 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 1391 | |
| 1392 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1393 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 1394 | |
| 1395 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 1396 | contention resoultion) and make sure it is ACKED fine. */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 1397 | 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] | 1398 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
| 1399 | f_ms_tx_ul_data_block(ms, total_payload, cv := 15, with_tlli := true) |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 1400 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 1401 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1402 | 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] | 1403 | |
| 1404 | /* Send enough blocks to test whole procedure: Until Nth block |
| 1405 | (N=BS_CV_MAX), CV=15 is sent, and then the decreasing countdown value is sent. |
| 1406 | */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1407 | 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] | 1408 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 1409 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1410 | 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] | 1411 | |
| 1412 | /* receive one message on BSSGP with all aggregated data in payload: */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1413 | 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] | 1414 | |
| 1415 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 1416 | } |
| 1417 | |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 1418 | /* Verify PCU handles correctly CS1..4 with all possible LLC payload sizes fitting alone in one RLC block */ |
| 1419 | testcase TC_ul_all_sizes() runs on RAW_PCU_Test_CT { |
| 1420 | var RlcmacDlBlock dl_block; |
| 1421 | var uint32_t dl_fn, sched_fn; |
| 1422 | var octetstring payload; |
| 1423 | var template (value) RlcmacUlBlock ul_data; |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 1424 | var template (value) LlcBlockHdr blk_hdr; |
| 1425 | var template (value) LlcBlocks blocks; |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 1426 | var integer blk_len; |
| 1427 | var CodingScheme tx_cs; |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 1428 | var GprsMS ms; |
| 1429 | |
| 1430 | /* Initialize NS/BSSGP side */ |
| 1431 | f_init_bssgp(); |
| 1432 | /* Initialize GPRS MS side */ |
| 1433 | f_init_gprs_ms(); |
| 1434 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1435 | |
| 1436 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 1437 | 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] | 1438 | |
| 1439 | /* Establish BSSGP connection to the PCU */ |
| 1440 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 1441 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 1442 | |
| 1443 | /* Establish an Uplink TBF */ |
| 1444 | f_ms_establish_ul_tbf(ms); |
| 1445 | |
| 1446 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 1447 | contention resoultion) and make sure it is ACKED fine. */ |
| 1448 | 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] | 1449 | blk_hdr := t_RLCMAC_LLCBLOCK_HDR(length_ind := lengthof(payload), |
| 1450 | more := false, e := true); |
| 1451 | blocks := { t_RLCMAC_LLCBLOCK(payload, blk_hdr) }; |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 1452 | /* 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] | 1453 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := ms.ul_tbf.tx_cs_mcs, |
| 1454 | tfi := ms.ul_tbf.tfi, |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 1455 | cv := 15, |
| 1456 | bsn := ms.ul_tbf.bsn, |
| 1457 | blocks := blocks, |
| 1458 | tlli := ms.tlli); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 1459 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 1460 | f_ms_tx_ul_block(ms, ul_data); |
| 1461 | |
| 1462 | /* ACK and check it was received fine */ |
| 1463 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 1464 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 1465 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 1466 | /* receive one message on BSSGP with all aggregated data in payload: */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1467 | 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] | 1468 | |
| 1469 | /* Test sending LLC PDUS of incrementing size */ |
| 1470 | var integer max_size := 49; |
| 1471 | for (var integer i := 1; i <= max_size; i := i + 1) { |
| 1472 | var integer cv; |
| 1473 | /* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */ |
| 1474 | log("Sending DATA.ind with LLC payload size ", i); |
| 1475 | if (i < max_size - g_bs_cv_max) { |
| 1476 | cv := 15; |
| 1477 | } else { |
| 1478 | cv := max_size - i; |
| 1479 | } |
| 1480 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 1481 | blk_len := 3 + 1 + i; /* 3 Header bytes + LI byte + payload length */ |
| 1482 | 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] | 1483 | payload := f_rnd_octstring(i); |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 1484 | blk_hdr := t_RLCMAC_LLCBLOCK_HDR(length_ind := lengthof(payload), |
| 1485 | more := false, e := true); |
| 1486 | blocks := { t_RLCMAC_LLCBLOCK(payload, blk_hdr) }; |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 1487 | /* 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] | 1488 | ul_data := t_RLCMAC_UL_DATA(cs := tx_cs, |
| 1489 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 1490 | cv := cv, |
| 1491 | bsn := ms.ul_tbf.bsn, |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 1492 | blocks := blocks); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 1493 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 1494 | f_ms_tx_ul_block(ms, ul_data); |
| 1495 | |
| 1496 | /* receive one message on BSSGP with all aggregated data in payload: */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1497 | 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] | 1498 | |
| 1499 | /* we will receive UL ACK/NACK from time to time, handle it. */ |
| 1500 | f_rx_rlcmac_dl_block(dl_block, dl_fn); |
| 1501 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 1502 | continue; |
| 1503 | } |
| 1504 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_GPRS(ul_tfi := ?)) and |
| 1505 | not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 1506 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 1507 | f_shutdown(__BFILE__, __LINE__); |
| 1508 | } |
| 1509 | |
| 1510 | log("Rx Packet Uplink ACK / NACK"); |
| 1511 | sched_fn := f_rrbp_ack_fn(dl_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 1512 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 1513 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 1514 | } |
Vadim Yanitskiy | 8e6df0c | 2020-10-18 00:13:15 +0700 | [diff] [blame] | 1515 | |
| 1516 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 1517 | } |
| 1518 | |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 1519 | function f_TC_ul_data_toolong_fills_padding_cs(inout GprsMS ms, CodingScheme cs, integer cv) runs on RAW_PCU_Test_CT { |
| 1520 | var octetstring payload; |
| 1521 | var template (value) RlcmacUlBlock ul_data; |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 1522 | var template (value) LlcBlockHdr blk_hdr; |
| 1523 | var template (value) LlcBlocks blocks; |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 1524 | var integer block_len, max_valid_data_len; |
| 1525 | timer T; |
| 1526 | |
| 1527 | block_len := f_rlcmac_cs_mcs2block_len(cs); |
| 1528 | /* We need to send with TLLI since we are in One-Phase Access Contenion |
| 1529 | * resoultion), so that's -4 bytes of data, -3 for headers, -1 for LI |
| 1530 | * indicator, -1 for spare bits octet at the end */ |
| 1531 | max_valid_data_len := block_len - 4 - 3 - 1 - 1; |
| 1532 | 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] | 1533 | blk_hdr := t_RLCMAC_LLCBLOCK_HDR(length_ind := lengthof(payload), |
| 1534 | more := false, e := true); |
| 1535 | blocks := { t_RLCMAC_LLCBLOCK(payload, blk_hdr) }; |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 1536 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := cs, |
| 1537 | tfi := ms.ul_tbf.tfi, |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 1538 | cv := cv, |
| 1539 | bsn := ms.ul_tbf.bsn, |
| 1540 | blocks := blocks, |
| 1541 | tlli := ms.tlli); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 1542 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 1543 | f_ms_tx_data_ind(ms, enc_RlcmacUlBlock(valueof(ul_data))); |
| 1544 | |
| 1545 | T.start(0.5); |
| 1546 | alt { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1547 | [] 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] | 1548 | setverdict(fail, "LLC PDU in Malformed RLC block was forwarded"); |
| 1549 | f_shutdown(__BFILE__, __LINE__); |
| 1550 | } |
| 1551 | [] T.timeout { |
| 1552 | setverdict(pass); |
| 1553 | } |
| 1554 | } |
| 1555 | } |
| 1556 | /* Verify PCU finds out incorrectly formated RLC block and discards it. This |
| 1557 | blocks intentionally contain last byte of data placed in last byte of RLC |
| 1558 | containing padding/spare bits, which is incorrect. Spare bits exist and are |
| 1559 | described for CS2..4 in 3GPP TS 44.060 Table 10.2.1: "RLC data block size, |
| 1560 | discounting padding in octet" */ |
| 1561 | testcase TC_ul_data_toolong_fills_padding() runs on RAW_PCU_Test_CT { |
| 1562 | var GprsMS ms; |
| 1563 | var integer block_len, max_valid_data_len; |
| 1564 | |
| 1565 | /* Initialize NS/BSSGP side */ |
| 1566 | f_init_bssgp(); |
| 1567 | /* Initialize GPRS MS side */ |
| 1568 | f_init_gprs_ms(); |
| 1569 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1570 | |
| 1571 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 1572 | 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] | 1573 | |
| 1574 | /* Establish BSSGP connection to the PCU */ |
| 1575 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 1576 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 1577 | |
| 1578 | /* Establish an Uplink TBF */ |
| 1579 | f_ms_establish_ul_tbf(ms); |
| 1580 | |
| 1581 | f_TC_ul_data_toolong_fills_padding_cs(ms, CS_2, 2); |
| 1582 | f_TC_ul_data_toolong_fills_padding_cs(ms, CS_3, 1); |
| 1583 | f_TC_ul_data_toolong_fills_padding_cs(ms, CS_4, 0); |
| 1584 | |
Vadim Yanitskiy | 8e6df0c | 2020-10-18 00:13:15 +0700 | [diff] [blame] | 1585 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 1586 | } |
| 1587 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1588 | /* Test scenario where MS wants to send some data on PDCH against SGSN and it is |
| 1589 | * answered, so TBFs for uplink and later for downlink are created. |
| 1590 | */ |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 1591 | 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] | 1592 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1593 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1594 | var uint32_t sched_fn; |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1595 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1596 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1597 | |
| 1598 | /* Initialize NS/BSSGP side */ |
| 1599 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1600 | /* Initialize GPRS MS side */ |
| 1601 | f_init_gprs_ms(); |
| 1602 | 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] | 1603 | |
| 1604 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 1605 | 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] | 1606 | |
| 1607 | /* Establish BSSGP connection to the PCU */ |
| 1608 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 1609 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1610 | |
| 1611 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1612 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1613 | |
Pau Espin Pedrol | 4aac3d0 | 2020-05-13 15:13:49 +0200 | [diff] [blame] | 1614 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 1615 | contention resoultion) and make sure it is ACKED fine */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1616 | 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] | 1617 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 1618 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1619 | 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] | 1620 | |
| 1621 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1622 | 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] | 1623 | |
| 1624 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1625 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 1626 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1627 | |
| 1628 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1629 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1630 | 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] | 1631 | |
| 1632 | /* ACK the DL block */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1633 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1634 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1635 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 1636 | |
| 1637 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1638 | } |
| 1639 | |
| 1640 | /* Test scenario where MS wants to send some data on PDCH against SGSN and it is |
| 1641 | * answered, so TBFs for uplink and later for downlink are created. |
| 1642 | */ |
| 1643 | testcase TC_mo_ping_pong() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 1644 | var template (present) CodingScheme exp_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 1645 | f_TC_mo_ping_pong_1phase_access(exp_cs_mcs); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1646 | } |
| 1647 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 1648 | /* Test scenario where MS wants to send some data on PDCH against SGSN and it is |
| 1649 | * answered, so TBFs for uplink and later for downlink are created. |
| 1650 | */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 1651 | private function f_TC_mo_ping_pong_2phase_access(PCUIF_Flags ind_flags, |
| 1652 | template (value) MSRadioAccessCapabilityV ms_racap, |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 1653 | template (present) CodingScheme exp_ul_cs_mcs := ?, |
| 1654 | template (present) CodingScheme exp_dl_cs_mcs := ?) |
| 1655 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 1656 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 1657 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 1658 | var PollFnCtx pollctx; |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 1659 | var uint32_t sched_fn; |
| 1660 | var uint32_t dl_fn; |
Pau Espin Pedrol | adbbe1e | 2020-05-17 00:28:01 +0200 | [diff] [blame] | 1661 | var uint32_t unused_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1662 | var GprsMS ms; |
| 1663 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 1664 | /* Initialize NS/BSSGP side */ |
| 1665 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1666 | /* Initialize GPRS MS side */ |
| 1667 | f_init_gprs_ms(); |
| 1668 | 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] | 1669 | |
| 1670 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 1671 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(ind_flags)); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 1672 | |
| 1673 | /* Establish BSSGP connection to the PCU */ |
| 1674 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 1675 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 1676 | |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 1677 | /* Send PACKET RESOURCE REQUEST to upgrade to EGPRS */ |
| 1678 | 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] | 1679 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1680 | if (not match(ms.ul_tbf.tx_cs_mcs, exp_ul_cs_mcs)) { |
| 1681 | 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] | 1682 | f_shutdown(__BFILE__, __LINE__); |
| 1683 | } |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 1684 | |
| 1685 | /* Send one UL block (without TLLI since we are in Second-Phase Access) |
| 1686 | and make sure it is ACKED fine */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 1687 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 1688 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 1689 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 1690 | 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] | 1691 | |
| 1692 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1693 | 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] | 1694 | |
| 1695 | /* Now SGSN sends some DL data, PCU will page on PACCH */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1696 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
Vadim Yanitskiy | 7431e9e | 2020-07-21 01:59:17 +0700 | [diff] [blame] | 1697 | 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] | 1698 | /* DL Ass sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1699 | 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] | 1700 | |
Pau Espin Pedrol | adbbe1e | 2020-05-17 00:28:01 +0200 | [diff] [blame] | 1701 | /* PCU acks the UL data after having received CV=0) */ |
| 1702 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 1703 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 1704 | /* 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] | 1705 | 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] | 1706 | |
| 1707 | /* ACK the DL block */ |
Pau Espin Pedrol | e8db673 | 2020-11-12 21:06:41 +0100 | [diff] [blame] | 1708 | f_dltbf_ack_block(ms.dl_tbf, dl_block, '1'B); |
| 1709 | 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] | 1710 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 1711 | |
| 1712 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1713 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1714 | |
| 1715 | 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] | 1716 | var template (present) CodingScheme exp_ul_cs_mcs := cs_gprs_any; |
| 1717 | var template (present) CodingScheme exp_dl_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1718 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1719 | 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 | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 1720 | } |
| 1721 | |
| 1722 | 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] | 1723 | var template (present) CodingScheme exp_ul_cs_mcs := mcs_egprs_any; |
| 1724 | var template (present) CodingScheme exp_dl_cs_mcs := mcs_egprs_any; |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 1725 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1726 | 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 | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1727 | } |
| 1728 | |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 1729 | testcase TC_force_two_phase_access() runs on RAW_PCU_Test_CT { |
| 1730 | /* Configure PCU to force two phase access */ |
| 1731 | g_force_two_phase_access := true; |
| 1732 | |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 1733 | 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] | 1734 | var template (present) CodingScheme exp_dl_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 1735 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1736 | 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 | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 1737 | } |
| 1738 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1739 | /* Test scenario where SGSN wants to send some data against MS and it is |
| 1740 | * answered by the MS on PDCH, so TBFs for downlink and later for uplink are created. |
| 1741 | */ |
Vadim Yanitskiy | c67240a | 2020-10-17 15:59:37 +0700 | [diff] [blame] | 1742 | private function f_TC_mt_ping_pong(template (omit) MSRadioAccessCapabilityV_BSSGP ms_racap := omit, |
| 1743 | template (present) CodingScheme exp_cs_mcs := ?) |
| 1744 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1745 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1746 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1747 | var uint32_t sched_fn; |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1748 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1749 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1750 | |
| 1751 | /* Initialize NS/BSSGP side */ |
| 1752 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1753 | /* Initialize GPRS MS side */ |
| 1754 | f_init_gprs_ms(); |
| 1755 | 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] | 1756 | |
| 1757 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 1758 | 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] | 1759 | |
| 1760 | /* Establish BSSGP connection to the PCU */ |
| 1761 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 1762 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1763 | |
| 1764 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1765 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap)); |
| 1766 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1767 | |
| 1768 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1769 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1770 | 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] | 1771 | |
Pau Espin Pedrol | 6791eb6 | 2020-05-20 18:27:10 +0200 | [diff] [blame] | 1772 | /* 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] | 1773 | f_dltbf_ack_block(ms.dl_tbf, dl_block, '1'B); |
| 1774 | 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] | 1775 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1776 | |
Pau Espin Pedrol | 6791eb6 | 2020-05-20 18:27:10 +0200 | [diff] [blame] | 1777 | /* Expect UL ass */ |
Vadim Yanitskiy | 7431e9e | 2020-07-21 01:59:17 +0700 | [diff] [blame] | 1778 | 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] | 1779 | |
Pau Espin Pedrol | 4aac3d0 | 2020-05-13 15:13:49 +0200 | [diff] [blame] | 1780 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 1781 | contention resoultion) and make sure it is ACKED fine */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1782 | 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] | 1783 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 1784 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1785 | 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] | 1786 | |
| 1787 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1788 | 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] | 1789 | |
| 1790 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1791 | } |
| 1792 | |
| 1793 | testcase TC_mt_ping_pong() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 1794 | var template (present) CodingScheme exp_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1795 | f_TC_mt_ping_pong(omit, exp_cs_mcs); |
| 1796 | } |
| 1797 | |
| 1798 | /* TC_mt_ping_pong, but DL-UNITDATA contains RA Access capability with (M)CS |
| 1799 | /* information about the MS */ |
| 1800 | 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] | 1801 | var template (present) CodingScheme exp_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1802 | 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] | 1803 | } |
| 1804 | |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1805 | /* Verify that if PCU doesn't get one of the intermediate UL data blocks in a UL |
| 1806 | * TBF, it will request retransmission through UL ACK/NACK (with missing block |
| 1807 | * in its bitmap) when CV=0 is received (and hence it knows no more data is to |
| 1808 | * be transferred). |
| 1809 | */ |
| 1810 | testcase TC_ul_intermediate_retrans() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1811 | var RlcmacDlBlock dl_block; |
| 1812 | var template (value) RlcmacUlBlock ul_data; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1813 | var uint32_t sched_fn; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1814 | var octetstring total_payload; |
| 1815 | var octetstring payload; |
| 1816 | var octetstring lost_payload; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1817 | var uint5_t tfi; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1818 | var GprsMS ms; |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 1819 | var uint32_t payload_fill_len; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1820 | |
| 1821 | /* Initialize NS/BSSGP side */ |
| 1822 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1823 | /* Initialize GPRS MS side */ |
| 1824 | f_init_gprs_ms(); |
| 1825 | 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] | 1826 | |
| 1827 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 1828 | 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] | 1829 | |
| 1830 | /* Establish BSSGP connection to the PCU */ |
| 1831 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 1832 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1833 | |
| 1834 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1835 | f_ms_establish_ul_tbf(ms); |
| 1836 | tfi := ms.ul_tbf.tfi; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1837 | |
| 1838 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 1839 | contention resoultion) and make sure it is ACKED fine. */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 1840 | 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 | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1841 | f_ms_tx_ul_data_block(ms, payload, cv := 15, with_tlli := true); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1842 | |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1843 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 1844 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1845 | 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] | 1846 | total_payload := payload; |
| 1847 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 1848 | payload_fill_len := f_ultbf_payload_fill_length(ms.ul_tbf); |
| 1849 | |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1850 | /* Send 2 packets, skip 1 (inc bsn) and send another one */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 1851 | payload := f_rnd_octstring(payload_fill_len); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1852 | f_ms_tx_ul_data_block(ms, payload, cv := 15); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1853 | total_payload := total_payload & payload; |
| 1854 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 1855 | payload := f_rnd_octstring(payload_fill_len); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1856 | f_ms_tx_ul_data_block(ms, payload, cv := 15); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1857 | total_payload := total_payload & payload; |
| 1858 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 1859 | lost_payload := f_rnd_octstring(payload_fill_len); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1860 | 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] | 1861 | total_payload := total_payload & lost_payload; |
| 1862 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 1863 | payload := f_rnd_octstring(payload_fill_len) |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1864 | f_ms_tx_ul_data_block(ms, payload, cv := 15); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1865 | total_payload := total_payload & payload; |
| 1866 | |
| 1867 | /* 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] | 1868 | 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] | 1869 | |
| 1870 | /* On CV=0, we'll receive a UL ACK asking about missing block */ |
| 1871 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 1872 | /* TODO: check ack ack bitmap (URBB) */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 1873 | ul_data := t_RLCMAC_UL_DATA(cs := ms.ul_tbf.tx_cs_mcs, |
| 1874 | tfi := tfi, |
| 1875 | cv := 15, |
| 1876 | bsn := 3, |
| 1877 | blocks := {t_RLCMAC_LLCBLOCK(lost_payload)}); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1878 | f_ms_tx_ul_block(ms, ul_data); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1879 | |
| 1880 | /* Now final ack is recieved */ |
| 1881 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 1882 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1883 | 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] | 1884 | |
| 1885 | /* receive one message on BSSGP with all aggregated data in payload: */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 1886 | 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] | 1887 | |
| 1888 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 1889 | } |
| 1890 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1891 | /* Verify that if PCU doesn't get an ACK for first DL block after IMM ASS, it |
| 1892 | * will retry by retransmitting both the IMM ASS + DL block after poll (ack) |
| 1893 | * timeout occurs (specified by sent RRBP on DL block). */ |
| 1894 | 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] | 1895 | var RlcmacDlBlock dl_block; |
| 1896 | var octetstring data := f_rnd_octstring(10); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1897 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1898 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1899 | |
| 1900 | /* Initialize NS/BSSGP side */ |
| 1901 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1902 | /* Initialize GPRS MS side */ |
| 1903 | f_init_gprs_ms(); |
| 1904 | 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] | 1905 | |
| 1906 | /* Initialize the PCU interface abstraction */ |
| 1907 | f_init_raw(testcasename()); |
| 1908 | |
| 1909 | /* Establish BSSGP connection to the PCU */ |
| 1910 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 1911 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1912 | |
| 1913 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1914 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 1915 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1916 | |
| 1917 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1918 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1919 | 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] | 1920 | |
| 1921 | /* Now we don't ack the dl block (emulate MS failed receiveing IMM ASS |
| 1922 | * or GPRS DL, or DL ACK was lost for some reason). As a result, PCU |
| 1923 | * should retrigger IMM ASS + GPRS DL procedure after poll timeout. */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1924 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Vadim Yanitskiy | 2e213ae | 2020-05-06 22:26:17 +0700 | [diff] [blame] | 1925 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1926 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1927 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1928 | 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] | 1929 | |
| 1930 | /* ACK the DL block */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1931 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1932 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1933 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 1934 | |
| 1935 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1936 | } |
| 1937 | |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 1938 | /* Verify scheduling of multiple Downlink data blocks during one RRBP. */ |
| 1939 | testcase TC_dl_flow_more_blocks() runs on RAW_PCU_Test_CT { |
| 1940 | var AckNackDescription ack_nack_desc := valueof(t_AckNackDescription_init); |
| 1941 | var octetstring data := f_rnd_octstring(16); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 1942 | var PacketDlAssign dl_tbf_ass; |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 1943 | var RlcmacDlBlock dl_block; |
| 1944 | var uint32_t ack_fn; |
| 1945 | var uint32_t fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1946 | var GprsMS ms; |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 1947 | timer T := 5.0; |
| 1948 | |
| 1949 | /* Initialize NS/BSSGP side */ |
| 1950 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1951 | /* Initialize GPRS MS side */ |
| 1952 | f_init_gprs_ms(); |
| 1953 | ms := g_ms[0]; /* We only use first MS in this test */ |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 1954 | |
| 1955 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 1956 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 1957 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 1958 | f_statsd_reset(); |
| 1959 | |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 1960 | /* Establish BSSGP connection to the PCU */ |
| 1961 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 1962 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 1963 | |
| 1964 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1965 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 1966 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 1967 | |
| 1968 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 1969 | f_sleep(X2002); |
| 1970 | |
| 1971 | /* Expect the first (GPRS DL) block with bsn=0 and rrbp_valid=1 */ |
| 1972 | f_rx_rlcmac_dl_block_exp_data(dl_block, fn, data, 0); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1973 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 1974 | |
| 1975 | /* TDMA frame number on which we are supposed to send the ACK */ |
| 1976 | ack_fn := f_dl_block_ack_fn(dl_block, fn); |
| 1977 | |
| 1978 | /* SGSN sends more blocks during the indicated RRBP */ |
| 1979 | for (var integer bsn := 1; bsn < 63; bsn := bsn + 1) { |
| 1980 | data := f_rnd_octstring(16); /* Random LLC data */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1981 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 1982 | |
| 1983 | f_rx_rlcmac_dl_block_exp_data(dl_block, fn, data, bsn); |
| 1984 | |
| 1985 | /* Make sure this block has the same TFI as was assigned |
| 1986 | * FIXME: this is only valid for GPRS, not EGPRS. */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1987 | 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] | 1988 | setverdict(fail, "Rx DL data block with unexpected TFI: ", |
| 1989 | dl_block.data.mac_hdr.hdr_ext.tfi); |
| 1990 | f_shutdown(__BFILE__, __LINE__); |
| 1991 | } |
| 1992 | |
| 1993 | /* Keep Ack/Nack description updated */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1994 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 1995 | |
| 1996 | /* Break if this is the end of RRBP */ |
| 1997 | if (fn == ack_fn) { |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1998 | ms.dl_tbf.acknack_desc.final_ack := '1'B; |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 1999 | break; |
| 2000 | } |
| 2001 | } |
| 2002 | |
| 2003 | /* This is the end of RRBP, send Packet Downlink Ack/Nack */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2004 | 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] | 2005 | |
| 2006 | /* Make sure that the next block (after the Ack) is dummy */ |
| 2007 | f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 2008 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 2009 | var StatsDExpects expect := { |
| 2010 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 0, max := 0}, |
| 2011 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 1, max := 1}, |
| 2012 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 0, max := 0}, |
| 2013 | { name := "TTCN3.bts.0.tbf.dl.alloc", mtype := "c", min := 1, max := 1}, |
| 2014 | { 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] | 2015 | { 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] | 2016 | { name := "TTCN3.bts.0.rlc.ul_payload_bytes", mtype := "c", min := 0, max := 0} |
| 2017 | }; |
| 2018 | f_statsd_expect(expect); |
| 2019 | |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2020 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2021 | } |
| 2022 | |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2023 | /* Verify Decoding and segmentation of UL LLC PDUs into RLC data blocks, OS#4559. |
| 2024 | * Check "GPRS from A-Z" slide "Example of LI-Field and E-Bit" page 186. |
| 2025 | * Check "3GPP TS 44.060" Annex B. */ |
| 2026 | testcase TC_ul_flow_multiple_llc_blocks() runs on RAW_PCU_Test_CT { |
| 2027 | var RlcmacDlBlock dl_block; |
| 2028 | var octetstring dataA := f_rnd_octstring(20); |
| 2029 | var octetstring dataB := f_rnd_octstring(13); |
| 2030 | var octetstring dataC := f_rnd_octstring(3); |
| 2031 | var octetstring dataD := f_rnd_octstring(12); |
| 2032 | var uint32_t sched_fn; |
| 2033 | var GprsMS ms; |
| 2034 | var template (value) RlcmacUlBlock ul_data; |
| 2035 | |
| 2036 | /* Initialize NS/BSSGP side */ |
| 2037 | f_init_bssgp(); |
| 2038 | /* Initialize GPRS MS side */ |
| 2039 | f_init_gprs_ms(); |
| 2040 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2041 | |
| 2042 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2043 | 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] | 2044 | |
| 2045 | /* Establish BSSGP connection to the PCU */ |
| 2046 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2047 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2048 | |
| 2049 | /* Establish an Uplink TBF */ |
| 2050 | f_ms_establish_ul_tbf(ms); |
| 2051 | |
| 2052 | /* Summary of what's transmitted: |
| 2053 | * 1- UL RlcDataBlock(dataA) [BSN=0, CV=3] |
| 2054 | * 2- UL RlcDataBlock(dataA finished, dataB starts) [BSN=1, CV=2] |
| 2055 | * 3- UL RlcDataBlock(dataB finished, dataC starts and finishes, dataD starts) [BSN=2, CV=1] |
| 2056 | * 4- UL RlcDataBlock(dataD finishes) [BSN=3, CV=0] |
| 2057 | * And on SGSN we receive 4 packets, one for each LlcBlock dataA..D. |
| 2058 | * We'll also receive some UL ACK/NACK we need to reply with CTRL ACK. |
| 2059 | */ |
| 2060 | |
| 2061 | /* UL RlcDataBlock(dataA) [BSN=0, CV=3] */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2062 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := CS_1, |
| 2063 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2064 | cv := 3, |
| 2065 | bsn := ms.ul_tbf.bsn, |
| 2066 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataA, 0, 16)) }, |
| 2067 | tlli := ms.tlli); |
| 2068 | /* Indicate no llc header, meaning first LLC block doesn't finish in current |
| 2069 | * RLCMAC block being sent. */ |
| 2070 | ul_data.data.mac_hdr.e := true; |
| 2071 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2072 | f_ms_tx_ul_block(ms, ul_data); |
| 2073 | |
| 2074 | /* UL RlcDataBlock(dataA finished, dataB starts) [BSN=1, CV=2] */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2075 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := CS_1, |
| 2076 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2077 | cv := 2, |
| 2078 | bsn := ms.ul_tbf.bsn, |
| 2079 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataA, 16, 4), |
| 2080 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 4, more := true, e := true)), |
| 2081 | t_RLCMAC_LLCBLOCK(substr(dataB, 0, 11)) |
| 2082 | }, |
| 2083 | tlli := ms.tlli); |
| 2084 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2085 | f_ms_tx_ul_block(ms, ul_data); |
| 2086 | |
| 2087 | /* UL block dataA should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2088 | 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] | 2089 | |
| 2090 | /* 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] | 2091 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := CS_1, |
| 2092 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2093 | cv := 1, |
| 2094 | bsn := ms.ul_tbf.bsn, |
| 2095 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataB, 11, 2), |
| 2096 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 2, more := true, e := false)), |
| 2097 | t_RLCMAC_LLCBLOCK(substr(dataC, 0, 3), |
| 2098 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 3, more := true, e := true)), |
| 2099 | t_RLCMAC_LLCBLOCK(substr(dataD, 0, 9)) |
| 2100 | }, |
| 2101 | tlli := ms.tlli); |
| 2102 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2103 | f_ms_tx_ul_block(ms, ul_data); |
| 2104 | |
| 2105 | /* UL block dataB and dataC should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2106 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id, dataB)); |
| 2107 | 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] | 2108 | |
| 2109 | /* UL RlcDataBlock(dataD finishes) [BSN=3, CV=0] */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2110 | ul_data := t_RLCMAC_UL_DATA_TLLI( |
| 2111 | cs := CS_1, |
| 2112 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2113 | cv := 0, |
| 2114 | bsn := ms.ul_tbf.bsn, |
| 2115 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataD, 9, 3), |
| 2116 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 3, more := false, e := true)) |
| 2117 | }, |
| 2118 | tlli := ms.tlli); |
| 2119 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2120 | f_ms_tx_ul_block(ms, ul_data); |
| 2121 | |
| 2122 | /* UL block dataB and dataD should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2123 | 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] | 2124 | |
| 2125 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2126 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2127 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 2128 | |
| 2129 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2130 | } |
| 2131 | |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 2132 | /* Verify allocation and use of multislot tbf, triggered by MS class provided in SGSN. SYS#5131 */ |
| 2133 | 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] | 2134 | 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] | 2135 | var octetstring data := f_rnd_octstring(10); |
| 2136 | var PacketDlAssign dl_tbf_ass; |
| 2137 | var RlcmacDlBlock dl_block; |
| 2138 | var uint32_t poll_fn; |
| 2139 | var uint32_t sched_fn; |
| 2140 | var GprsMS ms; |
| 2141 | timer T := 5.0; |
| 2142 | |
| 2143 | /* Initialize NS/BSSGP side */ |
| 2144 | f_init_bssgp(); |
| 2145 | /* Initialize GPRS MS side */ |
| 2146 | f_init_gprs_ms(); |
| 2147 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2148 | |
| 2149 | /* Only 1 TRX with 8 PDCH */ |
| 2150 | f_PCUIF_ver_INFO_PDCHMask_set(info_ind, '11111111'B, 0); |
| 2151 | f_PCUIF_ver_INFO_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 2152 | |
| 2153 | /* Initialize the PCU interface abstraction */ |
| 2154 | f_init_raw(testcasename(), info_ind); |
| 2155 | |
| 2156 | /* Establish BSSGP connection to the PCU */ |
| 2157 | f_bssgp_establish(); |
| 2158 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 2159 | |
| 2160 | /* Establish an Uplink TBF, this way the PCU can send DL Assignment |
| 2161 | through PDCH (no multiblock assignment possible through PCH) */ |
| 2162 | f_ms_establish_ul_tbf(ms); |
| 2163 | |
| 2164 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 2165 | contention resoultion) and make sure it is ACKED fine */ |
| 2166 | f_ms_tx_ul_data_block(ms, data, with_tlli := true, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2167 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2168 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, poll_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2169 | |
| 2170 | /* SGSN sends some DL data, PCU will assign DL TBF through PACCH */ |
| 2171 | var MultislotCap_GPRS_BSSGP mscap_gprs := { |
| 2172 | gprsmultislotclass := '10010'B, /* MS class 18, supports 8 DL and 8 UL */ |
| 2173 | gprsextendeddynalloccap := '0'B |
| 2174 | }; |
| 2175 | var MSRadioAccessCapabilityV_BSSGP ms_racap := { valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, mscap_gprs, omit)) }; |
| 2176 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap)); |
| 2177 | dl_block := f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2178 | if (f_dltbf_num_slots(ms.dl_tbf) != 8) { |
| 2179 | setverdict(fail, "Expected 8 PDCH slots allocated but got ", f_dltbf_num_slots(ms.dl_tbf)); |
| 2180 | f_shutdown(__BFILE__, __LINE__); |
| 2181 | } |
| 2182 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2183 | |
| 2184 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2185 | } |
| 2186 | |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 2187 | 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] | 2188 | 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] | 2189 | var RlcmacDlBlock dl_block; |
| 2190 | var octetstring data := f_rnd_octstring(10); |
| 2191 | var PollFnCtx pollctx; |
| 2192 | var uint32_t sched_fn; |
| 2193 | var GprsMS ms; |
| 2194 | |
| 2195 | var MultislotCap_GPRS mscap_gprs := { |
| 2196 | gprsmultislotclass := '10010'B, /* MS class 18, supports 8 DL and 8 UL */ |
| 2197 | gprsextendeddynalloccap := '0'B |
| 2198 | }; |
| 2199 | var MSRadioAccessCapabilityV ms_racap := { valueof(ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs, omit)) }; |
| 2200 | |
| 2201 | |
| 2202 | /* Initialize NS/BSSGP side */ |
| 2203 | f_init_bssgp(); |
| 2204 | /* Initialize GPRS MS side */ |
| 2205 | f_init_gprs_ms(); |
| 2206 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2207 | |
| 2208 | /* Only 1 TRX with 8 PDCH */ |
| 2209 | f_PCUIF_ver_INFO_PDCHMask_set(info_ind, '11111111'B, 0); |
| 2210 | f_PCUIF_ver_INFO_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 2211 | |
| 2212 | /* Initialize the PCU interface abstraction */ |
| 2213 | f_init_raw(testcasename(), info_ind); |
| 2214 | |
| 2215 | /* Establish BSSGP connection to the PCU */ |
| 2216 | f_bssgp_establish(); |
| 2217 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 2218 | |
| 2219 | /* Send PACKET RESOURCE REQUEST to notify the MultiSlot Class */ |
| 2220 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap)); |
| 2221 | |
| 2222 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2223 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 2224 | |
| 2225 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 2226 | dl_block := f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2227 | if (f_dltbf_num_slots(ms.dl_tbf) != 8) { |
| 2228 | setverdict(fail, "Expected 8 PDCH slot allocated but got ", f_dltbf_num_slots(ms.dl_tbf)); |
| 2229 | f_shutdown(__BFILE__, __LINE__); |
| 2230 | } |
| 2231 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2232 | |
| 2233 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2234 | } |
| 2235 | |
Pau Espin Pedrol | a9f27fa | 2020-10-30 13:16:21 +0100 | [diff] [blame] | 2236 | testcase TC_ul_multislot_tbf_ms_class_from_2phase() runs on RAW_PCU_Test_CT { |
| 2237 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 2238 | var RlcmacDlBlock dl_block; |
| 2239 | var octetstring data := f_rnd_octstring(10); |
| 2240 | var PollFnCtx pollctx; |
| 2241 | var uint32_t sched_fn; |
| 2242 | var GprsMS ms; |
| 2243 | |
| 2244 | var MultislotCap_GPRS mscap_gprs := { |
| 2245 | gprsmultislotclass := '10010'B, /* MS class 18, supports 8 DL and 8 UL */ |
| 2246 | gprsextendeddynalloccap := '0'B |
| 2247 | }; |
| 2248 | var MSRadioAccessCapabilityV ms_racap := { valueof(ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs, omit)) }; |
| 2249 | |
| 2250 | |
| 2251 | /* Initialize NS/BSSGP side */ |
| 2252 | f_init_bssgp(); |
| 2253 | /* Initialize GPRS MS side */ |
| 2254 | f_init_gprs_ms(); |
| 2255 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2256 | |
| 2257 | /* Only 1 TRX with 8 PDCH */ |
| 2258 | f_PCUIF_ver_INFO_PDCHMask_set(info_ind, '11111111'B, 0); |
| 2259 | f_PCUIF_ver_INFO_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 2260 | |
| 2261 | /* Initialize the PCU interface abstraction */ |
| 2262 | f_init_raw(testcasename(), info_ind); |
| 2263 | |
| 2264 | /* Establish BSSGP connection to the PCU */ |
| 2265 | f_bssgp_establish(); |
| 2266 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 2267 | |
| 2268 | /* Send PACKET RESOURCE REQUEST to notify the MultiSlot Class */ |
| 2269 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap)); |
| 2270 | |
| 2271 | if (f_ultbf_num_slots(ms.ul_tbf) != 8) { |
| 2272 | setverdict(fail, "Expected 8 PDCH slot allocated but got ", f_ultbf_num_slots(ms.ul_tbf)); |
| 2273 | f_shutdown(__BFILE__, __LINE__); |
| 2274 | } |
| 2275 | |
| 2276 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2277 | } |
| 2278 | |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 2279 | /* Test scenario where MS wants to request a new TBF once the current one is |
| 2280 | * ending, by means of sending a Packet Resource Request on ul slot provided by |
| 2281 | * last Pkt Ul ACK's RRBP. |
| 2282 | * See 3GPP TS 44.060 sec 9.3.2.4.2 "Non-extended uplink TBF mode" */ |
| 2283 | 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] | 2284 | var RlcmacDlBlock dl_block; |
| 2285 | var octetstring data := f_rnd_octstring(10); |
| 2286 | var uint32_t sched_fn; |
| 2287 | var uint32_t dl_fn; |
| 2288 | var template RlcmacDlBlock acknack_tmpl; |
| 2289 | var GprsMS ms; |
| 2290 | |
| 2291 | /* Initialize NS/BSSGP side */ |
| 2292 | f_init_bssgp(); |
| 2293 | /* Initialize GPRS MS side */ |
| 2294 | f_init_gprs_ms(); |
| 2295 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2296 | |
| 2297 | /* Initialize the PCU interface abstraction */ |
| 2298 | f_init_raw(testcasename()); |
| 2299 | |
| 2300 | /* Establish BSSGP connection to the PCU */ |
| 2301 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2302 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 2303 | |
| 2304 | /* Establish an Uplink TBF */ |
| 2305 | f_ms_establish_ul_tbf(ms); |
| 2306 | |
| 2307 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 2308 | contention resoultion) and make sure it is ACKED fine */ |
| 2309 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true); |
| 2310 | |
| 2311 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2312 | 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] | 2313 | |
| 2314 | acknack_tmpl := tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, |
| 2315 | tr_UlAckNackGprs(ms.tlli, |
| 2316 | tr_AckNackDescription(final_ack := '1'B), |
| 2317 | tr_UlAckNackGprsAdditionsRel99(tbf_est := true))) |
| 2318 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn, acknack_tmpl); |
| 2319 | |
| 2320 | /* TODO: verify TBF_EST and FinalACK are both '1' above */ |
| 2321 | |
| 2322 | /* Send PACKET RESOURCE REQUEST to request a new UL TBF */ |
Vadim Yanitskiy | f3cb4dd | 2020-07-21 01:52:33 +0700 | [diff] [blame] | 2323 | 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] | 2324 | 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] | 2325 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2326 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 2327 | |
| 2328 | /* Send one UL block (without TLLI since we are in Second-Phase Access) |
| 2329 | and make sure it is ACKED fine */ |
| 2330 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := false); /* TODO: send using cs_mcs */ |
| 2331 | |
| 2332 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2333 | 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] | 2334 | |
| 2335 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn, acknack_tmpl); |
| 2336 | /* ACK the ACK */ |
| 2337 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 2338 | |
| 2339 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2340 | } |
| 2341 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2342 | /* Test CS paging over the BTS<->PCU socket. |
| 2343 | * 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. |
| 2344 | * Paging should be send on the PACCH. |
| 2345 | * |
| 2346 | * 1. Send a Paging Request over PCU socket. |
| 2347 | * 2. Send a Ready-To-Send message over PCU socket |
| 2348 | * 3. Expect a Paging Frame |
| 2349 | */ |
| 2350 | 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] | 2351 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2352 | var MobileIdentityLV mi; |
| 2353 | var octetstring mi_enc_lv; |
| 2354 | var hexstring imsi := f_gen_imsi(42); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2355 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2356 | |
| 2357 | /* Initialize NS/BSSGP side */ |
| 2358 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2359 | /* Initialize GPRS MS side */ |
| 2360 | f_init_gprs_ms(); |
| 2361 | 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] | 2362 | |
| 2363 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2364 | 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] | 2365 | |
| 2366 | /* Establish BSSGP connection to the PCU */ |
| 2367 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2368 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2369 | |
| 2370 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2371 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2372 | |
| 2373 | /* build mobile Identity */ |
| 2374 | mi := valueof(ts_MI_IMSI_LV(imsi)); |
| 2375 | mi_enc_lv := enc_MobileIdentityLV(mi); |
| 2376 | /* Send paging request */ |
| 2377 | BTS.send(ts_PCUIF_PAG_REQ(bts_nr := 0, id_lv := mi_enc_lv, chan_needed := 0, |
| 2378 | sapi :=PCU_IF_SAPI_PDTCH)); |
| 2379 | |
| 2380 | /* Receive it on BTS side towards MS */ |
| 2381 | f_rx_rlcmac_dl_block_exp_pkt_pag_req(dl_block); |
| 2382 | |
| 2383 | /* Make sure that Packet Paging Request contains the same IMSI */ |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 2384 | var PacketPagingReq req := dl_block.ctrl.payload.u.paging; |
| 2385 | if (not f_pkt_paging_match_imsi(req, imsi, ps_domain := false)) { |
| 2386 | setverdict(fail, "Failed to match IMSI ", imsi, " in ", req); |
| 2387 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2388 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 2389 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2390 | } |
| 2391 | |
| 2392 | /* Test CS paging over Gb (SGSN->PCU->BTS[PDCH]). |
| 2393 | */ |
| 2394 | private function f_tc_paging_cs_from_sgsn(Nsvci bvci, boolean use_ptmsi := false) |
| 2395 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2396 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2397 | var hexstring imsi := f_gen_imsi(42); |
| 2398 | var GsmTmsi tmsi; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2399 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2400 | |
| 2401 | /* Initialize NS/BSSGP side */ |
| 2402 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2403 | /* Initialize GPRS MS side */ |
| 2404 | f_init_gprs_ms(); |
| 2405 | 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] | 2406 | |
| 2407 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2408 | 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] | 2409 | |
| 2410 | /* Establish BSSGP connection to the PCU */ |
| 2411 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2412 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2413 | |
| 2414 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2415 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2416 | |
| 2417 | /* Send paging request with or without TMSI */ |
| 2418 | if (use_ptmsi) { |
| 2419 | tmsi := oct2int(f_rnd_octstring(4)); /* Random P-TMSI */ |
| 2420 | BSSGP[0].send(ts_BSSGP_CS_PAGING_PTMSI(bvci, imsi, tmsi)); |
| 2421 | } else { |
| 2422 | BSSGP[0].send(ts_BSSGP_CS_PAGING_IMSI(bvci, imsi)); |
| 2423 | } |
| 2424 | |
| 2425 | /* Receive it on BTS side towards MS */ |
| 2426 | f_rx_rlcmac_dl_block_exp_pkt_pag_req(dl_block); |
| 2427 | |
| 2428 | /* Make sure that Packet Paging Request contains the same P-TMSI/IMSI */ |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 2429 | var PacketPagingReq req := dl_block.ctrl.payload.u.paging; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2430 | if (use_ptmsi) { |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 2431 | if (not f_pkt_paging_match_tmsi(req, tmsi, ps_domain := false)) { |
| 2432 | setverdict(fail, "Failed to match P-TMSI ", tmsi, " in ", req); |
| 2433 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2434 | } else { |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 2435 | if (not f_pkt_paging_match_imsi(req, imsi, ps_domain := false)) { |
| 2436 | setverdict(fail, "Failed to match IMSI ", imsi, " in ", req); |
| 2437 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2438 | } |
| 2439 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 2440 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2441 | } |
| 2442 | |
| 2443 | testcase TC_paging_cs_from_sgsn_sign_ptmsi() runs on RAW_PCU_Test_CT { |
| 2444 | f_tc_paging_cs_from_sgsn(0, true); |
| 2445 | } |
| 2446 | |
| 2447 | testcase TC_paging_cs_from_sgsn_sign() runs on RAW_PCU_Test_CT { |
| 2448 | f_tc_paging_cs_from_sgsn(0); |
| 2449 | } |
| 2450 | |
| 2451 | 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] | 2452 | 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] | 2453 | } |
| 2454 | |
| 2455 | /* Test PS paging over Gb (SGSN->PCU->BTS[CCCH]). |
| 2456 | */ |
| 2457 | private function f_tc_paging_ps_from_sgsn(Nsvci bvci, boolean use_ptmsi := false) |
| 2458 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2459 | var integer imsi_suff_tx := 423; |
| 2460 | var hexstring imsi := f_gen_imsi(imsi_suff_tx); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2461 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2462 | |
| 2463 | /* Initialize NS/BSSGP side */ |
| 2464 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2465 | /* Initialize GPRS MS side */ |
| 2466 | f_init_gprs_ms(); |
| 2467 | 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] | 2468 | |
| 2469 | /* Initialize the PCU interface abstraction */ |
| 2470 | f_init_raw(testcasename()); |
| 2471 | |
| 2472 | /* Establish BSSGP connection to the PCU */ |
| 2473 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2474 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2475 | |
| 2476 | /* Send BSSGP PAGING-PS (with or without TMSI), wait for RR Paging Request Type 1. |
| 2477 | * Make sure that both paging group (IMSI suffix) and Mobile Identity match. */ |
| 2478 | if (use_ptmsi) { |
| 2479 | var OCT4 tmsi := f_rnd_octstring(4); /* Random P-TMSI */ |
| 2480 | BSSGP[0].send(ts_BSSGP_PS_PAGING_PTMSI(bvci, imsi, oct2int(tmsi))); |
| 2481 | f_pcuif_rx_pch_pag_req1(t_MI_TMSI(tmsi), imsi_suff_tx); |
| 2482 | } else { |
| 2483 | BSSGP[0].send(ts_BSSGP_PS_PAGING_IMSI(bvci, imsi)); |
| 2484 | f_pcuif_rx_pch_pag_req1(tr_MI_IMSI(imsi), imsi_suff_tx); |
| 2485 | } |
| 2486 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 2487 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2488 | } |
| 2489 | |
| 2490 | testcase TC_paging_ps_from_sgsn_sign_ptmsi() runs on RAW_PCU_Test_CT { |
| 2491 | f_tc_paging_ps_from_sgsn(0, true); |
| 2492 | } |
| 2493 | |
| 2494 | testcase TC_paging_ps_from_sgsn_sign() runs on RAW_PCU_Test_CT { |
| 2495 | f_tc_paging_ps_from_sgsn(0); |
| 2496 | } |
| 2497 | |
| 2498 | testcase TC_paging_ps_from_sgsn_ptp() runs on RAW_PCU_Test_CT { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2499 | f_tc_paging_ps_from_sgsn(mp_gb_cfg.bvc[0].bvci); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2500 | } |
| 2501 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 2502 | /* Verify osmo-pcu handles DL UNIT_DATA from SGSN with IMSI IE correctly. See OS#4729 */ |
| 2503 | testcase TC_bssgp_dl_unitdata_with_valid_imsi() runs on RAW_PCU_Test_CT { |
| 2504 | var RlcmacDlBlock dl_block; |
| 2505 | var octetstring data := f_rnd_octstring(10); |
| 2506 | var uint32_t sched_fn; |
| 2507 | var uint32_t dl_fn; |
| 2508 | var GprsMS ms; |
| 2509 | |
| 2510 | /* Initialize NS/BSSGP side */ |
| 2511 | f_init_bssgp(); |
| 2512 | /* Initialize GPRS MS side */ |
| 2513 | f_init_gprs_ms(); |
| 2514 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2515 | |
| 2516 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2517 | 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] | 2518 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 2519 | f_statsd_reset(); |
| 2520 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 2521 | /* Establish BSSGP connection to the PCU */ |
| 2522 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2523 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 2524 | |
| 2525 | /* Establish an Uplink TBF */ |
| 2526 | f_ms_establish_ul_tbf(ms); |
| 2527 | |
| 2528 | /* Fake GMM GPRS Attach or similar, PCU doesn't care about upper layers here */ |
| 2529 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true); |
| 2530 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2531 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2532 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 2533 | |
| 2534 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2535 | 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] | 2536 | |
| 2537 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 2538 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi))); |
| 2539 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 2540 | |
| 2541 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2542 | f_sleep(X2002); |
| 2543 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 2544 | |
| 2545 | /* ACK the DL block */ |
| 2546 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 2547 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 2548 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 2549 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 2550 | var StatsDExpects expect := { |
| 2551 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 1, max := 1}, |
| 2552 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 1, max := 1}, |
| 2553 | { name := "TTCN3.bts.0.tbf.dl.alloc", mtype := "c", min := 1, max := 1}, |
| 2554 | { 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] | 2555 | { 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] | 2556 | { 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] | 2557 | }; |
| 2558 | f_statsd_expect(expect); |
| 2559 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 2560 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2561 | } |
| 2562 | |
| 2563 | /* Verify osmo-pcu acts on incorrect IMSI IE content in DL UNIT_DATA from SGSN. See OS#4729 */ |
| 2564 | testcase TC_bssgp_dl_unitdata_with_invalid_imsi() runs on RAW_PCU_Test_CT { |
| 2565 | var RlcmacDlBlock dl_block; |
| 2566 | var octetstring data := f_rnd_octstring(10); |
| 2567 | var uint32_t sched_fn; |
| 2568 | var uint32_t dl_fn; |
| 2569 | var GprsMS ms; |
| 2570 | |
| 2571 | /* Initialize NS/BSSGP side */ |
| 2572 | f_init_bssgp(); |
| 2573 | /* Initialize GPRS MS side */ |
| 2574 | f_init_gprs_ms(); |
| 2575 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2576 | |
| 2577 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2578 | 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] | 2579 | |
| 2580 | /* Establish BSSGP connection to the PCU */ |
| 2581 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2582 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 2583 | |
| 2584 | /* Establish an Uplink TBF */ |
| 2585 | f_ms_establish_ul_tbf(ms); |
| 2586 | |
| 2587 | /* Fake GMM GPRS Attach or similar, PCU doesn't care about upper layers here */ |
| 2588 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true); |
| 2589 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2590 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2591 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 2592 | |
| 2593 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2594 | 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] | 2595 | |
| 2596 | /* Now SGSN sends some DL data with an invalid IMSI */ |
| 2597 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI('1122'H))); |
| 2598 | |
Pau Espin Pedrol | f7e947a | 2021-01-25 18:51:33 +0100 | [diff] [blame] | 2599 | 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] | 2600 | |
| 2601 | /* TODO: make sure no data is sent over PCU -> MS */ |
| 2602 | |
| 2603 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2604 | } |
| 2605 | |
Pau Espin Pedrol | 2e459d6 | 2020-11-30 19:34:16 +0100 | [diff] [blame] | 2606 | private function f_tc_dl_data_no_llc_ui_dummy(template (omit) MSRadioAccessCapabilityV_BSSGP ms_racap := omit) runs on RAW_PCU_Test_CT { |
| 2607 | var AckNackDescription ack_nack_desc := valueof(t_AckNackDescription_init); |
| 2608 | var octetstring data := f_rnd_octstring(6); |
| 2609 | var RlcmacDlBlock dl_block; |
| 2610 | var GprsMS ms; |
| 2611 | var uint32_t fn; |
| 2612 | |
| 2613 | /* Initialize NS/BSSGP side */ |
| 2614 | f_init_bssgp(); |
| 2615 | /* Initialize GPRS MS side */ |
| 2616 | f_init_gprs_ms(); |
| 2617 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2618 | |
| 2619 | /* Initialize the PCU interface abstraction */ |
| 2620 | f_init_raw(testcasename()); |
| 2621 | |
| 2622 | /* Establish BSSGP connection to the PCU */ |
| 2623 | f_bssgp_establish(); |
| 2624 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 2625 | |
| 2626 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 2627 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap)); |
| 2628 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 2629 | |
| 2630 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 2631 | f_sleep(X2002); |
| 2632 | |
| 2633 | /* Expect the first (GPRS DL) block with bsn=0 and rrbp_valid=1 */ |
| 2634 | f_rx_rlcmac_dl_block_exp_data(dl_block, fn, data, 0); |
| 2635 | |
| 2636 | if (ischosen(dl_block.data_egprs)) { |
| 2637 | if (lengthof(dl_block.data_egprs.blocks) != 2) { |
| 2638 | setverdict(fail, "DL EGPRS block has unexpected number of LLC frames: ", dl_block.data_egprs); |
| 2639 | f_shutdown(__BFILE__, __LINE__); |
| 2640 | } |
| 2641 | if (dl_block.data_egprs.blocks[1].hdr.length_ind != 127) { |
| 2642 | setverdict(fail, "DL EGPRS block 2nd llc frame is not padding!: ", dl_block.data_egprs); |
| 2643 | f_shutdown(__BFILE__, __LINE__); |
| 2644 | } |
| 2645 | if (not match(dl_block.data_egprs.blocks[1].payload, |
| 2646 | f_pad_oct(''O, lengthof(dl_block.data_egprs.blocks[1].payload), '2B'O))) { |
| 2647 | setverdict(fail, "DL EGPRS block 2nd llc frame is not padding!: ", dl_block.data_egprs); |
| 2648 | f_shutdown(__BFILE__, __LINE__); |
| 2649 | } |
| 2650 | } else if (lengthof(dl_block.data.blocks) > 1) { |
| 2651 | setverdict(fail, "DL GPRS block has extra unexpected LLC frames: ", dl_block.data); |
| 2652 | f_shutdown(__BFILE__, __LINE__); |
| 2653 | } |
| 2654 | |
| 2655 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2656 | } |
| 2657 | |
| 2658 | /* Verify osmo-pcu Doesn't append LLC UI dummy frames to rlcmac blocks |
| 2659 | * containing llc data. See OS#4849 */ |
| 2660 | testcase TC_dl_gprs_data_no_llc_ui_dummy() runs on RAW_PCU_Test_CT { |
| 2661 | f_tc_dl_data_no_llc_ui_dummy(omit); |
| 2662 | } |
| 2663 | |
| 2664 | /* Verify osmo-pcu Doesn't append LLC UI dummy frames to rlcmac blocks |
| 2665 | * containing llc data. See OS#4849 */ |
| 2666 | 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] | 2667 | 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] | 2668 | } |
| 2669 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2670 | private function f_TC_egprs_pkt_chan_req(in EGPRSPktChRequest req, |
Vadim Yanitskiy | 4389390 | 2020-05-29 15:21:50 +0700 | [diff] [blame] | 2671 | template GsmRrMessage t_imm_ass := ?, |
| 2672 | PCUIF_BurstType bt := BURST_TYPE_1) |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2673 | runs on RAW_PCU_Test_CT { |
Vadim Yanitskiy | 4389390 | 2020-05-29 15:21:50 +0700 | [diff] [blame] | 2674 | var GsmRrMessage rr_msg; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2675 | var uint16_t ra11; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2676 | |
| 2677 | ra11 := enc_EGPRSPktChRequest2uint(req); |
| 2678 | log("Sending EGPRS Packet Channel Request (", ra11, "): ", req); |
| 2679 | |
Vadim Yanitskiy | 28d18e1 | 2020-05-29 15:25:59 +0700 | [diff] [blame] | 2680 | 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] | 2681 | if (not match(rr_msg, t_imm_ass)) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2682 | setverdict(fail, "Immediate Assignment does not match"); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 2683 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2684 | } |
| 2685 | |
| 2686 | setverdict(pass); |
| 2687 | } |
| 2688 | |
| 2689 | testcase TC_egprs_pkt_chan_req_signalling() runs on RAW_PCU_Test_CT { |
| 2690 | var template GsmRrMessage imm_ass; |
| 2691 | var template IaRestOctets rest; |
| 2692 | var template EgprsUlAss ul_ass; |
| 2693 | |
| 2694 | /* Initialize the PCU interface abstraction */ |
| 2695 | f_init_raw(testcasename()); |
| 2696 | |
| 2697 | var EGPRSPktChRequest req := { |
| 2698 | /* NOTE: other fields are set in the loop */ |
| 2699 | signalling := { tag := '110011'B } |
| 2700 | }; |
| 2701 | |
| 2702 | for (var integer i := 0; i < 6; i := i + 1) { |
| 2703 | var BIT5 ext_ra := int2bit(f_rnd_int(32), 5); |
| 2704 | req.signalling.random_bits := ext_ra; |
| 2705 | |
| 2706 | /* For signalling, do we expect Multiblock UL TBF Assignment? */ |
| 2707 | ul_ass := tr_EgprsUlAssMultiblock(ext_ra := ext_ra); |
| 2708 | rest := tr_IaRestOctets_EGPRSULAss(ul_ass); |
| 2709 | imm_ass := tr_IMM_TBF_ASS(dl := false, rest := rest); |
| 2710 | |
| 2711 | f_TC_egprs_pkt_chan_req(req, imm_ass); |
| 2712 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 2713 | |
| 2714 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2715 | } |
| 2716 | |
| 2717 | testcase TC_egprs_pkt_chan_req_one_phase() runs on RAW_PCU_Test_CT { |
| 2718 | var template GsmRrMessage imm_ass; |
| 2719 | var template IaRestOctets rest; |
| 2720 | var template EgprsUlAss ul_ass; |
| 2721 | |
| 2722 | /* Initialize the PCU interface abstraction */ |
| 2723 | f_init_raw(testcasename()); |
| 2724 | |
| 2725 | var EGPRSPktChRequest req := { |
| 2726 | /* NOTE: other fields are set in the loop */ |
| 2727 | one_phase := { tag := '0'B } |
| 2728 | }; |
| 2729 | |
| 2730 | for (var integer i := 0; i < 6; i := i + 1) { |
| 2731 | var BIT5 ext_ra := int2bit(f_rnd_int(32), 5); |
| 2732 | var BIT5 mslot_class := int2bit(f_rnd_int(32), 5); |
| 2733 | var BIT2 priority := substr(ext_ra, 0, 2); |
| 2734 | var BIT3 rand := substr(ext_ra, 2, 3); |
| 2735 | |
| 2736 | req.one_phase.multislot_class := mslot_class; |
| 2737 | req.one_phase.priority := priority; |
| 2738 | req.one_phase.random_bits := rand; |
| 2739 | |
| 2740 | /* For one phase access, do we expect Dynamic UL TBF Assignment? */ |
| 2741 | ul_ass := tr_EgprsUlAssDynamic(ext_ra := ext_ra); |
| 2742 | rest := tr_IaRestOctets_EGPRSULAss(ul_ass); |
| 2743 | imm_ass := tr_IMM_TBF_ASS(dl := false, rest := rest); |
| 2744 | |
| 2745 | f_TC_egprs_pkt_chan_req(req, imm_ass); |
| 2746 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 2747 | |
| 2748 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2749 | } |
| 2750 | |
| 2751 | testcase TC_egprs_pkt_chan_req_two_phase() runs on RAW_PCU_Test_CT { |
| 2752 | var template GsmRrMessage imm_ass; |
| 2753 | var template IaRestOctets rest; |
| 2754 | var template EgprsUlAss ul_ass; |
| 2755 | |
| 2756 | /* Initialize the PCU interface abstraction */ |
| 2757 | f_init_raw(testcasename()); |
| 2758 | |
| 2759 | var EGPRSPktChRequest req := { |
| 2760 | /* NOTE: other fields are set in the loop */ |
| 2761 | two_phase := { tag := '110000'B } |
| 2762 | }; |
| 2763 | |
| 2764 | for (var integer i := 0; i < 6; i := i + 1) { |
| 2765 | var BIT5 ext_ra := int2bit(f_rnd_int(32), 5); |
| 2766 | var BIT2 priority := substr(ext_ra, 0, 2); |
| 2767 | var BIT3 rand := substr(ext_ra, 2, 3); |
| 2768 | |
| 2769 | req.two_phase.priority := priority; |
| 2770 | req.two_phase.random_bits := rand; |
| 2771 | |
| 2772 | /* For two phase access, do we expect Multiblock UL TBF Assignment? */ |
| 2773 | ul_ass := tr_EgprsUlAssMultiblock(ext_ra := ext_ra); |
| 2774 | rest := tr_IaRestOctets_EGPRSULAss(ul_ass); |
| 2775 | imm_ass := tr_IMM_TBF_ASS(dl := false, rest := rest); |
| 2776 | |
| 2777 | f_TC_egprs_pkt_chan_req(req, imm_ass); |
| 2778 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 2779 | |
| 2780 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2781 | } |
| 2782 | |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 2783 | private function f_TC_egprs_pkt_chan_req_reject(bitstring ra11, uint32_t fn, |
| 2784 | template IARRestOctets rest := ?, |
| 2785 | PCUIF_BurstType bt := BURST_TYPE_1) |
| 2786 | runs on RAW_PCU_Test_CT { |
| 2787 | var template ReqRefWaitInd tr_ref; |
| 2788 | var GsmRrMessage rr_msg; |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 2789 | |
| 2790 | /* Send RACH.ind with malformed EGPRS Packet Channel Request */ |
| 2791 | BTS.send(ts_PCUIF_RACH_IND(bts_nr := 0, trx_nr := 0, ts_nr := 0, |
| 2792 | ra := bit2int(ra11), is_11bit := 1, |
| 2793 | burst_type := bt, fn := fn, |
| 2794 | arfcn := 871)); |
| 2795 | |
| 2796 | /* Abuse f_pcuif_rx_imm_ass(): wait for Immediate Assignment Reject */ |
Vadim Yanitskiy | 7466c33 | 2020-05-28 20:41:19 +0700 | [diff] [blame] | 2797 | 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] | 2798 | |
| 2799 | /* Just to have a short-name reference to the actual message */ |
| 2800 | var ImmediateAssignmentReject iar := rr_msg.payload.imm_ass_rej; |
| 2801 | |
| 2802 | /* Make sure that Request Reference list contains at least one entry |
| 2803 | * with our TDMA frame number, and RA is set to 'reserved' value 127. */ |
| 2804 | tr_ref := tr_ReqRefWaitInd(f_compute_ReqRef(127, fn)); |
| 2805 | if (not match(iar.payload, { *, tr_ref, * })) { |
| 2806 | setverdict(fail, "Request Reference list does not match"); |
| 2807 | f_shutdown(__BFILE__, __LINE__); |
| 2808 | } |
| 2809 | |
| 2810 | /* Match Feature Indicator (must indicate PS domain) */ |
| 2811 | if (not match(iar.feature_ind, FeatureIndicator:{?, false, true})) { |
| 2812 | setverdict(fail, "Feature Indicator does not match"); |
| 2813 | f_shutdown(__BFILE__, __LINE__); |
| 2814 | } |
| 2815 | |
| 2816 | /* Match IAR Rest Octets */ |
| 2817 | if (not match(iar.rest_octets, rest)) { |
| 2818 | setverdict(fail, "IAR Rest Octets does not match: ", |
| 2819 | iar.rest_octets, " vs expected ", rest); |
| 2820 | f_shutdown(__BFILE__, __LINE__); |
| 2821 | } |
| 2822 | |
| 2823 | setverdict(pass); |
| 2824 | } |
| 2825 | |
| 2826 | /* Verify the contents of RR Immediate Assignment Reject message and its |
| 2827 | * Rest Octets sent in response to EGPRS Packet Channel Request (11 bit). */ |
| 2828 | testcase TC_egprs_pkt_chan_req_reject_content() runs on RAW_PCU_Test_CT { |
| 2829 | var template IARRestOctets rest; |
| 2830 | var BIT5 ext_ra; |
| 2831 | |
| 2832 | /* Initialize the PCU interface abstraction */ |
| 2833 | f_init_raw(testcasename()); |
| 2834 | |
| 2835 | for (var integer i := 0; i < 6; i := i + 1) { |
| 2836 | ext_ra := int2bit(f_rnd_int(32), 5); /* 5 LSB's of RA11 */ |
| 2837 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(ext_ra), * }); |
| 2838 | |
| 2839 | /* Intentionally incorrect message (see table 11.2.5a.2) */ |
| 2840 | f_TC_egprs_pkt_chan_req_reject('111111'B & ext_ra, 1337 + i, rest); |
| 2841 | } |
| 2842 | |
| 2843 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2844 | } |
| 2845 | |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 2846 | /* At the moment, the IUT does not support any emergency services. Make sure |
| 2847 | * that EGPRS Packet Channel Request for an emergency call is properly rejected. */ |
| 2848 | testcase TC_egprs_pkt_chan_req_reject_emergency() runs on RAW_PCU_Test_CT { |
| 2849 | var template IARRestOctets rest; |
| 2850 | var BIT5 ext_ra; |
| 2851 | var BIT11 ra11; |
| 2852 | |
| 2853 | /* Initialize the PCU interface abstraction */ |
| 2854 | f_init_raw(testcasename()); |
| 2855 | |
| 2856 | var EGPRSPktChRequest req := { |
| 2857 | /* NOTE: other fields are set in the loop */ |
| 2858 | emergency := { tag := '110111'B } |
| 2859 | }; |
| 2860 | |
| 2861 | for (var integer i := 0; i < 6; i := i + 1) { |
| 2862 | ext_ra := int2bit(f_rnd_int(32), 5); /* 5 LSB's of RA11 */ |
| 2863 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(ext_ra), * }); |
| 2864 | |
| 2865 | req.emergency.random_bits := ext_ra; |
| 2866 | ra11 := enc_EGPRSPktChRequest2bits(req); |
| 2867 | |
| 2868 | /* Intentionally incorrect message (see table 11.2.5a.2) */ |
| 2869 | f_TC_egprs_pkt_chan_req_reject(ra11, 1337 + i, rest); |
| 2870 | } |
| 2871 | |
| 2872 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2873 | } |
| 2874 | |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 2875 | /* Make sure that IUT responds with RR Immediate Assignment Reject due to exhaustion. */ |
| 2876 | 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] | 2877 | var PCUIF_info_ind info_ind; |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 2878 | var template IARRestOctets rest; |
| 2879 | var BIT11 ra11; |
| 2880 | |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 2881 | info_ind := valueof(ts_PCUIF_INFO_default); |
Vadim Yanitskiy | d5321fb | 2020-10-31 20:23:47 +0700 | [diff] [blame] | 2882 | |
| 2883 | /* Only the first TRX is enabled. */ |
| 2884 | f_PCUIF_ver_INFO_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 2885 | f_PCUIF_ver_INFO_PDCHMask_set(info_ind, '00000001'B, 0); |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 2886 | |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 2887 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 2888 | f_init_raw(testcasename(), info_ind); |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 2889 | |
| 2890 | var EGPRSPktChRequest req := { |
| 2891 | one_phase := { |
| 2892 | tag := '0'B, |
| 2893 | multislot_class := '10101'B, |
| 2894 | priority := '01'B, |
| 2895 | random_bits := '101'B |
| 2896 | } |
| 2897 | }; |
| 2898 | |
| 2899 | /* We send 7 requests, the IUT gives us all available USFs (0..6). |
| 2900 | * TODO: make it configurable: usf_max := mp_pdch_ts_num * 7. */ |
| 2901 | for (var integer i := 0; i < 7; i := i + 1) { |
| 2902 | req.one_phase.random_bits := int2bit(f_rnd_int(8), 3); |
| 2903 | f_TC_egprs_pkt_chan_req(req, tr_IMM_TBF_ASS); |
| 2904 | } |
| 2905 | |
| 2906 | ra11 := enc_EGPRSPktChRequest2bits(req); |
| 2907 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(substr(ra11, 6, 5)), * }); |
| 2908 | |
| 2909 | /* At this point, the IUT should run out of free USFs */ |
| 2910 | f_TC_egprs_pkt_chan_req_reject(ra11, 1870, rest); |
| 2911 | |
| 2912 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2913 | } |
| 2914 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 2915 | /* Randomly generate a set of hopping parameters for one timeslot */ |
Vadim Yanitskiy | 7a04cdd | 2020-09-07 11:43:32 +0700 | [diff] [blame] | 2916 | private function f_TC_pcuif_fh_params_gen(integer max_ma_len) |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 2917 | return template (value) PCUIF_InfoTrxTs { |
Vadim Yanitskiy | 7a04cdd | 2020-09-07 11:43:32 +0700 | [diff] [blame] | 2918 | /* Pick a random MA length in range 2 .. max_ma_len */ |
| 2919 | var integer ma_len := 2 + f_rnd_int(max_ma_len - 2); |
| 2920 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 2921 | return ts_PCUIF_InfoTrxTsH1(tsc := f_rnd_int(7), |
| 2922 | hsn := f_rnd_int(63), |
| 2923 | maio := f_rnd_int(63), |
| 2924 | ma := f_rnd_bitstring(ma_len)); |
| 2925 | } |
| 2926 | |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 2927 | private function f_TC_pcuif_fh_check_imm_ass(in PCUIF_info_ind info_ind, |
| 2928 | in GsmRrMessage rr_msg) |
| 2929 | { |
| 2930 | var ImmediateAssignment ia := rr_msg.payload.imm_ass; |
| 2931 | var PCUIF_InfoTrxTs ts := info_ind.trx.v10[0].ts[ia.pkt_chan_desc.tn]; |
| 2932 | |
| 2933 | var template PacketChannelDescription tr_pkt_chan_desc := { |
| 2934 | channel_Type_spare := ?, |
| 2935 | tn := ?, |
| 2936 | tsc := ts.tsc, |
| 2937 | presence := '1'B, |
| 2938 | zero := omit, |
| 2939 | one := { |
| 2940 | maio := ts.maio, |
| 2941 | hsn := ts.hsn |
| 2942 | } |
| 2943 | }; |
| 2944 | |
| 2945 | if (not match(ia.pkt_chan_desc, tr_pkt_chan_desc)) { |
| 2946 | setverdict(fail, "Packet Channel Description does not match: ", |
| 2947 | ia.pkt_chan_desc, " vs ", tr_pkt_chan_desc); |
| 2948 | } |
| 2949 | |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 2950 | /* Mobile Allocation is expected to be octet-aligned */ |
| 2951 | var uint8_t ma_oct_len := (ts.ma_bit_len + 8 - 1) / 8; |
| 2952 | var template MobileAllocationLV tr_ma := { |
| 2953 | len := ma_oct_len, /* in bytes */ |
| 2954 | ma := substr(ts.ma, 0, ma_oct_len * 8) |
| 2955 | }; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 2956 | |
| 2957 | if (not match(ia.mobile_allocation, tr_ma)) { |
| 2958 | setverdict(fail, "Mobile Allocation does not match: ", |
| 2959 | ia.mobile_allocation, " vs ", tr_ma); |
| 2960 | } |
| 2961 | |
| 2962 | setverdict(pass); |
| 2963 | } |
| 2964 | |
| 2965 | /* Make sure that Immediate (UL EGPRS TBF) Assignment contains hopping parameters */ |
| 2966 | 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] | 2967 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 2968 | var GprsMS ms := valueof(t_GprsMS_def); |
| 2969 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 2970 | /* Enable frequency hopping on TRX0/TS7 */ |
| 2971 | info_ind.trx.v10[0].ts[7] := f_TC_pcuif_fh_params_gen(32); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 2972 | |
| 2973 | /* Initialize the PCU interface abstraction */ |
| 2974 | f_init_raw(testcasename(), info_ind); |
| 2975 | |
| 2976 | /* EGPRS Packet Channel Request (cause=Signalling) */ |
| 2977 | f_ms_use_ra(ms, bit2int('11001101010'B), ra_is_11bit := 1); |
| 2978 | |
| 2979 | /* Establish an Uplink EGPRS TBF */ |
| 2980 | f_ms_establish_ul_tbf(ms); |
| 2981 | |
| 2982 | f_TC_pcuif_fh_check_imm_ass(valueof(info_ind), ms.ul_tbf.rr_imm_ass); |
| 2983 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2984 | } |
| 2985 | |
| 2986 | /* Make sure that Immediate (UL TBF) Assignment contains hopping parameters */ |
| 2987 | 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] | 2988 | 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] | 2989 | var GprsMS ms := valueof(t_GprsMS_def); |
| 2990 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 2991 | /* Enable frequency hopping on TRX0/TS7 */ |
| 2992 | info_ind.trx.v10[0].ts[7] := f_TC_pcuif_fh_params_gen(32); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 2993 | |
| 2994 | /* Initialize the PCU interface abstraction */ |
| 2995 | f_init_raw(testcasename(), info_ind); |
| 2996 | |
| 2997 | /* Establish an Uplink TBF */ |
| 2998 | f_ms_establish_ul_tbf(ms); |
| 2999 | |
| 3000 | f_TC_pcuif_fh_check_imm_ass(valueof(info_ind), ms.ul_tbf.rr_imm_ass); |
| 3001 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3002 | } |
| 3003 | |
| 3004 | /* Make sure that Immediate (DL TBF) Assignment contains hopping parameters */ |
| 3005 | 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] | 3006 | 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] | 3007 | var GprsMS ms := valueof(t_GprsMS_def); |
| 3008 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3009 | /* Enable frequency hopping on TRX0/TS7 */ |
| 3010 | info_ind.trx.v10[0].ts[7] := f_TC_pcuif_fh_params_gen(16); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3011 | |
| 3012 | /* Initialize NS/BSSGP side */ |
| 3013 | f_init_bssgp(); |
| 3014 | |
| 3015 | /* Initialize the PCU interface abstraction */ |
| 3016 | f_init_raw(testcasename(), info_ind); |
| 3017 | |
| 3018 | /* Establish BSSGP connection to the PCU */ |
| 3019 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3020 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3021 | |
| 3022 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 3023 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, f_rnd_octstring(12))); |
| 3024 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 3025 | |
| 3026 | f_TC_pcuif_fh_check_imm_ass(valueof(info_ind), ms.dl_tbf.rr_imm_ass); |
| 3027 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3028 | } |
| 3029 | |
| 3030 | private function f_TC_pcuif_fh_check_pkt_ass(in PCUIF_info_ind info_ind, |
| 3031 | in FrequencyParameters fp) |
| 3032 | { |
| 3033 | /* FIXME: TRX0/TS7 is a hard-coded expectation, make it configurable */ |
| 3034 | var PCUIF_InfoTrxTs ts := info_ind.trx.v10[0].ts[7]; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3035 | |
| 3036 | /* Table 12.8.1: Frequency Parameters information elements */ |
| 3037 | var template FrequencyParameters tr_fp := { |
| 3038 | tsc := ts.tsc, |
| 3039 | presence := '10'B, /* Direct encoding 1 */ |
| 3040 | arfcn := omit, |
| 3041 | indirect := omit, |
| 3042 | direct1 := { |
| 3043 | maio := ts.maio, |
| 3044 | /* Table 12.10a.1: GPRS Mobile Allocation information elements */ |
| 3045 | mobile_allocation := { |
| 3046 | hsn := ts.hsn, |
| 3047 | rfl_number_list_present := '0'B, |
| 3048 | rfl_number_list := omit, |
| 3049 | ma_present := '0'B, /* inverted logic */ |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 3050 | ma_length := ts.ma_bit_len, |
| 3051 | ma_bitmap := substr(ts.ma, 0, ts.ma_bit_len) |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3052 | } |
| 3053 | }, |
| 3054 | direct2 := omit |
| 3055 | }; |
| 3056 | |
| 3057 | if (not match(fp, tr_fp)) { |
| 3058 | setverdict(fail, "Frequency Parameters IE does not match: ", |
| 3059 | fp, " vs ", tr_fp); |
| 3060 | } |
| 3061 | |
| 3062 | setverdict(pass); |
| 3063 | } |
| 3064 | |
| 3065 | /* Make sure that Packet Uplink Assignment contains hopping parameters */ |
| 3066 | 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] | 3067 | 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] | 3068 | var GprsMS ms := valueof(t_GprsMS_def); |
| 3069 | var uint32_t poll_fn; |
| 3070 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3071 | /* Enable frequency hopping on TRX0/TS7 */ |
| 3072 | info_ind.trx.v10[0].ts[7] := f_TC_pcuif_fh_params_gen(33); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3073 | |
| 3074 | /* Initialize the PCU interface abstraction */ |
| 3075 | f_init_raw(testcasename(), info_ind); |
| 3076 | |
| 3077 | /* Establish an Uplink TBF */ |
| 3078 | f_ms_establish_ul_tbf(ms); |
| 3079 | |
| 3080 | /* Send Packet Resource Request, so the network will allocate an Uplink resource */ |
| 3081 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, omit))); |
| 3082 | |
| 3083 | /* 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] | 3084 | f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_UL_PACKET_ASS); |
| 3085 | var PacketUlAssignment ua := ms.ul_tbf.ass.pacch; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3086 | |
| 3087 | /* 3GPP TS 44.060, section 12.8 "Frequency Parameters" */ |
| 3088 | var template (omit) FrequencyParameters fp; |
| 3089 | if (ua.is_egprs == '1'B) { |
| 3090 | fp := ua.egprs.freq_par; |
| 3091 | } else { |
| 3092 | fp := ua.gprs.freq_par; |
| 3093 | } |
| 3094 | |
| 3095 | /* This is an optional IE, so it's worth to check its presence */ |
| 3096 | if (istemplatekind(fp, "omit")) { |
| 3097 | setverdict(fail, "Frequency Parameters IE is not present"); |
| 3098 | f_shutdown(__BFILE__, __LINE__); |
| 3099 | } |
| 3100 | |
| 3101 | f_TC_pcuif_fh_check_pkt_ass(valueof(info_ind), valueof(fp)); |
| 3102 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3103 | } |
| 3104 | |
| 3105 | /* Make sure that Packet Downlink Assignment contains hopping parameters */ |
| 3106 | 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] | 3107 | 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] | 3108 | var octetstring data := f_rnd_octstring(10); |
| 3109 | var GprsMS ms := valueof(t_GprsMS_def); |
| 3110 | var RlcmacDlBlock dl_block; |
| 3111 | var uint32_t poll_fn; |
| 3112 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3113 | /* Enable frequency hopping on TRX0/TS7 */ |
| 3114 | info_ind.trx.v10[0].ts[7] := f_TC_pcuif_fh_params_gen(33); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3115 | |
| 3116 | /* Initialize NS/BSSGP side */ |
| 3117 | f_init_bssgp(); |
| 3118 | |
| 3119 | /* Initialize the PCU interface abstraction */ |
| 3120 | f_init_raw(testcasename(), info_ind); |
| 3121 | |
| 3122 | /* Establish BSSGP connection to the PCU */ |
| 3123 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3124 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3125 | |
| 3126 | /* Establish an Uplink TBF */ |
| 3127 | f_ms_establish_ul_tbf(ms); |
| 3128 | |
| 3129 | /* Send an Uplink block, so this TBF becomes "active" */ |
| 3130 | f_ms_tx_ul_data_block(ms, data, with_tlli := true); |
| 3131 | |
| 3132 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3133 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, poll_fn); |
| 3134 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), poll_fn); |
| 3135 | |
| 3136 | /* SGSN sends some DL data, PCU will assign Downlink resource on PACCH */ |
| 3137 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 3138 | |
| 3139 | /* 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] | 3140 | f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 3141 | var PacketDlAssignment da := ms.dl_tbf.ass.pacch; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3142 | |
| 3143 | /* This is an optional IE, so it's worth to check its presence */ |
| 3144 | if (not ispresent(da.freq_par)) { |
| 3145 | setverdict(fail, "Frequency Parameters IE is not present"); |
| 3146 | f_shutdown(__BFILE__, __LINE__); |
| 3147 | } |
| 3148 | |
| 3149 | f_TC_pcuif_fh_check_pkt_ass(valueof(info_ind), da.freq_par); |
| 3150 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3151 | } |
| 3152 | |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 3153 | /* Check if the IUT handles subsequent INFO.ind messages */ |
| 3154 | 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] | 3155 | 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] | 3156 | var BTS_PDTCH_Block data_msg; |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 3157 | |
| 3158 | /* Initialize the PCU interface abstraction */ |
| 3159 | f_init_raw(testcasename(), info_ind); |
| 3160 | |
| 3161 | /* Send 16 conseqtive INFO.ind messages and check that the IUT stays alive */ |
| 3162 | for (var integer i := 0; i < 16; i := i + 1) { |
| 3163 | BTS.send(ts_PCUIF_INFO_IND(0, info_ind)); |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 3164 | f_pcuif_rx_data_req_pdtch(data_msg); |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 3165 | } |
| 3166 | |
| 3167 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3168 | } |
| 3169 | |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 3170 | /* Verify allocation of several MS along PDCH ts of several TRX. See OS#1775, SYS#5030 */ |
| 3171 | testcase TC_multitrx_multims_alloc() runs on RAW_PCU_Test_CT { |
| 3172 | var PCUIF_info_ind info_ind; |
| 3173 | var integer i; |
| 3174 | const integer num_ms := 8; |
| 3175 | |
| 3176 | /* Initialize NS/BSSGP side */ |
| 3177 | f_init_bssgp(); |
| 3178 | /* Initialize GPRS MS side */ |
| 3179 | f_init_gprs_ms(num_ms); |
| 3180 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3181 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 3182 | /* Only the 3 first TRX are enabled. The enabled ones all have same |
| 3183 | amount of resources, hence same amount of initial resources. */ |
Vadim Yanitskiy | d5321fb | 2020-10-31 20:23:47 +0700 | [diff] [blame] | 3184 | f_PCUIF_ver_INFO_PDCHMask_set(info_ind, '00000000'B, (3 .. 7)); |
| 3185 | f_PCUIF_ver_INFO_PDCHMask_set(info_ind, '00000011'B, 0); |
| 3186 | f_PCUIF_ver_INFO_PDCHMask_set(info_ind, '00001100'B, 1); |
| 3187 | f_PCUIF_ver_INFO_PDCHMask_set(info_ind, '11000000'B, 2); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 3188 | |
| 3189 | /* Initialize the PCU interface abstraction */ |
| 3190 | f_init_raw(testcasename(), info_ind); |
| 3191 | |
| 3192 | /* Establish BSSGP connection to the PCU */ |
| 3193 | f_bssgp_establish(); |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 3194 | f_multi_ms_bssgp_register(); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 3195 | |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 3196 | /* Establish an Uplink TBF for each GprsMS instance */ |
| 3197 | f_multi_ms_establish_tbf(do_activate := false); |
| 3198 | |
| 3199 | /* 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] | 3200 | for (i := 0; i < num_ms; i := i + 1) { |
Pau Espin Pedrol | b20b7e5 | 2020-10-28 21:28:45 +0100 | [diff] [blame] | 3201 | if (g_ms[i].ul_tbf.arfcn != info_ind.trx.v10[i mod 3].arfcn) { |
| 3202 | setverdict(fail, "Got assigned ARFCN ", g_ms[i].ul_tbf.arfcn, |
| 3203 | " vs exp ", info_ind.trx.v10[i mod 3].arfcn); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 3204 | f_shutdown(__BFILE__, __LINE__); |
| 3205 | } |
| 3206 | } |
| 3207 | |
| 3208 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3209 | } |
| 3210 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 3211 | /* Verify concurrent PDCH use of EGPRS and GPRS (EGPRS dl rlcmac blk is |
| 3212 | * downgraded to CS1-4 so that GPRS can read the USF). |
| 3213 | * See 3GPP TS 44.060 5.2.4a "Multiplexing of GPRS, EGPRS and EGPRS2 capable mobile stations" |
| 3214 | */ |
| 3215 | testcase TC_multiplex_dl_gprs_egprs() runs on RAW_PCU_Test_CT { |
| 3216 | var PCUIF_info_ind info_ind; |
| 3217 | const integer num_ms := 2; /* 2 MS, first one is GPRS-only, second one is EGPRS */ |
| 3218 | var PollFnCtx pollctx; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 3219 | var uint32_t sched_fn, dl_fn, ack_fn; |
| 3220 | var octetstring data := f_rnd_octstring(10); |
| 3221 | var RlcmacDlBlock dl_block; |
| 3222 | var integer tx_data_remain := 5; |
| 3223 | var integer tgt_ms; |
| 3224 | var integer ms_gprs_usf_count[num_ms] := { 0, 0 }; |
| 3225 | var integer ms_egprs_usf_count[num_ms] := { 0, 0 }; |
| 3226 | |
| 3227 | /* Initialize NS/BSSGP side */ |
| 3228 | f_init_bssgp(); |
| 3229 | /* Initialize GPRS MS side */ |
| 3230 | f_init_gprs_ms(num_ms); |
| 3231 | |
| 3232 | info_ind := valueof(ts_PCUIF_INFO_default); |
| 3233 | /* Only use 1 PDCH to make sure both end up in the same slot: */ |
| 3234 | f_PCUIF_ver_INFO_PDCHMask_set(info_ind, '00000001'B, 0); |
| 3235 | f_PCUIF_ver_INFO_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 3236 | |
| 3237 | /* Initialize the PCU interface abstraction */ |
| 3238 | f_init_raw(testcasename(), info_ind); |
| 3239 | |
| 3240 | /* Set Initial MCS > 4 and maintain it non-variable to simplify test */ |
| 3241 | g_mcs_initial_dl := 5; |
| 3242 | g_mcs_max_dl := 5; |
| 3243 | f_pcuvty_set_allowed_cs_mcs(); |
| 3244 | |
| 3245 | /* Establish BSSGP connection to the PCU */ |
| 3246 | f_bssgp_establish(); |
| 3247 | f_multi_ms_bssgp_register(); |
| 3248 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 3249 | /* Establish UL TBF for MS0 (GPRS-only) */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 3250 | 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] | 3251 | if (not match(g_ms[0].ul_tbf.tx_cs_mcs, cs_gprs_any)) { |
| 3252 | setverdict(fail, "Wrong CS_MCS ", g_ms[0].ul_tbf.tx_cs_mcs, " received vs exp ", cs_gprs_any); |
| 3253 | f_shutdown(__BFILE__, __LINE__); |
| 3254 | } |
| 3255 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3256 | f_ms_tx_ul_block(g_ms[0], ts_RLCMAC_CTRL_ACK(g_ms[0].tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 3257 | |
| 3258 | /* Establish UL TBF for MS1 (EGPRS) */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 3259 | 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] | 3260 | if (not match(g_ms[1].ul_tbf.tx_cs_mcs, mcs_egprs_any)) { |
| 3261 | setverdict(fail, "Wrong CS_MCS ", g_ms[1].ul_tbf.tx_cs_mcs, " received vs exp ", mcs_egprs_any); |
| 3262 | f_shutdown(__BFILE__, __LINE__); |
| 3263 | } |
| 3264 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3265 | f_ms_tx_ul_block(g_ms[1], ts_RLCMAC_CTRL_ACK(g_ms[1].tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 3266 | |
| 3267 | /* Now SGSN sends some DL data to MS0, PCU will assign a GPRS DL TBF on PACCH */ |
| 3268 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[0].tlli, data)); |
| 3269 | f_sleep(0.1); |
| 3270 | f_ms_rx_pkt_ass_pacch(g_ms[0], sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 3271 | /* DL Ass sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3272 | f_ms_tx_ul_block(g_ms[0], ts_RLCMAC_CTRL_ACK(g_ms[0].tlli), sched_fn); |
| 3273 | /* After acking the dl assignment, dl tbf goes into FLOW state and PCU will provide DL data when BTS asks for it */ |
| 3274 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0, cs_gprs_any); |
| 3275 | /* ACK the DL block */ |
| 3276 | f_dltbf_ack_block(g_ms[0].dl_tbf, dl_block, '0'B); |
| 3277 | f_ms_tx_ul_block(g_ms[0], f_dltbf_ts_RLCMAC_DL_ACK_NACK(g_ms[0].dl_tbf, false), |
| 3278 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 3279 | |
| 3280 | /* Now SGSN sends some DL data to MS1, PCU will assign a EGPRS DL TBF on PACCH */ |
| 3281 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[1].tlli, data)); |
| 3282 | f_sleep(0.1); |
| 3283 | f_ms_rx_pkt_ass_pacch(g_ms[1], sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 3284 | /* DL Ass sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3285 | f_ms_tx_ul_block(g_ms[1], ts_RLCMAC_CTRL_ACK(g_ms[1].tlli), sched_fn); |
| 3286 | /* After acking the dl assignment, dl tbf goes into FLOW state and PCU will provide DL data when BTS asks for it */ |
| 3287 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0, mcs_egprs_any); |
| 3288 | /* ACK the DL block */ |
| 3289 | f_dltbf_ack_block(g_ms[1].dl_tbf, dl_block, '0'B); |
| 3290 | f_ms_tx_ul_block(g_ms[1], f_dltbf_ts_RLCMAC_DL_ACK_NACK(g_ms[1].dl_tbf, true), |
| 3291 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 3292 | |
| 3293 | data := f_rnd_octstring(1400); |
| 3294 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[0].tlli, data)); |
| 3295 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[1].tlli, data)); |
| 3296 | |
| 3297 | for (var integer i := 0; i < 800; i := i + 1) { |
| 3298 | f_rx_rlcmac_dl_block(dl_block, dl_fn); |
| 3299 | |
| 3300 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL)) { |
| 3301 | /* No more data to receive, done */ |
| 3302 | break; |
| 3303 | } |
| 3304 | |
| 3305 | if (ischosen(dl_block.ctrl)) { |
| 3306 | setverdict(fail, "Unexpected DL CTRL block ", dl_block); |
| 3307 | f_shutdown(__BFILE__, __LINE__); |
| 3308 | } else if (ischosen(dl_block.data_egprs)) { |
| 3309 | if (not match(dl_block.data_egprs.mac_hdr.tfi, g_ms[1].dl_tbf.tfi)) { |
| 3310 | setverdict(fail, "EGPRS DL DATA not matching EGPRS MS TFI (", g_ms[1].dl_tbf.tfi, "): ", dl_block.data_egprs.mac_hdr.tfi); |
| 3311 | f_shutdown(__BFILE__, __LINE__); |
| 3312 | } |
| 3313 | tgt_ms := 1; |
| 3314 | if (match(dl_block.data_egprs.mac_hdr.usf, g_ms[0].ul_tbf.usf[7])) { |
| 3315 | if (dl_block.data_egprs.mcs > MCS_4) { |
| 3316 | setverdict(fail, "Signalling USF ", dl_block.data_egprs.mac_hdr.usf, " for GPRS-only MS using MCS > 4: ", dl_block); |
| 3317 | f_shutdown(__BFILE__, __LINE__); |
| 3318 | } |
| 3319 | ms_egprs_usf_count[0] := ms_egprs_usf_count[0] + 1; |
| 3320 | } else { |
| 3321 | if (dl_block.data_egprs.mcs <= MCS_4) { |
| 3322 | setverdict(fail, "Using too-low MCS for EGPRS MS: ", dl_block.data_egprs.mcs); |
| 3323 | f_shutdown(__BFILE__, __LINE__); |
| 3324 | } |
| 3325 | if (match(dl_block.data_egprs.mac_hdr.usf, g_ms[1].ul_tbf.usf[7])) { |
| 3326 | ms_egprs_usf_count[1] := ms_egprs_usf_count[1] + 1; |
| 3327 | } |
| 3328 | } |
| 3329 | } else { |
| 3330 | if (not match(dl_block.data.mac_hdr.hdr_ext.tfi, g_ms[0].dl_tbf.tfi)) { |
| 3331 | setverdict(fail, "GPRS DL DATA not matching GPRS MS TFI (", g_ms[0].dl_tbf.tfi, "): ", dl_block.data.mac_hdr.hdr_ext.tfi); |
| 3332 | f_shutdown(__BFILE__, __LINE__); |
| 3333 | } |
| 3334 | tgt_ms := 0; |
| 3335 | if (match(dl_block.data.mac_hdr.mac_hdr.usf, g_ms[0].ul_tbf.usf[7])) { |
| 3336 | ms_gprs_usf_count[0] := ms_gprs_usf_count[0] + 1; |
| 3337 | } else if (match(dl_block.data.mac_hdr.mac_hdr.usf, g_ms[1].ul_tbf.usf[7])) { |
| 3338 | ms_gprs_usf_count[1] := ms_gprs_usf_count[1] + 1; |
| 3339 | } |
| 3340 | } |
| 3341 | |
| 3342 | /* Keep Ack/Nack description updated */ |
| 3343 | f_dltbf_ack_block(g_ms[tgt_ms].dl_tbf, dl_block); |
| 3344 | |
| 3345 | /* TDMA frame number on which we are supposed to send the ACK */ |
| 3346 | if (f_dl_block_rrbp_valid(dl_block)) { |
| 3347 | ack_fn := f_dl_block_ack_fn(dl_block, dl_fn); |
| 3348 | 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); |
| 3349 | if (tx_data_remain != 0) { |
| 3350 | /* Submit more data from time to time to keep the TBF ongoing */ |
| 3351 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[0].tlli, data)); |
| 3352 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[1].tlli, data)); |
| 3353 | tx_data_remain := tx_data_remain - 1; |
| 3354 | } |
| 3355 | } |
| 3356 | } |
| 3357 | |
| 3358 | log("results: ms_gprs_usf_count=", ms_gprs_usf_count, " / ms_egprs_usf_count=", ms_egprs_usf_count); |
| 3359 | if (ms_gprs_usf_count[0] == 0 or ms_gprs_usf_count[1] == 0 or |
| 3360 | ms_egprs_usf_count[0] == 0 or ms_egprs_usf_count[1] == 0) { |
| 3361 | setverdict(fail, "USF thresholds not met!"); |
| 3362 | f_shutdown(__BFILE__, __LINE__); |
| 3363 | } |
| 3364 | |
| 3365 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3366 | } |
| 3367 | |
| 3368 | |
Vadim Yanitskiy | dbd4b24 | 2020-10-31 05:44:58 +0700 | [diff] [blame] | 3369 | private function f_TC_paging_cs_multi_ms(template (value) TsTrxBtsNum nr, |
| 3370 | boolean exp_imsi, boolean exp_tmsi) |
| 3371 | runs on RAW_PCU_Test_CT { |
| 3372 | var bitstring mask := f_pad_bit(''B, lengthof(g_ms), '0'B); |
| 3373 | var integer pending := lengthof(g_ms); |
| 3374 | var RlcmacDlBlock dl_block; |
| 3375 | var boolean f1, f2; |
| 3376 | |
| 3377 | while (pending > 0) { |
| 3378 | var uint32_t poll_fn; |
| 3379 | |
| 3380 | /* Obtain a Downlink block and make sure it is a paging request */ |
| 3381 | f_rx_rlcmac_dl_block(dl_block, poll_fn, nr := nr); |
| 3382 | if (not match(dl_block, tr_RLCMAC_PACKET_PAG_REQ)) { |
| 3383 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 3384 | break; |
| 3385 | } |
| 3386 | |
| 3387 | /* This should not happen in general, but who knows... */ |
| 3388 | var PacketPagingReq req := dl_block.ctrl.payload.u.paging; |
| 3389 | if (not ispresent(req.repeated_pageinfo)) { |
| 3390 | setverdict(fail, "Repeated Page Info IE is absent?!?"); |
| 3391 | break; |
| 3392 | } |
| 3393 | |
| 3394 | /* A single message may contain several MIs depending on their type */ |
| 3395 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 3396 | f1 := exp_imsi and f_pkt_paging_match_imsi(req, g_ms[i].imsi, |
| 3397 | ps_domain := false); |
| 3398 | f2 := exp_tmsi and f_pkt_paging_match_tmsi(req, oct2int(g_ms[i].tlli), |
| 3399 | ps_domain := false); |
| 3400 | if (not f1 and not f2) |
| 3401 | { continue; } |
| 3402 | |
| 3403 | /* Detect duplicate MIs */ |
| 3404 | if (mask[i] == '1'B) { |
| 3405 | setverdict(fail, "MS is paged twice: ", g_ms[i].imsi); |
| 3406 | continue; |
| 3407 | } |
| 3408 | |
| 3409 | mask[i] := '1'B; |
| 3410 | } |
| 3411 | |
| 3412 | pending := pending - lengthof(req.repeated_pageinfo); |
| 3413 | } |
| 3414 | |
| 3415 | for (var integer i := 0; i < lengthof(mask); i := i + 1) { |
| 3416 | if (mask[i] != '1'B) { |
| 3417 | setverdict(fail, "MS was not paged at all: ", g_ms[i].imsi); |
| 3418 | log("===== mask := ", mask); |
| 3419 | } |
| 3420 | } |
| 3421 | |
| 3422 | /* All messages must have been received by now, expect a dummy block */ |
| 3423 | f_rx_rlcmac_dl_block_exp_dummy(dl_block, nr := nr); |
| 3424 | } |
| 3425 | |
| 3426 | private function f_TC_paging_cs_multi_ms_init(BIT8 pdch_mask) |
| 3427 | runs on RAW_PCU_Test_CT { |
| 3428 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 3429 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 3430 | |
| 3431 | /* Initialize NS/BSSGP side */ |
| 3432 | f_init_bssgp(); |
| 3433 | |
| 3434 | /* Explicitly set the given PDCH slot-mask to all transceivers */ |
| 3435 | f_PCUIF_ver_INFO_PDCHMask_set(info_ind, pdch_mask); |
| 3436 | |
| 3437 | /* Allocate 56 GprsMS instances (maximum for 8 PDCH slots) */ |
| 3438 | f_init_gprs_ms(7 * 8); |
| 3439 | |
| 3440 | /* Initialize the PCU interface abstraction */ |
| 3441 | f_init_raw(testcasename(), info_ind); |
| 3442 | |
| 3443 | /* Establish BSSGP connection to the PCU */ |
| 3444 | f_bssgp_establish(); |
| 3445 | f_multi_ms_bssgp_register(); |
| 3446 | |
| 3447 | /* Establish an Uplink TBF for each GprsMS instance */ |
| 3448 | f_multi_ms_establish_tbf(do_activate := true); |
| 3449 | } |
| 3450 | |
| 3451 | testcase TC_paging_cs_multi_ms_imsi() runs on RAW_PCU_Test_CT { |
| 3452 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 3453 | |
| 3454 | /* Common part: send INFO.ind, establish TBFs... */ |
| 3455 | f_TC_paging_cs_multi_ms_init(pdch_mask := '00000001'B); |
| 3456 | |
| 3457 | /* Enqueue multiple CS PAGING requests at a time (IMSI only) */ |
| 3458 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 3459 | BSSGP[0].send(ts_BSSGP_CS_PAGING_IMSI(bvci, g_ms[i].imsi)); |
| 3460 | } |
| 3461 | |
| 3462 | /* FIXME: work around a race condition between PCUIF and BSSGP */ |
| 3463 | f_sleep(0.2); /* i.e. give the IUT some time to process everything */ |
| 3464 | |
| 3465 | /* Check what the IUT sends on PACCH, all GprsMS instances must be paged. |
| 3466 | * The IUT is expected to page on all PDCH slots of all transceivers. */ |
| 3467 | for (var integer trx_nr := 0; trx_nr < 8; trx_nr := trx_nr + 1) { |
| 3468 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, trx_nr); |
| 3469 | f_TC_paging_cs_multi_ms(nr, exp_imsi := true, exp_tmsi := false); |
| 3470 | } |
| 3471 | |
| 3472 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3473 | } |
| 3474 | |
| 3475 | testcase TC_paging_cs_multi_ms_tmsi() runs on RAW_PCU_Test_CT { |
| 3476 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 3477 | |
| 3478 | /* Common part: send INFO.ind, establish TBFs... */ |
| 3479 | f_TC_paging_cs_multi_ms_init(pdch_mask := '00000001'B); |
| 3480 | |
| 3481 | /* Enqueue multiple CS PAGING requests at a time (P-TMSI only) */ |
| 3482 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 3483 | var GsmTmsi tmsi := oct2int(g_ms[i].tlli); /* P-TMSI == TLLI */ |
| 3484 | BSSGP[0].send(ts_BSSGP_CS_PAGING_PTMSI(bvci, g_ms[i].imsi, tmsi)); |
| 3485 | } |
| 3486 | |
| 3487 | /* FIXME: work around a race condition between PCUIF and BSSGP */ |
| 3488 | f_sleep(0.2); /* i.e. give the IUT some time to process everything */ |
| 3489 | |
| 3490 | /* Check what the IUT sends on PACCH, all GprsMS instances must be paged. |
| 3491 | * The IUT is expected to page on all PDCH slots of all transceivers. */ |
| 3492 | for (var integer trx_nr := 0; trx_nr < 8; trx_nr := trx_nr + 1) { |
| 3493 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, trx_nr); |
| 3494 | f_TC_paging_cs_multi_ms(nr, exp_imsi := false, exp_tmsi := true); |
| 3495 | } |
| 3496 | |
| 3497 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3498 | } |
| 3499 | |
| 3500 | testcase TC_paging_cs_multi_ms_imsi_tmsi() runs on RAW_PCU_Test_CT { |
| 3501 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 3502 | |
| 3503 | /* Common part: send INFO.ind, establish TBFs... */ |
| 3504 | f_TC_paging_cs_multi_ms_init(pdch_mask := '00000001'B); |
| 3505 | |
| 3506 | /* Enqueue multiple CS PAGING requests at a time (IMSI & P-TMSI) */ |
| 3507 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 3508 | var GsmTmsi tmsi := oct2int(g_ms[i].tlli); /* P-TMSI == TLLI */ |
| 3509 | if (i mod 3 == 0) { /* One PDU fits: 1 IMSI and 2 P-TMSI MIs */ |
| 3510 | BSSGP[0].send(ts_BSSGP_CS_PAGING_PTMSI(bvci, g_ms[i].imsi, tmsi)); |
| 3511 | } else { |
| 3512 | BSSGP[0].send(ts_BSSGP_CS_PAGING_IMSI(bvci, g_ms[i].imsi)); |
| 3513 | } |
| 3514 | } |
| 3515 | |
| 3516 | /* FIXME: work around a race condition between PCUIF and BSSGP */ |
| 3517 | f_sleep(0.2); /* i.e. give the IUT some time to process everything */ |
| 3518 | |
| 3519 | /* Check what the IUT sends on PACCH, all GprsMS instances must be paged. |
| 3520 | * The IUT is expected to page on all PDCH slots of all transceivers. */ |
| 3521 | for (var integer trx_nr := 0; trx_nr < 8; trx_nr := trx_nr + 1) { |
| 3522 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, trx_nr); |
| 3523 | f_TC_paging_cs_multi_ms(nr, exp_imsi := true, exp_tmsi := true); |
| 3524 | } |
| 3525 | |
| 3526 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3527 | } |
| 3528 | |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 3529 | 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] | 3530 | runs on RAW_PCU_Test_CT return RlcmacDlBlock { |
| 3531 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 3532 | var integer i := 0; |
| 3533 | while (true) { |
| 3534 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 3535 | if (not match(dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 3536 | break; |
| 3537 | } |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 3538 | if (max_num_iter > 0 and i > max_num_iter) { |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 3539 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 3540 | f_shutdown(__BFILE__, __LINE__); |
| 3541 | } |
| 3542 | i := i + 1; |
| 3543 | } |
| 3544 | return dl_block; |
| 3545 | } |
| 3546 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 3547 | private function f_outbound_nacc_rim_tx_resp(PCUIF_info_ind info_ind) |
| 3548 | runs on RAW_PCU_Test_CT { |
| 3549 | var BssgpCellId src := valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_enc_BcdMccMnc(info_ind.mcc, info_ind.mnc, info_ind.mnc_3_digits == 1), |
| 3550 | info_ind.lac), |
| 3551 | info_ind.rac), |
| 3552 | info_ind.cell_id)); |
| 3553 | var BssgpCellId dst := valueof(ts_BssgpCellId(ts_RAI(ts_LAI('023F43'H, /* Decided by test itself (emulating BSC) */ |
| 3554 | 423), |
| 3555 | 2), |
| 3556 | 5)); |
| 3557 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src)); |
| 3558 | var RIM_Routing_Address dst_addr := valueof(t_RIM_Routing_Address_cid(dst)); |
| 3559 | var template (value) RAN_Information_RIM_Container res_cont := |
| 3560 | ts_RAN_Information_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 3561 | ts_RIM_Sequence_Number(2), |
| 3562 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 3563 | ts_RIM_Protocol_Version_Number(1), |
| 3564 | tsu_ApplContainer_or_ApplErrContainer_NACC(tsu_ApplContainer_NACC(dst, false, 3, si_default)), |
| 3565 | omit); |
| 3566 | RIM.send(ts_PDU_BSSGP_RAN_INFORMATION(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 3567 | ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 3568 | res_cont)); |
| 3569 | } |
| 3570 | |
| 3571 | altstep as_outbound_nacc_rim_resolve(PCUIF_info_ind info_ind, boolean do_answer := true, boolean do_repeat := false) |
| 3572 | runs on RAW_PCU_Test_CT { |
| 3573 | /* RIM procedure: */ |
| 3574 | var BssgpCellId src := valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_enc_BcdMccMnc(info_ind.mcc, info_ind.mnc, info_ind.mnc_3_digits == 1), |
| 3575 | info_ind.lac), |
| 3576 | info_ind.rac), |
| 3577 | info_ind.cell_id)); |
| 3578 | var BssgpCellId dst := valueof(ts_BssgpCellId(ts_RAI(ts_LAI('023F43'H, /* Decided by test itself (emulating BSC) */ |
| 3579 | 423), |
| 3580 | 2), |
| 3581 | 5)); |
| 3582 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src)); |
| 3583 | var RIM_Routing_Address dst_addr := valueof(t_RIM_Routing_Address_cid(dst)); |
| 3584 | [] RIM.receive(tr_RAN_INFORMATION_REQUEST(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 3585 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 3586 | tr_RAN_Information_Request_RIM_Container)) { |
| 3587 | if (do_answer) { |
| 3588 | f_outbound_nacc_rim_tx_resp(info_ind); |
| 3589 | } |
| 3590 | if (do_repeat) { |
| 3591 | repeat; |
| 3592 | } |
| 3593 | } |
| 3594 | } |
| 3595 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 3596 | /* Start NACC from MS side */ |
| 3597 | private function f_outbound_nacc_success(inout GprsMS ms, PCUIF_info_ind info_ind, |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 3598 | boolean exp_rac_ci_query := true, boolean exp_si_query := true, |
| 3599 | boolean skip_final_ctrl_ack := false) |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 3600 | runs on RAW_PCU_Test_CT { |
| 3601 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 3602 | var RlcmacDlBlock dl_block; |
| 3603 | var uint32_t sched_fn; |
| 3604 | var GsmArfcn req_arfcn := 862; |
| 3605 | var uint6_t req_bsic := 43; |
| 3606 | |
| 3607 | /* Start NACC from MS side */ |
| 3608 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 3609 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3610 | |
| 3611 | if (exp_rac_ci_query == true) { |
| 3612 | /* osmo-pcu should now ask for resolution: */ |
| 3613 | f_ipa_ctrl_wait_link_up(); |
| 3614 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 3615 | int2str(info_ind.lac) & "." & |
| 3616 | int2str(info_ind.cell_id) & "." & |
| 3617 | int2str(req_arfcn) & "." & |
| 3618 | int2str(req_bsic); |
| 3619 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 3620 | } |
| 3621 | |
| 3622 | if (exp_si_query == true) { |
| 3623 | /* RIM procedure: */ |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 3624 | as_outbound_nacc_rim_resolve(info_ind); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 3625 | } |
| 3626 | |
| 3627 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 3628 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 3629 | |
| 3630 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 3631 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 3632 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 3633 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 3634 | f_shutdown(__BFILE__, __LINE__); |
| 3635 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 3636 | /* 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] | 3637 | 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] | 3638 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 3639 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3640 | } |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 3641 | } |
| 3642 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 3643 | /* Verify PCU handles outbound Network Assisted Cell Change Cell Change (NACC, TS 44.060 sec 8.8). */ |
| 3644 | testcase TC_nacc_outbound_success() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 3645 | var PollFnCtx pollctx; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 3646 | var GprsMS ms; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 3647 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 3648 | |
| 3649 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 3650 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 3651 | |
| 3652 | /* Initialize NS/BSSGP side */ |
| 3653 | f_init_bssgp(); |
| 3654 | /* Initialize GPRS MS side */ |
| 3655 | f_init_gprs_ms(); |
| 3656 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3657 | |
| 3658 | /* Initialize the PCU interface abstraction */ |
| 3659 | f_init_raw(testcasename(), info_ind); |
| 3660 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 3661 | /* Make sure we are not affected by full cache from previous tests */ |
| 3662 | f_pcuvty_flush_neigh_caches(); |
| 3663 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 3664 | /* Establish BSSGP connection to the PCU */ |
| 3665 | f_bssgp_establish(); |
| 3666 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3667 | |
| 3668 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 3669 | 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] | 3670 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3671 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 3672 | |
| 3673 | /* Start NACC from MS side */ |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 3674 | f_outbound_nacc_success(ms, info_ind); |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 3675 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 3676 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3677 | } |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 3678 | |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 3679 | /* Verify Pkt Cell Change Continue is retransmitted if not CTRL ACKed */ |
| 3680 | testcase TC_nacc_outbound_success_no_ctrl_ack() runs on RAW_PCU_Test_CT { |
| 3681 | var PollFnCtx pollctx; |
| 3682 | var GprsMS ms; |
| 3683 | var RlcmacDlBlock dl_block; |
| 3684 | var uint32_t sched_fn; |
| 3685 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 3686 | |
| 3687 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 3688 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 3689 | |
| 3690 | /* Initialize NS/BSSGP side */ |
| 3691 | f_init_bssgp(); |
| 3692 | /* Initialize GPRS MS side */ |
| 3693 | f_init_gprs_ms(); |
| 3694 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3695 | |
| 3696 | /* Initialize the PCU interface abstraction */ |
| 3697 | f_init_raw(testcasename(), info_ind); |
| 3698 | |
| 3699 | /* Make sure we are not affected by full cache from previous tests */ |
| 3700 | f_pcuvty_flush_neigh_caches(); |
| 3701 | |
| 3702 | /* Establish BSSGP connection to the PCU */ |
| 3703 | f_bssgp_establish(); |
| 3704 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3705 | |
| 3706 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 3707 | 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] | 3708 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3709 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 3710 | |
| 3711 | /* Start NACC from MS side, avoid sending final CTRL ACK */ |
| 3712 | f_outbound_nacc_success(ms, info_ind, skip_final_ctrl_ack := true); |
| 3713 | |
| 3714 | /* Wait until we receive something non-dummy */ |
| 3715 | dl_block := f_skip_dummy(0, sched_fn); |
| 3716 | /* Make sure it is a Pkt Cell Chg Continue (retransmitted)*/ |
| 3717 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 3718 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 3719 | } |
| 3720 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3721 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 3722 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 3723 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3724 | } |
| 3725 | |
| 3726 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3727 | } |
| 3728 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 3729 | /* Verify PCU handles outbound Network Assisted Cell Change Cell Change (NACC, TS 44.060 sec 8.8) twice, the second time using the caches */ |
| 3730 | testcase TC_nacc_outbound_success_twice() runs on RAW_PCU_Test_CT { |
| 3731 | var PollFnCtx pollctx; |
| 3732 | var GprsMS ms; |
| 3733 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 3734 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 3735 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 3736 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 3737 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 3738 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 3739 | /* Initialize NS/BSSGP side */ |
| 3740 | f_init_bssgp(); |
| 3741 | /* Initialize GPRS MS side */ |
| 3742 | f_init_gprs_ms(); |
| 3743 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3744 | |
| 3745 | /* Initialize the PCU interface abstraction */ |
| 3746 | f_init_raw(testcasename(), info_ind); |
| 3747 | |
| 3748 | /* Make sure we are not affected by full cache from previous tests */ |
| 3749 | f_pcuvty_flush_neigh_caches(); |
| 3750 | /* Set timeout values for caches so that entries will be in cache during second try */ |
| 3751 | f_pcuvty_set_neigh_caches(10, 10); |
| 3752 | |
| 3753 | /* Establish BSSGP connection to the PCU */ |
| 3754 | f_bssgp_establish(); |
| 3755 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3756 | |
| 3757 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 3758 | 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] | 3759 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3760 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 3761 | |
| 3762 | /* Start NACC from MS side */ |
| 3763 | f_outbound_nacc_success(ms, info_ind); |
| 3764 | |
| 3765 | /* First NACC procedure is done, let's try to start a new one now that previous queries are cached: */ |
| 3766 | f_outbound_nacc_success(ms, info_ind, false, false); |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 3767 | |
| 3768 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3769 | } |
| 3770 | |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 3771 | /* Verify PCU handles outbound Network Assisted Cell Change Cell Change (NACC, |
| 3772 | * TS 44.060 sec 8.8) twice, the second time after caches timed out |
| 3773 | */ |
| 3774 | testcase TC_nacc_outbound_success_twice_nocache() runs on RAW_PCU_Test_CT { |
| 3775 | var PollFnCtx pollctx; |
| 3776 | var GprsMS ms; |
| 3777 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 3778 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 3779 | |
| 3780 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 3781 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 3782 | |
| 3783 | /* Initialize NS/BSSGP side */ |
| 3784 | f_init_bssgp(); |
| 3785 | /* Initialize GPRS MS side */ |
| 3786 | f_init_gprs_ms(); |
| 3787 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3788 | |
| 3789 | /* Initialize the PCU interface abstraction */ |
| 3790 | f_init_raw(testcasename(), info_ind); |
| 3791 | |
| 3792 | /* Make sure we are not affected by full cache from previous tests */ |
| 3793 | f_pcuvty_flush_neigh_caches(); |
| 3794 | /* Set timeout values for caches so that entries will be erased before the second try */ |
| 3795 | f_pcuvty_set_neigh_caches(1, 1); |
| 3796 | |
| 3797 | /* Establish BSSGP connection to the PCU */ |
| 3798 | f_bssgp_establish(); |
| 3799 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3800 | |
| 3801 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 3802 | 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] | 3803 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3804 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 3805 | |
| 3806 | /* Start NACC from MS side */ |
| 3807 | f_outbound_nacc_success(ms, info_ind); |
| 3808 | |
| 3809 | /* CTRL client should have disconnected from us */ |
| 3810 | f_ipa_ctrl_wait_link_down(); |
| 3811 | /* wait for cache entries to time out */ |
| 3812 | f_sleep(2.0); |
| 3813 | /* First NACC procedure is done, let's try to start a new one now that previous queries have timed out: */ |
| 3814 | f_outbound_nacc_success(ms, info_ind); |
| 3815 | |
| 3816 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3817 | } |
| 3818 | |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 3819 | /* 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] | 3820 | testcase TC_nacc_outbound_rac_ci_resolve_conn_refused() runs on RAW_PCU_Test_CT { |
| 3821 | var RlcmacDlBlock dl_block; |
| 3822 | var PollFnCtx pollctx; |
| 3823 | var uint32_t sched_fn; |
| 3824 | var GprsMS ms; |
| 3825 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 3826 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 3827 | var GsmArfcn req_arfcn := 862; |
| 3828 | var uint6_t req_bsic := 43; |
| 3829 | |
| 3830 | /* In here we explicitly avoid starting osmo-bsc emulation neighbor |
| 3831 | * resolution CTRL port, to trigger Conn Refused by socket: |
| 3832 | * f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 3833 | */ |
| 3834 | |
| 3835 | /* Initialize NS/BSSGP side */ |
| 3836 | f_init_bssgp(); |
| 3837 | /* Initialize GPRS MS side */ |
| 3838 | f_init_gprs_ms(); |
| 3839 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3840 | |
| 3841 | /* Initialize the PCU interface abstraction */ |
| 3842 | f_init_raw(testcasename(), info_ind); |
| 3843 | |
| 3844 | /* Make sure we are not affected by full cache from previous tests */ |
| 3845 | f_pcuvty_flush_neigh_caches(); |
| 3846 | |
| 3847 | /* Establish BSSGP connection to the PCU */ |
| 3848 | f_bssgp_establish(); |
| 3849 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3850 | |
| 3851 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 3852 | 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] | 3853 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3854 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 3855 | |
| 3856 | /* Start NACC from MS side */ |
| 3857 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 3858 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3859 | |
| 3860 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 3861 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 3862 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 3863 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 3864 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 3865 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 3866 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3867 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 3868 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 3869 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3870 | } |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 3871 | |
| 3872 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3873 | } |
| 3874 | |
| 3875 | /* 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] | 3876 | testcase TC_nacc_outbound_rac_ci_resolve_timeout() runs on RAW_PCU_Test_CT { |
| 3877 | var RlcmacDlBlock dl_block; |
| 3878 | var PollFnCtx pollctx; |
| 3879 | var uint32_t sched_fn; |
| 3880 | var GprsMS ms; |
| 3881 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 3882 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 3883 | var GsmArfcn req_arfcn := 862; |
| 3884 | var uint6_t req_bsic := 43; |
| 3885 | |
| 3886 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 3887 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 3888 | |
| 3889 | /* Initialize NS/BSSGP side */ |
| 3890 | f_init_bssgp(); |
| 3891 | /* Initialize GPRS MS side */ |
| 3892 | f_init_gprs_ms(); |
| 3893 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3894 | |
| 3895 | /* Initialize the PCU interface abstraction */ |
| 3896 | f_init_raw(testcasename(), info_ind); |
| 3897 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 3898 | /* Make sure we are not affected by full cache from previous tests */ |
| 3899 | f_pcuvty_flush_neigh_caches(); |
| 3900 | |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 3901 | /* Establish BSSGP connection to the PCU */ |
| 3902 | f_bssgp_establish(); |
| 3903 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3904 | |
| 3905 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 3906 | 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] | 3907 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3908 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 3909 | |
| 3910 | /* Start NACC from MS side */ |
| 3911 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 3912 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3913 | |
| 3914 | /* osmo-pcu should now ask for resolution: */ |
| 3915 | f_ipa_ctrl_wait_link_up(); |
| 3916 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 3917 | int2str(info_ind.lac) & "." & |
| 3918 | int2str(info_ind.cell_id) & "." & |
| 3919 | int2str(req_arfcn) & "." & |
| 3920 | int2str(req_bsic); |
| 3921 | /* we receive RAC+CI resolution request, but we never answer to it, timeout should occur */ |
| 3922 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, omit); |
| 3923 | |
| 3924 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 3925 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 3926 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 3927 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 3928 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 3929 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 3930 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3931 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 3932 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 3933 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3934 | } |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 3935 | |
| 3936 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3937 | } |
| 3938 | |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 3939 | /* Verify PCU transmits Pkt Cell Change Continue if RAC+CI resolution fails during outbound NACC procedure */ |
| 3940 | testcase TC_nacc_outbound_rac_ci_resolve_fail_parse_response() runs on RAW_PCU_Test_CT { |
| 3941 | var RlcmacDlBlock dl_block; |
| 3942 | var PollFnCtx pollctx; |
| 3943 | var uint32_t sched_fn; |
| 3944 | var GprsMS ms; |
| 3945 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 3946 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 3947 | var GsmArfcn req_arfcn := 862; |
| 3948 | var uint6_t req_bsic := 43; |
| 3949 | |
| 3950 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 3951 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 3952 | |
| 3953 | /* Initialize NS/BSSGP side */ |
| 3954 | f_init_bssgp(); |
| 3955 | /* Initialize GPRS MS side */ |
| 3956 | f_init_gprs_ms(); |
| 3957 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3958 | |
| 3959 | /* Initialize the PCU interface abstraction */ |
| 3960 | f_init_raw(testcasename(), info_ind); |
| 3961 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 3962 | /* Make sure we are not affected by full cache from previous tests */ |
| 3963 | f_pcuvty_flush_neigh_caches(); |
| 3964 | |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 3965 | /* Establish BSSGP connection to the PCU */ |
| 3966 | f_bssgp_establish(); |
| 3967 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3968 | |
| 3969 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 3970 | 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] | 3971 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3972 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 3973 | |
| 3974 | /* Start NACC from MS side */ |
| 3975 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 3976 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 3977 | |
| 3978 | /* osmo-pcu should now ask for resolution: */ |
| 3979 | f_ipa_ctrl_wait_link_up(); |
| 3980 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 3981 | int2str(info_ind.lac) & "." & |
| 3982 | int2str(info_ind.cell_id) & "." & |
| 3983 | int2str(req_arfcn) & "." & |
| 3984 | int2str(req_bsic); |
| 3985 | /* we receive RAC+CI resolution request and we send incorrectlt formated response */ |
| 3986 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "foobar-error"); |
| 3987 | |
| 3988 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 3989 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 3990 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 3991 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 3992 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 3993 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 3994 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3995 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 3996 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 3997 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3998 | } |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 3999 | |
| 4000 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4001 | } |
| 4002 | |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4003 | /* Verify PCU transmits Pkt Cell Change Continue if SI resolution fails during outbound NACC procedure */ |
| 4004 | testcase TC_nacc_outbound_si_resolve_timeout() runs on RAW_PCU_Test_CT { |
| 4005 | var RlcmacDlBlock dl_block; |
| 4006 | var PollFnCtx pollctx; |
| 4007 | var uint32_t sched_fn; |
| 4008 | var GprsMS ms; |
| 4009 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4010 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4011 | var GsmArfcn req_arfcn := 862; |
| 4012 | var uint6_t req_bsic := 43; |
| 4013 | var BssgpCellId src := valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_enc_BcdMccMnc(info_ind.mcc, info_ind.mnc, info_ind.mnc_3_digits == 1), /* '262F42'H */ |
| 4014 | info_ind.lac), |
| 4015 | info_ind.rac), |
| 4016 | info_ind.cell_id)); |
| 4017 | var BssgpCellId dst := valueof(ts_BssgpCellId(ts_RAI(ts_LAI('023F43'H, /* Decided by test itself (emulating BSC) */ |
| 4018 | 423), |
| 4019 | 2), |
| 4020 | 5)); |
| 4021 | var template RIM_Routing_Address src_addr := t_RIM_Routing_Address_cid(src); |
| 4022 | var template RIM_Routing_Address dst_addr := t_RIM_Routing_Address_cid(dst); |
| 4023 | |
| 4024 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4025 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4026 | |
| 4027 | /* Initialize NS/BSSGP side */ |
| 4028 | f_init_bssgp(); |
| 4029 | /* Initialize GPRS MS side */ |
| 4030 | f_init_gprs_ms(); |
| 4031 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4032 | |
| 4033 | /* Initialize the PCU interface abstraction */ |
| 4034 | f_init_raw(testcasename(), info_ind); |
| 4035 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4036 | /* Make sure we are not affected by full cache from previous tests */ |
| 4037 | f_pcuvty_flush_neigh_caches(); |
| 4038 | |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4039 | /* Establish BSSGP connection to the PCU */ |
| 4040 | f_bssgp_establish(); |
| 4041 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4042 | |
| 4043 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4044 | 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] | 4045 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4046 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4047 | |
| 4048 | /* Start NACC from MS side */ |
| 4049 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4050 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4051 | |
| 4052 | /* osmo-pcu should now ask for resolution: */ |
| 4053 | f_ipa_ctrl_wait_link_up(); |
| 4054 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4055 | int2str(info_ind.lac) & "." & |
| 4056 | int2str(info_ind.cell_id) & "." & |
| 4057 | int2str(req_arfcn) & "." & |
| 4058 | int2str(req_bsic); |
| 4059 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4060 | |
| 4061 | /* RIM procedure: */ |
| 4062 | RIM.receive(tr_RAN_INFORMATION_REQUEST(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 4063 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 4064 | tr_RAN_Information_Request_RIM_Container)); |
| 4065 | /* We never answer the RIM procude -> PCU timeouts and should send Pkt Cell Chg continue */ |
| 4066 | |
| 4067 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4068 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4069 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 4070 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4071 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4072 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4073 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4074 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4075 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4076 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4077 | } |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4078 | |
| 4079 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4080 | } |
| 4081 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4082 | /* Test MS sending Pkt Cell Change Notify twice (duplicate msg) while waiting for CTRL resolution */ |
| 4083 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup() runs on RAW_PCU_Test_CT { |
| 4084 | var PollFnCtx pollctx; |
| 4085 | var GprsMS ms; |
| 4086 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 4087 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4088 | var RlcmacDlBlock dl_block; |
| 4089 | var uint32_t sched_fn; |
| 4090 | var CtrlMessage rx_ctrl; |
| 4091 | var GsmArfcn req_arfcn := 862; |
| 4092 | var uint6_t req_bsic := 43; |
| 4093 | |
| 4094 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4095 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4096 | |
| 4097 | /* Initialize NS/BSSGP side */ |
| 4098 | f_init_bssgp(); |
| 4099 | /* Initialize GPRS MS side */ |
| 4100 | f_init_gprs_ms(); |
| 4101 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4102 | |
| 4103 | /* Initialize the PCU interface abstraction */ |
| 4104 | f_init_raw(testcasename(), info_ind); |
| 4105 | |
| 4106 | /* Make sure we are not affected by full cache from previous tests */ |
| 4107 | f_pcuvty_flush_neigh_caches(); |
| 4108 | |
| 4109 | /* Establish BSSGP connection to the PCU */ |
| 4110 | f_bssgp_establish(); |
| 4111 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4112 | |
| 4113 | /* Send PACKET RESOURCE REQUEST */ |
| 4114 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 4115 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4116 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4117 | |
| 4118 | /* Start NACC from MS side */ |
| 4119 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4120 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4121 | |
| 4122 | /* osmo-pcu should now ask for resolution: */ |
| 4123 | f_ipa_ctrl_wait_link_up(); |
| 4124 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4125 | int2str(info_ind.lac) & "." & |
| 4126 | int2str(info_ind.cell_id) & "." & |
| 4127 | int2str(req_arfcn) & "." & |
| 4128 | int2str(req_bsic); |
| 4129 | IPA_CTRL.receive(tr_CtrlMsgGet(?, ctrl_var)) -> value rx_ctrl; |
| 4130 | /* Before receiving CTRL response, MS retransmits Pkt cell Chg Notif */ |
| 4131 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4132 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
| 4133 | IPA_CTRL.send(ts_CtrlMsgGetRepl(rx_ctrl.cmd.id, valueof(ctrl_var), valueof("023-43-423-2-5"))); |
| 4134 | timer T := 2.0; |
| 4135 | T.start; |
| 4136 | alt { |
| 4137 | [] as_outbound_nacc_rim_resolve(info_ind, do_repeat := true); |
| 4138 | [] IPA_CTRL.receive(tr_CtrlMsgGet(?, ctrl_var)) -> value rx_ctrl { |
| 4139 | setverdict(fail, "Received unexpected CTRL resolution after duplicate Pkt Cell Change Notification:", rx_ctrl); |
| 4140 | f_shutdown(__BFILE__, __LINE__); |
| 4141 | } |
| 4142 | [] T.timeout { |
| 4143 | setverdict(pass); |
| 4144 | } |
| 4145 | } |
| 4146 | |
| 4147 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 4148 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4149 | |
| 4150 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 4151 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4152 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4153 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4154 | f_shutdown(__BFILE__, __LINE__); |
| 4155 | } |
| 4156 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4157 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4158 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4159 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4160 | } |
| 4161 | |
| 4162 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4163 | } |
| 4164 | |
| 4165 | /* Test MS sending Pkt Cell Change Notify twice (duplicate msg) while waiting for SI resolution */ |
| 4166 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup2() runs on RAW_PCU_Test_CT { |
| 4167 | var PollFnCtx pollctx; |
| 4168 | var GprsMS ms; |
| 4169 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 4170 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4171 | var RlcmacDlBlock dl_block; |
| 4172 | var uint32_t sched_fn; |
| 4173 | var CtrlMessage rx_ctrl; |
| 4174 | var GsmArfcn req_arfcn := 862; |
| 4175 | var uint6_t req_bsic := 43; |
| 4176 | |
| 4177 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4178 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4179 | |
| 4180 | /* Initialize NS/BSSGP side */ |
| 4181 | f_init_bssgp(); |
| 4182 | /* Initialize GPRS MS side */ |
| 4183 | f_init_gprs_ms(); |
| 4184 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4185 | |
| 4186 | /* Initialize the PCU interface abstraction */ |
| 4187 | f_init_raw(testcasename(), info_ind); |
| 4188 | |
| 4189 | /* Make sure we are not affected by full cache from previous tests */ |
| 4190 | f_pcuvty_flush_neigh_caches(); |
| 4191 | |
| 4192 | /* Establish BSSGP connection to the PCU */ |
| 4193 | f_bssgp_establish(); |
| 4194 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4195 | |
| 4196 | /* Send PACKET RESOURCE REQUEST */ |
| 4197 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 4198 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4199 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4200 | |
| 4201 | /* Start NACC from MS side */ |
| 4202 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4203 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4204 | |
| 4205 | /* osmo-pcu should now ask for resolution: */ |
| 4206 | f_ipa_ctrl_wait_link_up(); |
| 4207 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4208 | int2str(info_ind.lac) & "." & |
| 4209 | int2str(info_ind.cell_id) & "." & |
| 4210 | int2str(req_arfcn) & "." & |
| 4211 | int2str(req_bsic); |
| 4212 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4213 | as_outbound_nacc_rim_resolve(info_ind, do_answer := false); |
| 4214 | /* Before receiving RIM response, MS retransmits Pkt cell Chg Notif */ |
| 4215 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4216 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
| 4217 | f_outbound_nacc_rim_tx_resp(info_ind); |
| 4218 | timer T := 1.0; |
| 4219 | T.start; |
| 4220 | alt { |
| 4221 | [] RIM.receive { |
| 4222 | setverdict(fail, "Received unexpected RIM message"); |
| 4223 | f_shutdown(__BFILE__, __LINE__); |
| 4224 | } |
| 4225 | [] T.timeout { |
| 4226 | setverdict(pass); |
| 4227 | } |
| 4228 | } |
| 4229 | |
| 4230 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 4231 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4232 | |
| 4233 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 4234 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4235 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4236 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4237 | f_shutdown(__BFILE__, __LINE__); |
| 4238 | } |
| 4239 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4240 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4241 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4242 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4243 | } |
| 4244 | |
| 4245 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4246 | } |
| 4247 | |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 4248 | /* Test MS sending Pkt Cell Change Notification twice (duplicate msg) while sending Pkt Neigh Data Change */ |
| 4249 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup3() runs on RAW_PCU_Test_CT { |
| 4250 | var PollFnCtx pollctx; |
| 4251 | var GprsMS ms; |
| 4252 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 4253 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4254 | var RlcmacDlBlock dl_block; |
| 4255 | var uint32_t sched_fn; |
| 4256 | var CtrlMessage rx_ctrl; |
| 4257 | var GsmArfcn req_arfcn := 862; |
| 4258 | var uint6_t req_bsic := 43; |
| 4259 | |
| 4260 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4261 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4262 | |
| 4263 | /* Initialize NS/BSSGP side */ |
| 4264 | f_init_bssgp(); |
| 4265 | /* Initialize GPRS MS side */ |
| 4266 | f_init_gprs_ms(); |
| 4267 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4268 | |
| 4269 | /* Initialize the PCU interface abstraction */ |
| 4270 | f_init_raw(testcasename(), info_ind); |
| 4271 | |
| 4272 | /* Make sure we are not affected by full cache from previous tests */ |
| 4273 | f_pcuvty_flush_neigh_caches(); |
| 4274 | |
| 4275 | /* Establish BSSGP connection to the PCU */ |
| 4276 | f_bssgp_establish(); |
| 4277 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4278 | |
| 4279 | /* Send PACKET RESOURCE REQUEST */ |
| 4280 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 4281 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4282 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4283 | |
| 4284 | /* Start NACC from MS side */ |
| 4285 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4286 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4287 | |
| 4288 | /* osmo-pcu should now ask for resolution: */ |
| 4289 | f_ipa_ctrl_wait_link_up(); |
| 4290 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4291 | int2str(info_ind.lac) & "." & |
| 4292 | int2str(info_ind.cell_id) & "." & |
| 4293 | int2str(req_arfcn) & "." & |
| 4294 | int2str(req_bsic); |
| 4295 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4296 | /* RIM procedure: */ |
| 4297 | as_outbound_nacc_rim_resolve(info_ind); |
| 4298 | |
| 4299 | /* Receive first Pkt Neigh data Change, then trigger a new Pkt Cell Change Notif: */ |
| 4300 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, single_step := true); |
| 4301 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4302 | |
| 4303 | /* It should be ignored, let's continue fetching Pkt Neigh Data Change */ |
| 4304 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, f_ms_tx_TsTrxBtsNum(ms), 1, 16); |
| 4305 | |
| 4306 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 4307 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4308 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4309 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4310 | f_shutdown(__BFILE__, __LINE__); |
| 4311 | } |
| 4312 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4313 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4314 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4315 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4316 | } |
| 4317 | } |
| 4318 | |
| 4319 | /* Test MS sending Pkt Cell Change Notification twice (duplicate msg) while sending Pkt Cell Change Continue */ |
| 4320 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup4() runs on RAW_PCU_Test_CT { |
| 4321 | var PollFnCtx pollctx; |
| 4322 | var GprsMS ms; |
| 4323 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 4324 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4325 | var RlcmacDlBlock dl_block; |
| 4326 | var uint32_t sched_fn; |
| 4327 | var CtrlMessage rx_ctrl; |
| 4328 | var GsmArfcn req_arfcn := 862; |
| 4329 | var uint6_t req_bsic := 43; |
| 4330 | |
| 4331 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4332 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4333 | |
| 4334 | /* Initialize NS/BSSGP side */ |
| 4335 | f_init_bssgp(); |
| 4336 | /* Initialize GPRS MS side */ |
| 4337 | f_init_gprs_ms(); |
| 4338 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4339 | |
| 4340 | /* Initialize the PCU interface abstraction */ |
| 4341 | f_init_raw(testcasename(), info_ind); |
| 4342 | |
| 4343 | /* Make sure we are not affected by full cache from previous tests */ |
| 4344 | f_pcuvty_flush_neigh_caches(); |
| 4345 | |
| 4346 | /* Establish BSSGP connection to the PCU */ |
| 4347 | f_bssgp_establish(); |
| 4348 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4349 | |
| 4350 | /* Send PACKET RESOURCE REQUEST */ |
| 4351 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 4352 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4353 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4354 | |
| 4355 | /* Start NACC from MS side */ |
| 4356 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4357 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4358 | |
| 4359 | /* osmo-pcu should now ask for resolution: */ |
| 4360 | f_ipa_ctrl_wait_link_up(); |
| 4361 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4362 | int2str(info_ind.lac) & "." & |
| 4363 | int2str(info_ind.cell_id) & "." & |
| 4364 | int2str(req_arfcn) & "." & |
| 4365 | int2str(req_bsic); |
| 4366 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4367 | /* RIM procedure: */ |
| 4368 | as_outbound_nacc_rim_resolve(info_ind); |
| 4369 | |
| 4370 | /* Announce SI back to MS, continue NACC procedure */ |
| 4371 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 4372 | |
| 4373 | /* trigger a dup Pkt Cell Change Notif, it should be ignored: */ |
| 4374 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4375 | |
| 4376 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 4377 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4378 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4379 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4380 | f_shutdown(__BFILE__, __LINE__); |
| 4381 | } |
| 4382 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4383 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4384 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4385 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4386 | } |
| 4387 | } |
| 4388 | |
| 4389 | /* Test MS sending Pkt Cell Change Notification twice (duplicate msg) while waiting for Pkt Cell Change Continue CTRL ACK */ |
| 4390 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup5() runs on RAW_PCU_Test_CT { |
| 4391 | var PollFnCtx pollctx; |
| 4392 | var GprsMS ms; |
| 4393 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 4394 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4395 | var RlcmacDlBlock dl_block; |
| 4396 | var uint32_t sched_fn; |
| 4397 | var CtrlMessage rx_ctrl; |
| 4398 | var GsmArfcn req_arfcn := 862; |
| 4399 | var uint6_t req_bsic := 43; |
| 4400 | |
| 4401 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4402 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4403 | |
| 4404 | /* Initialize NS/BSSGP side */ |
| 4405 | f_init_bssgp(); |
| 4406 | /* Initialize GPRS MS side */ |
| 4407 | f_init_gprs_ms(); |
| 4408 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4409 | |
| 4410 | /* Initialize the PCU interface abstraction */ |
| 4411 | f_init_raw(testcasename(), info_ind); |
| 4412 | |
| 4413 | /* Make sure we are not affected by full cache from previous tests */ |
| 4414 | f_pcuvty_flush_neigh_caches(); |
| 4415 | |
| 4416 | /* Establish BSSGP connection to the PCU */ |
| 4417 | f_bssgp_establish(); |
| 4418 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4419 | |
| 4420 | /* Send PACKET RESOURCE REQUEST */ |
| 4421 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 4422 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4423 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4424 | |
| 4425 | /* Start NACC from MS side */ |
| 4426 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4427 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4428 | |
| 4429 | /* osmo-pcu should now ask for resolution: */ |
| 4430 | f_ipa_ctrl_wait_link_up(); |
| 4431 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4432 | int2str(info_ind.lac) & "." & |
| 4433 | int2str(info_ind.cell_id) & "." & |
| 4434 | int2str(req_arfcn) & "." & |
| 4435 | int2str(req_bsic); |
| 4436 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4437 | /* RIM procedure: */ |
| 4438 | as_outbound_nacc_rim_resolve(info_ind); |
| 4439 | |
| 4440 | /* Announce SI back to MS, continue NACC procedure */ |
| 4441 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 4442 | |
| 4443 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 4444 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4445 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4446 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4447 | f_shutdown(__BFILE__, __LINE__); |
| 4448 | } |
| 4449 | /* trigger a dup Pkt Cell Change Notif, it should be ignored: */ |
| 4450 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4451 | |
| 4452 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4453 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4454 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4455 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4456 | } |
| 4457 | } |
| 4458 | |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 4459 | /* Test MS sending Pkt Cell Change Notify twice (different tgt cell each time) |
| 4460 | * while waiting for CTRL resolution */ |
| 4461 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice() runs on RAW_PCU_Test_CT { |
| 4462 | var PollFnCtx pollctx; |
| 4463 | var GprsMS ms; |
| 4464 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 4465 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4466 | var RlcmacDlBlock dl_block; |
| 4467 | var uint32_t sched_fn; |
| 4468 | var CtrlMessage rx_ctrl; |
| 4469 | var GsmArfcn req_arfcn := 862; |
| 4470 | var uint6_t req_bsic := 43; |
| 4471 | |
| 4472 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4473 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4474 | |
| 4475 | /* Initialize NS/BSSGP side */ |
| 4476 | f_init_bssgp(); |
| 4477 | /* Initialize GPRS MS side */ |
| 4478 | f_init_gprs_ms(); |
| 4479 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4480 | |
| 4481 | /* Initialize the PCU interface abstraction */ |
| 4482 | f_init_raw(testcasename(), info_ind); |
| 4483 | |
| 4484 | /* Make sure we are not affected by full cache from previous tests */ |
| 4485 | f_pcuvty_flush_neigh_caches(); |
| 4486 | |
| 4487 | /* Establish BSSGP connection to the PCU */ |
| 4488 | f_bssgp_establish(); |
| 4489 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4490 | |
| 4491 | /* Send PACKET RESOURCE REQUEST */ |
| 4492 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 4493 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4494 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4495 | |
| 4496 | /* Start NACC from MS side */ |
| 4497 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4498 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4499 | |
| 4500 | /* osmo-pcu should now ask for resolution: */ |
| 4501 | f_ipa_ctrl_wait_link_up(); |
| 4502 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4503 | int2str(info_ind.lac) & "." & |
| 4504 | int2str(info_ind.cell_id) & "." & |
| 4505 | int2str(req_arfcn) & "." & |
| 4506 | int2str(req_bsic); |
| 4507 | IPA_CTRL.receive(tr_CtrlMsgGet(?, ctrl_var)) -> value rx_ctrl; |
| 4508 | /* Before receiving CTRL response, MS retransmits Pkt cell Chg Notif with different tgt arfcn */ |
| 4509 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 4510 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4511 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
| 4512 | IPA_CTRL.send(ts_CtrlMsgGetRepl(rx_ctrl.cmd.id, valueof(ctrl_var), valueof("023-43-423-2-5"))); |
| 4513 | /* We should now receive a 2nd CTRL request with the new ARFCN+BSIC */ |
| 4514 | ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4515 | int2str(info_ind.lac) & "." & |
| 4516 | int2str(info_ind.cell_id) & "." & |
| 4517 | int2str(req_arfcn + 1) & "." & |
| 4518 | int2str(req_bsic + 1); |
| 4519 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4520 | |
| 4521 | /* And finally everything continues as usual with RIN procedure */ |
| 4522 | as_outbound_nacc_rim_resolve(info_ind); |
| 4523 | |
| 4524 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 4525 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 4526 | |
| 4527 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 4528 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4529 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4530 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4531 | f_shutdown(__BFILE__, __LINE__); |
| 4532 | } |
| 4533 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4534 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4535 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4536 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4537 | } |
| 4538 | |
| 4539 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4540 | } |
| 4541 | |
| 4542 | /* Test MS sending Pkt Cell Change Notify twice (different tgt cell each time) |
| 4543 | * while waiting for SI resolution */ |
| 4544 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice2() runs on RAW_PCU_Test_CT { |
| 4545 | var PollFnCtx pollctx; |
| 4546 | var GprsMS ms; |
| 4547 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 4548 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4549 | var RlcmacDlBlock dl_block; |
| 4550 | var uint32_t sched_fn; |
| 4551 | var CtrlMessage rx_ctrl; |
| 4552 | var GsmArfcn req_arfcn := 862; |
| 4553 | var uint6_t req_bsic := 43; |
| 4554 | |
| 4555 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4556 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4557 | |
| 4558 | /* Initialize NS/BSSGP side */ |
| 4559 | f_init_bssgp(); |
| 4560 | /* Initialize GPRS MS side */ |
| 4561 | f_init_gprs_ms(); |
| 4562 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4563 | |
| 4564 | /* Initialize the PCU interface abstraction */ |
| 4565 | f_init_raw(testcasename(), info_ind); |
| 4566 | |
| 4567 | /* Make sure we are not affected by full cache from previous tests */ |
| 4568 | f_pcuvty_flush_neigh_caches(); |
| 4569 | |
| 4570 | /* Establish BSSGP connection to the PCU */ |
| 4571 | f_bssgp_establish(); |
| 4572 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4573 | |
| 4574 | /* Send PACKET RESOURCE REQUEST */ |
| 4575 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 4576 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4577 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4578 | |
| 4579 | /* Start NACC from MS side */ |
| 4580 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4581 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4582 | |
| 4583 | /* osmo-pcu should now ask for resolution: */ |
| 4584 | f_ipa_ctrl_wait_link_up(); |
| 4585 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4586 | int2str(info_ind.lac) & "." & |
| 4587 | int2str(info_ind.cell_id) & "." & |
| 4588 | int2str(req_arfcn) & "." & |
| 4589 | int2str(req_bsic); |
| 4590 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4591 | as_outbound_nacc_rim_resolve(info_ind, do_answer := false); |
| 4592 | /* Before receiving RIM response, MS retransmits Pkt cell Chg Notif with different tgt cell: */ |
| 4593 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 4594 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4595 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
| 4596 | f_outbound_nacc_rim_tx_resp(info_ind); |
| 4597 | |
| 4598 | /* As a result, CTRL + RIM resolution for new tgt cell should now be done: */ |
| 4599 | ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4600 | int2str(info_ind.lac) & "." & |
| 4601 | int2str(info_ind.cell_id) & "." & |
| 4602 | int2str(req_arfcn + 1) & "." & |
| 4603 | int2str(req_bsic + 1); |
| 4604 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4605 | |
| 4606 | /* And finally everything continues as usual with RIN procedure */ |
| 4607 | as_outbound_nacc_rim_resolve(info_ind); |
| 4608 | |
| 4609 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 4610 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 4611 | |
| 4612 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 4613 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4614 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4615 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4616 | f_shutdown(__BFILE__, __LINE__); |
| 4617 | } |
| 4618 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4619 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4620 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4621 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4622 | } |
| 4623 | |
| 4624 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4625 | } |
| 4626 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 4627 | /* Test MS sending Pkt Cell Change Notify twice (different tgt cell each time) |
| 4628 | * while sending Pkt Neigh Data Change */ |
| 4629 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice3() runs on RAW_PCU_Test_CT { |
| 4630 | var PollFnCtx pollctx; |
| 4631 | var GprsMS ms; |
| 4632 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 4633 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4634 | var RlcmacDlBlock dl_block; |
| 4635 | var uint32_t sched_fn; |
| 4636 | var CtrlMessage rx_ctrl; |
| 4637 | var GsmArfcn req_arfcn := 862; |
| 4638 | var uint6_t req_bsic := 43; |
| 4639 | |
| 4640 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4641 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4642 | |
| 4643 | /* Initialize NS/BSSGP side */ |
| 4644 | f_init_bssgp(); |
| 4645 | /* Initialize GPRS MS side */ |
| 4646 | f_init_gprs_ms(); |
| 4647 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4648 | |
| 4649 | /* Initialize the PCU interface abstraction */ |
| 4650 | f_init_raw(testcasename(), info_ind); |
| 4651 | |
| 4652 | /* Make sure we are not affected by full cache from previous tests */ |
| 4653 | f_pcuvty_flush_neigh_caches(); |
| 4654 | |
| 4655 | /* Establish BSSGP connection to the PCU */ |
| 4656 | f_bssgp_establish(); |
| 4657 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4658 | |
| 4659 | /* Send PACKET RESOURCE REQUEST */ |
| 4660 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 4661 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4662 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4663 | |
| 4664 | /* Start NACC from MS side */ |
| 4665 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4666 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4667 | |
| 4668 | /* osmo-pcu should now ask for resolution: */ |
| 4669 | f_ipa_ctrl_wait_link_up(); |
| 4670 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4671 | int2str(info_ind.lac) & "." & |
| 4672 | int2str(info_ind.cell_id) & "." & |
| 4673 | int2str(req_arfcn) & "." & |
| 4674 | int2str(req_bsic); |
| 4675 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4676 | /* RIM procedure: */ |
| 4677 | as_outbound_nacc_rim_resolve(info_ind); |
| 4678 | |
| 4679 | /* Receive first Pkt Neigh data Change, then trigger a new Pkt Cell Change Notif (different ARFCN+BSIC): */ |
| 4680 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, single_step := true); |
| 4681 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 4682 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4683 | |
| 4684 | /* It should trigger RAC_CI resolution to start again: */ |
| 4685 | ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4686 | int2str(info_ind.lac) & "." & |
| 4687 | int2str(info_ind.cell_id) & "." & |
| 4688 | int2str(req_arfcn + 1) & "." & |
| 4689 | int2str(req_bsic + 1); |
| 4690 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4691 | /* RIM procedure: */ |
| 4692 | as_outbound_nacc_rim_resolve(info_ind); |
| 4693 | /* Transmit SI back to MS */ |
| 4694 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 4695 | |
| 4696 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 4697 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4698 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4699 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4700 | f_shutdown(__BFILE__, __LINE__); |
| 4701 | } |
| 4702 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4703 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4704 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4705 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4706 | } |
| 4707 | } |
| 4708 | |
| 4709 | /* Test MS sending Pkt Cell Change Notification twice (different tgt cell) while sending Pkt Cell Change Continue */ |
| 4710 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice4() runs on RAW_PCU_Test_CT { |
| 4711 | var PollFnCtx pollctx; |
| 4712 | var GprsMS ms; |
| 4713 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 4714 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4715 | var RlcmacDlBlock dl_block; |
| 4716 | var uint32_t sched_fn; |
| 4717 | var CtrlMessage rx_ctrl; |
| 4718 | var GsmArfcn req_arfcn := 862; |
| 4719 | var uint6_t req_bsic := 43; |
| 4720 | |
| 4721 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4722 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4723 | |
| 4724 | /* Initialize NS/BSSGP side */ |
| 4725 | f_init_bssgp(); |
| 4726 | /* Initialize GPRS MS side */ |
| 4727 | f_init_gprs_ms(); |
| 4728 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4729 | |
| 4730 | /* Initialize the PCU interface abstraction */ |
| 4731 | f_init_raw(testcasename(), info_ind); |
| 4732 | |
| 4733 | /* Make sure we are not affected by full cache from previous tests */ |
| 4734 | f_pcuvty_flush_neigh_caches(); |
| 4735 | |
| 4736 | /* Establish BSSGP connection to the PCU */ |
| 4737 | f_bssgp_establish(); |
| 4738 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4739 | |
| 4740 | /* Send PACKET RESOURCE REQUEST */ |
| 4741 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 4742 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4743 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4744 | |
| 4745 | /* Start NACC from MS side */ |
| 4746 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4747 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4748 | |
| 4749 | /* osmo-pcu should now ask for resolution: */ |
| 4750 | f_ipa_ctrl_wait_link_up(); |
| 4751 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4752 | int2str(info_ind.lac) & "." & |
| 4753 | int2str(info_ind.cell_id) & "." & |
| 4754 | int2str(req_arfcn) & "." & |
| 4755 | int2str(req_bsic); |
| 4756 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4757 | /* RIM procedure: */ |
| 4758 | as_outbound_nacc_rim_resolve(info_ind); |
| 4759 | |
| 4760 | /* Announce SI back to MS, continue NACC procedure */ |
| 4761 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 4762 | |
| 4763 | /* trigger a Pkt Cell Change Notif with different tgt cell */ |
| 4764 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 4765 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4766 | |
| 4767 | /* PCU TBF NACC state changed, so we should next receive a dummy block: */ |
| 4768 | f_rx_rlcmac_dl_block_exp_dummy(dl_block, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4769 | |
| 4770 | /* It should trigger RAC_CI resolution to start again: */ |
| 4771 | ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4772 | int2str(info_ind.lac) & "." & |
| 4773 | int2str(info_ind.cell_id) & "." & |
| 4774 | int2str(req_arfcn + 1) & "." & |
| 4775 | int2str(req_bsic + 1); |
| 4776 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4777 | /* RIM procedure: */ |
| 4778 | as_outbound_nacc_rim_resolve(info_ind); |
| 4779 | /* Transmit SI back to MS */ |
| 4780 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 4781 | |
| 4782 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 4783 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4784 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4785 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4786 | f_shutdown(__BFILE__, __LINE__); |
| 4787 | } |
| 4788 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4789 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4790 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4791 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4792 | } |
| 4793 | } |
| 4794 | |
| 4795 | /* Test MS sending Pkt Cell Change Notification twice (different tgt cell) while waiting for Pkt Cell Change Continue CTRL ACK*/ |
| 4796 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice5() runs on RAW_PCU_Test_CT { |
| 4797 | var PollFnCtx pollctx; |
| 4798 | var GprsMS ms; |
| 4799 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 4800 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4801 | var RlcmacDlBlock dl_block; |
| 4802 | var uint32_t sched_fn; |
| 4803 | var CtrlMessage rx_ctrl; |
| 4804 | var GsmArfcn req_arfcn := 862; |
| 4805 | var uint6_t req_bsic := 43; |
| 4806 | |
| 4807 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4808 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4809 | |
| 4810 | /* Initialize NS/BSSGP side */ |
| 4811 | f_init_bssgp(); |
| 4812 | /* Initialize GPRS MS side */ |
| 4813 | f_init_gprs_ms(); |
| 4814 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4815 | |
| 4816 | /* Initialize the PCU interface abstraction */ |
| 4817 | f_init_raw(testcasename(), info_ind); |
| 4818 | |
| 4819 | /* Make sure we are not affected by full cache from previous tests */ |
| 4820 | f_pcuvty_flush_neigh_caches(); |
| 4821 | |
| 4822 | /* Establish BSSGP connection to the PCU */ |
| 4823 | f_bssgp_establish(); |
| 4824 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4825 | |
| 4826 | /* Send PACKET RESOURCE REQUEST */ |
| 4827 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 4828 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4829 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4830 | |
| 4831 | /* Start NACC from MS side */ |
| 4832 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4833 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4834 | |
| 4835 | /* osmo-pcu should now ask for resolution: */ |
| 4836 | f_ipa_ctrl_wait_link_up(); |
| 4837 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4838 | int2str(info_ind.lac) & "." & |
| 4839 | int2str(info_ind.cell_id) & "." & |
| 4840 | int2str(req_arfcn) & "." & |
| 4841 | int2str(req_bsic); |
| 4842 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4843 | /* RIM procedure: */ |
| 4844 | as_outbound_nacc_rim_resolve(info_ind); |
| 4845 | |
| 4846 | /* Announce SI back to MS, continue NACC procedure */ |
| 4847 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 4848 | |
| 4849 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 4850 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4851 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4852 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4853 | f_shutdown(__BFILE__, __LINE__); |
| 4854 | } |
| 4855 | |
| 4856 | /* trigger a Pkt Cell Change Notif with different tgt cell */ |
| 4857 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 4858 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4859 | |
| 4860 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4861 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4862 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4863 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4864 | } |
| 4865 | /* PCU TBF NACC state changed, so we should next receive a dummy block: */ |
| 4866 | f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 4867 | |
| 4868 | /* It should trigger RAC_CI resolution to start again: */ |
| 4869 | ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4870 | int2str(info_ind.lac) & "." & |
| 4871 | int2str(info_ind.cell_id) & "." & |
| 4872 | int2str(req_arfcn + 1) & "." & |
| 4873 | int2str(req_bsic + 1); |
| 4874 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4875 | /* RIM procedure: */ |
| 4876 | as_outbound_nacc_rim_resolve(info_ind); |
| 4877 | /* Transmit SI back to MS */ |
| 4878 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 4879 | |
| 4880 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 4881 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4882 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4883 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4884 | f_shutdown(__BFILE__, __LINE__); |
| 4885 | } |
| 4886 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4887 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4888 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4889 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4890 | } |
| 4891 | } |
| 4892 | |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 4893 | /* Send a RIM RAN info request to the PCU and verify the response, we expect |
| 4894 | * getting the system information back which we have transfered to the PCU via |
| 4895 | * PCUIF on startup. */ |
| 4896 | testcase TC_rim_ran_info_req_single_rep() runs on RAW_PCU_Test_CT { |
| 4897 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 4898 | timer T := 2.0; |
| 4899 | |
| 4900 | /* Initialize NS/BSSGP side */ |
| 4901 | f_init_bssgp(); |
| 4902 | |
| 4903 | /* Initialize the PCU interface abstraction */ |
| 4904 | f_init_raw(testcasename()); |
| 4905 | |
| 4906 | /* Establish BSSGP connection to the PCU */ |
| 4907 | f_bssgp_establish(); |
| 4908 | |
| 4909 | /* Send sysinfo to the PCU */ |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 4910 | 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] | 4911 | BTS.send(si1_data_ind); |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 4912 | 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] | 4913 | BTS.send(si3_data_ind); |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 4914 | var template PCUIF_Message si16_data_ind := ts_PCUIF_DATA_IND(0, 0, 0, 0, PCU_IF_SAPI_BCCH, '0106'O & si13_default, 0, 0, 0, 0, 32767); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 4915 | BTS.send(si16_data_ind); |
| 4916 | f_sleep(1.0); |
| 4917 | |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 4918 | var RIM_Routing_Address dst_addr; |
| 4919 | var RIM_Routing_Address src_addr; |
| 4920 | var template (value) RAN_Information_Request_RIM_Container req_cont; |
| 4921 | var template (value) PDU_BSSGP bssgp_rim_pdu; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 4922 | var template PDU_BSSGP bssgp_rim_pdu_expect; |
| 4923 | var template RAN_Information_RIM_Container rim_cont_expect; |
| 4924 | |
| 4925 | 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] | 4926 | src_addr := valueof(t_RIM_Routing_Address_cid(src_cid)); |
| 4927 | 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] | 4928 | |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 4929 | req_cont := ts_RAN_Information_Request_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 4930 | ts_RIM_Sequence_Number(1), |
| 4931 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 4932 | ts_RIM_Protocol_Version_Number(1), |
| 4933 | tsu_RAN_Information_Request_Application_Container_NACC(mp_gb_cfg.bvc[0].cell_id), |
| 4934 | omit); |
| 4935 | bssgp_rim_pdu := ts_RAN_INFORMATION_REQUEST(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 4936 | ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 4937 | req_cont); |
| 4938 | |
| 4939 | rim_cont_expect := tr_RAN_Information_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 4940 | tr_RIM_Sequence_Number(1), |
| 4941 | tr_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 4942 | tr_RIM_Protocol_Version_Number(1), |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 4943 | 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] | 4944 | omit); |
| 4945 | |
| 4946 | bssgp_rim_pdu_expect := tr_PDU_BSSGP_RAN_INFORMATION(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 4947 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 4948 | rim_cont_expect); |
| 4949 | RIM.send(bssgp_rim_pdu); |
| 4950 | T.start; |
| 4951 | alt { |
| 4952 | [] RIM.receive(bssgp_rim_pdu_expect) { } |
| 4953 | [] RIM.receive { |
| 4954 | setverdict(fail, "Unexpected BSSGP RIM PDU received"); |
| 4955 | } |
| 4956 | [] T.timeout { |
| 4957 | setverdict(fail, "No BSSGP RIM PDU received"); |
| 4958 | mtc.stop; |
| 4959 | } |
| 4960 | } |
| 4961 | |
| 4962 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4963 | } |
| 4964 | |
| 4965 | /* Same as above, but in this case we simulate the rare case in which the PCU |
| 4966 | * has no system information available. We expect getting a response back but |
| 4967 | * with no system information inside. */ |
| 4968 | 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] | 4969 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 4970 | var PCUIF_Message pcu_msg; |
| 4971 | timer T := 2.0; |
| 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(); |
| 4981 | |
| 4982 | /* Clear sysinfo from the PCU */ |
| 4983 | 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); |
| 4984 | BTS.send(si1_data_ind); |
| 4985 | 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); |
| 4986 | BTS.send(si3_data_ind); |
| 4987 | 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); |
| 4988 | BTS.send(si16_data_ind); |
| 4989 | f_sleep(1.0); |
| 4990 | |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 4991 | var RIM_Routing_Address dst_addr; |
| 4992 | var RIM_Routing_Address src_addr; |
| 4993 | var template (value) RAN_Information_Request_RIM_Container req_cont; |
| 4994 | var template (value) PDU_BSSGP bssgp_rim_pdu; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 4995 | var template PDU_BSSGP bssgp_rim_pdu_expect; |
| 4996 | var template RAN_Information_RIM_Container rim_cont_expect; |
| 4997 | |
| 4998 | 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] | 4999 | src_addr := valueof(t_RIM_Routing_Address_cid(src_cid)); |
| 5000 | 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] | 5001 | |
| 5002 | req_cont := ts_RAN_Information_Request_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 5003 | ts_RIM_Sequence_Number(1), |
| 5004 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 5005 | ts_RIM_Protocol_Version_Number(1), |
| 5006 | tsu_RAN_Information_Request_Application_Container_NACC(mp_gb_cfg.bvc[0].cell_id), |
| 5007 | omit); |
| 5008 | bssgp_rim_pdu := ts_RAN_INFORMATION_REQUEST(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 5009 | ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 5010 | req_cont); |
| 5011 | |
| 5012 | |
| 5013 | rim_cont_expect := tr_RAN_Information_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 5014 | tr_RIM_Sequence_Number(1), |
| 5015 | tr_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 5016 | tr_RIM_Protocol_Version_Number(1), |
| 5017 | tru_ApplContainer_or_ApplErrContainer_NACC(tru_ApplContainer_NACC(mp_gb_cfg.bvc[0].cell_id, false, 0, ''O)), |
| 5018 | omit); |
| 5019 | |
| 5020 | bssgp_rim_pdu_expect := tr_PDU_BSSGP_RAN_INFORMATION(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 5021 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 5022 | rim_cont_expect); |
| 5023 | RIM.send(bssgp_rim_pdu); |
| 5024 | T.start; |
| 5025 | alt { |
| 5026 | [] RIM.receive(bssgp_rim_pdu_expect) { } |
| 5027 | [] RIM.receive { |
| 5028 | setverdict(fail, "Unexpected BSSGP RIM PDU received"); |
| 5029 | } |
| 5030 | [] T.timeout { |
| 5031 | setverdict(fail, "No BSSGP RIM PDU received"); |
| 5032 | mtc.stop; |
| 5033 | } |
| 5034 | } |
| 5035 | |
| 5036 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5037 | } |
| 5038 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 5039 | control { |
| 5040 | execute( TC_pcuif_suspend() ); |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 5041 | execute( TC_pcuif_suspend_active_tbf() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 5042 | execute( TC_ta_ptcch_idle() ); |
| 5043 | execute( TC_ta_rach_imm_ass() ); |
| 5044 | execute( TC_ta_idle_dl_tbf_ass() ); |
| 5045 | execute( TC_ta_ptcch_ul_multi_tbf() ); |
| 5046 | execute( TC_cs_lqual_ul_tbf() ); |
| 5047 | execute( TC_cs_initial_ul() ); |
| 5048 | execute( TC_cs_max_ul() ); |
Pau Espin Pedrol | 7512259 | 2020-11-03 15:22:59 +0100 | [diff] [blame] | 5049 | execute( TC_cs_initial_dl() ); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 5050 | execute( TC_cs_max_dl() ); |
| 5051 | execute( TC_dl_cs1_to_cs4() ); |
Pau Espin Pedrol | 2354d6a | 2020-11-05 18:36:59 +0100 | [diff] [blame] | 5052 | execute( TC_mcs_initial_ul() ); |
Pau Espin Pedrol | db15fa7 | 2020-11-11 12:58:34 +0100 | [diff] [blame] | 5053 | execute( TC_mcs_max_ul() ); |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 5054 | execute( TC_mcs_initial_dl() ); |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 5055 | execute( TC_mcs_max_dl() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 5056 | execute( TC_t3169() ); |
| 5057 | execute( TC_t3193() ); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 5058 | execute( TC_countdown_procedure() ); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 5059 | execute( TC_ul_all_sizes() ); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 5060 | execute( TC_ul_data_toolong_fills_padding() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 5061 | execute( TC_mo_ping_pong() ); |
| 5062 | execute( TC_mo_ping_pong_with_ul_racap() ); |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 5063 | execute( TC_force_two_phase_access() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 5064 | execute( TC_mt_ping_pong() ); |
| 5065 | execute( TC_mt_ping_pong_with_dl_racap() ); |
Pau Espin Pedrol | e1195bb | 2020-07-07 13:27:18 +0200 | [diff] [blame] | 5066 | execute( TC_ul_intermediate_retrans() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 5067 | execute( TC_imm_ass_dl_block_retrans() ); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 5068 | execute( TC_dl_flow_more_blocks() ); |
Pau Espin Pedrol | e1195bb | 2020-07-07 13:27:18 +0200 | [diff] [blame] | 5069 | execute( TC_ul_flow_multiple_llc_blocks() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 5070 | execute( TC_paging_cs_from_bts() ); |
| 5071 | execute( TC_paging_cs_from_sgsn_sign_ptmsi() ); |
| 5072 | execute( TC_paging_cs_from_sgsn_sign() ); |
| 5073 | execute( TC_paging_cs_from_sgsn_ptp() ); |
| 5074 | execute( TC_paging_ps_from_sgsn_sign_ptmsi() ); |
| 5075 | execute( TC_paging_ps_from_sgsn_sign() ); |
| 5076 | execute( TC_paging_ps_from_sgsn_ptp() ); |
Vadim Yanitskiy | dbd4b24 | 2020-10-31 05:44:58 +0700 | [diff] [blame] | 5077 | execute( TC_paging_cs_multi_ms_imsi_tmsi() ); |
| 5078 | execute( TC_paging_cs_multi_ms_imsi() ); |
| 5079 | execute( TC_paging_cs_multi_ms_tmsi() ); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 5080 | execute( TC_bssgp_dl_unitdata_with_valid_imsi() ); |
| 5081 | execute( TC_bssgp_dl_unitdata_with_invalid_imsi() ); |
Pau Espin Pedrol | 2e459d6 | 2020-11-30 19:34:16 +0100 | [diff] [blame] | 5082 | execute( TC_dl_gprs_data_no_llc_ui_dummy() ); |
| 5083 | execute( TC_dl_egprs_data_no_llc_ui_dummy() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 5084 | |
| 5085 | /* EGPRS specific test cases */ |
| 5086 | execute( TC_egprs_pkt_chan_req_signalling() ); |
| 5087 | execute( TC_egprs_pkt_chan_req_one_phase() ); |
| 5088 | execute( TC_egprs_pkt_chan_req_two_phase() ); |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 5089 | execute( TC_egprs_pkt_chan_req_reject_content() ); |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 5090 | execute( TC_egprs_pkt_chan_req_reject_emergency() ); |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 5091 | execute( TC_egprs_pkt_chan_req_reject_exhaustion() ); |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 5092 | |
| 5093 | execute( TC_mo_ping_pong_with_ul_racap_egprs_only() ); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 5094 | |
| 5095 | /* Frequency hopping specific test cases */ |
| 5096 | if (PCUIF_Types.mp_pcuif_version >= 10) { |
| 5097 | /* Immediate Assignment on AGCH/PCH */ |
| 5098 | execute( TC_pcuif_fh_imm_ass_ul_egprs() ); |
| 5099 | execute( TC_pcuif_fh_imm_ass_ul() ); |
| 5100 | execute( TC_pcuif_fh_imm_ass_dl() ); |
| 5101 | /* Packet Uplink/Downlink Assignment on PACCH */ |
| 5102 | execute( TC_pcuif_fh_pkt_ass_ul() ); |
| 5103 | execute( TC_pcuif_fh_pkt_ass_dl() ); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 5104 | execute( TC_multitrx_multims_alloc() ); |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 5105 | execute( TC_dl_multislot_tbf_ms_class_from_sgsn() ); |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 5106 | execute( TC_dl_multislot_tbf_ms_class_from_2phase() ); |
Pau Espin Pedrol | a9f27fa | 2020-10-30 13:16:21 +0100 | [diff] [blame] | 5107 | execute( TC_ul_multislot_tbf_ms_class_from_2phase() ); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 5108 | } |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 5109 | execute( TC_multiplex_dl_gprs_egprs() ); |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 5110 | |
| 5111 | execute( TC_pcuif_info_ind_subsequent() ); |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 5112 | execute( TC_nacc_outbound_success() ); |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 5113 | execute( TC_nacc_outbound_success_no_ctrl_ack() ); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 5114 | execute( TC_nacc_outbound_success_twice() ); |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 5115 | execute( TC_nacc_outbound_success_twice_nocache() ); |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 5116 | execute( TC_nacc_outbound_rac_ci_resolve_conn_refused() ); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 5117 | execute( TC_nacc_outbound_rac_ci_resolve_timeout() ); |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 5118 | execute( TC_nacc_outbound_rac_ci_resolve_fail_parse_response() ); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 5119 | execute( TC_nacc_outbound_si_resolve_timeout() ); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5120 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup() ); |
| 5121 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup2() ); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5122 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup3() ); |
| 5123 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup4() ); |
| 5124 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup5() ); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5125 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice() ); |
| 5126 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice2() ); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5127 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice3() ); |
| 5128 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice4() ); |
| 5129 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice5() ); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5130 | |
| 5131 | execute( TC_rim_ran_info_req_single_rep() ); |
| 5132 | execute( TC_rim_ran_info_req_single_rep_no_si() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 5133 | } |
| 5134 | |
Harald Welte | a419df2 | 2019-03-21 17:23:04 +0100 | [diff] [blame] | 5135 | } |