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); |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame^] | 400 | var BTS_PDTCH_Block data_msg; |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 401 | var RlcmacDlBlock dl_block; |
| 402 | var octetstring data := f_rnd_octstring(10); |
| 403 | var uint32_t sched_fn; |
| 404 | var uint32_t dl_fn; |
| 405 | var GprsMS ms; |
| 406 | timer T; |
| 407 | |
| 408 | /* Initialize NS/BSSGP side */ |
| 409 | f_init_bssgp(); |
| 410 | /* Initialize GPRS MS side */ |
| 411 | f_init_gprs_ms(); |
| 412 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 413 | |
| 414 | /* Initialize the PCU interface abstraction */ |
| 415 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 416 | |
| 417 | /* Establish BSSGP connection to the PCU */ |
| 418 | f_bssgp_establish(); |
| 419 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 420 | |
| 421 | /* Establish an Uplink TBF */ |
| 422 | f_ms_establish_ul_tbf(ms); |
| 423 | |
| 424 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 425 | contention resoultion) and make sure it is ACKED fine */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 426 | 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] | 427 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 428 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 429 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 430 | |
| 431 | /* UL block should be received in SGSN */ |
| 432 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id)); |
| 433 | |
| 434 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 435 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 436 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 437 | |
| 438 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 439 | f_sleep(X2002); |
| 440 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 441 | |
| 442 | /* MS has moved to CS, it sent SUSP REQ to BTS and PCU gets it, TBF is freed: */ |
| 443 | BTS.send(ts_PCUIF_SUSP_REQ(0, ms.tlli, ra_id, 0)); |
| 444 | |
| 445 | T.start(2.0); |
| 446 | alt { |
| 447 | [] BSSGP_GLOBAL[0].receive(tr_BSSGP_SUSPEND(ms.tlli, mp_gb_cfg.bvc[0].cell_id.ra_id)) { |
| 448 | setverdict(pass); |
| 449 | } |
| 450 | [] T.timeout { |
| 451 | setverdict(fail, "Timeout waiting for BSSGP SUSPEND"); |
| 452 | f_shutdown(__BFILE__, __LINE__); |
| 453 | } |
| 454 | } |
| 455 | |
| 456 | /* Make sure we don't receive data for that TBF since it was released |
| 457 | * before. Also check our TBF is not polled for UL. */ |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame^] | 458 | f_pcuif_rx_data_req_pdtch(data_msg); |
| 459 | if (mp_osmo_pcu_newer_than_0_9_0 and data_msg.dl_block == omit) { |
| 460 | /* IDLE block, expected on new PCU versions */ |
| 461 | } else if (not mp_osmo_pcu_newer_than_0_9_0 and match(data_msg.dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 462 | /* Dummy RLCMAC block, expected on older PCU versions */ |
| 463 | if (data_msg.dl_block.ctrl.mac_hdr.usf != USF_UNUSED) { |
| 464 | setverdict(fail, "Unexpected USF ", data_msg.dl_block.ctrl.mac_hdr.usf); |
| 465 | f_shutdown(__BFILE__, __LINE__); |
| 466 | } |
| 467 | } else { |
| 468 | setverdict(fail, "Unexpected dl_block", data_msg.dl_block); |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 469 | f_shutdown(__BFILE__, __LINE__); |
| 470 | } |
| 471 | |
| 472 | /* New data arrives, PCU should page the MS since no TBF active exists: */ |
| 473 | /* Send some more data, it will never reach the MS */ |
| 474 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 475 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 476 | |
| 477 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 478 | } |
| 479 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 480 | /* Test of correct Timing Advance at the time of TBF establishment |
| 481 | * (derived from timing offset of the Access Burst). */ |
| 482 | 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] | 483 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 484 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 485 | /* Initialize GPRS MS side */ |
| 486 | f_init_gprs_ms(); |
| 487 | 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] | 488 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 489 | 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] | 490 | |
| 491 | /* We cannot send too many TBF requests in a short time because |
| 492 | * at some point the PCU will fail to allocate a new TBF. */ |
| 493 | for (var TimingAdvance ta := 0; ta < 64; ta := ta + 16) { |
| 494 | /* Establish an Uplink TBF (send RACH.ind with current TA) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 495 | ms.ta := ta; |
Vadim Yanitskiy | 84d1dd5 | 2020-05-28 21:09:22 +0700 | [diff] [blame] | 496 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 497 | |
| 498 | /* Make sure Timing Advance IE matches out expectations */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 499 | 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] | 500 | setverdict(fail, "Timing Advance mismatch: ", |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 501 | ms.ul_tbf.rr_imm_ass.payload.imm_ass.timing_advance, |
Vadim Yanitskiy | 8685b38 | 2020-05-06 16:53:26 +0700 | [diff] [blame] | 502 | " vs expected ", ta); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 503 | break; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 504 | } |
| 505 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 506 | |
| 507 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 508 | } |
| 509 | |
Vadim Yanitskiy | 866f870 | 2021-05-26 14:50:27 +0200 | [diff] [blame] | 510 | /* Verify Timing Advance value indicated in Packet Uplink ACK/NACK message |
| 511 | * sent in response to the first Uplink block after resource allocation. */ |
| 512 | testcase TC_ta_ul_ack_nack_first_block() runs on RAW_PCU_Test_CT { |
| 513 | var GprsMS ms := valueof(t_GprsMS_def); |
| 514 | var PacketUlAckNack ul_ack_nack; |
| 515 | var PacketTimingAdvance pkt_ta; |
| 516 | var RlcmacDlBlock dl_block; |
| 517 | var uint32_t sched_fn; |
| 518 | |
| 519 | /* Initialize NS/BSSGP side */ |
| 520 | f_init_bssgp(); |
| 521 | |
| 522 | /* Initialize the PCU interface abstraction */ |
| 523 | f_init_raw(testcasename()); |
| 524 | |
| 525 | /* Establish BSSGP connection to the PCU */ |
| 526 | f_bssgp_establish(); |
| 527 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 528 | |
| 529 | /* Establish an Uplink TBF */ |
| 530 | f_ms_establish_ul_tbf(ms); |
| 531 | |
| 532 | /* In a busy network, there can be a significant delay between resource |
| 533 | * allocation (Packet Uplink Assignment above) and the actual time when |
| 534 | * the MS is allowed to transmit the first Uplink data block. */ |
| 535 | |
| 536 | /* Simulate a delay > 0 */ |
| 537 | ms.ta := 2; |
| 538 | |
| 539 | /* We're in One-Phase Access contention resoultion, include TLLI */ |
| 540 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := true, fn := ms.ul_tbf.start_time_fn); |
| 541 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 542 | |
| 543 | ul_ack_nack := dl_block.ctrl.payload.u.ul_ack_nack; |
| 544 | if (ispresent(ul_ack_nack.gprs.pkt_ta)) { |
| 545 | pkt_ta := ul_ack_nack.gprs.pkt_ta; |
| 546 | } else if (ispresent(ul_ack_nack.egprs.pkt_ta)) { |
| 547 | pkt_ta := ul_ack_nack.egprs.pkt_ta; |
| 548 | } else { |
| 549 | setverdict(fail, "PacketTimingAdvance IE is not present"); |
| 550 | f_shutdown(__BFILE__, __LINE__); |
| 551 | } |
| 552 | |
| 553 | if (not ispresent(pkt_ta.val)) { |
| 554 | setverdict(fail, "Timing Advance value is not present"); |
| 555 | f_shutdown(__BFILE__, __LINE__); |
| 556 | } else if (pkt_ta.val != ms.ta) { |
| 557 | setverdict(fail, "Timing Advance mismatch: expected ", |
| 558 | ms.ta, ", but received ", pkt_ta.val); |
| 559 | f_shutdown(__BFILE__, __LINE__); |
| 560 | } |
| 561 | } |
| 562 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 563 | /* Verify Timing Advance value(s) indicated during the packet Downlink assignment |
| 564 | * procedure as per 3GPP TS 44.018, section 3.5.3. There seems to be a bug in the |
| 565 | * IUT that causes it to send an unreasonable Timing Advance value > 0 despite |
| 566 | * no active TBF exists at the moment of establishment (idle mode). */ |
| 567 | 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] | 568 | var GprsMS ms := valueof(t_GprsMS_def); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 569 | |
| 570 | /* Initialize NS/BSSGP side */ |
| 571 | f_init_bssgp(); |
| 572 | |
| 573 | /* Initialize the PCU interface abstraction */ |
| 574 | f_init_raw(testcasename()); |
| 575 | |
| 576 | /* Establish BSSGP connection to the PCU */ |
| 577 | f_bssgp_establish(); |
Vadim Yanitskiy | 37f3333 | 2021-02-21 00:04:23 +0100 | [diff] [blame] | 578 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 579 | |
| 580 | /* SGSN sends some DL data, PCU will initiate Packet Downlink |
| 581 | * Assignment on CCCH (PCH). We don't care about the payload. */ |
Vadim Yanitskiy | 37f3333 | 2021-02-21 00:04:23 +0100 | [diff] [blame] | 582 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, f_rnd_octstring(10))); |
| 583 | 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] | 584 | |
| 585 | /* Make sure that Timing Advance is 0 (the actual value is not known yet). |
| 586 | * As per 3GPP S 44.018, section 3.5.3.1.2, the network *shall* initiate |
| 587 | * 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] | 588 | 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] | 589 | setverdict(fail, "Timing Advance value doesn't match"); |
| 590 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 591 | |
| 592 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 593 | } |
| 594 | |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame^] | 595 | /* Verify that the PCU generates idle blocks in PTCCH/D |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 596 | * while neither Uplink nor Downlink TBF is established. */ |
| 597 | testcase TC_ta_ptcch_idle() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 598 | var BTS_PTCCH_Block pcu_msg; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 599 | timer T; |
| 600 | |
| 601 | /* Initialize the PCU interface abstraction */ |
| 602 | f_init_raw(testcasename()); |
| 603 | |
| 604 | /* Sent an RTS.req for PTCCH/D */ |
| 605 | BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7, |
| 606 | sapi := PCU_IF_SAPI_PTCCH, fn := 0, |
| 607 | arfcn := 871, block_nr := 0)); |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 608 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 609 | T.start(5.0); |
| 610 | alt { |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame^] | 611 | [] BTS.receive(tr_PCUIF_DATA_PTCCH(0, |
| 612 | tr_PCUIF_DATA(0, 7, sapi := PCU_IF_SAPI_PTCCH), |
| 613 | omit)) { |
| 614 | if (not mp_osmo_pcu_newer_than_0_9_0) { |
| 615 | setverdict(fail, "Expected PTCCH/D block instead of IDLE block"); |
| 616 | f_shutdown(__BFILE__, __LINE__); |
| 617 | } |
| 618 | } |
| 619 | [] as_rx_ptcch(pcu_msg, tr_PTCCHDownlinkMsg) { |
| 620 | if (mp_osmo_pcu_newer_than_0_9_0) { |
| 621 | setverdict(fail, "Expected IDLE block instead of PTCCH/D block"); |
| 622 | f_shutdown(__BFILE__, __LINE__); |
| 623 | } |
| 624 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 625 | [] BTS.receive(PCUIF_Message:?) { repeat; } |
| 626 | [] T.timeout { |
| 627 | setverdict(fail, "Timeout waiting for a PTCCH/D block"); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 628 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 629 | } |
| 630 | } |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 631 | log("Decoded PTCCH/D message: ", pcu_msg.dl_block); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 632 | |
| 633 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 634 | } |
| 635 | |
| 636 | /* Test of correct Timing Advance during an active Uplink TBF. |
| 637 | * |
| 638 | * Unlike the circuit-switched domain, Uplink transmissions on PDCH time-slots |
| 639 | * are not continuous and there can be long time gaps between them. This happens |
| 640 | * due to a bursty nature of packet data. The actual Timing Advance of a MS may |
| 641 | * significantly change between such rare Uplink transmissions, so GPRS introduces |
| 642 | * additional mechanisms to control Timing Advance, and thus reduce interference |
| 643 | * between neighboring TDMA time-slots. |
| 644 | * |
| 645 | * At the moment of Uplink TBF establishment, initial Timing Advance is measured |
| 646 | * from ToA (Timing of Arrival) of an Access Burst. This is covered by another |
| 647 | * test case - TC_ta_rach_imm_ass. In response to that Access Burst the network |
| 648 | * sends Immediate Assignment on AGCH, which _may_ contain Timing Advance Index |
| 649 | * among with the initial Timing Advance value. And here PTCCH comes to play. |
| 650 | * |
| 651 | * PTCCH is a unidirectional channel on which the network can instruct a sub-set |
| 652 | * of 16 MS (whether TBFs are active or not) to adjust their Timing Advance |
| 653 | * continuously. To ensure continuous measurements of the signal propagation |
| 654 | * delay, the MSs shall transmit Access Bursts on Uplink (PTCCH/U) on sub-slots |
| 655 | * defined by an assigned Timing Advance Index (see 3GPP TS 45.002). |
| 656 | * |
| 657 | * The purpose of this test case is to verify the assignment of Timing Advance |
| 658 | * Index, and the process of Timing Advance notification on PTCCH/D. The MTC |
| 659 | * first establishes several Uplink TBFs, but does not transmit any Uplink |
| 660 | * blocks on them. During 4 TDMA multi-frame periods the MTC is sending RACH |
| 661 | * indications to the PCU, checking the correctness of two received PTCCH/D |
| 662 | * messages (period of PTCCH/D is two multi-frames). |
| 663 | */ |
| 664 | |
| 665 | /* List of ToA values for Access Bursts to be sent on PTCCH/U, |
| 666 | * each ToA (Timing of Arrival) value is in units of 1/4 of |
| 667 | * a symbol (i.e. 1 symbol is 4 QTA units). */ |
| 668 | type record length(16) of int16_t PTCCH_TAI_ToA_MAP; |
| 669 | const PTCCH_TAI_ToA_MAP ptcch_toa_map_def := { |
| 670 | 0, 0, 0, 0, |
| 671 | 0, 0, 0, 0, |
| 672 | 0, 0, 0, 0, |
| 673 | 0, 0, 0, 0 |
| 674 | }; |
| 675 | |
| 676 | private altstep as_ta_ptcch(uint8_t bts_nr := 0, uint8_t trx_nr := 0, uint8_t ts_nr := 7, |
| 677 | in PTCCH_TAI_ToA_MAP toa_map := ptcch_toa_map_def) |
| 678 | runs on RAW_PCU_Test_CT { |
| 679 | var RAW_PCU_Event event; |
| 680 | var integer ss; |
| 681 | |
| 682 | /* Send Access Bursts on PTCCH/U for every TA Index */ |
| 683 | [] BTS.receive(tr_RAW_PCU_EV(TDMA_EV_PTCCH_UL_BURST)) -> value event { |
| 684 | ss := f_tdma_ptcch_fn2ss(event.data.tdma_fn); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 685 | if (ss < 0) { /* Shall not happen */ |
| 686 | f_shutdown(__BFILE__, __LINE__); |
| 687 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 688 | |
| 689 | log("Sending an Access Burst on PTCCH/U", |
| 690 | ", sub-slot=", ss, " (TAI)", |
| 691 | ", fn=", event.data.tdma_fn, |
| 692 | ", ToA=", toa_map[ss], " (QTA)"); |
| 693 | /* TODO: do we care about RA and burst format? */ |
| 694 | BTS.send(ts_PCUIF_RACH_IND(bts_nr, trx_nr, ts_nr, |
| 695 | ra := oct2int('3A'O), |
| 696 | is_11bit := 0, |
| 697 | burst_type := BURST_TYPE_0, |
| 698 | fn := event.data.tdma_fn, |
| 699 | arfcn := 871, |
| 700 | qta := toa_map[ss], |
| 701 | sapi := PCU_IF_SAPI_PTCCH)); |
| 702 | repeat; |
| 703 | } |
| 704 | } |
| 705 | |
| 706 | private function f_TC_ta_ptcch_ul_multi_tbf(in PTCCH_TAI_ToA_MAP ptcch_toa_map, |
| 707 | template PTCCHDownlinkMsg t_ta_msg) |
| 708 | runs on RAW_PCU_Test_CT { |
| 709 | var PTCCHDownlinkMsg ta_msg; |
| 710 | var PCUIF_Message pcu_msg; |
| 711 | timer T; |
| 712 | |
| 713 | /* First, send an RTS.req for the upcoming PTCCH/D block */ |
| 714 | BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7, |
| 715 | sapi := PCU_IF_SAPI_PTCCH, fn := 0, |
| 716 | arfcn := 871, block_nr := 0)); |
| 717 | T.start(2.0); |
| 718 | alt { |
| 719 | /* Keep sending of Access Bursts during two multi-frames (period of PTCCH/D) |
| 720 | * with increasing ToA (Timing of Arrival) values: 0, 7, 14, 28, 35... */ |
| 721 | [] as_ta_ptcch(bts_nr := 0, trx_nr := 0, ts_nr := 7, toa_map := ptcch_toa_map); |
| 722 | /* In the end of 2nd multi-frame we should receive a PTCCH/D block */ |
| 723 | [] BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7, |
| 724 | sapi := PCU_IF_SAPI_PTCCH)) -> value pcu_msg { |
| 725 | ta_msg := dec_PTCCHDownlinkMsg(pcu_msg.u.data_req.data); |
| 726 | log("Rx PTCCH/D message: ", ta_msg); |
| 727 | |
| 728 | /* Make sure Timing Advance values match our expectations */ |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 729 | if (not match(ta_msg, t_ta_msg)) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 730 | setverdict(fail, "PTCCH/D message does not match: ", t_ta_msg); |
| 731 | } |
| 732 | } |
| 733 | [] BTS.receive { repeat; } |
| 734 | [] T.timeout { |
| 735 | setverdict(fail, "Timeout waiting for a PTCCH/D block"); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 736 | } |
| 737 | } |
| 738 | } |
| 739 | |
| 740 | testcase TC_ta_ptcch_ul_multi_tbf() runs on RAW_PCU_Test_CT { |
| 741 | var template PacketUlAssign t_ul_tbf_ass; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 742 | var GprsMS ms; |
| 743 | |
| 744 | /* Initialize GPRS MS side */ |
| 745 | f_init_gprs_ms(); |
| 746 | ms := g_ms[0]; /* We only use first MS in this test */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 747 | |
| 748 | /* Initialize the PCU interface abstraction */ |
| 749 | f_init_raw(testcasename()); |
| 750 | |
| 751 | /* Enable forwarding of PTCCH/U TDMA events to us */ |
| 752 | BTS.send(ts_RAW_PCU_CMD(TDMA_CMD_ENABLE_PTCCH_UL_FWD)); |
| 753 | |
| 754 | /* Establish 7 Uplink TBFs (USF flag is 3 bits long, '111'B is reserved) */ |
| 755 | for (var integer i := 0; i < 7; i := i + 1) { |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 756 | /* Establish an Uplink TBF */ |
| 757 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 758 | |
| 759 | /* We expect incremental TFI/USF assignment (dynamic allocation) */ |
| 760 | t_ul_tbf_ass := tr_PacketUlDynAssign(tfi := i, usf := i); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 761 | 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] | 762 | setverdict(fail, "Failed to match Packet Uplink Assignment for #", i); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 763 | break; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 764 | } |
| 765 | |
| 766 | /* 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] | 767 | if (ms.ul_tbf.ass.ccch.dynamic.ta_index != i) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 768 | setverdict(fail, "Failed to match Timing Advance Index for #", i); |
| 769 | /* Keep going, the current OsmoPCU does not assign TA Index */ |
| 770 | } |
| 771 | } |
| 772 | |
| 773 | /* Prepare a list of ToA values for Access Bursts to be sent on PTCCH/U */ |
| 774 | var PTCCH_TAI_ToA_MAP toa_map := ptcch_toa_map_def; |
| 775 | for (var integer i := 0; i < 7; i := i + 1) { |
| 776 | /* ToA in units of 1/4 of a symbol */ |
| 777 | toa_map[i] := (i + 1) * 7 * 4; |
| 778 | } |
| 779 | |
| 780 | /* Now we have all 7 TBFs established in one-phase access mode, |
| 781 | * however we will not be sending any data on them. Instead, we |
| 782 | * will be sending RACH.ind on PTCCH/U during 4 multi-frame |
| 783 | * periods (TAI 0..8), and then will check two PTCCH/D blocks. |
| 784 | * |
| 785 | * Why not 4 TBFs at once? Because Uplink is delayed by 3 TDMA |
| 786 | * time-slots, so at the moment of scheduling a PTCCH/D block |
| 787 | * the PCU has odd number of PTCCH/U Access Bursts received. */ |
| 788 | f_TC_ta_ptcch_ul_multi_tbf(toa_map, tr_PTCCHDownlinkMsg( |
| 789 | tai0_ta := 7, tai1_ta := 14, tai2_ta := 21, |
| 790 | /* Other values are not known (yet) */ |
| 791 | tai3_ta := ?)); |
| 792 | f_TC_ta_ptcch_ul_multi_tbf(toa_map, tr_PTCCHDownlinkMsg( |
| 793 | tai0_ta := 7, tai1_ta := 14, tai2_ta := 21, |
| 794 | tai3_ta := 28, tai4_ta := 35, tai5_ta := 42, |
| 795 | /* Other values are out of our interest */ |
| 796 | tai6_ta := ?)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 797 | |
| 798 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 799 | } |
| 800 | |
| 801 | /* Default link quality adaptation (Coding Scheme) ranges (inclusive). |
| 802 | * OsmoPCU (VTY): cs link-quality-ranges cs1 6 cs2 5 8 cs3 7 13 cs4 12 |
| 803 | * |
| 804 | * NOTE: the ranges are intentionally overlapping because OsmoPCU |
| 805 | * does not change CS/MCS on the range borders (5-6, 7-8, 12-13). */ |
| 806 | private template integer CS1_lqual_dB_range := (-infinity .. 6); |
| 807 | private template integer CS2_lqual_dB_range := (5 .. 8); |
| 808 | private template integer CS3_lqual_dB_range := (7 .. 13); |
| 809 | private template integer CS4_lqual_dB_range := (12 .. infinity); |
| 810 | |
| 811 | 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] | 812 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 813 | var GprsMS ms; |
| 814 | var uint32_t unused_fn, sched_fn; |
| 815 | var uint4_t cv; |
| 816 | |
| 817 | /* Initialize GPRS MS side */ |
| 818 | f_init_gprs_ms(); |
| 819 | 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] | 820 | |
| 821 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 822 | 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] | 823 | |
| 824 | f_pcuvty_set_allowed_cs_mcs(); |
| 825 | f_pcuvty_set_link_quality_ranges(); |
| 826 | |
| 827 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 828 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 829 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 830 | |
| 831 | /* The actual / old link quality values. We need to keep track of the old |
| 832 | * (basically previous) link quality value, because OsmoPCU actually |
| 833 | * changes the coding scheme if not only the actual, but also the old |
| 834 | * value leaves the current link quality range (window). */ |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 835 | var integer lqual_old; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 836 | ms.lqual_cb := 0; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 837 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 838 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 839 | contention resoultion) and make sure it is ACKED fine. */ |
| 840 | /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
| 841 | /* 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] | 842 | 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] | 843 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 844 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 845 | 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] | 846 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 847 | /* 16 UL blocks (0 .. 15 dB, step = 1 cB) */ |
| 848 | for (var integer i := 150; i >= 0; i := i - 1) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 849 | /* Update the old / actual link quality */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 850 | lqual_old := ms.lqual_cb; |
| 851 | ms.lqual_cb := 150 - i; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 852 | |
| 853 | /* 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] | 854 | log("Sending DATA.ind with link quality (dB): ", ms.lqual_cb); |
| 855 | if (i > g_bs_cv_max) { |
| 856 | cv := 15; |
| 857 | } else { |
| 858 | cv := i; |
| 859 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 860 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 861 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := cv) |
| 862 | |
| 863 | /* we will receive UL ACK/NACK from time to time. In that case, check CdCofing increases */ |
| 864 | f_rx_rlcmac_dl_block(dl_block, unused_fn); |
| 865 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 866 | continue; |
| 867 | } |
| 868 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_GPRS(ul_tfi := ?)) and |
| 869 | not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 870 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 871 | f_shutdown(__BFILE__, __LINE__); |
| 872 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 873 | |
| 874 | log("Rx Packet Uplink ACK / NACK with Channel Coding Command: ", |
| 875 | dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd); |
| 876 | |
| 877 | /* Match the received Channel Coding Command. Since we are increasing |
| 878 | * the link quality value on each iteration and not decreasing, there |
| 879 | * is no need to check the both old and current link quality values. */ |
| 880 | var template ChCodingCommand ch_coding; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 881 | select (lqual_old / 10) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 882 | case (CS1_lqual_dB_range) { ch_coding := CH_CODING_CS1; } |
| 883 | case (CS2_lqual_dB_range) { ch_coding := CH_CODING_CS2; } |
| 884 | case (CS3_lqual_dB_range) { ch_coding := CH_CODING_CS3; } |
| 885 | case (CS4_lqual_dB_range) { ch_coding := CH_CODING_CS4; } |
| 886 | } |
| 887 | |
| 888 | if (not match(dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd, ch_coding)) { |
| 889 | setverdict(fail, "Channel Coding does not match our expectations: ", ch_coding); |
Pau Espin Pedrol | 1617e31 | 2020-05-22 14:41:14 +0200 | [diff] [blame] | 890 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 891 | } |
| 892 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 893 | |
| 894 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 895 | } |
| 896 | |
| 897 | /* Test the max UL CS set by VTY works fine */ |
| 898 | testcase TC_cs_initial_ul() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 899 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 900 | var ChCodingCommand last_ch_coding; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 901 | var uint32_t unused_fn, sched_fn; |
| 902 | var GprsMS ms; |
| 903 | |
| 904 | /* Initialize GPRS MS side */ |
| 905 | f_init_gprs_ms(); |
| 906 | 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] | 907 | |
| 908 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 909 | 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] | 910 | |
| 911 | /* Set initial UL CS to 3 */ |
| 912 | g_cs_initial_ul := 3; |
| 913 | f_pcuvty_set_allowed_cs_mcs(); |
| 914 | f_pcuvty_set_link_quality_ranges(); |
| 915 | |
| 916 | /* Take lqual (dB->cB) so that we stay in that CS */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 917 | ms.lqual_cb := g_cs_lqual_ranges[2].low * 10; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 918 | |
| 919 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 920 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 921 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 922 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 923 | contention resoultion) and make sure it is ACKED fine. */ |
| 924 | /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
| 925 | /* 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] | 926 | 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] | 927 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 928 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 929 | 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] | 930 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 931 | /* Send UL blocks, until we receive UL ACK/NACK and check we are in same initial CS: */ |
| 932 | while (true) { |
| 933 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := 15); |
| 934 | f_rx_rlcmac_dl_block(dl_block, unused_fn); |
| 935 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 936 | continue; |
| 937 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 938 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 939 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_GPRS(ul_tfi := ?)) and |
| 940 | not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 941 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 942 | f_shutdown(__BFILE__, __LINE__); |
| 943 | break; |
| 944 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 945 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 946 | 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] | 947 | break; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 948 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 949 | if (last_ch_coding != CH_CODING_CS3) { |
| 950 | 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] | 951 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 952 | } |
| 953 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 954 | /* Remaining UL blocks are used to make sure regardless of initial |
| 955 | /* lqual, we can go lower at any time */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 956 | /* 0 dB, make sure we downgrade CS */ |
| 957 | ms.lqual_cb := 0; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 958 | /* 5 UL blocks, check we are in same initial CS: */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 959 | f_ms_tx_ul_data_block_multi(ms, 5); |
| 960 | /* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */ |
| 961 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 962 | 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] | 963 | |
| 964 | if (last_ch_coding != CH_CODING_CS1) { |
| 965 | 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] | 966 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 967 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 968 | |
| 969 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 970 | } |
| 971 | |
| 972 | /* Test the max UL CS set by VTY works fine */ |
| 973 | testcase TC_cs_max_ul() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 974 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 975 | var ChCodingCommand last_ch_coding; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 976 | var uint32_t unused_fn, sched_fn; |
| 977 | var GprsMS ms; |
| 978 | |
| 979 | /* Initialize GPRS MS side */ |
| 980 | f_init_gprs_ms(); |
| 981 | 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] | 982 | |
| 983 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 984 | 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] | 985 | |
| 986 | /* Set maximum allowed UL CS to 3 */ |
| 987 | g_cs_max_ul := 3; |
| 988 | f_pcuvty_set_allowed_cs_mcs(); |
| 989 | f_pcuvty_set_link_quality_ranges(); |
| 990 | |
| 991 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 992 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 993 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 994 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 995 | contention resoultion) and make sure it is ACKED fine. */ |
| 996 | /* 16 bytes fills the llc block (because TLLI takes 4 bytes) */ |
| 997 | /* 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] | 998 | 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] | 999 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 1000 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 1001 | 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] | 1002 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1003 | ms.lqual_cb := 40*10; /* 40 dB */ |
| 1004 | f_ms_tx_ul_data_block_multi(ms, 16); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1005 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1006 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 1007 | 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] | 1008 | |
| 1009 | if (last_ch_coding != CH_CODING_CS3) { |
| 1010 | 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] | 1011 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1012 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 1013 | |
| 1014 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1015 | } |
| 1016 | |
Pau Espin Pedrol | 7512259 | 2020-11-03 15:22:59 +0100 | [diff] [blame] | 1017 | /* Test the initial DL CS set by VTY works fine */ |
| 1018 | testcase TC_cs_initial_dl() runs on RAW_PCU_Test_CT { |
| 1019 | var octetstring data := f_rnd_octstring(10); |
| 1020 | var CodingScheme exp_dl_cs_mcs; |
| 1021 | var RlcmacDlBlock dl_block; |
| 1022 | var uint32_t poll_fn; |
| 1023 | var GprsMS ms; |
| 1024 | |
| 1025 | /* Initialize NS/BSSGP side */ |
| 1026 | f_init_bssgp(); |
| 1027 | /* Initialize GPRS MS side */ |
| 1028 | f_init_gprs_ms(); |
| 1029 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1030 | |
| 1031 | /* Initialize the PCU interface abstraction */ |
| 1032 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1033 | |
| 1034 | /* Set initial allowed DL CS to 3 */ |
| 1035 | g_cs_initial_dl := 3; |
| 1036 | exp_dl_cs_mcs := CS_3; |
| 1037 | /* Set maximum allowed UL CS to 4 */ |
| 1038 | g_cs_max_dl := 4; |
| 1039 | f_pcuvty_set_allowed_cs_mcs(); |
| 1040 | f_pcuvty_set_link_quality_ranges(); |
| 1041 | |
| 1042 | /* Establish BSSGP connection to the PCU */ |
| 1043 | f_bssgp_establish(); |
| 1044 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1045 | |
| 1046 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 1047 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 1048 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1049 | |
| 1050 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1051 | f_sleep(X2002); |
| 1052 | f_rx_rlcmac_dl_block_exp_data(dl_block, poll_fn, data, 0, exp_dl_cs_mcs); |
| 1053 | |
| 1054 | /* ACK the DL block */ |
| 1055 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1056 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1057 | f_dl_block_ack_fn(dl_block, poll_fn)); |
| 1058 | |
| 1059 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1060 | } |
| 1061 | |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1062 | /* Verify scheduling of multiple Downlink data blocks, enough to reach CS4 */ |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 1063 | 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] | 1064 | var octetstring data := f_rnd_octstring(1400); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1065 | var RlcmacDlBlock prev_dl_block, dl_block; |
| 1066 | var uint32_t ack_fn; |
| 1067 | var uint32_t fn; |
| 1068 | var GprsMS ms; |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1069 | var integer tx_data_remain := 10; |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1070 | var integer bsn := 0; |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1071 | var boolean using_egprs := f_rlcmac_cs_mcs_is_mcs(valueof(exp_final_cs)); |
| 1072 | var integer bsn_mod; |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 1073 | var template (present) CodingScheme exp_tmp_csmcs; |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1074 | |
| 1075 | if (using_egprs) { |
| 1076 | exp_tmp_csmcs := mcs_egprs_any; |
| 1077 | bsn_mod := 2048; |
| 1078 | } else { |
| 1079 | exp_tmp_csmcs := cs_gprs_any; |
| 1080 | bsn_mod := 128; |
| 1081 | } |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1082 | |
| 1083 | /* Establish BSSGP connection to the PCU */ |
| 1084 | f_bssgp_establish(); |
| 1085 | |
| 1086 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1087 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1088 | |
| 1089 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1090 | 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] | 1091 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1092 | |
| 1093 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 1094 | f_sleep(X2002); |
| 1095 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1096 | for (var integer i := 0; i < 800; i := i + 1) { |
| 1097 | bsn := i mod bsn_mod; |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1098 | f_rx_rlcmac_dl_block(dl_block, fn); |
| 1099 | |
| 1100 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL)) { |
| 1101 | /* No more data to receive, done */ |
| 1102 | break; |
| 1103 | } |
| 1104 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1105 | 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] | 1106 | |
| 1107 | /* Keep Ack/Nack description updated */ |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1108 | f_dltbf_ack_block(ms.dl_tbf, dl_block); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1109 | |
| 1110 | /* 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] | 1111 | if (f_dl_block_rrbp_valid(dl_block)) { |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 1112 | ack_fn := f_dl_block_ack_fn(dl_block, fn); |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1113 | 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] | 1114 | if (tx_data_remain != 0) { |
| 1115 | /* Submit more data from time to time to keep the TBF ongoing */ |
| 1116 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 1117 | tx_data_remain := tx_data_remain - 1; |
| 1118 | } |
| 1119 | } |
| 1120 | prev_dl_block := dl_block; |
| 1121 | } |
| 1122 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1123 | bsn := (bsn + (bsn_mod-1)) mod bsn_mod; /* previous bsn: bsn -1 */ |
| 1124 | 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] | 1125 | |
| 1126 | |
| 1127 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1128 | } |
| 1129 | |
| 1130 | /* Verify DL CS above "cs max" set by VTY is never used */ |
| 1131 | testcase TC_cs_max_dl() 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 maximum allowed DL CS to 3 */ |
| 1141 | g_cs_initial_dl := 1; |
| 1142 | g_cs_max_dl := 3; |
| 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 | |
| 1149 | /* Check DL CS4 is used in good link conditions if allowed by config */ |
| 1150 | testcase TC_dl_cs1_to_cs4() runs on RAW_PCU_Test_CT { |
| 1151 | /* Initialize NS/BSSGP side */ |
| 1152 | f_init_bssgp(); |
| 1153 | /* Initialize GPRS MS side */ |
| 1154 | f_init_gprs_ms(); |
| 1155 | |
| 1156 | /* Initialize the PCU interface abstraction */ |
| 1157 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1158 | |
| 1159 | /* Set initial DL CS to 1 & maximum allowed DL CS to 4 */ |
| 1160 | g_cs_initial_dl := 1; |
| 1161 | g_cs_max_dl := 4; |
| 1162 | f_pcuvty_set_allowed_cs_mcs(); |
| 1163 | f_pcuvty_set_link_quality_ranges(); |
| 1164 | |
| 1165 | f_dl_data_exp_cs(f_rlcmac_block_int2cs_mcs(g_cs_max_dl, false)); |
| 1166 | } |
| 1167 | |
Pau Espin Pedrol | 2354d6a | 2020-11-05 18:36:59 +0100 | [diff] [blame] | 1168 | /* Test the initial UL MCS set by VTY works fine */ |
| 1169 | testcase TC_mcs_initial_ul() runs on RAW_PCU_Test_CT { |
| 1170 | var RlcmacDlBlock dl_block; |
| 1171 | var PollFnCtx pollctx; |
| 1172 | var EgprsChCodingCommand last_ch_coding; |
| 1173 | var uint32_t unused_fn, sched_fn; |
| 1174 | var GprsMS ms; |
| 1175 | var CodingScheme exp_ul_mcs; |
Pau Espin Pedrol | 2354d6a | 2020-11-05 18:36:59 +0100 | [diff] [blame] | 1176 | |
| 1177 | /* Initialize GPRS MS side */ |
| 1178 | f_init_gprs_ms(); |
| 1179 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1180 | |
| 1181 | /* Initialize the PCU interface abstraction */ |
| 1182 | f_init_raw(testcasename()); |
| 1183 | |
| 1184 | /* Set initial UL MCS to 3 */ |
| 1185 | g_mcs_initial_ul := 3; |
| 1186 | exp_ul_mcs := f_rlcmac_block_int2cs_mcs(g_mcs_initial_ul, true); |
| 1187 | f_pcuvty_set_allowed_cs_mcs(); |
| 1188 | f_pcuvty_set_link_quality_ranges(); |
| 1189 | |
| 1190 | /* Take lqual (dB->cB) so that we stay in that MCS */ |
| 1191 | ms.lqual_cb := g_mcs_lqual_ranges[2].low * 10; |
| 1192 | |
| 1193 | /* Send PACKET RESOURCE REQUEST to upgrade to EGPRS */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1194 | 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] | 1195 | |
| 1196 | if (not match(ms.ul_tbf.tx_cs_mcs, exp_ul_mcs)) { |
| 1197 | setverdict(fail, "Wrong CS_MCS ", ms.ul_tbf.tx_cs_mcs, " received vs exp ", exp_ul_mcs); |
| 1198 | f_shutdown(__BFILE__, __LINE__); |
| 1199 | } |
| 1200 | |
| 1201 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 1202 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 1203 | |
| 1204 | /* Send UL blocks, until we receive UL ACK/NACK and check we are in same initial CS: */ |
| 1205 | while (true) { |
| 1206 | f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := 15); |
| 1207 | f_rx_rlcmac_dl_block(dl_block, unused_fn); |
| 1208 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 1209 | continue; |
| 1210 | } |
| 1211 | |
| 1212 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 1213 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 1214 | f_shutdown(__BFILE__, __LINE__); |
| 1215 | break; |
| 1216 | } |
| 1217 | |
| 1218 | last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.egprs.ch_coding_cmd; |
| 1219 | break; |
| 1220 | } |
| 1221 | if (f_rlcmac_block_EgprsChCodingCommand2cs_mcs(last_ch_coding) != exp_ul_mcs) { |
| 1222 | setverdict(fail, "Channel Coding does not match our expectations ", exp_ul_mcs, ": ", last_ch_coding); |
| 1223 | f_shutdown(__BFILE__, __LINE__); |
| 1224 | } |
| 1225 | |
| 1226 | /* Remaining UL blocks are used to make sure regardless of initial |
| 1227 | * lqual, we can go lower at any time |
| 1228 | * 0 dB, make sure we downgrade MCS */ |
| 1229 | ms.lqual_cb := 0; |
| 1230 | /* 5 UL blocks, check we are in same initial MCS: */ |
| 1231 | f_ms_tx_ul_data_block_multi(ms, 5); |
| 1232 | /* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */ |
| 1233 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 1234 | last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.egprs.ch_coding_cmd; |
| 1235 | |
| 1236 | if (last_ch_coding != CH_CODING_MCS1) { |
| 1237 | setverdict(fail, "Channel Coding does not match our expectations (MCS-1): ", last_ch_coding); |
| 1238 | f_shutdown(__BFILE__, __LINE__); |
| 1239 | } |
| 1240 | |
| 1241 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1242 | } |
| 1243 | |
Pau Espin Pedrol | db15fa7 | 2020-11-11 12:58:34 +0100 | [diff] [blame] | 1244 | /* Test the maximum UL MCS set by VTY works fine */ |
| 1245 | testcase TC_mcs_max_ul() runs on RAW_PCU_Test_CT { |
| 1246 | var RlcmacDlBlock dl_block; |
| 1247 | var EgprsChCodingCommand last_ch_coding; |
| 1248 | var PollFnCtx pollctx; |
| 1249 | var uint32_t unused_fn, sched_fn; |
| 1250 | var GprsMS ms; |
Pau Espin Pedrol | db15fa7 | 2020-11-11 12:58:34 +0100 | [diff] [blame] | 1251 | |
| 1252 | /* Initialize GPRS MS side */ |
| 1253 | f_init_gprs_ms(); |
| 1254 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1255 | |
| 1256 | /* Initialize the PCU interface abstraction */ |
| 1257 | f_init_raw(testcasename()); |
| 1258 | |
| 1259 | /* Set maximum allowed UL MCS to 5 */ |
| 1260 | g_mcs_max_ul := 5; |
| 1261 | f_pcuvty_set_allowed_cs_mcs(); |
| 1262 | f_pcuvty_set_link_quality_ranges(); |
| 1263 | |
| 1264 | /* Send PACKET RESOURCE REQUEST to upgrade to EGPRS */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1265 | 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] | 1266 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 1267 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 1268 | |
| 1269 | ms.lqual_cb := 40*10; /* 40 dB */ |
| 1270 | f_ms_tx_ul_data_block_multi(ms, 16); |
| 1271 | |
| 1272 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 1273 | last_ch_coding := dl_block.ctrl.payload.u.ul_ack_nack.egprs.ch_coding_cmd; |
| 1274 | |
| 1275 | if (last_ch_coding != CH_CODING_MCS5) { |
| 1276 | setverdict(fail, "Channel Coding does not match our expectations (MCS-5): ", last_ch_coding); |
| 1277 | f_shutdown(__BFILE__, __LINE__); |
| 1278 | } |
| 1279 | |
| 1280 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1281 | } |
| 1282 | |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 1283 | /* Test the initial DL CS set by VTY works fine */ |
| 1284 | testcase TC_mcs_initial_dl() runs on RAW_PCU_Test_CT { |
| 1285 | var octetstring data := f_rnd_octstring(10); |
| 1286 | var CodingScheme exp_dl_cs_mcs; |
| 1287 | var RlcmacDlBlock dl_block; |
| 1288 | var uint32_t poll_fn; |
| 1289 | var GprsMS ms; |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 1290 | |
| 1291 | /* Initialize NS/BSSGP side */ |
| 1292 | f_init_bssgp(); |
| 1293 | /* Initialize GPRS MS side */ |
| 1294 | f_init_gprs_ms(); |
| 1295 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1296 | |
| 1297 | /* Initialize the PCU interface abstraction */ |
| 1298 | f_init_raw(testcasename()); |
| 1299 | |
| 1300 | /* Set initial allowed DL MCS to 3 */ |
| 1301 | g_mcs_initial_dl := 3; |
| 1302 | exp_dl_cs_mcs := MCS_3; |
| 1303 | /* Set maximum allowed DL MCS to 4 */ |
| 1304 | g_mcs_max_dl := 4; |
| 1305 | f_pcuvty_set_allowed_cs_mcs(); |
| 1306 | f_pcuvty_set_link_quality_ranges(); |
| 1307 | |
| 1308 | /* Establish BSSGP connection to the PCU */ |
| 1309 | f_bssgp_establish(); |
| 1310 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1311 | |
| 1312 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1313 | 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] | 1314 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1315 | |
| 1316 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1317 | f_sleep(X2002); |
| 1318 | f_rx_rlcmac_dl_block_exp_data(dl_block, poll_fn, data, 0, exp_dl_cs_mcs); |
| 1319 | |
| 1320 | /* ACK the DL block */ |
Pau Espin Pedrol | e8db673 | 2020-11-12 21:06:41 +0100 | [diff] [blame] | 1321 | f_dltbf_ack_block(ms.dl_tbf, dl_block, '1'B); |
| 1322 | 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] | 1323 | f_dl_block_ack_fn(dl_block, poll_fn)); |
| 1324 | |
| 1325 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1326 | } |
| 1327 | |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 1328 | /* Verify DL MCS above "mcs max" set by VTY is never used */ |
| 1329 | testcase TC_mcs_max_dl() runs on RAW_PCU_Test_CT { |
| 1330 | /* Initialize NS/BSSGP side */ |
| 1331 | f_init_bssgp(); |
| 1332 | /* Initialize GPRS MS side */ |
| 1333 | f_init_gprs_ms(); |
| 1334 | |
| 1335 | /* Initialize the PCU interface abstraction */ |
| 1336 | f_init_raw(testcasename()); |
| 1337 | |
| 1338 | /* Set maximum allowed DL CS to 3 */ |
| 1339 | g_mcs_initial_dl := 1; |
| 1340 | g_mcs_max_dl := 3; |
| 1341 | f_pcuvty_set_allowed_cs_mcs(); |
| 1342 | f_pcuvty_set_link_quality_ranges(); |
| 1343 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 1344 | 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] | 1345 | } |
| 1346 | |
Pau Espin Pedrol | 1451f9f | 2021-05-11 11:52:37 +0200 | [diff] [blame] | 1347 | /* Verify PCU drops TBF after some time of inactivity. */ |
| 1348 | testcase TC_t3141() runs on RAW_PCU_Test_CT { |
| 1349 | var PCUIF_info_ind info_ind; |
| 1350 | var template (value) TsTrxBtsNum nr; |
| 1351 | var BTS_PDTCH_Block data_msg; |
| 1352 | var GprsMS ms; |
| 1353 | var uint3_t rx_usf; |
| 1354 | timer T_3141 := 1.0; |
| 1355 | var boolean ul_tbf_usf_req := false; |
| 1356 | |
| 1357 | /* Initialize NS/BSSGP side */ |
| 1358 | f_init_bssgp(); |
| 1359 | /* Initialize GPRS MS side */ |
| 1360 | f_init_gprs_ms(); |
| 1361 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1362 | |
| 1363 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1364 | /* Only use 1 PDCH to simplify test: */ |
| 1365 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
| 1366 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 1367 | /* Initialize the PCU interface abstraction */ |
| 1368 | f_init_raw(testcasename(), info_ind); |
| 1369 | |
| 1370 | f_vty_config2(PCUVTY, {"pcu"}, "timer T3141 1"); |
| 1371 | |
| 1372 | /* Establish BSSGP connection to the PCU */ |
| 1373 | f_bssgp_establish(); |
| 1374 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1375 | |
| 1376 | /* Establish a one-phase access Uplink TBF */ |
| 1377 | f_ms_establish_ul_tbf(ms); |
| 1378 | |
| 1379 | T_3141.start; |
| 1380 | |
| 1381 | /* Now we wait for PCU to transmit our USF */ |
| 1382 | nr := ts_TsTrxBtsNum; |
| 1383 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1384 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1385 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1386 | block_nr := nr.blk_nr)); |
| 1387 | |
| 1388 | alt { |
| 1389 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1390 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1391 | ?)) -> value data_msg { |
| 1392 | if (ms.ul_tbf.usf[valueof(nr.ts_nr)] == USF_UNUSED) { |
| 1393 | setverdict(fail, "Unexpected ts_nr ", valueof(nr.ts_nr), " without USF allocated"); |
| 1394 | f_shutdown(__BFILE__, __LINE__); |
| 1395 | } |
| 1396 | |
| 1397 | rx_usf := f_rlcmac_dl_block_get_usf(data_msg.dl_block); |
| 1398 | if (rx_usf == ms.ul_tbf.usf[valueof(nr.ts_nr)]) { |
| 1399 | /* PCU requests our USF, transmit WITHOUT tlli to avoid contention resolution success */ |
| 1400 | ul_tbf_usf_req := true; |
| 1401 | 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)) |
| 1402 | } else if (rx_usf == USF_UNUSED) { |
| 1403 | if (data_msg.raw.fn >= ms.ul_tbf.start_time_fn) { |
| 1404 | if (ul_tbf_usf_req) { |
| 1405 | /* TBF was dropped by T3141, success */ |
| 1406 | setverdict(pass); |
| 1407 | break; |
| 1408 | } else { |
| 1409 | log("PCU never requested USF, unexpected"); |
| 1410 | f_shutdown(__BFILE__, __LINE__); |
| 1411 | } |
| 1412 | } /* else: Keep waiting for TBF to be active by network */ |
| 1413 | } else { |
| 1414 | log("PCU requests ", rx_usf, ", we have ", ms.ul_tbf.usf[valueof(nr.ts_nr)]); |
| 1415 | f_shutdown(__BFILE__, __LINE__); |
| 1416 | } |
| 1417 | |
| 1418 | /* Make sure we don't receive a Ul ACK/NACK with TLLI set: */ |
| 1419 | if (match(data_msg.dl_block, |
| 1420 | tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, |
| 1421 | tr_UlAckNackGprs(tlli := ?, |
| 1422 | acknack_desc := ?, |
| 1423 | rel99 := *)))) |
| 1424 | { |
| 1425 | log("Received UL ACK/NACK with TLLI set"); |
| 1426 | f_shutdown(__BFILE__, __LINE__); |
| 1427 | } |
| 1428 | |
| 1429 | nr := ts_TsTrxBtsNum; |
| 1430 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1431 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1432 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1433 | block_nr := nr.blk_nr)); |
| 1434 | repeat; |
| 1435 | } |
| 1436 | [] T_3141.timeout { |
| 1437 | log("T_3141 expired but TBF is still active, unexpected"); |
| 1438 | f_shutdown(__BFILE__, __LINE__); |
| 1439 | } |
| 1440 | [] BTS.receive { |
| 1441 | /* We should never receive non-dummy messages, aka UL ACK/NACK, |
| 1442 | * because we never sent the TLLI to the PCU */ |
| 1443 | setverdict(fail, "Unexpected BTS message"); |
| 1444 | f_shutdown(__BFILE__, __LINE__); |
| 1445 | } |
| 1446 | } |
| 1447 | |
| 1448 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1449 | } |
| 1450 | |
Pau Espin Pedrol | f30fa1d | 2021-03-03 19:55:11 +0100 | [diff] [blame] | 1451 | /* Validate what happens when RACH to get UL TBF and then PCU receives no UL |
| 1452 | * data. It should end up in N3101 reaching N3101_MAX and finally triggering |
| 1453 | * T3169. See OS#5033 */ |
| 1454 | testcase TC_n3101_max_t3169() runs on RAW_PCU_Test_CT { |
| 1455 | var PCUIF_info_ind info_ind; |
| 1456 | var template (value) TsTrxBtsNum nr; |
| 1457 | var BTS_PDTCH_Block data_msg; |
| 1458 | var GprsMS ms; |
| 1459 | var uint3_t rx_usf; |
| 1460 | const integer N3101_MAX := 9; /* N3101 shall be greater than 8 */ |
| 1461 | var integer n3101 := 0; |
| 1462 | timer T_3169 := 1.0; |
| 1463 | |
| 1464 | /* Initialize NS/BSSGP side */ |
| 1465 | f_init_bssgp(); |
| 1466 | /* Initialize GPRS MS side */ |
| 1467 | f_init_gprs_ms(); |
| 1468 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1469 | |
| 1470 | /* Initialize the PCU interface abstraction */ |
| 1471 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1472 | info_ind.n3101 := N3101_MAX; |
| 1473 | info_ind.t3169 := 1; |
| 1474 | f_init_raw(testcasename(), info_ind); |
| 1475 | |
| 1476 | /* Establish BSSGP connection to the PCU */ |
| 1477 | f_bssgp_establish(); |
| 1478 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1479 | |
| 1480 | /* Establish UL TBF */ |
| 1481 | f_ms_establish_ul_tbf(ms); |
| 1482 | |
| 1483 | /* Now we wait for PCU to transmit our USF */ |
| 1484 | nr := ts_TsTrxBtsNum; |
| 1485 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1486 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1487 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1488 | block_nr := nr.blk_nr)); |
| 1489 | |
| 1490 | alt { |
| 1491 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1492 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1493 | ?)) -> value data_msg { |
| 1494 | if (ms.ul_tbf.usf[valueof(nr.ts_nr)] == USF_UNUSED) { |
| 1495 | setverdict(fail, "Unexpected ts_nr ", valueof(nr.ts_nr), " without USF allocated"); |
| 1496 | f_shutdown(__BFILE__, __LINE__); |
| 1497 | } |
| 1498 | |
| 1499 | rx_usf := f_rlcmac_dl_block_get_usf(data_msg.dl_block); |
| 1500 | if (rx_usf == ms.ul_tbf.usf[valueof(nr.ts_nr)]) { |
| 1501 | log("PCU requests our USF ", rx_usf, ", n3101=", n3101); |
| 1502 | n3101 := n3101 + 1; |
Pau Espin Pedrol | 73c5d37 | 2021-03-24 18:48:24 +0100 | [diff] [blame] | 1503 | if (n3101 > N3101_MAX + 1) { //+1: DL<->UL FN offset |
| 1504 | 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] | 1505 | f_shutdown(__BFILE__, __LINE__); |
| 1506 | } |
Pau Espin Pedrol | 73c5d37 | 2021-03-24 18:48:24 +0100 | [diff] [blame] | 1507 | } else if (rx_usf == USF_UNUSED and n3101 == N3101_MAX + 1) { |
Pau Espin Pedrol | f30fa1d | 2021-03-03 19:55:11 +0100 | [diff] [blame] | 1508 | /* If we already received USFs for us and we don't receive them anymore, that means the TBF entered T3169 */ |
| 1509 | log("PCU stopped requesting USF ", ms.ul_tbf.usf[valueof(nr.ts_nr)]); |
| 1510 | if (not T_3169.running) { |
| 1511 | log("T3169 started"); |
| 1512 | T_3169.start; |
| 1513 | } |
| 1514 | } else if(rx_usf == USF_UNUSED and n3101 > 0) { |
| 1515 | setverdict(fail, "PCU stopped requesting USFs too early: ", n3101, " < ", N3101_MAX, " (N3101_MAX)"); |
| 1516 | f_shutdown(__BFILE__, __LINE__); |
| 1517 | } else { |
| 1518 | log("PCU requests ", rx_usf, ", we have ", ms.ul_tbf.usf[valueof(nr.ts_nr)]); |
| 1519 | } |
| 1520 | nr := ts_TsTrxBtsNum; |
| 1521 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1522 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1523 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1524 | block_nr := nr.blk_nr)); |
| 1525 | repeat; |
| 1526 | } |
| 1527 | [] T_3169.timeout { |
| 1528 | log("T_3169 expired"); |
| 1529 | /* Done in alt */ |
| 1530 | } |
| 1531 | [] BTS.receive { |
| 1532 | setverdict(fail, "Unexpected BTS message"); |
| 1533 | f_shutdown(__BFILE__, __LINE__); |
| 1534 | } |
| 1535 | } |
| 1536 | |
| 1537 | /* Now that T3169 has expired, establishing a Ul TBF should provide same |
| 1538 | /* USFs as per previous TBF since they were freed at expiration time: */ |
| 1539 | var uint3_t old_usf[8] := ms.ul_tbf.usf; |
| 1540 | var uint5_t old_tfi := ms.ul_tbf.tfi; |
| 1541 | f_ms_establish_ul_tbf(ms); |
| 1542 | if (old_tfi != ms.ul_tbf.tfi) { |
| 1543 | setverdict(fail, "Unexpected TFI change: ", ms.ul_tbf.tfi, " vs exp ", old_tfi); |
| 1544 | f_shutdown(__BFILE__, __LINE__); |
| 1545 | } |
| 1546 | for (var integer i := 0; i < 8; i := i +1) { |
| 1547 | if (ms.ul_tbf.usf[i] != old_usf[i]) { |
| 1548 | setverdict(fail, "Unexpected USF change: ", ms.ul_tbf.usf[i], " vs exp ", old_usf[i]); |
| 1549 | f_shutdown(__BFILE__, __LINE__); |
| 1550 | } |
| 1551 | } |
| 1552 | |
| 1553 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1554 | } |
| 1555 | |
Pau Espin Pedrol | cc895df | 2021-04-20 12:58:32 +0200 | [diff] [blame] | 1556 | |
| 1557 | /* Verify after N3103_MAX is reached, T3169 is started and upon timeout TBF is |
| 1558 | freed and no longer available. Trigger it by sending a few UL blocks CTRL ACKING |
| 1559 | the final UL ACK sent at us. */ |
| 1560 | testcase TC_n3103_max_t3169() runs on RAW_PCU_Test_CT { |
| 1561 | var PCUIF_info_ind info_ind; |
| 1562 | var BTS_PDTCH_Block data_msg; |
| 1563 | var RlcmacDlBlock dl_block; |
| 1564 | var uint32_t sched_fn; |
| 1565 | var template (value) TsTrxBtsNum nr; |
| 1566 | var template RlcmacDlBlock exp_ul_ack; |
| 1567 | var template UlAckNackGprs exp_ul_ack_sub; |
| 1568 | var GprsMS ms; |
| 1569 | const integer N3103_MAX := 2; /* N3103 is usually somewhere 2-5 */ |
| 1570 | var integer N3103 := 0; |
| 1571 | timer T_3169 := 1.0; |
| 1572 | |
| 1573 | /* Initialize GPRS MS side */ |
| 1574 | f_init_gprs_ms(); |
| 1575 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1576 | |
| 1577 | /* Initialize the PCU interface abstraction */ |
| 1578 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1579 | info_ind.n3103 := N3103_MAX; |
| 1580 | info_ind.t3169 := 1; |
| 1581 | f_init_raw(testcasename(), info_ind); |
| 1582 | |
| 1583 | /* Establish an Uplink TBF */ |
| 1584 | f_ms_establish_ul_tbf(ms); |
| 1585 | |
Pau Espin Pedrol | 93ae452 | 2021-05-11 15:58:26 +0200 | [diff] [blame] | 1586 | 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] | 1587 | exp_ul_ack_sub := tr_UlAckNackGprs(*, tr_AckNackDescription('1'B), *); |
| 1588 | exp_ul_ack := tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, exp_ul_ack_sub); |
| 1589 | |
| 1590 | nr := ts_TsTrxBtsNum; |
| 1591 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1592 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1593 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1594 | block_nr := nr.blk_nr)); |
| 1595 | alt { |
| 1596 | [N3103 < N3103_MAX] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1597 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1598 | exp_ul_ack)) -> value data_msg { |
| 1599 | if (not f_dl_block_rrbp_valid(data_msg.dl_block)) { |
| 1600 | setverdict(fail, "Unexpected DL BLOCK has no RRBP: ", data_msg.dl_block); |
| 1601 | f_shutdown(__BFILE__, __LINE__); |
| 1602 | } |
| 1603 | |
| 1604 | nr := ts_TsTrxBtsNum; |
| 1605 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1606 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1607 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1608 | block_nr := nr.blk_nr)); |
| 1609 | N3103 := N3103 + 1; |
| 1610 | if (N3103 == N3103_MAX) { |
| 1611 | /* At this point in time (N3103_MAX reached), PCU is |
| 1612 | * moving the TBF to RELEASE state so no data/ctrl for |
| 1613 | * it is tx'ed, hence the dummy blocks: */ |
| 1614 | T_3169.start; |
| 1615 | } |
| 1616 | repeat; |
| 1617 | } |
| 1618 | [N3103 >= N3103_MAX] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1619 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1620 | exp_ul_ack)) -> value data_msg { |
| 1621 | setverdict(fail, "Unexpected UL ACK/NACK after reaching N3103_MAX"); |
| 1622 | f_shutdown(__BFILE__, __LINE__); |
| 1623 | } |
| 1624 | [] as_ms_rx_ignore_dummy(ms, nr); |
| 1625 | [T_3169.running] T_3169.timeout { |
| 1626 | log("T_3169 timeout"); |
| 1627 | /* Done in alt, wait for pending RTS initiated previously in |
| 1628 | * above case before continuing (expect /* Dummy block): */ |
| 1629 | BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1630 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1631 | tr_RLCMAC_DUMMY_CTRL)); |
| 1632 | } |
| 1633 | [] BTS.receive { |
| 1634 | setverdict(fail, "Unexpected BTS message"); |
| 1635 | f_shutdown(__BFILE__, __LINE__); |
| 1636 | } |
| 1637 | } |
| 1638 | |
| 1639 | /* Now that T3169 has expired, establishing a Ul TBF should provide same |
| 1640 | * USFs as per previous TBF since they were freed at expiration time: */ |
| 1641 | var uint3_t old_usf[8] := ms.ul_tbf.usf; |
| 1642 | var uint5_t old_tfi := ms.ul_tbf.tfi; |
| 1643 | f_ms_establish_ul_tbf(ms); |
| 1644 | if (old_tfi != ms.ul_tbf.tfi) { |
| 1645 | setverdict(fail, "Unexpected TFI change: ", ms.ul_tbf.tfi, " vs exp ", old_tfi); |
| 1646 | f_shutdown(__BFILE__, __LINE__); |
| 1647 | } |
| 1648 | for (var integer i := 0; i < 8; i := i +1) { |
| 1649 | if (ms.ul_tbf.usf[i] != old_usf[i]) { |
| 1650 | setverdict(fail, "Unexpected USF change: ", ms.ul_tbf.usf[i], " vs exp ", old_usf[i]); |
| 1651 | f_shutdown(__BFILE__, __LINE__); |
| 1652 | } |
| 1653 | } |
| 1654 | |
| 1655 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1656 | } |
| 1657 | |
Pau Espin Pedrol | 84a8c3c | 2021-03-01 17:22:29 +0100 | [diff] [blame] | 1658 | /* Verify that a Downlink TBF is kept available until T3191 fires, at which |
| 1659 | * point the TBF is no longer available. In order to get to start of T3191, we |
| 1660 | * have to wait for x2031 since that marks the IDLE TBF time, that is, the delay |
| 1661 | * until TBF release procedure starts after draining DL queue. */ |
| 1662 | testcase TC_x2031_t3191() runs on RAW_PCU_Test_CT { |
| 1663 | var PCUIF_info_ind info_ind; |
| 1664 | var RlcmacDlBlock dl_block; |
| 1665 | var octetstring data1 := f_rnd_octstring(200); |
| 1666 | var octetstring data2 := f_rnd_octstring(10); |
| 1667 | var uint32_t dl_fn; |
| 1668 | var template (value) TsTrxBtsNum nr; |
| 1669 | var BTS_PDTCH_Block data_msg; |
| 1670 | var GprsMS ms; |
| 1671 | |
| 1672 | /* Initialize NS/BSSGP side */ |
| 1673 | f_init_bssgp(); |
| 1674 | /* Initialize GPRS MS side */ |
| 1675 | f_init_gprs_ms(); |
| 1676 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1677 | |
| 1678 | /* Initialize the PCU interface abstraction */ |
| 1679 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1680 | /* Set timer to 1 sec (default 5) to speedup test: */ |
| 1681 | info_ind.t3191 := 1; |
| 1682 | f_init_raw(testcasename(), info_ind); |
| 1683 | |
| 1684 | /* Establish BSSGP connection to the PCU */ |
| 1685 | f_bssgp_establish(); |
| 1686 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1687 | |
| 1688 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 1689 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1)); |
| 1690 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1691 | |
| 1692 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1693 | f_sleep(X2002); |
| 1694 | |
| 1695 | while (true) { |
| 1696 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, ?, ?); |
| 1697 | |
| 1698 | /* Keep Ack/Nack description updated (except for last BSN) */ |
| 1699 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
| 1700 | |
| 1701 | if (f_dl_block_rrbp_valid(dl_block)) { |
| 1702 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1703 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 1704 | break; |
| 1705 | } |
| 1706 | } |
| 1707 | |
| 1708 | /* Now we wait for IDLE TBF timer (X2031) to time out and receive a FINAL ACK */ |
| 1709 | nr := ts_TsTrxBtsNum; |
| 1710 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1711 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1712 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1713 | block_nr := nr.blk_nr)); |
| 1714 | alt { |
| 1715 | [] as_ms_rx_ignore_dummy(ms, nr); |
| 1716 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1717 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1718 | ?)) -> value data_msg { |
| 1719 | if (data_msg.dl_block.data.mac_hdr.hdr_ext.fbi) { |
| 1720 | log("Received FINAL_ACK"); |
| 1721 | ms.dl_tbf.acknack_desc.final_ack := '1'B; |
| 1722 | break; |
| 1723 | } |
| 1724 | if (f_dl_block_rrbp_valid(data_msg.dl_block)) { |
| 1725 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, data_msg.dl_block); |
| 1726 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1727 | f_dl_block_ack_fn(dl_block, data_msg.raw.fn)); |
| 1728 | } |
| 1729 | nr := ts_TsTrxBtsNum; |
| 1730 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1731 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1732 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1733 | block_nr := nr.blk_nr)); |
| 1734 | repeat; |
| 1735 | } |
| 1736 | [] BTS.receive { |
| 1737 | setverdict(fail, "Unexpected BTS message"); |
| 1738 | f_shutdown(__BFILE__, __LINE__); |
| 1739 | } |
| 1740 | } |
| 1741 | |
| 1742 | /* Avoid ACKing the last RLC data block on purpose here, wait for t3191 |
| 1743 | to time out. We simply sleep instead of requesting blocks because |
| 1744 | otherwise retransmissions would keep restarting the timer. */ |
| 1745 | f_sleep(int2float(info_ind.t3191)); |
| 1746 | |
| 1747 | /* The TBF should be freed now, so new data should trigger an Assignment: */ |
| 1748 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data2)); |
| 1749 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1750 | |
| 1751 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1752 | f_sleep(X2002); |
| 1753 | /* Now that we confirmed the new assignment in the dl-tbf, lets receive the data and ack it */ |
| 1754 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data2, 0); |
| 1755 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1756 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1757 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 1758 | |
| 1759 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1760 | } |
| 1761 | |
| 1762 | /* Same as TC_zero_x2031_t3191, but this time without x2031 (immediate FINAL_ACK). */ |
| 1763 | testcase TC_zero_x2031_t3191() runs on RAW_PCU_Test_CT { |
| 1764 | var PCUIF_info_ind info_ind; |
| 1765 | var RlcmacDlBlock dl_block; |
| 1766 | var octetstring data1 := f_rnd_octstring(1400); |
| 1767 | var octetstring data2 := f_rnd_octstring(10); |
| 1768 | var uint32_t dl_fn; |
| 1769 | var GprsMS ms; |
| 1770 | |
| 1771 | /* Initialize NS/BSSGP side */ |
| 1772 | f_init_bssgp(); |
| 1773 | /* Initialize GPRS MS side */ |
| 1774 | f_init_gprs_ms(); |
| 1775 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1776 | |
| 1777 | /* Initialize the PCU interface abstraction */ |
| 1778 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1779 | /* Set timer to 1 sec (default 5) to speedup test: */ |
| 1780 | info_ind.t3191 := 1; |
| 1781 | f_init_raw(testcasename(), info_ind); |
| 1782 | |
| 1783 | f_vty_config2(PCUVTY, {"pcu"}, "timer X2031 0"); |
| 1784 | |
| 1785 | /* Establish BSSGP connection to the PCU */ |
| 1786 | f_bssgp_establish(); |
| 1787 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1788 | |
| 1789 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 1790 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1)); |
| 1791 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1792 | |
| 1793 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1794 | f_sleep(X2002); |
| 1795 | |
| 1796 | /* Send enough DL data to at least be able to DL ACK once (excl the |
| 1797 | * FINAL_ACK one), so that PCU sees we are listening in PDCH and avoids |
| 1798 | * other code paths like trying to Imm Assign on CCCH again, etc.. */ |
| 1799 | while (true) { |
| 1800 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, ?, ?); |
| 1801 | |
| 1802 | if (dl_block.data.mac_hdr.hdr_ext.fbi) { |
| 1803 | log("Received FINAL_ACK"); |
| 1804 | ms.dl_tbf.acknack_desc.final_ack := '1'B; |
| 1805 | break; |
| 1806 | } |
| 1807 | |
| 1808 | /* Keep Ack/Nack description updated (except for last BSN) */ |
| 1809 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
| 1810 | |
| 1811 | if (f_dl_block_rrbp_valid(dl_block)) { |
| 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 | } |
| 1816 | |
| 1817 | /* Avoid ACKing the last RLC data block on purpose here, wait for t3191 |
| 1818 | to time out. We simply sleep instead of requesting blocks because |
| 1819 | otherwise retransmissions would keep restarting the timer. */ |
| 1820 | f_sleep(int2float(info_ind.t3191)); |
| 1821 | |
| 1822 | /* The TBF should be freed now, so new data should trigger an Assignment: */ |
| 1823 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data2)); |
| 1824 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1825 | |
| 1826 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1827 | f_sleep(X2002); |
| 1828 | /* Now that we confirmed the new assignment in the dl-tbf, lets receive the data and ack it */ |
| 1829 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data2, 0); |
| 1830 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1831 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1832 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 1833 | |
| 1834 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 1835 | } |
| 1836 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1837 | /* Verify that a Downlink TBF can be assigned using PACCH shortly after the |
| 1838 | * release of prev DL TBF due to MS staying in PDCH for a while (T3192, in PCU |
| 1839 | * T3193) after DL TBF release */ |
| 1840 | testcase TC_t3193() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1841 | var RlcmacDlBlock dl_block; |
| 1842 | var octetstring data := f_rnd_octstring(10); |
| 1843 | var boolean ok; |
| 1844 | var uint32_t sched_fn; |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1845 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1846 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1847 | var AckNackDescription ack_nack_desc := valueof(t_AckNackDescription_init); |
| 1848 | |
| 1849 | /* Initialize NS/BSSGP side */ |
| 1850 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1851 | /* Initialize GPRS MS side */ |
| 1852 | f_init_gprs_ms(); |
| 1853 | 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] | 1854 | |
| 1855 | /* Initialize the PCU interface abstraction */ |
| 1856 | f_init_raw(testcasename()); |
| 1857 | |
| 1858 | /* Establish BSSGP connection to the PCU */ |
| 1859 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 1860 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1861 | |
| 1862 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1863 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 1864 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Vadim Yanitskiy | 2e213ae | 2020-05-06 22:26:17 +0700 | [diff] [blame] | 1865 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1866 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1867 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 1868 | 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] | 1869 | |
| 1870 | /* ACK the DL block */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 1871 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1872 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1873 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1874 | |
| 1875 | /* 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] | 1876 | (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] | 1877 | 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] | 1878 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
Vadim Yanitskiy | 7431e9e | 2020-07-21 01:59:17 +0700 | [diff] [blame] | 1879 | 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] | 1880 | |
| 1881 | 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] | 1882 | |
| 1883 | /* 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] | 1884 | 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] | 1885 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 1886 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1887 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 1888 | |
| 1889 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1890 | } |
| 1891 | |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 1892 | /* Verify after N3105_MAX is reached, T3195 is started and upon timeout TBF is |
| 1893 | freed and no longer available. Trigger it by sending DL blocks and never DL |
| 1894 | ACKing the data (which are requested through RRBP) */ |
| 1895 | testcase TC_n3105_max_t3195() runs on RAW_PCU_Test_CT { |
| 1896 | var PCUIF_info_ind info_ind; |
| 1897 | var RlcmacDlBlock dl_block; |
| 1898 | var octetstring data1 := f_rnd_octstring(1000); |
| 1899 | var octetstring data2 := f_rnd_octstring(10); |
| 1900 | var uint32_t dl_fn; |
| 1901 | var template (value) TsTrxBtsNum nr; |
| 1902 | var BTS_PDTCH_Block data_msg; |
| 1903 | var GprsMS ms; |
| 1904 | const integer N3105_MAX := 2; |
| 1905 | var integer N3105 := 0; |
| 1906 | timer T_3195 := 1.0; |
| 1907 | var integer num_poll_recv := 0; |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame^] | 1908 | var template RlcmacDlBlock dl_block_exp; |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 1909 | |
| 1910 | /* Initialize NS/BSSGP side */ |
| 1911 | f_init_bssgp(); |
| 1912 | /* Initialize GPRS MS side */ |
| 1913 | f_init_gprs_ms(); |
| 1914 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 1915 | |
| 1916 | /* Initialize the PCU interface abstraction */ |
| 1917 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
| 1918 | /* Speedup test: */ |
| 1919 | info_ind.n3105 := N3105_MAX; |
| 1920 | info_ind.t3195 := 1; |
| 1921 | f_init_raw(testcasename(), info_ind); |
| 1922 | |
| 1923 | /* Disable "MS delay release" timer, to avoid old DL data kept in cached |
| 1924 | * MS and retransmitted after the TBF is released and later on created |
| 1925 | * (because the MS is reused) */ |
| 1926 | f_vty_config2(PCUVTY, {"pcu"}, "timer X2030 0"); |
| 1927 | |
| 1928 | /* Establish BSSGP connection to the PCU */ |
| 1929 | f_bssgp_establish(); |
| 1930 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 1931 | |
| 1932 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 1933 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1)); |
| 1934 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 1935 | |
| 1936 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 1937 | f_sleep(X2002); |
| 1938 | |
| 1939 | /* Now we go on receiving DL data and not answering RRBP: */ |
| 1940 | nr := ts_TsTrxBtsNum; |
| 1941 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1942 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1943 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1944 | block_nr := nr.blk_nr)); |
| 1945 | alt { |
| 1946 | [not T_3195.running] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1947 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1948 | tr_RLCMAC_DATA)) -> value data_msg { |
| 1949 | if (f_dl_block_rrbp_valid(data_msg.dl_block)) { |
| 1950 | if (num_poll_recv == 0) { |
| 1951 | /* ACK first one so PCU detects we are there and doesn't retransmit Imm Ass */ |
| 1952 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, data_msg.dl_block); |
| 1953 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 1954 | f_dl_block_ack_fn(data_msg.dl_block, data_msg.raw.fn)); |
| 1955 | } else { |
| 1956 | log("Ignoring RRBP ", num_poll_recv); |
| 1957 | N3105 := N3105 + 1; |
| 1958 | } |
| 1959 | num_poll_recv := num_poll_recv + 1; |
| 1960 | } |
| 1961 | |
| 1962 | nr := ts_TsTrxBtsNum; |
| 1963 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1964 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1965 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1966 | block_nr := nr.blk_nr)); |
| 1967 | repeat; |
| 1968 | } |
| 1969 | /* At this point in time (N3105_MAX reached), PCU already moved TBF to |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame^] | 1970 | * RELEASE state so no data for it is tx'ed, hence the dummy/idle blocks: |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 1971 | */ |
| 1972 | [N3105 == N3105_MAX] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1973 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1974 | tr_RLCMAC_DUMMY_CTRL)) -> value data_msg { |
| 1975 | if (not T_3195.running) { |
| 1976 | T_3195.start; |
| 1977 | /* We even send some new data, nothing should be sent to MS */ |
| 1978 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1)); |
| 1979 | } |
| 1980 | nr := ts_TsTrxBtsNum; |
| 1981 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1982 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1983 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1984 | block_nr := nr.blk_nr)); |
| 1985 | repeat; |
| 1986 | } |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame^] | 1987 | [mp_osmo_pcu_newer_than_0_9_0 and N3105 == N3105_MAX] |
| 1988 | BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 1989 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 1990 | omit)) -> value data_msg { |
| 1991 | /* We may already receive idle blocks before our own TTCN3 timer |
| 1992 | * triggers due to the TBF being released. Keep going until our T_3195 triggers. */ |
| 1993 | nr := ts_TsTrxBtsNum; |
| 1994 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 1995 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 1996 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 1997 | block_nr := nr.blk_nr)); |
| 1998 | repeat; |
| 1999 | } |
Pau Espin Pedrol | bf8c71f | 2021-04-20 12:23:28 +0200 | [diff] [blame] | 2000 | [T_3195.running] T_3195.timeout { |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 2001 | log("T_3195 timeout"); |
Pau Espin Pedrol | bf8c71f | 2021-04-20 12:23:28 +0200 | [diff] [blame] | 2002 | /* Done in alt, wait for pending RTS initiated previously in |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame^] | 2003 | * above case before continuing (expect empty blocks on new |
| 2004 | * versions, Dummy block on older versions): */ |
| 2005 | if (mp_osmo_pcu_newer_than_0_9_0) { |
| 2006 | dl_block_exp := omit; |
| 2007 | } else { |
| 2008 | dl_block_exp := tr_RLCMAC_DUMMY_CTRL; |
| 2009 | } |
Pau Espin Pedrol | bf8c71f | 2021-04-20 12:23:28 +0200 | [diff] [blame] | 2010 | BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 2011 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame^] | 2012 | dl_block_exp)); |
| 2013 | } |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 2014 | [] BTS.receive { |
| 2015 | setverdict(fail, "Unexpected BTS message"); |
| 2016 | f_shutdown(__BFILE__, __LINE__); |
| 2017 | } |
| 2018 | } |
| 2019 | |
| 2020 | /* after T_3195 timeout, TBF is released */ |
| 2021 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data2)); |
| 2022 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 2023 | |
| 2024 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2025 | f_sleep(X2002); |
| 2026 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data2, 0); |
| 2027 | |
| 2028 | /* ACK the DL block */ |
| 2029 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 2030 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 2031 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 2032 | |
| 2033 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2034 | } |
| 2035 | |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2036 | /* Verify PCU handles correctly Countdown Procedure based on BS_CV_MAX */ |
| 2037 | testcase TC_countdown_procedure() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2038 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2039 | var uint32_t sched_fn; |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2040 | var octetstring total_payload; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2041 | var GprsMS ms; |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2042 | |
| 2043 | /* Initialize NS/BSSGP side */ |
| 2044 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2045 | /* Initialize GPRS MS side */ |
| 2046 | f_init_gprs_ms(); |
| 2047 | 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] | 2048 | |
| 2049 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2050 | 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] | 2051 | |
| 2052 | /* Establish BSSGP connection to the PCU */ |
| 2053 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2054 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2055 | |
| 2056 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2057 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2058 | |
| 2059 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 2060 | contention resoultion) and make sure it is ACKED fine. */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2061 | 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] | 2062 | /* 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] | 2063 | 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] | 2064 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2065 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2066 | 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] | 2067 | |
| 2068 | /* Send enough blocks to test whole procedure: Until Nth block |
| 2069 | (N=BS_CV_MAX), CV=15 is sent, and then the decreasing countdown value is sent. |
| 2070 | */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2071 | 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] | 2072 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2073 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2074 | 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] | 2075 | |
| 2076 | /* receive one message on BSSGP with all aggregated data in payload: */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2077 | 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] | 2078 | |
| 2079 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 2080 | } |
| 2081 | |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2082 | /* Verify PCU handles correctly CS1..4 with all possible LLC payload sizes fitting alone in one RLC block */ |
| 2083 | testcase TC_ul_all_sizes() runs on RAW_PCU_Test_CT { |
| 2084 | var RlcmacDlBlock dl_block; |
| 2085 | var uint32_t dl_fn, sched_fn; |
| 2086 | var octetstring payload; |
| 2087 | var template (value) RlcmacUlBlock ul_data; |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2088 | var template (value) LlcBlockHdr blk_hdr; |
| 2089 | var template (value) LlcBlocks blocks; |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2090 | var integer blk_len; |
| 2091 | var CodingScheme tx_cs; |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2092 | var GprsMS ms; |
| 2093 | |
| 2094 | /* Initialize NS/BSSGP side */ |
| 2095 | f_init_bssgp(); |
| 2096 | /* Initialize GPRS MS side */ |
| 2097 | f_init_gprs_ms(); |
| 2098 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2099 | |
| 2100 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2101 | 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] | 2102 | |
| 2103 | /* Establish BSSGP connection to the PCU */ |
| 2104 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2105 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2106 | |
| 2107 | /* Establish an Uplink TBF */ |
| 2108 | f_ms_establish_ul_tbf(ms); |
| 2109 | |
| 2110 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 2111 | contention resoultion) and make sure it is ACKED fine. */ |
| 2112 | 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] | 2113 | blk_hdr := t_RLCMAC_LLCBLOCK_HDR(length_ind := lengthof(payload), |
| 2114 | more := false, e := true); |
| 2115 | blocks := { t_RLCMAC_LLCBLOCK(payload, blk_hdr) }; |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2116 | /* 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] | 2117 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := ms.ul_tbf.tx_cs_mcs, |
| 2118 | tfi := ms.ul_tbf.tfi, |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2119 | cv := 15, |
| 2120 | bsn := ms.ul_tbf.bsn, |
| 2121 | blocks := blocks, |
| 2122 | tlli := ms.tlli); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2123 | f_ultbf_inc_bsn(ms.ul_tbf); |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 2124 | 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] | 2125 | |
| 2126 | /* ACK and check it was received fine */ |
| 2127 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2128 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2129 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 2130 | /* receive one message on BSSGP with all aggregated data in payload: */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2131 | 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] | 2132 | |
| 2133 | /* Test sending LLC PDUS of incrementing size */ |
| 2134 | var integer max_size := 49; |
| 2135 | for (var integer i := 1; i <= max_size; i := i + 1) { |
| 2136 | var integer cv; |
| 2137 | /* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */ |
| 2138 | log("Sending DATA.ind with LLC payload size ", i); |
| 2139 | if (i < max_size - g_bs_cv_max) { |
| 2140 | cv := 15; |
| 2141 | } else { |
| 2142 | cv := max_size - i; |
| 2143 | } |
| 2144 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2145 | blk_len := 3 + 1 + i; /* 3 Header bytes + LI byte + payload length */ |
| 2146 | 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] | 2147 | payload := f_rnd_octstring(i); |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2148 | blk_hdr := t_RLCMAC_LLCBLOCK_HDR(length_ind := lengthof(payload), |
| 2149 | more := false, e := true); |
| 2150 | blocks := { t_RLCMAC_LLCBLOCK(payload, blk_hdr) }; |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2151 | /* 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] | 2152 | ul_data := t_RLCMAC_UL_DATA(cs := tx_cs, |
| 2153 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2154 | cv := cv, |
| 2155 | bsn := ms.ul_tbf.bsn, |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2156 | blocks := blocks); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2157 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2158 | f_ms_tx_ul_block(ms, ul_data); |
| 2159 | |
| 2160 | /* receive one message on BSSGP with all aggregated data in payload: */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2161 | 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] | 2162 | |
| 2163 | /* we will receive UL ACK/NACK from time to time, handle it. */ |
| 2164 | f_rx_rlcmac_dl_block(dl_block, dl_fn); |
| 2165 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 2166 | continue; |
| 2167 | } |
| 2168 | if (not match(dl_block, tr_RLCMAC_UL_ACK_NACK_GPRS(ul_tfi := ?)) and |
| 2169 | not match(dl_block, tr_RLCMAC_UL_ACK_NACK_EGPRS(ul_tfi := ?))) { |
| 2170 | setverdict(fail, "Failed to match Packet Uplink ACK / NACK:", dl_block); |
| 2171 | f_shutdown(__BFILE__, __LINE__); |
| 2172 | } |
| 2173 | |
| 2174 | log("Rx Packet Uplink ACK / NACK"); |
| 2175 | sched_fn := f_rrbp_ack_fn(dl_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 2176 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2177 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 2178 | } |
Vadim Yanitskiy | 8e6df0c | 2020-10-18 00:13:15 +0700 | [diff] [blame] | 2179 | |
| 2180 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 2181 | } |
| 2182 | |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2183 | function f_TC_ul_data_toolong_fills_padding_cs(inout GprsMS ms, CodingScheme cs, integer cv) runs on RAW_PCU_Test_CT { |
| 2184 | var octetstring payload; |
| 2185 | var template (value) RlcmacUlBlock ul_data; |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2186 | var template (value) LlcBlockHdr blk_hdr; |
| 2187 | var template (value) LlcBlocks blocks; |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2188 | var integer block_len, max_valid_data_len; |
| 2189 | timer T; |
| 2190 | |
| 2191 | block_len := f_rlcmac_cs_mcs2block_len(cs); |
| 2192 | /* We need to send with TLLI since we are in One-Phase Access Contenion |
| 2193 | * resoultion), so that's -4 bytes of data, -3 for headers, -1 for LI |
| 2194 | * indicator, -1 for spare bits octet at the end */ |
| 2195 | max_valid_data_len := block_len - 4 - 3 - 1 - 1; |
| 2196 | 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] | 2197 | blk_hdr := t_RLCMAC_LLCBLOCK_HDR(length_ind := lengthof(payload), |
| 2198 | more := false, e := true); |
| 2199 | blocks := { t_RLCMAC_LLCBLOCK(payload, blk_hdr) }; |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2200 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := cs, |
| 2201 | tfi := ms.ul_tbf.tfi, |
Vadim Yanitskiy | ceb1f98 | 2020-10-17 15:58:19 +0700 | [diff] [blame] | 2202 | cv := cv, |
| 2203 | bsn := ms.ul_tbf.bsn, |
| 2204 | blocks := blocks, |
| 2205 | tlli := ms.tlli); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2206 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2207 | f_ms_tx_data_ind(ms, enc_RlcmacUlBlock(valueof(ul_data))); |
| 2208 | |
| 2209 | T.start(0.5); |
| 2210 | alt { |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2211 | [] 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] | 2212 | setverdict(fail, "LLC PDU in Malformed RLC block was forwarded"); |
| 2213 | f_shutdown(__BFILE__, __LINE__); |
| 2214 | } |
| 2215 | [] T.timeout { |
| 2216 | setverdict(pass); |
| 2217 | } |
| 2218 | } |
| 2219 | } |
| 2220 | /* Verify PCU finds out incorrectly formated RLC block and discards it. This |
| 2221 | blocks intentionally contain last byte of data placed in last byte of RLC |
| 2222 | containing padding/spare bits, which is incorrect. Spare bits exist and are |
| 2223 | described for CS2..4 in 3GPP TS 44.060 Table 10.2.1: "RLC data block size, |
| 2224 | discounting padding in octet" */ |
| 2225 | testcase TC_ul_data_toolong_fills_padding() runs on RAW_PCU_Test_CT { |
| 2226 | var GprsMS ms; |
| 2227 | var integer block_len, max_valid_data_len; |
| 2228 | |
| 2229 | /* Initialize NS/BSSGP side */ |
| 2230 | f_init_bssgp(); |
| 2231 | /* Initialize GPRS MS side */ |
| 2232 | f_init_gprs_ms(); |
| 2233 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2234 | |
| 2235 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2236 | 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] | 2237 | |
| 2238 | /* Establish BSSGP connection to the PCU */ |
| 2239 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2240 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2241 | |
| 2242 | /* Establish an Uplink TBF */ |
| 2243 | f_ms_establish_ul_tbf(ms); |
| 2244 | |
| 2245 | f_TC_ul_data_toolong_fills_padding_cs(ms, CS_2, 2); |
| 2246 | f_TC_ul_data_toolong_fills_padding_cs(ms, CS_3, 1); |
| 2247 | f_TC_ul_data_toolong_fills_padding_cs(ms, CS_4, 0); |
| 2248 | |
Vadim Yanitskiy | 8e6df0c | 2020-10-18 00:13:15 +0700 | [diff] [blame] | 2249 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 2250 | } |
| 2251 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2252 | /* Test scenario where MS wants to send some data on PDCH against SGSN and it is |
| 2253 | * answered, so TBFs for uplink and later for downlink are created. |
| 2254 | */ |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2255 | 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] | 2256 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2257 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2258 | var uint32_t sched_fn; |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2259 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2260 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2261 | |
| 2262 | /* Initialize NS/BSSGP side */ |
| 2263 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2264 | /* Initialize GPRS MS side */ |
| 2265 | f_init_gprs_ms(); |
| 2266 | 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] | 2267 | |
| 2268 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2269 | 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] | 2270 | |
| 2271 | /* Establish BSSGP connection to the PCU */ |
| 2272 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2273 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2274 | |
| 2275 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2276 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2277 | |
Pau Espin Pedrol | 4aac3d0 | 2020-05-13 15:13:49 +0200 | [diff] [blame] | 2278 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 2279 | contention resoultion) and make sure it is ACKED fine */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 2280 | 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] | 2281 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2282 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2283 | 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] | 2284 | |
| 2285 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2286 | 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] | 2287 | |
| 2288 | /* 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] | 2289 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 2290 | 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] | 2291 | |
| 2292 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2293 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2294 | 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] | 2295 | |
| 2296 | /* ACK the DL block */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2297 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 2298 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 2299 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 2300 | |
| 2301 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2302 | } |
| 2303 | |
| 2304 | /* Test scenario where MS wants to send some data on PDCH against SGSN and it is |
| 2305 | * answered, so TBFs for uplink and later for downlink are created. |
| 2306 | */ |
| 2307 | testcase TC_mo_ping_pong() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 2308 | var template (present) CodingScheme exp_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2309 | f_TC_mo_ping_pong_1phase_access(exp_cs_mcs); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2310 | } |
| 2311 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2312 | /* Test scenario where MS wants to send some data on PDCH against SGSN and it is |
| 2313 | * answered, so TBFs for uplink and later for downlink are created. |
| 2314 | */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2315 | private function f_TC_mo_ping_pong_2phase_access(PCUIF_Flags ind_flags, |
| 2316 | template (value) MSRadioAccessCapabilityV ms_racap, |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 2317 | template (present) CodingScheme exp_ul_cs_mcs := ?, |
| 2318 | template (present) CodingScheme exp_dl_cs_mcs := ?) |
| 2319 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2320 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2321 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 2322 | var PollFnCtx pollctx; |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2323 | var uint32_t sched_fn; |
| 2324 | var uint32_t dl_fn; |
Pau Espin Pedrol | adbbe1e | 2020-05-17 00:28:01 +0200 | [diff] [blame] | 2325 | var uint32_t unused_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2326 | var GprsMS ms; |
| 2327 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2328 | /* Initialize NS/BSSGP side */ |
| 2329 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2330 | /* Initialize GPRS MS side */ |
| 2331 | f_init_gprs_ms(); |
| 2332 | 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] | 2333 | |
| 2334 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2335 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(ind_flags)); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2336 | |
| 2337 | /* Establish BSSGP connection to the PCU */ |
| 2338 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2339 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2340 | |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 2341 | /* Send PACKET RESOURCE REQUEST to upgrade to EGPRS */ |
| 2342 | 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] | 2343 | |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2344 | if (not match(ms.ul_tbf.tx_cs_mcs, exp_ul_cs_mcs)) { |
| 2345 | 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] | 2346 | f_shutdown(__BFILE__, __LINE__); |
| 2347 | } |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2348 | |
| 2349 | /* Send one UL block (without TLLI since we are in Second-Phase Access) |
| 2350 | and make sure it is ACKED fine */ |
Pau Espin Pedrol | fdbce84 | 2021-03-03 11:43:40 +0100 | [diff] [blame] | 2351 | f_ms_tx_ul_data_block_multi(ms, 1); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2352 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2353 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 2354 | 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] | 2355 | |
| 2356 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2357 | 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] | 2358 | |
| 2359 | /* Now SGSN sends some DL data, PCU will page on PACCH */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2360 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
Pau Espin Pedrol | ddd6c3f | 2021-03-03 12:01:20 +0100 | [diff] [blame] | 2361 | /* Sleep a bit to make sure PCU received the DL data and hence it will be prioritized by scheduler: */ |
| 2362 | f_sleep(0.5); |
Vadim Yanitskiy | 7431e9e | 2020-07-21 01:59:17 +0700 | [diff] [blame] | 2363 | 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] | 2364 | /* DL Ass sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2365 | 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] | 2366 | |
Pau Espin Pedrol | adbbe1e | 2020-05-17 00:28:01 +0200 | [diff] [blame] | 2367 | /* PCU acks the UL data after having received CV=0) */ |
| 2368 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, unused_fn); |
| 2369 | |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2370 | /* 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] | 2371 | 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] | 2372 | |
| 2373 | /* ACK the DL block */ |
Pau Espin Pedrol | e8db673 | 2020-11-12 21:06:41 +0100 | [diff] [blame] | 2374 | f_dltbf_ack_block(ms.dl_tbf, dl_block, '1'B); |
| 2375 | 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] | 2376 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Pau Espin Pedrol | 02c972d | 2020-05-13 15:56:16 +0200 | [diff] [blame] | 2377 | |
| 2378 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2379 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2380 | |
| 2381 | 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] | 2382 | var template (present) CodingScheme exp_ul_cs_mcs := cs_gprs_any; |
| 2383 | var template (present) CodingScheme exp_dl_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2384 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 2385 | 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] | 2386 | } |
| 2387 | |
| 2388 | 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] | 2389 | var template (present) CodingScheme exp_ul_cs_mcs := mcs_egprs_any; |
| 2390 | var template (present) CodingScheme exp_dl_cs_mcs := mcs_egprs_any; |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 2391 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 2392 | 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] | 2393 | } |
| 2394 | |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 2395 | testcase TC_force_two_phase_access() runs on RAW_PCU_Test_CT { |
| 2396 | /* Configure PCU to force two phase access */ |
| 2397 | g_force_two_phase_access := true; |
| 2398 | |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 2399 | 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] | 2400 | var template (present) CodingScheme exp_dl_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 2401 | |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 2402 | 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] | 2403 | } |
| 2404 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2405 | /* Test scenario where SGSN wants to send some data against MS and it is |
| 2406 | * answered by the MS on PDCH, so TBFs for downlink and later for uplink are created. |
| 2407 | */ |
Vadim Yanitskiy | c67240a | 2020-10-17 15:59:37 +0700 | [diff] [blame] | 2408 | private function f_TC_mt_ping_pong(template (omit) MSRadioAccessCapabilityV_BSSGP ms_racap := omit, |
| 2409 | template (present) CodingScheme exp_cs_mcs := ?) |
| 2410 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2411 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2412 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2413 | var uint32_t sched_fn; |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2414 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2415 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2416 | |
| 2417 | /* Initialize NS/BSSGP side */ |
| 2418 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2419 | /* Initialize GPRS MS side */ |
| 2420 | f_init_gprs_ms(); |
| 2421 | 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] | 2422 | |
| 2423 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2424 | 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] | 2425 | |
| 2426 | /* Establish BSSGP connection to the PCU */ |
| 2427 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2428 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2429 | |
| 2430 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2431 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap)); |
| 2432 | 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] | 2433 | |
| 2434 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2435 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2436 | 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] | 2437 | |
Pau Espin Pedrol | 6791eb6 | 2020-05-20 18:27:10 +0200 | [diff] [blame] | 2438 | /* 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] | 2439 | f_dltbf_ack_block(ms.dl_tbf, dl_block, '1'B); |
| 2440 | 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] | 2441 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2442 | |
Pau Espin Pedrol | 6791eb6 | 2020-05-20 18:27:10 +0200 | [diff] [blame] | 2443 | /* Expect UL ass */ |
Vadim Yanitskiy | 7431e9e | 2020-07-21 01:59:17 +0700 | [diff] [blame] | 2444 | 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] | 2445 | |
Pau Espin Pedrol | 4aac3d0 | 2020-05-13 15:13:49 +0200 | [diff] [blame] | 2446 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 2447 | contention resoultion) and make sure it is ACKED fine */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2448 | 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] | 2449 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2450 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2451 | 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] | 2452 | |
| 2453 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2454 | 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] | 2455 | |
| 2456 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2457 | } |
| 2458 | |
| 2459 | testcase TC_mt_ping_pong() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 2460 | var template (present) CodingScheme exp_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2461 | f_TC_mt_ping_pong(omit, exp_cs_mcs); |
| 2462 | } |
| 2463 | |
| 2464 | /* TC_mt_ping_pong, but DL-UNITDATA contains RA Access capability with (M)CS |
| 2465 | /* information about the MS */ |
| 2466 | 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] | 2467 | var template (present) CodingScheme exp_cs_mcs := cs_gprs_any; |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 2468 | 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] | 2469 | } |
| 2470 | |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2471 | /* Verify that if PCU doesn't get one of the intermediate UL data blocks in a UL |
| 2472 | * TBF, it will request retransmission through UL ACK/NACK (with missing block |
| 2473 | * in its bitmap) when CV=0 is received (and hence it knows no more data is to |
| 2474 | * be transferred). |
| 2475 | */ |
| 2476 | testcase TC_ul_intermediate_retrans() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2477 | var RlcmacDlBlock dl_block; |
| 2478 | var template (value) RlcmacUlBlock ul_data; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2479 | var uint32_t sched_fn; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2480 | var octetstring total_payload; |
| 2481 | var octetstring payload; |
| 2482 | var octetstring lost_payload; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2483 | var uint5_t tfi; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2484 | var GprsMS ms; |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2485 | var uint32_t payload_fill_len; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2486 | |
| 2487 | /* Initialize NS/BSSGP side */ |
| 2488 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2489 | /* Initialize GPRS MS side */ |
| 2490 | f_init_gprs_ms(); |
| 2491 | 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] | 2492 | |
| 2493 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2494 | 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] | 2495 | |
| 2496 | /* Establish BSSGP connection to the PCU */ |
| 2497 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2498 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2499 | |
| 2500 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2501 | f_ms_establish_ul_tbf(ms); |
| 2502 | tfi := ms.ul_tbf.tfi; |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2503 | |
| 2504 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 2505 | contention resoultion) and make sure it is ACKED fine. */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2506 | 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] | 2507 | 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] | 2508 | |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2509 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2510 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2511 | 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] | 2512 | total_payload := payload; |
| 2513 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2514 | payload_fill_len := f_ultbf_payload_fill_length(ms.ul_tbf); |
| 2515 | |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2516 | /* Send 2 packets, skip 1 (inc bsn) and send another one */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2517 | payload := f_rnd_octstring(payload_fill_len); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2518 | f_ms_tx_ul_data_block(ms, payload, cv := 15); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2519 | total_payload := total_payload & payload; |
| 2520 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2521 | payload := f_rnd_octstring(payload_fill_len); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2522 | f_ms_tx_ul_data_block(ms, payload, cv := 15); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2523 | total_payload := total_payload & payload; |
| 2524 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2525 | lost_payload := f_rnd_octstring(payload_fill_len); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2526 | 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] | 2527 | total_payload := total_payload & lost_payload; |
| 2528 | |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2529 | payload := f_rnd_octstring(payload_fill_len) |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2530 | f_ms_tx_ul_data_block(ms, payload, cv := 15); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2531 | total_payload := total_payload & payload; |
| 2532 | |
| 2533 | /* 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] | 2534 | 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] | 2535 | |
| 2536 | /* On CV=0, we'll receive a UL ACK asking about missing block */ |
| 2537 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2538 | /* TODO: check ack ack bitmap (URBB) */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2539 | ul_data := t_RLCMAC_UL_DATA(cs := ms.ul_tbf.tx_cs_mcs, |
| 2540 | tfi := tfi, |
| 2541 | cv := 15, |
| 2542 | bsn := 3, |
| 2543 | blocks := {t_RLCMAC_LLCBLOCK(lost_payload)}); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2544 | f_ms_tx_ul_block(ms, ul_data); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2545 | |
| 2546 | /* Now final ack is recieved */ |
| 2547 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2548 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2549 | 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] | 2550 | |
| 2551 | /* receive one message on BSSGP with all aggregated data in payload: */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2552 | 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] | 2553 | |
| 2554 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | a416cb8 | 2020-05-15 14:09:02 +0200 | [diff] [blame] | 2555 | } |
| 2556 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2557 | /* Verify that if PCU doesn't get an ACK for first DL block after IMM ASS, it |
| 2558 | * will retry by retransmitting both the IMM ASS + DL block after poll (ack) |
| 2559 | * timeout occurs (specified by sent RRBP on DL block). */ |
| 2560 | 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] | 2561 | var RlcmacDlBlock dl_block; |
| 2562 | var octetstring data := f_rnd_octstring(10); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2563 | var uint32_t dl_fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2564 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2565 | |
| 2566 | /* Initialize NS/BSSGP side */ |
| 2567 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2568 | /* Initialize GPRS MS side */ |
| 2569 | f_init_gprs_ms(); |
| 2570 | 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] | 2571 | |
| 2572 | /* Initialize the PCU interface abstraction */ |
| 2573 | f_init_raw(testcasename()); |
| 2574 | |
| 2575 | /* Establish BSSGP connection to the PCU */ |
| 2576 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2577 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2578 | |
| 2579 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2580 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 2581 | 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] | 2582 | |
| 2583 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2584 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2585 | 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] | 2586 | |
| 2587 | /* Now we don't ack the dl block (emulate MS failed receiveing IMM ASS |
| 2588 | * or GPRS DL, or DL ACK was lost for some reason). As a result, PCU |
| 2589 | * should retrigger IMM ASS + GPRS DL procedure after poll timeout. */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2590 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Vadim Yanitskiy | 2e213ae | 2020-05-06 22:26:17 +0700 | [diff] [blame] | 2591 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2592 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2593 | f_sleep(X2002); |
Vadim Yanitskiy | b6733a6 | 2020-05-10 14:39:00 +0700 | [diff] [blame] | 2594 | 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] | 2595 | |
| 2596 | /* ACK the DL block */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2597 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 2598 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 2599 | f_dl_block_ack_fn(dl_block, dl_fn)); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 2600 | |
| 2601 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 2602 | } |
| 2603 | |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2604 | /* Verify scheduling of multiple Downlink data blocks during one RRBP. */ |
| 2605 | testcase TC_dl_flow_more_blocks() runs on RAW_PCU_Test_CT { |
| 2606 | var AckNackDescription ack_nack_desc := valueof(t_AckNackDescription_init); |
| 2607 | var octetstring data := f_rnd_octstring(16); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2608 | var PacketDlAssign dl_tbf_ass; |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2609 | var RlcmacDlBlock dl_block; |
| 2610 | var uint32_t ack_fn; |
| 2611 | var uint32_t fn; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2612 | var GprsMS ms; |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2613 | timer T := 5.0; |
| 2614 | |
| 2615 | /* Initialize NS/BSSGP side */ |
| 2616 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2617 | /* Initialize GPRS MS side */ |
| 2618 | f_init_gprs_ms(); |
| 2619 | ms := g_ms[0]; /* We only use first MS in this test */ |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2620 | |
| 2621 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2622 | f_init_raw(testcasename(), ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2623 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 2624 | f_statsd_reset(); |
| 2625 | |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2626 | /* Establish BSSGP connection to the PCU */ |
| 2627 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2628 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2629 | |
| 2630 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2631 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 2632 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2633 | |
| 2634 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 2635 | f_sleep(X2002); |
| 2636 | |
| 2637 | /* Expect the first (GPRS DL) block with bsn=0 and rrbp_valid=1 */ |
| 2638 | 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] | 2639 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2640 | |
| 2641 | /* TDMA frame number on which we are supposed to send the ACK */ |
| 2642 | ack_fn := f_dl_block_ack_fn(dl_block, fn); |
| 2643 | |
| 2644 | /* SGSN sends more blocks during the indicated RRBP */ |
| 2645 | for (var integer bsn := 1; bsn < 63; bsn := bsn + 1) { |
| 2646 | data := f_rnd_octstring(16); /* Random LLC data */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2647 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2648 | |
| 2649 | f_rx_rlcmac_dl_block_exp_data(dl_block, fn, data, bsn); |
| 2650 | |
| 2651 | /* Make sure this block has the same TFI as was assigned |
| 2652 | * FIXME: this is only valid for GPRS, not EGPRS. */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2653 | 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] | 2654 | setverdict(fail, "Rx DL data block with unexpected TFI: ", |
| 2655 | dl_block.data.mac_hdr.hdr_ext.tfi); |
| 2656 | f_shutdown(__BFILE__, __LINE__); |
| 2657 | } |
| 2658 | |
| 2659 | /* Keep Ack/Nack description updated */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2660 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2661 | |
| 2662 | /* Break if this is the end of RRBP */ |
| 2663 | if (fn == ack_fn) { |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2664 | ms.dl_tbf.acknack_desc.final_ack := '1'B; |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2665 | break; |
| 2666 | } |
| 2667 | } |
| 2668 | |
| 2669 | /* This is the end of RRBP, send Packet Downlink Ack/Nack */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 2670 | 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] | 2671 | |
| 2672 | /* Make sure that the next block (after the Ack) is dummy */ |
| 2673 | f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 2674 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 2675 | var StatsDExpects expect := { |
| 2676 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 0, max := 0}, |
| 2677 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 1, max := 1}, |
| 2678 | { name := "TTCN3.bts.0.immediate.assignment_UL", mtype := "c", min := 0, max := 0}, |
| 2679 | { name := "TTCN3.bts.0.tbf.dl.alloc", mtype := "c", min := 1, max := 1}, |
| 2680 | { 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] | 2681 | { 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] | 2682 | { name := "TTCN3.bts.0.rlc.ul_payload_bytes", mtype := "c", min := 0, max := 0} |
| 2683 | }; |
| 2684 | f_statsd_expect(expect); |
| 2685 | |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 2686 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2687 | } |
| 2688 | |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2689 | /* Verify Decoding and segmentation of UL LLC PDUs into RLC data blocks, OS#4559. |
| 2690 | * Check "GPRS from A-Z" slide "Example of LI-Field and E-Bit" page 186. |
| 2691 | * Check "3GPP TS 44.060" Annex B. */ |
| 2692 | testcase TC_ul_flow_multiple_llc_blocks() runs on RAW_PCU_Test_CT { |
| 2693 | var RlcmacDlBlock dl_block; |
| 2694 | var octetstring dataA := f_rnd_octstring(20); |
| 2695 | var octetstring dataB := f_rnd_octstring(13); |
| 2696 | var octetstring dataC := f_rnd_octstring(3); |
| 2697 | var octetstring dataD := f_rnd_octstring(12); |
| 2698 | var uint32_t sched_fn; |
| 2699 | var GprsMS ms; |
| 2700 | var template (value) RlcmacUlBlock ul_data; |
| 2701 | |
| 2702 | /* Initialize NS/BSSGP side */ |
| 2703 | f_init_bssgp(); |
| 2704 | /* Initialize GPRS MS side */ |
| 2705 | f_init_gprs_ms(); |
| 2706 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2707 | |
| 2708 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 2709 | 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] | 2710 | |
| 2711 | /* Establish BSSGP connection to the PCU */ |
| 2712 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 2713 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2714 | |
| 2715 | /* Establish an Uplink TBF */ |
| 2716 | f_ms_establish_ul_tbf(ms); |
| 2717 | |
| 2718 | /* Summary of what's transmitted: |
| 2719 | * 1- UL RlcDataBlock(dataA) [BSN=0, CV=3] |
| 2720 | * 2- UL RlcDataBlock(dataA finished, dataB starts) [BSN=1, CV=2] |
| 2721 | * 3- UL RlcDataBlock(dataB finished, dataC starts and finishes, dataD starts) [BSN=2, CV=1] |
| 2722 | * 4- UL RlcDataBlock(dataD finishes) [BSN=3, CV=0] |
| 2723 | * And on SGSN we receive 4 packets, one for each LlcBlock dataA..D. |
| 2724 | * We'll also receive some UL ACK/NACK we need to reply with CTRL ACK. |
| 2725 | */ |
| 2726 | |
| 2727 | /* UL RlcDataBlock(dataA) [BSN=0, CV=3] */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2728 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := CS_1, |
| 2729 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2730 | cv := 3, |
| 2731 | bsn := ms.ul_tbf.bsn, |
| 2732 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataA, 0, 16)) }, |
| 2733 | tlli := ms.tlli); |
| 2734 | /* Indicate no llc header, meaning first LLC block doesn't finish in current |
| 2735 | * RLCMAC block being sent. */ |
| 2736 | ul_data.data.mac_hdr.e := true; |
| 2737 | f_ultbf_inc_bsn(ms.ul_tbf); |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 2738 | 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] | 2739 | |
| 2740 | /* UL RlcDataBlock(dataA finished, dataB starts) [BSN=1, CV=2] */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2741 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := CS_1, |
| 2742 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2743 | cv := 2, |
| 2744 | bsn := ms.ul_tbf.bsn, |
| 2745 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataA, 16, 4), |
| 2746 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 4, more := true, e := true)), |
| 2747 | t_RLCMAC_LLCBLOCK(substr(dataB, 0, 11)) |
| 2748 | }, |
| 2749 | tlli := ms.tlli); |
| 2750 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2751 | f_ms_tx_ul_block(ms, ul_data); |
| 2752 | |
| 2753 | /* UL block dataA should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2754 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id, dataA)); |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2755 | |
| 2756 | /* 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] | 2757 | ul_data := t_RLCMAC_UL_DATA_TLLI(cs := CS_1, |
| 2758 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2759 | cv := 1, |
| 2760 | bsn := ms.ul_tbf.bsn, |
| 2761 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataB, 11, 2), |
| 2762 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 2, more := true, e := false)), |
| 2763 | t_RLCMAC_LLCBLOCK(substr(dataC, 0, 3), |
| 2764 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 3, more := true, e := true)), |
| 2765 | t_RLCMAC_LLCBLOCK(substr(dataD, 0, 9)) |
| 2766 | }, |
| 2767 | tlli := ms.tlli); |
| 2768 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2769 | f_ms_tx_ul_block(ms, ul_data); |
| 2770 | |
| 2771 | /* UL block dataB and dataC should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2772 | BSSGP[0].receive(tr_BSSGP_UL_UD(ms.tlli, mp_gb_cfg.bvc[0].cell_id, dataB)); |
| 2773 | 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] | 2774 | |
| 2775 | /* UL RlcDataBlock(dataD finishes) [BSN=3, CV=0] */ |
Pau Espin Pedrol | cb00c52 | 2020-11-06 19:52:05 +0100 | [diff] [blame] | 2776 | ul_data := t_RLCMAC_UL_DATA_TLLI( |
| 2777 | cs := CS_1, |
| 2778 | tfi := ms.ul_tbf.tfi, |
Pau Espin Pedrol | 05b6c17 | 2020-06-26 17:28:23 +0200 | [diff] [blame] | 2779 | cv := 0, |
| 2780 | bsn := ms.ul_tbf.bsn, |
| 2781 | blocks := { t_RLCMAC_LLCBLOCK(substr(dataD, 9, 3), |
| 2782 | t_RLCMAC_LLCBLOCK_HDR(length_ind := 3, more := false, e := true)) |
| 2783 | }, |
| 2784 | tlli := ms.tlli); |
| 2785 | f_ultbf_inc_bsn(ms.ul_tbf); |
| 2786 | f_ms_tx_ul_block(ms, ul_data); |
| 2787 | |
| 2788 | /* UL block dataB and dataD should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 2789 | 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] | 2790 | |
| 2791 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 2792 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2793 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 2794 | |
| 2795 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2796 | } |
| 2797 | |
Pau Espin Pedrol | 90fdfed | 2021-03-02 17:29:32 +0100 | [diff] [blame] | 2798 | /* Validate an Imm Assignment is retransmitted if first RRBP requesting DL |
| 2799 | * ACK/NACK is not answered */ |
| 2800 | testcase TC_dl_no_ack_retrans_imm_ass() runs on RAW_PCU_Test_CT { |
| 2801 | var RlcmacDlBlock dl_block; |
| 2802 | var octetstring data1 := f_rnd_octstring(200); |
| 2803 | var octetstring data2 := f_rnd_octstring(10); |
| 2804 | var uint32_t dl_fn; |
| 2805 | var GprsMS ms; |
| 2806 | var template (value) TsTrxBtsNum nr; |
| 2807 | var BTS_PDTCH_Block data_msg; |
| 2808 | |
| 2809 | /* Initialize NS/BSSGP side */ |
| 2810 | f_init_bssgp(); |
| 2811 | /* Initialize GPRS MS side */ |
| 2812 | f_init_gprs_ms(); |
| 2813 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2814 | |
| 2815 | /* Initialize the PCU interface abstraction */ |
| 2816 | f_init_raw(testcasename()) |
| 2817 | |
| 2818 | /* Establish BSSGP connection to the PCU */ |
| 2819 | f_bssgp_establish(); |
| 2820 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 2821 | |
| 2822 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 2823 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data1)); |
| 2824 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 2825 | |
| 2826 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2827 | f_sleep(X2002); |
| 2828 | |
| 2829 | /* Recv DL data until receiving RRBP to DL ACK (because it's last queued DL data) */ |
| 2830 | while (true) { |
| 2831 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, ?, ?); |
| 2832 | |
| 2833 | /* Keep Ack/Nack description updated (except for last BSN) */ |
| 2834 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block); |
| 2835 | |
| 2836 | if (f_dl_block_rrbp_valid(dl_block)) { |
| 2837 | /* Don't transmit DL ACK here on purpose ignore it */ |
| 2838 | break; |
| 2839 | } |
| 2840 | } |
| 2841 | |
| 2842 | /* PCU starts whole process again */ |
| 2843 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 2844 | |
| 2845 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 2846 | f_sleep(X2002); |
| 2847 | |
| 2848 | /* Recv DL data until receiving RRBP to DL ACK (because it's last queued |
| 2849 | /* DL data), after that we receive only DUMMY blocks so we are done */ |
| 2850 | var boolean data_received := false; |
| 2851 | nr := ts_TsTrxBtsNum; |
| 2852 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 2853 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 2854 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 2855 | block_nr := nr.blk_nr)); |
| 2856 | alt { |
| 2857 | [data_received] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 2858 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 2859 | tr_RLCMAC_DUMMY_CTRL)) { /* done */ } |
| 2860 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 2861 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 2862 | tr_RLCMAC_DATA)) -> value data_msg { |
| 2863 | data_received := true; |
| 2864 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, data_msg.dl_block); |
| 2865 | if (data_msg.dl_block.data.mac_hdr.hdr_ext.fbi) { |
| 2866 | log("Received FINAL_ACK"); |
| 2867 | ms.dl_tbf.acknack_desc.final_ack := '1'B; |
| 2868 | } |
| 2869 | if (f_dl_block_rrbp_valid(data_msg.dl_block)) { |
| 2870 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 2871 | f_dl_block_ack_fn(dl_block, data_msg.raw.fn)); |
| 2872 | } |
| 2873 | nr := ts_TsTrxBtsNum; |
| 2874 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 2875 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 2876 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), |
| 2877 | block_nr := nr.blk_nr)); |
| 2878 | repeat; |
| 2879 | } |
| 2880 | [] BTS.receive { |
| 2881 | setverdict(fail, "Unexpected BTS message"); |
| 2882 | f_shutdown(__BFILE__, __LINE__); |
| 2883 | } |
| 2884 | } |
| 2885 | |
| 2886 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2887 | } |
| 2888 | |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 2889 | /* Verify allocation and use of multislot tbf, triggered by MS class provided in SGSN. SYS#5131 */ |
| 2890 | 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] | 2891 | 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] | 2892 | var octetstring data := f_rnd_octstring(10); |
| 2893 | var PacketDlAssign dl_tbf_ass; |
| 2894 | var RlcmacDlBlock dl_block; |
| 2895 | var uint32_t poll_fn; |
| 2896 | var uint32_t sched_fn; |
| 2897 | var GprsMS ms; |
| 2898 | timer T := 5.0; |
| 2899 | |
| 2900 | /* Initialize NS/BSSGP side */ |
| 2901 | f_init_bssgp(); |
| 2902 | /* Initialize GPRS MS side */ |
| 2903 | f_init_gprs_ms(); |
| 2904 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2905 | |
| 2906 | /* Only 1 TRX with 8 PDCH */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 2907 | f_PCUIF_PDCHMask_set(info_ind, '11111111'B, 0); |
| 2908 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 2909 | |
| 2910 | /* Initialize the PCU interface abstraction */ |
| 2911 | f_init_raw(testcasename(), info_ind); |
| 2912 | |
| 2913 | /* Establish BSSGP connection to the PCU */ |
| 2914 | f_bssgp_establish(); |
| 2915 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 2916 | |
| 2917 | /* Establish an Uplink TBF, this way the PCU can send DL Assignment |
| 2918 | through PDCH (no multiblock assignment possible through PCH) */ |
| 2919 | f_ms_establish_ul_tbf(ms); |
| 2920 | |
| 2921 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 2922 | contention resoultion) and make sure it is ACKED fine */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 2923 | f_ms_tx_ul_data_block(ms, data, with_tlli := true, fn := ms.ul_tbf.start_time_fn, |
| 2924 | nr := f_ms_tx_TsTrxBtsNum(ms)); |
Pau Espin Pedrol | 0ea8b6f | 2020-10-29 20:48:43 +0100 | [diff] [blame] | 2925 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2926 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, poll_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2927 | |
| 2928 | /* SGSN sends some DL data, PCU will assign DL TBF through PACCH */ |
| 2929 | var MultislotCap_GPRS_BSSGP mscap_gprs := { |
| 2930 | gprsmultislotclass := '10010'B, /* MS class 18, supports 8 DL and 8 UL */ |
| 2931 | gprsextendeddynalloccap := '0'B |
| 2932 | }; |
| 2933 | var MSRadioAccessCapabilityV_BSSGP ms_racap := { valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, mscap_gprs, omit)) }; |
| 2934 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap)); |
| 2935 | dl_block := f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2936 | if (f_dltbf_num_slots(ms.dl_tbf) != 8) { |
| 2937 | setverdict(fail, "Expected 8 PDCH slots allocated but got ", f_dltbf_num_slots(ms.dl_tbf)); |
| 2938 | f_shutdown(__BFILE__, __LINE__); |
| 2939 | } |
| 2940 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2941 | |
| 2942 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2943 | } |
| 2944 | |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 2945 | 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] | 2946 | 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] | 2947 | var RlcmacDlBlock dl_block; |
| 2948 | var octetstring data := f_rnd_octstring(10); |
| 2949 | var PollFnCtx pollctx; |
| 2950 | var uint32_t sched_fn; |
| 2951 | var GprsMS ms; |
| 2952 | |
| 2953 | var MultislotCap_GPRS mscap_gprs := { |
| 2954 | gprsmultislotclass := '10010'B, /* MS class 18, supports 8 DL and 8 UL */ |
| 2955 | gprsextendeddynalloccap := '0'B |
| 2956 | }; |
| 2957 | var MSRadioAccessCapabilityV ms_racap := { valueof(ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs, omit)) }; |
| 2958 | |
| 2959 | |
| 2960 | /* Initialize NS/BSSGP side */ |
| 2961 | f_init_bssgp(); |
| 2962 | /* Initialize GPRS MS side */ |
| 2963 | f_init_gprs_ms(); |
| 2964 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 2965 | |
| 2966 | /* Only 1 TRX with 8 PDCH */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 2967 | f_PCUIF_PDCHMask_set(info_ind, '11111111'B, 0); |
| 2968 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | 8155bf4 | 2020-10-29 17:34:26 +0100 | [diff] [blame] | 2969 | |
| 2970 | /* Initialize the PCU interface abstraction */ |
| 2971 | f_init_raw(testcasename(), info_ind); |
| 2972 | |
| 2973 | /* Establish BSSGP connection to the PCU */ |
| 2974 | f_bssgp_establish(); |
| 2975 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 2976 | |
| 2977 | /* Send PACKET RESOURCE REQUEST to notify the MultiSlot Class */ |
| 2978 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap)); |
| 2979 | |
| 2980 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 2981 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 2982 | |
| 2983 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 2984 | dl_block := f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2985 | if (f_dltbf_num_slots(ms.dl_tbf) != 8) { |
| 2986 | setverdict(fail, "Expected 8 PDCH slot allocated but got ", f_dltbf_num_slots(ms.dl_tbf)); |
| 2987 | f_shutdown(__BFILE__, __LINE__); |
| 2988 | } |
| 2989 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 2990 | |
| 2991 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 2992 | } |
| 2993 | |
Pau Espin Pedrol | a9f27fa | 2020-10-30 13:16:21 +0100 | [diff] [blame] | 2994 | testcase TC_ul_multislot_tbf_ms_class_from_2phase() runs on RAW_PCU_Test_CT { |
| 2995 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 2996 | var RlcmacDlBlock dl_block; |
| 2997 | var octetstring data := f_rnd_octstring(10); |
| 2998 | var PollFnCtx pollctx; |
| 2999 | var uint32_t sched_fn; |
| 3000 | var GprsMS ms; |
| 3001 | |
| 3002 | var MultislotCap_GPRS mscap_gprs := { |
| 3003 | gprsmultislotclass := '10010'B, /* MS class 18, supports 8 DL and 8 UL */ |
| 3004 | gprsextendeddynalloccap := '0'B |
| 3005 | }; |
| 3006 | var MSRadioAccessCapabilityV ms_racap := { valueof(ts_RaCapRec('0001'B /* E-GSM */, mscap_gprs, omit)) }; |
| 3007 | |
| 3008 | |
| 3009 | /* Initialize NS/BSSGP side */ |
| 3010 | f_init_bssgp(); |
| 3011 | /* Initialize GPRS MS side */ |
| 3012 | f_init_gprs_ms(); |
| 3013 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3014 | |
| 3015 | /* Only 1 TRX with 8 PDCH */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3016 | f_PCUIF_PDCHMask_set(info_ind, '11111111'B, 0); |
| 3017 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | a9f27fa | 2020-10-30 13:16:21 +0100 | [diff] [blame] | 3018 | |
| 3019 | /* Initialize the PCU interface abstraction */ |
| 3020 | f_init_raw(testcasename(), info_ind); |
| 3021 | |
| 3022 | /* Establish BSSGP connection to the PCU */ |
| 3023 | f_bssgp_establish(); |
| 3024 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3025 | |
| 3026 | /* Send PACKET RESOURCE REQUEST to notify the MultiSlot Class */ |
| 3027 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap)); |
| 3028 | |
| 3029 | if (f_ultbf_num_slots(ms.ul_tbf) != 8) { |
| 3030 | setverdict(fail, "Expected 8 PDCH slot allocated but got ", f_ultbf_num_slots(ms.ul_tbf)); |
| 3031 | f_shutdown(__BFILE__, __LINE__); |
| 3032 | } |
| 3033 | |
| 3034 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3035 | } |
| 3036 | |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3037 | /* Test scenario where MS wants to request a new TBF once the current one is |
| 3038 | * ending, by means of sending a Packet Resource Request on ul slot provided by |
| 3039 | * last Pkt Ul ACK's RRBP. |
| 3040 | * See 3GPP TS 44.060 sec 9.3.2.4.2 "Non-extended uplink TBF mode" */ |
| 3041 | 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] | 3042 | var RlcmacDlBlock dl_block; |
| 3043 | var octetstring data := f_rnd_octstring(10); |
| 3044 | var uint32_t sched_fn; |
| 3045 | var uint32_t dl_fn; |
| 3046 | var template RlcmacDlBlock acknack_tmpl; |
| 3047 | var GprsMS ms; |
| 3048 | |
| 3049 | /* Initialize NS/BSSGP side */ |
| 3050 | f_init_bssgp(); |
| 3051 | /* Initialize GPRS MS side */ |
| 3052 | f_init_gprs_ms(); |
| 3053 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3054 | |
| 3055 | /* Initialize the PCU interface abstraction */ |
| 3056 | f_init_raw(testcasename()); |
| 3057 | |
| 3058 | /* Establish BSSGP connection to the PCU */ |
| 3059 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3060 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | cdbe903 | 2020-07-07 20:20:42 +0200 | [diff] [blame] | 3061 | |
| 3062 | /* Establish an Uplink TBF */ |
| 3063 | f_ms_establish_ul_tbf(ms); |
| 3064 | |
| 3065 | /* Send one UL block (with TLLI since we are in One-Phase Access |
| 3066 | contention resoultion) and make sure it is ACKED fine */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 3067 | 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] | 3068 | |
| 3069 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3070 | 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] | 3071 | |
| 3072 | acknack_tmpl := tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi, |
| 3073 | tr_UlAckNackGprs(ms.tlli, |
| 3074 | tr_AckNackDescription(final_ack := '1'B), |
| 3075 | tr_UlAckNackGprsAdditionsRel99(tbf_est := true))) |
| 3076 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn, acknack_tmpl); |
| 3077 | |
| 3078 | /* TODO: verify TBF_EST and FinalACK are both '1' above */ |
| 3079 | |
| 3080 | /* Send PACKET RESOURCE REQUEST to request a new UL TBF */ |
Vadim Yanitskiy | f3cb4dd | 2020-07-21 01:52:33 +0700 | [diff] [blame] | 3081 | 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] | 3082 | 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] | 3083 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3084 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3085 | |
| 3086 | /* Send one UL block (without TLLI since we are in Second-Phase Access) |
| 3087 | and make sure it is ACKED fine */ |
| 3088 | f_ms_tx_ul_data_block_multi(ms, 1, with_tlli := false); /* TODO: send using cs_mcs */ |
| 3089 | |
| 3090 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3091 | 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] | 3092 | |
| 3093 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn, acknack_tmpl); |
| 3094 | /* ACK the ACK */ |
| 3095 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3096 | |
| 3097 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3098 | } |
| 3099 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3100 | /* Test CS paging over the BTS<->PCU socket. |
| 3101 | * 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. |
| 3102 | * Paging should be send on the PACCH. |
| 3103 | * |
| 3104 | * 1. Send a Paging Request over PCU socket. |
| 3105 | * 2. Send a Ready-To-Send message over PCU socket |
| 3106 | * 3. Expect a Paging Frame |
| 3107 | */ |
| 3108 | 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] | 3109 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3110 | var MobileIdentityLV mi; |
| 3111 | var octetstring mi_enc_lv; |
| 3112 | var hexstring imsi := f_gen_imsi(42); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3113 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3114 | |
| 3115 | /* Initialize NS/BSSGP side */ |
| 3116 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3117 | /* Initialize GPRS MS side */ |
| 3118 | f_init_gprs_ms(); |
| 3119 | 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] | 3120 | |
| 3121 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3122 | 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] | 3123 | |
| 3124 | /* Establish BSSGP connection to the PCU */ |
| 3125 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3126 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3127 | |
| 3128 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3129 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3130 | |
| 3131 | /* build mobile Identity */ |
| 3132 | mi := valueof(ts_MI_IMSI_LV(imsi)); |
| 3133 | mi_enc_lv := enc_MobileIdentityLV(mi); |
| 3134 | /* Send paging request */ |
| 3135 | BTS.send(ts_PCUIF_PAG_REQ(bts_nr := 0, id_lv := mi_enc_lv, chan_needed := 0, |
| 3136 | sapi :=PCU_IF_SAPI_PDTCH)); |
| 3137 | |
| 3138 | /* Receive it on BTS side towards MS */ |
| 3139 | f_rx_rlcmac_dl_block_exp_pkt_pag_req(dl_block); |
| 3140 | |
| 3141 | /* Make sure that Packet Paging Request contains the same IMSI */ |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3142 | var PacketPagingReq req := dl_block.ctrl.payload.u.paging; |
| 3143 | if (not f_pkt_paging_match_imsi(req, imsi, ps_domain := false)) { |
| 3144 | setverdict(fail, "Failed to match IMSI ", imsi, " in ", req); |
| 3145 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3146 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3147 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3148 | } |
| 3149 | |
| 3150 | /* Test CS paging over Gb (SGSN->PCU->BTS[PDCH]). |
| 3151 | */ |
| 3152 | private function f_tc_paging_cs_from_sgsn(Nsvci bvci, boolean use_ptmsi := false) |
| 3153 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3154 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3155 | var hexstring imsi := f_gen_imsi(42); |
| 3156 | var GsmTmsi tmsi; |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3157 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3158 | |
| 3159 | /* Initialize NS/BSSGP side */ |
| 3160 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3161 | /* Initialize GPRS MS side */ |
| 3162 | f_init_gprs_ms(); |
| 3163 | 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] | 3164 | |
| 3165 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3166 | 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] | 3167 | |
| 3168 | /* Establish BSSGP connection to the PCU */ |
| 3169 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3170 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3171 | |
| 3172 | /* Establish an Uplink TBF */ |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3173 | f_ms_establish_ul_tbf(ms); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3174 | |
| 3175 | /* Send paging request with or without TMSI */ |
| 3176 | if (use_ptmsi) { |
| 3177 | tmsi := oct2int(f_rnd_octstring(4)); /* Random P-TMSI */ |
| 3178 | BSSGP[0].send(ts_BSSGP_CS_PAGING_PTMSI(bvci, imsi, tmsi)); |
| 3179 | } else { |
| 3180 | BSSGP[0].send(ts_BSSGP_CS_PAGING_IMSI(bvci, imsi)); |
| 3181 | } |
| 3182 | |
| 3183 | /* Receive it on BTS side towards MS */ |
| 3184 | f_rx_rlcmac_dl_block_exp_pkt_pag_req(dl_block); |
| 3185 | |
| 3186 | /* Make sure that Packet Paging Request contains the same P-TMSI/IMSI */ |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3187 | var PacketPagingReq req := dl_block.ctrl.payload.u.paging; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3188 | if (use_ptmsi) { |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3189 | if (not f_pkt_paging_match_tmsi(req, tmsi, ps_domain := false)) { |
| 3190 | setverdict(fail, "Failed to match P-TMSI ", tmsi, " in ", req); |
| 3191 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3192 | } else { |
Vadim Yanitskiy | 3e5f074 | 2020-11-01 03:30:18 +0700 | [diff] [blame] | 3193 | if (not f_pkt_paging_match_imsi(req, imsi, ps_domain := false)) { |
| 3194 | setverdict(fail, "Failed to match IMSI ", imsi, " in ", req); |
| 3195 | } |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3196 | } |
| 3197 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3198 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3199 | } |
| 3200 | |
| 3201 | testcase TC_paging_cs_from_sgsn_sign_ptmsi() runs on RAW_PCU_Test_CT { |
| 3202 | f_tc_paging_cs_from_sgsn(0, true); |
| 3203 | } |
| 3204 | |
| 3205 | testcase TC_paging_cs_from_sgsn_sign() runs on RAW_PCU_Test_CT { |
| 3206 | f_tc_paging_cs_from_sgsn(0); |
| 3207 | } |
| 3208 | |
| 3209 | 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] | 3210 | 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] | 3211 | } |
| 3212 | |
| 3213 | /* Test PS paging over Gb (SGSN->PCU->BTS[CCCH]). |
| 3214 | */ |
| 3215 | private function f_tc_paging_ps_from_sgsn(Nsvci bvci, boolean use_ptmsi := false) |
| 3216 | runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3217 | var integer imsi_suff_tx := 423; |
| 3218 | var hexstring imsi := f_gen_imsi(imsi_suff_tx); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3219 | var GprsMS ms; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3220 | |
| 3221 | /* Initialize NS/BSSGP side */ |
| 3222 | f_init_bssgp(); |
Pau Espin Pedrol | 4f7b8fd | 2020-05-18 18:28:17 +0200 | [diff] [blame] | 3223 | /* Initialize GPRS MS side */ |
| 3224 | f_init_gprs_ms(); |
| 3225 | 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] | 3226 | |
Oliver Smith | 61b4e73 | 2021-07-22 08:14:29 +0200 | [diff] [blame] | 3227 | f_statsd_reset(); |
| 3228 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3229 | /* Establish BSSGP connection to the PCU */ |
| 3230 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3231 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3232 | |
| 3233 | /* Send BSSGP PAGING-PS (with or without TMSI), wait for RR Paging Request Type 1. |
| 3234 | * Make sure that both paging group (IMSI suffix) and Mobile Identity match. */ |
| 3235 | if (use_ptmsi) { |
| 3236 | var OCT4 tmsi := f_rnd_octstring(4); /* Random P-TMSI */ |
| 3237 | BSSGP[0].send(ts_BSSGP_PS_PAGING_PTMSI(bvci, imsi, oct2int(tmsi))); |
| 3238 | f_pcuif_rx_pch_pag_req1(t_MI_TMSI(tmsi), imsi_suff_tx); |
| 3239 | } else { |
| 3240 | BSSGP[0].send(ts_BSSGP_PS_PAGING_IMSI(bvci, imsi)); |
| 3241 | f_pcuif_rx_pch_pag_req1(tr_MI_IMSI(imsi), imsi_suff_tx); |
| 3242 | } |
| 3243 | |
Oliver Smith | 61b4e73 | 2021-07-22 08:14:29 +0200 | [diff] [blame] | 3244 | if (mp_osmo_pcu_newer_than_0_9_0) { |
| 3245 | var StatsDExpects expect := { |
Oliver Smith | 36d95d8 | 2021-08-06 22:01:53 +0200 | [diff] [blame] | 3246 | { name := "TTCN3.pcu.sgsn.0.rx_paging_ps", mtype := "c", min := 1, max := 1 }, |
| 3247 | /* After the PCU receives the paging request from SGSN, |
| 3248 | * and it doesn't have any errors, PCU sends it to the |
| 3249 | * BTS to do paging over PCH. */ |
| 3250 | { name := "TTCN3.bts.0.pch.requests", mtype := "c", min := 1, max := 1 } |
Oliver Smith | 61b4e73 | 2021-07-22 08:14:29 +0200 | [diff] [blame] | 3251 | }; |
| 3252 | f_statsd_expect(expect); |
| 3253 | } |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3254 | } |
| 3255 | |
| 3256 | testcase TC_paging_ps_from_sgsn_sign_ptmsi() runs on RAW_PCU_Test_CT { |
| 3257 | /* Initialize the PCU interface abstraction */ |
| 3258 | f_init_raw(testcasename()); |
| 3259 | |
| 3260 | f_tc_paging_ps_from_sgsn(0, true); |
Oliver Smith | 61b4e73 | 2021-07-22 08:14:29 +0200 | [diff] [blame] | 3261 | |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3262 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3263 | } |
| 3264 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3265 | 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] | 3266 | /* Initialize the PCU interface abstraction */ |
| 3267 | f_init_raw(testcasename()); |
| 3268 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3269 | f_tc_paging_ps_from_sgsn(0); |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3270 | |
| 3271 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3272 | } |
| 3273 | |
| 3274 | 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] | 3275 | /* Initialize the PCU interface abstraction */ |
| 3276 | f_init_raw(testcasename()); |
| 3277 | |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3278 | f_tc_paging_ps_from_sgsn(mp_gb_cfg.bvc[0].bvci); |
Oliver Smith | fbd3931 | 2021-07-27 15:23:39 +0200 | [diff] [blame] | 3279 | |
| 3280 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3281 | } |
| 3282 | |
Oliver Smith | e1a77c4 | 2021-07-28 13:36:09 +0200 | [diff] [blame] | 3283 | testcase TC_paging_pch_timeout() runs on RAW_PCU_Test_CT { |
| 3284 | /* Initialize the PCU interface abstraction */ |
| 3285 | f_init_raw(testcasename()); |
| 3286 | |
| 3287 | /* Set T3113 to 1s to shorten the test duration */ |
| 3288 | f_vty_config2(PCUVTY, {"pcu"}, "timer T3113 1"); |
| 3289 | |
| 3290 | /* Reset stats and send paging PS request */ |
| 3291 | f_tc_paging_ps_from_sgsn(mp_gb_cfg.bvc[0].bvci); |
| 3292 | |
| 3293 | /* Verify that counter increases when T3113 times out (MS did not start |
| 3294 | * TBF to respond to paging). */ |
| 3295 | f_sleep(1.2); |
| 3296 | var StatsDExpects expect := { |
| 3297 | { name := "TTCN3.bts.0.pch.requests.timeout", mtype := "c", min := 1, max := 1 } |
| 3298 | }; |
| 3299 | f_statsd_expect(expect); |
| 3300 | |
| 3301 | f_vty_config2(PCUVTY, {"pcu"}, "timer T3113 default"); |
| 3302 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3303 | } |
| 3304 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3305 | /* Verify osmo-pcu handles DL UNIT_DATA from SGSN with IMSI IE correctly. See OS#4729 */ |
| 3306 | testcase TC_bssgp_dl_unitdata_with_valid_imsi() runs on RAW_PCU_Test_CT { |
| 3307 | var RlcmacDlBlock dl_block; |
| 3308 | var octetstring data := f_rnd_octstring(10); |
| 3309 | var uint32_t sched_fn; |
| 3310 | var uint32_t dl_fn; |
| 3311 | var GprsMS ms; |
| 3312 | |
| 3313 | /* Initialize NS/BSSGP side */ |
| 3314 | f_init_bssgp(); |
| 3315 | /* Initialize GPRS MS side */ |
| 3316 | f_init_gprs_ms(); |
| 3317 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3318 | |
| 3319 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3320 | 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] | 3321 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 3322 | f_statsd_reset(); |
| 3323 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3324 | /* Establish BSSGP connection to the PCU */ |
| 3325 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3326 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3327 | |
| 3328 | /* Establish an Uplink TBF */ |
| 3329 | f_ms_establish_ul_tbf(ms); |
| 3330 | |
| 3331 | /* 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] | 3332 | 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] | 3333 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 3334 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3335 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3336 | |
| 3337 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3338 | 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] | 3339 | |
| 3340 | /* Now SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 3341 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI(ms.imsi))); |
| 3342 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 3343 | |
| 3344 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS: */ |
| 3345 | f_sleep(X2002); |
| 3346 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 3347 | |
| 3348 | /* ACK the DL block */ |
| 3349 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 3350 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 3351 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 3352 | |
Daniel Willmann | 535aea6 | 2020-09-21 13:27:08 +0200 | [diff] [blame] | 3353 | var StatsDExpects expect := { |
| 3354 | { name := "TTCN3.bts.0.rach.requests", mtype := "c", min := 1, max := 1}, |
| 3355 | { name := "TTCN3.bts.0.immediate.assignment_DL", mtype := "c", min := 1, max := 1}, |
| 3356 | { name := "TTCN3.bts.0.tbf.dl.alloc", mtype := "c", min := 1, max := 1}, |
| 3357 | { 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] | 3358 | { 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] | 3359 | { 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] | 3360 | }; |
| 3361 | f_statsd_expect(expect); |
| 3362 | |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3363 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3364 | } |
| 3365 | |
| 3366 | /* Verify osmo-pcu acts on incorrect IMSI IE content in DL UNIT_DATA from SGSN. See OS#4729 */ |
| 3367 | testcase TC_bssgp_dl_unitdata_with_invalid_imsi() runs on RAW_PCU_Test_CT { |
| 3368 | var RlcmacDlBlock dl_block; |
| 3369 | var octetstring data := f_rnd_octstring(10); |
| 3370 | var uint32_t sched_fn; |
| 3371 | var uint32_t dl_fn; |
| 3372 | var GprsMS ms; |
| 3373 | |
| 3374 | /* Initialize NS/BSSGP side */ |
| 3375 | f_init_bssgp(); |
| 3376 | /* Initialize GPRS MS side */ |
| 3377 | f_init_gprs_ms(); |
| 3378 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3379 | |
| 3380 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3381 | 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] | 3382 | |
| 3383 | /* Establish BSSGP connection to the PCU */ |
| 3384 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3385 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 3386 | |
| 3387 | /* Establish an Uplink TBF */ |
| 3388 | f_ms_establish_ul_tbf(ms); |
| 3389 | |
| 3390 | /* 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] | 3391 | 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] | 3392 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, sched_fn); |
| 3393 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3394 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 3395 | |
| 3396 | /* UL block should be received in SGSN */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 3397 | 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] | 3398 | |
| 3399 | /* Now SGSN sends some DL data with an invalid IMSI */ |
| 3400 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, imsi := ts_BSSGP_IMSI('1122'H))); |
| 3401 | |
Pau Espin Pedrol | f7e947a | 2021-01-25 18:51:33 +0100 | [diff] [blame] | 3402 | 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] | 3403 | |
| 3404 | /* TODO: make sure no data is sent over PCU -> MS */ |
| 3405 | |
| 3406 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3407 | } |
| 3408 | |
Pau Espin Pedrol | 2e459d6 | 2020-11-30 19:34:16 +0100 | [diff] [blame] | 3409 | private function f_tc_dl_data_no_llc_ui_dummy(template (omit) MSRadioAccessCapabilityV_BSSGP ms_racap := omit) runs on RAW_PCU_Test_CT { |
| 3410 | var AckNackDescription ack_nack_desc := valueof(t_AckNackDescription_init); |
| 3411 | var octetstring data := f_rnd_octstring(6); |
| 3412 | var RlcmacDlBlock dl_block; |
| 3413 | var GprsMS ms; |
| 3414 | var uint32_t fn; |
| 3415 | |
| 3416 | /* Initialize NS/BSSGP side */ |
| 3417 | f_init_bssgp(); |
| 3418 | /* Initialize GPRS MS side */ |
| 3419 | f_init_gprs_ms(); |
| 3420 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 3421 | |
| 3422 | /* Initialize the PCU interface abstraction */ |
| 3423 | f_init_raw(testcasename()); |
| 3424 | |
| 3425 | /* Establish BSSGP connection to the PCU */ |
| 3426 | f_bssgp_establish(); |
| 3427 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 3428 | |
| 3429 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 3430 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, ms_racap)); |
| 3431 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 3432 | |
| 3433 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 3434 | f_sleep(X2002); |
| 3435 | |
| 3436 | /* Expect the first (GPRS DL) block with bsn=0 and rrbp_valid=1 */ |
| 3437 | f_rx_rlcmac_dl_block_exp_data(dl_block, fn, data, 0); |
| 3438 | |
| 3439 | if (ischosen(dl_block.data_egprs)) { |
| 3440 | if (lengthof(dl_block.data_egprs.blocks) != 2) { |
| 3441 | setverdict(fail, "DL EGPRS block has unexpected number of LLC frames: ", dl_block.data_egprs); |
| 3442 | f_shutdown(__BFILE__, __LINE__); |
| 3443 | } |
| 3444 | if (dl_block.data_egprs.blocks[1].hdr.length_ind != 127) { |
| 3445 | setverdict(fail, "DL EGPRS block 2nd llc frame is not padding!: ", dl_block.data_egprs); |
| 3446 | f_shutdown(__BFILE__, __LINE__); |
| 3447 | } |
| 3448 | if (not match(dl_block.data_egprs.blocks[1].payload, |
| 3449 | f_pad_oct(''O, lengthof(dl_block.data_egprs.blocks[1].payload), '2B'O))) { |
| 3450 | setverdict(fail, "DL EGPRS block 2nd llc frame is not padding!: ", dl_block.data_egprs); |
| 3451 | f_shutdown(__BFILE__, __LINE__); |
| 3452 | } |
| 3453 | } else if (lengthof(dl_block.data.blocks) > 1) { |
| 3454 | setverdict(fail, "DL GPRS block has extra unexpected LLC frames: ", dl_block.data); |
| 3455 | f_shutdown(__BFILE__, __LINE__); |
| 3456 | } |
| 3457 | |
| 3458 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3459 | } |
| 3460 | |
| 3461 | /* Verify osmo-pcu Doesn't append LLC UI dummy frames to rlcmac blocks |
| 3462 | * containing llc data. See OS#4849 */ |
| 3463 | testcase TC_dl_gprs_data_no_llc_ui_dummy() runs on RAW_PCU_Test_CT { |
| 3464 | f_tc_dl_data_no_llc_ui_dummy(omit); |
| 3465 | } |
| 3466 | |
| 3467 | /* Verify osmo-pcu Doesn't append LLC UI dummy frames to rlcmac blocks |
| 3468 | * containing llc data. See OS#4849 */ |
| 3469 | 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] | 3470 | 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] | 3471 | } |
| 3472 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3473 | private function f_TC_egprs_pkt_chan_req(in EGPRSPktChRequest req, |
Vadim Yanitskiy | 4389390 | 2020-05-29 15:21:50 +0700 | [diff] [blame] | 3474 | template GsmRrMessage t_imm_ass := ?, |
| 3475 | PCUIF_BurstType bt := BURST_TYPE_1) |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3476 | runs on RAW_PCU_Test_CT { |
Vadim Yanitskiy | 4389390 | 2020-05-29 15:21:50 +0700 | [diff] [blame] | 3477 | var GsmRrMessage rr_msg; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3478 | var uint16_t ra11; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3479 | |
| 3480 | ra11 := enc_EGPRSPktChRequest2uint(req); |
| 3481 | log("Sending EGPRS Packet Channel Request (", ra11, "): ", req); |
| 3482 | |
Vadim Yanitskiy | 28d18e1 | 2020-05-29 15:25:59 +0700 | [diff] [blame] | 3483 | 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] | 3484 | if (not match(rr_msg, t_imm_ass)) { |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3485 | setverdict(fail, "Immediate Assignment does not match"); |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3486 | f_shutdown(__BFILE__, __LINE__); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3487 | } |
| 3488 | |
| 3489 | setverdict(pass); |
| 3490 | } |
| 3491 | |
| 3492 | testcase TC_egprs_pkt_chan_req_signalling() runs on RAW_PCU_Test_CT { |
| 3493 | var template GsmRrMessage imm_ass; |
| 3494 | var template IaRestOctets rest; |
| 3495 | var template EgprsUlAss ul_ass; |
| 3496 | |
| 3497 | /* Initialize the PCU interface abstraction */ |
| 3498 | f_init_raw(testcasename()); |
| 3499 | |
| 3500 | var EGPRSPktChRequest req := { |
| 3501 | /* NOTE: other fields are set in the loop */ |
| 3502 | signalling := { tag := '110011'B } |
| 3503 | }; |
| 3504 | |
| 3505 | for (var integer i := 0; i < 6; i := i + 1) { |
| 3506 | var BIT5 ext_ra := int2bit(f_rnd_int(32), 5); |
| 3507 | req.signalling.random_bits := ext_ra; |
| 3508 | |
| 3509 | /* For signalling, do we expect Multiblock UL TBF Assignment? */ |
| 3510 | ul_ass := tr_EgprsUlAssMultiblock(ext_ra := ext_ra); |
| 3511 | rest := tr_IaRestOctets_EGPRSULAss(ul_ass); |
| 3512 | imm_ass := tr_IMM_TBF_ASS(dl := false, rest := rest); |
| 3513 | |
| 3514 | f_TC_egprs_pkt_chan_req(req, imm_ass); |
| 3515 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3516 | |
| 3517 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3518 | } |
| 3519 | |
| 3520 | testcase TC_egprs_pkt_chan_req_one_phase() runs on RAW_PCU_Test_CT { |
| 3521 | var template GsmRrMessage imm_ass; |
| 3522 | var template IaRestOctets rest; |
| 3523 | var template EgprsUlAss ul_ass; |
| 3524 | |
| 3525 | /* Initialize the PCU interface abstraction */ |
| 3526 | f_init_raw(testcasename()); |
| 3527 | |
| 3528 | var EGPRSPktChRequest req := { |
| 3529 | /* NOTE: other fields are set in the loop */ |
| 3530 | one_phase := { tag := '0'B } |
| 3531 | }; |
| 3532 | |
| 3533 | for (var integer i := 0; i < 6; i := i + 1) { |
| 3534 | var BIT5 ext_ra := int2bit(f_rnd_int(32), 5); |
| 3535 | var BIT5 mslot_class := int2bit(f_rnd_int(32), 5); |
| 3536 | var BIT2 priority := substr(ext_ra, 0, 2); |
| 3537 | var BIT3 rand := substr(ext_ra, 2, 3); |
| 3538 | |
| 3539 | req.one_phase.multislot_class := mslot_class; |
| 3540 | req.one_phase.priority := priority; |
| 3541 | req.one_phase.random_bits := rand; |
| 3542 | |
| 3543 | /* For one phase access, do we expect Dynamic UL TBF Assignment? */ |
| 3544 | ul_ass := tr_EgprsUlAssDynamic(ext_ra := ext_ra); |
| 3545 | rest := tr_IaRestOctets_EGPRSULAss(ul_ass); |
| 3546 | imm_ass := tr_IMM_TBF_ASS(dl := false, rest := rest); |
| 3547 | |
| 3548 | f_TC_egprs_pkt_chan_req(req, imm_ass); |
| 3549 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3550 | |
| 3551 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3552 | } |
| 3553 | |
| 3554 | testcase TC_egprs_pkt_chan_req_two_phase() runs on RAW_PCU_Test_CT { |
| 3555 | var template GsmRrMessage imm_ass; |
| 3556 | var template IaRestOctets rest; |
| 3557 | var template EgprsUlAss ul_ass; |
| 3558 | |
| 3559 | /* Initialize the PCU interface abstraction */ |
| 3560 | f_init_raw(testcasename()); |
| 3561 | |
| 3562 | var EGPRSPktChRequest req := { |
| 3563 | /* NOTE: other fields are set in the loop */ |
| 3564 | two_phase := { tag := '110000'B } |
| 3565 | }; |
| 3566 | |
| 3567 | for (var integer i := 0; i < 6; i := i + 1) { |
| 3568 | var BIT5 ext_ra := int2bit(f_rnd_int(32), 5); |
| 3569 | var BIT2 priority := substr(ext_ra, 0, 2); |
| 3570 | var BIT3 rand := substr(ext_ra, 2, 3); |
| 3571 | |
| 3572 | req.two_phase.priority := priority; |
| 3573 | req.two_phase.random_bits := rand; |
| 3574 | |
| 3575 | /* For two phase access, do we expect Multiblock UL TBF Assignment? */ |
| 3576 | ul_ass := tr_EgprsUlAssMultiblock(ext_ra := ext_ra); |
| 3577 | rest := tr_IaRestOctets_EGPRSULAss(ul_ass); |
| 3578 | imm_ass := tr_IMM_TBF_ASS(dl := false, rest := rest); |
| 3579 | |
| 3580 | f_TC_egprs_pkt_chan_req(req, imm_ass); |
| 3581 | } |
Vadim Yanitskiy | 91f8a09 | 2020-05-06 21:41:05 +0700 | [diff] [blame] | 3582 | |
| 3583 | f_shutdown(__BFILE__, __LINE__, final := true); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 3584 | } |
| 3585 | |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 3586 | private function f_TC_egprs_pkt_chan_req_reject(bitstring ra11, uint32_t fn, |
| 3587 | template IARRestOctets rest := ?, |
Pau Espin Pedrol | a5cee4c | 2021-04-26 13:50:29 +0200 | [diff] [blame] | 3588 | PCUIF_BurstType bt := BURST_TYPE_1, |
| 3589 | template WaitIndication wi := ?) |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 3590 | runs on RAW_PCU_Test_CT { |
| 3591 | var template ReqRefWaitInd tr_ref; |
| 3592 | var GsmRrMessage rr_msg; |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 3593 | |
| 3594 | /* Send RACH.ind with malformed EGPRS Packet Channel Request */ |
| 3595 | BTS.send(ts_PCUIF_RACH_IND(bts_nr := 0, trx_nr := 0, ts_nr := 0, |
| 3596 | ra := bit2int(ra11), is_11bit := 1, |
| 3597 | burst_type := bt, fn := fn, |
| 3598 | arfcn := 871)); |
| 3599 | |
| 3600 | /* Abuse f_pcuif_rx_imm_ass(): wait for Immediate Assignment Reject */ |
Vadim Yanitskiy | 7466c33 | 2020-05-28 20:41:19 +0700 | [diff] [blame] | 3601 | 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] | 3602 | |
| 3603 | /* Just to have a short-name reference to the actual message */ |
| 3604 | var ImmediateAssignmentReject iar := rr_msg.payload.imm_ass_rej; |
| 3605 | |
| 3606 | /* Make sure that Request Reference list contains at least one entry |
| 3607 | * 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] | 3608 | tr_ref := tr_ReqRefWaitInd(f_compute_ReqRef(127, fn), wi); |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 3609 | if (not match(iar.payload, { *, tr_ref, * })) { |
| 3610 | setverdict(fail, "Request Reference list does not match"); |
| 3611 | f_shutdown(__BFILE__, __LINE__); |
| 3612 | } |
| 3613 | |
| 3614 | /* Match Feature Indicator (must indicate PS domain) */ |
| 3615 | if (not match(iar.feature_ind, FeatureIndicator:{?, false, true})) { |
| 3616 | setverdict(fail, "Feature Indicator does not match"); |
| 3617 | f_shutdown(__BFILE__, __LINE__); |
| 3618 | } |
| 3619 | |
| 3620 | /* Match IAR Rest Octets */ |
| 3621 | if (not match(iar.rest_octets, rest)) { |
| 3622 | setverdict(fail, "IAR Rest Octets does not match: ", |
| 3623 | iar.rest_octets, " vs expected ", rest); |
| 3624 | f_shutdown(__BFILE__, __LINE__); |
| 3625 | } |
| 3626 | |
| 3627 | setverdict(pass); |
| 3628 | } |
| 3629 | |
| 3630 | /* Verify the contents of RR Immediate Assignment Reject message and its |
| 3631 | * Rest Octets sent in response to EGPRS Packet Channel Request (11 bit). */ |
| 3632 | testcase TC_egprs_pkt_chan_req_reject_content() runs on RAW_PCU_Test_CT { |
| 3633 | var template IARRestOctets rest; |
| 3634 | var BIT5 ext_ra; |
| 3635 | |
| 3636 | /* Initialize the PCU interface abstraction */ |
| 3637 | f_init_raw(testcasename()); |
| 3638 | |
| 3639 | for (var integer i := 0; i < 6; i := i + 1) { |
| 3640 | ext_ra := int2bit(f_rnd_int(32), 5); /* 5 LSB's of RA11 */ |
| 3641 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(ext_ra), * }); |
| 3642 | |
| 3643 | /* Intentionally incorrect message (see table 11.2.5a.2) */ |
| 3644 | f_TC_egprs_pkt_chan_req_reject('111111'B & ext_ra, 1337 + i, rest); |
| 3645 | } |
| 3646 | |
| 3647 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3648 | } |
| 3649 | |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 3650 | /* At the moment, the IUT does not support any emergency services. Make sure |
| 3651 | * that EGPRS Packet Channel Request for an emergency call is properly rejected. */ |
| 3652 | testcase TC_egprs_pkt_chan_req_reject_emergency() runs on RAW_PCU_Test_CT { |
| 3653 | var template IARRestOctets rest; |
| 3654 | var BIT5 ext_ra; |
| 3655 | var BIT11 ra11; |
| 3656 | |
| 3657 | /* Initialize the PCU interface abstraction */ |
| 3658 | f_init_raw(testcasename()); |
| 3659 | |
| 3660 | var EGPRSPktChRequest req := { |
| 3661 | /* NOTE: other fields are set in the loop */ |
| 3662 | emergency := { tag := '110111'B } |
| 3663 | }; |
| 3664 | |
| 3665 | for (var integer i := 0; i < 6; i := i + 1) { |
| 3666 | ext_ra := int2bit(f_rnd_int(32), 5); /* 5 LSB's of RA11 */ |
| 3667 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(ext_ra), * }); |
| 3668 | |
| 3669 | req.emergency.random_bits := ext_ra; |
| 3670 | ra11 := enc_EGPRSPktChRequest2bits(req); |
| 3671 | |
| 3672 | /* Intentionally incorrect message (see table 11.2.5a.2) */ |
| 3673 | f_TC_egprs_pkt_chan_req_reject(ra11, 1337 + i, rest); |
| 3674 | } |
| 3675 | |
| 3676 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3677 | } |
| 3678 | |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 3679 | /* Make sure that IUT responds with RR Immediate Assignment Reject due to exhaustion. */ |
| 3680 | 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] | 3681 | var PCUIF_info_ind info_ind; |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 3682 | var template IARRestOctets rest; |
| 3683 | var BIT11 ra11; |
| 3684 | |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 3685 | info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | a5cee4c | 2021-04-26 13:50:29 +0200 | [diff] [blame] | 3686 | info_ind.t3142 := 3; |
Vadim Yanitskiy | d5321fb | 2020-10-31 20:23:47 +0700 | [diff] [blame] | 3687 | |
| 3688 | /* Only the first TRX is enabled. */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3689 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
| 3690 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 3691 | |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 3692 | /* Initialize the PCU interface abstraction */ |
Pau Espin Pedrol | 7ebc112 | 2020-10-29 13:33:39 +0100 | [diff] [blame] | 3693 | f_init_raw(testcasename(), info_ind); |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 3694 | |
| 3695 | var EGPRSPktChRequest req := { |
| 3696 | one_phase := { |
| 3697 | tag := '0'B, |
| 3698 | multislot_class := '10101'B, |
| 3699 | priority := '01'B, |
| 3700 | random_bits := '101'B |
| 3701 | } |
| 3702 | }; |
| 3703 | |
| 3704 | /* We send 7 requests, the IUT gives us all available USFs (0..6). |
| 3705 | * TODO: make it configurable: usf_max := mp_pdch_ts_num * 7. */ |
| 3706 | for (var integer i := 0; i < 7; i := i + 1) { |
| 3707 | req.one_phase.random_bits := int2bit(f_rnd_int(8), 3); |
| 3708 | f_TC_egprs_pkt_chan_req(req, tr_IMM_TBF_ASS); |
| 3709 | } |
| 3710 | |
| 3711 | ra11 := enc_EGPRSPktChRequest2bits(req); |
| 3712 | rest := tr_IARRestOctets({ *, tr_ExtRAOpt(substr(ra11, 6, 5)), * }); |
| 3713 | |
| 3714 | /* At this point, the IUT should run out of free USFs */ |
Pau Espin Pedrol | a5cee4c | 2021-04-26 13:50:29 +0200 | [diff] [blame] | 3715 | 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] | 3716 | |
| 3717 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3718 | } |
| 3719 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3720 | /* Randomly generate a set of hopping parameters for one timeslot */ |
Vadim Yanitskiy | 7a04cdd | 2020-09-07 11:43:32 +0700 | [diff] [blame] | 3721 | private function f_TC_pcuif_fh_params_gen(integer max_ma_len) |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3722 | return template (value) PCUIF_InfoTrxTs { |
Vadim Yanitskiy | 7a04cdd | 2020-09-07 11:43:32 +0700 | [diff] [blame] | 3723 | /* Pick a random MA length in range 2 .. max_ma_len */ |
| 3724 | var integer ma_len := 2 + f_rnd_int(max_ma_len - 2); |
| 3725 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3726 | return ts_PCUIF_InfoTrxTsH1(tsc := f_rnd_int(7), |
| 3727 | hsn := f_rnd_int(63), |
| 3728 | maio := f_rnd_int(63), |
| 3729 | ma := f_rnd_bitstring(ma_len)); |
| 3730 | } |
| 3731 | |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3732 | private function f_TC_pcuif_fh_check_imm_ass(in PCUIF_info_ind info_ind, |
| 3733 | in GsmRrMessage rr_msg) |
| 3734 | { |
| 3735 | var ImmediateAssignment ia := rr_msg.payload.imm_ass; |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3736 | 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] | 3737 | |
| 3738 | var template PacketChannelDescription tr_pkt_chan_desc := { |
| 3739 | channel_Type_spare := ?, |
| 3740 | tn := ?, |
| 3741 | tsc := ts.tsc, |
| 3742 | presence := '1'B, |
| 3743 | zero := omit, |
| 3744 | one := { |
| 3745 | maio := ts.maio, |
| 3746 | hsn := ts.hsn |
| 3747 | } |
| 3748 | }; |
| 3749 | |
| 3750 | if (not match(ia.pkt_chan_desc, tr_pkt_chan_desc)) { |
| 3751 | setverdict(fail, "Packet Channel Description does not match: ", |
| 3752 | ia.pkt_chan_desc, " vs ", tr_pkt_chan_desc); |
| 3753 | } |
| 3754 | |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 3755 | /* Mobile Allocation is expected to be octet-aligned */ |
| 3756 | var uint8_t ma_oct_len := (ts.ma_bit_len + 8 - 1) / 8; |
| 3757 | var template MobileAllocationLV tr_ma := { |
| 3758 | len := ma_oct_len, /* in bytes */ |
| 3759 | ma := substr(ts.ma, 0, ma_oct_len * 8) |
| 3760 | }; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3761 | |
| 3762 | if (not match(ia.mobile_allocation, tr_ma)) { |
| 3763 | setverdict(fail, "Mobile Allocation does not match: ", |
| 3764 | ia.mobile_allocation, " vs ", tr_ma); |
| 3765 | } |
| 3766 | |
| 3767 | setverdict(pass); |
| 3768 | } |
| 3769 | |
| 3770 | /* Make sure that Immediate (UL EGPRS TBF) Assignment contains hopping parameters */ |
| 3771 | 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] | 3772 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default; |
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(32); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3777 | |
| 3778 | /* Initialize the PCU interface abstraction */ |
| 3779 | f_init_raw(testcasename(), info_ind); |
| 3780 | |
| 3781 | /* EGPRS Packet Channel Request (cause=Signalling) */ |
| 3782 | f_ms_use_ra(ms, bit2int('11001101010'B), ra_is_11bit := 1); |
| 3783 | |
| 3784 | /* Establish an Uplink EGPRS TBF */ |
| 3785 | f_ms_establish_ul_tbf(ms); |
| 3786 | |
| 3787 | f_TC_pcuif_fh_check_imm_ass(valueof(info_ind), ms.ul_tbf.rr_imm_ass); |
| 3788 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3789 | } |
| 3790 | |
| 3791 | /* Make sure that Immediate (UL TBF) Assignment contains hopping parameters */ |
| 3792 | 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] | 3793 | 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] | 3794 | var GprsMS ms := valueof(t_GprsMS_def); |
| 3795 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3796 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3797 | 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] | 3798 | |
| 3799 | /* Initialize the PCU interface abstraction */ |
| 3800 | f_init_raw(testcasename(), info_ind); |
| 3801 | |
| 3802 | /* Establish an Uplink TBF */ |
| 3803 | f_ms_establish_ul_tbf(ms); |
| 3804 | |
| 3805 | f_TC_pcuif_fh_check_imm_ass(valueof(info_ind), ms.ul_tbf.rr_imm_ass); |
| 3806 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3807 | } |
| 3808 | |
| 3809 | /* Make sure that Immediate (DL TBF) Assignment contains hopping parameters */ |
| 3810 | 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] | 3811 | 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] | 3812 | var GprsMS ms := valueof(t_GprsMS_def); |
| 3813 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3814 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3815 | 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] | 3816 | |
| 3817 | /* Initialize NS/BSSGP side */ |
| 3818 | f_init_bssgp(); |
| 3819 | |
| 3820 | /* Initialize the PCU interface abstraction */ |
| 3821 | f_init_raw(testcasename(), info_ind); |
| 3822 | |
| 3823 | /* Establish BSSGP connection to the PCU */ |
| 3824 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3825 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3826 | |
| 3827 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 3828 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, f_rnd_octstring(12))); |
| 3829 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 3830 | |
| 3831 | f_TC_pcuif_fh_check_imm_ass(valueof(info_ind), ms.dl_tbf.rr_imm_ass); |
| 3832 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3833 | } |
| 3834 | |
| 3835 | private function f_TC_pcuif_fh_check_pkt_ass(in PCUIF_info_ind info_ind, |
| 3836 | in FrequencyParameters fp) |
| 3837 | { |
| 3838 | /* FIXME: TRX0/TS7 is a hard-coded expectation, make it configurable */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3839 | var PCUIF_InfoTrxTs ts := info_ind.trx[0].ts[7]; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3840 | |
| 3841 | /* Table 12.8.1: Frequency Parameters information elements */ |
| 3842 | var template FrequencyParameters tr_fp := { |
| 3843 | tsc := ts.tsc, |
| 3844 | presence := '10'B, /* Direct encoding 1 */ |
| 3845 | arfcn := omit, |
| 3846 | indirect := omit, |
| 3847 | direct1 := { |
| 3848 | maio := ts.maio, |
| 3849 | /* Table 12.10a.1: GPRS Mobile Allocation information elements */ |
| 3850 | mobile_allocation := { |
| 3851 | hsn := ts.hsn, |
| 3852 | rfl_number_list_present := '0'B, |
| 3853 | rfl_number_list := omit, |
| 3854 | ma_present := '0'B, /* inverted logic */ |
Vadim Yanitskiy | 43ccaf5 | 2020-09-05 21:35:13 +0700 | [diff] [blame] | 3855 | ma_length := ts.ma_bit_len, |
| 3856 | ma_bitmap := substr(ts.ma, 0, ts.ma_bit_len) |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3857 | } |
| 3858 | }, |
| 3859 | direct2 := omit |
| 3860 | }; |
| 3861 | |
| 3862 | if (not match(fp, tr_fp)) { |
| 3863 | setverdict(fail, "Frequency Parameters IE does not match: ", |
| 3864 | fp, " vs ", tr_fp); |
| 3865 | } |
| 3866 | |
| 3867 | setverdict(pass); |
| 3868 | } |
| 3869 | |
| 3870 | /* Make sure that Packet Uplink Assignment contains hopping parameters */ |
| 3871 | 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] | 3872 | 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] | 3873 | var GprsMS ms := valueof(t_GprsMS_def); |
| 3874 | var uint32_t poll_fn; |
| 3875 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3876 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3877 | 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] | 3878 | |
| 3879 | /* Initialize the PCU interface abstraction */ |
| 3880 | f_init_raw(testcasename(), info_ind); |
| 3881 | |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 3882 | /* Single block (two phase) packet access */ |
| 3883 | var uint16_t ra := bit2int(chan_req_sb); |
| 3884 | f_ms_use_ra(ms, ra, ra_is_11bit := 0); |
| 3885 | |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3886 | /* Establish an Uplink TBF */ |
| 3887 | f_ms_establish_ul_tbf(ms); |
| 3888 | |
| 3889 | /* 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] | 3890 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, omit)), |
| 3891 | fn := ms.ul_tbf.start_time_fn); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3892 | |
| 3893 | /* 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] | 3894 | f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_UL_PACKET_ASS); |
| 3895 | var PacketUlAssignment ua := ms.ul_tbf.ass.pacch; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3896 | |
| 3897 | /* 3GPP TS 44.060, section 12.8 "Frequency Parameters" */ |
| 3898 | var template (omit) FrequencyParameters fp; |
| 3899 | if (ua.is_egprs == '1'B) { |
| 3900 | fp := ua.egprs.freq_par; |
| 3901 | } else { |
| 3902 | fp := ua.gprs.freq_par; |
| 3903 | } |
| 3904 | |
| 3905 | /* This is an optional IE, so it's worth to check its presence */ |
| 3906 | if (istemplatekind(fp, "omit")) { |
| 3907 | setverdict(fail, "Frequency Parameters IE is not present"); |
| 3908 | f_shutdown(__BFILE__, __LINE__); |
| 3909 | } |
| 3910 | |
| 3911 | f_TC_pcuif_fh_check_pkt_ass(valueof(info_ind), valueof(fp)); |
| 3912 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3913 | } |
| 3914 | |
| 3915 | /* Make sure that Packet Downlink Assignment contains hopping parameters */ |
| 3916 | 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] | 3917 | 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] | 3918 | var octetstring data := f_rnd_octstring(10); |
| 3919 | var GprsMS ms := valueof(t_GprsMS_def); |
| 3920 | var RlcmacDlBlock dl_block; |
| 3921 | var uint32_t poll_fn; |
| 3922 | |
Vadim Yanitskiy | ef0c1b5 | 2020-09-05 21:32:18 +0700 | [diff] [blame] | 3923 | /* Enable frequency hopping on TRX0/TS7 */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3924 | 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] | 3925 | |
| 3926 | /* Initialize NS/BSSGP side */ |
| 3927 | f_init_bssgp(); |
| 3928 | |
| 3929 | /* Initialize the PCU interface abstraction */ |
| 3930 | f_init_raw(testcasename(), info_ind); |
| 3931 | |
| 3932 | /* Establish BSSGP connection to the PCU */ |
| 3933 | f_bssgp_establish(); |
Pau Espin Pedrol | 7b761e2 | 2021-01-11 14:43:35 +0100 | [diff] [blame] | 3934 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3935 | |
| 3936 | /* Establish an Uplink TBF */ |
| 3937 | f_ms_establish_ul_tbf(ms); |
| 3938 | |
| 3939 | /* Send an Uplink block, so this TBF becomes "active" */ |
Pau Espin Pedrol | dee5570 | 2021-04-23 21:08:22 +0200 | [diff] [blame] | 3940 | 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] | 3941 | |
| 3942 | /* DL ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 3943 | f_rx_rlcmac_dl_block_exp_ack_nack(dl_block, poll_fn); |
| 3944 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), poll_fn); |
| 3945 | |
| 3946 | /* SGSN sends some DL data, PCU will assign Downlink resource on PACCH */ |
| 3947 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 3948 | |
| 3949 | /* 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] | 3950 | f_ms_rx_pkt_ass_pacch(ms, poll_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 3951 | var PacketDlAssignment da := ms.dl_tbf.ass.pacch; |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 3952 | |
| 3953 | /* This is an optional IE, so it's worth to check its presence */ |
| 3954 | if (not ispresent(da.freq_par)) { |
| 3955 | setverdict(fail, "Frequency Parameters IE is not present"); |
| 3956 | f_shutdown(__BFILE__, __LINE__); |
| 3957 | } |
| 3958 | |
| 3959 | f_TC_pcuif_fh_check_pkt_ass(valueof(info_ind), da.freq_par); |
| 3960 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3961 | } |
| 3962 | |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 3963 | /* Check if the IUT handles subsequent INFO.ind messages */ |
| 3964 | 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] | 3965 | 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] | 3966 | var BTS_PDTCH_Block data_msg; |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 3967 | |
| 3968 | /* Initialize the PCU interface abstraction */ |
| 3969 | f_init_raw(testcasename(), info_ind); |
| 3970 | |
| 3971 | /* Send 16 conseqtive INFO.ind messages and check that the IUT stays alive */ |
| 3972 | for (var integer i := 0; i < 16; i := i + 1) { |
| 3973 | BTS.send(ts_PCUIF_INFO_IND(0, info_ind)); |
Pau Espin Pedrol | b34bb06 | 2021-01-19 18:58:07 +0100 | [diff] [blame] | 3974 | f_pcuif_rx_data_req_pdtch(data_msg); |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 3975 | } |
| 3976 | |
| 3977 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 3978 | } |
| 3979 | |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 3980 | /* Verify allocation of several MS along PDCH ts of several TRX. See OS#1775, SYS#5030 */ |
| 3981 | testcase TC_multitrx_multims_alloc() runs on RAW_PCU_Test_CT { |
| 3982 | var PCUIF_info_ind info_ind; |
| 3983 | var integer i; |
| 3984 | const integer num_ms := 8; |
| 3985 | |
| 3986 | /* Initialize NS/BSSGP side */ |
| 3987 | f_init_bssgp(); |
| 3988 | /* Initialize GPRS MS side */ |
| 3989 | f_init_gprs_ms(num_ms); |
| 3990 | |
Pau Espin Pedrol | 745a48b | 2020-10-30 15:31:07 +0100 | [diff] [blame] | 3991 | info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS)); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 3992 | /* Only the 3 first TRX are enabled. The enabled ones all have same |
| 3993 | amount of resources, hence same amount of initial resources. */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 3994 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (3 .. 7)); |
| 3995 | f_PCUIF_PDCHMask_set(info_ind, '00000011'B, 0); |
| 3996 | f_PCUIF_PDCHMask_set(info_ind, '00001100'B, 1); |
| 3997 | f_PCUIF_PDCHMask_set(info_ind, '11000000'B, 2); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 3998 | |
| 3999 | /* Initialize the PCU interface abstraction */ |
| 4000 | f_init_raw(testcasename(), info_ind); |
| 4001 | |
| 4002 | /* Establish BSSGP connection to the PCU */ |
| 4003 | f_bssgp_establish(); |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 4004 | f_multi_ms_bssgp_register(); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 4005 | |
Vadim Yanitskiy | 8a02b92 | 2020-10-31 21:57:10 +0700 | [diff] [blame] | 4006 | /* Establish an Uplink TBF for each GprsMS instance */ |
| 4007 | f_multi_ms_establish_tbf(do_activate := false); |
| 4008 | |
| 4009 | /* 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] | 4010 | for (i := 0; i < num_ms; i := i + 1) { |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4011 | 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] | 4012 | setverdict(fail, "Got assigned ARFCN ", g_ms[i].ul_tbf.arfcn, |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4013 | " vs exp ", info_ind.trx[i mod 3].arfcn); |
Pau Espin Pedrol | bfd69f6 | 2020-10-22 18:06:07 +0200 | [diff] [blame] | 4014 | f_shutdown(__BFILE__, __LINE__); |
| 4015 | } |
| 4016 | } |
| 4017 | |
| 4018 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4019 | } |
| 4020 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4021 | /* Verify concurrent PDCH use of EGPRS and GPRS (EGPRS dl rlcmac blk is |
| 4022 | * downgraded to CS1-4 so that GPRS can read the USF). |
| 4023 | * See 3GPP TS 44.060 5.2.4a "Multiplexing of GPRS, EGPRS and EGPRS2 capable mobile stations" |
| 4024 | */ |
| 4025 | testcase TC_multiplex_dl_gprs_egprs() runs on RAW_PCU_Test_CT { |
| 4026 | var PCUIF_info_ind info_ind; |
| 4027 | const integer num_ms := 2; /* 2 MS, first one is GPRS-only, second one is EGPRS */ |
| 4028 | var PollFnCtx pollctx; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4029 | var uint32_t sched_fn, dl_fn, ack_fn; |
| 4030 | var octetstring data := f_rnd_octstring(10); |
| 4031 | var RlcmacDlBlock dl_block; |
| 4032 | var integer tx_data_remain := 5; |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4033 | var integer tgt_ms, usf_ms; |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4034 | var integer ms_gprs_usf_count[num_ms] := { 0, 0 }; |
| 4035 | var integer ms_egprs_usf_count[num_ms] := { 0, 0 }; |
| 4036 | |
| 4037 | /* Initialize NS/BSSGP side */ |
| 4038 | f_init_bssgp(); |
| 4039 | /* Initialize GPRS MS side */ |
| 4040 | f_init_gprs_ms(num_ms); |
| 4041 | |
| 4042 | info_ind := valueof(ts_PCUIF_INFO_default); |
| 4043 | /* 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] | 4044 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
| 4045 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7)); |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4046 | |
| 4047 | /* Initialize the PCU interface abstraction */ |
| 4048 | f_init_raw(testcasename(), info_ind); |
| 4049 | |
| 4050 | /* Set Initial MCS > 4 and maintain it non-variable to simplify test */ |
| 4051 | g_mcs_initial_dl := 5; |
| 4052 | g_mcs_max_dl := 5; |
| 4053 | f_pcuvty_set_allowed_cs_mcs(); |
| 4054 | |
| 4055 | /* Establish BSSGP connection to the PCU */ |
| 4056 | f_bssgp_establish(); |
| 4057 | f_multi_ms_bssgp_register(); |
| 4058 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4059 | /* Establish UL TBF for MS0 (GPRS-only) */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4060 | 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] | 4061 | if (not match(g_ms[0].ul_tbf.tx_cs_mcs, cs_gprs_any)) { |
| 4062 | setverdict(fail, "Wrong CS_MCS ", g_ms[0].ul_tbf.tx_cs_mcs, " received vs exp ", cs_gprs_any); |
| 4063 | f_shutdown(__BFILE__, __LINE__); |
| 4064 | } |
| 4065 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4066 | f_ms_tx_ul_block(g_ms[0], ts_RLCMAC_CTRL_ACK(g_ms[0].tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4067 | |
| 4068 | /* Establish UL TBF for MS1 (EGPRS) */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4069 | 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] | 4070 | if (not match(g_ms[1].ul_tbf.tx_cs_mcs, mcs_egprs_any)) { |
| 4071 | setverdict(fail, "Wrong CS_MCS ", g_ms[1].ul_tbf.tx_cs_mcs, " received vs exp ", mcs_egprs_any); |
| 4072 | f_shutdown(__BFILE__, __LINE__); |
| 4073 | } |
| 4074 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4075 | f_ms_tx_ul_block(g_ms[1], ts_RLCMAC_CTRL_ACK(g_ms[1].tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4076 | |
| 4077 | /* Now SGSN sends some DL data to MS0, PCU will assign a GPRS DL TBF on PACCH */ |
| 4078 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[0].tlli, data)); |
| 4079 | f_sleep(0.1); |
| 4080 | f_ms_rx_pkt_ass_pacch(g_ms[0], sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 4081 | /* DL Ass sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4082 | f_ms_tx_ul_block(g_ms[0], ts_RLCMAC_CTRL_ACK(g_ms[0].tlli), sched_fn); |
| 4083 | /* After acking the dl assignment, dl tbf goes into FLOW state and PCU will provide DL data when BTS asks for it */ |
| 4084 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0, cs_gprs_any); |
| 4085 | /* ACK the DL block */ |
| 4086 | f_dltbf_ack_block(g_ms[0].dl_tbf, dl_block, '0'B); |
| 4087 | f_ms_tx_ul_block(g_ms[0], f_dltbf_ts_RLCMAC_DL_ACK_NACK(g_ms[0].dl_tbf, false), |
| 4088 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 4089 | |
| 4090 | /* Now SGSN sends some DL data to MS1, PCU will assign a EGPRS DL TBF on PACCH */ |
| 4091 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[1].tlli, data)); |
| 4092 | f_sleep(0.1); |
| 4093 | f_ms_rx_pkt_ass_pacch(g_ms[1], sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 4094 | /* DL Ass sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4095 | f_ms_tx_ul_block(g_ms[1], ts_RLCMAC_CTRL_ACK(g_ms[1].tlli), sched_fn); |
| 4096 | /* After acking the dl assignment, dl tbf goes into FLOW state and PCU will provide DL data when BTS asks for it */ |
| 4097 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0, mcs_egprs_any); |
| 4098 | /* ACK the DL block */ |
| 4099 | f_dltbf_ack_block(g_ms[1].dl_tbf, dl_block, '0'B); |
| 4100 | f_ms_tx_ul_block(g_ms[1], f_dltbf_ts_RLCMAC_DL_ACK_NACK(g_ms[1].dl_tbf, true), |
| 4101 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 4102 | |
| 4103 | data := f_rnd_octstring(1400); |
| 4104 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[0].tlli, data)); |
| 4105 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[1].tlli, data)); |
| 4106 | |
| 4107 | for (var integer i := 0; i < 800; i := i + 1) { |
| 4108 | f_rx_rlcmac_dl_block(dl_block, dl_fn); |
| 4109 | |
| 4110 | if (match(dl_block, tr_RLCMAC_DUMMY_CTRL)) { |
| 4111 | /* No more data to receive, done */ |
| 4112 | break; |
| 4113 | } |
| 4114 | |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4115 | usf_ms := -1; |
| 4116 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4117 | if (ischosen(dl_block.ctrl)) { |
| 4118 | setverdict(fail, "Unexpected DL CTRL block ", dl_block); |
| 4119 | f_shutdown(__BFILE__, __LINE__); |
| 4120 | } else if (ischosen(dl_block.data_egprs)) { |
| 4121 | if (not match(dl_block.data_egprs.mac_hdr.tfi, g_ms[1].dl_tbf.tfi)) { |
| 4122 | setverdict(fail, "EGPRS DL DATA not matching EGPRS MS TFI (", g_ms[1].dl_tbf.tfi, "): ", dl_block.data_egprs.mac_hdr.tfi); |
| 4123 | f_shutdown(__BFILE__, __LINE__); |
| 4124 | } |
| 4125 | tgt_ms := 1; |
| 4126 | if (match(dl_block.data_egprs.mac_hdr.usf, g_ms[0].ul_tbf.usf[7])) { |
| 4127 | if (dl_block.data_egprs.mcs > MCS_4) { |
| 4128 | setverdict(fail, "Signalling USF ", dl_block.data_egprs.mac_hdr.usf, " for GPRS-only MS using MCS > 4: ", dl_block); |
| 4129 | f_shutdown(__BFILE__, __LINE__); |
| 4130 | } |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4131 | usf_ms := 0; |
| 4132 | 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] | 4133 | } else { |
| 4134 | if (dl_block.data_egprs.mcs <= MCS_4) { |
| 4135 | setverdict(fail, "Using too-low MCS for EGPRS MS: ", dl_block.data_egprs.mcs); |
| 4136 | f_shutdown(__BFILE__, __LINE__); |
| 4137 | } |
| 4138 | 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] | 4139 | usf_ms := 1; |
| 4140 | 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] | 4141 | } |
| 4142 | } |
| 4143 | } else { |
| 4144 | if (not match(dl_block.data.mac_hdr.hdr_ext.tfi, g_ms[0].dl_tbf.tfi)) { |
| 4145 | setverdict(fail, "GPRS DL DATA not matching GPRS MS TFI (", g_ms[0].dl_tbf.tfi, "): ", dl_block.data.mac_hdr.hdr_ext.tfi); |
| 4146 | f_shutdown(__BFILE__, __LINE__); |
| 4147 | } |
| 4148 | tgt_ms := 0; |
| 4149 | 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] | 4150 | usf_ms := 0; |
| 4151 | 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] | 4152 | } 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] | 4153 | usf_ms := 1; |
| 4154 | 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] | 4155 | } |
| 4156 | } |
| 4157 | |
| 4158 | /* Keep Ack/Nack description updated */ |
| 4159 | f_dltbf_ack_block(g_ms[tgt_ms].dl_tbf, dl_block); |
| 4160 | |
| 4161 | /* TDMA frame number on which we are supposed to send the ACK */ |
| 4162 | if (f_dl_block_rrbp_valid(dl_block)) { |
| 4163 | ack_fn := f_dl_block_ack_fn(dl_block, dl_fn); |
| 4164 | 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); |
| 4165 | if (tx_data_remain != 0) { |
| 4166 | /* Submit more data from time to time to keep the TBF ongoing */ |
| 4167 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[0].tlli, data)); |
| 4168 | BSSGP[0].send(ts_BSSGP_DL_UD(g_ms[1].tlli, data)); |
| 4169 | tx_data_remain := tx_data_remain - 1; |
| 4170 | } |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4171 | } else if (tx_data_remain != 0) { |
| 4172 | /* keep sending UL blocks when requested by USF to avoid |
| 4173 | * UL TBF timeout and hence stop receival of USFs */ |
| 4174 | if (usf_ms != -1) { |
| 4175 | f_ms_tx_ul_data_block(g_ms[usf_ms], f_rnd_octstring(10), cv := 15); |
| 4176 | } |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4177 | } |
| 4178 | } |
| 4179 | |
| 4180 | 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] | 4181 | /* He we check that DL blocks scheduled at GPRS can still request UL |
| 4182 | * blocks for EGPRS MS, and the other way around. Furthermore, the 2nd |
| 4183 | * condition also ensures the downgrade to <=MCS4 condition is tested |
| 4184 | * above */ |
| 4185 | if (ms_gprs_usf_count[1] == 0 or ms_egprs_usf_count[0] == 0) { |
| 4186 | setverdict(fail, "USF exchange thresholds not met!"); |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4187 | f_shutdown(__BFILE__, __LINE__); |
| 4188 | } |
Pau Espin Pedrol | 4ceb61c | 2021-03-24 18:03:42 +0100 | [diff] [blame] | 4189 | /* Here check for some level of fairness between them (at least ~40%): */ |
| 4190 | var integer gprs_usf_cnt := ms_gprs_usf_count[0] + ms_egprs_usf_count[0]; |
| 4191 | var integer egprs_usf_cnt := ms_gprs_usf_count[1] + ms_egprs_usf_count[1]; |
| 4192 | var integer total_usf_cnt := gprs_usf_cnt + egprs_usf_cnt; |
| 4193 | if (gprs_usf_cnt < total_usf_cnt * 4 / 10) { |
| 4194 | setverdict(fail, "USF GPRS-only MS ", gprs_usf_cnt, " < ", total_usf_cnt * 4 / 10); |
| 4195 | f_shutdown(__BFILE__, __LINE__); |
| 4196 | } |
| 4197 | if (egprs_usf_cnt < total_usf_cnt * 4 / 10) { |
| 4198 | setverdict(fail, "USF EGPRS MS ", egprs_usf_cnt, " < ", total_usf_cnt * 4 / 10); |
| 4199 | f_shutdown(__BFILE__, __LINE__); |
| 4200 | } |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 4201 | |
| 4202 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4203 | } |
| 4204 | |
| 4205 | |
Vadim Yanitskiy | dbd4b24 | 2020-10-31 05:44:58 +0700 | [diff] [blame] | 4206 | private function f_TC_paging_cs_multi_ms(template (value) TsTrxBtsNum nr, |
| 4207 | boolean exp_imsi, boolean exp_tmsi) |
| 4208 | runs on RAW_PCU_Test_CT { |
| 4209 | var bitstring mask := f_pad_bit(''B, lengthof(g_ms), '0'B); |
| 4210 | var integer pending := lengthof(g_ms); |
| 4211 | var RlcmacDlBlock dl_block; |
| 4212 | var boolean f1, f2; |
| 4213 | |
| 4214 | while (pending > 0) { |
| 4215 | var uint32_t poll_fn; |
| 4216 | |
| 4217 | /* Obtain a Downlink block and make sure it is a paging request */ |
| 4218 | f_rx_rlcmac_dl_block(dl_block, poll_fn, nr := nr); |
| 4219 | if (not match(dl_block, tr_RLCMAC_PACKET_PAG_REQ)) { |
| 4220 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4221 | break; |
| 4222 | } |
| 4223 | |
| 4224 | /* This should not happen in general, but who knows... */ |
| 4225 | var PacketPagingReq req := dl_block.ctrl.payload.u.paging; |
| 4226 | if (not ispresent(req.repeated_pageinfo)) { |
| 4227 | setverdict(fail, "Repeated Page Info IE is absent?!?"); |
| 4228 | break; |
| 4229 | } |
| 4230 | |
| 4231 | /* A single message may contain several MIs depending on their type */ |
| 4232 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 4233 | f1 := exp_imsi and f_pkt_paging_match_imsi(req, g_ms[i].imsi, |
| 4234 | ps_domain := false); |
| 4235 | f2 := exp_tmsi and f_pkt_paging_match_tmsi(req, oct2int(g_ms[i].tlli), |
| 4236 | ps_domain := false); |
| 4237 | if (not f1 and not f2) |
| 4238 | { continue; } |
| 4239 | |
| 4240 | /* Detect duplicate MIs */ |
| 4241 | if (mask[i] == '1'B) { |
| 4242 | setverdict(fail, "MS is paged twice: ", g_ms[i].imsi); |
| 4243 | continue; |
| 4244 | } |
| 4245 | |
| 4246 | mask[i] := '1'B; |
| 4247 | } |
| 4248 | |
| 4249 | pending := pending - lengthof(req.repeated_pageinfo); |
| 4250 | } |
| 4251 | |
| 4252 | for (var integer i := 0; i < lengthof(mask); i := i + 1) { |
| 4253 | if (mask[i] != '1'B) { |
| 4254 | setverdict(fail, "MS was not paged at all: ", g_ms[i].imsi); |
| 4255 | log("===== mask := ", mask); |
| 4256 | } |
| 4257 | } |
| 4258 | |
| 4259 | /* All messages must have been received by now, expect a dummy block */ |
| 4260 | f_rx_rlcmac_dl_block_exp_dummy(dl_block, nr := nr); |
| 4261 | } |
| 4262 | |
| 4263 | private function f_TC_paging_cs_multi_ms_init(BIT8 pdch_mask) |
| 4264 | runs on RAW_PCU_Test_CT { |
| 4265 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 4266 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 4267 | |
| 4268 | /* Initialize NS/BSSGP side */ |
| 4269 | f_init_bssgp(); |
| 4270 | |
| 4271 | /* Explicitly set the given PDCH slot-mask to all transceivers */ |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 4272 | f_PCUIF_PDCHMask_set(info_ind, pdch_mask); |
Vadim Yanitskiy | dbd4b24 | 2020-10-31 05:44:58 +0700 | [diff] [blame] | 4273 | |
| 4274 | /* Allocate 56 GprsMS instances (maximum for 8 PDCH slots) */ |
| 4275 | f_init_gprs_ms(7 * 8); |
| 4276 | |
| 4277 | /* Initialize the PCU interface abstraction */ |
| 4278 | f_init_raw(testcasename(), info_ind); |
| 4279 | |
| 4280 | /* Establish BSSGP connection to the PCU */ |
| 4281 | f_bssgp_establish(); |
| 4282 | f_multi_ms_bssgp_register(); |
| 4283 | |
| 4284 | /* Establish an Uplink TBF for each GprsMS instance */ |
| 4285 | f_multi_ms_establish_tbf(do_activate := true); |
| 4286 | } |
| 4287 | |
| 4288 | testcase TC_paging_cs_multi_ms_imsi() runs on RAW_PCU_Test_CT { |
| 4289 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 4290 | |
| 4291 | /* Common part: send INFO.ind, establish TBFs... */ |
| 4292 | f_TC_paging_cs_multi_ms_init(pdch_mask := '00000001'B); |
| 4293 | |
| 4294 | /* Enqueue multiple CS PAGING requests at a time (IMSI only) */ |
| 4295 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 4296 | BSSGP[0].send(ts_BSSGP_CS_PAGING_IMSI(bvci, g_ms[i].imsi)); |
| 4297 | } |
| 4298 | |
| 4299 | /* FIXME: work around a race condition between PCUIF and BSSGP */ |
| 4300 | f_sleep(0.2); /* i.e. give the IUT some time to process everything */ |
| 4301 | |
| 4302 | /* Check what the IUT sends on PACCH, all GprsMS instances must be paged. |
| 4303 | * The IUT is expected to page on all PDCH slots of all transceivers. */ |
| 4304 | for (var integer trx_nr := 0; trx_nr < 8; trx_nr := trx_nr + 1) { |
| 4305 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, trx_nr); |
| 4306 | f_TC_paging_cs_multi_ms(nr, exp_imsi := true, exp_tmsi := false); |
| 4307 | } |
| 4308 | |
| 4309 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4310 | } |
| 4311 | |
| 4312 | testcase TC_paging_cs_multi_ms_tmsi() runs on RAW_PCU_Test_CT { |
| 4313 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 4314 | |
| 4315 | /* Common part: send INFO.ind, establish TBFs... */ |
| 4316 | f_TC_paging_cs_multi_ms_init(pdch_mask := '00000001'B); |
| 4317 | |
| 4318 | /* Enqueue multiple CS PAGING requests at a time (P-TMSI only) */ |
| 4319 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 4320 | var GsmTmsi tmsi := oct2int(g_ms[i].tlli); /* P-TMSI == TLLI */ |
| 4321 | BSSGP[0].send(ts_BSSGP_CS_PAGING_PTMSI(bvci, g_ms[i].imsi, tmsi)); |
| 4322 | } |
| 4323 | |
| 4324 | /* FIXME: work around a race condition between PCUIF and BSSGP */ |
| 4325 | f_sleep(0.2); /* i.e. give the IUT some time to process everything */ |
| 4326 | |
| 4327 | /* Check what the IUT sends on PACCH, all GprsMS instances must be paged. |
| 4328 | * The IUT is expected to page on all PDCH slots of all transceivers. */ |
| 4329 | for (var integer trx_nr := 0; trx_nr < 8; trx_nr := trx_nr + 1) { |
| 4330 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, trx_nr); |
| 4331 | f_TC_paging_cs_multi_ms(nr, exp_imsi := false, exp_tmsi := true); |
| 4332 | } |
| 4333 | |
| 4334 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4335 | } |
| 4336 | |
| 4337 | testcase TC_paging_cs_multi_ms_imsi_tmsi() runs on RAW_PCU_Test_CT { |
| 4338 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 4339 | |
| 4340 | /* Common part: send INFO.ind, establish TBFs... */ |
| 4341 | f_TC_paging_cs_multi_ms_init(pdch_mask := '00000001'B); |
| 4342 | |
| 4343 | /* Enqueue multiple CS PAGING requests at a time (IMSI & P-TMSI) */ |
| 4344 | for (var integer i := 0; i < lengthof(g_ms); i := i + 1) { |
| 4345 | var GsmTmsi tmsi := oct2int(g_ms[i].tlli); /* P-TMSI == TLLI */ |
| 4346 | if (i mod 3 == 0) { /* One PDU fits: 1 IMSI and 2 P-TMSI MIs */ |
| 4347 | BSSGP[0].send(ts_BSSGP_CS_PAGING_PTMSI(bvci, g_ms[i].imsi, tmsi)); |
| 4348 | } else { |
| 4349 | BSSGP[0].send(ts_BSSGP_CS_PAGING_IMSI(bvci, g_ms[i].imsi)); |
| 4350 | } |
| 4351 | } |
| 4352 | |
| 4353 | /* FIXME: work around a race condition between PCUIF and BSSGP */ |
| 4354 | f_sleep(0.2); /* i.e. give the IUT some time to process everything */ |
| 4355 | |
| 4356 | /* Check what the IUT sends on PACCH, all GprsMS instances must be paged. |
| 4357 | * The IUT is expected to page on all PDCH slots of all transceivers. */ |
| 4358 | for (var integer trx_nr := 0; trx_nr < 8; trx_nr := trx_nr + 1) { |
| 4359 | var template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum(7, trx_nr); |
| 4360 | f_TC_paging_cs_multi_ms(nr, exp_imsi := true, exp_tmsi := true); |
| 4361 | } |
| 4362 | |
| 4363 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4364 | } |
| 4365 | |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4366 | 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] | 4367 | runs on RAW_PCU_Test_CT return RlcmacDlBlock { |
| 4368 | var RlcmacDlBlock dl_block; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4369 | var integer i := 0; |
| 4370 | while (true) { |
| 4371 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4372 | if (not match(dl_block, tr_RLCMAC_DUMMY_CTRL())) { |
| 4373 | break; |
| 4374 | } |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4375 | if (max_num_iter > 0 and i > max_num_iter) { |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4376 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4377 | f_shutdown(__BFILE__, __LINE__); |
| 4378 | } |
| 4379 | i := i + 1; |
| 4380 | } |
| 4381 | return dl_block; |
| 4382 | } |
| 4383 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4384 | private function f_outbound_nacc_rim_tx_resp(PCUIF_info_ind info_ind) |
| 4385 | runs on RAW_PCU_Test_CT { |
| 4386 | 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), |
| 4387 | info_ind.lac), |
| 4388 | info_ind.rac), |
| 4389 | info_ind.cell_id)); |
| 4390 | var BssgpCellId dst := valueof(ts_BssgpCellId(ts_RAI(ts_LAI('023F43'H, /* Decided by test itself (emulating BSC) */ |
| 4391 | 423), |
| 4392 | 2), |
| 4393 | 5)); |
| 4394 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src)); |
| 4395 | var RIM_Routing_Address dst_addr := valueof(t_RIM_Routing_Address_cid(dst)); |
| 4396 | var template (value) RAN_Information_RIM_Container res_cont := |
| 4397 | ts_RAN_Information_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 4398 | ts_RIM_Sequence_Number(2), |
| 4399 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 4400 | ts_RIM_Protocol_Version_Number(1), |
| 4401 | tsu_ApplContainer_or_ApplErrContainer_NACC(tsu_ApplContainer_NACC(dst, false, 3, si_default)), |
| 4402 | omit); |
| 4403 | RIM.send(ts_PDU_BSSGP_RAN_INFORMATION(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 4404 | ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 4405 | res_cont)); |
| 4406 | } |
| 4407 | |
| 4408 | altstep as_outbound_nacc_rim_resolve(PCUIF_info_ind info_ind, boolean do_answer := true, boolean do_repeat := false) |
| 4409 | runs on RAW_PCU_Test_CT { |
| 4410 | /* RIM procedure: */ |
| 4411 | 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), |
| 4412 | info_ind.lac), |
| 4413 | info_ind.rac), |
| 4414 | info_ind.cell_id)); |
| 4415 | var BssgpCellId dst := valueof(ts_BssgpCellId(ts_RAI(ts_LAI('023F43'H, /* Decided by test itself (emulating BSC) */ |
| 4416 | 423), |
| 4417 | 2), |
| 4418 | 5)); |
| 4419 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src)); |
| 4420 | var RIM_Routing_Address dst_addr := valueof(t_RIM_Routing_Address_cid(dst)); |
| 4421 | [] RIM.receive(tr_RAN_INFORMATION_REQUEST(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 4422 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 4423 | tr_RAN_Information_Request_RIM_Container)) { |
| 4424 | if (do_answer) { |
| 4425 | f_outbound_nacc_rim_tx_resp(info_ind); |
| 4426 | } |
| 4427 | if (do_repeat) { |
| 4428 | repeat; |
| 4429 | } |
| 4430 | } |
| 4431 | } |
| 4432 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4433 | private function f_handle_nacc_rac_ci_query(PCUIF_info_ind info_ind, GsmArfcn req_arfcn, uint6_t req_bsic, |
| 4434 | boolean answer := true, boolean use_old_ctrl_iface := false) |
| 4435 | runs on RAW_PCU_Test_CT { |
| 4436 | if (use_old_ctrl_iface == true) { |
| 4437 | f_ipa_ctrl_wait_link_up(); |
| 4438 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4439 | int2str(info_ind.lac) & "." & |
| 4440 | int2str(info_ind.cell_id) & "." & |
| 4441 | int2str(req_arfcn) & "." & |
| 4442 | int2str(req_bsic); |
| 4443 | if (answer) { |
| 4444 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "023-43-423-2-5"); |
| 4445 | } else { |
| 4446 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, omit); |
| 4447 | } |
| 4448 | } else { |
| 4449 | var PCUIF_Message pcu_msg; |
| 4450 | BTS.receive(tr_PCUIF_NEIGH_ADDR_REQ(0, info_ind.lac, info_ind.cell_id, req_arfcn, req_bsic)) -> value pcu_msg; |
| 4451 | if (answer) { |
| 4452 | BTS.send(ts_PCUIF_NEIGH_ADDR_CNF(0, pcu_msg.u.container.u.neigh_addr_req, 0, 23, 43, 0, 423, 2, 5)); |
| 4453 | } |
| 4454 | } |
| 4455 | } |
| 4456 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4457 | /* Start NACC from MS side */ |
| 4458 | 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] | 4459 | boolean exp_rac_ci_query := true, boolean exp_si_query := true, |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4460 | boolean skip_final_ctrl_ack := false, |
| 4461 | boolean use_old_ctrl_iface := false) |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4462 | runs on RAW_PCU_Test_CT { |
| 4463 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4464 | var RlcmacDlBlock dl_block; |
| 4465 | var uint32_t sched_fn; |
| 4466 | var GsmArfcn req_arfcn := 862; |
| 4467 | var uint6_t req_bsic := 43; |
| 4468 | |
| 4469 | /* Start NACC from MS side */ |
| 4470 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4471 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4472 | |
| 4473 | if (exp_rac_ci_query == true) { |
| 4474 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4475 | 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] | 4476 | } |
| 4477 | |
| 4478 | if (exp_si_query == true) { |
| 4479 | /* RIM procedure: */ |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4480 | as_outbound_nacc_rim_resolve(info_ind); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4481 | } |
| 4482 | |
| 4483 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 4484 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4485 | |
| 4486 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 4487 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 4488 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4489 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4490 | f_shutdown(__BFILE__, __LINE__); |
| 4491 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4492 | /* 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] | 4493 | 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] | 4494 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4495 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4496 | } |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4497 | } |
| 4498 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4499 | /* Verify PCU handles outbound Network Assisted Cell Change Cell Change (NACC, TS 44.060 sec 8.8). */ |
| 4500 | testcase TC_nacc_outbound_success() runs on RAW_PCU_Test_CT { |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4501 | var PollFnCtx pollctx; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4502 | var GprsMS ms; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4503 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4504 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4505 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4506 | if (use_old_ctrl_iface) { |
| 4507 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4508 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4509 | } |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4510 | |
| 4511 | /* Initialize NS/BSSGP side */ |
| 4512 | f_init_bssgp(); |
| 4513 | /* Initialize GPRS MS side */ |
| 4514 | f_init_gprs_ms(); |
| 4515 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4516 | |
| 4517 | /* Initialize the PCU interface abstraction */ |
| 4518 | f_init_raw(testcasename(), info_ind); |
| 4519 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4520 | /* Make sure we are not affected by full cache from previous tests */ |
| 4521 | f_pcuvty_flush_neigh_caches(); |
| 4522 | |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4523 | /* Establish BSSGP connection to the PCU */ |
| 4524 | f_bssgp_establish(); |
| 4525 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4526 | |
| 4527 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4528 | 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] | 4529 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4530 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4531 | |
| 4532 | /* Start NACC from MS side */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4533 | 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] | 4534 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4535 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4536 | } |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4537 | |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 4538 | /* Verify Pkt Cell Change Continue is retransmitted if not CTRL ACKed */ |
| 4539 | testcase TC_nacc_outbound_success_no_ctrl_ack() runs on RAW_PCU_Test_CT { |
| 4540 | var PollFnCtx pollctx; |
| 4541 | var GprsMS ms; |
| 4542 | var RlcmacDlBlock dl_block; |
| 4543 | var uint32_t sched_fn; |
| 4544 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4545 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 4546 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4547 | if (use_old_ctrl_iface) { |
| 4548 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4549 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4550 | } |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 4551 | |
| 4552 | /* Initialize NS/BSSGP side */ |
| 4553 | f_init_bssgp(); |
| 4554 | /* Initialize GPRS MS side */ |
| 4555 | f_init_gprs_ms(); |
| 4556 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4557 | |
| 4558 | /* Initialize the PCU interface abstraction */ |
| 4559 | f_init_raw(testcasename(), info_ind); |
| 4560 | |
| 4561 | /* Make sure we are not affected by full cache from previous tests */ |
| 4562 | f_pcuvty_flush_neigh_caches(); |
| 4563 | |
| 4564 | /* Establish BSSGP connection to the PCU */ |
| 4565 | f_bssgp_establish(); |
| 4566 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4567 | |
| 4568 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4569 | 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] | 4570 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4571 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4572 | |
| 4573 | /* Start NACC from MS side, avoid sending final CTRL ACK */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4574 | 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] | 4575 | |
| 4576 | /* Wait until we receive something non-dummy */ |
| 4577 | dl_block := f_skip_dummy(0, sched_fn); |
| 4578 | /* Make sure it is a Pkt Cell Chg Continue (retransmitted)*/ |
| 4579 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4580 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4581 | } |
| 4582 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4583 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4584 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4585 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4586 | } |
| 4587 | |
| 4588 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4589 | } |
| 4590 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4591 | /* Verify PCU handles outbound Network Assisted Cell Change Cell Change (NACC, TS 44.060 sec 8.8) twice, the second time using the caches */ |
| 4592 | testcase TC_nacc_outbound_success_twice() runs on RAW_PCU_Test_CT { |
| 4593 | var PollFnCtx pollctx; |
| 4594 | var GprsMS ms; |
| 4595 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4596 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4597 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4598 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4599 | if (use_old_ctrl_iface) { |
| 4600 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4601 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4602 | } |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 4603 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4604 | /* Initialize NS/BSSGP side */ |
| 4605 | f_init_bssgp(); |
| 4606 | /* Initialize GPRS MS side */ |
| 4607 | f_init_gprs_ms(); |
| 4608 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4609 | |
| 4610 | /* Initialize the PCU interface abstraction */ |
| 4611 | f_init_raw(testcasename(), info_ind); |
| 4612 | |
| 4613 | /* Make sure we are not affected by full cache from previous tests */ |
| 4614 | f_pcuvty_flush_neigh_caches(); |
| 4615 | /* Set timeout values for caches so that entries will be in cache during second try */ |
| 4616 | f_pcuvty_set_neigh_caches(10, 10); |
| 4617 | |
| 4618 | /* Establish BSSGP connection to the PCU */ |
| 4619 | f_bssgp_establish(); |
| 4620 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4621 | |
| 4622 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4623 | 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] | 4624 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4625 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4626 | |
| 4627 | /* Start NACC from MS side */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4628 | 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] | 4629 | |
| 4630 | /* 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] | 4631 | 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] | 4632 | |
| 4633 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4634 | } |
| 4635 | |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 4636 | /* Verify PCU handles outbound Network Assisted Cell Change Cell Change (NACC, |
| 4637 | * TS 44.060 sec 8.8) twice, the second time after caches timed out |
| 4638 | */ |
| 4639 | testcase TC_nacc_outbound_success_twice_nocache() runs on RAW_PCU_Test_CT { |
| 4640 | var PollFnCtx pollctx; |
| 4641 | var GprsMS ms; |
| 4642 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 4643 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4644 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 4645 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4646 | if (use_old_ctrl_iface) { |
| 4647 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4648 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4649 | } |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 4650 | |
| 4651 | /* Initialize NS/BSSGP side */ |
| 4652 | f_init_bssgp(); |
| 4653 | /* Initialize GPRS MS side */ |
| 4654 | f_init_gprs_ms(); |
| 4655 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4656 | |
| 4657 | /* Initialize the PCU interface abstraction */ |
| 4658 | f_init_raw(testcasename(), info_ind); |
| 4659 | |
| 4660 | /* Make sure we are not affected by full cache from previous tests */ |
| 4661 | f_pcuvty_flush_neigh_caches(); |
| 4662 | /* Set timeout values for caches so that entries will be erased before the second try */ |
| 4663 | f_pcuvty_set_neigh_caches(1, 1); |
| 4664 | |
| 4665 | /* Establish BSSGP connection to the PCU */ |
| 4666 | f_bssgp_establish(); |
| 4667 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4668 | |
| 4669 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4670 | 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] | 4671 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4672 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4673 | |
| 4674 | /* Start NACC from MS side */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4675 | 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] | 4676 | |
| 4677 | /* CTRL client should have disconnected from us */ |
| 4678 | f_ipa_ctrl_wait_link_down(); |
| 4679 | /* wait for cache entries to time out */ |
| 4680 | f_sleep(2.0); |
| 4681 | /* 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] | 4682 | 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] | 4683 | |
| 4684 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4685 | } |
| 4686 | |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4687 | /* 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] | 4688 | testcase TC_nacc_outbound_rac_ci_resolve_conn_refused() runs on RAW_PCU_Test_CT { |
| 4689 | var RlcmacDlBlock dl_block; |
| 4690 | var PollFnCtx pollctx; |
| 4691 | var uint32_t sched_fn; |
| 4692 | var GprsMS ms; |
| 4693 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4694 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 4695 | var GsmArfcn req_arfcn := 862; |
| 4696 | var uint6_t req_bsic := 43; |
| 4697 | |
| 4698 | /* In here we explicitly avoid starting osmo-bsc emulation neighbor |
| 4699 | * resolution CTRL port, to trigger Conn Refused by socket: |
| 4700 | * f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4701 | */ |
| 4702 | |
| 4703 | /* Initialize NS/BSSGP side */ |
| 4704 | f_init_bssgp(); |
| 4705 | /* Initialize GPRS MS side */ |
| 4706 | f_init_gprs_ms(); |
| 4707 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4708 | |
| 4709 | /* Initialize the PCU interface abstraction */ |
| 4710 | f_init_raw(testcasename(), info_ind); |
| 4711 | |
| 4712 | /* Make sure we are not affected by full cache from previous tests */ |
| 4713 | f_pcuvty_flush_neigh_caches(); |
| 4714 | |
| 4715 | /* Establish BSSGP connection to the PCU */ |
| 4716 | f_bssgp_establish(); |
| 4717 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4718 | |
| 4719 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4720 | 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] | 4721 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4722 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4723 | |
| 4724 | /* Start NACC from MS side */ |
| 4725 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4726 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4727 | |
| 4728 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4729 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 4730 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 4731 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4732 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4733 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4734 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4735 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4736 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4737 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4738 | } |
Pau Espin Pedrol | e51c17a | 2021-01-27 18:29:22 +0100 | [diff] [blame] | 4739 | |
| 4740 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4741 | } |
| 4742 | |
| 4743 | /* 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] | 4744 | testcase TC_nacc_outbound_rac_ci_resolve_timeout() runs on RAW_PCU_Test_CT { |
| 4745 | var RlcmacDlBlock dl_block; |
| 4746 | var PollFnCtx pollctx; |
| 4747 | var uint32_t sched_fn; |
| 4748 | var GprsMS ms; |
| 4749 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4750 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4751 | var GsmArfcn req_arfcn := 862; |
| 4752 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4753 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4754 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4755 | if (use_old_ctrl_iface) { |
| 4756 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4757 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4758 | } |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4759 | |
| 4760 | /* Initialize NS/BSSGP side */ |
| 4761 | f_init_bssgp(); |
| 4762 | /* Initialize GPRS MS side */ |
| 4763 | f_init_gprs_ms(); |
| 4764 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4765 | |
| 4766 | /* Initialize the PCU interface abstraction */ |
| 4767 | f_init_raw(testcasename(), info_ind); |
| 4768 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4769 | /* Make sure we are not affected by full cache from previous tests */ |
| 4770 | f_pcuvty_flush_neigh_caches(); |
| 4771 | |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4772 | /* Establish BSSGP connection to the PCU */ |
| 4773 | f_bssgp_establish(); |
| 4774 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4775 | |
| 4776 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4777 | 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] | 4778 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4779 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4780 | |
| 4781 | /* Start NACC from MS side */ |
| 4782 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4783 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4784 | |
| 4785 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4786 | /* 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] | 4787 | 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] | 4788 | |
| 4789 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4790 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4791 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 4792 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4793 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4794 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4795 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4796 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4797 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4798 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4799 | } |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 4800 | |
| 4801 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4802 | } |
| 4803 | |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 4804 | /* Verify PCU transmits Pkt Cell Change Continue if RAC+CI resolution fails during outbound NACC procedure */ |
| 4805 | testcase TC_nacc_outbound_rac_ci_resolve_fail_parse_response() runs on RAW_PCU_Test_CT { |
| 4806 | var RlcmacDlBlock dl_block; |
| 4807 | var PollFnCtx pollctx; |
| 4808 | var uint32_t sched_fn; |
| 4809 | var GprsMS ms; |
| 4810 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4811 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 4812 | var GsmArfcn req_arfcn := 862; |
| 4813 | var uint6_t req_bsic := 43; |
| 4814 | |
| 4815 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4816 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4817 | |
| 4818 | /* Initialize NS/BSSGP side */ |
| 4819 | f_init_bssgp(); |
| 4820 | /* Initialize GPRS MS side */ |
| 4821 | f_init_gprs_ms(); |
| 4822 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4823 | |
| 4824 | /* Initialize the PCU interface abstraction */ |
| 4825 | f_init_raw(testcasename(), info_ind); |
| 4826 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4827 | /* Make sure we are not affected by full cache from previous tests */ |
| 4828 | f_pcuvty_flush_neigh_caches(); |
| 4829 | |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 4830 | /* Establish BSSGP connection to the PCU */ |
| 4831 | f_bssgp_establish(); |
| 4832 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4833 | |
| 4834 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4835 | 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] | 4836 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4837 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4838 | |
| 4839 | /* Start NACC from MS side */ |
| 4840 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4841 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4842 | |
| 4843 | /* osmo-pcu should now ask for resolution: */ |
| 4844 | f_ipa_ctrl_wait_link_up(); |
| 4845 | var charstring ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4846 | int2str(info_ind.lac) & "." & |
| 4847 | int2str(info_ind.cell_id) & "." & |
| 4848 | int2str(req_arfcn) & "." & |
| 4849 | int2str(req_bsic); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4850 | /* 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] | 4851 | f_ctrl_exp_get(IPA_CTRL, ctrl_var, "foobar-error"); |
| 4852 | |
| 4853 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4854 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 4855 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 4856 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4857 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4858 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4859 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4860 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4861 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4862 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4863 | } |
Pau Espin Pedrol | 4b5227c | 2021-01-26 20:03:01 +0100 | [diff] [blame] | 4864 | |
| 4865 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4866 | } |
| 4867 | |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4868 | /* Verify PCU transmits Pkt Cell Change Continue if SI resolution fails during outbound NACC procedure */ |
| 4869 | testcase TC_nacc_outbound_si_resolve_timeout() runs on RAW_PCU_Test_CT { |
| 4870 | var RlcmacDlBlock dl_block; |
| 4871 | var PollFnCtx pollctx; |
| 4872 | var uint32_t sched_fn; |
| 4873 | var GprsMS ms; |
| 4874 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4875 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4876 | var GsmArfcn req_arfcn := 862; |
| 4877 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4878 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4879 | 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 */ |
| 4880 | info_ind.lac), |
| 4881 | info_ind.rac), |
| 4882 | info_ind.cell_id)); |
| 4883 | var BssgpCellId dst := valueof(ts_BssgpCellId(ts_RAI(ts_LAI('023F43'H, /* Decided by test itself (emulating BSC) */ |
| 4884 | 423), |
| 4885 | 2), |
| 4886 | 5)); |
| 4887 | var template RIM_Routing_Address src_addr := t_RIM_Routing_Address_cid(src); |
| 4888 | var template RIM_Routing_Address dst_addr := t_RIM_Routing_Address_cid(dst); |
| 4889 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4890 | if (use_old_ctrl_iface) { |
| 4891 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4892 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4893 | } |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4894 | |
| 4895 | /* Initialize NS/BSSGP side */ |
| 4896 | f_init_bssgp(); |
| 4897 | /* Initialize GPRS MS side */ |
| 4898 | f_init_gprs_ms(); |
| 4899 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4900 | |
| 4901 | /* Initialize the PCU interface abstraction */ |
| 4902 | f_init_raw(testcasename(), info_ind); |
| 4903 | |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 4904 | /* Make sure we are not affected by full cache from previous tests */ |
| 4905 | f_pcuvty_flush_neigh_caches(); |
| 4906 | |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4907 | /* Establish BSSGP connection to the PCU */ |
| 4908 | f_bssgp_establish(); |
| 4909 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4910 | |
| 4911 | /* Send PACKET RESOURCE REQUEST */ |
Pau Espin Pedrol | 13ab5ea | 2021-02-05 11:56:15 +0100 | [diff] [blame] | 4912 | 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] | 4913 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4914 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4915 | |
| 4916 | /* Start NACC from MS side */ |
| 4917 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4918 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4919 | |
| 4920 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4921 | 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] | 4922 | |
| 4923 | /* RIM procedure: */ |
| 4924 | RIM.receive(tr_RAN_INFORMATION_REQUEST(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 4925 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 4926 | tr_RAN_Information_Request_RIM_Container)); |
| 4927 | /* We never answer the RIM procude -> PCU timeouts and should send Pkt Cell Chg continue */ |
| 4928 | |
| 4929 | /* Wait until we receive something non-dummy */ |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4930 | dl_block := f_skip_dummy(0, sched_fn); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4931 | /* Make sure it is a Pkt Cell Chg Continue */ |
| 4932 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 4933 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 4934 | } |
Pau Espin Pedrol | a846e61 | 2021-02-01 19:25:25 +0100 | [diff] [blame] | 4935 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4936 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 4937 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 4938 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 4939 | } |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 4940 | |
| 4941 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 4942 | } |
| 4943 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4944 | /* Test MS sending Pkt Cell Change Notify twice (duplicate msg) while waiting for CTRL resolution */ |
| 4945 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup() runs on RAW_PCU_Test_CT { |
| 4946 | var PollFnCtx pollctx; |
| 4947 | var GprsMS ms; |
| 4948 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 4949 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 4950 | var RlcmacDlBlock dl_block; |
| 4951 | var uint32_t sched_fn; |
| 4952 | var CtrlMessage rx_ctrl; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4953 | var charstring ctrl_var; |
| 4954 | var PCUIF_Message pcu_msg; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4955 | var GsmArfcn req_arfcn := 862; |
| 4956 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4957 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4958 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4959 | if (use_old_ctrl_iface) { |
| 4960 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 4961 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 4962 | } |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 4963 | |
| 4964 | /* Initialize NS/BSSGP side */ |
| 4965 | f_init_bssgp(); |
| 4966 | /* Initialize GPRS MS side */ |
| 4967 | f_init_gprs_ms(); |
| 4968 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 4969 | |
| 4970 | /* Initialize the PCU interface abstraction */ |
| 4971 | f_init_raw(testcasename(), info_ind); |
| 4972 | |
| 4973 | /* Make sure we are not affected by full cache from previous tests */ |
| 4974 | f_pcuvty_flush_neigh_caches(); |
| 4975 | |
| 4976 | /* Establish BSSGP connection to the PCU */ |
| 4977 | f_bssgp_establish(); |
| 4978 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 4979 | |
| 4980 | /* Send PACKET RESOURCE REQUEST */ |
| 4981 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 4982 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 4983 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 4984 | |
| 4985 | /* Start NACC from MS side */ |
| 4986 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 4987 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 4988 | |
| 4989 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 4990 | if (use_old_ctrl_iface) { |
| 4991 | f_ipa_ctrl_wait_link_up(); |
| 4992 | ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 4993 | int2str(info_ind.lac) & "." & |
| 4994 | int2str(info_ind.cell_id) & "." & |
| 4995 | int2str(req_arfcn) & "." & |
| 4996 | int2str(req_bsic); |
| 4997 | IPA_CTRL.receive(tr_CtrlMsgGet(?, ctrl_var)) -> value rx_ctrl; |
| 4998 | } else { |
| 4999 | BTS.receive(tr_PCUIF_NEIGH_ADDR_REQ(0, info_ind.lac, info_ind.cell_id, req_arfcn, req_bsic)) -> value pcu_msg; |
| 5000 | } |
| 5001 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5002 | /* Before receiving CTRL response, MS retransmits Pkt cell Chg Notif */ |
| 5003 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5004 | 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] | 5005 | |
| 5006 | if (use_old_ctrl_iface) { |
| 5007 | IPA_CTRL.send(ts_CtrlMsgGetRepl(rx_ctrl.cmd.id, valueof(ctrl_var), valueof("023-43-423-2-5"))); |
| 5008 | } else { |
| 5009 | BTS.send(ts_PCUIF_NEIGH_ADDR_CNF(0, pcu_msg.u.container.u.neigh_addr_req, 0, 23, 43, 0, 423, 2, 5)); |
| 5010 | } |
| 5011 | |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5012 | timer T := 2.0; |
| 5013 | T.start; |
| 5014 | alt { |
| 5015 | [] as_outbound_nacc_rim_resolve(info_ind, do_repeat := true); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5016 | [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] | 5017 | setverdict(fail, "Received unexpected CTRL resolution after duplicate Pkt Cell Change Notification:", rx_ctrl); |
| 5018 | f_shutdown(__BFILE__, __LINE__); |
| 5019 | } |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5020 | [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 { |
| 5021 | setverdict(fail, "Received unexpected PCUIF resolution after duplicate Pkt Cell Change Notification:", pcu_msg); |
| 5022 | f_shutdown(__BFILE__, __LINE__); |
| 5023 | } |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5024 | [] T.timeout { |
| 5025 | setverdict(pass); |
| 5026 | } |
| 5027 | } |
| 5028 | |
| 5029 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 5030 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5031 | |
| 5032 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5033 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5034 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5035 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5036 | f_shutdown(__BFILE__, __LINE__); |
| 5037 | } |
| 5038 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5039 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5040 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5041 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5042 | } |
| 5043 | |
| 5044 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5045 | } |
| 5046 | |
| 5047 | /* Test MS sending Pkt Cell Change Notify twice (duplicate msg) while waiting for SI resolution */ |
| 5048 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup2() runs on RAW_PCU_Test_CT { |
| 5049 | var PollFnCtx pollctx; |
| 5050 | var GprsMS ms; |
| 5051 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5052 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5053 | var RlcmacDlBlock dl_block; |
| 5054 | var uint32_t sched_fn; |
| 5055 | var CtrlMessage rx_ctrl; |
| 5056 | var GsmArfcn req_arfcn := 862; |
| 5057 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5058 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5059 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5060 | if (use_old_ctrl_iface) { |
| 5061 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5062 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5063 | } |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5064 | |
| 5065 | /* Initialize NS/BSSGP side */ |
| 5066 | f_init_bssgp(); |
| 5067 | /* Initialize GPRS MS side */ |
| 5068 | f_init_gprs_ms(); |
| 5069 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5070 | |
| 5071 | /* Initialize the PCU interface abstraction */ |
| 5072 | f_init_raw(testcasename(), info_ind); |
| 5073 | |
| 5074 | /* Make sure we are not affected by full cache from previous tests */ |
| 5075 | f_pcuvty_flush_neigh_caches(); |
| 5076 | |
| 5077 | /* Establish BSSGP connection to the PCU */ |
| 5078 | f_bssgp_establish(); |
| 5079 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5080 | |
| 5081 | /* Send PACKET RESOURCE REQUEST */ |
| 5082 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5083 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5084 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5085 | |
| 5086 | /* Start NACC from MS side */ |
| 5087 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5088 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5089 | |
| 5090 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5091 | 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] | 5092 | as_outbound_nacc_rim_resolve(info_ind, do_answer := false); |
| 5093 | /* Before receiving RIM response, MS retransmits Pkt cell Chg Notif */ |
| 5094 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5095 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
| 5096 | f_outbound_nacc_rim_tx_resp(info_ind); |
| 5097 | timer T := 1.0; |
| 5098 | T.start; |
| 5099 | alt { |
| 5100 | [] RIM.receive { |
| 5101 | setverdict(fail, "Received unexpected RIM message"); |
| 5102 | f_shutdown(__BFILE__, __LINE__); |
| 5103 | } |
| 5104 | [] T.timeout { |
| 5105 | setverdict(pass); |
| 5106 | } |
| 5107 | } |
| 5108 | |
| 5109 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 5110 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 5111 | |
| 5112 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5113 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5114 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5115 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5116 | f_shutdown(__BFILE__, __LINE__); |
| 5117 | } |
| 5118 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5119 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5120 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5121 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5122 | } |
| 5123 | |
| 5124 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5125 | } |
| 5126 | |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5127 | /* Test MS sending Pkt Cell Change Notification twice (duplicate msg) while sending Pkt Neigh Data Change */ |
| 5128 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup3() runs on RAW_PCU_Test_CT { |
| 5129 | var PollFnCtx pollctx; |
| 5130 | var GprsMS ms; |
| 5131 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5132 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5133 | var RlcmacDlBlock dl_block; |
| 5134 | var uint32_t sched_fn; |
| 5135 | var CtrlMessage rx_ctrl; |
| 5136 | var GsmArfcn req_arfcn := 862; |
| 5137 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5138 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5139 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5140 | if (use_old_ctrl_iface) { |
| 5141 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5142 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5143 | } |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5144 | |
| 5145 | /* Initialize NS/BSSGP side */ |
| 5146 | f_init_bssgp(); |
| 5147 | /* Initialize GPRS MS side */ |
| 5148 | f_init_gprs_ms(); |
| 5149 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5150 | |
| 5151 | /* Initialize the PCU interface abstraction */ |
| 5152 | f_init_raw(testcasename(), info_ind); |
| 5153 | |
| 5154 | /* Make sure we are not affected by full cache from previous tests */ |
| 5155 | f_pcuvty_flush_neigh_caches(); |
| 5156 | |
| 5157 | /* Establish BSSGP connection to the PCU */ |
| 5158 | f_bssgp_establish(); |
| 5159 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5160 | |
| 5161 | /* Send PACKET RESOURCE REQUEST */ |
| 5162 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5163 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5164 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5165 | |
| 5166 | /* Start NACC from MS side */ |
| 5167 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5168 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5169 | |
| 5170 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5171 | 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] | 5172 | /* RIM procedure: */ |
| 5173 | as_outbound_nacc_rim_resolve(info_ind); |
| 5174 | |
| 5175 | /* Receive first Pkt Neigh data Change, then trigger a new Pkt Cell Change Notif: */ |
| 5176 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, single_step := true); |
| 5177 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5178 | |
| 5179 | /* It should be ignored, let's continue fetching Pkt Neigh Data Change */ |
| 5180 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, f_ms_tx_TsTrxBtsNum(ms), 1, 16); |
| 5181 | |
| 5182 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5183 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5184 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5185 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5186 | f_shutdown(__BFILE__, __LINE__); |
| 5187 | } |
| 5188 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5189 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5190 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5191 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5192 | } |
| 5193 | } |
| 5194 | |
| 5195 | /* Test MS sending Pkt Cell Change Notification twice (duplicate msg) while sending Pkt Cell Change Continue */ |
| 5196 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup4() runs on RAW_PCU_Test_CT { |
| 5197 | var PollFnCtx pollctx; |
| 5198 | var GprsMS ms; |
| 5199 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5200 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5201 | var RlcmacDlBlock dl_block; |
| 5202 | var uint32_t sched_fn; |
| 5203 | var CtrlMessage rx_ctrl; |
| 5204 | var GsmArfcn req_arfcn := 862; |
| 5205 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5206 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5207 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5208 | if (use_old_ctrl_iface) { |
| 5209 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5210 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5211 | } |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5212 | |
| 5213 | /* Initialize NS/BSSGP side */ |
| 5214 | f_init_bssgp(); |
| 5215 | /* Initialize GPRS MS side */ |
| 5216 | f_init_gprs_ms(); |
| 5217 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5218 | |
| 5219 | /* Initialize the PCU interface abstraction */ |
| 5220 | f_init_raw(testcasename(), info_ind); |
| 5221 | |
| 5222 | /* Make sure we are not affected by full cache from previous tests */ |
| 5223 | f_pcuvty_flush_neigh_caches(); |
| 5224 | |
| 5225 | /* Establish BSSGP connection to the PCU */ |
| 5226 | f_bssgp_establish(); |
| 5227 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5228 | |
| 5229 | /* Send PACKET RESOURCE REQUEST */ |
| 5230 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5231 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5232 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5233 | |
| 5234 | /* Start NACC from MS side */ |
| 5235 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5236 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5237 | |
| 5238 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5239 | 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] | 5240 | /* RIM procedure: */ |
| 5241 | as_outbound_nacc_rim_resolve(info_ind); |
| 5242 | |
| 5243 | /* Announce SI back to MS, continue NACC procedure */ |
| 5244 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 5245 | |
| 5246 | /* trigger a dup Pkt Cell Change Notif, it should be ignored: */ |
| 5247 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5248 | |
| 5249 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5250 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5251 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5252 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5253 | f_shutdown(__BFILE__, __LINE__); |
| 5254 | } |
| 5255 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5256 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5257 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5258 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5259 | } |
| 5260 | } |
| 5261 | |
| 5262 | /* Test MS sending Pkt Cell Change Notification twice (duplicate msg) while waiting for Pkt Cell Change Continue CTRL ACK */ |
| 5263 | testcase TC_nacc_outbound_pkt_cell_chg_notif_dup5() runs on RAW_PCU_Test_CT { |
| 5264 | var PollFnCtx pollctx; |
| 5265 | var GprsMS ms; |
| 5266 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5267 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5268 | var RlcmacDlBlock dl_block; |
| 5269 | var uint32_t sched_fn; |
| 5270 | var CtrlMessage rx_ctrl; |
| 5271 | var GsmArfcn req_arfcn := 862; |
| 5272 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5273 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5274 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5275 | if (use_old_ctrl_iface) { |
| 5276 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5277 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5278 | } |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 5279 | |
| 5280 | /* Initialize NS/BSSGP side */ |
| 5281 | f_init_bssgp(); |
| 5282 | /* Initialize GPRS MS side */ |
| 5283 | f_init_gprs_ms(); |
| 5284 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5285 | |
| 5286 | /* Initialize the PCU interface abstraction */ |
| 5287 | f_init_raw(testcasename(), info_ind); |
| 5288 | |
| 5289 | /* Make sure we are not affected by full cache from previous tests */ |
| 5290 | f_pcuvty_flush_neigh_caches(); |
| 5291 | |
| 5292 | /* Establish BSSGP connection to the PCU */ |
| 5293 | f_bssgp_establish(); |
| 5294 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5295 | |
| 5296 | /* Send PACKET RESOURCE REQUEST */ |
| 5297 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5298 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5299 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5300 | |
| 5301 | /* Start NACC from MS side */ |
| 5302 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5303 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5304 | |
| 5305 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5306 | 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] | 5307 | /* RIM procedure: */ |
| 5308 | as_outbound_nacc_rim_resolve(info_ind); |
| 5309 | |
| 5310 | /* Announce SI back to MS, continue NACC procedure */ |
| 5311 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 5312 | |
| 5313 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5314 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5315 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5316 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5317 | f_shutdown(__BFILE__, __LINE__); |
| 5318 | } |
| 5319 | /* trigger a dup Pkt Cell Change Notif, it should be ignored: */ |
| 5320 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5321 | |
| 5322 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5323 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5324 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5325 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5326 | } |
| 5327 | } |
| 5328 | |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5329 | /* Test MS sending Pkt Cell Change Notify twice (different tgt cell each time) |
| 5330 | * while waiting for CTRL resolution */ |
| 5331 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice() runs on RAW_PCU_Test_CT { |
| 5332 | var PollFnCtx pollctx; |
| 5333 | var GprsMS ms; |
| 5334 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5335 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5336 | var RlcmacDlBlock dl_block; |
| 5337 | var uint32_t sched_fn; |
| 5338 | var CtrlMessage rx_ctrl; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5339 | var charstring ctrl_var; |
| 5340 | var PCUIF_Message pcu_msg; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5341 | var GsmArfcn req_arfcn := 862; |
| 5342 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5343 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5344 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5345 | if (use_old_ctrl_iface) { |
| 5346 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5347 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5348 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5349 | |
| 5350 | /* Initialize NS/BSSGP side */ |
| 5351 | f_init_bssgp(); |
| 5352 | /* Initialize GPRS MS side */ |
| 5353 | f_init_gprs_ms(); |
| 5354 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5355 | |
| 5356 | /* Initialize the PCU interface abstraction */ |
| 5357 | f_init_raw(testcasename(), info_ind); |
| 5358 | |
| 5359 | /* Make sure we are not affected by full cache from previous tests */ |
| 5360 | f_pcuvty_flush_neigh_caches(); |
| 5361 | |
| 5362 | /* Establish BSSGP connection to the PCU */ |
| 5363 | f_bssgp_establish(); |
| 5364 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5365 | |
| 5366 | /* Send PACKET RESOURCE REQUEST */ |
| 5367 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5368 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5369 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5370 | |
| 5371 | /* Start NACC from MS side */ |
| 5372 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5373 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5374 | |
| 5375 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5376 | if (use_old_ctrl_iface) { |
| 5377 | f_ipa_ctrl_wait_link_up(); |
| 5378 | ctrl_var := "neighbor_resolve_cgi_ps_from_lac_ci." & |
| 5379 | int2str(info_ind.lac) & "." & |
| 5380 | int2str(info_ind.cell_id) & "." & |
| 5381 | int2str(req_arfcn) & "." & |
| 5382 | int2str(req_bsic); |
| 5383 | IPA_CTRL.receive(tr_CtrlMsgGet(?, ctrl_var)) -> value rx_ctrl; |
| 5384 | } else { |
| 5385 | BTS.receive(tr_PCUIF_NEIGH_ADDR_REQ(0, info_ind.lac, info_ind.cell_id, req_arfcn, req_bsic)) -> value pcu_msg; |
| 5386 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5387 | /* Before receiving CTRL response, MS retransmits Pkt cell Chg Notif with different tgt arfcn */ |
| 5388 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 5389 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5390 | 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] | 5391 | if (use_old_ctrl_iface) { |
| 5392 | IPA_CTRL.send(ts_CtrlMsgGetRepl(rx_ctrl.cmd.id, valueof(ctrl_var), valueof("023-43-423-2-5"))); |
| 5393 | } else { |
| 5394 | BTS.send(ts_PCUIF_NEIGH_ADDR_CNF(0, pcu_msg.u.container.u.neigh_addr_req, 0, 23, 43, 0, 423, 2, 5)); |
| 5395 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5396 | /* 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] | 5397 | 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] | 5398 | |
| 5399 | /* And finally everything continues as usual with RIN procedure */ |
| 5400 | as_outbound_nacc_rim_resolve(info_ind); |
| 5401 | |
| 5402 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 5403 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5404 | |
| 5405 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5406 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5407 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5408 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5409 | f_shutdown(__BFILE__, __LINE__); |
| 5410 | } |
| 5411 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5412 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5413 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5414 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5415 | } |
| 5416 | |
| 5417 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5418 | } |
| 5419 | |
| 5420 | /* Test MS sending Pkt Cell Change Notify twice (different tgt cell each time) |
| 5421 | * while waiting for SI resolution */ |
| 5422 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice2() runs on RAW_PCU_Test_CT { |
| 5423 | var PollFnCtx pollctx; |
| 5424 | var GprsMS ms; |
| 5425 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5426 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5427 | var RlcmacDlBlock dl_block; |
| 5428 | var uint32_t sched_fn; |
| 5429 | var CtrlMessage rx_ctrl; |
| 5430 | var GsmArfcn req_arfcn := 862; |
| 5431 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5432 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5433 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5434 | if (use_old_ctrl_iface) { |
| 5435 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5436 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5437 | } |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5438 | |
| 5439 | /* Initialize NS/BSSGP side */ |
| 5440 | f_init_bssgp(); |
| 5441 | /* Initialize GPRS MS side */ |
| 5442 | f_init_gprs_ms(); |
| 5443 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5444 | |
| 5445 | /* Initialize the PCU interface abstraction */ |
| 5446 | f_init_raw(testcasename(), info_ind); |
| 5447 | |
| 5448 | /* Make sure we are not affected by full cache from previous tests */ |
| 5449 | f_pcuvty_flush_neigh_caches(); |
| 5450 | |
| 5451 | /* Establish BSSGP connection to the PCU */ |
| 5452 | f_bssgp_establish(); |
| 5453 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5454 | |
| 5455 | /* Send PACKET RESOURCE REQUEST */ |
| 5456 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5457 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5458 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5459 | |
| 5460 | /* Start NACC from MS side */ |
| 5461 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5462 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5463 | |
| 5464 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5465 | 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] | 5466 | as_outbound_nacc_rim_resolve(info_ind, do_answer := false); |
| 5467 | /* Before receiving RIM response, MS retransmits Pkt cell Chg Notif with different tgt cell: */ |
| 5468 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 5469 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5470 | f_sleep(0.2); /* let some time to avoid race conditons between CTRL and RLCMAC */ |
| 5471 | f_outbound_nacc_rim_tx_resp(info_ind); |
| 5472 | |
| 5473 | /* 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] | 5474 | 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] | 5475 | |
| 5476 | /* And finally everything continues as usual with RIN procedure */ |
| 5477 | as_outbound_nacc_rim_resolve(info_ind); |
| 5478 | |
| 5479 | /* Announce SI back to MS, continue NACC procedure */ |
Pau Espin Pedrol | 6cb71cc | 2021-02-11 13:54:01 +0100 | [diff] [blame] | 5480 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 5481 | |
| 5482 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5483 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5484 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5485 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5486 | f_shutdown(__BFILE__, __LINE__); |
| 5487 | } |
| 5488 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5489 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5490 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5491 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5492 | } |
| 5493 | |
| 5494 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5495 | } |
| 5496 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5497 | /* Test MS sending Pkt Cell Change Notify twice (different tgt cell each time) |
| 5498 | * while sending Pkt Neigh Data Change */ |
| 5499 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice3() runs on RAW_PCU_Test_CT { |
| 5500 | var PollFnCtx pollctx; |
| 5501 | var GprsMS ms; |
| 5502 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5503 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5504 | var RlcmacDlBlock dl_block; |
| 5505 | var uint32_t sched_fn; |
| 5506 | var CtrlMessage rx_ctrl; |
| 5507 | var GsmArfcn req_arfcn := 862; |
| 5508 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5509 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5510 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5511 | if (use_old_ctrl_iface) { |
| 5512 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5513 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5514 | } |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5515 | |
| 5516 | /* Initialize NS/BSSGP side */ |
| 5517 | f_init_bssgp(); |
| 5518 | /* Initialize GPRS MS side */ |
| 5519 | f_init_gprs_ms(); |
| 5520 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5521 | |
| 5522 | /* Initialize the PCU interface abstraction */ |
| 5523 | f_init_raw(testcasename(), info_ind); |
| 5524 | |
| 5525 | /* Make sure we are not affected by full cache from previous tests */ |
| 5526 | f_pcuvty_flush_neigh_caches(); |
| 5527 | |
| 5528 | /* Establish BSSGP connection to the PCU */ |
| 5529 | f_bssgp_establish(); |
| 5530 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5531 | |
| 5532 | /* Send PACKET RESOURCE REQUEST */ |
| 5533 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5534 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5535 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5536 | |
| 5537 | /* Start NACC from MS side */ |
| 5538 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5539 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5540 | |
| 5541 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5542 | 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] | 5543 | /* RIM procedure: */ |
| 5544 | as_outbound_nacc_rim_resolve(info_ind); |
| 5545 | |
| 5546 | /* Receive first Pkt Neigh data Change, then trigger a new Pkt Cell Change Notif (different ARFCN+BSIC): */ |
| 5547 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, single_step := true); |
| 5548 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 5549 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5550 | |
| 5551 | /* It should trigger RAC_CI resolution to start again: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5552 | 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] | 5553 | /* RIM procedure: */ |
| 5554 | as_outbound_nacc_rim_resolve(info_ind); |
| 5555 | /* Transmit SI back to MS */ |
| 5556 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 5557 | |
| 5558 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5559 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5560 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5561 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5562 | f_shutdown(__BFILE__, __LINE__); |
| 5563 | } |
| 5564 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5565 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5566 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5567 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5568 | } |
| 5569 | } |
| 5570 | |
| 5571 | /* Test MS sending Pkt Cell Change Notification twice (different tgt cell) while sending Pkt Cell Change Continue */ |
| 5572 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice4() runs on RAW_PCU_Test_CT { |
| 5573 | var PollFnCtx pollctx; |
| 5574 | var GprsMS ms; |
| 5575 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5576 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5577 | var RlcmacDlBlock dl_block; |
| 5578 | var uint32_t sched_fn; |
| 5579 | var CtrlMessage rx_ctrl; |
| 5580 | var GsmArfcn req_arfcn := 862; |
| 5581 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5582 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5583 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5584 | if (use_old_ctrl_iface) { |
| 5585 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5586 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5587 | } |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5588 | |
| 5589 | /* Initialize NS/BSSGP side */ |
| 5590 | f_init_bssgp(); |
| 5591 | /* Initialize GPRS MS side */ |
| 5592 | f_init_gprs_ms(); |
| 5593 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5594 | |
| 5595 | /* Initialize the PCU interface abstraction */ |
| 5596 | f_init_raw(testcasename(), info_ind); |
| 5597 | |
| 5598 | /* Make sure we are not affected by full cache from previous tests */ |
| 5599 | f_pcuvty_flush_neigh_caches(); |
| 5600 | |
| 5601 | /* Establish BSSGP connection to the PCU */ |
| 5602 | f_bssgp_establish(); |
| 5603 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5604 | |
| 5605 | /* Send PACKET RESOURCE REQUEST */ |
| 5606 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5607 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5608 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5609 | |
| 5610 | /* Start NACC from MS side */ |
| 5611 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5612 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5613 | |
| 5614 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5615 | 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] | 5616 | /* RIM procedure: */ |
| 5617 | as_outbound_nacc_rim_resolve(info_ind); |
| 5618 | |
| 5619 | /* Announce SI back to MS, continue NACC procedure */ |
| 5620 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 5621 | |
| 5622 | /* trigger a Pkt Cell Change Notif with different tgt cell */ |
| 5623 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 5624 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5625 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5626 | /* It should trigger RAC_CI resolution to start again: */ |
| 5627 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
| 5628 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5629 | /* PCU TBF NACC state changed, so we should next receive a dummy block: */ |
| 5630 | f_rx_rlcmac_dl_block_exp_dummy(dl_block, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5631 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5632 | /* RIM procedure: */ |
| 5633 | as_outbound_nacc_rim_resolve(info_ind); |
| 5634 | /* Transmit SI back to MS */ |
| 5635 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 5636 | |
| 5637 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5638 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5639 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5640 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5641 | f_shutdown(__BFILE__, __LINE__); |
| 5642 | } |
| 5643 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5644 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5645 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5646 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5647 | } |
| 5648 | } |
| 5649 | |
| 5650 | /* Test MS sending Pkt Cell Change Notification twice (different tgt cell) while waiting for Pkt Cell Change Continue CTRL ACK*/ |
| 5651 | testcase TC_nacc_outbound_pkt_cell_chg_notif_twice5() runs on RAW_PCU_Test_CT { |
| 5652 | var PollFnCtx pollctx; |
| 5653 | var GprsMS ms; |
| 5654 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5655 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5656 | var RlcmacDlBlock dl_block; |
| 5657 | var uint32_t sched_fn; |
| 5658 | var CtrlMessage rx_ctrl; |
| 5659 | var GsmArfcn req_arfcn := 862; |
| 5660 | var uint6_t req_bsic := 43; |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5661 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5662 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5663 | if (use_old_ctrl_iface) { |
| 5664 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5665 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5666 | } |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5667 | |
| 5668 | /* Initialize NS/BSSGP side */ |
| 5669 | f_init_bssgp(); |
| 5670 | /* Initialize GPRS MS side */ |
| 5671 | f_init_gprs_ms(); |
| 5672 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5673 | |
| 5674 | /* Initialize the PCU interface abstraction */ |
| 5675 | f_init_raw(testcasename(), info_ind); |
| 5676 | |
| 5677 | /* Make sure we are not affected by full cache from previous tests */ |
| 5678 | f_pcuvty_flush_neigh_caches(); |
| 5679 | |
| 5680 | /* Establish BSSGP connection to the PCU */ |
| 5681 | f_bssgp_establish(); |
| 5682 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5683 | |
| 5684 | /* Send PACKET RESOURCE REQUEST */ |
| 5685 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5686 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5687 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5688 | |
| 5689 | /* Start NACC from MS side */ |
| 5690 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5691 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5692 | |
| 5693 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5694 | 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] | 5695 | /* RIM procedure: */ |
| 5696 | as_outbound_nacc_rim_resolve(info_ind); |
| 5697 | |
| 5698 | /* Announce SI back to MS, continue NACC procedure */ |
| 5699 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 5700 | |
| 5701 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5702 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5703 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5704 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5705 | f_shutdown(__BFILE__, __LINE__); |
| 5706 | } |
| 5707 | |
| 5708 | /* trigger a Pkt Cell Change Notif with different tgt cell */ |
| 5709 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn + 1, req_bsic + 1); |
| 5710 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5711 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5712 | /* It should trigger RAC_CI resolution to start again: */ |
| 5713 | /* When using new PCUIF interface for resolution, we must |
| 5714 | * PCUIF.receive() here since that's the first message in the PCUIF |
| 5715 | * queue that PCU will have sent. Calling other functions doing |
| 5716 | * PCUIF.receive() (like f_ms_tx_ul_block() below) will make them fail |
| 5717 | * due to unexpected message receive. */ |
| 5718 | if (not use_old_ctrl_iface) { |
| 5719 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
| 5720 | } |
| 5721 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5722 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5723 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5724 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5725 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5726 | } |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5727 | |
| 5728 | /* When using CTRL interface, we must schedule the ACK before (see |
| 5729 | * above) blocking here waiting for the resoltion, otherwise we'll be |
| 5730 | * too late scheduling by the time the resolution is done. */ |
| 5731 | if (use_old_ctrl_iface) { |
| 5732 | f_handle_nacc_rac_ci_query(info_ind, req_arfcn + 1, req_bsic + 1, true, use_old_ctrl_iface); |
| 5733 | } |
| 5734 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5735 | /* PCU TBF NACC state changed, so we should next receive a dummy block: */ |
| 5736 | f_rx_rlcmac_dl_block_exp_dummy(dl_block); |
| 5737 | |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 5738 | /* RIM procedure: */ |
| 5739 | as_outbound_nacc_rim_resolve(info_ind); |
| 5740 | /* Transmit SI back to MS */ |
| 5741 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default); |
| 5742 | |
| 5743 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5744 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5745 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5746 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5747 | f_shutdown(__BFILE__, __LINE__); |
| 5748 | } |
| 5749 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5750 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5751 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5752 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5753 | } |
| 5754 | } |
| 5755 | |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 5756 | /* Test MS sending Pkt Cell Change Notification on an MS with an existing but unassigned (no TFI) DL TBF */ |
| 5757 | testcase TC_nacc_outbound_pkt_cell_chg_notif_unassigned_dl_tbf() runs on RAW_PCU_Test_CT { |
| 5758 | var PollFnCtx pollctx; |
| 5759 | var GprsMS ms; |
| 5760 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 5761 | var template (value) RlcmacUlCtrlMsg cell_chf_notif; |
| 5762 | var RlcmacDlBlock dl_block; |
| 5763 | var uint32_t sched_fn, dl_fn; |
| 5764 | var CtrlMessage rx_ctrl; |
| 5765 | var GsmArfcn req_arfcn := 862; |
| 5766 | var uint6_t req_bsic := 43; |
| 5767 | var octetstring data := f_rnd_octstring(10); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5768 | var boolean use_old_ctrl_iface := mp_ctrl_neigh_ip != ""; |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 5769 | |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5770 | if (use_old_ctrl_iface) { |
| 5771 | /* Initialize osmo-bsc emulation neighbor resolution CTRL port */ |
| 5772 | f_ipa_ctrl_start_server(mp_ctrl_neigh_ip, mp_ctrl_neigh_port); |
| 5773 | } |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 5774 | |
| 5775 | /* Initialize NS/BSSGP side */ |
| 5776 | f_init_bssgp(); |
| 5777 | /* Initialize GPRS MS side */ |
| 5778 | f_init_gprs_ms(); |
| 5779 | ms := g_ms[0]; /* We only use first MS in this test */ |
| 5780 | |
| 5781 | /* Initialize the PCU interface abstraction */ |
| 5782 | f_init_raw(testcasename(), info_ind); |
| 5783 | |
| 5784 | /* Make sure we are not affected by full cache from previous tests */ |
| 5785 | f_pcuvty_flush_neigh_caches(); |
| 5786 | |
| 5787 | /* Establish BSSGP connection to the PCU */ |
| 5788 | f_bssgp_establish(); |
| 5789 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 5790 | |
| 5791 | /* Send PACKET RESOURCE REQUEST */ |
| 5792 | pollctx := f_ms_establish_ul_tbf_2phase_access(ms, ts_RlcMacUlCtrl_PKT_RES_REQ(ms.tlli, ms_racap_gprs_def)); |
| 5793 | /* Pkt Uplink Assignment above sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5794 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), pollctx.fn, nr := pollctx.tstrxbts); |
| 5795 | |
| 5796 | /* Start NACC from MS side */ |
| 5797 | cell_chf_notif := ts_RlcMacUlCtrl_PKT_CELL_CHG_NOTIF(ms.ul_tbf.tfi, req_arfcn, req_bsic); |
| 5798 | f_ms_tx_ul_block(ms, ts_RLC_UL_CTRL_ACK(cell_chf_notif), 0, nr := f_ms_tx_TsTrxBtsNum(ms)); |
| 5799 | |
| 5800 | /* osmo-pcu should now ask for resolution: */ |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 5801 | 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] | 5802 | /* RIM procedure: */ |
| 5803 | as_outbound_nacc_rim_resolve(info_ind); |
| 5804 | |
| 5805 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data)); |
| 5806 | /* Make sure we leave some time for SGSN->PCU data to arrive to PCU */ |
| 5807 | f_sleep(0.1); |
| 5808 | /* rx DL assignment, don't ack it yet (keep TBF in state ASSIGN): */ |
| 5809 | f_ms_rx_pkt_ass_pacch(ms, sched_fn, tr_RLCMAC_DL_PACKET_ASS); |
| 5810 | |
| 5811 | /* NACC: scheduler selects tx Pkt Cell Neighbor Data. Receive first one: */ |
| 5812 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, single_step := true); |
| 5813 | /* ACK DL assignment (we do it here on purpose to test tx Pkt Neigh Cell |
| 5814 | * Data with unassigned DL TBF in line above): */ |
| 5815 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5816 | /* Continue receiving Pkt Cell Neighbor Data */ |
| 5817 | f_ms_handle_pkt_neighbor_cell_data(ms, si_default, f_ms_tx_TsTrxBtsNum(ms), 1, 16); |
| 5818 | |
| 5819 | /* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */ |
| 5820 | f_rx_rlcmac_dl_block(dl_block, sched_fn); |
| 5821 | if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_CELL_CHG_CONTINUE))) { |
| 5822 | setverdict(fail, "Rx unexpected DL block: ", dl_block); |
| 5823 | f_shutdown(__BFILE__, __LINE__); |
| 5824 | } |
| 5825 | /* PKT CELL CHG CONTINUE ACK/NACK sets poll+rrbp requesting PACKET CONTROL ACK */ |
| 5826 | if (dl_block.ctrl.mac_hdr.rrbp_valid) { |
| 5827 | sched_fn := f_rrbp_ack_fn(sched_fn, dl_block.ctrl.mac_hdr.rrbp); |
| 5828 | f_ms_tx_ul_block(ms, ts_RLCMAC_CTRL_ACK(ms.tlli), sched_fn); |
| 5829 | } |
| 5830 | |
| 5831 | /* Now that we confirmed the new assignment in the dl-tbf, lets receive the data and ack it */ |
| 5832 | f_rx_rlcmac_dl_block_exp_data(dl_block, dl_fn, data, 0); |
| 5833 | f_acknackdesc_ack_block(ms.dl_tbf.acknack_desc, dl_block, '1'B); |
| 5834 | f_ms_tx_ul_block(ms, ts_RLCMAC_DL_ACK_NACK(ms.dl_tbf.tfi, ms.dl_tbf.acknack_desc), |
| 5835 | f_dl_block_ack_fn(dl_block, dl_fn)); |
| 5836 | } |
| 5837 | |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5838 | |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 5839 | function f_do_inbound_nacc(template (value) RIM_Routing_Information tx_src_addr, template RIM_Routing_Information rx_dst_addr) |
| 5840 | runs on RAW_PCU_Test_CT |
| 5841 | { |
| 5842 | var template (value) RAN_Information_Request_RIM_Container req_cont; |
| 5843 | var template (value) PDU_BSSGP bssgp_rim_pdu; |
| 5844 | var template PDU_BSSGP bssgp_rim_pdu_expect; |
| 5845 | var template RAN_Information_RIM_Container rim_cont_expect; |
| 5846 | var RIM_Routing_Address bts_addr; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5847 | |
| 5848 | /* Send sysinfo to the PCU */ |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 5849 | 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] | 5850 | BTS.send(si1_data_ind); |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 5851 | 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] | 5852 | BTS.send(si3_data_ind); |
Pau Espin Pedrol | 02a6d0c | 2021-04-19 17:11:07 +0200 | [diff] [blame] | 5853 | 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); |
| 5854 | BTS.send(si13_data_ind); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5855 | f_sleep(1.0); |
| 5856 | |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 5857 | 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] | 5858 | |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5859 | req_cont := ts_RAN_Information_Request_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 5860 | ts_RIM_Sequence_Number(1), |
| 5861 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 5862 | ts_RIM_Protocol_Version_Number(1), |
| 5863 | tsu_RAN_Information_Request_Application_Container_NACC(mp_gb_cfg.bvc[0].cell_id), |
| 5864 | omit); |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 5865 | bssgp_rim_pdu := ts_RAN_INFORMATION_REQUEST(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, bts_addr), |
| 5866 | tx_src_addr, req_cont); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5867 | |
| 5868 | rim_cont_expect := tr_RAN_Information_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 5869 | tr_RIM_Sequence_Number(1), |
| 5870 | tr_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 5871 | tr_RIM_Protocol_Version_Number(1), |
Pau Espin Pedrol | 0af478e | 2021-02-05 18:00:58 +0100 | [diff] [blame] | 5872 | 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] | 5873 | omit); |
| 5874 | |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 5875 | bssgp_rim_pdu_expect := tr_PDU_BSSGP_RAN_INFORMATION(rx_dst_addr, |
| 5876 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, bts_addr), |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5877 | rim_cont_expect); |
| 5878 | RIM.send(bssgp_rim_pdu); |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 5879 | timer T := 2.0; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5880 | T.start; |
| 5881 | alt { |
| 5882 | [] RIM.receive(bssgp_rim_pdu_expect) { } |
| 5883 | [] RIM.receive { |
| 5884 | setverdict(fail, "Unexpected BSSGP RIM PDU received"); |
| 5885 | } |
| 5886 | [] T.timeout { |
| 5887 | setverdict(fail, "No BSSGP RIM PDU received"); |
| 5888 | mtc.stop; |
| 5889 | } |
| 5890 | } |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 5891 | } |
| 5892 | /* Send a RIM RAN info request to the PCU and verify the response, we expect |
| 5893 | * getting the system information back which we have transfered to the PCU via |
| 5894 | * PCUIF on startup. */ |
| 5895 | testcase TC_rim_ran_info_req_single_rep() runs on RAW_PCU_Test_CT { |
| 5896 | /* Initialize NS/BSSGP side */ |
| 5897 | f_init_bssgp(); |
| 5898 | |
| 5899 | /* Initialize the PCU interface abstraction */ |
| 5900 | f_init_raw(testcasename()); |
| 5901 | |
| 5902 | /* Establish BSSGP connection to the PCU */ |
| 5903 | f_bssgp_establish(); |
| 5904 | |
| 5905 | var BssgpCellId src_cid := {ra_id := { lai := { mcc_mnc := '262F42'H, lac := 12345}, rac := 0 }, cell_id := 20962 }; |
| 5906 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_cid(src_cid)); |
| 5907 | |
| 5908 | f_do_inbound_nacc(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 5909 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr)); |
| 5910 | |
| 5911 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5912 | } |
| 5913 | |
| 5914 | /* Same as TC_rim_ran_info_req_single_rep, but using an EUTRAN eNodeB ID as |
| 5915 | * Routing information, to verify PCU handles that kind of address just fine |
| 5916 | */ |
| 5917 | testcase TC_rim_ran_info_req_single_rep_eutran() runs on RAW_PCU_Test_CT { |
| 5918 | /* Initialize NS/BSSGP side */ |
| 5919 | f_init_bssgp(); |
| 5920 | |
| 5921 | /* Initialize the PCU interface abstraction */ |
| 5922 | f_init_raw(testcasename()); |
| 5923 | |
| 5924 | /* Establish BSSGP connection to the PCU */ |
| 5925 | f_bssgp_establish(); |
| 5926 | |
| 5927 | var BssgpCellId src_cid := {ra_id := { lai := { mcc_mnc := '262F42'H, lac := 12345}, rac := 0 }, cell_id := 20962 }; |
| 5928 | var RIM_Routing_Address src_addr := valueof(t_RIM_Routing_Address_enbid(src_cid, tac := 3, gnbid := '12345678123456'O)); |
| 5929 | |
| 5930 | f_do_inbound_nacc(ts_RIM_Routing_Information(RIM_ADDR_EUTRAN_NODEB_ID, src_addr), |
| 5931 | tr_RIM_Routing_Information(RIM_ADDR_EUTRAN_NODEB_ID, src_addr)); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5932 | |
| 5933 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 5934 | } |
| 5935 | |
| 5936 | /* Same as above, but in this case we simulate the rare case in which the PCU |
| 5937 | * has no system information available. We expect getting a response back but |
| 5938 | * with no system information inside. */ |
| 5939 | 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] | 5940 | var template (value) PCUIF_info_ind info_ind := ts_PCUIF_INFO_default; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5941 | var PCUIF_Message pcu_msg; |
| 5942 | timer T := 2.0; |
| 5943 | |
| 5944 | /* Initialize NS/BSSGP side */ |
| 5945 | f_init_bssgp(); |
| 5946 | |
| 5947 | /* Initialize the PCU interface abstraction */ |
| 5948 | f_init_raw(testcasename(), info_ind); |
| 5949 | |
| 5950 | /* Establish BSSGP connection to the PCU */ |
| 5951 | f_bssgp_establish(); |
| 5952 | |
| 5953 | /* Clear sysinfo from the PCU */ |
| 5954 | 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); |
| 5955 | BTS.send(si1_data_ind); |
| 5956 | 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); |
| 5957 | BTS.send(si3_data_ind); |
| 5958 | 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); |
| 5959 | BTS.send(si16_data_ind); |
| 5960 | f_sleep(1.0); |
| 5961 | |
Pau Espin Pedrol | fa64e28 | 2021-02-05 17:56:52 +0100 | [diff] [blame] | 5962 | var RIM_Routing_Address dst_addr; |
| 5963 | var RIM_Routing_Address src_addr; |
| 5964 | var template (value) RAN_Information_Request_RIM_Container req_cont; |
| 5965 | var template (value) PDU_BSSGP bssgp_rim_pdu; |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 5966 | var template PDU_BSSGP bssgp_rim_pdu_expect; |
| 5967 | var template RAN_Information_RIM_Container rim_cont_expect; |
| 5968 | |
| 5969 | 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] | 5970 | src_addr := valueof(t_RIM_Routing_Address_cid(src_cid)); |
| 5971 | 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] | 5972 | |
| 5973 | req_cont := ts_RAN_Information_Request_RIM_Container(ts_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 5974 | ts_RIM_Sequence_Number(1), |
| 5975 | ts_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 5976 | ts_RIM_Protocol_Version_Number(1), |
| 5977 | tsu_RAN_Information_Request_Application_Container_NACC(mp_gb_cfg.bvc[0].cell_id), |
| 5978 | omit); |
| 5979 | bssgp_rim_pdu := ts_RAN_INFORMATION_REQUEST(ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 5980 | ts_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 5981 | req_cont); |
| 5982 | |
| 5983 | |
| 5984 | rim_cont_expect := tr_RAN_Information_RIM_Container(tr_RIM_Application_Identity(RIM_APP_ID_NACC), |
| 5985 | tr_RIM_Sequence_Number(1), |
| 5986 | tr_RIM_PDU_Indications(false, RIM_PDU_TYPE_SING_REP), |
| 5987 | tr_RIM_Protocol_Version_Number(1), |
| 5988 | tru_ApplContainer_or_ApplErrContainer_NACC(tru_ApplContainer_NACC(mp_gb_cfg.bvc[0].cell_id, false, 0, ''O)), |
| 5989 | omit); |
| 5990 | |
| 5991 | bssgp_rim_pdu_expect := tr_PDU_BSSGP_RAN_INFORMATION(tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, src_addr), |
| 5992 | tr_RIM_Routing_Information(RIM_ADDR_GERAN_CELL_ID, dst_addr), |
| 5993 | rim_cont_expect); |
| 5994 | RIM.send(bssgp_rim_pdu); |
| 5995 | T.start; |
| 5996 | alt { |
| 5997 | [] RIM.receive(bssgp_rim_pdu_expect) { } |
| 5998 | [] RIM.receive { |
| 5999 | setverdict(fail, "Unexpected BSSGP RIM PDU received"); |
| 6000 | } |
| 6001 | [] T.timeout { |
| 6002 | setverdict(fail, "No BSSGP RIM PDU received"); |
| 6003 | mtc.stop; |
| 6004 | } |
| 6005 | } |
| 6006 | |
| 6007 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6008 | } |
| 6009 | |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame^] | 6010 | /* Verify PCU schedule idle blocks (len=0) if no TBF attached to it. See OS#4772, SYS#4919 */ |
Pau Espin Pedrol | 3aa61c6 | 2021-08-25 19:24:03 +0200 | [diff] [blame] | 6011 | testcase TC_pdch_energy_saving() runs on RAW_PCU_Test_CT { |
| 6012 | var PCUIF_info_ind info_ind; |
| 6013 | var template (value) TsTrxBtsNum nr; |
| 6014 | var RlcmacDlBlock dl_block; |
| 6015 | var BTS_PDTCH_Block data_msg; |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame^] | 6016 | var integer ts; |
Pau Espin Pedrol | 3aa61c6 | 2021-08-25 19:24:03 +0200 | [diff] [blame] | 6017 | timer T; |
| 6018 | |
| 6019 | /* Initialize NS/BSSGP side */ |
| 6020 | f_init_bssgp(); |
| 6021 | |
| 6022 | info_ind := valueof(ts_PCUIF_INFO_default); |
| 6023 | /* The 2 first TRX are enabled. */ |
| 6024 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (2 .. 7)); |
| 6025 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0); |
| 6026 | f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 1); |
| 6027 | |
| 6028 | /* Initialize the PCU interface abstraction */ |
| 6029 | f_init_raw(testcasename(), info_ind); |
| 6030 | |
| 6031 | /* Establish BSSGP connection to the PCU */ |
| 6032 | f_bssgp_establish(); |
| 6033 | |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame^] | 6034 | for (ts := 0; ts < 2; ts := ts + 1) { |
| 6035 | nr := ts_TsTrxBtsNum(ts_nr := 7, trx_nr := ts, bts_nr := 0, blk_nr := 0); |
Pau Espin Pedrol | 3aa61c6 | 2021-08-25 19:24:03 +0200 | [diff] [blame] | 6036 | |
Pau Espin Pedrol | 332aba8 | 2021-09-22 14:50:35 +0200 | [diff] [blame^] | 6037 | BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr, |
| 6038 | sapi := PCU_IF_SAPI_PDTCH, fn := 0, |
| 6039 | arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)), block_nr := nr.blk_nr)); |
| 6040 | T.start(0.5); |
| 6041 | alt { |
| 6042 | [] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, |
| 6043 | tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH), |
| 6044 | omit)) -> value data_msg { |
| 6045 | setverdict(pass); |
| 6046 | T.stop; |
| 6047 | } |
| 6048 | [] as_rx_fail_dummy(nr); |
| 6049 | [] BTS.receive { |
| 6050 | setverdict(fail, "Unexpected block from BTS"); |
| 6051 | f_shutdown(__BFILE__, __LINE__); |
| 6052 | } |
| 6053 | [] T.timeout { |
| 6054 | setverdict(fail, "Expected IDLE block from BTS"); |
| 6055 | f_shutdown(__BFILE__, __LINE__); |
| 6056 | } |
| 6057 | } |
Pau Espin Pedrol | 3aa61c6 | 2021-08-25 19:24:03 +0200 | [diff] [blame] | 6058 | } |
| 6059 | |
| 6060 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6061 | } |
| 6062 | |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 6063 | /* Test stats for available and occupied PDCHs */ |
| 6064 | testcase TC_stat_pdch_avail_occ() runs on RAW_PCU_Test_CT { |
| 6065 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 6066 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 6067 | |
| 6068 | /* Initialize NS/BSSGP side */ |
| 6069 | f_init_bssgp(); |
| 6070 | |
Oliver Smith | edcded2 | 2021-09-14 09:26:55 +0200 | [diff] [blame] | 6071 | /* Only the 4 first TRX are enabled, each with 2 PDCHs. */ |
| 6072 | f_PCUIF_PDCHMask_set(info_ind, '00000011'B, 0); |
| 6073 | f_PCUIF_PDCHMask_set(info_ind, '00001100'B, 1); |
| 6074 | f_PCUIF_PDCHMask_set(info_ind, '11000000'B, 2); |
| 6075 | f_PCUIF_PDCHMask_set(info_ind, '00110000'B, 3); |
| 6076 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (4 .. 7)); |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 6077 | |
Oliver Smith | 72d0c69 | 2021-09-08 10:03:52 +0200 | [diff] [blame] | 6078 | /* Allocate 4 GprsMS instances */ |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 6079 | f_init_gprs_ms(4); |
| 6080 | |
| 6081 | /* Initialize the PCU interface abstraction */ |
| 6082 | f_init_raw(testcasename(), info_ind); |
| 6083 | |
| 6084 | /* Reset stats */ |
| 6085 | f_statsd_reset(); |
| 6086 | |
| 6087 | /* Establish BSSGP */ |
| 6088 | f_bssgp_establish(); |
| 6089 | |
| 6090 | /* 8 PDCHs available, 0 occupied */ |
| 6091 | var StatsDExpects expect := { |
| 6092 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
Oliver Smith | 4b2a89f | 2021-09-08 11:24:39 +0200 | [diff] [blame] | 6093 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 0, max := 0 }, |
| 6094 | { name := "TTCN3.bts.0.pdch.occupied.gprs", mtype := "g", min := 0, max := 0 }, |
| 6095 | { name := "TTCN3.bts.0.pdch.occupied.egprs", mtype := "g", min := 0, max := 0 } |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 6096 | }; |
| 6097 | f_statsd_expect(expect); |
| 6098 | |
Oliver Smith | 4b2a89f | 2021-09-08 11:24:39 +0200 | [diff] [blame] | 6099 | /* Establish an Uplink TBF for each GprsMS instance (3x GPRS, 1x EGPRS) */ |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 6100 | f_multi_ms_bssgp_register(); |
Oliver Smith | 4b2a89f | 2021-09-08 11:24:39 +0200 | [diff] [blame] | 6101 | f_ms_establish_ul_tbf(g_ms[0]); |
| 6102 | f_ms_establish_ul_tbf(g_ms[1]); |
| 6103 | f_ms_establish_ul_tbf(g_ms[2]); |
| 6104 | f_ms_establish_ul_tbf_2phase_access(g_ms[3], ts_RlcMacUlCtrl_PKT_RES_REQ(g_ms[3].tlli, ms_racap_egprs_def)); |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 6105 | |
| 6106 | /* 4 PDCHs occupied */ |
| 6107 | expect := { |
| 6108 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
Oliver Smith | 4b2a89f | 2021-09-08 11:24:39 +0200 | [diff] [blame] | 6109 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 4, max := 4 }, |
| 6110 | { name := "TTCN3.bts.0.pdch.occupied.gprs", mtype := "g", min := 3, max := 3 }, |
| 6111 | { name := "TTCN3.bts.0.pdch.occupied.egprs", mtype := "g", min := 1, max := 1 } |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 6112 | }; |
| 6113 | f_statsd_expect(expect); |
| 6114 | |
| 6115 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6116 | } |
| 6117 | |
Oliver Smith | f04762d | 2021-09-14 17:20:38 +0200 | [diff] [blame] | 6118 | /* Test stats for available and occupied PDCHs, for MS which is not known by |
| 6119 | * the PCU (e.g. because it was forgotten due to no interaction, and old DL |
| 6120 | * data arrives from SGSN) */ |
| 6121 | function f_tc_stat_pdch_avail_occ_ms_not_known(boolean egprs) runs on RAW_PCU_Test_CT { |
| 6122 | var PCUIF_info_ind info_ind := valueof(ts_PCUIF_INFO_default); |
| 6123 | const BssgpBvci bvci := mp_gb_cfg.bvc[0].bvci; |
| 6124 | |
| 6125 | /* Ensure a deterministic slot allocation of 1 PDCH with MS class 1 */ |
| 6126 | const MultislotCap_GPRS_BSSGP bssgp_mscap_gprs := { |
| 6127 | gprsmultislotclass := '00001'B, |
| 6128 | gprsextendeddynalloccap := '0'B |
| 6129 | }; |
| 6130 | const MultislotCap_EGPRS_BSSGP bssgp_mscap_egprs := { |
| 6131 | egprsmultislotclass := '00001'B, |
| 6132 | egprsextendeddynalloccap := '0'B |
| 6133 | }; |
| 6134 | template (value) MSRadioAccessCapabilityV_BSSGP bssgp_ms_racap_gprs := { |
| 6135 | valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, bssgp_mscap_gprs, omit)) }; |
| 6136 | template (value) MSRadioAccessCapabilityV_BSSGP bssgp_ms_racap_egprs := { |
| 6137 | valueof(ts_RaCapRec_BSSGP('0001'B /* E-GSM */, bssgp_mscap_gprs, bssgp_mscap_egprs)) }; |
| 6138 | |
| 6139 | /* Initialize NS/BSSGP side */ |
| 6140 | f_init_bssgp(); |
| 6141 | |
| 6142 | /* Only the 4 first TRX are enabled, each with 2 PDCHs. */ |
| 6143 | f_PCUIF_PDCHMask_set(info_ind, '00000011'B, 0); |
| 6144 | f_PCUIF_PDCHMask_set(info_ind, '00001100'B, 1); |
| 6145 | f_PCUIF_PDCHMask_set(info_ind, '11000000'B, 2); |
| 6146 | f_PCUIF_PDCHMask_set(info_ind, '00110000'B, 3); |
| 6147 | f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (4 .. 7)); |
| 6148 | |
| 6149 | /* Allocate 1 GprsMS instance */ |
| 6150 | f_init_gprs_ms(1); |
| 6151 | |
| 6152 | /* Initialize the PCU interface abstraction */ |
| 6153 | f_init_raw(testcasename(), info_ind); |
| 6154 | |
| 6155 | /* Reset stats */ |
| 6156 | f_statsd_reset(); |
| 6157 | |
| 6158 | /* Establish BSSGP */ |
| 6159 | f_bssgp_establish(); |
| 6160 | |
| 6161 | /* 8 PDCHs available, 0 occupied */ |
| 6162 | var StatsDExpects expect := { |
| 6163 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
| 6164 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 0, max := 0 }, |
| 6165 | { name := "TTCN3.bts.0.pdch.occupied.gprs", mtype := "g", min := 0, max := 0 }, |
| 6166 | { name := "TTCN3.bts.0.pdch.occupied.egprs", mtype := "g", min := 0, max := 0 } |
| 6167 | }; |
| 6168 | f_statsd_expect(expect); |
| 6169 | |
| 6170 | var GprsMS ms := g_ms[0]; /* We only use first MS in this test */ |
| 6171 | f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli); |
| 6172 | |
| 6173 | /* SGSN sends some DL data, PCU will page on CCCH (PCH) */ |
| 6174 | var octetstring data := f_rnd_octstring(1400); |
| 6175 | if (egprs) { |
| 6176 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, bssgp_ms_racap_egprs)); |
| 6177 | } else { |
| 6178 | BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, data, bssgp_ms_racap_gprs)); |
| 6179 | } |
| 6180 | f_ms_exp_dl_tbf_ass_ccch(ms, PCU_IF_SAPI_PCH); |
| 6181 | |
| 6182 | /* Wait timer X2002 and DL block is available after CCCH IMM ASS */ |
| 6183 | f_sleep(X2002); |
| 6184 | |
| 6185 | /* 1 PDCH occupied */ |
| 6186 | if (egprs) { |
| 6187 | expect := { |
| 6188 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
| 6189 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 1, max := 1 }, |
| 6190 | { name := "TTCN3.bts.0.pdch.occupied.gprs", mtype := "g", min := 0, max := 0 }, |
| 6191 | { name := "TTCN3.bts.0.pdch.occupied.egprs", mtype := "g", min := 1, max := 1 } |
| 6192 | }; |
| 6193 | } else { |
| 6194 | expect := { |
| 6195 | { name := "TTCN3.bts.0.pdch.available", mtype := "g", min := 8, max := 8 }, |
| 6196 | { name := "TTCN3.bts.0.pdch.occupied", mtype := "g", min := 1, max := 1 }, |
| 6197 | { name := "TTCN3.bts.0.pdch.occupied.gprs", mtype := "g", min := 1, max := 1 }, |
| 6198 | { name := "TTCN3.bts.0.pdch.occupied.egprs", mtype := "g", min := 0, max := 0 } |
| 6199 | }; |
| 6200 | } |
| 6201 | f_statsd_expect(expect); |
| 6202 | |
| 6203 | /* Clean up */ |
| 6204 | f_shutdown(__BFILE__, __LINE__, final := true); |
| 6205 | } |
| 6206 | testcase TC_stat_pdch_avail_occ_ms_not_known_gprs() runs on RAW_PCU_Test_CT { |
| 6207 | f_tc_stat_pdch_avail_occ_ms_not_known(false); |
| 6208 | } |
| 6209 | testcase TC_stat_pdch_avail_occ_ms_not_known_egprs() runs on RAW_PCU_Test_CT { |
| 6210 | f_tc_stat_pdch_avail_occ_ms_not_known(true); |
| 6211 | } |
| 6212 | |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6213 | control { |
| 6214 | execute( TC_pcuif_suspend() ); |
Pau Espin Pedrol | 9e04d5e | 2021-01-11 15:03:50 +0100 | [diff] [blame] | 6215 | execute( TC_pcuif_suspend_active_tbf() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6216 | execute( TC_ta_ptcch_idle() ); |
| 6217 | execute( TC_ta_rach_imm_ass() ); |
Vadim Yanitskiy | 866f870 | 2021-05-26 14:50:27 +0200 | [diff] [blame] | 6218 | execute( TC_ta_ul_ack_nack_first_block() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6219 | execute( TC_ta_idle_dl_tbf_ass() ); |
| 6220 | execute( TC_ta_ptcch_ul_multi_tbf() ); |
| 6221 | execute( TC_cs_lqual_ul_tbf() ); |
| 6222 | execute( TC_cs_initial_ul() ); |
| 6223 | execute( TC_cs_max_ul() ); |
Pau Espin Pedrol | 7512259 | 2020-11-03 15:22:59 +0100 | [diff] [blame] | 6224 | execute( TC_cs_initial_dl() ); |
Pau Espin Pedrol | 5d07ae6 | 2020-11-05 17:59:30 +0100 | [diff] [blame] | 6225 | execute( TC_cs_max_dl() ); |
| 6226 | execute( TC_dl_cs1_to_cs4() ); |
Pau Espin Pedrol | 2354d6a | 2020-11-05 18:36:59 +0100 | [diff] [blame] | 6227 | execute( TC_mcs_initial_ul() ); |
Pau Espin Pedrol | db15fa7 | 2020-11-11 12:58:34 +0100 | [diff] [blame] | 6228 | execute( TC_mcs_max_ul() ); |
Pau Espin Pedrol | e4fa45b | 2020-11-11 13:28:31 +0100 | [diff] [blame] | 6229 | execute( TC_mcs_initial_dl() ); |
Pau Espin Pedrol | 1b9aa78 | 2020-11-12 21:14:16 +0100 | [diff] [blame] | 6230 | execute( TC_mcs_max_dl() ); |
Pau Espin Pedrol | 1451f9f | 2021-05-11 11:52:37 +0200 | [diff] [blame] | 6231 | execute( TC_t3141() ); |
Pau Espin Pedrol | f30fa1d | 2021-03-03 19:55:11 +0100 | [diff] [blame] | 6232 | execute( TC_n3101_max_t3169() ); |
Pau Espin Pedrol | cc895df | 2021-04-20 12:58:32 +0200 | [diff] [blame] | 6233 | execute( TC_n3103_max_t3169() ); |
Pau Espin Pedrol | 84a8c3c | 2021-03-01 17:22:29 +0100 | [diff] [blame] | 6234 | execute( TC_x2031_t3191() ); |
| 6235 | execute( TC_zero_x2031_t3191() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6236 | execute( TC_t3193() ); |
Pau Espin Pedrol | 14ca7e3 | 2021-03-01 17:41:21 +0100 | [diff] [blame] | 6237 | execute( TC_n3105_max_t3195() ); |
Pau Espin Pedrol | 487d634 | 2020-05-14 19:22:33 +0200 | [diff] [blame] | 6238 | execute( TC_countdown_procedure() ); |
Pau Espin Pedrol | fb2301e | 2020-06-30 20:46:54 +0200 | [diff] [blame] | 6239 | execute( TC_ul_all_sizes() ); |
Pau Espin Pedrol | 5e6844d | 2020-07-01 17:24:02 +0200 | [diff] [blame] | 6240 | execute( TC_ul_data_toolong_fills_padding() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6241 | execute( TC_mo_ping_pong() ); |
| 6242 | execute( TC_mo_ping_pong_with_ul_racap() ); |
Pau Espin Pedrol | 0c0bf87 | 2020-05-14 15:50:49 +0200 | [diff] [blame] | 6243 | execute( TC_force_two_phase_access() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6244 | execute( TC_mt_ping_pong() ); |
| 6245 | execute( TC_mt_ping_pong_with_dl_racap() ); |
Pau Espin Pedrol | e1195bb | 2020-07-07 13:27:18 +0200 | [diff] [blame] | 6246 | execute( TC_ul_intermediate_retrans() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6247 | execute( TC_imm_ass_dl_block_retrans() ); |
Vadim Yanitskiy | 71238c1 | 2020-05-11 03:48:06 +0700 | [diff] [blame] | 6248 | execute( TC_dl_flow_more_blocks() ); |
Pau Espin Pedrol | e1195bb | 2020-07-07 13:27:18 +0200 | [diff] [blame] | 6249 | execute( TC_ul_flow_multiple_llc_blocks() ); |
Pau Espin Pedrol | 90fdfed | 2021-03-02 17:29:32 +0100 | [diff] [blame] | 6250 | execute( TC_dl_no_ack_retrans_imm_ass() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6251 | execute( TC_paging_cs_from_bts() ); |
| 6252 | execute( TC_paging_cs_from_sgsn_sign_ptmsi() ); |
| 6253 | execute( TC_paging_cs_from_sgsn_sign() ); |
| 6254 | execute( TC_paging_cs_from_sgsn_ptp() ); |
| 6255 | execute( TC_paging_ps_from_sgsn_sign_ptmsi() ); |
| 6256 | execute( TC_paging_ps_from_sgsn_sign() ); |
| 6257 | execute( TC_paging_ps_from_sgsn_ptp() ); |
Oliver Smith | e1a77c4 | 2021-07-28 13:36:09 +0200 | [diff] [blame] | 6258 | if (mp_osmo_pcu_newer_than_0_9_0) { |
| 6259 | execute( TC_paging_pch_timeout() ); |
| 6260 | } |
Vadim Yanitskiy | dbd4b24 | 2020-10-31 05:44:58 +0700 | [diff] [blame] | 6261 | execute( TC_paging_cs_multi_ms_imsi_tmsi() ); |
| 6262 | execute( TC_paging_cs_multi_ms_imsi() ); |
| 6263 | execute( TC_paging_cs_multi_ms_tmsi() ); |
Pau Espin Pedrol | c03eb12 | 2020-08-27 18:54:24 +0200 | [diff] [blame] | 6264 | execute( TC_bssgp_dl_unitdata_with_valid_imsi() ); |
| 6265 | execute( TC_bssgp_dl_unitdata_with_invalid_imsi() ); |
Pau Espin Pedrol | 2e459d6 | 2020-11-30 19:34:16 +0100 | [diff] [blame] | 6266 | execute( TC_dl_gprs_data_no_llc_ui_dummy() ); |
| 6267 | execute( TC_dl_egprs_data_no_llc_ui_dummy() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6268 | |
| 6269 | /* EGPRS specific test cases */ |
| 6270 | execute( TC_egprs_pkt_chan_req_signalling() ); |
| 6271 | execute( TC_egprs_pkt_chan_req_one_phase() ); |
| 6272 | execute( TC_egprs_pkt_chan_req_two_phase() ); |
Vadim Yanitskiy | 4f56d32 | 2020-05-22 20:15:48 +0700 | [diff] [blame] | 6273 | execute( TC_egprs_pkt_chan_req_reject_content() ); |
Vadim Yanitskiy | 7e06c25 | 2020-05-22 20:48:53 +0700 | [diff] [blame] | 6274 | execute( TC_egprs_pkt_chan_req_reject_emergency() ); |
Vadim Yanitskiy | c4324ff | 2020-05-22 21:53:58 +0700 | [diff] [blame] | 6275 | execute( TC_egprs_pkt_chan_req_reject_exhaustion() ); |
Pau Espin Pedrol | 42acafc | 2020-05-14 15:18:38 +0200 | [diff] [blame] | 6276 | |
| 6277 | execute( TC_mo_ping_pong_with_ul_racap_egprs_only() ); |
Vadim Yanitskiy | 94fe83e | 2020-07-20 04:03:13 +0700 | [diff] [blame] | 6278 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 6279 | /* Immediate Assignment on AGCH/PCH */ |
| 6280 | execute( TC_pcuif_fh_imm_ass_ul_egprs() ); |
| 6281 | execute( TC_pcuif_fh_imm_ass_ul() ); |
| 6282 | execute( TC_pcuif_fh_imm_ass_dl() ); |
| 6283 | /* Packet Uplink/Downlink Assignment on PACCH */ |
| 6284 | execute( TC_pcuif_fh_pkt_ass_ul() ); |
| 6285 | execute( TC_pcuif_fh_pkt_ass_dl() ); |
| 6286 | execute( TC_multitrx_multims_alloc() ); |
| 6287 | execute( TC_dl_multislot_tbf_ms_class_from_sgsn() ); |
| 6288 | execute( TC_dl_multislot_tbf_ms_class_from_2phase() ); |
| 6289 | execute( TC_ul_multislot_tbf_ms_class_from_2phase() ); |
Pau Espin Pedrol | 3760457 | 2021-10-15 14:36:16 +0200 | [diff] [blame] | 6290 | execute( TC_ul_tbf_reestablish_with_pkt_resource_req() ); |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 6291 | |
Pau Espin Pedrol | e130305 | 2020-11-16 11:13:51 +0100 | [diff] [blame] | 6292 | execute( TC_multiplex_dl_gprs_egprs() ); |
Vadim Yanitskiy | d53fb67 | 2020-10-09 16:41:02 +0700 | [diff] [blame] | 6293 | |
| 6294 | execute( TC_pcuif_info_ind_subsequent() ); |
Pau Espin Pedrol | 0637ba0 | 2021-01-22 18:36:12 +0100 | [diff] [blame] | 6295 | execute( TC_nacc_outbound_success() ); |
Pau Espin Pedrol | 2abbba9 | 2021-02-02 11:52:57 +0100 | [diff] [blame] | 6296 | execute( TC_nacc_outbound_success_no_ctrl_ack() ); |
Pau Espin Pedrol | 43be425 | 2021-01-27 16:40:54 +0100 | [diff] [blame] | 6297 | execute( TC_nacc_outbound_success_twice() ); |
Pau Espin Pedrol | 8536668 | 2021-01-27 19:04:54 +0100 | [diff] [blame] | 6298 | execute( TC_nacc_outbound_success_twice_nocache() ); |
Pau Espin Pedrol | 31e3064 | 2021-01-26 19:25:16 +0100 | [diff] [blame] | 6299 | execute( TC_nacc_outbound_rac_ci_resolve_timeout() ); |
Pau Espin Pedrol | 9076ee7 | 2021-01-26 19:38:26 +0100 | [diff] [blame] | 6300 | execute( TC_nacc_outbound_si_resolve_timeout() ); |
Pau Espin Pedrol | 6a71548 | 2021-02-10 18:40:46 +0100 | [diff] [blame] | 6301 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup() ); |
| 6302 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup2() ); |
Pau Espin Pedrol | 0d6ebb7 | 2021-02-11 14:53:24 +0100 | [diff] [blame] | 6303 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup3() ); |
| 6304 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup4() ); |
| 6305 | execute( TC_nacc_outbound_pkt_cell_chg_notif_dup5() ); |
Pau Espin Pedrol | d4ed360 | 2021-02-11 12:37:22 +0100 | [diff] [blame] | 6306 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice() ); |
| 6307 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice2() ); |
Pau Espin Pedrol | 179ddef | 2021-02-11 16:03:46 +0100 | [diff] [blame] | 6308 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice3() ); |
| 6309 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice4() ); |
| 6310 | execute( TC_nacc_outbound_pkt_cell_chg_notif_twice5() ); |
Pau Espin Pedrol | 1303577 | 2021-02-18 16:07:06 +0100 | [diff] [blame] | 6311 | execute( TC_nacc_outbound_pkt_cell_chg_notif_unassigned_dl_tbf() ); |
Pau Espin Pedrol | f28fd08 | 2021-09-07 20:02:25 +0200 | [diff] [blame] | 6312 | if (mp_ctrl_neigh_ip != "") { /* PCU using old CTRL neigh addr resolution iface */ |
| 6313 | execute( TC_nacc_outbound_rac_ci_resolve_conn_refused() ); |
| 6314 | execute( TC_nacc_outbound_rac_ci_resolve_fail_parse_response() ); |
| 6315 | } |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6316 | |
| 6317 | execute( TC_rim_ran_info_req_single_rep() ); |
Pau Espin Pedrol | 436e2bd | 2021-05-06 20:07:08 +0200 | [diff] [blame] | 6318 | execute( TC_rim_ran_info_req_single_rep_eutran() ); |
Philipp Maier | d55fe7e | 2021-02-01 17:23:40 +0100 | [diff] [blame] | 6319 | execute( TC_rim_ran_info_req_single_rep_no_si() ); |
Pau Espin Pedrol | 3aa61c6 | 2021-08-25 19:24:03 +0200 | [diff] [blame] | 6320 | |
| 6321 | execute (TC_pdch_energy_saving() ); |
Oliver Smith | 3d17488 | 2021-09-03 11:38:51 +0200 | [diff] [blame] | 6322 | |
| 6323 | execute( TC_stat_pdch_avail_occ() ); |
Oliver Smith | f04762d | 2021-09-14 17:20:38 +0200 | [diff] [blame] | 6324 | execute( TC_stat_pdch_avail_occ_ms_not_known_gprs() ); |
| 6325 | execute( TC_stat_pdch_avail_occ_ms_not_known_egprs() ); |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 6326 | } |
| 6327 | |
Harald Welte | a419df2 | 2019-03-21 17:23:04 +0100 | [diff] [blame] | 6328 | } |