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