Harald Welte | a0895f9 | 2018-03-08 11:51:23 +0100 | [diff] [blame] | 1 | module PCU_Tests { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2 | |
| 3 | /* "RAW" PCU tests: Talk directly to the PCU socket of OsmoPCU on the one hand side (emulating |
| 4 | the BTS/BSC side PCU socket server) and the Gb interface on the other hand side. No NS/BSSGP |
| 5 | Emulation is used; rather, we simply use the NS_CodecPort to implement both standard and non- |
| 6 | standard procedures on the NS and BSSGP level. The goal of these tests is to test exactly |
| 7 | those NS and BSSGP implementations on the BSS (PCU) side. */ |
| 8 | |
| 9 | /* (C) 2018-2019 Harald Welte <laforge@gnumonks.org> |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 10 | * (C) 2019-2020 Vadim Yanitskiy <axilirator@gmail.com> |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 11 | * All rights reserved. |
| 12 | * |
| 13 | * Released under the terms of GNU General Public License, Version 2 or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 17 | */ |
| 18 | |
| 19 | friend module PCU_Tests_NS; |
| 20 | |
| 21 | import from General_Types all; |
| 22 | import from Osmocom_Types all; |
| 23 | import from GSM_Types all; |
| 24 | import from GSM_RR_Types all; |
| 25 | |
| 26 | import from Osmocom_VTY_Functions all; |
| 27 | import from TELNETasp_PortType all; |
| 28 | |
| 29 | import from MobileL3_GMM_SM_Types all; |
| 30 | import from RLCMAC_CSN1_Types all; |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 31 | import from RLCMAC_CSN1_Templates all; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 32 | import from RLCMAC_Types all; |
Pau Espin Pedrol | e8d7d16 | 2020-04-29 19:07:36 +0200 | [diff] [blame] | 33 | import from RLCMAC_Templates all; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 34 | |
| 35 | import from MobileL3_CommonIE_Types all; |
| 36 | import from L3_Templates all; |
| 37 | |
| 38 | import from NS_Types all; |
| 39 | import from BSSGP_Types all; |
| 40 | import from Osmocom_Gb_Types all; |
| 41 | |
| 42 | import from BSSGP_Emulation all; /* BssgpConfig */ |
| 43 | import from NS_Emulation all; /* NSConfiguration */ |
| 44 | |
| 45 | import from UD_Types all; |
| 46 | import from PCUIF_Types all; |
| 47 | import from PCUIF_CodecPort all; |
| 48 | import from PCUIF_Components all; |
| 49 | import from IPL4asp_Types all; |
| 50 | import from Native_Functions all; |
| 51 | import from SGSN_Components all; |
Pau Espin Pedrol | aedc511 | 2020-05-16 17:30:42 +0200 | [diff] [blame] | 52 | import from GPRS_Components all; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 53 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 54 | import from StatsD_Types all; |
| 55 | import from StatsD_CodecPort all; |
| 56 | import from StatsD_CodecPort_CtrlFunct all; |
| 57 | import from StatsD_Checker all; |
| 58 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 59 | import from IPA_Emulation all; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 60 | import from Osmocom_CTRL_Types all; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 61 | import from Osmocom_CTRL_Adapter all; |
| 62 | import from Osmocom_CTRL_Functions all; |
| 63 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 64 | modulepar { |
| 65 | charstring mp_pcu_sock_path := PCU_SOCK_DEFAULT; |
| 66 | |
| 67 | float X2002 := 0.2; /* Timer -2002, IMM ASSIGN confirm delay */ |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 68 | |
| 69 | charstring mp_pcu_statsd_ip := "127.0.0.1"; |
| 70 | integer mp_pcu_statsd_port := 8125; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 71 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 72 | charstring mp_ctrl_neigh_ip := ""; /* Use new PCUIF over IPA multiplex for Neigh Addr Resolution */ |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 73 | integer mp_ctrl_neigh_port := 4248; |
Oliver Smith | 61b4e73 | 2021-07-22 08:14:29 +0200 | [diff] [blame] | 74 | |
| 75 | boolean mp_osmo_pcu_newer_than_0_9_0 := true; /* Drop after OsmoPCU > 0.9.0 was released */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | |
| 79 | /* 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] | 80 | friend template (value) PCUIF_info_ind ts_PCUIF_INFO_default(template (value) PCUIF_Flags flags := c_PCUIF_Flags_default) |
| 81 | := { |
Vadim Yanitskiy | c155930 | 2020-07-19 16:39:12 +0700 | [diff] [blame] | 82 | version := PCUIF_Types.mp_pcuif_version, |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 83 | flags := flags, |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 84 | trx := ts_PCUIF_InfoTrxs_def(GPRS_Components.mp_base_arfcn), |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 85 | bsic := 7, |
| 86 | mcc := 262, |
| 87 | mnc := 42, |
| 88 | mnc_3_digits := 0, |
| 89 | lac := 13135, |
| 90 | rac := 0, |
| 91 | nsei := mp_nsconfig.nsei, |
| 92 | nse_timer := { 3, 3, 3, 3, 30, 3, 10 }, |
| 93 | cell_timer := { 3, 3, 3, 3, 3, 10, 3, 10, 3, 10, 3 }, |
| 94 | cell_id := 20960, |
| 95 | repeat_time := 5 * 50, |
| 96 | repeat_count := 3, |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 97 | bvci := mp_gb_cfg.bvc[0].bvci, |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 98 | t3142 := 20, |
| 99 | t3169 := 5, |
| 100 | t3191 := 5, |
| 101 | t3193_10ms := 160, |
| 102 | t3195 := 5, |
Pau Espin Pedrol | 76de166 | 2021-03-01 17:40:58 +0100 | [diff] [blame] | 103 | n3101 := 10, |
| 104 | n3103 := 4, |
| 105 | n3105 := 8, |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 106 | cv_countdown := 15, |
| 107 | dl_tbf_ext := 250 * 10, /* ms */ |
| 108 | ul_tbf_ext := 250 * 10, /* ms */ |
| 109 | initial_cs := 2, |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 110 | initial_mcs := 1, |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 111 | nsvci := { mp_nsconfig.nsvc[0].nsvci, 0 }, |
| 112 | local_port := { mp_nsconfig.nsvc[0].provider.ip.remote_udp_port, 0 }, |
| 113 | remote_port := { mp_nsconfig.nsvc[0].provider.ip.local_udp_port, 0 }, |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 114 | remote_addr := f_PCUIF_RemoteAddr( |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 115 | 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] | 116 | } |
| 117 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 118 | /* Passed in RAN-INFO message from emulated neighbor using RIM */ |
| 119 | const octetstring si1_default := '198fb100000000000000000000000000007900002b'O; |
| 120 | const octetstring si3_default := '1b753000f110236ec9033c2747407900003c0b2b2b'O; |
| 121 | const octetstring si13_default := '009000185a6fc9e08410ab2b2b2b2b2b2b2b2b2b2b'O; |
| 122 | const octetstring si_default := si1_default & si3_default & si13_default; |
| 123 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 124 | const MultislotCap_GPRS mscap_gprs_def := { |
| 125 | gprsmultislotclass := '00011'B, |
| 126 | gprsextendeddynalloccap := '0'B |
| 127 | }; |
| 128 | const MultislotCap_EGPRS mscap_egprs_def := { |
| 129 | egprsmultislotclass := '00011'B, |
| 130 | egprsextendeddynalloccap := '0'B |
| 131 | }; |
| 132 | template (value) MSRadioAccessCapabilityV ms_racap_gprs_def := { ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs_def, omit) }; |
| 133 | template (value) MSRadioAccessCapabilityV ms_racap_egprs_def := { ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs_def, mscap_egprs_def) }; |
| 134 | |
| 135 | const MultislotCap_GPRS_BSSGP bssgp_mscap_gprs_def := { |
| 136 | gprsmultislotclass := '00011'B, |
| 137 | gprsextendeddynalloccap := '0'B |
| 138 | }; |
| 139 | const MultislotCap_EGPRS_BSSGP bssgp_mscap_egprs_def := { |
| 140 | egprsmultislotclass := '00011'B, |
| 141 | egprsextendeddynalloccap := '0'B |
| 142 | }; |
| 143 | template (value) MSRadioAccessCapabilityV_BSSGP bssgp_ms_racap_gprs_def := { valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, bssgp_mscap_gprs_def, omit)) }; |
| 144 | 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)) }; |
| 145 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 146 | type record lqual_range { |
| 147 | /* component reference to the IPA_Client component used for RSL */ |
| 148 | uint8_t low, |
| 149 | uint8_t high |
| 150 | } |
| 151 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 152 | 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] | 153 | /* PCU interface abstraction component */ |
| 154 | var RAW_PCUIF_CT vc_PCUIF; |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 155 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 156 | /* StatsD */ |
| 157 | var StatsD_Checker_CT vc_STATSD; |
| 158 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 159 | /* Connection to the PCUIF component */ |
| 160 | port RAW_PCU_MSG_PT PCUIF; |
| 161 | /* VTY connection to the PCU */ |
| 162 | port TELNETasp_PT PCUVTY; |
| 163 | |
| 164 | /* Uplink CS/MCS thresholds, default from pcu_main.c: */ |
| 165 | var lqual_range g_cs_lqual_ranges[4] := {{low := 0, high := 6}, |
| 166 | {low := 5, high := 8}, |
| 167 | {low := 7, high := 13}, |
| 168 | {low := 12,high := 35}}; |
| 169 | var lqual_range g_mcs_lqual_ranges[9] := {{low := 0, high := 6}, |
| 170 | {low := 5, high := 8}, |
| 171 | {low := 7, high := 13}, |
| 172 | {low := 12,high := 15}, |
| 173 | {low := 14, high := 17}, |
| 174 | {low := 16, high := 18}, |
| 175 | {low := 17,high := 20}, |
| 176 | {low := 19, high := 24}, |
| 177 | {low := 23,high := 35}}; |
| 178 | var uint8_t g_cs_initial_dl := 1; |
| 179 | var uint8_t g_cs_initial_ul := 1; |
| 180 | var uint8_t g_mcs_initial_dl := 1; |
| 181 | var uint8_t g_mcs_initial_ul := 1; |
| 182 | var uint8_t g_cs_max_dl := 4; |
| 183 | var uint8_t g_cs_max_ul := 4; |
| 184 | var uint8_t g_mcs_max_dl := 9; |
| 185 | var uint8_t g_mcs_max_ul := 9; |
| 186 | |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 187 | var boolean g_force_two_phase_access := false; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 188 | |
| 189 | /* Guard timeout */ |
| 190 | timer g_T_guard := 60.0; |
| 191 | }; |
| 192 | |
| 193 | private altstep as_Tguard_RAW() runs on RAW_PCU_Test_CT { |
| 194 | [] g_T_guard.timeout { |
| 195 | setverdict(fail, "Timeout of T_guard"); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 196 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 197 | } |
| 198 | } |
| 199 | |
| 200 | private function f_pcuvty_set_allowed_cs_mcs() runs on RAW_PCU_Test_CT { |
| 201 | f_vty_config2(PCUVTY, {"pcu"}, "cs " & int2str(g_cs_initial_dl) & " " & int2str(g_cs_initial_ul)); |
| 202 | f_vty_config2(PCUVTY, {"pcu"}, "cs max " & int2str(g_cs_max_dl) & " " & int2str(g_cs_max_ul)); |
| 203 | |
| 204 | f_vty_config2(PCUVTY, {"pcu"}, "mcs " & int2str(g_mcs_initial_dl) & " " & int2str(g_mcs_initial_ul)); |
| 205 | f_vty_config2(PCUVTY, {"pcu"}, "mcs max " & int2str(g_mcs_max_dl) & " " & int2str(g_mcs_max_ul)); |
| 206 | } |
| 207 | |
| 208 | private function f_pcuvty_set_link_quality_ranges() runs on RAW_PCU_Test_CT { |
| 209 | var charstring cmd; |
| 210 | |
| 211 | cmd := "cs link-quality-ranges" & |
| 212 | " cs1 " & int2str(g_cs_lqual_ranges[0].high) & |
| 213 | " cs2 " & int2str(g_cs_lqual_ranges[1].low) & " " & int2str(g_cs_lqual_ranges[1].high) & |
| 214 | " cs3 " & int2str(g_cs_lqual_ranges[2].low) & " " & int2str(g_cs_lqual_ranges[2].high) & |
| 215 | " cs4 " & int2str(g_cs_lqual_ranges[3].low); |
| 216 | f_vty_config2(PCUVTY, {"pcu"}, cmd); |
| 217 | |
| 218 | cmd := "mcs link-quality-ranges" & |
| 219 | " mcs1 " & int2str(g_mcs_lqual_ranges[0].high) & |
| 220 | " mcs2 " & int2str(g_mcs_lqual_ranges[1].low) & " " & int2str(g_mcs_lqual_ranges[1].high) & |
| 221 | " mcs3 " & int2str(g_mcs_lqual_ranges[2].low) & " " & int2str(g_mcs_lqual_ranges[2].high) & |
| 222 | " mcs4 " & int2str(g_mcs_lqual_ranges[3].low) & " " & int2str(g_mcs_lqual_ranges[3].high) & |
| 223 | " mcs5 " & int2str(g_mcs_lqual_ranges[4].low) & " " & int2str(g_mcs_lqual_ranges[4].high) & |
| 224 | " mcs6 " & int2str(g_mcs_lqual_ranges[5].low) & " " & int2str(g_mcs_lqual_ranges[5].high) & |
| 225 | " mcs7 " & int2str(g_mcs_lqual_ranges[6].low) & " " & int2str(g_mcs_lqual_ranges[6].high) & |
| 226 | " mcs8 " & int2str(g_mcs_lqual_ranges[7].low) & " " & int2str(g_mcs_lqual_ranges[7].high) & |
| 227 | " mcs9 " & int2str(g_mcs_lqual_ranges[8].low); |
| 228 | f_vty_config2(PCUVTY, {"pcu"}, cmd); |
| 229 | } |
| 230 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 231 | private function f_pcuvty_flush_neigh_caches() runs on RAW_PCU_Test_CT { |
| 232 | f_pcuvty_set_neigh_caches(0, 0); |
| 233 | } |
| 234 | |
| 235 | private function f_pcuvty_set_neigh_caches(integer neigh_cache_secs := -1, integer si_cache_secs := -1) |
| 236 | runs on RAW_PCU_Test_CT { |
| 237 | if (neigh_cache_secs == -1) { |
| 238 | f_vty_config2(PCUVTY, {"pcu"}, "timer X10 default"); |
| 239 | } else { |
| 240 | f_vty_config2(PCUVTY, {"pcu"}, "timer X10 " & int2str(neigh_cache_secs)); |
| 241 | } |
| 242 | if (si_cache_secs == -1) { |
| 243 | f_vty_config2(PCUVTY, {"pcu"}, "timer X11 default"); |
| 244 | } else { |
| 245 | f_vty_config2(PCUVTY, {"pcu"}, "timer X11 " & int2str(si_cache_secs)); |
| 246 | } |
| 247 | } |
| 248 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 249 | 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] | 250 | map(self:PCUVTY, system:PCUVTY); |
| 251 | f_vty_set_prompts(PCUVTY); |
| 252 | f_vty_transceive(PCUVTY, "enable"); |
| 253 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 254 | /* This will be removed soon, not needed. EGPRS support is controlled through pcu_ind flags */ |
| 255 | if (egprs_only) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 256 | f_vty_config2(PCUVTY, {"pcu"}, "egprs only"); |
| 257 | } else { |
| 258 | f_vty_config2(PCUVTY, {"pcu"}, "no egprs"); |
| 259 | } |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 260 | |
| 261 | if (g_force_two_phase_access) { |
| 262 | f_vty_config2(PCUVTY, {"pcu"}, "two-phase-access"); |
| 263 | } else { |
| 264 | f_vty_config2(PCUVTY, {"pcu"}, "no two-phase-access"); |
| 265 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 266 | } |
| 267 | |
Pau Espin Pedrol | 2456dad | 2020-04-30 20:22:38 +0200 | [diff] [blame] | 268 | 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] | 269 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 270 | /* Start the guard timer */ |
| 271 | g_T_guard.start; |
| 272 | activate(as_Tguard_RAW()); |
| 273 | |
| 274 | /* Init PCU interface component */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 275 | vc_PCUIF := RAW_PCUIF_CT.create("PCUIF"); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 276 | connect(vc_PCUIF:MTC, self:PCUIF); |
| 277 | map(vc_PCUIF:PCU, system:PCU); |
| 278 | |
| 279 | /* Create one BTS component (we may want more some day) */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 280 | vc_BTS := RAW_PCU_BTS_CT.create("BTS"); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 281 | connect(vc_BTS:PCUIF, vc_PCUIF:BTS); |
| 282 | connect(vc_BTS:TC, self:BTS); |
| 283 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 284 | 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] | 285 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 286 | f_init_statsd(id, vc_STATSD, mp_pcu_statsd_ip, mp_pcu_statsd_port); |
| 287 | /* This is normally done in the ConnHdlr component, but here |
| 288 | * the Test_CT doubles as ConnHdlr */ |
| 289 | connect(self:STATSD_PROC, vc_STATSD:STATSD_PROC); |
| 290 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 291 | vc_PCUIF.start(f_PCUIF_CT_handler(mp_pcu_sock_path)); |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 292 | 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] | 293 | |
| 294 | /* Wait until the BTS is ready (SI13 negotiated) */ |
| 295 | BTS.receive(tr_RAW_PCU_EV(BTS_EV_SI13_NEGO)); |
| 296 | } |
| 297 | |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 298 | /* Register TLLI of each allocated GprsMS instance */ |
| 299 | private function f_multi_ms_bssgp_register() |
| 300 | runs on RAW_PCU_Test_CT { |
| 301 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 302 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, g_ms[i].tlli); |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | /* Allocate [and activate] an Uplink TBF for each allocated GprsMS instance */ |
| 307 | private function f_multi_ms_establish_tbf(boolean do_activate := false) |
| 308 | runs on RAW_PCU_Test_CT { |
| 309 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 310 | /* Establish an Uplink TBF */ |
| 311 | f_ms_establish_ul_tbf(g_ms[i]); |
| 312 | |
| 313 | /* Send a random block, so this TBF becomes "active" */ |
| 314 | if (do_activate) { |
| 315 | /* FIXME: use the new APU by Pau to get correct TRX/TS here */ |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 316 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, i mod 8); |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 317 | var octetstring dummy := f_rnd_octstring(12); |
| 318 | var RlcmacDlBlock dl_block; |
| 319 | var uint32_t poll_fn; |
| 320 | |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 321 | f_ms_tx_ul_data_block(g_ms[i], dummy, with_tlli := true, fn := g_ms[i].ul_tbf.start_time_fn, nr := nr); |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 322 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, poll_fn, nr := nr); |
| 323 | } |
| 324 | } |
| 325 | } |
| 326 | |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 327 | private function f_ms_establish_ul_tbf_2phase_access(inout GprsMS ms, |
| 328 | template (omit) RlcmacUlCtrlMsg pkt_res_req := omit) |
| 329 | runs on RAW_PCU_Test_CT return PollFnCtx { |
| 330 | var PollFnCtx pollctx; |
| 331 | |
| 332 | /* Single block (two phase) packet access */ |
| 333 | var uint16_t ra := bit2int(chan_req_sb); |
| 334 | if (g_force_two_phase_access) { |
| 335 | /* If 2phase access is enforced by the network, then let's |
| 336 | * request a One phase packet access, we'll receive a single block |
| 337 | * anyway |
| 338 | */ |
| 339 | ra := bit2int(chan_req_def); |
| 340 | } |
| 341 | |
| 342 | /* Establish an Uplink TBF */ |
| 343 | f_ms_use_ra(ms, ra, ra_is_11bit := 0); |
| 344 | f_ms_establish_ul_tbf(ms); |
| 345 | |
| 346 | /* Make sure we've got an Uplink TBF assignment */ |
| 347 | if (not match(ms.ul_tbf.ass.ccch, tr_PacketUlSglAssign)) { |
| 348 | setverdict(fail, "Wrong Packet Uplink Assignment received: ", ms.ul_tbf.ass.ccch, " vs exp: ", tr_PacketUlSglAssign); |
| 349 | f_shutdown(__BFILE__, __LINE__); |
| 350 | } |
| 351 | |
| 352 | /* Send PACKET RESOURCE REQUEST |
| 353 | * (see 3GPP TS 04.60 "7.1.3.1 Initiation of the Packet resource request procedure") |
| 354 | */ |
| 355 | if (istemplatekind(pkt_res_req, "omit")) { |
| 356 | pkt_res_req := ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, omit); |
| 357 | } |
| 358 | |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 359 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(valueof(pkt_res_req)), ms.ul_tbf.start_time_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 360 | /* Store 1st UlTBF context before receiving next one, will |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 361 | * overwrite the TS allocation on MS with info from new UL TBF: |
| 362 | */ |
| 363 | pollctx.tstrxbts := f_ms_tx_TsTrxBtsNum(ms); |
| 364 | f_ms_rx_pkt_ass_pacch(ms, pollctx.fn, tr_RLCMAC_UL_PACKET_ASS, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 365 | return pollctx; |
| 366 | } |
| 367 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 368 | testcase TC_pcuif_suspend() runs on RAW_PCU_Test_CT { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 369 | 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] | 370 | var GprsTlli tlli := TLLI_UNUSED; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 371 | timer T; |
| 372 | |
| 373 | /* Initialize NS/BSSGP side */ |
| 374 | f_init_bssgp(); |
| 375 | |
| 376 | /* Initialize the PCU interface abstraction */ |
| 377 | f_init_raw(testcasename()); |
| 378 | |
| 379 | /* Establish BSSGP connection to the PCU */ |
| 380 | f_bssgp_establish(); |
| 381 | |
| 382 | BTS.send(ts_PCUIF_SUSP_REQ(0, tlli, ra_id, 0)); |
| 383 | |
| 384 | T.start(2.0); |
| 385 | alt { |
Harald Welte | 9b461a9 | 2020-12-10 23:41:14 +0100 | [diff] [blame] | 386 | [] 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] | 387 | setverdict(pass); |
| 388 | } |
| 389 | [] T.timeout { |
| 390 | setverdict(fail, "Timeout waiting for BSSGP SUSPEND"); |
| 391 | } |
| 392 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 393 | |
| 394 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 395 | } |
| 396 | |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 397 | /* Make sure TBF is released and no data is sent for in after reciving a Suspend Request from that MS. See OS#4761 */ |
| 398 | testcase TC_pcuif_suspend_active_tbf() runs on RAW_PCU_Test_CT { |
| 399 | var octetstring ra_id := enc_RoutingAreaIdentification(mp_gb_cfg.bvc[0].cell_id.ra_id); |
| 400 | var RlcmacDlBlock dl_block; |
| 401 | var octetstring data := f_rnd_octstring(10); |
| 402 | var uint32_t sched_fn; |
| 403 | var uint32_t dl_fn; |
| 404 | var GprsMS ms; |
| 405 | timer T; |
| 406 | |
| 407 | /* Initialize NS/BSSGP side */ |
| 408 | f_init_bssgp(); |
| 409 | /* Initialize GPRS MS side */ |
| 410 | f_init_gprs_ms(); |
| 411 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 412 | |
| 413 | /* Initialize the PCU interface abstraction */ |
| 414 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 415 | |
| 416 | /* Establish BSSGP connection to the PCU */ |
| 417 | f_bssgp_establish(); |
| 418 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 419 | |
| 420 | /* Establish an Uplink TBF */ |
| 421 | f_ms_establish_ul_tbf(ms); |
| 422 | |
| 423 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 424 | contention resoultion) and make sure it is ACKED fine */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 425 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 426 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 427 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 428 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 429 | |
| 430 | /* UL block should be received in SGSN */ |
| 431 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
| 432 | |
| 433 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 434 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 435 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 436 | |
| 437 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 438 | f_sleep(X2002); |
| 439 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 440 | |
| 441 | /* MS has moved to CS, it sent SUSP REQ to BTS and PCU gets it, TBF is freed: */ |
| 442 | BTS.send(ts_PCUIF_SUSP_REQ(0, ms.tlli, ra_id, 0)); |
| 443 | |
| 444 | T.start(2.0); |
| 445 | alt { |
| 446 | [] BSSGP_GLOBAL[0].receive(tr_BSSGP_SUSPEND(ms.tlli, mp_gb_cfg.bvc[0].cell_id.ra_id)) { |
| 447 | setverdict(pass); |
| 448 | } |
| 449 | [] T.timeout { |
| 450 | setverdict(fail, "Timeout waiting for BSSGP SUSPEND"); |
| 451 | f_shutdown(__BFILE__, __LINE__); |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | /* Make sure we don't receive data for that TBF since it was released |
| 456 | * before. Also check our TBF is not polled for UL. */ |
| 457 | f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 458 | if (dl_block.ctrl.mac_hdr.usf != USF_UNUSED) { |
| 459 | setverdict(fail, "Unexpected USF ", dl_block.ctrl.mac_hdr.usf); |
| 460 | f_shutdown(__BFILE__, __LINE__); |
| 461 | } |
| 462 | |
| 463 | /* New data arrives, PCU should page the MS since no TBF active exists: */ |
| 464 | /* Send some more data, it will never reach the MS */ |
| 465 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 466 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 467 | |
| 468 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 469 | } |
| 470 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 471 | /* Test of correct Timing Advance at the time of TBF establishment |
| 472 | * (derived from timing offset of the Access Burst). */ |
| 473 | 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] | 474 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 475 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 476 | /* Initialize GPRS MS side */ |
| 477 | f_init_gprs_ms(); |
| 478 | 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] | 479 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 480 | 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] | 481 | |
| 482 | /* We cannot send too many TBF requests in a short time because |
| 483 | * at some point the PCU will fail to allocate a new TBF. */ |
| 484 | for (var TimingAdvance ta := 0; ta < 64; ta := ta + 16) { |
| 485 | /* Establish an Uplink TBF (send RACH.ind with current TA) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 486 | ms.ta := ta; |
Vadim Yanitskiy | 84d1dd5 | 2020-05-28 21:09:22 +0700 | [diff] [blame] | 487 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 488 | |
| 489 | /* Make sure Timing Advance IE matches out expectations */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 490 | 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] | 491 | setverdict(fail, "Timing Advance mismatch: ", |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 492 | ms.ul_tbf.rr_imm_ass.payload.imm_ass.timing_advance, |
Vadim Yanitskiy | 8685b38 | 2020-05-06 16:53:26 +0700 | [diff] [blame] | 493 | " vs expected ", ta); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 494 | break; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 495 | } |
| 496 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 497 | |
| 498 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 499 | } |
| 500 | |
Vadim Yanitskiy | 866f870 | 2021-05-26 14:50:27 +0200 | [diff] [blame] | 501 | /* Verify Timing Advance value indicated in Packet Uplink ACK/NACK message |
| 502 | * sent in response to the first Uplink block after resource allocation. */ |
| 503 | testcase TC_ta_ul_ack_nack_first_block() runs on RAW_PCU_Test_CT { |
| 504 | var GprsMS ms := valueof(t_GprsMS_def); |
| 505 | var PacketUlAckNack ul_ack_nack; |
| 506 | var PacketTimingAdvance pkt_ta; |
| 507 | var RlcmacDlBlock dl_block; |
| 508 | var uint32_t sched_fn; |
| 509 | |
| 510 | /* Initialize NS/BSSGP side */ |
| 511 | f_init_bssgp(); |
| 512 | |
| 513 | /* Initialize the PCU interface abstraction */ |
| 514 | f_init_raw(testcasename()); |
| 515 | |
| 516 | /* Establish BSSGP connection to the PCU */ |
| 517 | f_bssgp_establish(); |
| 518 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 519 | |
| 520 | /* Establish an Uplink TBF */ |
| 521 | f_ms_establish_ul_tbf(ms); |
| 522 | |
| 523 | /* In a busy network, there can be a significant delay between resource |
| 524 | * allocation (Packet Uplink Assignment above) and the actual time when |
| 525 | * the MS is allowed to transmit the first Uplink data block. */ |
| 526 | |
| 527 | /* Simulate a delay > 0 */ |
| 528 | ms.ta := 2; |
| 529 | |
| 530 | /* We're in One-Phase Access contention resoultion, include TLLI */ |
| 531 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
| 532 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 533 | |
| 534 | ul_ack_nack := dl_block.ctrl.payload.u.ul_ack_nack; |
| 535 | if (ispresent(ul_ack_nack.gprs.pkt_ta)) { |
| 536 | pkt_ta := ul_ack_nack.gprs.pkt_ta; |
| 537 | } else if (ispresent(ul_ack_nack.egprs.pkt_ta)) { |
| 538 | pkt_ta := ul_ack_nack.egprs.pkt_ta; |
| 539 | } else { |
| 540 | setverdict(fail, "PacketTimingAdvance IE is not present"); |
| 541 | f_shutdown(__BFILE__, __LINE__); |
| 542 | } |
| 543 | |
| 544 | if (not ispresent(pkt_ta.val)) { |
| 545 | setverdict(fail, "Timing Advance value is not present"); |
| 546 | f_shutdown(__BFILE__, __LINE__); |
| 547 | } else if (pkt_ta.val != ms.ta) { |
| 548 | setverdict(fail, "Timing Advance mismatch: expected ", |
| 549 | ms.ta, ", but received ", pkt_ta.val); |
| 550 | f_shutdown(__BFILE__, __LINE__); |
| 551 | } |
| 552 | } |
| 553 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 554 | /* Verify Timing Advance value(s) indicated during the packet Downlink assignment |
| 555 | * procedure as per 3GPP TS 44.018, section 3.5.3. There seems to be a bug in the |
| 556 | * IUT that causes it to send an unreasonable Timing Advance value > 0 despite |
| 557 | * no active TBF exists at the moment of establishment (idle mode). */ |
| 558 | testcase TC_ta_idle_dl_tbf_ass() runs on RAW_PCU_Test_CT { |
Vadim Yanitskiy | 37f3333 | 2021-02-21 00:04:23 +0100 | [diff] [blame] | 559 | var GprsMS ms := valueof(t_GprsMS_def); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 560 | |
| 561 | /* Initialize NS/BSSGP side */ |
| 562 | f_init_bssgp(); |
| 563 | |
| 564 | /* Initialize the PCU interface abstraction */ |
| 565 | f_init_raw(testcasename()); |
| 566 | |
| 567 | /* Establish BSSGP connection to the PCU */ |
| 568 | f_bssgp_establish(); |
Vadim Yanitskiy | 37f3333 | 2021-02-21 00:04:23 +0100 | [diff] [blame] | 569 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 570 | |
| 571 | /* SGSN sends some DL data, PCU will initiate Packet Downlink |
| 572 | * Assignment on CCCH (PCH). We don't care about the payload. */ |
Vadim Yanitskiy | 37f3333 | 2021-02-21 00:04:23 +0100 | [diff] [blame] | 573 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, f_rnd_octstring(10))); |
| 574 | 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] | 575 | |
| 576 | /* Make sure that Timing Advance is 0 (the actual value is not known yet). |
| 577 | * As per 3GPP S 44.018, section 3.5.3.1.2, the network *shall* initiate |
| 578 | * the procedures defined in 3GPP TS 44.060 or use the polling mechanism. */ |
Vadim Yanitskiy | 37f3333 | 2021-02-21 00:04:23 +0100 | [diff] [blame] | 579 | if (ms.dl_tbf.rr_imm_ass.payload.imm_ass.timing_advance != 0) { |
Vadim Yanitskiy | 84d1dd5 | 2020-05-28 21:09:22 +0700 | [diff] [blame] | 580 | setverdict(fail, "Timing Advance value doesn't match"); |
| 581 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 582 | |
| 583 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 584 | } |
| 585 | |
| 586 | /* Verify that the PCU generates valid PTCCH/D messages |
| 587 | * while neither Uplink nor Downlink TBF is established. */ |
| 588 | testcase TC_ta_ptcch_idle() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 589 | var BTS_PTCCH_Block pcu_msg; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 590 | timer T; |
| 591 | |
| 592 | /* Initialize the PCU interface abstraction */ |
| 593 | f_init_raw(testcasename()); |
| 594 | |
| 595 | /* Sent an RTS.req for PTCCH/D */ |
| 596 | BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7, |
| 597 | sapi := PCU_IF_SAPI_PTCCH, fn := 0, |
| 598 | arfcn := 871, block_nr := 0)); |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 599 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 600 | T.start(5.0); |
| 601 | alt { |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 602 | /* Make sure the message is encoded correctly |
| 603 | * TODO: do we expect all TA values to be equal '1111111'B? */ |
| 604 | [] as_rx_ptcch(pcu_msg, tr_PTCCHDownlinkMsg); |
| 605 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 606 | [] BTS.receive(PCUIF_Message:?) { repeat; } |
| 607 | [] T.timeout { |
| 608 | setverdict(fail, "Timeout waiting for a PTCCH/D block"); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 609 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 610 | } |
| 611 | } |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 612 | log("Decoded PTCCH/D message: ", pcu_msg.dl_block); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 613 | |
| 614 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 615 | } |
| 616 | |
| 617 | /* Test of correct Timing Advance during an active Uplink TBF. |
| 618 | * |
| 619 | * Unlike the circuit-switched domain, Uplink transmissions on PDCH time-slots |
| 620 | * are not continuous and there can be long time gaps between them. This happens |
| 621 | * due to a bursty nature of packet data. The actual Timing Advance of a MS may |
| 622 | * significantly change between such rare Uplink transmissions, so GPRS introduces |
| 623 | * additional mechanisms to control Timing Advance, and thus reduce interference |
| 624 | * between neighboring TDMA time-slots. |
| 625 | * |
| 626 | * At the moment of Uplink TBF establishment, initial Timing Advance is measured |
| 627 | * from ToA (Timing of Arrival) of an Access Burst. This is covered by another |
| 628 | * test case - TC_ta_rach_imm_ass. In response to that Access Burst the network |
| 629 | * sends Immediate Assignment on AGCH, which _may_ contain Timing Advance Index |
| 630 | * among with the initial Timing Advance value. And here PTCCH comes to play. |
| 631 | * |
| 632 | * PTCCH is a unidirectional channel on which the network can instruct a sub-set |
| 633 | * of 16 MS (whether TBFs are active or not) to adjust their Timing Advance |
| 634 | * continuously. To ensure continuous measurements of the signal propagation |
| 635 | * delay, the MSs shall transmit Access Bursts on Uplink (PTCCH/U) on sub-slots |
| 636 | * defined by an assigned Timing Advance Index (see 3GPP TS 45.002). |
| 637 | * |
| 638 | * The purpose of this test case is to verify the assignment of Timing Advance |
| 639 | * Index, and the process of Timing Advance notification on PTCCH/D. The MTC |
| 640 | * first establishes several Uplink TBFs, but does not transmit any Uplink |
| 641 | * blocks on them. During 4 TDMA multi-frame periods the MTC is sending RACH |
| 642 | * indications to the PCU, checking the correctness of two received PTCCH/D |
| 643 | * messages (period of PTCCH/D is two multi-frames). |
| 644 | */ |
| 645 | |
| 646 | /* List of ToA values for Access Bursts to be sent on PTCCH/U, |
| 647 | * each ToA (Timing of Arrival) value is in units of 1/4 of |
| 648 | * a symbol (i.e. 1 symbol is 4 QTA units). */ |
| 649 | type record length(16) of int16_t PTCCH_TAI_ToA_MAP; |
| 650 | const PTCCH_TAI_ToA_MAP ptcch_toa_map_def := { |
| 651 | 0, 0, 0, 0, |
| 652 | 0, 0, 0, 0, |
| 653 | 0, 0, 0, 0, |
| 654 | 0, 0, 0, 0 |
| 655 | }; |
| 656 | |
| 657 | private altstep as_ta_ptcch(uint8_t bts_nr := 0, uint8_t trx_nr := 0, uint8_t ts_nr := 7, |
| 658 | in PTCCH_TAI_ToA_MAP toa_map := ptcch_toa_map_def) |
| 659 | runs on RAW_PCU_Test_CT { |
| 660 | var RAW_PCU_Event event; |
| 661 | var integer ss; |
| 662 | |
| 663 | /* Send Access Bursts on PTCCH/U for every TA Index */ |
| 664 | [] BTS.receive(tr_RAW_PCU_EV(TDMA_EV_PTCCH_UL_BURST)) -> value event { |
| 665 | ss := f_tdma_ptcch_fn2ss(event.data.tdma_fn); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 666 | if (ss < 0) { /* Shall not happen */ |
| 667 | f_shutdown(__BFILE__, __LINE__); |
| 668 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 669 | |
| 670 | log("Sending an Access Burst on PTCCH/U", |
| 671 | ", sub-slot=", ss, " (TAI)", |
| 672 | ", fn=", event.data.tdma_fn, |
| 673 | ", ToA=", toa_map[ss], " (QTA)"); |
| 674 | /* TODO: do we care about RA and burst format? */ |
| 675 | BTS.send(ts_PCUIF_RACH_IND(bts_nr, trx_nr, ts_nr, |
| 676 | ra := oct2int('3A'O), |
| 677 | is_11bit := 0, |
| 678 | burst_type := BURST_TYPE_0, |
| 679 | fn := event.data.tdma_fn, |
| 680 | arfcn := 871, |
| 681 | qta := toa_map[ss], |
| 682 | sapi := PCU_IF_SAPI_PTCCH)); |
| 683 | repeat; |
| 684 | } |
| 685 | } |
| 686 | |
| 687 | private function f_TC_ta_ptcch_ul_multi_tbf(in PTCCH_TAI_ToA_MAP ptcch_toa_map, |
| 688 | template PTCCHDownlinkMsg t_ta_msg) |
| 689 | runs on RAW_PCU_Test_CT { |
| 690 | var PTCCHDownlinkMsg ta_msg; |
| 691 | var PCUIF_Message pcu_msg; |
| 692 | timer T; |
| 693 | |
| 694 | /* First, send an RTS.req for the upcoming PTCCH/D block */ |
| 695 | BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7, |
| 696 | sapi := PCU_IF_SAPI_PTCCH, fn := 0, |
| 697 | arfcn := 871, block_nr := 0)); |
| 698 | T.start(2.0); |
| 699 | alt { |
| 700 | /* Keep sending of Access Bursts during two multi-frames (period of PTCCH/D) |
| 701 | * with increasing ToA (Timing of Arrival) values: 0, 7, 14, 28, 35... */ |
| 702 | [] as_ta_ptcch(bts_nr := 0, trx_nr := 0, ts_nr := 7, toa_map := ptcch_toa_map); |
| 703 | /* In the end of 2nd multi-frame we should receive a PTCCH/D block */ |
| 704 | [] BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7, |
| 705 | sapi := PCU_IF_SAPI_PTCCH)) -> value pcu_msg { |
| 706 | ta_msg := dec_PTCCHDownlinkMsg(pcu_msg.u.data_req.data); |
| 707 | log("Rx PTCCH/D message: ", ta_msg); |
| 708 | |
| 709 | /* Make sure Timing Advance values match our expectations */ |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 710 | if (not match(ta_msg, t_ta_msg)) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 711 | setverdict(fail, "PTCCH/D message does not match: ", t_ta_msg); |
| 712 | } |
| 713 | } |
| 714 | [] BTS.receive { repeat; } |
| 715 | [] T.timeout { |
| 716 | setverdict(fail, "Timeout waiting for a PTCCH/D block"); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 717 | } |
| 718 | } |
| 719 | } |
| 720 | |
| 721 | testcase TC_ta_ptcch_ul_multi_tbf() runs on RAW_PCU_Test_CT { |
| 722 | var template PacketUlAssign t_ul_tbf_ass; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 723 | var GprsMS ms; |
| 724 | |
| 725 | /* Initialize GPRS MS side */ |
| 726 | f_init_gprs_ms(); |
| 727 | 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] | 728 | |
| 729 | /* Initialize the PCU interface abstraction */ |
| 730 | f_init_raw(testcasename()); |
| 731 | |
| 732 | /* Enable forwarding of PTCCH/U TDMA events to us */ |
| 733 | BTS.send(ts_RAW_PCU_CMD(TDMA_CMD_ENABLE_PTCCH_UL_FWD)); |
| 734 | |
| 735 | /* Establish 7 Uplink TBFs (USF flag is 3 bits long, '111'B is reserved) */ |
| 736 | for (var integer i := 0; i < 7; i := i + 1) { |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 737 | /* Establish an Uplink TBF */ |
| 738 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 739 | |
| 740 | /* We expect incremental TFI/USF assignment (dynamic allocation) */ |
| 741 | t_ul_tbf_ass := tr_PacketUlDynAssign(tfi := i, usf := i); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 742 | 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] | 743 | setverdict(fail, "Failed to match Packet Uplink Assignment for #", i); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 744 | break; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 745 | } |
| 746 | |
| 747 | /* 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] | 748 | if (ms.ul_tbf.ass.ccch.dynamic.ta_index != i) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 749 | setverdict(fail, "Failed to match Timing Advance Index for #", i); |
| 750 | /* Keep going, the current OsmoPCU does not assign TA Index */ |
| 751 | } |
| 752 | } |
| 753 | |
| 754 | /* Prepare a list of ToA values for Access Bursts to be sent on PTCCH/U */ |
| 755 | var PTCCH_TAI_ToA_MAP toa_map := ptcch_toa_map_def; |
| 756 | for (var integer i := 0; i < 7; i := i + 1) { |
| 757 | /* ToA in units of 1/4 of a symbol */ |
| 758 | toa_map[i] := (i + 1) * 7 * 4; |
| 759 | } |
| 760 | |
| 761 | /* Now we have all 7 TBFs established in one-phase access mode, |
| 762 | * however we will not be sending any data on them. Instead, we |
| 763 | * will be sending RACH.ind on PTCCH/U during 4 multi-frame |
| 764 | * periods (TAI 0..8), and then will check two PTCCH/D blocks. |
| 765 | * |
| 766 | * Why not 4 TBFs at once? Because Uplink is delayed by 3 TDMA |
| 767 | * time-slots, so at the moment of scheduling a PTCCH/D block |
| 768 | * the PCU has odd number of PTCCH/U Access Bursts received. */ |
| 769 | f_TC_ta_ptcch_ul_multi_tbf(toa_map, tr_PTCCHDownlinkMsg( |
| 770 | tai0_ta := 7, tai1_ta := 14, tai2_ta := 21, |
| 771 | /* Other values are not known (yet) */ |
| 772 | tai3_ta := ?)); |
| 773 | f_TC_ta_ptcch_ul_multi_tbf(toa_map, tr_PTCCHDownlinkMsg( |
| 774 | tai0_ta := 7, tai1_ta := 14, tai2_ta := 21, |
| 775 | tai3_ta := 28, tai4_ta := 35, tai5_ta := 42, |
| 776 | /* Other values are out of our interest */ |
| 777 | tai6_ta := ?)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 778 | |
| 779 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 780 | } |
| 781 | |
| 782 | /* Default link quality adaptation (Coding Scheme) ranges (inclusive). |
| 783 | * OsmoPCU (VTY): cs link-quality-ranges cs1 6 cs2 5 8 cs3 7 13 cs4 12 |
| 784 | * |
| 785 | * NOTE: the ranges are intentionally overlapping because OsmoPCU |
| 786 | * does not change CS/MCS on the range borders (5-6, 7-8, 12-13). */ |
| 787 | private template integer CS1_lqual_dB_range := (-infinity .. 6); |
| 788 | private template integer CS2_lqual_dB_range := (5 .. 8); |
| 789 | private template integer CS3_lqual_dB_range := (7 .. 13); |
| 790 | private template integer CS4_lqual_dB_range := (12 .. infinity); |
| 791 | |
| 792 | 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] | 793 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 794 | var GprsMS ms; |
| 795 | var uint32_t unused_fn, sched_fn; |
| 796 | var uint4_t cv; |
| 797 | |
| 798 | /* Initialize GPRS MS side */ |
| 799 | f_init_gprs_ms(); |
| 800 | 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] | 801 | |
| 802 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 803 | 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] | 804 | |
| 805 | f_pcuvty_set_allowed_cs_mcs(); |
| 806 | f_pcuvty_set_link_quality_ranges(); |
| 807 | |
| 808 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 809 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 810 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 811 | |
| 812 | /* The actual / old link quality values. We need to keep track of the old |
| 813 | * (basically previous) link quality value, because OsmoPCU actually |
| 814 | * changes the coding scheme if not only the actual, but also the old |
| 815 | * value leaves the current link quality range (window). */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 816 | var integer lqual_old; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 817 | ms.lqual_cb := 0; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 818 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 819 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 820 | contention resoultion) and make sure it is ACKED fine. */ |
| 821 | /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
| 822 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 823 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(16), cv := 15, with_tlli := true, fn := ms.ul_tbf.start_time_fn) |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 824 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 825 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 826 | 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] | 827 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 828 | /* 16 UL blocks (0 .. 15 dB, step = 1 cB) */ |
| 829 | for (var integer i := 150; i >= 0; i := i - 1) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 830 | /* Update the old / actual link quality */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 831 | lqual_old := ms.lqual_cb; |
| 832 | ms.lqual_cb := 150 - i; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 833 | |
| 834 | /* 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] | 835 | log("Sending DATA.ind with link quality (dB): ", ms.lqual_cb); |
| 836 | if (i > g_bs_cv_max) { |
| 837 | cv := 15; |
| 838 | } else { |
| 839 | cv := i; |
| 840 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 841 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 842 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := cv) |
| 843 | |
| 844 | /* we will receive UL ACK/NACK from time to time. In that case, check CdCofing increases */ |
| 845 | f_rx_rlcmac_dl_block(dl_block, unused_fn); |
| 846 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 847 | continue; |
| 848 | } |
| 849 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_GPRS(ul_tfi := ?)) and |
| 850 | not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 851 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 852 | f_shutdown(__BFILE__, __LINE__); |
| 853 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 854 | |
| 855 | log("Rx Packet Uplink ACK / NACK with Channel Coding Command: ", |
| 856 | dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd); |
| 857 | |
| 858 | /* Match the received Channel Coding Command. Since we are increasing |
| 859 | * the link quality value on each iteration and not decreasing, there |
| 860 | * is no need to check the both old and current link quality values. */ |
| 861 | var template ChCodingCommand ch_coding; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 862 | select (lqual_old / 10) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 863 | case (CS1_lqual_dB_range) { ch_coding := CH_CODING_CS1; } |
| 864 | case (CS2_lqual_dB_range) { ch_coding := CH_CODING_CS2; } |
| 865 | case (CS3_lqual_dB_range) { ch_coding := CH_CODING_CS3; } |
| 866 | case (CS4_lqual_dB_range) { ch_coding := CH_CODING_CS4; } |
| 867 | } |
| 868 | |
| 869 | if (not match(dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd, ch_coding)) { |
| 870 | setverdict(fail, "Channel Coding does not match our expectations: ", ch_coding); |
Pau Espin Pedrol | 1617e31 | 2020-05-22 14:41:14 +0200 | [diff] [blame] | 871 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 872 | } |
| 873 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 874 | |
| 875 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 876 | } |
| 877 | |
| 878 | /* Test the max UL CS set by VTY works fine */ |
| 879 | testcase TC_cs_initial_ul() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 880 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 881 | var ChCodingCommand last_ch_coding; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 882 | var uint32_t unused_fn, sched_fn; |
| 883 | var GprsMS ms; |
| 884 | |
| 885 | /* Initialize GPRS MS side */ |
| 886 | f_init_gprs_ms(); |
| 887 | 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] | 888 | |
| 889 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 890 | 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] | 891 | |
| 892 | /* Set initial UL CS to 3 */ |
| 893 | g_cs_initial_ul := 3; |
| 894 | f_pcuvty_set_allowed_cs_mcs(); |
| 895 | f_pcuvty_set_link_quality_ranges(); |
| 896 | |
| 897 | /* Take lqual (dB->cB) so that we stay in that CS */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 898 | ms.lqual_cb := g_cs_lqual_ranges[2].low * 10; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 899 | |
| 900 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 901 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 902 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 903 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 904 | contention resoultion) and make sure it is ACKED fine. */ |
| 905 | /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
| 906 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 907 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(16), cv := 15, with_tlli := true, fn := ms.ul_tbf.start_time_fn) |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 908 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 909 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 910 | 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] | 911 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 912 | /* Send UL blocks, until we receive UL ACK/NACK and check we are in same initial CS: */ |
| 913 | while (true) { |
| 914 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := 15); |
| 915 | f_rx_rlcmac_dl_block(dl_block, unused_fn); |
| 916 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 917 | continue; |
| 918 | } |
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 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_GPRS(ul_tfi := ?)) and |
| 921 | not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 922 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 923 | f_shutdown(__BFILE__, __LINE__); |
| 924 | break; |
| 925 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 926 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 927 | 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] | 928 | break; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 929 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 930 | if (last_ch_coding != CH_CODING_CS3) { |
| 931 | 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] | 932 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 933 | } |
| 934 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 935 | /* Remaining UL blocks are used to make sure regardless of initial |
| 936 | /* lqual, we can go lower at any time */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 937 | /* 0 dB, make sure we downgrade CS */ |
| 938 | ms.lqual_cb := 0; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 939 | /* 5 UL blocks, check we are in same initial CS: */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 940 | f_ms_tx_ul_data_block_multi(ms, 5); |
| 941 | /* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */ |
| 942 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 943 | 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] | 944 | |
| 945 | if (last_ch_coding != CH_CODING_CS1) { |
| 946 | 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] | 947 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 948 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 949 | |
| 950 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 951 | } |
| 952 | |
| 953 | /* Test the max UL CS set by VTY works fine */ |
| 954 | testcase TC_cs_max_ul() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 955 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 956 | var ChCodingCommand last_ch_coding; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 957 | var uint32_t unused_fn, sched_fn; |
| 958 | var GprsMS ms; |
| 959 | |
| 960 | /* Initialize GPRS MS side */ |
| 961 | f_init_gprs_ms(); |
| 962 | 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] | 963 | |
| 964 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 965 | 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] | 966 | |
| 967 | /* Set maximum allowed UL CS to 3 */ |
| 968 | g_cs_max_ul := 3; |
| 969 | f_pcuvty_set_allowed_cs_mcs(); |
| 970 | f_pcuvty_set_link_quality_ranges(); |
| 971 | |
| 972 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 973 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 974 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 975 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 976 | contention resoultion) and make sure it is ACKED fine. */ |
| 977 | /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
| 978 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 979 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(16), cv := 15, with_tlli := true, fn := ms.ul_tbf.start_time_fn) |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 980 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 981 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 982 | 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] | 983 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 984 | ms.lqual_cb := 40*10; /* 40 dB */ |
| 985 | f_ms_tx_ul_data_block_multi(ms, 16); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 986 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 987 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 988 | 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] | 989 | |
| 990 | if (last_ch_coding != CH_CODING_CS3) { |
| 991 | 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] | 992 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 993 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 994 | |
| 995 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 996 | } |
| 997 | |
Pau Espin Pedrol | 7512259 | 2020-11-03 15:22:59 +0100 | [diff] [blame] | 998 | /* Test the initial DL CS set by VTY works fine */ |
| 999 | testcase TC_cs_initial_dl() runs on RAW_PCU_Test_CT { |
| 1000 | var octetstring data := f_rnd_octstring(10); |
| 1001 | var CodingScheme exp_dl_cs_mcs; |
| 1002 | var RlcmacDlBlock dl_block; |
| 1003 | var uint32_t poll_fn; |
| 1004 | var GprsMS ms; |
| 1005 | |
| 1006 | /* Initialize NS/BSSGP side */ |
| 1007 | f_init_bssgp(); |
| 1008 | /* Initialize GPRS MS side */ |
| 1009 | f_init_gprs_ms(); |
| 1010 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1011 | |
| 1012 | /* Initialize the PCU interface abstraction */ |
| 1013 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1014 | |
| 1015 | /* Set initial allowed DL CS to 3 */ |
| 1016 | g_cs_initial_dl := 3; |
| 1017 | exp_dl_cs_mcs := CS_3; |
| 1018 | /* Set maximum allowed UL CS to 4 */ |
| 1019 | g_cs_max_dl := 4; |
| 1020 | f_pcuvty_set_allowed_cs_mcs(); |
| 1021 | f_pcuvty_set_link_quality_ranges(); |
| 1022 | |
| 1023 | /* Establish BSSGP connection to the PCU */ |
| 1024 | f_bssgp_establish(); |
| 1025 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1026 | |
| 1027 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 1028 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 1029 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1030 | |
| 1031 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1032 | f_sleep(X2002); |
| 1033 | f_rx_rlcmac_dl_block_exp_data(dl_block, poll_fn, data, 0, exp_dl_cs_mcs); |
| 1034 | |
| 1035 | /* ACK the DL block */ |
| 1036 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1037 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1038 | f_dl_block_ack_fn(dl_block, poll_fn)); |
| 1039 | |
| 1040 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1041 | } |
| 1042 | |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1043 | /* Verify scheduling of multiple Downlink data blocks, enough to reach CS4 */ |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 1044 | function f_dl_data_exp_cs(template (present) CodingScheme exp_final_cs := ?, template (omit) MSRadioAccessCapabilityV_BSSGP ms_racap := omit) runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1045 | var octetstring data := f_rnd_octstring(1400); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1046 | var RlcmacDlBlock prev_dl_block, dl_block; |
| 1047 | var uint32_t ack_fn; |
| 1048 | var uint32_t fn; |
| 1049 | var GprsMS ms; |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1050 | var integer tx_data_remain := 10; |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1051 | var integer bsn := 0; |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1052 | var boolean using_egprs := f_rlcmac_cs_mcs_is_mcs(valueof(exp_final_cs)); |
| 1053 | var integer bsn_mod; |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 1054 | var template (present) CodingScheme exp_tmp_csmcs; |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1055 | |
| 1056 | if (using_egprs) { |
| 1057 | exp_tmp_csmcs := mcs_egprs_any; |
| 1058 | bsn_mod := 2048; |
| 1059 | } else { |
| 1060 | exp_tmp_csmcs := cs_gprs_any; |
| 1061 | bsn_mod := 128; |
| 1062 | } |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1063 | |
| 1064 | /* Establish BSSGP connection to the PCU */ |
| 1065 | f_bssgp_establish(); |
| 1066 | |
| 1067 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1068 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1069 | |
| 1070 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1071 | 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] | 1072 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1073 | |
| 1074 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 1075 | f_sleep(X2002); |
| 1076 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1077 | for (var integer i := 0; i < 800; i := i + 1) { |
| 1078 | bsn := i mod bsn_mod; |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1079 | f_rx_rlcmac_dl_block(dl_block, fn); |
| 1080 | |
| 1081 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL)) { |
| 1082 | /* No more data to receive, done */ |
| 1083 | break; |
| 1084 | } |
| 1085 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1086 | 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] | 1087 | |
| 1088 | /* Keep Ack/Nack description updated */ |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1089 | f_dltbf_ack_block(ms.dl_tbf, dl_block); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1090 | |
| 1091 | /* 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] | 1092 | if (f_dl_block_rrbp_valid(dl_block)) { |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1093 | ack_fn := f_dl_block_ack_fn(dl_block, fn); |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1094 | 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] | 1095 | if (tx_data_remain != 0) { |
| 1096 | /* Submit more data from time to time to keep the TBF ongoing */ |
| 1097 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 1098 | tx_data_remain := tx_data_remain - 1; |
| 1099 | } |
| 1100 | } |
| 1101 | prev_dl_block := dl_block; |
| 1102 | } |
| 1103 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1104 | bsn := (bsn + (bsn_mod-1)) mod bsn_mod; /* previous bsn: bsn -1 */ |
| 1105 | 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] | 1106 | |
| 1107 | |
| 1108 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1109 | } |
| 1110 | |
| 1111 | /* Verify DL CS above "cs max" set by VTY is never used */ |
| 1112 | testcase TC_cs_max_dl() runs on RAW_PCU_Test_CT { |
| 1113 | /* Initialize NS/BSSGP side */ |
| 1114 | f_init_bssgp(); |
| 1115 | /* Initialize GPRS MS side */ |
| 1116 | f_init_gprs_ms(); |
| 1117 | |
| 1118 | /* Initialize the PCU interface abstraction */ |
| 1119 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1120 | |
| 1121 | /* Set maximum allowed DL CS to 3 */ |
| 1122 | g_cs_initial_dl := 1; |
| 1123 | g_cs_max_dl := 3; |
| 1124 | f_pcuvty_set_allowed_cs_mcs(); |
| 1125 | f_pcuvty_set_link_quality_ranges(); |
| 1126 | |
| 1127 | f_dl_data_exp_cs(f_rlcmac_block_int2cs_mcs(g_cs_max_dl, false)); |
| 1128 | } |
| 1129 | |
| 1130 | /* Check DL CS4 is used in good link conditions if allowed by config */ |
| 1131 | testcase TC_dl_cs1_to_cs4() runs on RAW_PCU_Test_CT { |
| 1132 | /* Initialize NS/BSSGP side */ |
| 1133 | f_init_bssgp(); |
| 1134 | /* Initialize GPRS MS side */ |
| 1135 | f_init_gprs_ms(); |
| 1136 | |
| 1137 | /* Initialize the PCU interface abstraction */ |
| 1138 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1139 | |
| 1140 | /* Set initial DL CS to 1 & maximum allowed DL CS to 4 */ |
| 1141 | g_cs_initial_dl := 1; |
| 1142 | g_cs_max_dl := 4; |
| 1143 | f_pcuvty_set_allowed_cs_mcs(); |
| 1144 | f_pcuvty_set_link_quality_ranges(); |
| 1145 | |
| 1146 | f_dl_data_exp_cs(f_rlcmac_block_int2cs_mcs(g_cs_max_dl, false)); |
| 1147 | } |
| 1148 | |
Pau Espin Pedrol | 2354d6a | 2020-11-05 18:36:59 +0100 | [diff] [blame] | 1149 | /* Test the initial UL MCS set by VTY works fine */ |
| 1150 | testcase TC_mcs_initial_ul() runs on RAW_PCU_Test_CT { |
| 1151 | var RlcmacDlBlock dl_block; |
| 1152 | var PollFnCtx pollctx; |
| 1153 | var EgprsChCodingCommand last_ch_coding; |
| 1154 | var uint32_t unused_fn, sched_fn; |
| 1155 | var GprsMS ms; |
| 1156 | var CodingScheme exp_ul_mcs; |
Pau Espin Pedrol | 2354d6a | 2020-11-05 18:36:59 +0100 | [diff] [blame] | 1157 | |
| 1158 | /* Initialize GPRS MS side */ |
| 1159 | f_init_gprs_ms(); |
| 1160 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1161 | |
| 1162 | /* Initialize the PCU interface abstraction */ |
| 1163 | f_init_raw(testcasename()); |
| 1164 | |
| 1165 | /* Set initial UL MCS to 3 */ |
| 1166 | g_mcs_initial_ul := 3; |
| 1167 | exp_ul_mcs := f_rlcmac_block_int2cs_mcs(g_mcs_initial_ul, true); |
| 1168 | f_pcuvty_set_allowed_cs_mcs(); |
| 1169 | f_pcuvty_set_link_quality_ranges(); |
| 1170 | |
| 1171 | /* Take lqual (dB->cB) so that we stay in that MCS */ |
| 1172 | ms.lqual_cb := g_mcs_lqual_ranges[2].low * 10; |
| 1173 | |
| 1174 | /* Send PACKET RESOURCE REQUEST to upgrade to EGPRS */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1175 | 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] | 1176 | |
| 1177 | if (not match(ms.ul_tbf.tx_cs_mcs, exp_ul_mcs)) { |
| 1178 | setverdict(fail, "Wrong CS_MCS ", ms.ul_tbf.tx_cs_mcs, " received vs exp ", exp_ul_mcs); |
| 1179 | f_shutdown(__BFILE__, __LINE__); |
| 1180 | } |
| 1181 | |
| 1182 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 1183 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 1184 | |
| 1185 | /* Send UL blocks, until we receive UL ACK/NACK and check we are in same initial CS: */ |
| 1186 | while (true) { |
| 1187 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := 15); |
| 1188 | f_rx_rlcmac_dl_block(dl_block, unused_fn); |
| 1189 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 1190 | continue; |
| 1191 | } |
| 1192 | |
| 1193 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 1194 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 1195 | f_shutdown(__BFILE__, __LINE__); |
| 1196 | break; |
| 1197 | } |
| 1198 | |
| 1199 | last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.egprs.ch_coding_cmd; |
| 1200 | break; |
| 1201 | } |
| 1202 | if (f_rlcmac_block_EgprsChCodingCommand2cs_mcs(last_ch_coding) != exp_ul_mcs) { |
| 1203 | setverdict(fail, "Channel Coding does not match our expectations ", exp_ul_mcs, ": ", last_ch_coding); |
| 1204 | f_shutdown(__BFILE__, __LINE__); |
| 1205 | } |
| 1206 | |
| 1207 | /* Remaining UL blocks are used to make sure regardless of initial |
| 1208 | * lqual, we can go lower at any time |
| 1209 | * 0 dB, make sure we downgrade MCS */ |
| 1210 | ms.lqual_cb := 0; |
| 1211 | /* 5 UL blocks, check we are in same initial MCS: */ |
| 1212 | f_ms_tx_ul_data_block_multi(ms, 5); |
| 1213 | /* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */ |
| 1214 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 1215 | last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.egprs.ch_coding_cmd; |
| 1216 | |
| 1217 | if (last_ch_coding != CH_CODING_MCS1) { |
| 1218 | setverdict(fail, "Channel Coding does not match our expectations (MCS-1): ", last_ch_coding); |
| 1219 | f_shutdown(__BFILE__, __LINE__); |
| 1220 | } |
| 1221 | |
| 1222 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1223 | } |
| 1224 | |
Pau Espin Pedrol | db15fa7 | 2020-11-11 12:58:34 +0100 | [diff] [blame] | 1225 | /* Test the maximum UL MCS set by VTY works fine */ |
| 1226 | testcase TC_mcs_max_ul() runs on RAW_PCU_Test_CT { |
| 1227 | var RlcmacDlBlock dl_block; |
| 1228 | var EgprsChCodingCommand last_ch_coding; |
| 1229 | var PollFnCtx pollctx; |
| 1230 | var uint32_t unused_fn, sched_fn; |
| 1231 | var GprsMS ms; |
Pau Espin Pedrol | db15fa7 | 2020-11-11 12:58:34 +0100 | [diff] [blame] | 1232 | |
| 1233 | /* Initialize GPRS MS side */ |
| 1234 | f_init_gprs_ms(); |
| 1235 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1236 | |
| 1237 | /* Initialize the PCU interface abstraction */ |
| 1238 | f_init_raw(testcasename()); |
| 1239 | |
| 1240 | /* Set maximum allowed UL MCS to 5 */ |
| 1241 | g_mcs_max_ul := 5; |
| 1242 | f_pcuvty_set_allowed_cs_mcs(); |
| 1243 | f_pcuvty_set_link_quality_ranges(); |
| 1244 | |
| 1245 | /* Send PACKET RESOURCE REQUEST to upgrade to EGPRS */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1246 | 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] | 1247 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 1248 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 1249 | |
| 1250 | ms.lqual_cb := 40*10; /* 40 dB */ |
| 1251 | f_ms_tx_ul_data_block_multi(ms, 16); |
| 1252 | |
| 1253 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 1254 | last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.egprs.ch_coding_cmd; |
| 1255 | |
| 1256 | if (last_ch_coding != CH_CODING_MCS5) { |
| 1257 | setverdict(fail, "Channel Coding does not match our expectations (MCS-5): ", last_ch_coding); |
| 1258 | f_shutdown(__BFILE__, __LINE__); |
| 1259 | } |
| 1260 | |
| 1261 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1262 | } |
| 1263 | |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 1264 | /* Test the initial DL CS set by VTY works fine */ |
| 1265 | testcase TC_mcs_initial_dl() runs on RAW_PCU_Test_CT { |
| 1266 | var octetstring data := f_rnd_octstring(10); |
| 1267 | var CodingScheme exp_dl_cs_mcs; |
| 1268 | var RlcmacDlBlock dl_block; |
| 1269 | var uint32_t poll_fn; |
| 1270 | var GprsMS ms; |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 1271 | |
| 1272 | /* Initialize NS/BSSGP side */ |
| 1273 | f_init_bssgp(); |
| 1274 | /* Initialize GPRS MS side */ |
| 1275 | f_init_gprs_ms(); |
| 1276 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1277 | |
| 1278 | /* Initialize the PCU interface abstraction */ |
| 1279 | f_init_raw(testcasename()); |
| 1280 | |
| 1281 | /* Set initial allowed DL MCS to 3 */ |
| 1282 | g_mcs_initial_dl := 3; |
| 1283 | exp_dl_cs_mcs := MCS_3; |
| 1284 | /* Set maximum allowed DL MCS to 4 */ |
| 1285 | g_mcs_max_dl := 4; |
| 1286 | f_pcuvty_set_allowed_cs_mcs(); |
| 1287 | f_pcuvty_set_link_quality_ranges(); |
| 1288 | |
| 1289 | /* Establish BSSGP connection to the PCU */ |
| 1290 | f_bssgp_establish(); |
| 1291 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1292 | |
| 1293 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1294 | 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] | 1295 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1296 | |
| 1297 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1298 | f_sleep(X2002); |
| 1299 | f_rx_rlcmac_dl_block_exp_data(dl_block, poll_fn, data, 0, exp_dl_cs_mcs); |
| 1300 | |
| 1301 | /* ACK the DL block */ |
Pau Espin Pedrol | e8db673 | 2020-11-12 21:06:41 +0100 | [diff] [blame] | 1302 | f_dltbf_ack_block(ms.dl_tbf, dl_block, '1'B); |
| 1303 | 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] | 1304 | f_dl_block_ack_fn(dl_block, poll_fn)); |
| 1305 | |
| 1306 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1307 | } |
| 1308 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1309 | /* Verify DL MCS above "mcs max" set by VTY is never used */ |
| 1310 | testcase TC_mcs_max_dl() runs on RAW_PCU_Test_CT { |
| 1311 | /* Initialize NS/BSSGP side */ |
| 1312 | f_init_bssgp(); |
| 1313 | /* Initialize GPRS MS side */ |
| 1314 | f_init_gprs_ms(); |
| 1315 | |
| 1316 | /* Initialize the PCU interface abstraction */ |
| 1317 | f_init_raw(testcasename()); |
| 1318 | |
| 1319 | /* Set maximum allowed DL CS to 3 */ |
| 1320 | g_mcs_initial_dl := 1; |
| 1321 | g_mcs_max_dl := 3; |
| 1322 | f_pcuvty_set_allowed_cs_mcs(); |
| 1323 | f_pcuvty_set_link_quality_ranges(); |
| 1324 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1325 | 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] | 1326 | } |
| 1327 | |
Pau Espin Pedrol | 1451f9f | 2021-05-11 11:52:37 +0200 | [diff] [blame] | 1328 | /* Verify PCU drops TBF after some time of inactivity. */ |
| 1329 | testcase TC_t3141() runs on RAW_PCU_Test_CT { |
| 1330 | var PCUIF_info_ind info_ind; |
| 1331 | var template (value) TsTrxBtsNum nr; |
| 1332 | var BTS_PDTCH_Block data_msg; |
| 1333 | var GprsMS ms; |
| 1334 | var uint3_t rx_usf; |
| 1335 | timer T_3141 := 1.0; |
| 1336 | var boolean ul_tbf_usf_req := false; |
| 1337 | |
| 1338 | /* Initialize NS/BSSGP side */ |
| 1339 | f_init_bssgp(); |
| 1340 | /* Initialize GPRS MS side */ |
| 1341 | f_init_gprs_ms(); |
| 1342 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1343 | |
| 1344 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1345 | /* Only use 1 PDCH to simplify test: */ |
| 1346 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
| 1347 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 1348 | /* Initialize the PCU interface abstraction */ |
| 1349 | f_init_raw(testcasename(), info_ind); |
| 1350 | |
| 1351 | f_vty_config2(PCUVTY, {"pcu"}, "timer T3141 1"); |
| 1352 | |
| 1353 | /* Establish BSSGP connection to the PCU */ |
| 1354 | f_bssgp_establish(); |
| 1355 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1356 | |
| 1357 | /* Establish a one-phase access Uplink TBF */ |
| 1358 | f_ms_establish_ul_tbf(ms); |
| 1359 | |
| 1360 | T_3141.start; |
| 1361 | |
| 1362 | /* Now we wait for PCU to transmit our USF */ |
| 1363 | nr := ts_TsTrxBtsNum; |
| 1364 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1365 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1366 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1367 | block_nr := nr.blk_nr)); |
| 1368 | |
| 1369 | alt { |
| 1370 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1371 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1372 | ?)) -> value data_msg { |
| 1373 | if (ms.ul_tbf.usf[valueof(nr.ts_nr)] == USF_UNUSED) { |
| 1374 | setverdict(fail, "Unexpected ts_nr ", valueof(nr.ts_nr), " without USF allocated"); |
| 1375 | f_shutdown(__BFILE__, __LINE__); |
| 1376 | } |
| 1377 | |
| 1378 | rx_usf := f_rlcmac_dl_block_get_usf(data_msg.dl_block); |
| 1379 | if (rx_usf == ms.ul_tbf.usf[valueof(nr.ts_nr)]) { |
| 1380 | /* PCU requests our USF, transmit WITHOUT tlli to avoid contention resolution success */ |
| 1381 | ul_tbf_usf_req := true; |
| 1382 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := 15, with_tlli := false, fn := f_next_pdch_block(data_msg.raw.fn)) |
| 1383 | } else if (rx_usf == USF_UNUSED) { |
| 1384 | if (data_msg.raw.fn >= ms.ul_tbf.start_time_fn) { |
| 1385 | if (ul_tbf_usf_req) { |
| 1386 | /* TBF was dropped by T3141, success */ |
| 1387 | setverdict(pass); |
| 1388 | break; |
| 1389 | } else { |
| 1390 | log("PCU never requested USF, unexpected"); |
| 1391 | f_shutdown(__BFILE__, __LINE__); |
| 1392 | } |
| 1393 | } /* else: Keep waiting for TBF to be active by network */ |
| 1394 | } else { |
| 1395 | log("PCU requests ", rx_usf, ", we have ", ms.ul_tbf.usf[valueof(nr.ts_nr)]); |
| 1396 | f_shutdown(__BFILE__, __LINE__); |
| 1397 | } |
| 1398 | |
| 1399 | /* Make sure we don't receive a Ul ACK/NACK with TLLI set: */ |
| 1400 | if (match(data_msg.dl_block, |
| 1401 | tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, |
| 1402 | tr_UlAckNackGprs(tlli := ?, |
| 1403 | acknack_desc := ?, |
| 1404 | rel99 := *)))) |
| 1405 | { |
| 1406 | log("Received UL ACK/NACK with TLLI set"); |
| 1407 | f_shutdown(__BFILE__, __LINE__); |
| 1408 | } |
| 1409 | |
| 1410 | nr := ts_TsTrxBtsNum; |
| 1411 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1412 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1413 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1414 | block_nr := nr.blk_nr)); |
| 1415 | repeat; |
| 1416 | } |
| 1417 | [] T_3141.timeout { |
| 1418 | log("T_3141 expired but TBF is still active, unexpected"); |
| 1419 | f_shutdown(__BFILE__, __LINE__); |
| 1420 | } |
| 1421 | [] BTS.receive { |
| 1422 | /* We should never receive non-dummy messages, aka UL ACK/NACK, |
| 1423 | * because we never sent the TLLI to the PCU */ |
| 1424 | setverdict(fail, "Unexpected BTS message"); |
| 1425 | f_shutdown(__BFILE__, __LINE__); |
| 1426 | } |
| 1427 | } |
| 1428 | |
| 1429 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1430 | } |
| 1431 | |
Pau Espin Pedrol | f30fa1d | 2021-03-03 19:55:11 +0100 | [diff] [blame] | 1432 | /* Validate what happens when RACH to get UL TBF and then PCU receives no UL |
| 1433 | * data. It should end up in N3101 reaching N3101_MAX and finally triggering |
| 1434 | * T3169. See OS#5033 */ |
| 1435 | testcase TC_n3101_max_t3169() runs on RAW_PCU_Test_CT { |
| 1436 | var PCUIF_info_ind info_ind; |
| 1437 | var template (value) TsTrxBtsNum nr; |
| 1438 | var BTS_PDTCH_Block data_msg; |
| 1439 | var GprsMS ms; |
| 1440 | var uint3_t rx_usf; |
| 1441 | const integer N3101_MAX := 9; /* N3101 shall be greater than 8 */ |
| 1442 | var integer n3101 := 0; |
| 1443 | timer T_3169 := 1.0; |
| 1444 | |
| 1445 | /* Initialize NS/BSSGP side */ |
| 1446 | f_init_bssgp(); |
| 1447 | /* Initialize GPRS MS side */ |
| 1448 | f_init_gprs_ms(); |
| 1449 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1450 | |
| 1451 | /* Initialize the PCU interface abstraction */ |
| 1452 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1453 | info_ind.n3101 := N3101_MAX; |
| 1454 | info_ind.t3169 := 1; |
| 1455 | f_init_raw(testcasename(), info_ind); |
| 1456 | |
| 1457 | /* Establish BSSGP connection to the PCU */ |
| 1458 | f_bssgp_establish(); |
| 1459 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1460 | |
| 1461 | /* Establish UL TBF */ |
| 1462 | f_ms_establish_ul_tbf(ms); |
| 1463 | |
| 1464 | /* Now we wait for PCU to transmit our USF */ |
| 1465 | nr := ts_TsTrxBtsNum; |
| 1466 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1467 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1468 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1469 | block_nr := nr.blk_nr)); |
| 1470 | |
| 1471 | alt { |
| 1472 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1473 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1474 | ?)) -> value data_msg { |
| 1475 | if (ms.ul_tbf.usf[valueof(nr.ts_nr)] == USF_UNUSED) { |
| 1476 | setverdict(fail, "Unexpected ts_nr ", valueof(nr.ts_nr), " without USF allocated"); |
| 1477 | f_shutdown(__BFILE__, __LINE__); |
| 1478 | } |
| 1479 | |
| 1480 | rx_usf := f_rlcmac_dl_block_get_usf(data_msg.dl_block); |
| 1481 | if (rx_usf == ms.ul_tbf.usf[valueof(nr.ts_nr)]) { |
| 1482 | log("PCU requests our USF ", rx_usf, ", n3101=", n3101); |
| 1483 | n3101 := n3101 + 1; |
Pau Espin Pedrol | 73c5d37 | 2021-03-24 18:48:24 +0100 | [diff] [blame] | 1484 | if (n3101 > N3101_MAX + 1) { //+1: DL<->UL FN offset |
| 1485 | setverdict(fail, "Reached ", n3101, " > ", N3101_MAX + 1, " (N3101_MAX+1) and PCU still sends us USFs"); |
Pau Espin Pedrol | f30fa1d | 2021-03-03 19:55:11 +0100 | [diff] [blame] | 1486 | f_shutdown(__BFILE__, __LINE__); |
| 1487 | } |
Pau Espin Pedrol | 73c5d37 | 2021-03-24 18:48:24 +0100 | [diff] [blame] | 1488 | } else if (rx_usf == USF_UNUSED and n3101 == N3101_MAX + 1) { |
Pau Espin Pedrol | f30fa1d | 2021-03-03 19:55:11 +0100 | [diff] [blame] | 1489 | /* If we already received USFs for us and we don't receive them anymore, that means the TBF entered T3169 */ |
| 1490 | log("PCU stopped requesting USF ", ms.ul_tbf.usf[valueof(nr.ts_nr)]); |
| 1491 | if (not T_3169.running) { |
| 1492 | log("T3169 started"); |
| 1493 | T_3169.start; |
| 1494 | } |
| 1495 | } else if(rx_usf == USF_UNUSED and n3101 > 0) { |
| 1496 | setverdict(fail, "PCU stopped requesting USFs too early: ", n3101, " < ", N3101_MAX, " (N3101_MAX)"); |
| 1497 | f_shutdown(__BFILE__, __LINE__); |
| 1498 | } else { |
| 1499 | log("PCU requests ", rx_usf, ", we have ", ms.ul_tbf.usf[valueof(nr.ts_nr)]); |
| 1500 | } |
| 1501 | nr := ts_TsTrxBtsNum; |
| 1502 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1503 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1504 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1505 | block_nr := nr.blk_nr)); |
| 1506 | repeat; |
| 1507 | } |
| 1508 | [] T_3169.timeout { |
| 1509 | log("T_3169 expired"); |
| 1510 | /* Done in alt */ |
| 1511 | } |
| 1512 | [] BTS.receive { |
| 1513 | setverdict(fail, "Unexpected BTS message"); |
| 1514 | f_shutdown(__BFILE__, __LINE__); |
| 1515 | } |
| 1516 | } |
| 1517 | |
| 1518 | /* Now that T3169 has expired, establishing a Ul TBF should provide same |
| 1519 | /* USFs as per previous TBF since they were freed at expiration time: */ |
| 1520 | var uint3_t old_usf[8] := ms.ul_tbf.usf; |
| 1521 | var uint5_t old_tfi := ms.ul_tbf.tfi; |
| 1522 | f_ms_establish_ul_tbf(ms); |
| 1523 | if (old_tfi != ms.ul_tbf.tfi) { |
| 1524 | setverdict(fail, "Unexpected TFI change: ", ms.ul_tbf.tfi, " vs exp ", old_tfi); |
| 1525 | f_shutdown(__BFILE__, __LINE__); |
| 1526 | } |
| 1527 | for (var integer i := 0; i < 8; i := i +1) { |
| 1528 | if (ms.ul_tbf.usf[i] != old_usf[i]) { |
| 1529 | setverdict(fail, "Unexpected USF change: ", ms.ul_tbf.usf[i], " vs exp ", old_usf[i]); |
| 1530 | f_shutdown(__BFILE__, __LINE__); |
| 1531 | } |
| 1532 | } |
| 1533 | |
| 1534 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1535 | } |
| 1536 | |
Pau Espin Pedrol | cc895df | 2021-04-20 12:58:32 +0200 | [diff] [blame] | 1537 | |
| 1538 | /* Verify after N3103_MAX is reached, T3169 is started and upon timeout TBF is |
| 1539 | freed and no longer available. Trigger it by sending a few UL blocks CTRL ACKING |
| 1540 | the final UL ACK sent at us. */ |
| 1541 | testcase TC_n3103_max_t3169() runs on RAW_PCU_Test_CT { |
| 1542 | var PCUIF_info_ind info_ind; |
| 1543 | var BTS_PDTCH_Block data_msg; |
| 1544 | var RlcmacDlBlock dl_block; |
| 1545 | var uint32_t sched_fn; |
| 1546 | var template (value) TsTrxBtsNum nr; |
| 1547 | var template RlcmacDlBlock exp_ul_ack; |
| 1548 | var template UlAckNackGprs exp_ul_ack_sub; |
| 1549 | var GprsMS ms; |
| 1550 | const integer N3103_MAX := 2; /* N3103 is usually somewhere 2-5 */ |
| 1551 | var integer N3103 := 0; |
| 1552 | timer T_3169 := 1.0; |
| 1553 | |
| 1554 | /* Initialize GPRS MS side */ |
| 1555 | f_init_gprs_ms(); |
| 1556 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1557 | |
| 1558 | /* Initialize the PCU interface abstraction */ |
| 1559 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1560 | info_ind.n3103 := N3103_MAX; |
| 1561 | info_ind.t3169 := 1; |
| 1562 | f_init_raw(testcasename(), info_ind); |
| 1563 | |
| 1564 | /* Establish an Uplink TBF */ |
| 1565 | f_ms_establish_ul_tbf(ms); |
| 1566 | |
Pau Espin Pedrol | 93ae452 | 2021-05-11 15:58:26 +0200 | [diff] [blame] | 1567 | f_ms_tx_ul_data_block_multi(ms, 5, with_tlli := true); |
Pau Espin Pedrol | cc895df | 2021-04-20 12:58:32 +0200 | [diff] [blame] | 1568 | exp_ul_ack_sub := tr_UlAckNackGprs(*, tr_AckNackDescription('1'B), *); |
| 1569 | exp_ul_ack := tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, exp_ul_ack_sub); |
| 1570 | |
| 1571 | nr := ts_TsTrxBtsNum; |
| 1572 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1573 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1574 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1575 | block_nr := nr.blk_nr)); |
| 1576 | alt { |
| 1577 | [N3103 < N3103_MAX] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1578 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1579 | exp_ul_ack)) -> value data_msg { |
| 1580 | if (not f_dl_block_rrbp_valid(data_msg.dl_block)) { |
| 1581 | setverdict(fail, "Unexpected DL BLOCK has no RRBP: ", data_msg.dl_block); |
| 1582 | f_shutdown(__BFILE__, __LINE__); |
| 1583 | } |
| 1584 | |
| 1585 | nr := ts_TsTrxBtsNum; |
| 1586 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1587 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1588 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1589 | block_nr := nr.blk_nr)); |
| 1590 | N3103 := N3103 + 1; |
| 1591 | if (N3103 == N3103_MAX) { |
| 1592 | /* At this point in time (N3103_MAX reached), PCU is |
| 1593 | * moving the TBF to RELEASE state so no data/ctrl for |
| 1594 | * it is tx'ed, hence the dummy blocks: */ |
| 1595 | T_3169.start; |
| 1596 | } |
| 1597 | repeat; |
| 1598 | } |
| 1599 | [N3103 >= N3103_MAX] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1600 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1601 | exp_ul_ack)) -> value data_msg { |
| 1602 | setverdict(fail, "Unexpected UL ACK/NACK after reaching N3103_MAX"); |
| 1603 | f_shutdown(__BFILE__, __LINE__); |
| 1604 | } |
| 1605 | [] as_ms_rx_ignore_dummy(ms, nr); |
| 1606 | [T_3169.running] T_3169.timeout { |
| 1607 | log("T_3169 timeout"); |
| 1608 | /* Done in alt, wait for pending RTS initiated previously in |
| 1609 | * above case before continuing (expect /* Dummy block): */ |
| 1610 | BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1611 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1612 | tr_RLCMAC_DUMMY_CTRL)); |
| 1613 | } |
| 1614 | [] BTS.receive { |
| 1615 | setverdict(fail, "Unexpected BTS message"); |
| 1616 | f_shutdown(__BFILE__, __LINE__); |
| 1617 | } |
| 1618 | } |
| 1619 | |
| 1620 | /* Now that T3169 has expired, establishing a Ul TBF should provide same |
| 1621 | * USFs as per previous TBF since they were freed at expiration time: */ |
| 1622 | var uint3_t old_usf[8] := ms.ul_tbf.usf; |
| 1623 | var uint5_t old_tfi := ms.ul_tbf.tfi; |
| 1624 | f_ms_establish_ul_tbf(ms); |
| 1625 | if (old_tfi != ms.ul_tbf.tfi) { |
| 1626 | setverdict(fail, "Unexpected TFI change: ", ms.ul_tbf.tfi, " vs exp ", old_tfi); |
| 1627 | f_shutdown(__BFILE__, __LINE__); |
| 1628 | } |
| 1629 | for (var integer i := 0; i < 8; i := i +1) { |
| 1630 | if (ms.ul_tbf.usf[i] != old_usf[i]) { |
| 1631 | setverdict(fail, "Unexpected USF change: ", ms.ul_tbf.usf[i], " vs exp ", old_usf[i]); |
| 1632 | f_shutdown(__BFILE__, __LINE__); |
| 1633 | } |
| 1634 | } |
| 1635 | |
| 1636 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1637 | } |
| 1638 | |
Pau Espin Pedrol | 84a8c3c | 2021-03-01 17:22:29 +0100 | [diff] [blame] | 1639 | /* Verify that a Downlink TBF is kept available until T3191 fires, at which |
| 1640 | * point the TBF is no longer available. In order to get to start of T3191, we |
| 1641 | * have to wait for x2031 since that marks the IDLE TBF time, that is, the delay |
| 1642 | * until TBF release procedure starts after draining DL queue. */ |
| 1643 | testcase TC_x2031_t3191() runs on RAW_PCU_Test_CT { |
| 1644 | var PCUIF_info_ind info_ind; |
| 1645 | var RlcmacDlBlock dl_block; |
| 1646 | var octetstring data1 := f_rnd_octstring(200); |
| 1647 | var octetstring data2 := f_rnd_octstring(10); |
| 1648 | var uint32_t dl_fn; |
| 1649 | var template (value) TsTrxBtsNum nr; |
| 1650 | var BTS_PDTCH_Block data_msg; |
| 1651 | var GprsMS ms; |
| 1652 | |
| 1653 | /* Initialize NS/BSSGP side */ |
| 1654 | f_init_bssgp(); |
| 1655 | /* Initialize GPRS MS side */ |
| 1656 | f_init_gprs_ms(); |
| 1657 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1658 | |
| 1659 | /* Initialize the PCU interface abstraction */ |
| 1660 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1661 | /* Set timer to 1 sec (default 5) to speedup test: */ |
| 1662 | info_ind.t3191 := 1; |
| 1663 | f_init_raw(testcasename(), info_ind); |
| 1664 | |
| 1665 | /* Establish BSSGP connection to the PCU */ |
| 1666 | f_bssgp_establish(); |
| 1667 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1668 | |
| 1669 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 1670 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1)); |
| 1671 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1672 | |
| 1673 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1674 | f_sleep(X2002); |
| 1675 | |
| 1676 | while (true) { |
| 1677 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, ?, ?); |
| 1678 | |
| 1679 | /* Keep Ack/Nack description updated (except for last BSN) */ |
| 1680 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
| 1681 | |
| 1682 | if (f_dl_block_rrbp_valid(dl_block)) { |
| 1683 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1684 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 1685 | break; |
| 1686 | } |
| 1687 | } |
| 1688 | |
| 1689 | /* Now we wait for IDLE TBF timer (X2031) to time out and receive a FINAL ACK */ |
| 1690 | nr := ts_TsTrxBtsNum; |
| 1691 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1692 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1693 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1694 | block_nr := nr.blk_nr)); |
| 1695 | alt { |
| 1696 | [] as_ms_rx_ignore_dummy(ms, nr); |
| 1697 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1698 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1699 | ?)) -> value data_msg { |
| 1700 | if (data_msg.dl_block.data.mac_hdr.hdr_ext.fbi) { |
| 1701 | log("Received FINAL_ACK"); |
| 1702 | ms.dl_tbf.acknack_desc.final_ack := '1'B; |
| 1703 | break; |
| 1704 | } |
| 1705 | if (f_dl_block_rrbp_valid(data_msg.dl_block)) { |
| 1706 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, data_msg.dl_block); |
| 1707 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1708 | f_dl_block_ack_fn(dl_block, data_msg.raw.fn)); |
| 1709 | } |
| 1710 | nr := ts_TsTrxBtsNum; |
| 1711 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1712 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1713 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1714 | block_nr := nr.blk_nr)); |
| 1715 | repeat; |
| 1716 | } |
| 1717 | [] BTS.receive { |
| 1718 | setverdict(fail, "Unexpected BTS message"); |
| 1719 | f_shutdown(__BFILE__, __LINE__); |
| 1720 | } |
| 1721 | } |
| 1722 | |
| 1723 | /* Avoid ACKing the last RLC data block on purpose here, wait for t3191 |
| 1724 | to time out. We simply sleep instead of requesting blocks because |
| 1725 | otherwise retransmissions would keep restarting the timer. */ |
| 1726 | f_sleep(int2float(info_ind.t3191)); |
| 1727 | |
| 1728 | /* The TBF should be freed now, so new data should trigger an Assignment: */ |
| 1729 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data2)); |
| 1730 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1731 | |
| 1732 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1733 | f_sleep(X2002); |
| 1734 | /* Now that we confirmed the new assignment in the dl-tbf, lets receive the data and ack it */ |
| 1735 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data2, 0); |
| 1736 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1737 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1738 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 1739 | |
| 1740 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1741 | } |
| 1742 | |
| 1743 | /* Same as TC_zero_x2031_t3191, but this time without x2031 (immediate FINAL_ACK). */ |
| 1744 | testcase TC_zero_x2031_t3191() runs on RAW_PCU_Test_CT { |
| 1745 | var PCUIF_info_ind info_ind; |
| 1746 | var RlcmacDlBlock dl_block; |
| 1747 | var octetstring data1 := f_rnd_octstring(1400); |
| 1748 | var octetstring data2 := f_rnd_octstring(10); |
| 1749 | var uint32_t dl_fn; |
| 1750 | var GprsMS ms; |
| 1751 | |
| 1752 | /* Initialize NS/BSSGP side */ |
| 1753 | f_init_bssgp(); |
| 1754 | /* Initialize GPRS MS side */ |
| 1755 | f_init_gprs_ms(); |
| 1756 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1757 | |
| 1758 | /* Initialize the PCU interface abstraction */ |
| 1759 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1760 | /* Set timer to 1 sec (default 5) to speedup test: */ |
| 1761 | info_ind.t3191 := 1; |
| 1762 | f_init_raw(testcasename(), info_ind); |
| 1763 | |
| 1764 | f_vty_config2(PCUVTY, {"pcu"}, "timer X2031 0"); |
| 1765 | |
| 1766 | /* Establish BSSGP connection to the PCU */ |
| 1767 | f_bssgp_establish(); |
| 1768 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1769 | |
| 1770 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 1771 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1)); |
| 1772 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1773 | |
| 1774 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1775 | f_sleep(X2002); |
| 1776 | |
| 1777 | /* Send enough DL data to at least be able to DL ACK once (excl the |
| 1778 | * FINAL_ACK one), so that PCU sees we are listening in PDCH and avoids |
| 1779 | * other code paths like trying to Imm Assign on CCCH again, etc.. */ |
| 1780 | while (true) { |
| 1781 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, ?, ?); |
| 1782 | |
| 1783 | if (dl_block.data.mac_hdr.hdr_ext.fbi) { |
| 1784 | log("Received FINAL_ACK"); |
| 1785 | ms.dl_tbf.acknack_desc.final_ack := '1'B; |
| 1786 | break; |
| 1787 | } |
| 1788 | |
| 1789 | /* Keep Ack/Nack description updated (except for last BSN) */ |
| 1790 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
| 1791 | |
| 1792 | if (f_dl_block_rrbp_valid(dl_block)) { |
| 1793 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1794 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 1795 | } |
| 1796 | } |
| 1797 | |
| 1798 | /* Avoid ACKing the last RLC data block on purpose here, wait for t3191 |
| 1799 | to time out. We simply sleep instead of requesting blocks because |
| 1800 | otherwise retransmissions would keep restarting the timer. */ |
| 1801 | f_sleep(int2float(info_ind.t3191)); |
| 1802 | |
| 1803 | /* The TBF should be freed now, so new data should trigger an Assignment: */ |
| 1804 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data2)); |
| 1805 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1806 | |
| 1807 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1808 | f_sleep(X2002); |
| 1809 | /* Now that we confirmed the new assignment in the dl-tbf, lets receive the data and ack it */ |
| 1810 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data2, 0); |
| 1811 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1812 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1813 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 1814 | |
| 1815 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1816 | } |
| 1817 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1818 | /* Verify that a Downlink TBF can be assigned using PACCH shortly after the |
| 1819 | * release of prev DL TBF due to MS staying in PDCH for a while (T3192, in PCU |
| 1820 | * T3193) after DL TBF release */ |
| 1821 | testcase TC_t3193() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1822 | var RlcmacDlBlock dl_block; |
| 1823 | var octetstring data := f_rnd_octstring(10); |
| 1824 | var boolean ok; |
| 1825 | var uint32_t sched_fn; |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1826 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1827 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1828 | var AckNackDescription ack_nack_desc := valueof(t_AckNackDescription_init); |
| 1829 | |
| 1830 | /* Initialize NS/BSSGP side */ |
| 1831 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1832 | /* Initialize GPRS MS side */ |
| 1833 | f_init_gprs_ms(); |
| 1834 | 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] | 1835 | |
| 1836 | /* Initialize the PCU interface abstraction */ |
| 1837 | f_init_raw(testcasename()); |
| 1838 | |
| 1839 | /* Establish BSSGP connection to the PCU */ |
| 1840 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 1841 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1842 | |
| 1843 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1844 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 1845 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Vadim Yanitskiy | 2e213ae | 2020-05-06 22:26:17 +0700 | [diff] [blame] | 1846 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1847 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1848 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1849 | 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] | 1850 | |
| 1851 | /* ACK the DL block */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1852 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1853 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1854 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1855 | |
| 1856 | /* 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] | 1857 | (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] | 1858 | 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] | 1859 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
Vadim Yanitskiy | 7431e9e | 2020-07-21 01:59:17 +0700 | [diff] [blame] | 1860 | 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] | 1861 | |
| 1862 | 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] | 1863 | |
| 1864 | /* 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] | 1865 | 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] | 1866 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1867 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1868 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 1869 | |
| 1870 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1871 | } |
| 1872 | |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 1873 | /* Verify after N3105_MAX is reached, T3195 is started and upon timeout TBF is |
| 1874 | freed and no longer available. Trigger it by sending DL blocks and never DL |
| 1875 | ACKing the data (which are requested through RRBP) */ |
| 1876 | testcase TC_n3105_max_t3195() runs on RAW_PCU_Test_CT { |
| 1877 | var PCUIF_info_ind info_ind; |
| 1878 | var RlcmacDlBlock dl_block; |
| 1879 | var octetstring data1 := f_rnd_octstring(1000); |
| 1880 | var octetstring data2 := f_rnd_octstring(10); |
| 1881 | var uint32_t dl_fn; |
| 1882 | var template (value) TsTrxBtsNum nr; |
| 1883 | var BTS_PDTCH_Block data_msg; |
| 1884 | var GprsMS ms; |
| 1885 | const integer N3105_MAX := 2; |
| 1886 | var integer N3105 := 0; |
| 1887 | timer T_3195 := 1.0; |
| 1888 | var integer num_poll_recv := 0; |
| 1889 | |
| 1890 | /* Initialize NS/BSSGP side */ |
| 1891 | f_init_bssgp(); |
| 1892 | /* Initialize GPRS MS side */ |
| 1893 | f_init_gprs_ms(); |
| 1894 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1895 | |
| 1896 | /* Initialize the PCU interface abstraction */ |
| 1897 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1898 | /* Speedup test: */ |
| 1899 | info_ind.n3105 := N3105_MAX; |
| 1900 | info_ind.t3195 := 1; |
| 1901 | f_init_raw(testcasename(), info_ind); |
| 1902 | |
| 1903 | /* Disable "MS delay release" timer, to avoid old DL data kept in cached |
| 1904 | * MS and retransmitted after the TBF is released and later on created |
| 1905 | * (because the MS is reused) */ |
| 1906 | f_vty_config2(PCUVTY, {"pcu"}, "timer X2030 0"); |
| 1907 | |
| 1908 | /* Establish BSSGP connection to the PCU */ |
| 1909 | f_bssgp_establish(); |
| 1910 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1911 | |
| 1912 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 1913 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1)); |
| 1914 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1915 | |
| 1916 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1917 | f_sleep(X2002); |
| 1918 | |
| 1919 | /* Now we go on receiving DL data and not answering RRBP: */ |
| 1920 | nr := ts_TsTrxBtsNum; |
| 1921 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1922 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1923 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1924 | block_nr := nr.blk_nr)); |
| 1925 | alt { |
| 1926 | [not T_3195.running] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1927 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1928 | tr_RLCMAC_DATA)) -> value data_msg { |
| 1929 | if (f_dl_block_rrbp_valid(data_msg.dl_block)) { |
| 1930 | if (num_poll_recv == 0) { |
| 1931 | /* ACK first one so PCU detects we are there and doesn't retransmit Imm Ass */ |
| 1932 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, data_msg.dl_block); |
| 1933 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1934 | f_dl_block_ack_fn(data_msg.dl_block, data_msg.raw.fn)); |
| 1935 | } else { |
| 1936 | log("Ignoring RRBP ", num_poll_recv); |
| 1937 | N3105 := N3105 + 1; |
| 1938 | } |
| 1939 | num_poll_recv := num_poll_recv + 1; |
| 1940 | } |
| 1941 | |
| 1942 | nr := ts_TsTrxBtsNum; |
| 1943 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1944 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1945 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1946 | block_nr := nr.blk_nr)); |
| 1947 | repeat; |
| 1948 | } |
| 1949 | /* At this point in time (N3105_MAX reached), PCU already moved TBF to |
| 1950 | * RELEASE state so no data for it is tx'ed, hence the dummy blocks: |
| 1951 | */ |
| 1952 | [N3105 == N3105_MAX] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1953 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1954 | tr_RLCMAC_DUMMY_CTRL)) -> value data_msg { |
| 1955 | if (not T_3195.running) { |
| 1956 | T_3195.start; |
| 1957 | /* We even send some new data, nothing should be sent to MS */ |
| 1958 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1)); |
| 1959 | } |
| 1960 | nr := ts_TsTrxBtsNum; |
| 1961 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1962 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1963 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1964 | block_nr := nr.blk_nr)); |
| 1965 | repeat; |
| 1966 | } |
Pau Espin Pedrol | bf8c71f | 2021-04-20 12:23:28 +0200 | [diff] [blame] | 1967 | [T_3195.running] T_3195.timeout { |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 1968 | log("T_3195 timeout"); |
Pau Espin Pedrol | bf8c71f | 2021-04-20 12:23:28 +0200 | [diff] [blame] | 1969 | /* Done in alt, wait for pending RTS initiated previously in |
| 1970 | * above case before continuing (expect /* Dummy block): */ |
| 1971 | BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1972 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1973 | tr_RLCMAC_DUMMY_CTRL)); |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 1974 | } |
| 1975 | [] BTS.receive { |
| 1976 | setverdict(fail, "Unexpected BTS message"); |
| 1977 | f_shutdown(__BFILE__, __LINE__); |
| 1978 | } |
| 1979 | } |
| 1980 | |
| 1981 | /* after T_3195 timeout, TBF is released */ |
| 1982 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data2)); |
| 1983 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1984 | |
| 1985 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1986 | f_sleep(X2002); |
| 1987 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data2, 0); |
| 1988 | |
| 1989 | /* ACK the DL block */ |
| 1990 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1991 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1992 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 1993 | |
| 1994 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1995 | } |
| 1996 | |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 1997 | /* Verify PCU handles correctly Countdown Procedure based on BS_CV_MAX */ |
| 1998 | testcase TC_countdown_procedure() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 1999 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2000 | var uint32_t sched_fn; |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2001 | var octetstring total_payload; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2002 | var GprsMS ms; |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2003 | |
| 2004 | /* Initialize NS/BSSGP side */ |
| 2005 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2006 | /* Initialize GPRS MS side */ |
| 2007 | f_init_gprs_ms(); |
| 2008 | 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] | 2009 | |
| 2010 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2011 | 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] | 2012 | |
| 2013 | /* Establish BSSGP connection to the PCU */ |
| 2014 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2015 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2016 | |
| 2017 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2018 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2019 | |
| 2020 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 2021 | contention resoultion) and make sure it is ACKED fine. */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2022 | 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] | 2023 | /* Set CV = 15 to signal there's still more than BS_CV_MAX blocks to be sent */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 2024 | f_ms_tx_ul_data_block(ms, total_payload, cv := 15, with_tlli := true, fn := ms.ul_tbf.start_time_fn) |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2025 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2026 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2027 | 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] | 2028 | |
| 2029 | /* Send enough blocks to test whole procedure: Until Nth block |
| 2030 | (N=BS_CV_MAX), CV=15 is sent, and then the decreasing countdown value is sent. |
| 2031 | */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2032 | 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] | 2033 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2034 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2035 | 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] | 2036 | |
| 2037 | /* receive one message on BSSGP with all aggregated data in payload: */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2038 | 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] | 2039 | |
| 2040 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2041 | } |
| 2042 | |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2043 | /* Verify PCU handles correctly CS1..4 with all possible LLC payload sizes fitting alone in one RLC block */ |
| 2044 | testcase TC_ul_all_sizes() runs on RAW_PCU_Test_CT { |
| 2045 | var RlcmacDlBlock dl_block; |
| 2046 | var uint32_t dl_fn, sched_fn; |
| 2047 | var octetstring payload; |
| 2048 | var template (value) RlcmacUlBlock ul_data; |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2049 | var template (value) LlcBlockHdr blk_hdr; |
| 2050 | var template (value) LlcBlocks blocks; |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2051 | var integer blk_len; |
| 2052 | var CodingScheme tx_cs; |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2053 | var GprsMS ms; |
| 2054 | |
| 2055 | /* Initialize NS/BSSGP side */ |
| 2056 | f_init_bssgp(); |
| 2057 | /* Initialize GPRS MS side */ |
| 2058 | f_init_gprs_ms(); |
| 2059 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2060 | |
| 2061 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2062 | 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] | 2063 | |
| 2064 | /* Establish BSSGP connection to the PCU */ |
| 2065 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2066 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2067 | |
| 2068 | /* Establish an Uplink TBF */ |
| 2069 | f_ms_establish_ul_tbf(ms); |
| 2070 | |
| 2071 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 2072 | contention resoultion) and make sure it is ACKED fine. */ |
| 2073 | 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] | 2074 | blk_hdr := t_RLCMAC_LLCBLOCK_HDR(length_ind := lengthof(payload), |
| 2075 | more := false, e := true); |
| 2076 | blocks := { t_RLCMAC_LLCBLOCK(payload, blk_hdr) }; |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2077 | /* 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] | 2078 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := ms.ul_tbf.tx_cs_mcs, |
| 2079 | tfi := ms.ul_tbf.tfi, |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2080 | cv := 15, |
| 2081 | bsn := ms.ul_tbf.bsn, |
| 2082 | blocks := blocks, |
| 2083 | tlli := ms.tlli); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2084 | f_ultbf_inc_bsn(ms.ul_tbf); |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 2085 | f_ms_tx_ul_block(ms, ul_data, ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2086 | |
| 2087 | /* ACK and check it was received fine */ |
| 2088 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2089 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2090 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 2091 | /* receive one message on BSSGP with all aggregated data in payload: */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2092 | 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] | 2093 | |
| 2094 | /* Test sending LLC PDUS of incrementing size */ |
| 2095 | var integer max_size := 49; |
| 2096 | for (var integer i := 1; i <= max_size; i := i + 1) { |
| 2097 | var integer cv; |
| 2098 | /* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */ |
| 2099 | log("Sending DATA.ind with LLC payload size ", i); |
| 2100 | if (i < max_size - g_bs_cv_max) { |
| 2101 | cv := 15; |
| 2102 | } else { |
| 2103 | cv := max_size - i; |
| 2104 | } |
| 2105 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2106 | blk_len := 3 + 1 + i; /* 3 Header bytes + LI byte + payload length */ |
| 2107 | 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] | 2108 | payload := f_rnd_octstring(i); |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2109 | blk_hdr := t_RLCMAC_LLCBLOCK_HDR(length_ind := lengthof(payload), |
| 2110 | more := false, e := true); |
| 2111 | blocks := { t_RLCMAC_LLCBLOCK(payload, blk_hdr) }; |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2112 | /* 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] | 2113 | ul_data := t_RLCMAC_UL_DATA(cs := tx_cs, |
| 2114 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2115 | cv := cv, |
| 2116 | bsn := ms.ul_tbf.bsn, |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2117 | blocks := blocks); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2118 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2119 | f_ms_tx_ul_block(ms, ul_data); |
| 2120 | |
| 2121 | /* receive one message on BSSGP with all aggregated data in payload: */ |
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, payload)); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2123 | |
| 2124 | /* we will receive UL ACK/NACK from time to time, handle it. */ |
| 2125 | f_rx_rlcmac_dl_block(dl_block, dl_fn); |
| 2126 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 2127 | continue; |
| 2128 | } |
| 2129 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_GPRS(ul_tfi := ?)) and |
| 2130 | not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 2131 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 2132 | f_shutdown(__BFILE__, __LINE__); |
| 2133 | } |
| 2134 | |
| 2135 | log("Rx Packet Uplink ACK / NACK"); |
| 2136 | sched_fn := f_rrbp_ack_fn(dl_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 2137 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2138 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 2139 | } |
Vadim Yanitskiy | 8e6df0c | 2020-10-18 00:13:15 +0700 | [diff] [blame] | 2140 | |
| 2141 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2142 | } |
| 2143 | |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2144 | function f_TC_ul_data_toolong_fills_padding_cs(inout GprsMS ms, CodingScheme cs, integer cv) runs on RAW_PCU_Test_CT { |
| 2145 | var octetstring payload; |
| 2146 | var template (value) RlcmacUlBlock ul_data; |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2147 | var template (value) LlcBlockHdr blk_hdr; |
| 2148 | var template (value) LlcBlocks blocks; |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2149 | var integer block_len, max_valid_data_len; |
| 2150 | timer T; |
| 2151 | |
| 2152 | block_len := f_rlcmac_cs_mcs2block_len(cs); |
| 2153 | /* We need to send with TLLI since we are in One-Phase Access Contenion |
| 2154 | * resoultion), so that's -4 bytes of data, -3 for headers, -1 for LI |
| 2155 | * indicator, -1 for spare bits octet at the end */ |
| 2156 | max_valid_data_len := block_len - 4 - 3 - 1 - 1; |
| 2157 | 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] | 2158 | blk_hdr := t_RLCMAC_LLCBLOCK_HDR(length_ind := lengthof(payload), |
| 2159 | more := false, e := true); |
| 2160 | blocks := { t_RLCMAC_LLCBLOCK(payload, blk_hdr) }; |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2161 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := cs, |
| 2162 | tfi := ms.ul_tbf.tfi, |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2163 | cv := cv, |
| 2164 | bsn := ms.ul_tbf.bsn, |
| 2165 | blocks := blocks, |
| 2166 | tlli := ms.tlli); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2167 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2168 | f_ms_tx_data_ind(ms, enc_RlcmacUlBlock(valueof(ul_data))); |
| 2169 | |
| 2170 | T.start(0.5); |
| 2171 | alt { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2172 | [] 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] | 2173 | setverdict(fail, "LLC PDU in Malformed RLC block was forwarded"); |
| 2174 | f_shutdown(__BFILE__, __LINE__); |
| 2175 | } |
| 2176 | [] T.timeout { |
| 2177 | setverdict(pass); |
| 2178 | } |
| 2179 | } |
| 2180 | } |
| 2181 | /* Verify PCU finds out incorrectly formated RLC block and discards it. This |
| 2182 | blocks intentionally contain last byte of data placed in last byte of RLC |
| 2183 | containing padding/spare bits, which is incorrect. Spare bits exist and are |
| 2184 | described for CS2..4 in 3GPP TS 44.060 Table 10.2.1: "RLC data block size, |
| 2185 | discounting padding in octet" */ |
| 2186 | testcase TC_ul_data_toolong_fills_padding() runs on RAW_PCU_Test_CT { |
| 2187 | var GprsMS ms; |
| 2188 | var integer block_len, max_valid_data_len; |
| 2189 | |
| 2190 | /* Initialize NS/BSSGP side */ |
| 2191 | f_init_bssgp(); |
| 2192 | /* Initialize GPRS MS side */ |
| 2193 | f_init_gprs_ms(); |
| 2194 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2195 | |
| 2196 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2197 | 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] | 2198 | |
| 2199 | /* Establish BSSGP connection to the PCU */ |
| 2200 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2201 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2202 | |
| 2203 | /* Establish an Uplink TBF */ |
| 2204 | f_ms_establish_ul_tbf(ms); |
| 2205 | |
| 2206 | f_TC_ul_data_toolong_fills_padding_cs(ms, CS_2, 2); |
| 2207 | f_TC_ul_data_toolong_fills_padding_cs(ms, CS_3, 1); |
| 2208 | f_TC_ul_data_toolong_fills_padding_cs(ms, CS_4, 0); |
| 2209 | |
Vadim Yanitskiy | 8e6df0c | 2020-10-18 00:13:15 +0700 | [diff] [blame] | 2210 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2211 | } |
| 2212 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2213 | /* Test scenario where MS wants to send some data on PDCH against SGSN and it is |
| 2214 | * answered, so TBFs for uplink and later for downlink are created. |
| 2215 | */ |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2216 | 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] | 2217 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2218 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2219 | var uint32_t sched_fn; |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2220 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2221 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2222 | |
| 2223 | /* Initialize NS/BSSGP side */ |
| 2224 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2225 | /* Initialize GPRS MS side */ |
| 2226 | f_init_gprs_ms(); |
| 2227 | 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] | 2228 | |
| 2229 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2230 | 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] | 2231 | |
| 2232 | /* Establish BSSGP connection to the PCU */ |
| 2233 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2234 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2235 | |
| 2236 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2237 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2238 | |
Pau Espin Pedrol | 4aac3d0 | 2020-05-13 15:13:49 +0200 | [diff] [blame] | 2239 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 2240 | contention resoultion) and make sure it is ACKED fine */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 2241 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2242 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2243 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2244 | 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] | 2245 | |
| 2246 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2247 | 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] | 2248 | |
| 2249 | /* 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] | 2250 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 2251 | 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] | 2252 | |
| 2253 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2254 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2255 | 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] | 2256 | |
| 2257 | /* ACK the DL block */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2258 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 2259 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 2260 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 2261 | |
| 2262 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2263 | } |
| 2264 | |
| 2265 | /* Test scenario where MS wants to send some data on PDCH against SGSN and it is |
| 2266 | * answered, so TBFs for uplink and later for downlink are created. |
| 2267 | */ |
| 2268 | testcase TC_mo_ping_pong() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 2269 | var template (present) CodingScheme exp_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2270 | f_TC_mo_ping_pong_1phase_access(exp_cs_mcs); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2271 | } |
| 2272 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2273 | /* Test scenario where MS wants to send some data on PDCH against SGSN and it is |
| 2274 | * answered, so TBFs for uplink and later for downlink are created. |
| 2275 | */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2276 | private function f_TC_mo_ping_pong_2phase_access(PCUIF_Flags ind_flags, |
| 2277 | template (value) MSRadioAccessCapabilityV ms_racap, |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 2278 | template (present) CodingScheme exp_ul_cs_mcs := ?, |
| 2279 | template (present) CodingScheme exp_dl_cs_mcs := ?) |
| 2280 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2281 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2282 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 2283 | var PollFnCtx pollctx; |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2284 | var uint32_t sched_fn; |
| 2285 | var uint32_t dl_fn; |
Pau Espin Pedrol | adbbe1e | 2020-05-17 00:28:01 +0200 | [diff] [blame] | 2286 | var uint32_t unused_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2287 | var GprsMS ms; |
| 2288 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2289 | /* Initialize NS/BSSGP side */ |
| 2290 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2291 | /* Initialize GPRS MS side */ |
| 2292 | f_init_gprs_ms(); |
| 2293 | 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] | 2294 | |
| 2295 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2296 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(ind_flags)); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2297 | |
| 2298 | /* Establish BSSGP connection to the PCU */ |
| 2299 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2300 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2301 | |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 2302 | /* Send PACKET RESOURCE REQUEST to upgrade to EGPRS */ |
| 2303 | 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] | 2304 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2305 | if (not match(ms.ul_tbf.tx_cs_mcs, exp_ul_cs_mcs)) { |
| 2306 | 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] | 2307 | f_shutdown(__BFILE__, __LINE__); |
| 2308 | } |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2309 | |
| 2310 | /* Send one UL block (without TLLI since we are in Second-Phase Access) |
| 2311 | and make sure it is ACKED fine */ |
Pau Espin Pedrol | fdbce84 | 2021-03-03 11:43:40 +0100 | [diff] [blame] | 2312 | f_ms_tx_ul_data_block_multi(ms, 1); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2313 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2314 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 2315 | 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] | 2316 | |
| 2317 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2318 | 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] | 2319 | |
| 2320 | /* Now SGSN sends some DL data, PCU will page on PACCH */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2321 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
Pau Espin Pedrol | ddd6c3f | 2021-03-03 12:01:20 +0100 | [diff] [blame] | 2322 | /* Sleep a bit to make sure PCU received the DL data and hence it will be prioritized by scheduler: */ |
| 2323 | f_sleep(0.5); |
Vadim Yanitskiy | 7431e9e | 2020-07-21 01:59:17 +0700 | [diff] [blame] | 2324 | 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] | 2325 | /* DL Ass sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2326 | 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] | 2327 | |
Pau Espin Pedrol | adbbe1e | 2020-05-17 00:28:01 +0200 | [diff] [blame] | 2328 | /* PCU acks the UL data after having received CV=0) */ |
| 2329 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 2330 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2331 | /* 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] | 2332 | 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] | 2333 | |
| 2334 | /* ACK the DL block */ |
Pau Espin Pedrol | e8db673 | 2020-11-12 21:06:41 +0100 | [diff] [blame] | 2335 | f_dltbf_ack_block(ms.dl_tbf, dl_block, '1'B); |
| 2336 | 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] | 2337 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2338 | |
| 2339 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2340 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2341 | |
| 2342 | testcase TC_mo_ping_pong_with_ul_racap() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 2343 | var template (present) CodingScheme exp_ul_cs_mcs := cs_gprs_any; |
| 2344 | var template (present) CodingScheme exp_dl_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2345 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 2346 | 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] | 2347 | } |
| 2348 | |
| 2349 | testcase TC_mo_ping_pong_with_ul_racap_egprs_only() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 2350 | var template (present) CodingScheme exp_ul_cs_mcs := mcs_egprs_any; |
| 2351 | var template (present) CodingScheme exp_dl_cs_mcs := mcs_egprs_any; |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 2352 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 2353 | 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] | 2354 | } |
| 2355 | |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 2356 | testcase TC_force_two_phase_access() runs on RAW_PCU_Test_CT { |
| 2357 | /* Configure PCU to force two phase access */ |
| 2358 | g_force_two_phase_access := true; |
| 2359 | |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 2360 | var CodingScheme exp_ul_cs_mcs := f_rlcmac_block_int2cs_mcs(g_mcs_initial_ul, false); |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 2361 | var template (present) CodingScheme exp_dl_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 2362 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 2363 | 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] | 2364 | } |
| 2365 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2366 | /* Test scenario where SGSN wants to send some data against MS and it is |
| 2367 | * answered by the MS on PDCH, so TBFs for downlink and later for uplink are created. |
| 2368 | */ |
Vadim Yanitskiy | c67240a | 2020-10-17 15:59:37 +0700 | [diff] [blame] | 2369 | private function f_TC_mt_ping_pong(template (omit) MSRadioAccessCapabilityV_BSSGP ms_racap := omit, |
| 2370 | template (present) CodingScheme exp_cs_mcs := ?) |
| 2371 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2372 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2373 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2374 | var uint32_t sched_fn; |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2375 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2376 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2377 | |
| 2378 | /* Initialize NS/BSSGP side */ |
| 2379 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2380 | /* Initialize GPRS MS side */ |
| 2381 | f_init_gprs_ms(); |
| 2382 | 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] | 2383 | |
| 2384 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2385 | 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] | 2386 | |
| 2387 | /* Establish BSSGP connection to the PCU */ |
| 2388 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2389 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2390 | |
| 2391 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2392 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap)); |
| 2393 | 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] | 2394 | |
| 2395 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2396 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2397 | 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] | 2398 | |
Pau Espin Pedrol | 6791eb6 | 2020-05-20 18:27:10 +0200 | [diff] [blame] | 2399 | /* 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] | 2400 | f_dltbf_ack_block(ms.dl_tbf, dl_block, '1'B); |
| 2401 | 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] | 2402 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2403 | |
Pau Espin Pedrol | 6791eb6 | 2020-05-20 18:27:10 +0200 | [diff] [blame] | 2404 | /* Expect UL ass */ |
Vadim Yanitskiy | 7431e9e | 2020-07-21 01:59:17 +0700 | [diff] [blame] | 2405 | 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] | 2406 | |
Pau Espin Pedrol | 4aac3d0 | 2020-05-13 15:13:49 +0200 | [diff] [blame] | 2407 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 2408 | contention resoultion) and make sure it is ACKED fine */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2409 | 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] | 2410 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2411 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2412 | 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] | 2413 | |
| 2414 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2415 | 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] | 2416 | |
| 2417 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2418 | } |
| 2419 | |
| 2420 | testcase TC_mt_ping_pong() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 2421 | var template (present) CodingScheme exp_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2422 | f_TC_mt_ping_pong(omit, exp_cs_mcs); |
| 2423 | } |
| 2424 | |
| 2425 | /* TC_mt_ping_pong, but DL-UNITDATA contains RA Access capability with (M)CS |
| 2426 | /* information about the MS */ |
| 2427 | testcase TC_mt_ping_pong_with_dl_racap() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 2428 | var template (present) CodingScheme exp_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 2429 | 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] | 2430 | } |
| 2431 | |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2432 | /* Verify that if PCU doesn't get one of the intermediate UL data blocks in a UL |
| 2433 | * TBF, it will request retransmission through UL ACK/NACK (with missing block |
| 2434 | * in its bitmap) when CV=0 is received (and hence it knows no more data is to |
| 2435 | * be transferred). |
| 2436 | */ |
| 2437 | testcase TC_ul_intermediate_retrans() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2438 | var RlcmacDlBlock dl_block; |
| 2439 | var template (value) RlcmacUlBlock ul_data; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2440 | var uint32_t sched_fn; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2441 | var octetstring total_payload; |
| 2442 | var octetstring payload; |
| 2443 | var octetstring lost_payload; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2444 | var uint5_t tfi; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2445 | var GprsMS ms; |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2446 | var uint32_t payload_fill_len; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2447 | |
| 2448 | /* Initialize NS/BSSGP side */ |
| 2449 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2450 | /* Initialize GPRS MS side */ |
| 2451 | f_init_gprs_ms(); |
| 2452 | 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] | 2453 | |
| 2454 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2455 | 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] | 2456 | |
| 2457 | /* Establish BSSGP connection to the PCU */ |
| 2458 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2459 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2460 | |
| 2461 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2462 | f_ms_establish_ul_tbf(ms); |
| 2463 | tfi := ms.ul_tbf.tfi; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2464 | |
| 2465 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 2466 | contention resoultion) and make sure it is ACKED fine. */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2467 | payload := f_rnd_octstring(f_ultbf_payload_fill_length(ms.ul_tbf, true)); /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 2468 | f_ms_tx_ul_data_block(ms, payload, cv := 15, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2469 | |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2470 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2471 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2472 | 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] | 2473 | total_payload := payload; |
| 2474 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2475 | payload_fill_len := f_ultbf_payload_fill_length(ms.ul_tbf); |
| 2476 | |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2477 | /* Send 2 packets, skip 1 (inc bsn) and send another one */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2478 | payload := f_rnd_octstring(payload_fill_len); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2479 | f_ms_tx_ul_data_block(ms, payload, cv := 15); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2480 | total_payload := total_payload & payload; |
| 2481 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2482 | payload := f_rnd_octstring(payload_fill_len); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2483 | f_ms_tx_ul_data_block(ms, payload, cv := 15); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2484 | total_payload := total_payload & payload; |
| 2485 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2486 | lost_payload := f_rnd_octstring(payload_fill_len); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2487 | 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] | 2488 | total_payload := total_payload & lost_payload; |
| 2489 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2490 | payload := f_rnd_octstring(payload_fill_len) |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2491 | f_ms_tx_ul_data_block(ms, payload, cv := 15); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2492 | total_payload := total_payload & payload; |
| 2493 | |
| 2494 | /* 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] | 2495 | 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] | 2496 | |
| 2497 | /* On CV=0, we'll receive a UL ACK asking about missing block */ |
| 2498 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2499 | /* TODO: check ack ack bitmap (URBB) */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2500 | ul_data := t_RLCMAC_UL_DATA(cs := ms.ul_tbf.tx_cs_mcs, |
| 2501 | tfi := tfi, |
| 2502 | cv := 15, |
| 2503 | bsn := 3, |
| 2504 | blocks := {t_RLCMAC_LLCBLOCK(lost_payload)}); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2505 | f_ms_tx_ul_block(ms, ul_data); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2506 | |
| 2507 | /* Now final ack is recieved */ |
| 2508 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2509 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2510 | 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] | 2511 | |
| 2512 | /* receive one message on BSSGP with all aggregated data in payload: */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2513 | 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] | 2514 | |
| 2515 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2516 | } |
| 2517 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2518 | /* Verify that if PCU doesn't get an ACK for first DL block after IMM ASS, it |
| 2519 | * will retry by retransmitting both the IMM ASS + DL block after poll (ack) |
| 2520 | * timeout occurs (specified by sent RRBP on DL block). */ |
| 2521 | 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] | 2522 | var RlcmacDlBlock dl_block; |
| 2523 | var octetstring data := f_rnd_octstring(10); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2524 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2525 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2526 | |
| 2527 | /* Initialize NS/BSSGP side */ |
| 2528 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2529 | /* Initialize GPRS MS side */ |
| 2530 | f_init_gprs_ms(); |
| 2531 | 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] | 2532 | |
| 2533 | /* Initialize the PCU interface abstraction */ |
| 2534 | f_init_raw(testcasename()); |
| 2535 | |
| 2536 | /* Establish BSSGP connection to the PCU */ |
| 2537 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2538 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2539 | |
| 2540 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2541 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 2542 | 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] | 2543 | |
| 2544 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2545 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2546 | 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] | 2547 | |
| 2548 | /* Now we don't ack the dl block (emulate MS failed receiveing IMM ASS |
| 2549 | * or GPRS DL, or DL ACK was lost for some reason). As a result, PCU |
| 2550 | * should retrigger IMM ASS + GPRS DL procedure after poll timeout. */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2551 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Vadim Yanitskiy | 2e213ae | 2020-05-06 22:26:17 +0700 | [diff] [blame] | 2552 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2553 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2554 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2555 | 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] | 2556 | |
| 2557 | /* ACK the DL block */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2558 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 2559 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 2560 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 2561 | |
| 2562 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2563 | } |
| 2564 | |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2565 | /* Verify scheduling of multiple Downlink data blocks during one RRBP. */ |
| 2566 | testcase TC_dl_flow_more_blocks() runs on RAW_PCU_Test_CT { |
| 2567 | var AckNackDescription ack_nack_desc := valueof(t_AckNackDescription_init); |
| 2568 | var octetstring data := f_rnd_octstring(16); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2569 | var PacketDlAssign dl_tbf_ass; |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2570 | var RlcmacDlBlock dl_block; |
| 2571 | var uint32_t ack_fn; |
| 2572 | var uint32_t fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2573 | var GprsMS ms; |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2574 | timer T := 5.0; |
| 2575 | |
| 2576 | /* Initialize NS/BSSGP side */ |
| 2577 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2578 | /* Initialize GPRS MS side */ |
| 2579 | f_init_gprs_ms(); |
| 2580 | ms := g_ms[0]; /* We only use first MS in this test */ |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2581 | |
| 2582 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2583 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2584 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 2585 | f_statsd_reset(); |
| 2586 | |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2587 | /* Establish BSSGP connection to the PCU */ |
| 2588 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2589 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2590 | |
| 2591 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2592 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 2593 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2594 | |
| 2595 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 2596 | f_sleep(X2002); |
| 2597 | |
| 2598 | /* Expect the first (GPRS DL) block with bsn=0 and rrbp_valid=1 */ |
| 2599 | 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] | 2600 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2601 | |
| 2602 | /* TDMA frame number on which we are supposed to send the ACK */ |
| 2603 | ack_fn := f_dl_block_ack_fn(dl_block, fn); |
| 2604 | |
| 2605 | /* SGSN sends more blocks during the indicated RRBP */ |
| 2606 | for (var integer bsn := 1; bsn < 63; bsn := bsn + 1) { |
| 2607 | data := f_rnd_octstring(16); /* Random LLC data */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2608 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2609 | |
| 2610 | f_rx_rlcmac_dl_block_exp_data(dl_block, fn, data, bsn); |
| 2611 | |
| 2612 | /* Make sure this block has the same TFI as was assigned |
| 2613 | * FIXME: this is only valid for GPRS, not EGPRS. */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2614 | 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] | 2615 | setverdict(fail, "Rx DL data block with unexpected TFI: ", |
| 2616 | dl_block.data.mac_hdr.hdr_ext.tfi); |
| 2617 | f_shutdown(__BFILE__, __LINE__); |
| 2618 | } |
| 2619 | |
| 2620 | /* Keep Ack/Nack description updated */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2621 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2622 | |
| 2623 | /* Break if this is the end of RRBP */ |
| 2624 | if (fn == ack_fn) { |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2625 | ms.dl_tbf.acknack_desc.final_ack := '1'B; |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2626 | break; |
| 2627 | } |
| 2628 | } |
| 2629 | |
| 2630 | /* This is the end of RRBP, send Packet Downlink Ack/Nack */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2631 | 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] | 2632 | |
| 2633 | /* Make sure that the next block (after the Ack) is dummy */ |
| 2634 | f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 2635 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 2636 | var StatsDExpects expect := { |
| 2637 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 0, max := 0}, |
| 2638 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 1, max := 1}, |
| 2639 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 0, max := 0}, |
| 2640 | { name := "TTCN3.bts.0.tbf.dl.alloc", mtype := "c", min := 1, max := 1}, |
| 2641 | { 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] | 2642 | { 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] | 2643 | { name := "TTCN3.bts.0.rlc.ul_payload_bytes", mtype := "c", min := 0, max := 0} |
| 2644 | }; |
| 2645 | f_statsd_expect(expect); |
| 2646 | |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2647 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2648 | } |
| 2649 | |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2650 | /* Verify Decoding and segmentation of UL LLC PDUs into RLC data blocks, OS#4559. |
| 2651 | * Check "GPRS from A-Z" slide "Example of LI-Field and E-Bit" page 186. |
| 2652 | * Check "3GPP TS 44.060" Annex B. */ |
| 2653 | testcase TC_ul_flow_multiple_llc_blocks() runs on RAW_PCU_Test_CT { |
| 2654 | var RlcmacDlBlock dl_block; |
| 2655 | var octetstring dataA := f_rnd_octstring(20); |
| 2656 | var octetstring dataB := f_rnd_octstring(13); |
| 2657 | var octetstring dataC := f_rnd_octstring(3); |
| 2658 | var octetstring dataD := f_rnd_octstring(12); |
| 2659 | var uint32_t sched_fn; |
| 2660 | var GprsMS ms; |
| 2661 | var template (value) RlcmacUlBlock ul_data; |
| 2662 | |
| 2663 | /* Initialize NS/BSSGP side */ |
| 2664 | f_init_bssgp(); |
| 2665 | /* Initialize GPRS MS side */ |
| 2666 | f_init_gprs_ms(); |
| 2667 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2668 | |
| 2669 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2670 | 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] | 2671 | |
| 2672 | /* Establish BSSGP connection to the PCU */ |
| 2673 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2674 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2675 | |
| 2676 | /* Establish an Uplink TBF */ |
| 2677 | f_ms_establish_ul_tbf(ms); |
| 2678 | |
| 2679 | /* Summary of what's transmitted: |
| 2680 | * 1- UL RlcDataBlock(dataA) [BSN=0, CV=3] |
| 2681 | * 2- UL RlcDataBlock(dataA finished, dataB starts) [BSN=1, CV=2] |
| 2682 | * 3- UL RlcDataBlock(dataB finished, dataC starts and finishes, dataD starts) [BSN=2, CV=1] |
| 2683 | * 4- UL RlcDataBlock(dataD finishes) [BSN=3, CV=0] |
| 2684 | * And on SGSN we receive 4 packets, one for each LlcBlock dataA..D. |
| 2685 | * We'll also receive some UL ACK/NACK we need to reply with CTRL ACK. |
| 2686 | */ |
| 2687 | |
| 2688 | /* UL RlcDataBlock(dataA) [BSN=0, CV=3] */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2689 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := CS_1, |
| 2690 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2691 | cv := 3, |
| 2692 | bsn := ms.ul_tbf.bsn, |
| 2693 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataA, 0, 16)) }, |
| 2694 | tlli := ms.tlli); |
| 2695 | /* Indicate no llc header, meaning first LLC block doesn't finish in current |
| 2696 | * RLCMAC block being sent. */ |
| 2697 | ul_data.data.mac_hdr.e := true; |
| 2698 | f_ultbf_inc_bsn(ms.ul_tbf); |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 2699 | f_ms_tx_ul_block(ms, ul_data, ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2700 | |
| 2701 | /* UL RlcDataBlock(dataA finished, dataB starts) [BSN=1, CV=2] */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2702 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := CS_1, |
| 2703 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2704 | cv := 2, |
| 2705 | bsn := ms.ul_tbf.bsn, |
| 2706 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataA, 16, 4), |
| 2707 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 4, more := true, e := true)), |
| 2708 | t_RLCMAC_LLCBLOCK(substr(dataB, 0, 11)) |
| 2709 | }, |
| 2710 | tlli := ms.tlli); |
| 2711 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2712 | f_ms_tx_ul_block(ms, ul_data); |
| 2713 | |
| 2714 | /* UL block dataA should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2715 | 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] | 2716 | |
| 2717 | /* 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] | 2718 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := CS_1, |
| 2719 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2720 | cv := 1, |
| 2721 | bsn := ms.ul_tbf.bsn, |
| 2722 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataB, 11, 2), |
| 2723 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 2, more := true, e := false)), |
| 2724 | t_RLCMAC_LLCBLOCK(substr(dataC, 0, 3), |
| 2725 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 3, more := true, e := true)), |
| 2726 | t_RLCMAC_LLCBLOCK(substr(dataD, 0, 9)) |
| 2727 | }, |
| 2728 | tlli := ms.tlli); |
| 2729 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2730 | f_ms_tx_ul_block(ms, ul_data); |
| 2731 | |
| 2732 | /* UL block dataB and dataC should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2733 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id, dataB)); |
| 2734 | 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] | 2735 | |
| 2736 | /* UL RlcDataBlock(dataD finishes) [BSN=3, CV=0] */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2737 | ul_data := t_RLCMAC_UL_DATA_TLLI( |
| 2738 | cs := CS_1, |
| 2739 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2740 | cv := 0, |
| 2741 | bsn := ms.ul_tbf.bsn, |
| 2742 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataD, 9, 3), |
| 2743 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 3, more := false, e := true)) |
| 2744 | }, |
| 2745 | tlli := ms.tlli); |
| 2746 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2747 | f_ms_tx_ul_block(ms, ul_data); |
| 2748 | |
| 2749 | /* UL block dataB and dataD should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2750 | 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] | 2751 | |
| 2752 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2753 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2754 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 2755 | |
| 2756 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2757 | } |
| 2758 | |
Pau Espin Pedrol | 90fdfed | 2021-03-02 17:29:32 +0100 | [diff] [blame] | 2759 | /* Validate an Imm Assignment is retransmitted if first RRBP requesting DL |
| 2760 | * ACK/NACK is not answered */ |
| 2761 | testcase TC_dl_no_ack_retrans_imm_ass() runs on RAW_PCU_Test_CT { |
| 2762 | var RlcmacDlBlock dl_block; |
| 2763 | var octetstring data1 := f_rnd_octstring(200); |
| 2764 | var octetstring data2 := f_rnd_octstring(10); |
| 2765 | var uint32_t dl_fn; |
| 2766 | var GprsMS ms; |
| 2767 | var template (value) TsTrxBtsNum nr; |
| 2768 | var BTS_PDTCH_Block data_msg; |
| 2769 | |
| 2770 | /* Initialize NS/BSSGP side */ |
| 2771 | f_init_bssgp(); |
| 2772 | /* Initialize GPRS MS side */ |
| 2773 | f_init_gprs_ms(); |
| 2774 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2775 | |
| 2776 | /* Initialize the PCU interface abstraction */ |
| 2777 | f_init_raw(testcasename()) |
| 2778 | |
| 2779 | /* Establish BSSGP connection to the PCU */ |
| 2780 | f_bssgp_establish(); |
| 2781 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 2782 | |
| 2783 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 2784 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1)); |
| 2785 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 2786 | |
| 2787 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2788 | f_sleep(X2002); |
| 2789 | |
| 2790 | /* Recv DL data until receiving RRBP to DL ACK (because it's last queued DL data) */ |
| 2791 | while (true) { |
| 2792 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, ?, ?); |
| 2793 | |
| 2794 | /* Keep Ack/Nack description updated (except for last BSN) */ |
| 2795 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
| 2796 | |
| 2797 | if (f_dl_block_rrbp_valid(dl_block)) { |
| 2798 | /* Don't transmit DL ACK here on purpose ignore it */ |
| 2799 | break; |
| 2800 | } |
| 2801 | } |
| 2802 | |
| 2803 | /* PCU starts whole process again */ |
| 2804 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 2805 | |
| 2806 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2807 | f_sleep(X2002); |
| 2808 | |
| 2809 | /* Recv DL data until receiving RRBP to DL ACK (because it's last queued |
| 2810 | /* DL data), after that we receive only DUMMY blocks so we are done */ |
| 2811 | var boolean data_received := false; |
| 2812 | nr := ts_TsTrxBtsNum; |
| 2813 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 2814 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 2815 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 2816 | block_nr := nr.blk_nr)); |
| 2817 | alt { |
| 2818 | [data_received] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 2819 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 2820 | tr_RLCMAC_DUMMY_CTRL)) { /* done */ } |
| 2821 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 2822 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 2823 | tr_RLCMAC_DATA)) -> value data_msg { |
| 2824 | data_received := true; |
| 2825 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, data_msg.dl_block); |
| 2826 | if (data_msg.dl_block.data.mac_hdr.hdr_ext.fbi) { |
| 2827 | log("Received FINAL_ACK"); |
| 2828 | ms.dl_tbf.acknack_desc.final_ack := '1'B; |
| 2829 | } |
| 2830 | if (f_dl_block_rrbp_valid(data_msg.dl_block)) { |
| 2831 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 2832 | f_dl_block_ack_fn(dl_block, data_msg.raw.fn)); |
| 2833 | } |
| 2834 | nr := ts_TsTrxBtsNum; |
| 2835 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 2836 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 2837 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 2838 | block_nr := nr.blk_nr)); |
| 2839 | repeat; |
| 2840 | } |
| 2841 | [] BTS.receive { |
| 2842 | setverdict(fail, "Unexpected BTS message"); |
| 2843 | f_shutdown(__BFILE__, __LINE__); |
| 2844 | } |
| 2845 | } |
| 2846 | |
| 2847 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2848 | } |
| 2849 | |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 2850 | /* Verify allocation and use of multislot tbf, triggered by MS class provided in SGSN. SYS#5131 */ |
| 2851 | 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] | 2852 | 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] | 2853 | var octetstring data := f_rnd_octstring(10); |
| 2854 | var PacketDlAssign dl_tbf_ass; |
| 2855 | var RlcmacDlBlock dl_block; |
| 2856 | var uint32_t poll_fn; |
| 2857 | var uint32_t sched_fn; |
| 2858 | var GprsMS ms; |
| 2859 | timer T := 5.0; |
| 2860 | |
| 2861 | /* Initialize NS/BSSGP side */ |
| 2862 | f_init_bssgp(); |
| 2863 | /* Initialize GPRS MS side */ |
| 2864 | f_init_gprs_ms(); |
| 2865 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2866 | |
| 2867 | /* Only 1 TRX with 8 PDCH */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 2868 | f_PCUIF_PDCHMask_set(info_ind, '11111111'B, 0); |
| 2869 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 2870 | |
| 2871 | /* Initialize the PCU interface abstraction */ |
| 2872 | f_init_raw(testcasename(), info_ind); |
| 2873 | |
| 2874 | /* Establish BSSGP connection to the PCU */ |
| 2875 | f_bssgp_establish(); |
| 2876 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 2877 | |
| 2878 | /* Establish an Uplink TBF, this way the PCU can send DL Assignment |
| 2879 | through PDCH (no multiblock assignment possible through PCH) */ |
| 2880 | f_ms_establish_ul_tbf(ms); |
| 2881 | |
| 2882 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 2883 | contention resoultion) and make sure it is ACKED fine */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 2884 | f_ms_tx_ul_data_block(ms, data, with_tlli := true, fn := ms.ul_tbf.start_time_fn, |
| 2885 | nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 2886 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2887 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, poll_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2888 | |
| 2889 | /* SGSN sends some DL data, PCU will assign DL TBF through PACCH */ |
| 2890 | var MultislotCap_GPRS_BSSGP mscap_gprs := { |
| 2891 | gprsmultislotclass := '10010'B, /* MS class 18, supports 8 DL and 8 UL */ |
| 2892 | gprsextendeddynalloccap := '0'B |
| 2893 | }; |
| 2894 | var MSRadioAccessCapabilityV_BSSGP ms_racap := { valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, mscap_gprs, omit)) }; |
| 2895 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap)); |
| 2896 | dl_block := f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2897 | if (f_dltbf_num_slots(ms.dl_tbf) != 8) { |
| 2898 | setverdict(fail, "Expected 8 PDCH slots allocated but got ", f_dltbf_num_slots(ms.dl_tbf)); |
| 2899 | f_shutdown(__BFILE__, __LINE__); |
| 2900 | } |
| 2901 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2902 | |
| 2903 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2904 | } |
| 2905 | |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 2906 | 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] | 2907 | 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] | 2908 | var RlcmacDlBlock dl_block; |
| 2909 | var octetstring data := f_rnd_octstring(10); |
| 2910 | var PollFnCtx pollctx; |
| 2911 | var uint32_t sched_fn; |
| 2912 | var GprsMS ms; |
| 2913 | |
| 2914 | var MultislotCap_GPRS mscap_gprs := { |
| 2915 | gprsmultislotclass := '10010'B, /* MS class 18, supports 8 DL and 8 UL */ |
| 2916 | gprsextendeddynalloccap := '0'B |
| 2917 | }; |
| 2918 | var MSRadioAccessCapabilityV ms_racap := { valueof(ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs, omit)) }; |
| 2919 | |
| 2920 | |
| 2921 | /* Initialize NS/BSSGP side */ |
| 2922 | f_init_bssgp(); |
| 2923 | /* Initialize GPRS MS side */ |
| 2924 | f_init_gprs_ms(); |
| 2925 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2926 | |
| 2927 | /* Only 1 TRX with 8 PDCH */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 2928 | f_PCUIF_PDCHMask_set(info_ind, '11111111'B, 0); |
| 2929 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 2930 | |
| 2931 | /* Initialize the PCU interface abstraction */ |
| 2932 | f_init_raw(testcasename(), info_ind); |
| 2933 | |
| 2934 | /* Establish BSSGP connection to the PCU */ |
| 2935 | f_bssgp_establish(); |
| 2936 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 2937 | |
| 2938 | /* Send PACKET RESOURCE REQUEST to notify the MultiSlot Class */ |
| 2939 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap)); |
| 2940 | |
| 2941 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2942 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 2943 | |
| 2944 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 2945 | dl_block := f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2946 | if (f_dltbf_num_slots(ms.dl_tbf) != 8) { |
| 2947 | setverdict(fail, "Expected 8 PDCH slot allocated but got ", f_dltbf_num_slots(ms.dl_tbf)); |
| 2948 | f_shutdown(__BFILE__, __LINE__); |
| 2949 | } |
| 2950 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2951 | |
| 2952 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2953 | } |
| 2954 | |
Pau Espin Pedrol | a9f27fa | 2020-10-30 13:16:21 +0100 | [diff] [blame] | 2955 | testcase TC_ul_multislot_tbf_ms_class_from_2phase() runs on RAW_PCU_Test_CT { |
| 2956 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 2957 | var RlcmacDlBlock dl_block; |
| 2958 | var octetstring data := f_rnd_octstring(10); |
| 2959 | var PollFnCtx pollctx; |
| 2960 | var uint32_t sched_fn; |
| 2961 | var GprsMS ms; |
| 2962 | |
| 2963 | var MultislotCap_GPRS mscap_gprs := { |
| 2964 | gprsmultislotclass := '10010'B, /* MS class 18, supports 8 DL and 8 UL */ |
| 2965 | gprsextendeddynalloccap := '0'B |
| 2966 | }; |
| 2967 | var MSRadioAccessCapabilityV ms_racap := { valueof(ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs, omit)) }; |
| 2968 | |
| 2969 | |
| 2970 | /* Initialize NS/BSSGP side */ |
| 2971 | f_init_bssgp(); |
| 2972 | /* Initialize GPRS MS side */ |
| 2973 | f_init_gprs_ms(); |
| 2974 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2975 | |
| 2976 | /* Only 1 TRX with 8 PDCH */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 2977 | f_PCUIF_PDCHMask_set(info_ind, '11111111'B, 0); |
| 2978 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | a9f27fa | 2020-10-30 13:16:21 +0100 | [diff] [blame] | 2979 | |
| 2980 | /* Initialize the PCU interface abstraction */ |
| 2981 | f_init_raw(testcasename(), info_ind); |
| 2982 | |
| 2983 | /* Establish BSSGP connection to the PCU */ |
| 2984 | f_bssgp_establish(); |
| 2985 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 2986 | |
| 2987 | /* Send PACKET RESOURCE REQUEST to notify the MultiSlot Class */ |
| 2988 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap)); |
| 2989 | |
| 2990 | if (f_ultbf_num_slots(ms.ul_tbf) != 8) { |
| 2991 | setverdict(fail, "Expected 8 PDCH slot allocated but got ", f_ultbf_num_slots(ms.ul_tbf)); |
| 2992 | f_shutdown(__BFILE__, __LINE__); |
| 2993 | } |
| 2994 | |
| 2995 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2996 | } |
| 2997 | |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 2998 | /* Test scenario where MS wants to request a new TBF once the current one is |
| 2999 | * ending, by means of sending a Packet Resource Request on ul slot provided by |
| 3000 | * last Pkt Ul ACK's RRBP. |
| 3001 | * See 3GPP TS 44.060 sec 9.3.2.4.2 "Non-extended uplink TBF mode" */ |
| 3002 | 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] | 3003 | var RlcmacDlBlock dl_block; |
| 3004 | var octetstring data := f_rnd_octstring(10); |
| 3005 | var uint32_t sched_fn; |
| 3006 | var uint32_t dl_fn; |
| 3007 | var template RlcmacDlBlock acknack_tmpl; |
| 3008 | var GprsMS ms; |
| 3009 | |
| 3010 | /* Initialize NS/BSSGP side */ |
| 3011 | f_init_bssgp(); |
| 3012 | /* Initialize GPRS MS side */ |
| 3013 | f_init_gprs_ms(); |
| 3014 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3015 | |
| 3016 | /* Initialize the PCU interface abstraction */ |
| 3017 | f_init_raw(testcasename()); |
| 3018 | |
| 3019 | /* Establish BSSGP connection to the PCU */ |
| 3020 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3021 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3022 | |
| 3023 | /* Establish an Uplink TBF */ |
| 3024 | f_ms_establish_ul_tbf(ms); |
| 3025 | |
| 3026 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 3027 | contention resoultion) and make sure it is ACKED fine */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 3028 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3029 | |
| 3030 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3031 | 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] | 3032 | |
| 3033 | acknack_tmpl := tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, |
| 3034 | tr_UlAckNackGprs(ms.tlli, |
| 3035 | tr_AckNackDescription(final_ack := '1'B), |
| 3036 | tr_UlAckNackGprsAdditionsRel99(tbf_est := true))) |
| 3037 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn, acknack_tmpl); |
| 3038 | |
| 3039 | /* TODO: verify TBF_EST and FinalACK are both '1' above */ |
| 3040 | |
| 3041 | /* Send PACKET RESOURCE REQUEST to request a new UL TBF */ |
Vadim Yanitskiy | f3cb4dd | 2020-07-21 01:52:33 +0700 | [diff] [blame] | 3042 | 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] | 3043 | 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] | 3044 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3045 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3046 | |
| 3047 | /* Send one UL block (without TLLI since we are in Second-Phase Access) |
| 3048 | and make sure it is ACKED fine */ |
| 3049 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := false); /* TODO: send using cs_mcs */ |
| 3050 | |
| 3051 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3052 | 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] | 3053 | |
| 3054 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn, acknack_tmpl); |
| 3055 | /* ACK the ACK */ |
| 3056 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3057 | |
| 3058 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3059 | } |
| 3060 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3061 | /* Test CS paging over the BTS<->PCU socket. |
| 3062 | * 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. |
| 3063 | * Paging should be send on the PACCH. |
| 3064 | * |
| 3065 | * 1. Send a Paging Request over PCU socket. |
| 3066 | * 2. Send a Ready-To-Send message over PCU socket |
| 3067 | * 3. Expect a Paging Frame |
| 3068 | */ |
| 3069 | 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] | 3070 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3071 | var MobileIdentityLV mi; |
| 3072 | var octetstring mi_enc_lv; |
| 3073 | var hexstring imsi := f_gen_imsi(42); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3074 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3075 | |
| 3076 | /* Initialize NS/BSSGP side */ |
| 3077 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3078 | /* Initialize GPRS MS side */ |
| 3079 | f_init_gprs_ms(); |
| 3080 | 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] | 3081 | |
| 3082 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3083 | 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] | 3084 | |
| 3085 | /* Establish BSSGP connection to the PCU */ |
| 3086 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3087 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3088 | |
| 3089 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3090 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3091 | |
| 3092 | /* build mobile Identity */ |
| 3093 | mi := valueof(ts_MI_IMSI_LV(imsi)); |
| 3094 | mi_enc_lv := enc_MobileIdentityLV(mi); |
| 3095 | /* Send paging request */ |
| 3096 | BTS.send(ts_PCUIF_PAG_REQ(bts_nr := 0, id_lv := mi_enc_lv, chan_needed := 0, |
| 3097 | sapi :=PCU_IF_SAPI_PDTCH)); |
| 3098 | |
| 3099 | /* Receive it on BTS side towards MS */ |
| 3100 | f_rx_rlcmac_dl_block_exp_pkt_pag_req(dl_block); |
| 3101 | |
| 3102 | /* Make sure that Packet Paging Request contains the same IMSI */ |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3103 | var PacketPagingReq req := dl_block.ctrl.payload.u.paging; |
| 3104 | if (not f_pkt_paging_match_imsi(req, imsi, ps_domain := false)) { |
| 3105 | setverdict(fail, "Failed to match IMSI ", imsi, " in ", req); |
| 3106 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3107 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3108 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3109 | } |
| 3110 | |
| 3111 | /* Test CS paging over Gb (SGSN->PCU->BTS[PDCH]). |
| 3112 | */ |
| 3113 | private function f_tc_paging_cs_from_sgsn(Nsvci bvci, boolean use_ptmsi := false) |
| 3114 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3115 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3116 | var hexstring imsi := f_gen_imsi(42); |
| 3117 | var GsmTmsi tmsi; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3118 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3119 | |
| 3120 | /* Initialize NS/BSSGP side */ |
| 3121 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3122 | /* Initialize GPRS MS side */ |
| 3123 | f_init_gprs_ms(); |
| 3124 | 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] | 3125 | |
| 3126 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3127 | 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] | 3128 | |
| 3129 | /* Establish BSSGP connection to the PCU */ |
| 3130 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3131 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3132 | |
| 3133 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3134 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3135 | |
| 3136 | /* Send paging request with or without TMSI */ |
| 3137 | if (use_ptmsi) { |
| 3138 | tmsi := oct2int(f_rnd_octstring(4)); /* Random P-TMSI */ |
| 3139 | BSSGP[0].send(ts_BSSGP_CS_PAGING_PTMSI(bvci, imsi, tmsi)); |
| 3140 | } else { |
| 3141 | BSSGP[0].send(ts_BSSGP_CS_PAGING_IMSI(bvci, imsi)); |
| 3142 | } |
| 3143 | |
| 3144 | /* Receive it on BTS side towards MS */ |
| 3145 | f_rx_rlcmac_dl_block_exp_pkt_pag_req(dl_block); |
| 3146 | |
| 3147 | /* Make sure that Packet Paging Request contains the same P-TMSI/IMSI */ |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3148 | var PacketPagingReq req := dl_block.ctrl.payload.u.paging; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3149 | if (use_ptmsi) { |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3150 | if (not f_pkt_paging_match_tmsi(req, tmsi, ps_domain := false)) { |
| 3151 | setverdict(fail, "Failed to match P-TMSI ", tmsi, " in ", req); |
| 3152 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3153 | } else { |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3154 | if (not f_pkt_paging_match_imsi(req, imsi, ps_domain := false)) { |
| 3155 | setverdict(fail, "Failed to match IMSI ", imsi, " in ", req); |
| 3156 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3157 | } |
| 3158 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3159 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3160 | } |
| 3161 | |
| 3162 | testcase TC_paging_cs_from_sgsn_sign_ptmsi() runs on RAW_PCU_Test_CT { |
| 3163 | f_tc_paging_cs_from_sgsn(0, true); |
| 3164 | } |
| 3165 | |
| 3166 | testcase TC_paging_cs_from_sgsn_sign() runs on RAW_PCU_Test_CT { |
| 3167 | f_tc_paging_cs_from_sgsn(0); |
| 3168 | } |
| 3169 | |
| 3170 | 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] | 3171 | 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] | 3172 | } |
| 3173 | |
| 3174 | /* Test PS paging over Gb (SGSN->PCU->BTS[CCCH]). |
| 3175 | */ |
| 3176 | private function f_tc_paging_ps_from_sgsn(Nsvci bvci, boolean use_ptmsi := false) |
| 3177 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3178 | var integer imsi_suff_tx := 423; |
| 3179 | var hexstring imsi := f_gen_imsi(imsi_suff_tx); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3180 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3181 | |
| 3182 | /* Initialize NS/BSSGP side */ |
| 3183 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3184 | /* Initialize GPRS MS side */ |
| 3185 | f_init_gprs_ms(); |
| 3186 | 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] | 3187 | |
Oliver Smith | 61b4e73 | 2021-07-22 08:14:29 +0200 | [diff] [blame] | 3188 | f_statsd_reset(); |
| 3189 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3190 | /* Establish BSSGP connection to the PCU */ |
| 3191 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3192 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3193 | |
| 3194 | /* Send BSSGP PAGING-PS (with or without TMSI), wait for RR Paging Request Type 1. |
| 3195 | * Make sure that both paging group (IMSI suffix) and Mobile Identity match. */ |
| 3196 | if (use_ptmsi) { |
| 3197 | var OCT4 tmsi := f_rnd_octstring(4); /* Random P-TMSI */ |
| 3198 | BSSGP[0].send(ts_BSSGP_PS_PAGING_PTMSI(bvci, imsi, oct2int(tmsi))); |
| 3199 | f_pcuif_rx_pch_pag_req1(t_MI_TMSI(tmsi), imsi_suff_tx); |
| 3200 | } else { |
| 3201 | BSSGP[0].send(ts_BSSGP_PS_PAGING_IMSI(bvci, imsi)); |
| 3202 | f_pcuif_rx_pch_pag_req1(tr_MI_IMSI(imsi), imsi_suff_tx); |
| 3203 | } |
| 3204 | |
Oliver Smith | 61b4e73 | 2021-07-22 08:14:29 +0200 | [diff] [blame] | 3205 | if (mp_osmo_pcu_newer_than_0_9_0) { |
| 3206 | var StatsDExpects expect := { |
Oliver Smith | 36d95d8 | 2021-08-06 22:01:53 +0200 | [diff] [blame] | 3207 | { name := "TTCN3.pcu.sgsn.0.rx_paging_ps", mtype := "c", min := 1, max := 1 }, |
| 3208 | /* After the PCU receives the paging request from SGSN, |
| 3209 | * and it doesn't have any errors, PCU sends it to the |
| 3210 | * BTS to do paging over PCH. */ |
| 3211 | { name := "TTCN3.bts.0.pch.requests", mtype := "c", min := 1, max := 1 } |
Oliver Smith | 61b4e73 | 2021-07-22 08:14:29 +0200 | [diff] [blame] | 3212 | }; |
| 3213 | f_statsd_expect(expect); |
| 3214 | } |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3215 | } |
| 3216 | |
| 3217 | testcase TC_paging_ps_from_sgsn_sign_ptmsi() runs on RAW_PCU_Test_CT { |
| 3218 | /* Initialize the PCU interface abstraction */ |
| 3219 | f_init_raw(testcasename()); |
| 3220 | |
| 3221 | f_tc_paging_ps_from_sgsn(0, true); |
Oliver Smith | 61b4e73 | 2021-07-22 08:14:29 +0200 | [diff] [blame] | 3222 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3223 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3224 | } |
| 3225 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3226 | testcase TC_paging_ps_from_sgsn_sign() runs on RAW_PCU_Test_CT { |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3227 | /* Initialize the PCU interface abstraction */ |
| 3228 | f_init_raw(testcasename()); |
| 3229 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3230 | f_tc_paging_ps_from_sgsn(0); |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3231 | |
| 3232 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3233 | } |
| 3234 | |
| 3235 | testcase TC_paging_ps_from_sgsn_ptp() runs on RAW_PCU_Test_CT { |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3236 | /* Initialize the PCU interface abstraction */ |
| 3237 | f_init_raw(testcasename()); |
| 3238 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3239 | f_tc_paging_ps_from_sgsn(mp_gb_cfg.bvc[0].bvci); |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3240 | |
| 3241 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3242 | } |
| 3243 | |
Oliver Smith | e1a77c4 | 2021-07-28 13:36:09 +0200 | [diff] [blame] | 3244 | testcase TC_paging_pch_timeout() runs on RAW_PCU_Test_CT { |
| 3245 | /* Initialize the PCU interface abstraction */ |
| 3246 | f_init_raw(testcasename()); |
| 3247 | |
| 3248 | /* Set T3113 to 1s to shorten the test duration */ |
| 3249 | f_vty_config2(PCUVTY, {"pcu"}, "timer T3113 1"); |
| 3250 | |
| 3251 | /* Reset stats and send paging PS request */ |
| 3252 | f_tc_paging_ps_from_sgsn(mp_gb_cfg.bvc[0].bvci); |
| 3253 | |
| 3254 | /* Verify that counter increases when T3113 times out (MS did not start |
| 3255 | * TBF to respond to paging). */ |
| 3256 | f_sleep(1.2); |
| 3257 | var StatsDExpects expect := { |
| 3258 | { name := "TTCN3.bts.0.pch.requests.timeout", mtype := "c", min := 1, max := 1 } |
| 3259 | }; |
| 3260 | f_statsd_expect(expect); |
| 3261 | |
| 3262 | f_vty_config2(PCUVTY, {"pcu"}, "timer T3113 default"); |
| 3263 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3264 | } |
| 3265 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3266 | /* Verify osmo-pcu handles DL UNIT_DATA from SGSN with IMSI IE correctly. See OS#4729 */ |
| 3267 | testcase TC_bssgp_dl_unitdata_with_valid_imsi() runs on RAW_PCU_Test_CT { |
| 3268 | var RlcmacDlBlock dl_block; |
| 3269 | var octetstring data := f_rnd_octstring(10); |
| 3270 | var uint32_t sched_fn; |
| 3271 | var uint32_t dl_fn; |
| 3272 | var GprsMS ms; |
| 3273 | |
| 3274 | /* Initialize NS/BSSGP side */ |
| 3275 | f_init_bssgp(); |
| 3276 | /* Initialize GPRS MS side */ |
| 3277 | f_init_gprs_ms(); |
| 3278 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3279 | |
| 3280 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3281 | 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] | 3282 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 3283 | f_statsd_reset(); |
| 3284 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3285 | /* Establish BSSGP connection to the PCU */ |
| 3286 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3287 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3288 | |
| 3289 | /* Establish an Uplink TBF */ |
| 3290 | f_ms_establish_ul_tbf(ms); |
| 3291 | |
| 3292 | /* Fake GMM GPRS Attach or similar, PCU doesn't care about upper layers here */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 3293 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3294 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 3295 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3296 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3297 | |
| 3298 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3299 | 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] | 3300 | |
| 3301 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 3302 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi))); |
| 3303 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 3304 | |
| 3305 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 3306 | f_sleep(X2002); |
| 3307 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 3308 | |
| 3309 | /* ACK the DL block */ |
| 3310 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 3311 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 3312 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 3313 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 3314 | var StatsDExpects expect := { |
| 3315 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 1, max := 1}, |
| 3316 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 1, max := 1}, |
| 3317 | { name := "TTCN3.bts.0.tbf.dl.alloc", mtype := "c", min := 1, max := 1}, |
| 3318 | { 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] | 3319 | { 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] | 3320 | { 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] | 3321 | }; |
| 3322 | f_statsd_expect(expect); |
| 3323 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3324 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3325 | } |
| 3326 | |
| 3327 | /* Verify osmo-pcu acts on incorrect IMSI IE content in DL UNIT_DATA from SGSN. See OS#4729 */ |
| 3328 | testcase TC_bssgp_dl_unitdata_with_invalid_imsi() runs on RAW_PCU_Test_CT { |
| 3329 | var RlcmacDlBlock dl_block; |
| 3330 | var octetstring data := f_rnd_octstring(10); |
| 3331 | var uint32_t sched_fn; |
| 3332 | var uint32_t dl_fn; |
| 3333 | var GprsMS ms; |
| 3334 | |
| 3335 | /* Initialize NS/BSSGP side */ |
| 3336 | f_init_bssgp(); |
| 3337 | /* Initialize GPRS MS side */ |
| 3338 | f_init_gprs_ms(); |
| 3339 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3340 | |
| 3341 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3342 | 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] | 3343 | |
| 3344 | /* Establish BSSGP connection to the PCU */ |
| 3345 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3346 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3347 | |
| 3348 | /* Establish an Uplink TBF */ |
| 3349 | f_ms_establish_ul_tbf(ms); |
| 3350 | |
| 3351 | /* Fake GMM GPRS Attach or similar, PCU doesn't care about upper layers here */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 3352 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3353 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 3354 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3355 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3356 | |
| 3357 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3358 | 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] | 3359 | |
| 3360 | /* Now SGSN sends some DL data with an invalid IMSI */ |
| 3361 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI('1122'H))); |
| 3362 | |
Pau Espin Pedrol | f7e947a | 2021-01-25 18:51:33 +0100 | [diff] [blame] | 3363 | 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] | 3364 | |
| 3365 | /* TODO: make sure no data is sent over PCU -> MS */ |
| 3366 | |
| 3367 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3368 | } |
| 3369 | |
Pau Espin Pedrol | 2e459d6 | 2020-11-30 19:34:16 +0100 | [diff] [blame] | 3370 | private function f_tc_dl_data_no_llc_ui_dummy(template (omit) MSRadioAccessCapabilityV_BSSGP ms_racap := omit) runs on RAW_PCU_Test_CT { |
| 3371 | var AckNackDescription ack_nack_desc := valueof(t_AckNackDescription_init); |
| 3372 | var octetstring data := f_rnd_octstring(6); |
| 3373 | var RlcmacDlBlock dl_block; |
| 3374 | var GprsMS ms; |
| 3375 | var uint32_t fn; |
| 3376 | |
| 3377 | /* Initialize NS/BSSGP side */ |
| 3378 | f_init_bssgp(); |
| 3379 | /* Initialize GPRS MS side */ |
| 3380 | f_init_gprs_ms(); |
| 3381 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3382 | |
| 3383 | /* Initialize the PCU interface abstraction */ |
| 3384 | f_init_raw(testcasename()); |
| 3385 | |
| 3386 | /* Establish BSSGP connection to the PCU */ |
| 3387 | f_bssgp_establish(); |
| 3388 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3389 | |
| 3390 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 3391 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap)); |
| 3392 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 3393 | |
| 3394 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 3395 | f_sleep(X2002); |
| 3396 | |
| 3397 | /* Expect the first (GPRS DL) block with bsn=0 and rrbp_valid=1 */ |
| 3398 | f_rx_rlcmac_dl_block_exp_data(dl_block, fn, data, 0); |
| 3399 | |
| 3400 | if (ischosen(dl_block.data_egprs)) { |
| 3401 | if (lengthof(dl_block.data_egprs.blocks) != 2) { |
| 3402 | setverdict(fail, "DL EGPRS block has unexpected number of LLC frames: ", dl_block.data_egprs); |
| 3403 | f_shutdown(__BFILE__, __LINE__); |
| 3404 | } |
| 3405 | if (dl_block.data_egprs.blocks[1].hdr.length_ind != 127) { |
| 3406 | setverdict(fail, "DL EGPRS block 2nd llc frame is not padding!: ", dl_block.data_egprs); |
| 3407 | f_shutdown(__BFILE__, __LINE__); |
| 3408 | } |
| 3409 | if (not match(dl_block.data_egprs.blocks[1].payload, |
| 3410 | f_pad_oct(''O, lengthof(dl_block.data_egprs.blocks[1].payload), '2B'O))) { |
| 3411 | setverdict(fail, "DL EGPRS block 2nd llc frame is not padding!: ", dl_block.data_egprs); |
| 3412 | f_shutdown(__BFILE__, __LINE__); |
| 3413 | } |
| 3414 | } else if (lengthof(dl_block.data.blocks) > 1) { |
| 3415 | setverdict(fail, "DL GPRS block has extra unexpected LLC frames: ", dl_block.data); |
| 3416 | f_shutdown(__BFILE__, __LINE__); |
| 3417 | } |
| 3418 | |
| 3419 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3420 | } |
| 3421 | |
| 3422 | /* Verify osmo-pcu Doesn't append LLC UI dummy frames to rlcmac blocks |
| 3423 | * containing llc data. See OS#4849 */ |
| 3424 | testcase TC_dl_gprs_data_no_llc_ui_dummy() runs on RAW_PCU_Test_CT { |
| 3425 | f_tc_dl_data_no_llc_ui_dummy(omit); |
| 3426 | } |
| 3427 | |
| 3428 | /* Verify osmo-pcu Doesn't append LLC UI dummy frames to rlcmac blocks |
| 3429 | * containing llc data. See OS#4849 */ |
| 3430 | 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] | 3431 | 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] | 3432 | } |
| 3433 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3434 | private function f_TC_egprs_pkt_chan_req(in EGPRSPktChRequest req, |
Vadim Yanitskiy | 4389390 | 2020-05-29 15:21:50 +0700 | [diff] [blame] | 3435 | template GsmRrMessage t_imm_ass := ?, |
| 3436 | PCUIF_BurstType bt := BURST_TYPE_1) |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3437 | runs on RAW_PCU_Test_CT { |
Vadim Yanitskiy | 4389390 | 2020-05-29 15:21:50 +0700 | [diff] [blame] | 3438 | var GsmRrMessage rr_msg; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3439 | var uint16_t ra11; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3440 | |
| 3441 | ra11 := enc_EGPRSPktChRequest2uint(req); |
| 3442 | log("Sending EGPRS Packet Channel Request (", ra11, "): ", req); |
| 3443 | |
Vadim Yanitskiy | 28d18e1 | 2020-05-29 15:25:59 +0700 | [diff] [blame] | 3444 | 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] | 3445 | if (not match(rr_msg, t_imm_ass)) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3446 | setverdict(fail, "Immediate Assignment does not match"); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3447 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3448 | } |
| 3449 | |
| 3450 | setverdict(pass); |
| 3451 | } |
| 3452 | |
| 3453 | testcase TC_egprs_pkt_chan_req_signalling() runs on RAW_PCU_Test_CT { |
| 3454 | var template GsmRrMessage imm_ass; |
| 3455 | var template IaRestOctets rest; |
| 3456 | var template EgprsUlAss ul_ass; |
| 3457 | |
| 3458 | /* Initialize the PCU interface abstraction */ |
| 3459 | f_init_raw(testcasename()); |
| 3460 | |
| 3461 | var EGPRSPktChRequest req := { |
| 3462 | /* NOTE: other fields are set in the loop */ |
| 3463 | signalling := { tag := '110011'B } |
| 3464 | }; |
| 3465 | |
| 3466 | for (var integer i := 0; i < 6; i := i + 1) { |
| 3467 | var BIT5 ext_ra := int2bit(f_rnd_int(32), 5); |
| 3468 | req.signalling.random_bits := ext_ra; |
| 3469 | |
| 3470 | /* For signalling, do we expect Multiblock UL TBF Assignment? */ |
| 3471 | ul_ass := tr_EgprsUlAssMultiblock(ext_ra := ext_ra); |
| 3472 | rest := tr_IaRestOctets_EGPRSULAss(ul_ass); |
| 3473 | imm_ass := tr_IMM_TBF_ASS(dl := false, rest := rest); |
| 3474 | |
| 3475 | f_TC_egprs_pkt_chan_req(req, imm_ass); |
| 3476 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3477 | |
| 3478 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3479 | } |
| 3480 | |
| 3481 | testcase TC_egprs_pkt_chan_req_one_phase() runs on RAW_PCU_Test_CT { |
| 3482 | var template GsmRrMessage imm_ass; |
| 3483 | var template IaRestOctets rest; |
| 3484 | var template EgprsUlAss ul_ass; |
| 3485 | |
| 3486 | /* Initialize the PCU interface abstraction */ |
| 3487 | f_init_raw(testcasename()); |
| 3488 | |
| 3489 | var EGPRSPktChRequest req := { |
| 3490 | /* NOTE: other fields are set in the loop */ |
| 3491 | one_phase := { tag := '0'B } |
| 3492 | }; |
| 3493 | |
| 3494 | for (var integer i := 0; i < 6; i := i + 1) { |
| 3495 | var BIT5 ext_ra := int2bit(f_rnd_int(32), 5); |
| 3496 | var BIT5 mslot_class := int2bit(f_rnd_int(32), 5); |
| 3497 | var BIT2 priority := substr(ext_ra, 0, 2); |
| 3498 | var BIT3 rand := substr(ext_ra, 2, 3); |
| 3499 | |
| 3500 | req.one_phase.multislot_class := mslot_class; |
| 3501 | req.one_phase.priority := priority; |
| 3502 | req.one_phase.random_bits := rand; |
| 3503 | |
| 3504 | /* For one phase access, do we expect Dynamic UL TBF Assignment? */ |
| 3505 | ul_ass := tr_EgprsUlAssDynamic(ext_ra := ext_ra); |
| 3506 | rest := tr_IaRestOctets_EGPRSULAss(ul_ass); |
| 3507 | imm_ass := tr_IMM_TBF_ASS(dl := false, rest := rest); |
| 3508 | |
| 3509 | f_TC_egprs_pkt_chan_req(req, imm_ass); |
| 3510 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3511 | |
| 3512 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3513 | } |
| 3514 | |
| 3515 | testcase TC_egprs_pkt_chan_req_two_phase() runs on RAW_PCU_Test_CT { |
| 3516 | var template GsmRrMessage imm_ass; |
| 3517 | var template IaRestOctets rest; |
| 3518 | var template EgprsUlAss ul_ass; |
| 3519 | |
| 3520 | /* Initialize the PCU interface abstraction */ |
| 3521 | f_init_raw(testcasename()); |
| 3522 | |
| 3523 | var EGPRSPktChRequest req := { |
| 3524 | /* NOTE: other fields are set in the loop */ |
| 3525 | two_phase := { tag := '110000'B } |
| 3526 | }; |
| 3527 | |
| 3528 | for (var integer i := 0; i < 6; i := i + 1) { |
| 3529 | var BIT5 ext_ra := int2bit(f_rnd_int(32), 5); |
| 3530 | var BIT2 priority := substr(ext_ra, 0, 2); |
| 3531 | var BIT3 rand := substr(ext_ra, 2, 3); |
| 3532 | |
| 3533 | req.two_phase.priority := priority; |
| 3534 | req.two_phase.random_bits := rand; |
| 3535 | |
| 3536 | /* For two phase access, do we expect Multiblock UL TBF Assignment? */ |
| 3537 | ul_ass := tr_EgprsUlAssMultiblock(ext_ra := ext_ra); |
| 3538 | rest := tr_IaRestOctets_EGPRSULAss(ul_ass); |
| 3539 | imm_ass := tr_IMM_TBF_ASS(dl := false, rest := rest); |
| 3540 | |
| 3541 | f_TC_egprs_pkt_chan_req(req, imm_ass); |
| 3542 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3543 | |
| 3544 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3545 | } |
| 3546 | |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 3547 | private function f_TC_egprs_pkt_chan_req_reject(bitstring ra11, uint32_t fn, |
| 3548 | template IARRestOctets rest := ?, |
Pau Espin Pedrol | a5cee4c | 2021-04-26 13:50:29 +0200 | [diff] [blame] | 3549 | PCUIF_BurstType bt := BURST_TYPE_1, |
| 3550 | template WaitIndication wi := ?) |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 3551 | runs on RAW_PCU_Test_CT { |
| 3552 | var template ReqRefWaitInd tr_ref; |
| 3553 | var GsmRrMessage rr_msg; |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 3554 | |
| 3555 | /* Send RACH.ind with malformed EGPRS Packet Channel Request */ |
| 3556 | BTS.send(ts_PCUIF_RACH_IND(bts_nr := 0, trx_nr := 0, ts_nr := 0, |
| 3557 | ra := bit2int(ra11), is_11bit := 1, |
| 3558 | burst_type := bt, fn := fn, |
| 3559 | arfcn := 871)); |
| 3560 | |
| 3561 | /* Abuse f_pcuif_rx_imm_ass(): wait for Immediate Assignment Reject */ |
Vadim Yanitskiy | 7466c33 | 2020-05-28 20:41:19 +0700 | [diff] [blame] | 3562 | 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] | 3563 | |
| 3564 | /* Just to have a short-name reference to the actual message */ |
| 3565 | var ImmediateAssignmentReject iar := rr_msg.payload.imm_ass_rej; |
| 3566 | |
| 3567 | /* Make sure that Request Reference list contains at least one entry |
| 3568 | * with our TDMA frame number, and RA is set to 'reserved' value 127. */ |
Pau Espin Pedrol | a5cee4c | 2021-04-26 13:50:29 +0200 | [diff] [blame] | 3569 | tr_ref := tr_ReqRefWaitInd(f_compute_ReqRef(127, fn), wi); |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 3570 | if (not match(iar.payload, { *, tr_ref, * })) { |
| 3571 | setverdict(fail, "Request Reference list does not match"); |
| 3572 | f_shutdown(__BFILE__, __LINE__); |
| 3573 | } |
| 3574 | |
| 3575 | /* Match Feature Indicator (must indicate PS domain) */ |
| 3576 | if (not match(iar.feature_ind, FeatureIndicator:{?, false, true})) { |
| 3577 | setverdict(fail, "Feature Indicator does not match"); |
| 3578 | f_shutdown(__BFILE__, __LINE__); |
| 3579 | } |
| 3580 | |
| 3581 | /* Match IAR Rest Octets */ |
| 3582 | if (not match(iar.rest_octets, rest)) { |
| 3583 | setverdict(fail, "IAR Rest Octets does not match: ", |
| 3584 | iar.rest_octets, " vs expected ", rest); |
| 3585 | f_shutdown(__BFILE__, __LINE__); |
| 3586 | } |
| 3587 | |
| 3588 | setverdict(pass); |
| 3589 | } |
| 3590 | |
| 3591 | /* Verify the contents of RR Immediate Assignment Reject message and its |
| 3592 | * Rest Octets sent in response to EGPRS Packet Channel Request (11 bit). */ |
| 3593 | testcase TC_egprs_pkt_chan_req_reject_content() runs on RAW_PCU_Test_CT { |
| 3594 | var template IARRestOctets rest; |
| 3595 | var BIT5 ext_ra; |
| 3596 | |
| 3597 | /* Initialize the PCU interface abstraction */ |
| 3598 | f_init_raw(testcasename()); |
| 3599 | |
| 3600 | for (var integer i := 0; i < 6; i := i + 1) { |
| 3601 | ext_ra := int2bit(f_rnd_int(32), 5); /* 5 LSB's of RA11 */ |
| 3602 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(ext_ra), * }); |
| 3603 | |
| 3604 | /* Intentionally incorrect message (see table 11.2.5a.2) */ |
| 3605 | f_TC_egprs_pkt_chan_req_reject('111111'B & ext_ra, 1337 + i, rest); |
| 3606 | } |
| 3607 | |
| 3608 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3609 | } |
| 3610 | |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 3611 | /* At the moment, the IUT does not support any emergency services. Make sure |
| 3612 | * that EGPRS Packet Channel Request for an emergency call is properly rejected. */ |
| 3613 | testcase TC_egprs_pkt_chan_req_reject_emergency() runs on RAW_PCU_Test_CT { |
| 3614 | var template IARRestOctets rest; |
| 3615 | var BIT5 ext_ra; |
| 3616 | var BIT11 ra11; |
| 3617 | |
| 3618 | /* Initialize the PCU interface abstraction */ |
| 3619 | f_init_raw(testcasename()); |
| 3620 | |
| 3621 | var EGPRSPktChRequest req := { |
| 3622 | /* NOTE: other fields are set in the loop */ |
| 3623 | emergency := { tag := '110111'B } |
| 3624 | }; |
| 3625 | |
| 3626 | for (var integer i := 0; i < 6; i := i + 1) { |
| 3627 | ext_ra := int2bit(f_rnd_int(32), 5); /* 5 LSB's of RA11 */ |
| 3628 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(ext_ra), * }); |
| 3629 | |
| 3630 | req.emergency.random_bits := ext_ra; |
| 3631 | ra11 := enc_EGPRSPktChRequest2bits(req); |
| 3632 | |
| 3633 | /* Intentionally incorrect message (see table 11.2.5a.2) */ |
| 3634 | f_TC_egprs_pkt_chan_req_reject(ra11, 1337 + i, rest); |
| 3635 | } |
| 3636 | |
| 3637 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3638 | } |
| 3639 | |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 3640 | /* Make sure that IUT responds with RR Immediate Assignment Reject due to exhaustion. */ |
| 3641 | 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] | 3642 | var PCUIF_info_ind info_ind; |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 3643 | var template IARRestOctets rest; |
| 3644 | var BIT11 ra11; |
| 3645 | |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 3646 | info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | a5cee4c | 2021-04-26 13:50:29 +0200 | [diff] [blame] | 3647 | info_ind.t3142 := 3; |
Vadim Yanitskiy | d5321fb | 2020-10-31 20:23:47 +0700 | [diff] [blame] | 3648 | |
| 3649 | /* Only the first TRX is enabled. */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3650 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 3651 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 3652 | |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 3653 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 3654 | f_init_raw(testcasename(), info_ind); |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 3655 | |
| 3656 | var EGPRSPktChRequest req := { |
| 3657 | one_phase := { |
| 3658 | tag := '0'B, |
| 3659 | multislot_class := '10101'B, |
| 3660 | priority := '01'B, |
| 3661 | random_bits := '101'B |
| 3662 | } |
| 3663 | }; |
| 3664 | |
| 3665 | /* We send 7 requests, the IUT gives us all available USFs (0..6). |
| 3666 | * TODO: make it configurable: usf_max := mp_pdch_ts_num * 7. */ |
| 3667 | for (var integer i := 0; i < 7; i := i + 1) { |
| 3668 | req.one_phase.random_bits := int2bit(f_rnd_int(8), 3); |
| 3669 | f_TC_egprs_pkt_chan_req(req, tr_IMM_TBF_ASS); |
| 3670 | } |
| 3671 | |
| 3672 | ra11 := enc_EGPRSPktChRequest2bits(req); |
| 3673 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(substr(ra11, 6, 5)), * }); |
| 3674 | |
| 3675 | /* At this point, the IUT should run out of free USFs */ |
Pau Espin Pedrol | a5cee4c | 2021-04-26 13:50:29 +0200 | [diff] [blame] | 3676 | f_TC_egprs_pkt_chan_req_reject(ra11, 1870, rest, wi := info_ind.t3142); |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 3677 | |
| 3678 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3679 | } |
| 3680 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3681 | /* Randomly generate a set of hopping parameters for one timeslot */ |
Vadim Yanitskiy | 7a04cdd | 2020-09-07 11:43:32 +0700 | [diff] [blame] | 3682 | private function f_TC_pcuif_fh_params_gen(integer max_ma_len) |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3683 | return template (value) PCUIF_InfoTrxTs { |
Vadim Yanitskiy | 7a04cdd | 2020-09-07 11:43:32 +0700 | [diff] [blame] | 3684 | /* Pick a random MA length in range 2 .. max_ma_len */ |
| 3685 | var integer ma_len := 2 + f_rnd_int(max_ma_len - 2); |
| 3686 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3687 | return ts_PCUIF_InfoTrxTsH1(tsc := f_rnd_int(7), |
| 3688 | hsn := f_rnd_int(63), |
| 3689 | maio := f_rnd_int(63), |
| 3690 | ma := f_rnd_bitstring(ma_len)); |
| 3691 | } |
| 3692 | |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3693 | private function f_TC_pcuif_fh_check_imm_ass(in PCUIF_info_ind info_ind, |
| 3694 | in GsmRrMessage rr_msg) |
| 3695 | { |
| 3696 | var ImmediateAssignment ia := rr_msg.payload.imm_ass; |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3697 | var PCUIF_InfoTrxTs ts := info_ind.trx[0].ts[ia.pkt_chan_desc.tn]; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3698 | |
| 3699 | var template PacketChannelDescription tr_pkt_chan_desc := { |
| 3700 | channel_Type_spare := ?, |
| 3701 | tn := ?, |
| 3702 | tsc := ts.tsc, |
| 3703 | presence := '1'B, |
| 3704 | zero := omit, |
| 3705 | one := { |
| 3706 | maio := ts.maio, |
| 3707 | hsn := ts.hsn |
| 3708 | } |
| 3709 | }; |
| 3710 | |
| 3711 | if (not match(ia.pkt_chan_desc, tr_pkt_chan_desc)) { |
| 3712 | setverdict(fail, "Packet Channel Description does not match: ", |
| 3713 | ia.pkt_chan_desc, " vs ", tr_pkt_chan_desc); |
| 3714 | } |
| 3715 | |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 3716 | /* Mobile Allocation is expected to be octet-aligned */ |
| 3717 | var uint8_t ma_oct_len := (ts.ma_bit_len + 8 - 1) / 8; |
| 3718 | var template MobileAllocationLV tr_ma := { |
| 3719 | len := ma_oct_len, /* in bytes */ |
| 3720 | ma := substr(ts.ma, 0, ma_oct_len * 8) |
| 3721 | }; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3722 | |
| 3723 | if (not match(ia.mobile_allocation, tr_ma)) { |
| 3724 | setverdict(fail, "Mobile Allocation does not match: ", |
| 3725 | ia.mobile_allocation, " vs ", tr_ma); |
| 3726 | } |
| 3727 | |
| 3728 | setverdict(pass); |
| 3729 | } |
| 3730 | |
| 3731 | /* Make sure that Immediate (UL EGPRS TBF) Assignment contains hopping parameters */ |
| 3732 | testcase TC_pcuif_fh_imm_ass_ul_egprs() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 3733 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3734 | var GprsMS ms := valueof(t_GprsMS_def); |
| 3735 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3736 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3737 | info_ind.trx[0].ts[7] := f_TC_pcuif_fh_params_gen(32); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3738 | |
| 3739 | /* Initialize the PCU interface abstraction */ |
| 3740 | f_init_raw(testcasename(), info_ind); |
| 3741 | |
| 3742 | /* EGPRS Packet Channel Request (cause=Signalling) */ |
| 3743 | f_ms_use_ra(ms, bit2int('11001101010'B), ra_is_11bit := 1); |
| 3744 | |
| 3745 | /* Establish an Uplink EGPRS TBF */ |
| 3746 | f_ms_establish_ul_tbf(ms); |
| 3747 | |
| 3748 | f_TC_pcuif_fh_check_imm_ass(valueof(info_ind), ms.ul_tbf.rr_imm_ass); |
| 3749 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3750 | } |
| 3751 | |
| 3752 | /* Make sure that Immediate (UL TBF) Assignment contains hopping parameters */ |
| 3753 | testcase TC_pcuif_fh_imm_ass_ul() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 3754 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3755 | var GprsMS ms := valueof(t_GprsMS_def); |
| 3756 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3757 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3758 | info_ind.trx[0].ts[7] := f_TC_pcuif_fh_params_gen(32); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3759 | |
| 3760 | /* Initialize the PCU interface abstraction */ |
| 3761 | f_init_raw(testcasename(), info_ind); |
| 3762 | |
| 3763 | /* Establish an Uplink TBF */ |
| 3764 | f_ms_establish_ul_tbf(ms); |
| 3765 | |
| 3766 | f_TC_pcuif_fh_check_imm_ass(valueof(info_ind), ms.ul_tbf.rr_imm_ass); |
| 3767 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3768 | } |
| 3769 | |
| 3770 | /* Make sure that Immediate (DL TBF) Assignment contains hopping parameters */ |
| 3771 | testcase TC_pcuif_fh_imm_ass_dl() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 3772 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3773 | var GprsMS ms := valueof(t_GprsMS_def); |
| 3774 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3775 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3776 | info_ind.trx[0].ts[7] := f_TC_pcuif_fh_params_gen(16); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3777 | |
| 3778 | /* Initialize NS/BSSGP side */ |
| 3779 | f_init_bssgp(); |
| 3780 | |
| 3781 | /* Initialize the PCU interface abstraction */ |
| 3782 | f_init_raw(testcasename(), info_ind); |
| 3783 | |
| 3784 | /* Establish BSSGP connection to the PCU */ |
| 3785 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3786 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3787 | |
| 3788 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 3789 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, f_rnd_octstring(12))); |
| 3790 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 3791 | |
| 3792 | f_TC_pcuif_fh_check_imm_ass(valueof(info_ind), ms.dl_tbf.rr_imm_ass); |
| 3793 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3794 | } |
| 3795 | |
| 3796 | private function f_TC_pcuif_fh_check_pkt_ass(in PCUIF_info_ind info_ind, |
| 3797 | in FrequencyParameters fp) |
| 3798 | { |
| 3799 | /* FIXME: TRX0/TS7 is a hard-coded expectation, make it configurable */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3800 | var PCUIF_InfoTrxTs ts := info_ind.trx[0].ts[7]; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3801 | |
| 3802 | /* Table 12.8.1: Frequency Parameters information elements */ |
| 3803 | var template FrequencyParameters tr_fp := { |
| 3804 | tsc := ts.tsc, |
| 3805 | presence := '10'B, /* Direct encoding 1 */ |
| 3806 | arfcn := omit, |
| 3807 | indirect := omit, |
| 3808 | direct1 := { |
| 3809 | maio := ts.maio, |
| 3810 | /* Table 12.10a.1: GPRS Mobile Allocation information elements */ |
| 3811 | mobile_allocation := { |
| 3812 | hsn := ts.hsn, |
| 3813 | rfl_number_list_present := '0'B, |
| 3814 | rfl_number_list := omit, |
| 3815 | ma_present := '0'B, /* inverted logic */ |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 3816 | ma_length := ts.ma_bit_len, |
| 3817 | ma_bitmap := substr(ts.ma, 0, ts.ma_bit_len) |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3818 | } |
| 3819 | }, |
| 3820 | direct2 := omit |
| 3821 | }; |
| 3822 | |
| 3823 | if (not match(fp, tr_fp)) { |
| 3824 | setverdict(fail, "Frequency Parameters IE does not match: ", |
| 3825 | fp, " vs ", tr_fp); |
| 3826 | } |
| 3827 | |
| 3828 | setverdict(pass); |
| 3829 | } |
| 3830 | |
| 3831 | /* Make sure that Packet Uplink Assignment contains hopping parameters */ |
| 3832 | testcase TC_pcuif_fh_pkt_ass_ul() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 3833 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3834 | var GprsMS ms := valueof(t_GprsMS_def); |
| 3835 | var uint32_t poll_fn; |
| 3836 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3837 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3838 | info_ind.trx[0].ts[7] := f_TC_pcuif_fh_params_gen(33); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3839 | |
| 3840 | /* Initialize the PCU interface abstraction */ |
| 3841 | f_init_raw(testcasename(), info_ind); |
| 3842 | |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 3843 | /* Single block (two phase) packet access */ |
| 3844 | var uint16_t ra := bit2int(chan_req_sb); |
| 3845 | f_ms_use_ra(ms, ra, ra_is_11bit := 0); |
| 3846 | |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3847 | /* Establish an Uplink TBF */ |
| 3848 | f_ms_establish_ul_tbf(ms); |
| 3849 | |
| 3850 | /* Send Packet Resource Request, so the network will allocate an Uplink resource */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 3851 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, omit)), |
| 3852 | fn := ms.ul_tbf.start_time_fn); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3853 | |
| 3854 | /* 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] | 3855 | f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_UL_PACKET_ASS); |
| 3856 | var PacketUlAssignment ua := ms.ul_tbf.ass.pacch; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3857 | |
| 3858 | /* 3GPP TS 44.060, section 12.8 "Frequency Parameters" */ |
| 3859 | var template (omit) FrequencyParameters fp; |
| 3860 | if (ua.is_egprs == '1'B) { |
| 3861 | fp := ua.egprs.freq_par; |
| 3862 | } else { |
| 3863 | fp := ua.gprs.freq_par; |
| 3864 | } |
| 3865 | |
| 3866 | /* This is an optional IE, so it's worth to check its presence */ |
| 3867 | if (istemplatekind(fp, "omit")) { |
| 3868 | setverdict(fail, "Frequency Parameters IE is not present"); |
| 3869 | f_shutdown(__BFILE__, __LINE__); |
| 3870 | } |
| 3871 | |
| 3872 | f_TC_pcuif_fh_check_pkt_ass(valueof(info_ind), valueof(fp)); |
| 3873 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3874 | } |
| 3875 | |
| 3876 | /* Make sure that Packet Downlink Assignment contains hopping parameters */ |
| 3877 | testcase TC_pcuif_fh_pkt_ass_dl() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 3878 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3879 | var octetstring data := f_rnd_octstring(10); |
| 3880 | var GprsMS ms := valueof(t_GprsMS_def); |
| 3881 | var RlcmacDlBlock dl_block; |
| 3882 | var uint32_t poll_fn; |
| 3883 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3884 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3885 | info_ind.trx[0].ts[7] := f_TC_pcuif_fh_params_gen(33); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3886 | |
| 3887 | /* Initialize NS/BSSGP side */ |
| 3888 | f_init_bssgp(); |
| 3889 | |
| 3890 | /* Initialize the PCU interface abstraction */ |
| 3891 | f_init_raw(testcasename(), info_ind); |
| 3892 | |
| 3893 | /* Establish BSSGP connection to the PCU */ |
| 3894 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3895 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3896 | |
| 3897 | /* Establish an Uplink TBF */ |
| 3898 | f_ms_establish_ul_tbf(ms); |
| 3899 | |
| 3900 | /* Send an Uplink block, so this TBF becomes "active" */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 3901 | f_ms_tx_ul_data_block(ms, data, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3902 | |
| 3903 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3904 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, poll_fn); |
| 3905 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), poll_fn); |
| 3906 | |
| 3907 | /* SGSN sends some DL data, PCU will assign Downlink resource on PACCH */ |
| 3908 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 3909 | |
| 3910 | /* 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] | 3911 | f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 3912 | var PacketDlAssignment da := ms.dl_tbf.ass.pacch; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3913 | |
| 3914 | /* This is an optional IE, so it's worth to check its presence */ |
| 3915 | if (not ispresent(da.freq_par)) { |
| 3916 | setverdict(fail, "Frequency Parameters IE is not present"); |
| 3917 | f_shutdown(__BFILE__, __LINE__); |
| 3918 | } |
| 3919 | |
| 3920 | f_TC_pcuif_fh_check_pkt_ass(valueof(info_ind), da.freq_par); |
| 3921 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3922 | } |
| 3923 | |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 3924 | /* Check if the IUT handles subsequent INFO.ind messages */ |
| 3925 | testcase TC_pcuif_info_ind_subsequent() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 3926 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default; |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 3927 | var BTS_PDTCH_Block data_msg; |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 3928 | |
| 3929 | /* Initialize the PCU interface abstraction */ |
| 3930 | f_init_raw(testcasename(), info_ind); |
| 3931 | |
| 3932 | /* Send 16 conseqtive INFO.ind messages and check that the IUT stays alive */ |
| 3933 | for (var integer i := 0; i < 16; i := i + 1) { |
| 3934 | BTS.send(ts_PCUIF_INFO_IND(0, info_ind)); |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 3935 | f_pcuif_rx_data_req_pdtch(data_msg); |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 3936 | } |
| 3937 | |
| 3938 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3939 | } |
| 3940 | |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 3941 | /* Verify allocation of several MS along PDCH ts of several TRX. See OS#1775, SYS#5030 */ |
| 3942 | testcase TC_multitrx_multims_alloc() runs on RAW_PCU_Test_CT { |
| 3943 | var PCUIF_info_ind info_ind; |
| 3944 | var integer i; |
| 3945 | const integer num_ms := 8; |
| 3946 | |
| 3947 | /* Initialize NS/BSSGP side */ |
| 3948 | f_init_bssgp(); |
| 3949 | /* Initialize GPRS MS side */ |
| 3950 | f_init_gprs_ms(num_ms); |
| 3951 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3952 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 3953 | /* Only the 3 first TRX are enabled. The enabled ones all have same |
| 3954 | amount of resources, hence same amount of initial resources. */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3955 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (3 .. 7)); |
| 3956 | f_PCUIF_PDCHMask_set(info_ind, '00000011'B, 0); |
| 3957 | f_PCUIF_PDCHMask_set(info_ind, '00001100'B, 1); |
| 3958 | f_PCUIF_PDCHMask_set(info_ind, '11000000'B, 2); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 3959 | |
| 3960 | /* Initialize the PCU interface abstraction */ |
| 3961 | f_init_raw(testcasename(), info_ind); |
| 3962 | |
| 3963 | /* Establish BSSGP connection to the PCU */ |
| 3964 | f_bssgp_establish(); |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 3965 | f_multi_ms_bssgp_register(); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 3966 | |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 3967 | /* Establish an Uplink TBF for each GprsMS instance */ |
| 3968 | f_multi_ms_establish_tbf(do_activate := false); |
| 3969 | |
| 3970 | /* 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] | 3971 | for (i := 0; i < num_ms; i := i + 1) { |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3972 | if (g_ms[i].ul_tbf.arfcn != info_ind.trx[i mod 3].arfcn) { |
Pau Espin Pedrol | b20b7e5 | 2020-10-28 21:28:45 +0100 | [diff] [blame] | 3973 | setverdict(fail, "Got assigned ARFCN ", g_ms[i].ul_tbf.arfcn, |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3974 | " vs exp ", info_ind.trx[i mod 3].arfcn); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 3975 | f_shutdown(__BFILE__, __LINE__); |
| 3976 | } |
| 3977 | } |
| 3978 | |
| 3979 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3980 | } |
| 3981 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 3982 | /* Verify concurrent PDCH use of EGPRS and GPRS (EGPRS dl rlcmac blk is |
| 3983 | * downgraded to CS1-4 so that GPRS can read the USF). |
| 3984 | * See 3GPP TS 44.060 5.2.4a "Multiplexing of GPRS, EGPRS and EGPRS2 capable mobile stations" |
| 3985 | */ |
| 3986 | testcase TC_multiplex_dl_gprs_egprs() runs on RAW_PCU_Test_CT { |
| 3987 | var PCUIF_info_ind info_ind; |
| 3988 | const integer num_ms := 2; /* 2 MS, first one is GPRS-only, second one is EGPRS */ |
| 3989 | var PollFnCtx pollctx; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 3990 | var uint32_t sched_fn, dl_fn, ack_fn; |
| 3991 | var octetstring data := f_rnd_octstring(10); |
| 3992 | var RlcmacDlBlock dl_block; |
| 3993 | var integer tx_data_remain := 5; |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 3994 | var integer tgt_ms, usf_ms; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 3995 | var integer ms_gprs_usf_count[num_ms] := { 0, 0 }; |
| 3996 | var integer ms_egprs_usf_count[num_ms] := { 0, 0 }; |
| 3997 | |
| 3998 | /* Initialize NS/BSSGP side */ |
| 3999 | f_init_bssgp(); |
| 4000 | /* Initialize GPRS MS side */ |
| 4001 | f_init_gprs_ms(num_ms); |
| 4002 | |
| 4003 | info_ind := valueof(ts_PCUIF_INFO_default); |
| 4004 | /* Only use 1 PDCH to make sure both end up in the same slot: */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4005 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
| 4006 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4007 | |
| 4008 | /* Initialize the PCU interface abstraction */ |
| 4009 | f_init_raw(testcasename(), info_ind); |
| 4010 | |
| 4011 | /* Set Initial MCS > 4 and maintain it non-variable to simplify test */ |
| 4012 | g_mcs_initial_dl := 5; |
| 4013 | g_mcs_max_dl := 5; |
| 4014 | f_pcuvty_set_allowed_cs_mcs(); |
| 4015 | |
| 4016 | /* Establish BSSGP connection to the PCU */ |
| 4017 | f_bssgp_establish(); |
| 4018 | f_multi_ms_bssgp_register(); |
| 4019 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4020 | /* Establish UL TBF for MS0 (GPRS-only) */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4021 | 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] | 4022 | if (not match(g_ms[0].ul_tbf.tx_cs_mcs, cs_gprs_any)) { |
| 4023 | setverdict(fail, "Wrong CS_MCS ", g_ms[0].ul_tbf.tx_cs_mcs, " received vs exp ", cs_gprs_any); |
| 4024 | f_shutdown(__BFILE__, __LINE__); |
| 4025 | } |
| 4026 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4027 | f_ms_tx_ul_block(g_ms[0], ts_RLCMAC_CTRL_ACK(g_ms[0].tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4028 | |
| 4029 | /* Establish UL TBF for MS1 (EGPRS) */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4030 | 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] | 4031 | if (not match(g_ms[1].ul_tbf.tx_cs_mcs, mcs_egprs_any)) { |
| 4032 | setverdict(fail, "Wrong CS_MCS ", g_ms[1].ul_tbf.tx_cs_mcs, " received vs exp ", mcs_egprs_any); |
| 4033 | f_shutdown(__BFILE__, __LINE__); |
| 4034 | } |
| 4035 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4036 | f_ms_tx_ul_block(g_ms[1], ts_RLCMAC_CTRL_ACK(g_ms[1].tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4037 | |
| 4038 | /* Now SGSN sends some DL data to MS0, PCU will assign a GPRS DL TBF on PACCH */ |
| 4039 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[0].tlli, data)); |
| 4040 | f_sleep(0.1); |
| 4041 | f_ms_rx_pkt_ass_pacch(g_ms[0], sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 4042 | /* DL Ass sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4043 | f_ms_tx_ul_block(g_ms[0], ts_RLCMAC_CTRL_ACK(g_ms[0].tlli), sched_fn); |
| 4044 | /* After acking the dl assignment, dl tbf goes into FLOW state and PCU will provide DL data when BTS asks for it */ |
| 4045 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0, cs_gprs_any); |
| 4046 | /* ACK the DL block */ |
| 4047 | f_dltbf_ack_block(g_ms[0].dl_tbf, dl_block, '0'B); |
| 4048 | f_ms_tx_ul_block(g_ms[0], f_dltbf_ts_RLCMAC_DL_ACK_NACK(g_ms[0].dl_tbf, false), |
| 4049 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 4050 | |
| 4051 | /* Now SGSN sends some DL data to MS1, PCU will assign a EGPRS DL TBF on PACCH */ |
| 4052 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[1].tlli, data)); |
| 4053 | f_sleep(0.1); |
| 4054 | f_ms_rx_pkt_ass_pacch(g_ms[1], sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 4055 | /* DL Ass sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4056 | f_ms_tx_ul_block(g_ms[1], ts_RLCMAC_CTRL_ACK(g_ms[1].tlli), sched_fn); |
| 4057 | /* After acking the dl assignment, dl tbf goes into FLOW state and PCU will provide DL data when BTS asks for it */ |
| 4058 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0, mcs_egprs_any); |
| 4059 | /* ACK the DL block */ |
| 4060 | f_dltbf_ack_block(g_ms[1].dl_tbf, dl_block, '0'B); |
| 4061 | f_ms_tx_ul_block(g_ms[1], f_dltbf_ts_RLCMAC_DL_ACK_NACK(g_ms[1].dl_tbf, true), |
| 4062 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 4063 | |
| 4064 | data := f_rnd_octstring(1400); |
| 4065 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[0].tlli, data)); |
| 4066 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[1].tlli, data)); |
| 4067 | |
| 4068 | for (var integer i := 0; i < 800; i := i + 1) { |
| 4069 | f_rx_rlcmac_dl_block(dl_block, dl_fn); |
| 4070 | |
| 4071 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL)) { |
| 4072 | /* No more data to receive, done */ |
| 4073 | break; |
| 4074 | } |
| 4075 | |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4076 | usf_ms := -1; |
| 4077 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4078 | if (ischosen(dl_block.ctrl)) { |
| 4079 | setverdict(fail, "Unexpected DL CTRL block ", dl_block); |
| 4080 | f_shutdown(__BFILE__, __LINE__); |
| 4081 | } else if (ischosen(dl_block.data_egprs)) { |
| 4082 | if (not match(dl_block.data_egprs.mac_hdr.tfi, g_ms[1].dl_tbf.tfi)) { |
| 4083 | setverdict(fail, "EGPRS DL DATA not matching EGPRS MS TFI (", g_ms[1].dl_tbf.tfi, "): ", dl_block.data_egprs.mac_hdr.tfi); |
| 4084 | f_shutdown(__BFILE__, __LINE__); |
| 4085 | } |
| 4086 | tgt_ms := 1; |
| 4087 | if (match(dl_block.data_egprs.mac_hdr.usf, g_ms[0].ul_tbf.usf[7])) { |
| 4088 | if (dl_block.data_egprs.mcs > MCS_4) { |
| 4089 | setverdict(fail, "Signalling USF ", dl_block.data_egprs.mac_hdr.usf, " for GPRS-only MS using MCS > 4: ", dl_block); |
| 4090 | f_shutdown(__BFILE__, __LINE__); |
| 4091 | } |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4092 | usf_ms := 0; |
| 4093 | ms_egprs_usf_count[usf_ms] := ms_egprs_usf_count[usf_ms] + 1; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4094 | } else { |
| 4095 | if (dl_block.data_egprs.mcs <= MCS_4) { |
| 4096 | setverdict(fail, "Using too-low MCS for EGPRS MS: ", dl_block.data_egprs.mcs); |
| 4097 | f_shutdown(__BFILE__, __LINE__); |
| 4098 | } |
| 4099 | if (match(dl_block.data_egprs.mac_hdr.usf, g_ms[1].ul_tbf.usf[7])) { |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4100 | usf_ms := 1; |
| 4101 | ms_egprs_usf_count[usf_ms] := ms_egprs_usf_count[usf_ms] + 1; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4102 | } |
| 4103 | } |
| 4104 | } else { |
| 4105 | if (not match(dl_block.data.mac_hdr.hdr_ext.tfi, g_ms[0].dl_tbf.tfi)) { |
| 4106 | setverdict(fail, "GPRS DL DATA not matching GPRS MS TFI (", g_ms[0].dl_tbf.tfi, "): ", dl_block.data.mac_hdr.hdr_ext.tfi); |
| 4107 | f_shutdown(__BFILE__, __LINE__); |
| 4108 | } |
| 4109 | tgt_ms := 0; |
| 4110 | if (match(dl_block.data.mac_hdr.mac_hdr.usf, g_ms[0].ul_tbf.usf[7])) { |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4111 | usf_ms := 0; |
| 4112 | ms_gprs_usf_count[usf_ms] := ms_gprs_usf_count[usf_ms] + 1; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4113 | } else if (match(dl_block.data.mac_hdr.mac_hdr.usf, g_ms[1].ul_tbf.usf[7])) { |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4114 | usf_ms := 1; |
| 4115 | ms_gprs_usf_count[usf_ms] := ms_gprs_usf_count[usf_ms] + 1; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4116 | } |
| 4117 | } |
| 4118 | |
| 4119 | /* Keep Ack/Nack description updated */ |
| 4120 | f_dltbf_ack_block(g_ms[tgt_ms].dl_tbf, dl_block); |
| 4121 | |
| 4122 | /* TDMA frame number on which we are supposed to send the ACK */ |
| 4123 | if (f_dl_block_rrbp_valid(dl_block)) { |
| 4124 | ack_fn := f_dl_block_ack_fn(dl_block, dl_fn); |
| 4125 | 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); |
| 4126 | if (tx_data_remain != 0) { |
| 4127 | /* Submit more data from time to time to keep the TBF ongoing */ |
| 4128 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[0].tlli, data)); |
| 4129 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[1].tlli, data)); |
| 4130 | tx_data_remain := tx_data_remain - 1; |
| 4131 | } |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4132 | } else if (tx_data_remain != 0) { |
| 4133 | /* keep sending UL blocks when requested by USF to avoid |
| 4134 | * UL TBF timeout and hence stop receival of USFs */ |
| 4135 | if (usf_ms != -1) { |
| 4136 | f_ms_tx_ul_data_block(g_ms[usf_ms], f_rnd_octstring(10), cv := 15); |
| 4137 | } |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4138 | } |
| 4139 | } |
| 4140 | |
| 4141 | log("results: ms_gprs_usf_count=", ms_gprs_usf_count, " / ms_egprs_usf_count=", ms_egprs_usf_count); |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4142 | /* He we check that DL blocks scheduled at GPRS can still request UL |
| 4143 | * blocks for EGPRS MS, and the other way around. Furthermore, the 2nd |
| 4144 | * condition also ensures the downgrade to <=MCS4 condition is tested |
| 4145 | * above */ |
| 4146 | if (ms_gprs_usf_count[1] == 0 or ms_egprs_usf_count[0] == 0) { |
| 4147 | setverdict(fail, "USF exchange thresholds not met!"); |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4148 | f_shutdown(__BFILE__, __LINE__); |
| 4149 | } |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4150 | /* Here check for some level of fairness between them (at least ~40%): */ |
| 4151 | var integer gprs_usf_cnt := ms_gprs_usf_count[0] + ms_egprs_usf_count[0]; |
| 4152 | var integer egprs_usf_cnt := ms_gprs_usf_count[1] + ms_egprs_usf_count[1]; |
| 4153 | var integer total_usf_cnt := gprs_usf_cnt + egprs_usf_cnt; |
| 4154 | if (gprs_usf_cnt < total_usf_cnt * 4 / 10) { |
| 4155 | setverdict(fail, "USF GPRS-only MS ", gprs_usf_cnt, " < ", total_usf_cnt * 4 / 10); |
| 4156 | f_shutdown(__BFILE__, __LINE__); |
| 4157 | } |
| 4158 | if (egprs_usf_cnt < total_usf_cnt * 4 / 10) { |
| 4159 | setverdict(fail, "USF EGPRS MS ", egprs_usf_cnt, " < ", total_usf_cnt * 4 / 10); |
| 4160 | f_shutdown(__BFILE__, __LINE__); |
| 4161 | } |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4162 | |
| 4163 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4164 | } |
| 4165 | |
| 4166 | |
Vadim Yanitskiy | dbd4b24 | 2020-10-31 05:44:58 +0700 | [diff] [blame] | 4167 | private function f_TC_paging_cs_multi_ms(template (value) TsTrxBtsNum nr, |
| 4168 | boolean exp_imsi, boolean exp_tmsi) |
| 4169 | runs on RAW_PCU_Test_CT { |
| 4170 | var bitstring mask := f_pad_bit(''B, lengthof(g_ms), '0'B); |
| 4171 | var integer pending := lengthof(g_ms); |
| 4172 | var RlcmacDlBlock dl_block; |
| 4173 | var boolean f1, f2; |
| 4174 | |
| 4175 | while (pending > 0) { |
| 4176 | var uint32_t poll_fn; |
| 4177 | |
| 4178 | /* Obtain a Downlink block and make sure it is a paging request */ |
| 4179 | f_rx_rlcmac_dl_block(dl_block, poll_fn, nr := nr); |
| 4180 | if (not match(dl_block, tr_RLCMAC_PACKET_PAG_REQ)) { |
| 4181 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4182 | break; |
| 4183 | } |
| 4184 | |
| 4185 | /* This should not happen in general, but who knows... */ |
| 4186 | var PacketPagingReq req := dl_block.ctrl.payload.u.paging; |
| 4187 | if (not ispresent(req.repeated_pageinfo)) { |
| 4188 | setverdict(fail, "Repeated Page Info IE is absent?!?"); |
| 4189 | break; |
| 4190 | } |
| 4191 | |
| 4192 | /* A single message may contain several MIs depending on their type */ |
| 4193 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 4194 | f1 := exp_imsi and f_pkt_paging_match_imsi(req, g_ms[i].imsi, |
| 4195 | ps_domain := false); |
| 4196 | f2 := exp_tmsi and f_pkt_paging_match_tmsi(req, oct2int(g_ms[i].tlli), |
| 4197 | ps_domain := false); |
| 4198 | if (not f1 and not f2) |
| 4199 | { continue; } |
| 4200 | |
| 4201 | /* Detect duplicate MIs */ |
| 4202 | if (mask[i] == '1'B) { |
| 4203 | setverdict(fail, "MS is paged twice: ", g_ms[i].imsi); |
| 4204 | continue; |
| 4205 | } |
| 4206 | |
| 4207 | mask[i] := '1'B; |
| 4208 | } |
| 4209 | |
| 4210 | pending := pending - lengthof(req.repeated_pageinfo); |
| 4211 | } |
| 4212 | |
| 4213 | for (var integer i := 0; i < lengthof(mask); i := i + 1) { |
| 4214 | if (mask[i] != '1'B) { |
| 4215 | setverdict(fail, "MS was not paged at all: ", g_ms[i].imsi); |
| 4216 | log("===== mask := ", mask); |
| 4217 | } |
| 4218 | } |
| 4219 | |
| 4220 | /* All messages must have been received by now, expect a dummy block */ |
| 4221 | f_rx_rlcmac_dl_block_exp_dummy(dl_block, nr := nr); |
| 4222 | } |
| 4223 | |
| 4224 | private function f_TC_paging_cs_multi_ms_init(BIT8 pdch_mask) |
| 4225 | runs on RAW_PCU_Test_CT { |
| 4226 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 4227 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 4228 | |
| 4229 | /* Initialize NS/BSSGP side */ |
| 4230 | f_init_bssgp(); |
| 4231 | |
| 4232 | /* Explicitly set the given PDCH slot-mask to all transceivers */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4233 | f_PCUIF_PDCHMask_set(info_ind, pdch_mask); |
Vadim Yanitskiy | dbd4b24 | 2020-10-31 05:44:58 +0700 | [diff] [blame] | 4234 | |
| 4235 | /* Allocate 56 GprsMS instances (maximum for 8 PDCH slots) */ |
| 4236 | f_init_gprs_ms(7 * 8); |
| 4237 | |
| 4238 | /* Initialize the PCU interface abstraction */ |
| 4239 | f_init_raw(testcasename(), info_ind); |
| 4240 | |
| 4241 | /* Establish BSSGP connection to the PCU */ |
| 4242 | f_bssgp_establish(); |
| 4243 | f_multi_ms_bssgp_register(); |
| 4244 | |
| 4245 | /* Establish an Uplink TBF for each GprsMS instance */ |
| 4246 | f_multi_ms_establish_tbf(do_activate := true); |
| 4247 | } |
| 4248 | |
| 4249 | testcase TC_paging_cs_multi_ms_imsi() runs on RAW_PCU_Test_CT { |
| 4250 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 4251 | |
| 4252 | /* Common part: send INFO.ind, establish TBFs... */ |
| 4253 | f_TC_paging_cs_multi_ms_init(pdch_mask := '00000001'B); |
| 4254 | |
| 4255 | /* Enqueue multiple CS PAGING requests at a time (IMSI only) */ |
| 4256 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 4257 | BSSGP[0].send(ts_BSSGP_CS_PAGING_IMSI(bvci, g_ms[i].imsi)); |
| 4258 | } |
| 4259 | |
| 4260 | /* FIXME: work around a race condition between PCUIF and BSSGP */ |
| 4261 | f_sleep(0.2); /* i.e. give the IUT some time to process everything */ |
| 4262 | |
| 4263 | /* Check what the IUT sends on PACCH, all GprsMS instances must be paged. |
| 4264 | * The IUT is expected to page on all PDCH slots of all transceivers. */ |
| 4265 | for (var integer trx_nr := 0; trx_nr < 8; trx_nr := trx_nr + 1) { |
| 4266 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, trx_nr); |
| 4267 | f_TC_paging_cs_multi_ms(nr, exp_imsi := true, exp_tmsi := false); |
| 4268 | } |
| 4269 | |
| 4270 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4271 | } |
| 4272 | |
| 4273 | testcase TC_paging_cs_multi_ms_tmsi() runs on RAW_PCU_Test_CT { |
| 4274 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 4275 | |
| 4276 | /* Common part: send INFO.ind, establish TBFs... */ |
| 4277 | f_TC_paging_cs_multi_ms_init(pdch_mask := '00000001'B); |
| 4278 | |
| 4279 | /* Enqueue multiple CS PAGING requests at a time (P-TMSI only) */ |
| 4280 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 4281 | var GsmTmsi tmsi := oct2int(g_ms[i].tlli); /* P-TMSI == TLLI */ |
| 4282 | BSSGP[0].send(ts_BSSGP_CS_PAGING_PTMSI(bvci, g_ms[i].imsi, tmsi)); |
| 4283 | } |
| 4284 | |
| 4285 | /* FIXME: work around a race condition between PCUIF and BSSGP */ |
| 4286 | f_sleep(0.2); /* i.e. give the IUT some time to process everything */ |
| 4287 | |
| 4288 | /* Check what the IUT sends on PACCH, all GprsMS instances must be paged. |
| 4289 | * The IUT is expected to page on all PDCH slots of all transceivers. */ |
| 4290 | for (var integer trx_nr := 0; trx_nr < 8; trx_nr := trx_nr + 1) { |
| 4291 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, trx_nr); |
| 4292 | f_TC_paging_cs_multi_ms(nr, exp_imsi := false, exp_tmsi := true); |
| 4293 | } |
| 4294 | |
| 4295 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4296 | } |
| 4297 | |
| 4298 | testcase TC_paging_cs_multi_ms_imsi_tmsi() runs on RAW_PCU_Test_CT { |
| 4299 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 4300 | |
| 4301 | /* Common part: send INFO.ind, establish TBFs... */ |
| 4302 | f_TC_paging_cs_multi_ms_init(pdch_mask := '00000001'B); |
| 4303 | |
| 4304 | /* Enqueue multiple CS PAGING requests at a time (IMSI & P-TMSI) */ |
| 4305 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 4306 | var GsmTmsi tmsi := oct2int(g_ms[i].tlli); /* P-TMSI == TLLI */ |
| 4307 | if (i mod 3 == 0) { /* One PDU fits: 1 IMSI and 2 P-TMSI MIs */ |
| 4308 | BSSGP[0].send(ts_BSSGP_CS_PAGING_PTMSI(bvci, g_ms[i].imsi, tmsi)); |
| 4309 | } else { |
| 4310 | BSSGP[0].send(ts_BSSGP_CS_PAGING_IMSI(bvci, g_ms[i].imsi)); |
| 4311 | } |
| 4312 | } |
| 4313 | |
| 4314 | /* FIXME: work around a race condition between PCUIF and BSSGP */ |
| 4315 | f_sleep(0.2); /* i.e. give the IUT some time to process everything */ |
| 4316 | |
| 4317 | /* Check what the IUT sends on PACCH, all GprsMS instances must be paged. |
| 4318 | * The IUT is expected to page on all PDCH slots of all transceivers. */ |
| 4319 | for (var integer trx_nr := 0; trx_nr < 8; trx_nr := trx_nr + 1) { |
| 4320 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, trx_nr); |
| 4321 | f_TC_paging_cs_multi_ms(nr, exp_imsi := true, exp_tmsi := true); |
| 4322 | } |
| 4323 | |
| 4324 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4325 | } |
| 4326 | |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4327 | 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] | 4328 | runs on RAW_PCU_Test_CT return RlcmacDlBlock { |
| 4329 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4330 | var integer i := 0; |
| 4331 | while (true) { |
| 4332 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4333 | if (not match(dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 4334 | break; |
| 4335 | } |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4336 | if (max_num_iter > 0 and i > max_num_iter) { |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4337 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4338 | f_shutdown(__BFILE__, __LINE__); |
| 4339 | } |
| 4340 | i := i + 1; |
| 4341 | } |
| 4342 | return dl_block; |
| 4343 | } |
| 4344 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4345 | private function f_outbound_nacc_rim_tx_resp(PCUIF_info_ind info_ind) |
| 4346 | runs on RAW_PCU_Test_CT { |
| 4347 | 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), |
| 4348 | info_ind.lac), |
| 4349 | info_ind.rac), |
| 4350 | info_ind.cell_id)); |
| 4351 | var BssgpCellId dst := valueof(ts_BssgpCellId(ts_RAI(ts_LAI('023F43'H, /* Decided by test itself (emulating BSC) */ |
| 4352 | 423), |
| 4353 | 2), |
| 4354 | 5)); |
| 4355 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src)); |
| 4356 | var RIM_Routing_Address dst_addr := valueof(t_RIM_Routing_Address_cid(dst)); |
| 4357 | var template (value) RAN_Information_RIM_Container res_cont := |
| 4358 | ts_RAN_Information_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 4359 | ts_RIM_Sequence_Number(2), |
| 4360 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 4361 | ts_RIM_Protocol_Version_Number(1), |
| 4362 | tsu_ApplContainer_or_ApplErrContainer_NACC(tsu_ApplContainer_NACC(dst, false, 3, si_default)), |
| 4363 | omit); |
| 4364 | RIM.send(ts_PDU_BSSGP_RAN_INFORMATION(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 4365 | ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 4366 | res_cont)); |
| 4367 | } |
| 4368 | |
| 4369 | altstep as_outbound_nacc_rim_resolve(PCUIF_info_ind info_ind, boolean do_answer := true, boolean do_repeat := false) |
| 4370 | runs on RAW_PCU_Test_CT { |
| 4371 | /* RIM procedure: */ |
| 4372 | 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), |
| 4373 | info_ind.lac), |
| 4374 | info_ind.rac), |
| 4375 | info_ind.cell_id)); |
| 4376 | var BssgpCellId dst := valueof(ts_BssgpCellId(ts_RAI(ts_LAI('023F43'H, /* Decided by test itself (emulating BSC) */ |
| 4377 | 423), |
| 4378 | 2), |
| 4379 | 5)); |
| 4380 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src)); |
| 4381 | var RIM_Routing_Address dst_addr := valueof(t_RIM_Routing_Address_cid(dst)); |
| 4382 | [] RIM.receive(tr_RAN_INFORMATION_REQUEST(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 4383 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 4384 | tr_RAN_Information_Request_RIM_Container)) { |
| 4385 | if (do_answer) { |
| 4386 | f_outbound_nacc_rim_tx_resp(info_ind); |
| 4387 | } |
| 4388 | if (do_repeat) { |
| 4389 | repeat; |
| 4390 | } |
| 4391 | } |
| 4392 | } |
| 4393 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4394 | private function f_handle_nacc_rac_ci_query(PCUIF_info_ind info_ind, GsmArfcn req_arfcn, uint6_t req_bsic, |
| 4395 | boolean answer := true, boolean use_old_ctrl_iface := false) |
| 4396 | runs on RAW_PCU_Test_CT { |
| 4397 | if (use_old_ctrl_iface == true) { |
| 4398 | f_ipa_ctrl_wait_link_up(); |
| 4399 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4400 | int2str(info_ind.lac) & "." & |
| 4401 | int2str(info_ind.cell_id) & "." & |
| 4402 | int2str(req_arfcn) & "." & |
| 4403 | int2str(req_bsic); |
| 4404 | if (answer) { |
| 4405 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4406 | } else { |
| 4407 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, omit); |
| 4408 | } |
| 4409 | } else { |
| 4410 | var PCUIF_Message pcu_msg; |
| 4411 | BTS.receive(tr_PCUIF_NEIGH_ADDR_REQ(0, info_ind.lac, info_ind.cell_id, req_arfcn, req_bsic)) -> value pcu_msg; |
| 4412 | if (answer) { |
| 4413 | BTS.send(ts_PCUIF_NEIGH_ADDR_CNF(0, pcu_msg.u.container.u.neigh_addr_req, 0, 23, 43, 0, 423, 2, 5)); |
| 4414 | } |
| 4415 | } |
| 4416 | } |
| 4417 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4418 | /* Start NACC from MS side */ |
| 4419 | 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] | 4420 | boolean exp_rac_ci_query := true, boolean exp_si_query := true, |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4421 | boolean skip_final_ctrl_ack := false, |
| 4422 | boolean use_old_ctrl_iface := false) |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4423 | runs on RAW_PCU_Test_CT { |
| 4424 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4425 | var RlcmacDlBlock dl_block; |
| 4426 | var uint32_t sched_fn; |
| 4427 | var GsmArfcn req_arfcn := 862; |
| 4428 | var uint6_t req_bsic := 43; |
| 4429 | |
| 4430 | /* Start NACC from MS side */ |
| 4431 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4432 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4433 | |
| 4434 | if (exp_rac_ci_query == true) { |
| 4435 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4436 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4437 | } |
| 4438 | |
| 4439 | if (exp_si_query == true) { |
| 4440 | /* RIM procedure: */ |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4441 | as_outbound_nacc_rim_resolve(info_ind); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4442 | } |
| 4443 | |
| 4444 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 4445 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4446 | |
| 4447 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 4448 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4449 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4450 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4451 | f_shutdown(__BFILE__, __LINE__); |
| 4452 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4453 | /* 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] | 4454 | 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] | 4455 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4456 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4457 | } |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4458 | } |
| 4459 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4460 | /* Verify PCU handles outbound Network Assisted Cell Change Cell Change (NACC, TS 44.060 sec 8.8). */ |
| 4461 | testcase TC_nacc_outbound_success() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4462 | var PollFnCtx pollctx; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4463 | var GprsMS ms; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4464 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4465 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4466 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4467 | if (use_old_ctrl_iface) { |
| 4468 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4469 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4470 | } |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4471 | |
| 4472 | /* Initialize NS/BSSGP side */ |
| 4473 | f_init_bssgp(); |
| 4474 | /* Initialize GPRS MS side */ |
| 4475 | f_init_gprs_ms(); |
| 4476 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4477 | |
| 4478 | /* Initialize the PCU interface abstraction */ |
| 4479 | f_init_raw(testcasename(), info_ind); |
| 4480 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4481 | /* Make sure we are not affected by full cache from previous tests */ |
| 4482 | f_pcuvty_flush_neigh_caches(); |
| 4483 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4484 | /* Establish BSSGP connection to the PCU */ |
| 4485 | f_bssgp_establish(); |
| 4486 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4487 | |
| 4488 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4489 | 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] | 4490 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4491 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4492 | |
| 4493 | /* Start NACC from MS side */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4494 | f_outbound_nacc_success(ms, info_ind, use_old_ctrl_iface := use_old_ctrl_iface); |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4495 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4496 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4497 | } |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4498 | |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 4499 | /* Verify Pkt Cell Change Continue is retransmitted if not CTRL ACKed */ |
| 4500 | testcase TC_nacc_outbound_success_no_ctrl_ack() runs on RAW_PCU_Test_CT { |
| 4501 | var PollFnCtx pollctx; |
| 4502 | var GprsMS ms; |
| 4503 | var RlcmacDlBlock dl_block; |
| 4504 | var uint32_t sched_fn; |
| 4505 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4506 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 4507 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4508 | if (use_old_ctrl_iface) { |
| 4509 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4510 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4511 | } |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 4512 | |
| 4513 | /* Initialize NS/BSSGP side */ |
| 4514 | f_init_bssgp(); |
| 4515 | /* Initialize GPRS MS side */ |
| 4516 | f_init_gprs_ms(); |
| 4517 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4518 | |
| 4519 | /* Initialize the PCU interface abstraction */ |
| 4520 | f_init_raw(testcasename(), info_ind); |
| 4521 | |
| 4522 | /* Make sure we are not affected by full cache from previous tests */ |
| 4523 | f_pcuvty_flush_neigh_caches(); |
| 4524 | |
| 4525 | /* Establish BSSGP connection to the PCU */ |
| 4526 | f_bssgp_establish(); |
| 4527 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4528 | |
| 4529 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4530 | 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] | 4531 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4532 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4533 | |
| 4534 | /* Start NACC from MS side, avoid sending final CTRL ACK */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4535 | f_outbound_nacc_success(ms, info_ind, skip_final_ctrl_ack := true, use_old_ctrl_iface := use_old_ctrl_iface); |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 4536 | |
| 4537 | /* Wait until we receive something non-dummy */ |
| 4538 | dl_block := f_skip_dummy(0, sched_fn); |
| 4539 | /* Make sure it is a Pkt Cell Chg Continue (retransmitted)*/ |
| 4540 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4541 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4542 | } |
| 4543 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4544 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4545 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4546 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4547 | } |
| 4548 | |
| 4549 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4550 | } |
| 4551 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4552 | /* Verify PCU handles outbound Network Assisted Cell Change Cell Change (NACC, TS 44.060 sec 8.8) twice, the second time using the caches */ |
| 4553 | testcase TC_nacc_outbound_success_twice() runs on RAW_PCU_Test_CT { |
| 4554 | var PollFnCtx pollctx; |
| 4555 | var GprsMS ms; |
| 4556 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4557 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4558 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4559 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4560 | if (use_old_ctrl_iface) { |
| 4561 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4562 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4563 | } |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4564 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4565 | /* Initialize NS/BSSGP side */ |
| 4566 | f_init_bssgp(); |
| 4567 | /* Initialize GPRS MS side */ |
| 4568 | f_init_gprs_ms(); |
| 4569 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4570 | |
| 4571 | /* Initialize the PCU interface abstraction */ |
| 4572 | f_init_raw(testcasename(), info_ind); |
| 4573 | |
| 4574 | /* Make sure we are not affected by full cache from previous tests */ |
| 4575 | f_pcuvty_flush_neigh_caches(); |
| 4576 | /* Set timeout values for caches so that entries will be in cache during second try */ |
| 4577 | f_pcuvty_set_neigh_caches(10, 10); |
| 4578 | |
| 4579 | /* Establish BSSGP connection to the PCU */ |
| 4580 | f_bssgp_establish(); |
| 4581 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4582 | |
| 4583 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4584 | 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] | 4585 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4586 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4587 | |
| 4588 | /* Start NACC from MS side */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4589 | f_outbound_nacc_success(ms, info_ind, use_old_ctrl_iface := use_old_ctrl_iface); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4590 | |
| 4591 | /* First NACC procedure is done, let's try to start a new one now that previous queries are cached: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4592 | f_outbound_nacc_success(ms, info_ind, false, false, use_old_ctrl_iface := use_old_ctrl_iface); |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4593 | |
| 4594 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4595 | } |
| 4596 | |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 4597 | /* Verify PCU handles outbound Network Assisted Cell Change Cell Change (NACC, |
| 4598 | * TS 44.060 sec 8.8) twice, the second time after caches timed out |
| 4599 | */ |
| 4600 | testcase TC_nacc_outbound_success_twice_nocache() runs on RAW_PCU_Test_CT { |
| 4601 | var PollFnCtx pollctx; |
| 4602 | var GprsMS ms; |
| 4603 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 4604 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4605 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 4606 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4607 | if (use_old_ctrl_iface) { |
| 4608 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4609 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4610 | } |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 4611 | |
| 4612 | /* Initialize NS/BSSGP side */ |
| 4613 | f_init_bssgp(); |
| 4614 | /* Initialize GPRS MS side */ |
| 4615 | f_init_gprs_ms(); |
| 4616 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4617 | |
| 4618 | /* Initialize the PCU interface abstraction */ |
| 4619 | f_init_raw(testcasename(), info_ind); |
| 4620 | |
| 4621 | /* Make sure we are not affected by full cache from previous tests */ |
| 4622 | f_pcuvty_flush_neigh_caches(); |
| 4623 | /* Set timeout values for caches so that entries will be erased before the second try */ |
| 4624 | f_pcuvty_set_neigh_caches(1, 1); |
| 4625 | |
| 4626 | /* Establish BSSGP connection to the PCU */ |
| 4627 | f_bssgp_establish(); |
| 4628 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4629 | |
| 4630 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4631 | 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] | 4632 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4633 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4634 | |
| 4635 | /* Start NACC from MS side */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4636 | f_outbound_nacc_success(ms, info_ind, use_old_ctrl_iface := use_old_ctrl_iface); |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 4637 | |
| 4638 | /* CTRL client should have disconnected from us */ |
| 4639 | f_ipa_ctrl_wait_link_down(); |
| 4640 | /* wait for cache entries to time out */ |
| 4641 | f_sleep(2.0); |
| 4642 | /* First NACC procedure is done, let's try to start a new one now that previous queries have timed out: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4643 | f_outbound_nacc_success(ms, info_ind, use_old_ctrl_iface := use_old_ctrl_iface); |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 4644 | |
| 4645 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4646 | } |
| 4647 | |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4648 | /* 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] | 4649 | testcase TC_nacc_outbound_rac_ci_resolve_conn_refused() runs on RAW_PCU_Test_CT { |
| 4650 | var RlcmacDlBlock dl_block; |
| 4651 | var PollFnCtx pollctx; |
| 4652 | var uint32_t sched_fn; |
| 4653 | var GprsMS ms; |
| 4654 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4655 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 4656 | var GsmArfcn req_arfcn := 862; |
| 4657 | var uint6_t req_bsic := 43; |
| 4658 | |
| 4659 | /* In here we explicitly avoid starting osmo-bsc emulation neighbor |
| 4660 | * resolution CTRL port, to trigger Conn Refused by socket: |
| 4661 | * f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4662 | */ |
| 4663 | |
| 4664 | /* Initialize NS/BSSGP side */ |
| 4665 | f_init_bssgp(); |
| 4666 | /* Initialize GPRS MS side */ |
| 4667 | f_init_gprs_ms(); |
| 4668 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4669 | |
| 4670 | /* Initialize the PCU interface abstraction */ |
| 4671 | f_init_raw(testcasename(), info_ind); |
| 4672 | |
| 4673 | /* Make sure we are not affected by full cache from previous tests */ |
| 4674 | f_pcuvty_flush_neigh_caches(); |
| 4675 | |
| 4676 | /* Establish BSSGP connection to the PCU */ |
| 4677 | f_bssgp_establish(); |
| 4678 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4679 | |
| 4680 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4681 | 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] | 4682 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4683 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4684 | |
| 4685 | /* Start NACC from MS side */ |
| 4686 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4687 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4688 | |
| 4689 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4690 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 4691 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 4692 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4693 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4694 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4695 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4696 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4697 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4698 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4699 | } |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 4700 | |
| 4701 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4702 | } |
| 4703 | |
| 4704 | /* 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] | 4705 | testcase TC_nacc_outbound_rac_ci_resolve_timeout() runs on RAW_PCU_Test_CT { |
| 4706 | var RlcmacDlBlock dl_block; |
| 4707 | var PollFnCtx pollctx; |
| 4708 | var uint32_t sched_fn; |
| 4709 | var GprsMS ms; |
| 4710 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4711 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4712 | var GsmArfcn req_arfcn := 862; |
| 4713 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4714 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4715 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4716 | if (use_old_ctrl_iface) { |
| 4717 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4718 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4719 | } |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4720 | |
| 4721 | /* Initialize NS/BSSGP side */ |
| 4722 | f_init_bssgp(); |
| 4723 | /* Initialize GPRS MS side */ |
| 4724 | f_init_gprs_ms(); |
| 4725 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4726 | |
| 4727 | /* Initialize the PCU interface abstraction */ |
| 4728 | f_init_raw(testcasename(), info_ind); |
| 4729 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4730 | /* Make sure we are not affected by full cache from previous tests */ |
| 4731 | f_pcuvty_flush_neigh_caches(); |
| 4732 | |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4733 | /* Establish BSSGP connection to the PCU */ |
| 4734 | f_bssgp_establish(); |
| 4735 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4736 | |
| 4737 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4738 | 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] | 4739 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4740 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4741 | |
| 4742 | /* Start NACC from MS side */ |
| 4743 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4744 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4745 | |
| 4746 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4747 | /* we receive RAC+CI resolution request, but we never answer to it, timeout should occur */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4748 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, false, use_old_ctrl_iface); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4749 | |
| 4750 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4751 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4752 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 4753 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4754 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4755 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4756 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4757 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4758 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4759 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4760 | } |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4761 | |
| 4762 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4763 | } |
| 4764 | |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 4765 | /* Verify PCU transmits Pkt Cell Change Continue if RAC+CI resolution fails during outbound NACC procedure */ |
| 4766 | testcase TC_nacc_outbound_rac_ci_resolve_fail_parse_response() runs on RAW_PCU_Test_CT { |
| 4767 | var RlcmacDlBlock dl_block; |
| 4768 | var PollFnCtx pollctx; |
| 4769 | var uint32_t sched_fn; |
| 4770 | var GprsMS ms; |
| 4771 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4772 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 4773 | var GsmArfcn req_arfcn := 862; |
| 4774 | var uint6_t req_bsic := 43; |
| 4775 | |
| 4776 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4777 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4778 | |
| 4779 | /* Initialize NS/BSSGP side */ |
| 4780 | f_init_bssgp(); |
| 4781 | /* Initialize GPRS MS side */ |
| 4782 | f_init_gprs_ms(); |
| 4783 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4784 | |
| 4785 | /* Initialize the PCU interface abstraction */ |
| 4786 | f_init_raw(testcasename(), info_ind); |
| 4787 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4788 | /* Make sure we are not affected by full cache from previous tests */ |
| 4789 | f_pcuvty_flush_neigh_caches(); |
| 4790 | |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 4791 | /* Establish BSSGP connection to the PCU */ |
| 4792 | f_bssgp_establish(); |
| 4793 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4794 | |
| 4795 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4796 | 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] | 4797 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4798 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4799 | |
| 4800 | /* Start NACC from MS side */ |
| 4801 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4802 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4803 | |
| 4804 | /* osmo-pcu should now ask for resolution: */ |
| 4805 | f_ipa_ctrl_wait_link_up(); |
| 4806 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4807 | int2str(info_ind.lac) & "." & |
| 4808 | int2str(info_ind.cell_id) & "." & |
| 4809 | int2str(req_arfcn) & "." & |
| 4810 | int2str(req_bsic); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4811 | /* we receive RAC+CI resolution request and we send incorrectly formated response */ |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 4812 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "foobar-error"); |
| 4813 | |
| 4814 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4815 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 4816 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 4817 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4818 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4819 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4820 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4821 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4822 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4823 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4824 | } |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 4825 | |
| 4826 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4827 | } |
| 4828 | |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4829 | /* Verify PCU transmits Pkt Cell Change Continue if SI resolution fails during outbound NACC procedure */ |
| 4830 | testcase TC_nacc_outbound_si_resolve_timeout() runs on RAW_PCU_Test_CT { |
| 4831 | var RlcmacDlBlock dl_block; |
| 4832 | var PollFnCtx pollctx; |
| 4833 | var uint32_t sched_fn; |
| 4834 | var GprsMS ms; |
| 4835 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4836 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4837 | var GsmArfcn req_arfcn := 862; |
| 4838 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4839 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4840 | 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 */ |
| 4841 | info_ind.lac), |
| 4842 | info_ind.rac), |
| 4843 | info_ind.cell_id)); |
| 4844 | var BssgpCellId dst := valueof(ts_BssgpCellId(ts_RAI(ts_LAI('023F43'H, /* Decided by test itself (emulating BSC) */ |
| 4845 | 423), |
| 4846 | 2), |
| 4847 | 5)); |
| 4848 | var template RIM_Routing_Address src_addr := t_RIM_Routing_Address_cid(src); |
| 4849 | var template RIM_Routing_Address dst_addr := t_RIM_Routing_Address_cid(dst); |
| 4850 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4851 | if (use_old_ctrl_iface) { |
| 4852 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4853 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4854 | } |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4855 | |
| 4856 | /* Initialize NS/BSSGP side */ |
| 4857 | f_init_bssgp(); |
| 4858 | /* Initialize GPRS MS side */ |
| 4859 | f_init_gprs_ms(); |
| 4860 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4861 | |
| 4862 | /* Initialize the PCU interface abstraction */ |
| 4863 | f_init_raw(testcasename(), info_ind); |
| 4864 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4865 | /* Make sure we are not affected by full cache from previous tests */ |
| 4866 | f_pcuvty_flush_neigh_caches(); |
| 4867 | |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4868 | /* Establish BSSGP connection to the PCU */ |
| 4869 | f_bssgp_establish(); |
| 4870 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4871 | |
| 4872 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4873 | 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] | 4874 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4875 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4876 | |
| 4877 | /* Start NACC from MS side */ |
| 4878 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4879 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4880 | |
| 4881 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4882 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4883 | |
| 4884 | /* RIM procedure: */ |
| 4885 | RIM.receive(tr_RAN_INFORMATION_REQUEST(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 4886 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 4887 | tr_RAN_Information_Request_RIM_Container)); |
| 4888 | /* We never answer the RIM procude -> PCU timeouts and should send Pkt Cell Chg continue */ |
| 4889 | |
| 4890 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4891 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4892 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 4893 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4894 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4895 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4896 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4897 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4898 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4899 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4900 | } |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4901 | |
| 4902 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4903 | } |
| 4904 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4905 | /* Test MS sending Pkt Cell Change Notify twice (duplicate msg) while waiting for CTRL resolution */ |
| 4906 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup() runs on RAW_PCU_Test_CT { |
| 4907 | var PollFnCtx pollctx; |
| 4908 | var GprsMS ms; |
| 4909 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 4910 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4911 | var RlcmacDlBlock dl_block; |
| 4912 | var uint32_t sched_fn; |
| 4913 | var CtrlMessage rx_ctrl; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4914 | var charstring ctrl_var; |
| 4915 | var PCUIF_Message pcu_msg; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4916 | var GsmArfcn req_arfcn := 862; |
| 4917 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4918 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4919 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4920 | if (use_old_ctrl_iface) { |
| 4921 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4922 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4923 | } |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4924 | |
| 4925 | /* Initialize NS/BSSGP side */ |
| 4926 | f_init_bssgp(); |
| 4927 | /* Initialize GPRS MS side */ |
| 4928 | f_init_gprs_ms(); |
| 4929 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4930 | |
| 4931 | /* Initialize the PCU interface abstraction */ |
| 4932 | f_init_raw(testcasename(), info_ind); |
| 4933 | |
| 4934 | /* Make sure we are not affected by full cache from previous tests */ |
| 4935 | f_pcuvty_flush_neigh_caches(); |
| 4936 | |
| 4937 | /* Establish BSSGP connection to the PCU */ |
| 4938 | f_bssgp_establish(); |
| 4939 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4940 | |
| 4941 | /* Send PACKET RESOURCE REQUEST */ |
| 4942 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 4943 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4944 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4945 | |
| 4946 | /* Start NACC from MS side */ |
| 4947 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4948 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4949 | |
| 4950 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4951 | if (use_old_ctrl_iface) { |
| 4952 | f_ipa_ctrl_wait_link_up(); |
| 4953 | ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4954 | int2str(info_ind.lac) & "." & |
| 4955 | int2str(info_ind.cell_id) & "." & |
| 4956 | int2str(req_arfcn) & "." & |
| 4957 | int2str(req_bsic); |
| 4958 | IPA_CTRL.receive(tr_CtrlMsgGet(?, ctrl_var)) -> value rx_ctrl; |
| 4959 | } else { |
| 4960 | BTS.receive(tr_PCUIF_NEIGH_ADDR_REQ(0, info_ind.lac, info_ind.cell_id, req_arfcn, req_bsic)) -> value pcu_msg; |
| 4961 | } |
| 4962 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4963 | /* Before receiving CTRL response, MS retransmits Pkt cell Chg Notif */ |
| 4964 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4965 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4966 | |
| 4967 | if (use_old_ctrl_iface) { |
| 4968 | IPA_CTRL.send(ts_CtrlMsgGetRepl(rx_ctrl.cmd.id, valueof(ctrl_var), valueof("023-43-423-2-5"))); |
| 4969 | } else { |
| 4970 | BTS.send(ts_PCUIF_NEIGH_ADDR_CNF(0, pcu_msg.u.container.u.neigh_addr_req, 0, 23, 43, 0, 423, 2, 5)); |
| 4971 | } |
| 4972 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4973 | timer T := 2.0; |
| 4974 | T.start; |
| 4975 | alt { |
| 4976 | [] as_outbound_nacc_rim_resolve(info_ind, do_repeat := true); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4977 | [use_old_ctrl_iface] IPA_CTRL.receive(tr_CtrlMsgGet(?, ctrl_var)) -> value rx_ctrl { |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4978 | setverdict(fail, "Received unexpected CTRL resolution after duplicate Pkt Cell Change Notification:", rx_ctrl); |
| 4979 | f_shutdown(__BFILE__, __LINE__); |
| 4980 | } |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 4981 | [not use_old_ctrl_iface] BTS.receive(tr_PCUIF_NEIGH_ADDR_REQ(0, info_ind.lac, info_ind.cell_id, req_arfcn, req_bsic)) -> value pcu_msg { |
| 4982 | setverdict(fail, "Received unexpected PCUIF resolution after duplicate Pkt Cell Change Notification:", pcu_msg); |
| 4983 | f_shutdown(__BFILE__, __LINE__); |
| 4984 | } |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4985 | [] T.timeout { |
| 4986 | setverdict(pass); |
| 4987 | } |
| 4988 | } |
| 4989 | |
| 4990 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 4991 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4992 | |
| 4993 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 4994 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4995 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4996 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4997 | f_shutdown(__BFILE__, __LINE__); |
| 4998 | } |
| 4999 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5000 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5001 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5002 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5003 | } |
| 5004 | |
| 5005 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5006 | } |
| 5007 | |
| 5008 | /* Test MS sending Pkt Cell Change Notify twice (duplicate msg) while waiting for SI resolution */ |
| 5009 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup2() runs on RAW_PCU_Test_CT { |
| 5010 | var PollFnCtx pollctx; |
| 5011 | var GprsMS ms; |
| 5012 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5013 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5014 | var RlcmacDlBlock dl_block; |
| 5015 | var uint32_t sched_fn; |
| 5016 | var CtrlMessage rx_ctrl; |
| 5017 | var GsmArfcn req_arfcn := 862; |
| 5018 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5019 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5020 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5021 | if (use_old_ctrl_iface) { |
| 5022 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5023 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5024 | } |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5025 | |
| 5026 | /* Initialize NS/BSSGP side */ |
| 5027 | f_init_bssgp(); |
| 5028 | /* Initialize GPRS MS side */ |
| 5029 | f_init_gprs_ms(); |
| 5030 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5031 | |
| 5032 | /* Initialize the PCU interface abstraction */ |
| 5033 | f_init_raw(testcasename(), info_ind); |
| 5034 | |
| 5035 | /* Make sure we are not affected by full cache from previous tests */ |
| 5036 | f_pcuvty_flush_neigh_caches(); |
| 5037 | |
| 5038 | /* Establish BSSGP connection to the PCU */ |
| 5039 | f_bssgp_establish(); |
| 5040 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5041 | |
| 5042 | /* Send PACKET RESOURCE REQUEST */ |
| 5043 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5044 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5045 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5046 | |
| 5047 | /* Start NACC from MS side */ |
| 5048 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5049 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5050 | |
| 5051 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5052 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5053 | as_outbound_nacc_rim_resolve(info_ind, do_answer := false); |
| 5054 | /* Before receiving RIM response, MS retransmits Pkt cell Chg Notif */ |
| 5055 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5056 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
| 5057 | f_outbound_nacc_rim_tx_resp(info_ind); |
| 5058 | timer T := 1.0; |
| 5059 | T.start; |
| 5060 | alt { |
| 5061 | [] RIM.receive { |
| 5062 | setverdict(fail, "Received unexpected RIM message"); |
| 5063 | f_shutdown(__BFILE__, __LINE__); |
| 5064 | } |
| 5065 | [] T.timeout { |
| 5066 | setverdict(pass); |
| 5067 | } |
| 5068 | } |
| 5069 | |
| 5070 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 5071 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5072 | |
| 5073 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5074 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5075 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5076 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5077 | f_shutdown(__BFILE__, __LINE__); |
| 5078 | } |
| 5079 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5080 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5081 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5082 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5083 | } |
| 5084 | |
| 5085 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5086 | } |
| 5087 | |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5088 | /* Test MS sending Pkt Cell Change Notification twice (duplicate msg) while sending Pkt Neigh Data Change */ |
| 5089 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup3() runs on RAW_PCU_Test_CT { |
| 5090 | var PollFnCtx pollctx; |
| 5091 | var GprsMS ms; |
| 5092 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5093 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5094 | var RlcmacDlBlock dl_block; |
| 5095 | var uint32_t sched_fn; |
| 5096 | var CtrlMessage rx_ctrl; |
| 5097 | var GsmArfcn req_arfcn := 862; |
| 5098 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5099 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5100 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5101 | if (use_old_ctrl_iface) { |
| 5102 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5103 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5104 | } |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5105 | |
| 5106 | /* Initialize NS/BSSGP side */ |
| 5107 | f_init_bssgp(); |
| 5108 | /* Initialize GPRS MS side */ |
| 5109 | f_init_gprs_ms(); |
| 5110 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5111 | |
| 5112 | /* Initialize the PCU interface abstraction */ |
| 5113 | f_init_raw(testcasename(), info_ind); |
| 5114 | |
| 5115 | /* Make sure we are not affected by full cache from previous tests */ |
| 5116 | f_pcuvty_flush_neigh_caches(); |
| 5117 | |
| 5118 | /* Establish BSSGP connection to the PCU */ |
| 5119 | f_bssgp_establish(); |
| 5120 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5121 | |
| 5122 | /* Send PACKET RESOURCE REQUEST */ |
| 5123 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5124 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5125 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5126 | |
| 5127 | /* Start NACC from MS side */ |
| 5128 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5129 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5130 | |
| 5131 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5132 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5133 | /* RIM procedure: */ |
| 5134 | as_outbound_nacc_rim_resolve(info_ind); |
| 5135 | |
| 5136 | /* Receive first Pkt Neigh data Change, then trigger a new Pkt Cell Change Notif: */ |
| 5137 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, single_step := true); |
| 5138 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5139 | |
| 5140 | /* It should be ignored, let's continue fetching Pkt Neigh Data Change */ |
| 5141 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, f_ms_tx_TsTrxBtsNum(ms), 1, 16); |
| 5142 | |
| 5143 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5144 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5145 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5146 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5147 | f_shutdown(__BFILE__, __LINE__); |
| 5148 | } |
| 5149 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5150 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5151 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5152 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5153 | } |
| 5154 | } |
| 5155 | |
| 5156 | /* Test MS sending Pkt Cell Change Notification twice (duplicate msg) while sending Pkt Cell Change Continue */ |
| 5157 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup4() runs on RAW_PCU_Test_CT { |
| 5158 | var PollFnCtx pollctx; |
| 5159 | var GprsMS ms; |
| 5160 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5161 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5162 | var RlcmacDlBlock dl_block; |
| 5163 | var uint32_t sched_fn; |
| 5164 | var CtrlMessage rx_ctrl; |
| 5165 | var GsmArfcn req_arfcn := 862; |
| 5166 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5167 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5168 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5169 | if (use_old_ctrl_iface) { |
| 5170 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5171 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5172 | } |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5173 | |
| 5174 | /* Initialize NS/BSSGP side */ |
| 5175 | f_init_bssgp(); |
| 5176 | /* Initialize GPRS MS side */ |
| 5177 | f_init_gprs_ms(); |
| 5178 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5179 | |
| 5180 | /* Initialize the PCU interface abstraction */ |
| 5181 | f_init_raw(testcasename(), info_ind); |
| 5182 | |
| 5183 | /* Make sure we are not affected by full cache from previous tests */ |
| 5184 | f_pcuvty_flush_neigh_caches(); |
| 5185 | |
| 5186 | /* Establish BSSGP connection to the PCU */ |
| 5187 | f_bssgp_establish(); |
| 5188 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5189 | |
| 5190 | /* Send PACKET RESOURCE REQUEST */ |
| 5191 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5192 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5193 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5194 | |
| 5195 | /* Start NACC from MS side */ |
| 5196 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5197 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5198 | |
| 5199 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5200 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5201 | /* RIM procedure: */ |
| 5202 | as_outbound_nacc_rim_resolve(info_ind); |
| 5203 | |
| 5204 | /* Announce SI back to MS, continue NACC procedure */ |
| 5205 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 5206 | |
| 5207 | /* trigger a dup Pkt Cell Change Notif, it should be ignored: */ |
| 5208 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5209 | |
| 5210 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5211 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5212 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5213 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5214 | f_shutdown(__BFILE__, __LINE__); |
| 5215 | } |
| 5216 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5217 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5218 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5219 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5220 | } |
| 5221 | } |
| 5222 | |
| 5223 | /* Test MS sending Pkt Cell Change Notification twice (duplicate msg) while waiting for Pkt Cell Change Continue CTRL ACK */ |
| 5224 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup5() runs on RAW_PCU_Test_CT { |
| 5225 | var PollFnCtx pollctx; |
| 5226 | var GprsMS ms; |
| 5227 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5228 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5229 | var RlcmacDlBlock dl_block; |
| 5230 | var uint32_t sched_fn; |
| 5231 | var CtrlMessage rx_ctrl; |
| 5232 | var GsmArfcn req_arfcn := 862; |
| 5233 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5234 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5235 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5236 | if (use_old_ctrl_iface) { |
| 5237 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5238 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5239 | } |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5240 | |
| 5241 | /* Initialize NS/BSSGP side */ |
| 5242 | f_init_bssgp(); |
| 5243 | /* Initialize GPRS MS side */ |
| 5244 | f_init_gprs_ms(); |
| 5245 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5246 | |
| 5247 | /* Initialize the PCU interface abstraction */ |
| 5248 | f_init_raw(testcasename(), info_ind); |
| 5249 | |
| 5250 | /* Make sure we are not affected by full cache from previous tests */ |
| 5251 | f_pcuvty_flush_neigh_caches(); |
| 5252 | |
| 5253 | /* Establish BSSGP connection to the PCU */ |
| 5254 | f_bssgp_establish(); |
| 5255 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5256 | |
| 5257 | /* Send PACKET RESOURCE REQUEST */ |
| 5258 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5259 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5260 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5261 | |
| 5262 | /* Start NACC from MS side */ |
| 5263 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5264 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5265 | |
| 5266 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5267 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5268 | /* RIM procedure: */ |
| 5269 | as_outbound_nacc_rim_resolve(info_ind); |
| 5270 | |
| 5271 | /* Announce SI back to MS, continue NACC procedure */ |
| 5272 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 5273 | |
| 5274 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5275 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5276 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5277 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5278 | f_shutdown(__BFILE__, __LINE__); |
| 5279 | } |
| 5280 | /* trigger a dup Pkt Cell Change Notif, it should be ignored: */ |
| 5281 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5282 | |
| 5283 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5284 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5285 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5286 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5287 | } |
| 5288 | } |
| 5289 | |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5290 | /* Test MS sending Pkt Cell Change Notify twice (different tgt cell each time) |
| 5291 | * while waiting for CTRL resolution */ |
| 5292 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice() runs on RAW_PCU_Test_CT { |
| 5293 | var PollFnCtx pollctx; |
| 5294 | var GprsMS ms; |
| 5295 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5296 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5297 | var RlcmacDlBlock dl_block; |
| 5298 | var uint32_t sched_fn; |
| 5299 | var CtrlMessage rx_ctrl; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5300 | var charstring ctrl_var; |
| 5301 | var PCUIF_Message pcu_msg; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5302 | var GsmArfcn req_arfcn := 862; |
| 5303 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5304 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5305 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5306 | if (use_old_ctrl_iface) { |
| 5307 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5308 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5309 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5310 | |
| 5311 | /* Initialize NS/BSSGP side */ |
| 5312 | f_init_bssgp(); |
| 5313 | /* Initialize GPRS MS side */ |
| 5314 | f_init_gprs_ms(); |
| 5315 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5316 | |
| 5317 | /* Initialize the PCU interface abstraction */ |
| 5318 | f_init_raw(testcasename(), info_ind); |
| 5319 | |
| 5320 | /* Make sure we are not affected by full cache from previous tests */ |
| 5321 | f_pcuvty_flush_neigh_caches(); |
| 5322 | |
| 5323 | /* Establish BSSGP connection to the PCU */ |
| 5324 | f_bssgp_establish(); |
| 5325 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5326 | |
| 5327 | /* Send PACKET RESOURCE REQUEST */ |
| 5328 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5329 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5330 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5331 | |
| 5332 | /* Start NACC from MS side */ |
| 5333 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5334 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5335 | |
| 5336 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5337 | if (use_old_ctrl_iface) { |
| 5338 | f_ipa_ctrl_wait_link_up(); |
| 5339 | ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 5340 | int2str(info_ind.lac) & "." & |
| 5341 | int2str(info_ind.cell_id) & "." & |
| 5342 | int2str(req_arfcn) & "." & |
| 5343 | int2str(req_bsic); |
| 5344 | IPA_CTRL.receive(tr_CtrlMsgGet(?, ctrl_var)) -> value rx_ctrl; |
| 5345 | } else { |
| 5346 | BTS.receive(tr_PCUIF_NEIGH_ADDR_REQ(0, info_ind.lac, info_ind.cell_id, req_arfcn, req_bsic)) -> value pcu_msg; |
| 5347 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5348 | /* Before receiving CTRL response, MS retransmits Pkt cell Chg Notif with different tgt arfcn */ |
| 5349 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 5350 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5351 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5352 | if (use_old_ctrl_iface) { |
| 5353 | IPA_CTRL.send(ts_CtrlMsgGetRepl(rx_ctrl.cmd.id, valueof(ctrl_var), valueof("023-43-423-2-5"))); |
| 5354 | } else { |
| 5355 | BTS.send(ts_PCUIF_NEIGH_ADDR_CNF(0, pcu_msg.u.container.u.neigh_addr_req, 0, 23, 43, 0, 423, 2, 5)); |
| 5356 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5357 | /* We should now receive a 2nd CTRL request with the new ARFCN+BSIC */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5358 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5359 | |
| 5360 | /* And finally everything continues as usual with RIN procedure */ |
| 5361 | as_outbound_nacc_rim_resolve(info_ind); |
| 5362 | |
| 5363 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 5364 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5365 | |
| 5366 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5367 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5368 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5369 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5370 | f_shutdown(__BFILE__, __LINE__); |
| 5371 | } |
| 5372 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5373 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5374 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5375 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5376 | } |
| 5377 | |
| 5378 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5379 | } |
| 5380 | |
| 5381 | /* Test MS sending Pkt Cell Change Notify twice (different tgt cell each time) |
| 5382 | * while waiting for SI resolution */ |
| 5383 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice2() runs on RAW_PCU_Test_CT { |
| 5384 | var PollFnCtx pollctx; |
| 5385 | var GprsMS ms; |
| 5386 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5387 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5388 | var RlcmacDlBlock dl_block; |
| 5389 | var uint32_t sched_fn; |
| 5390 | var CtrlMessage rx_ctrl; |
| 5391 | var GsmArfcn req_arfcn := 862; |
| 5392 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5393 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5394 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5395 | if (use_old_ctrl_iface) { |
| 5396 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5397 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5398 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5399 | |
| 5400 | /* Initialize NS/BSSGP side */ |
| 5401 | f_init_bssgp(); |
| 5402 | /* Initialize GPRS MS side */ |
| 5403 | f_init_gprs_ms(); |
| 5404 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5405 | |
| 5406 | /* Initialize the PCU interface abstraction */ |
| 5407 | f_init_raw(testcasename(), info_ind); |
| 5408 | |
| 5409 | /* Make sure we are not affected by full cache from previous tests */ |
| 5410 | f_pcuvty_flush_neigh_caches(); |
| 5411 | |
| 5412 | /* Establish BSSGP connection to the PCU */ |
| 5413 | f_bssgp_establish(); |
| 5414 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5415 | |
| 5416 | /* Send PACKET RESOURCE REQUEST */ |
| 5417 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5418 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5419 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5420 | |
| 5421 | /* Start NACC from MS side */ |
| 5422 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5423 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5424 | |
| 5425 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5426 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5427 | as_outbound_nacc_rim_resolve(info_ind, do_answer := false); |
| 5428 | /* Before receiving RIM response, MS retransmits Pkt cell Chg Notif with different tgt cell: */ |
| 5429 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 5430 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5431 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
| 5432 | f_outbound_nacc_rim_tx_resp(info_ind); |
| 5433 | |
| 5434 | /* As a result, CTRL + RIM resolution for new tgt cell should now be done: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5435 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5436 | |
| 5437 | /* And finally everything continues as usual with RIN procedure */ |
| 5438 | as_outbound_nacc_rim_resolve(info_ind); |
| 5439 | |
| 5440 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 5441 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5442 | |
| 5443 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5444 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5445 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5446 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5447 | f_shutdown(__BFILE__, __LINE__); |
| 5448 | } |
| 5449 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5450 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5451 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5452 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5453 | } |
| 5454 | |
| 5455 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5456 | } |
| 5457 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5458 | /* Test MS sending Pkt Cell Change Notify twice (different tgt cell each time) |
| 5459 | * while sending Pkt Neigh Data Change */ |
| 5460 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice3() runs on RAW_PCU_Test_CT { |
| 5461 | var PollFnCtx pollctx; |
| 5462 | var GprsMS ms; |
| 5463 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5464 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5465 | var RlcmacDlBlock dl_block; |
| 5466 | var uint32_t sched_fn; |
| 5467 | var CtrlMessage rx_ctrl; |
| 5468 | var GsmArfcn req_arfcn := 862; |
| 5469 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5470 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5471 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5472 | if (use_old_ctrl_iface) { |
| 5473 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5474 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5475 | } |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5476 | |
| 5477 | /* Initialize NS/BSSGP side */ |
| 5478 | f_init_bssgp(); |
| 5479 | /* Initialize GPRS MS side */ |
| 5480 | f_init_gprs_ms(); |
| 5481 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5482 | |
| 5483 | /* Initialize the PCU interface abstraction */ |
| 5484 | f_init_raw(testcasename(), info_ind); |
| 5485 | |
| 5486 | /* Make sure we are not affected by full cache from previous tests */ |
| 5487 | f_pcuvty_flush_neigh_caches(); |
| 5488 | |
| 5489 | /* Establish BSSGP connection to the PCU */ |
| 5490 | f_bssgp_establish(); |
| 5491 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5492 | |
| 5493 | /* Send PACKET RESOURCE REQUEST */ |
| 5494 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5495 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5496 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5497 | |
| 5498 | /* Start NACC from MS side */ |
| 5499 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5500 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5501 | |
| 5502 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5503 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5504 | /* RIM procedure: */ |
| 5505 | as_outbound_nacc_rim_resolve(info_ind); |
| 5506 | |
| 5507 | /* Receive first Pkt Neigh data Change, then trigger a new Pkt Cell Change Notif (different ARFCN+BSIC): */ |
| 5508 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, single_step := true); |
| 5509 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 5510 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5511 | |
| 5512 | /* It should trigger RAC_CI resolution to start again: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5513 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5514 | /* RIM procedure: */ |
| 5515 | as_outbound_nacc_rim_resolve(info_ind); |
| 5516 | /* Transmit SI back to MS */ |
| 5517 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 5518 | |
| 5519 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5520 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5521 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5522 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5523 | f_shutdown(__BFILE__, __LINE__); |
| 5524 | } |
| 5525 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5526 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5527 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5528 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5529 | } |
| 5530 | } |
| 5531 | |
| 5532 | /* Test MS sending Pkt Cell Change Notification twice (different tgt cell) while sending Pkt Cell Change Continue */ |
| 5533 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice4() runs on RAW_PCU_Test_CT { |
| 5534 | var PollFnCtx pollctx; |
| 5535 | var GprsMS ms; |
| 5536 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5537 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5538 | var RlcmacDlBlock dl_block; |
| 5539 | var uint32_t sched_fn; |
| 5540 | var CtrlMessage rx_ctrl; |
| 5541 | var GsmArfcn req_arfcn := 862; |
| 5542 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5543 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5544 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5545 | if (use_old_ctrl_iface) { |
| 5546 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5547 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5548 | } |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5549 | |
| 5550 | /* Initialize NS/BSSGP side */ |
| 5551 | f_init_bssgp(); |
| 5552 | /* Initialize GPRS MS side */ |
| 5553 | f_init_gprs_ms(); |
| 5554 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5555 | |
| 5556 | /* Initialize the PCU interface abstraction */ |
| 5557 | f_init_raw(testcasename(), info_ind); |
| 5558 | |
| 5559 | /* Make sure we are not affected by full cache from previous tests */ |
| 5560 | f_pcuvty_flush_neigh_caches(); |
| 5561 | |
| 5562 | /* Establish BSSGP connection to the PCU */ |
| 5563 | f_bssgp_establish(); |
| 5564 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5565 | |
| 5566 | /* Send PACKET RESOURCE REQUEST */ |
| 5567 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5568 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5569 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5570 | |
| 5571 | /* Start NACC from MS side */ |
| 5572 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5573 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5574 | |
| 5575 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5576 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5577 | /* RIM procedure: */ |
| 5578 | as_outbound_nacc_rim_resolve(info_ind); |
| 5579 | |
| 5580 | /* Announce SI back to MS, continue NACC procedure */ |
| 5581 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 5582 | |
| 5583 | /* trigger a Pkt Cell Change Notif with different tgt cell */ |
| 5584 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 5585 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5586 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5587 | /* It should trigger RAC_CI resolution to start again: */ |
| 5588 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
| 5589 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5590 | /* PCU TBF NACC state changed, so we should next receive a dummy block: */ |
| 5591 | f_rx_rlcmac_dl_block_exp_dummy(dl_block, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5592 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5593 | /* RIM procedure: */ |
| 5594 | as_outbound_nacc_rim_resolve(info_ind); |
| 5595 | /* Transmit SI back to MS */ |
| 5596 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 5597 | |
| 5598 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5599 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5600 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5601 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5602 | f_shutdown(__BFILE__, __LINE__); |
| 5603 | } |
| 5604 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5605 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5606 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5607 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5608 | } |
| 5609 | } |
| 5610 | |
| 5611 | /* Test MS sending Pkt Cell Change Notification twice (different tgt cell) while waiting for Pkt Cell Change Continue CTRL ACK*/ |
| 5612 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice5() runs on RAW_PCU_Test_CT { |
| 5613 | var PollFnCtx pollctx; |
| 5614 | var GprsMS ms; |
| 5615 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5616 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5617 | var RlcmacDlBlock dl_block; |
| 5618 | var uint32_t sched_fn; |
| 5619 | var CtrlMessage rx_ctrl; |
| 5620 | var GsmArfcn req_arfcn := 862; |
| 5621 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5622 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5623 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5624 | if (use_old_ctrl_iface) { |
| 5625 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5626 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5627 | } |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5628 | |
| 5629 | /* Initialize NS/BSSGP side */ |
| 5630 | f_init_bssgp(); |
| 5631 | /* Initialize GPRS MS side */ |
| 5632 | f_init_gprs_ms(); |
| 5633 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5634 | |
| 5635 | /* Initialize the PCU interface abstraction */ |
| 5636 | f_init_raw(testcasename(), info_ind); |
| 5637 | |
| 5638 | /* Make sure we are not affected by full cache from previous tests */ |
| 5639 | f_pcuvty_flush_neigh_caches(); |
| 5640 | |
| 5641 | /* Establish BSSGP connection to the PCU */ |
| 5642 | f_bssgp_establish(); |
| 5643 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5644 | |
| 5645 | /* Send PACKET RESOURCE REQUEST */ |
| 5646 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5647 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5648 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5649 | |
| 5650 | /* Start NACC from MS side */ |
| 5651 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5652 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5653 | |
| 5654 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5655 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5656 | /* RIM procedure: */ |
| 5657 | as_outbound_nacc_rim_resolve(info_ind); |
| 5658 | |
| 5659 | /* Announce SI back to MS, continue NACC procedure */ |
| 5660 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 5661 | |
| 5662 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5663 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5664 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5665 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5666 | f_shutdown(__BFILE__, __LINE__); |
| 5667 | } |
| 5668 | |
| 5669 | /* trigger a Pkt Cell Change Notif with different tgt cell */ |
| 5670 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 5671 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5672 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5673 | /* It should trigger RAC_CI resolution to start again: */ |
| 5674 | /* When using new PCUIF interface for resolution, we must |
| 5675 | * PCUIF.receive() here since that's the first message in the PCUIF |
| 5676 | * queue that PCU will have sent. Calling other functions doing |
| 5677 | * PCUIF.receive() (like f_ms_tx_ul_block() below) will make them fail |
| 5678 | * due to unexpected message receive. */ |
| 5679 | if (not use_old_ctrl_iface) { |
| 5680 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
| 5681 | } |
| 5682 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5683 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5684 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5685 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5686 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5687 | } |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5688 | |
| 5689 | /* When using CTRL interface, we must schedule the ACK before (see |
| 5690 | * above) blocking here waiting for the resoltion, otherwise we'll be |
| 5691 | * too late scheduling by the time the resolution is done. */ |
| 5692 | if (use_old_ctrl_iface) { |
| 5693 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
| 5694 | } |
| 5695 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5696 | /* PCU TBF NACC state changed, so we should next receive a dummy block: */ |
| 5697 | f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 5698 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5699 | /* RIM procedure: */ |
| 5700 | as_outbound_nacc_rim_resolve(info_ind); |
| 5701 | /* Transmit SI back to MS */ |
| 5702 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 5703 | |
| 5704 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5705 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5706 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5707 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5708 | f_shutdown(__BFILE__, __LINE__); |
| 5709 | } |
| 5710 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5711 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5712 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5713 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5714 | } |
| 5715 | } |
| 5716 | |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 5717 | /* Test MS sending Pkt Cell Change Notification on an MS with an existing but unassigned (no TFI) DL TBF */ |
| 5718 | testcase TC_nacc_outbound_pkt_cell_chg_notif_unassigned_dl_tbf() runs on RAW_PCU_Test_CT { |
| 5719 | var PollFnCtx pollctx; |
| 5720 | var GprsMS ms; |
| 5721 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5722 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5723 | var RlcmacDlBlock dl_block; |
| 5724 | var uint32_t sched_fn, dl_fn; |
| 5725 | var CtrlMessage rx_ctrl; |
| 5726 | var GsmArfcn req_arfcn := 862; |
| 5727 | var uint6_t req_bsic := 43; |
| 5728 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5729 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 5730 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5731 | if (use_old_ctrl_iface) { |
| 5732 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5733 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5734 | } |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 5735 | |
| 5736 | /* Initialize NS/BSSGP side */ |
| 5737 | f_init_bssgp(); |
| 5738 | /* Initialize GPRS MS side */ |
| 5739 | f_init_gprs_ms(); |
| 5740 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5741 | |
| 5742 | /* Initialize the PCU interface abstraction */ |
| 5743 | f_init_raw(testcasename(), info_ind); |
| 5744 | |
| 5745 | /* Make sure we are not affected by full cache from previous tests */ |
| 5746 | f_pcuvty_flush_neigh_caches(); |
| 5747 | |
| 5748 | /* Establish BSSGP connection to the PCU */ |
| 5749 | f_bssgp_establish(); |
| 5750 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5751 | |
| 5752 | /* Send PACKET RESOURCE REQUEST */ |
| 5753 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5754 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5755 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5756 | |
| 5757 | /* Start NACC from MS side */ |
| 5758 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5759 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5760 | |
| 5761 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 5762 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn, req_bsic, true, use_old_ctrl_iface); |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 5763 | /* RIM procedure: */ |
| 5764 | as_outbound_nacc_rim_resolve(info_ind); |
| 5765 | |
| 5766 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 5767 | /* Make sure we leave some time for SGSN->PCU data to arrive to PCU */ |
| 5768 | f_sleep(0.1); |
| 5769 | /* rx DL assignment, don't ack it yet (keep TBF in state ASSIGN): */ |
| 5770 | f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 5771 | |
| 5772 | /* NACC: scheduler selects tx Pkt Cell Neighbor Data. Receive first one: */ |
| 5773 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, single_step := true); |
| 5774 | /* ACK DL assignment (we do it here on purpose to test tx Pkt Neigh Cell |
| 5775 | * Data with unassigned DL TBF in line above): */ |
| 5776 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5777 | /* Continue receiving Pkt Cell Neighbor Data */ |
| 5778 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, f_ms_tx_TsTrxBtsNum(ms), 1, 16); |
| 5779 | |
| 5780 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5781 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5782 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5783 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5784 | f_shutdown(__BFILE__, __LINE__); |
| 5785 | } |
| 5786 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5787 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5788 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5789 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5790 | } |
| 5791 | |
| 5792 | /* Now that we confirmed the new assignment in the dl-tbf, lets receive the data and ack it */ |
| 5793 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 5794 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 5795 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 5796 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 5797 | } |
| 5798 | |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5799 | |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 5800 | function f_do_inbound_nacc(template (value) RIM_Routing_Information tx_src_addr, template RIM_Routing_Information rx_dst_addr) |
| 5801 | runs on RAW_PCU_Test_CT |
| 5802 | { |
| 5803 | var template (value) RAN_Information_Request_RIM_Container req_cont; |
| 5804 | var template (value) PDU_BSSGP bssgp_rim_pdu; |
| 5805 | var template PDU_BSSGP bssgp_rim_pdu_expect; |
| 5806 | var template RAN_Information_RIM_Container rim_cont_expect; |
| 5807 | var RIM_Routing_Address bts_addr; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5808 | |
| 5809 | /* Send sysinfo to the PCU */ |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 5810 | var template PCUIF_Message si1_data_ind := ts_PCUIF_DATA_IND(0, 0, 0, 0, PCU_IF_SAPI_BCCH, '5506'O & si1_default, 0, 0, 0, 0, 32767); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5811 | BTS.send(si1_data_ind); |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 5812 | var template PCUIF_Message si3_data_ind := ts_PCUIF_DATA_IND(0, 0, 0, 0, PCU_IF_SAPI_BCCH, '4906'O & si3_default, 0, 0, 0, 0, 32767); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5813 | BTS.send(si3_data_ind); |
Pau Espin Pedrol | 02a6d0c | 2021-04-19 17:11:07 +0200 | [diff] [blame] | 5814 | var template PCUIF_Message si13_data_ind := ts_PCUIF_DATA_IND(0, 0, 0, 0, PCU_IF_SAPI_BCCH, '0106'O & si13_default, 0, 0, 0, 0, 32767); |
| 5815 | BTS.send(si13_data_ind); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5816 | f_sleep(1.0); |
| 5817 | |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 5818 | bts_addr := valueof(t_RIM_Routing_Address_cid(mp_gb_cfg.bvc[0].cell_id)); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5819 | |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5820 | req_cont := ts_RAN_Information_Request_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 5821 | ts_RIM_Sequence_Number(1), |
| 5822 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 5823 | ts_RIM_Protocol_Version_Number(1), |
| 5824 | tsu_RAN_Information_Request_Application_Container_NACC(mp_gb_cfg.bvc[0].cell_id), |
| 5825 | omit); |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 5826 | bssgp_rim_pdu := ts_RAN_INFORMATION_REQUEST(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, bts_addr), |
| 5827 | tx_src_addr, req_cont); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5828 | |
| 5829 | rim_cont_expect := tr_RAN_Information_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 5830 | tr_RIM_Sequence_Number(1), |
| 5831 | tr_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 5832 | tr_RIM_Protocol_Version_Number(1), |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 5833 | tru_ApplContainer_or_ApplErrContainer_NACC(tru_ApplContainer_NACC(mp_gb_cfg.bvc[0].cell_id, false, 3, si_default)), |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5834 | omit); |
| 5835 | |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 5836 | bssgp_rim_pdu_expect := tr_PDU_BSSGP_RAN_INFORMATION(rx_dst_addr, |
| 5837 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, bts_addr), |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5838 | rim_cont_expect); |
| 5839 | RIM.send(bssgp_rim_pdu); |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 5840 | timer T := 2.0; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5841 | T.start; |
| 5842 | alt { |
| 5843 | [] RIM.receive(bssgp_rim_pdu_expect) { } |
| 5844 | [] RIM.receive { |
| 5845 | setverdict(fail, "Unexpected BSSGP RIM PDU received"); |
| 5846 | } |
| 5847 | [] T.timeout { |
| 5848 | setverdict(fail, "No BSSGP RIM PDU received"); |
| 5849 | mtc.stop; |
| 5850 | } |
| 5851 | } |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 5852 | } |
| 5853 | /* Send a RIM RAN info request to the PCU and verify the response, we expect |
| 5854 | * getting the system information back which we have transfered to the PCU via |
| 5855 | * PCUIF on startup. */ |
| 5856 | testcase TC_rim_ran_info_req_single_rep() runs on RAW_PCU_Test_CT { |
| 5857 | /* Initialize NS/BSSGP side */ |
| 5858 | f_init_bssgp(); |
| 5859 | |
| 5860 | /* Initialize the PCU interface abstraction */ |
| 5861 | f_init_raw(testcasename()); |
| 5862 | |
| 5863 | /* Establish BSSGP connection to the PCU */ |
| 5864 | f_bssgp_establish(); |
| 5865 | |
| 5866 | var BssgpCellId src_cid := {ra_id := { lai := { mcc_mnc := '262F42'H, lac := 12345}, rac := 0 }, cell_id := 20962 }; |
| 5867 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src_cid)); |
| 5868 | |
| 5869 | f_do_inbound_nacc(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 5870 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr)); |
| 5871 | |
| 5872 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5873 | } |
| 5874 | |
| 5875 | /* Same as TC_rim_ran_info_req_single_rep, but using an EUTRAN eNodeB ID as |
| 5876 | * Routing information, to verify PCU handles that kind of address just fine |
| 5877 | */ |
| 5878 | testcase TC_rim_ran_info_req_single_rep_eutran() runs on RAW_PCU_Test_CT { |
| 5879 | /* Initialize NS/BSSGP side */ |
| 5880 | f_init_bssgp(); |
| 5881 | |
| 5882 | /* Initialize the PCU interface abstraction */ |
| 5883 | f_init_raw(testcasename()); |
| 5884 | |
| 5885 | /* Establish BSSGP connection to the PCU */ |
| 5886 | f_bssgp_establish(); |
| 5887 | |
| 5888 | var BssgpCellId src_cid := {ra_id := { lai := { mcc_mnc := '262F42'H, lac := 12345}, rac := 0 }, cell_id := 20962 }; |
| 5889 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_enbid(src_cid, tac := 3, gnbid := '12345678123456'O)); |
| 5890 | |
| 5891 | f_do_inbound_nacc(ts_RIM_Routing_Information(RIM_ADDR_EUTRAN_NODEB_ID, src_addr), |
| 5892 | tr_RIM_Routing_Information(RIM_ADDR_EUTRAN_NODEB_ID, src_addr)); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5893 | |
| 5894 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5895 | } |
| 5896 | |
| 5897 | /* Same as above, but in this case we simulate the rare case in which the PCU |
| 5898 | * has no system information available. We expect getting a response back but |
| 5899 | * with no system information inside. */ |
| 5900 | testcase TC_rim_ran_info_req_single_rep_no_si() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 5901 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5902 | var PCUIF_Message pcu_msg; |
| 5903 | timer T := 2.0; |
| 5904 | |
| 5905 | /* Initialize NS/BSSGP side */ |
| 5906 | f_init_bssgp(); |
| 5907 | |
| 5908 | /* Initialize the PCU interface abstraction */ |
| 5909 | f_init_raw(testcasename(), info_ind); |
| 5910 | |
| 5911 | /* Establish BSSGP connection to the PCU */ |
| 5912 | f_bssgp_establish(); |
| 5913 | |
| 5914 | /* Clear sysinfo from the PCU */ |
| 5915 | 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); |
| 5916 | BTS.send(si1_data_ind); |
| 5917 | 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); |
| 5918 | BTS.send(si3_data_ind); |
| 5919 | 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); |
| 5920 | BTS.send(si16_data_ind); |
| 5921 | f_sleep(1.0); |
| 5922 | |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 5923 | var RIM_Routing_Address dst_addr; |
| 5924 | var RIM_Routing_Address src_addr; |
| 5925 | var template (value) RAN_Information_Request_RIM_Container req_cont; |
| 5926 | var template (value) PDU_BSSGP bssgp_rim_pdu; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5927 | var template PDU_BSSGP bssgp_rim_pdu_expect; |
| 5928 | var template RAN_Information_RIM_Container rim_cont_expect; |
| 5929 | |
| 5930 | var BssgpCellId src_cid := {ra_id := { lai := { mcc_mnc := '262F42'H, lac := 12345}, rac := 0 }, cell_id := 20962 }; |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 5931 | src_addr := valueof(t_RIM_Routing_Address_cid(src_cid)); |
| 5932 | dst_addr := valueof(t_RIM_Routing_Address_cid(mp_gb_cfg.bvc[0].cell_id)); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5933 | |
| 5934 | req_cont := ts_RAN_Information_Request_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 5935 | ts_RIM_Sequence_Number(1), |
| 5936 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 5937 | ts_RIM_Protocol_Version_Number(1), |
| 5938 | tsu_RAN_Information_Request_Application_Container_NACC(mp_gb_cfg.bvc[0].cell_id), |
| 5939 | omit); |
| 5940 | bssgp_rim_pdu := ts_RAN_INFORMATION_REQUEST(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 5941 | ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 5942 | req_cont); |
| 5943 | |
| 5944 | |
| 5945 | rim_cont_expect := tr_RAN_Information_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 5946 | tr_RIM_Sequence_Number(1), |
| 5947 | tr_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 5948 | tr_RIM_Protocol_Version_Number(1), |
| 5949 | tru_ApplContainer_or_ApplErrContainer_NACC(tru_ApplContainer_NACC(mp_gb_cfg.bvc[0].cell_id, false, 0, ''O)), |
| 5950 | omit); |
| 5951 | |
| 5952 | bssgp_rim_pdu_expect := tr_PDU_BSSGP_RAN_INFORMATION(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 5953 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 5954 | rim_cont_expect); |
| 5955 | RIM.send(bssgp_rim_pdu); |
| 5956 | T.start; |
| 5957 | alt { |
| 5958 | [] RIM.receive(bssgp_rim_pdu_expect) { } |
| 5959 | [] RIM.receive { |
| 5960 | setverdict(fail, "Unexpected BSSGP RIM PDU received"); |
| 5961 | } |
| 5962 | [] T.timeout { |
| 5963 | setverdict(fail, "No BSSGP RIM PDU received"); |
| 5964 | mtc.stop; |
| 5965 | } |
| 5966 | } |
| 5967 | |
| 5968 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5969 | } |
| 5970 | |
Pau Espin Pedrol | 3aa61c6 | 2021-08-25 19:24:03 +0200 | [diff] [blame] | 5971 | /* Verify TRX!=C0 don't schedule rlcmac blocks if no TBF attached to it. See OS#4772, SYS#4919 */ |
| 5972 | testcase TC_pdch_energy_saving() runs on RAW_PCU_Test_CT { |
| 5973 | var PCUIF_info_ind info_ind; |
| 5974 | var template (value) TsTrxBtsNum nr; |
| 5975 | var RlcmacDlBlock dl_block; |
| 5976 | var BTS_PDTCH_Block data_msg; |
| 5977 | timer T; |
| 5978 | |
| 5979 | /* Initialize NS/BSSGP side */ |
| 5980 | f_init_bssgp(); |
| 5981 | |
| 5982 | info_ind := valueof(ts_PCUIF_INFO_default); |
| 5983 | /* The 2 first TRX are enabled. */ |
| 5984 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (2 .. 7)); |
| 5985 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
| 5986 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 1); |
| 5987 | |
| 5988 | /* Initialize the PCU interface abstraction */ |
| 5989 | f_init_raw(testcasename(), info_ind); |
| 5990 | |
| 5991 | /* Establish BSSGP connection to the PCU */ |
| 5992 | f_bssgp_establish(); |
| 5993 | |
| 5994 | /* Verify C0 gets always dummy blocks: */ |
| 5995 | nr := ts_TsTrxBtsNum(ts_nr := 7, trx_nr := 0, bts_nr := 0, blk_nr := 0); |
| 5996 | f_rx_rlcmac_dl_block_exp_dummy(dl_block, nr := nr); |
| 5997 | |
| 5998 | /* TRX1 doesn't send dummy blocks when not needed, in order to honour energy saving: */ |
| 5999 | nr.trx_nr := 1; |
| 6000 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 6001 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 6002 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), block_nr := nr.blk_nr)); |
| 6003 | T.start(0.5); |
| 6004 | alt { |
| 6005 | [] as_rx_fail_dummy(nr); |
| 6006 | [] BTS.receive { |
| 6007 | setverdict(fail, "Unexpected block from BTS"); |
| 6008 | f_shutdown(__BFILE__, __LINE__); |
| 6009 | } |
| 6010 | [] T.timeout { |
| 6011 | setverdict(pass); |
| 6012 | } |
| 6013 | } |
| 6014 | |
| 6015 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6016 | } |
| 6017 | |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 6018 | /* Test stats for available and occupied PDCHs */ |
| 6019 | testcase TC_stat_pdch_avail_occ() runs on RAW_PCU_Test_CT { |
| 6020 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 6021 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 6022 | |
| 6023 | /* Initialize NS/BSSGP side */ |
| 6024 | f_init_bssgp(); |
| 6025 | |
| 6026 | /* Only 1 TRX with 8 PDCH */ |
| 6027 | f_PCUIF_PDCHMask_set(info_ind, '11111111'B, 0); |
| 6028 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 6029 | |
Oliver Smith | 72d0c69 | 2021-09-08 10:03:52 +0200 | [diff] [blame] | 6030 | /* Allocate 4 GprsMS instances */ |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 6031 | f_init_gprs_ms(4); |
| 6032 | |
| 6033 | /* Initialize the PCU interface abstraction */ |
| 6034 | f_init_raw(testcasename(), info_ind); |
| 6035 | |
| 6036 | /* Reset stats */ |
| 6037 | f_statsd_reset(); |
| 6038 | |
| 6039 | /* Establish BSSGP */ |
| 6040 | f_bssgp_establish(); |
| 6041 | |
| 6042 | /* 8 PDCHs available, 0 occupied */ |
| 6043 | var StatsDExpects expect := { |
| 6044 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
| 6045 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 0, max := 0 } |
| 6046 | }; |
| 6047 | f_statsd_expect(expect); |
| 6048 | |
| 6049 | /* Establish an Uplink TBF for each GprsMS instance */ |
| 6050 | f_multi_ms_bssgp_register(); |
| 6051 | f_multi_ms_establish_tbf(do_activate := false); |
| 6052 | |
| 6053 | /* 4 PDCHs occupied */ |
| 6054 | expect := { |
| 6055 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
| 6056 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 4, max := 4 } |
| 6057 | }; |
| 6058 | f_statsd_expect(expect); |
| 6059 | |
| 6060 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6061 | } |
| 6062 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6063 | control { |
| 6064 | execute( TC_pcuif_suspend() ); |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 6065 | execute( TC_pcuif_suspend_active_tbf() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6066 | execute( TC_ta_ptcch_idle() ); |
| 6067 | execute( TC_ta_rach_imm_ass() ); |
Vadim Yanitskiy | 866f870 | 2021-05-26 14:50:27 +0200 | [diff] [blame] | 6068 | execute( TC_ta_ul_ack_nack_first_block() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6069 | execute( TC_ta_idle_dl_tbf_ass() ); |
| 6070 | execute( TC_ta_ptcch_ul_multi_tbf() ); |
| 6071 | execute( TC_cs_lqual_ul_tbf() ); |
| 6072 | execute( TC_cs_initial_ul() ); |
| 6073 | execute( TC_cs_max_ul() ); |
Pau Espin Pedrol | 7512259 | 2020-11-03 15:22:59 +0100 | [diff] [blame] | 6074 | execute( TC_cs_initial_dl() ); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 6075 | execute( TC_cs_max_dl() ); |
| 6076 | execute( TC_dl_cs1_to_cs4() ); |
Pau Espin Pedrol | 2354d6a | 2020-11-05 18:36:59 +0100 | [diff] [blame] | 6077 | execute( TC_mcs_initial_ul() ); |
Pau Espin Pedrol | db15fa7 | 2020-11-11 12:58:34 +0100 | [diff] [blame] | 6078 | execute( TC_mcs_max_ul() ); |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 6079 | execute( TC_mcs_initial_dl() ); |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 6080 | execute( TC_mcs_max_dl() ); |
Pau Espin Pedrol | 1451f9f | 2021-05-11 11:52:37 +0200 | [diff] [blame] | 6081 | execute( TC_t3141() ); |
Pau Espin Pedrol | f30fa1d | 2021-03-03 19:55:11 +0100 | [diff] [blame] | 6082 | execute( TC_n3101_max_t3169() ); |
Pau Espin Pedrol | cc895df | 2021-04-20 12:58:32 +0200 | [diff] [blame] | 6083 | execute( TC_n3103_max_t3169() ); |
Pau Espin Pedrol | 84a8c3c | 2021-03-01 17:22:29 +0100 | [diff] [blame] | 6084 | execute( TC_x2031_t3191() ); |
| 6085 | execute( TC_zero_x2031_t3191() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6086 | execute( TC_t3193() ); |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 6087 | execute( TC_n3105_max_t3195() ); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 6088 | execute( TC_countdown_procedure() ); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 6089 | execute( TC_ul_all_sizes() ); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 6090 | execute( TC_ul_data_toolong_fills_padding() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6091 | execute( TC_mo_ping_pong() ); |
| 6092 | execute( TC_mo_ping_pong_with_ul_racap() ); |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 6093 | execute( TC_force_two_phase_access() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6094 | execute( TC_mt_ping_pong() ); |
| 6095 | execute( TC_mt_ping_pong_with_dl_racap() ); |
Pau Espin Pedrol | e1195bb | 2020-07-07 13:27:18 +0200 | [diff] [blame] | 6096 | execute( TC_ul_intermediate_retrans() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6097 | execute( TC_imm_ass_dl_block_retrans() ); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 6098 | execute( TC_dl_flow_more_blocks() ); |
Pau Espin Pedrol | e1195bb | 2020-07-07 13:27:18 +0200 | [diff] [blame] | 6099 | execute( TC_ul_flow_multiple_llc_blocks() ); |
Pau Espin Pedrol | 90fdfed | 2021-03-02 17:29:32 +0100 | [diff] [blame] | 6100 | execute( TC_dl_no_ack_retrans_imm_ass() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6101 | execute( TC_paging_cs_from_bts() ); |
| 6102 | execute( TC_paging_cs_from_sgsn_sign_ptmsi() ); |
| 6103 | execute( TC_paging_cs_from_sgsn_sign() ); |
| 6104 | execute( TC_paging_cs_from_sgsn_ptp() ); |
| 6105 | execute( TC_paging_ps_from_sgsn_sign_ptmsi() ); |
| 6106 | execute( TC_paging_ps_from_sgsn_sign() ); |
| 6107 | execute( TC_paging_ps_from_sgsn_ptp() ); |
Oliver Smith | e1a77c4 | 2021-07-28 13:36:09 +0200 | [diff] [blame] | 6108 | if (mp_osmo_pcu_newer_than_0_9_0) { |
| 6109 | execute( TC_paging_pch_timeout() ); |
| 6110 | } |
Vadim Yanitskiy | dbd4b24 | 2020-10-31 05:44:58 +0700 | [diff] [blame] | 6111 | execute( TC_paging_cs_multi_ms_imsi_tmsi() ); |
| 6112 | execute( TC_paging_cs_multi_ms_imsi() ); |
| 6113 | execute( TC_paging_cs_multi_ms_tmsi() ); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 6114 | execute( TC_bssgp_dl_unitdata_with_valid_imsi() ); |
| 6115 | execute( TC_bssgp_dl_unitdata_with_invalid_imsi() ); |
Pau Espin Pedrol | 2e459d6 | 2020-11-30 19:34:16 +0100 | [diff] [blame] | 6116 | execute( TC_dl_gprs_data_no_llc_ui_dummy() ); |
| 6117 | execute( TC_dl_egprs_data_no_llc_ui_dummy() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6118 | |
| 6119 | /* EGPRS specific test cases */ |
| 6120 | execute( TC_egprs_pkt_chan_req_signalling() ); |
| 6121 | execute( TC_egprs_pkt_chan_req_one_phase() ); |
| 6122 | execute( TC_egprs_pkt_chan_req_two_phase() ); |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 6123 | execute( TC_egprs_pkt_chan_req_reject_content() ); |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 6124 | execute( TC_egprs_pkt_chan_req_reject_emergency() ); |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 6125 | execute( TC_egprs_pkt_chan_req_reject_exhaustion() ); |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 6126 | |
| 6127 | execute( TC_mo_ping_pong_with_ul_racap_egprs_only() ); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 6128 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 6129 | /* Immediate Assignment on AGCH/PCH */ |
| 6130 | execute( TC_pcuif_fh_imm_ass_ul_egprs() ); |
| 6131 | execute( TC_pcuif_fh_imm_ass_ul() ); |
| 6132 | execute( TC_pcuif_fh_imm_ass_dl() ); |
| 6133 | /* Packet Uplink/Downlink Assignment on PACCH */ |
| 6134 | execute( TC_pcuif_fh_pkt_ass_ul() ); |
| 6135 | execute( TC_pcuif_fh_pkt_ass_dl() ); |
| 6136 | execute( TC_multitrx_multims_alloc() ); |
| 6137 | execute( TC_dl_multislot_tbf_ms_class_from_sgsn() ); |
| 6138 | execute( TC_dl_multislot_tbf_ms_class_from_2phase() ); |
| 6139 | execute( TC_ul_multislot_tbf_ms_class_from_2phase() ); |
| 6140 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 6141 | execute( TC_multiplex_dl_gprs_egprs() ); |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 6142 | |
| 6143 | execute( TC_pcuif_info_ind_subsequent() ); |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 6144 | execute( TC_nacc_outbound_success() ); |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 6145 | execute( TC_nacc_outbound_success_no_ctrl_ack() ); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 6146 | execute( TC_nacc_outbound_success_twice() ); |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 6147 | execute( TC_nacc_outbound_success_twice_nocache() ); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 6148 | execute( TC_nacc_outbound_rac_ci_resolve_timeout() ); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 6149 | execute( TC_nacc_outbound_si_resolve_timeout() ); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6150 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup() ); |
| 6151 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup2() ); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6152 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup3() ); |
| 6153 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup4() ); |
| 6154 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup5() ); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6155 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice() ); |
| 6156 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice2() ); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6157 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice3() ); |
| 6158 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice4() ); |
| 6159 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice5() ); |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 6160 | execute( TC_nacc_outbound_pkt_cell_chg_notif_unassigned_dl_tbf() ); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame^] | 6161 | if (mp_ctrl_neigh_ip != "") { /* PCU using old CTRL neigh addr resolution iface */ |
| 6162 | execute( TC_nacc_outbound_rac_ci_resolve_conn_refused() ); |
| 6163 | execute( TC_nacc_outbound_rac_ci_resolve_fail_parse_response() ); |
| 6164 | } |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6165 | |
| 6166 | execute( TC_rim_ran_info_req_single_rep() ); |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 6167 | execute( TC_rim_ran_info_req_single_rep_eutran() ); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6168 | execute( TC_rim_ran_info_req_single_rep_no_si() ); |
Pau Espin Pedrol | 3aa61c6 | 2021-08-25 19:24:03 +0200 | [diff] [blame] | 6169 | |
| 6170 | execute (TC_pdch_energy_saving() ); |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 6171 | |
| 6172 | execute( TC_stat_pdch_avail_occ() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6173 | } |
| 6174 | |
Harald Welte | a419df2 | 2019-03-21 17:23:04 +0100 | [diff] [blame] | 6175 | } |