Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1 | module BTS_Tests { |
| 2 | |
| 3 | import from General_Types all; |
| 4 | import from GSM_Types all; |
| 5 | import from GSM_RR_Types all; |
| 6 | import from Osmocom_Types all; |
| 7 | import from GSM_Types all; |
| 8 | import from GSM_RR_Types all; |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 9 | import from GSM_SystemInformation all; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 10 | import from L1CTL_PortType all; |
| 11 | import from L1CTL_Types all; |
| 12 | import from LAPDm_Types all; |
| 13 | import from Osmocom_CTRL_Adapter all; |
| 14 | |
| 15 | import from RSL_Types all; |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 16 | import from IPA_Types all; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 17 | import from IPA_Emulation all; |
| 18 | import from RSL_Emulation all; |
| 19 | |
| 20 | import from IPL4asp_Types all; |
| 21 | import from TRXC_Types all; |
| 22 | import from TRXC_CodecPort all; |
| 23 | import from TRXC_CodecPort_CtrlFunct all; |
| 24 | |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 25 | import from MobileL3_CommonIE_Types all; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 26 | import from MobileL3_RRM_Types all; |
| 27 | import from MobileL3_Types all; |
| 28 | import from L3_Templates all; |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 29 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 30 | /* The tests assume a BTS with the following timeslot configuration: |
| 31 | * TS0 : Combined CCCH + SDCCH/4 |
| 32 | * TS1 .. TS 4: TCH/F |
| 33 | * TS5 : TCH/H |
| 34 | * TS6 : SDCCH/8 |
| 35 | * TS7 : PDCH |
| 36 | */ |
| 37 | |
| 38 | modulepar { |
| 39 | charstring mp_rsl_ip := "127.0.0.2"; |
| 40 | integer mp_rsl_port := 3003; |
| 41 | integer mp_trx0_arfcn := 871; |
| 42 | integer mp_bb_trxc_port := 5704; |
| 43 | } |
| 44 | |
| 45 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 46 | /* IPA Emulation component underneath RSL */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 47 | var IPA_Emulation_CT vc_IPA; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 48 | /* RSL Emulation component (for ConnHdlr tests) */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 49 | var RSL_Emulation_CT vc_RSL; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 50 | /* Direct RSL_CCHAN_PT */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 51 | port RSL_CCHAN_PT RSL_CCHAN; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 52 | |
| 53 | /* L1CTL port (for classic tests) */ |
| 54 | port L1CTL_PT L1CTL; |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 55 | |
| 56 | /* SI configuration */ |
| 57 | var SystemInformationConfig si_cfg := { |
| 58 | bcch_extended := false, |
| 59 | si1_present := false, |
| 60 | si2bis_present := false, |
| 61 | si2ter_present := false, |
| 62 | si2quater_present := false, |
| 63 | si7_present := false, |
| 64 | si8_present := false, |
| 65 | si9_present := false, |
| 66 | si13_present := false, |
| 67 | si13alt_present := false, |
| 68 | si15_present := false, |
| 69 | si16_present := false, |
| 70 | si17_present := false, |
| 71 | si2n_present := false, |
| 72 | si21_present := false, |
| 73 | si22_present := false |
| 74 | }; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | /* an individual call / channel */ |
| 78 | type component ConnHdlr extends RSL_DchanHdlr { |
| 79 | port L1CTL_PT L1CTL; |
| 80 | |
| 81 | port TRXC_CODEC_PT BB_TRXC; |
| 82 | var integer g_bb_trxc_conn_id; |
| 83 | |
| 84 | timer g_Tguard; |
| 85 | timer g_Tmeas_exp := 2.0; /* >= 103 SACCH multiframe ~ 500ms */ |
| 86 | |
| 87 | var ConnHdlrPars g_pars; |
| 88 | var uint8_t g_next_meas_res_nr := 0; |
| 89 | } |
| 90 | |
| 91 | function f_init_rsl(charstring id) runs on test_CT { |
| 92 | vc_IPA := IPA_Emulation_CT.create(id & "-RSL-IPA"); |
| 93 | vc_RSL := RSL_Emulation_CT.create(id & "-RSL"); |
| 94 | |
| 95 | map(vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
| 96 | connect(vc_IPA:IPA_RSL_PORT, vc_RSL:IPA_PT); |
| 97 | connect(self:RSL_CCHAN, vc_RSL:CCHAN_PT); |
| 98 | |
| 99 | vc_IPA.start(IPA_Emulation.main_server(mp_rsl_ip, mp_rsl_port)); |
| 100 | vc_RSL.start(RSL_Emulation.main(false)); |
| 101 | } |
| 102 | |
| 103 | type record ConnHdlrPars { |
| 104 | RslChannelNr chan_nr, |
| 105 | RSL_IE_ChannelMode chan_mode, |
| 106 | float t_guard, |
| 107 | ConnL1Pars l1_pars |
| 108 | } |
| 109 | |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 110 | template (value) RachControlParameters ts_RachCtrl_default := { |
| 111 | max_retrans := RACH_MAX_RETRANS_1, |
| 112 | tx_integer := '0000'B, /* 3 slots */ |
| 113 | cell_barr_access := false, |
| 114 | re_not_allowed := true, |
| 115 | acc := '1111111111111111'B |
| 116 | }; |
| 117 | |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 118 | template (value) CellSelectionParameters ts_CellSelPar_default := { |
| 119 | cell_resel_hyst_2dB := 0, |
| 120 | ms_txpwr_max_cch := 0, |
| 121 | acs := '0'B, |
| 122 | neci := true, |
| 123 | rxlev_access_min := 0 |
| 124 | } |
| 125 | |
| 126 | template (value) LocationAreaIdentification ts_LAI_default := { |
| 127 | mcc_mnc := '262F42'H, |
| 128 | lac := 42 |
| 129 | } |
| 130 | |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 131 | /* Default SYSTEM INFORMATION 3 */ |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 132 | template (value) SystemInformation ts_SI3_default := { |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 133 | header := t_RrHeader(SYSTEM_INFORMATION_TYPE_3, 0), |
| 134 | payload := { |
| 135 | si3 := { |
| 136 | cell_id := 23, |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 137 | lai := ts_LAI_default, |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 138 | ctrl_chan_desc := { |
| 139 | msc_r99 := true, |
| 140 | att := true, |
| 141 | bs_ag_blks_res := 1, |
| 142 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 143 | si22ind := false, |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 144 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 145 | spare := '00'B, |
| 146 | bs_pa_mfrms := 0, /* 2 multiframes */ |
| 147 | t3212 := 1 /* 6 minutes */ |
| 148 | }, |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 149 | cell_options := { |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 150 | dn_ind := false, |
| 151 | pwrc := false, |
| 152 | dtx := MS_MAY_USE_UL_DTX, |
| 153 | radio_link_tout_div4 := 4/4 |
| 154 | }, |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 155 | cell_sel_par := ts_CellSelPar_default, |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 156 | rach_control := ts_RachCtrl_default, |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 157 | rest_octets := ''O |
| 158 | } |
| 159 | } |
| 160 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 161 | |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 162 | template (value) SystemInformation ts_SI2_default := { |
| 163 | header := t_RrHeader(SYSTEM_INFORMATION_TYPE_2, 0), |
| 164 | payload := { |
| 165 | si2 := { |
| 166 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 167 | ncc_permitted := '11111111'B, |
| 168 | rach_control := ts_RachCtrl_default |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | template (value) SystemInformation ts_SI4_default := { |
| 174 | header := t_RrHeader(SYSTEM_INFORMATION_TYPE_4, 0), |
| 175 | payload := { |
| 176 | si4 := { |
| 177 | lai := ts_LAI_default, |
| 178 | cell_sel_par := ts_CellSelPar_default, |
| 179 | rach_control := ts_RachCtrl_default, |
| 180 | cbch_chan_desc := omit, |
| 181 | cbch_mobile_alloc := omit, |
| 182 | rest_octets := ''O |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | function f_rsl_bcch_fill_raw(RSL_IE_SysinfoType rsl_si_type, octetstring si_enc) |
| 188 | runs on test_CT { |
| 189 | log("Setting ", rsl_si_type, ": ", si_enc); |
| 190 | RSL_CCHAN.send(ts_RSL_UD(ts_RSL_BCCH_INFO(rsl_si_type, si_enc))); |
| 191 | } |
| 192 | |
| 193 | function f_rsl_bcch_fill(RSL_IE_SysinfoType rsl_si_type, template (value) SystemInformation si_dec) |
| 194 | runs on test_CT { |
| 195 | var octetstring si_enc := enc_SystemInformation(valueof(si_dec)); |
| 196 | log("Setting ", rsl_si_type, ": ", si_dec); |
| 197 | f_rsl_bcch_fill_raw(rsl_si_type, si_enc); |
| 198 | } |
| 199 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 200 | /* global init function */ |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 201 | function f_init(charstring id := "BTS-Test") runs on test_CT { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 202 | f_init_rsl(id); |
| 203 | RSL_CCHAN.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP}); |
Harald Welte | 2d14259 | 2018-02-25 13:19:44 +0100 | [diff] [blame] | 204 | f_sleep(0.5); /* workaround for OS#3000 */ |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 205 | |
| 206 | /* Send SI3 to the BTS, it is needed for various computations */ |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 207 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_3, ts_SI3_default); |
| 208 | /* SI2 + SI4 are required for SI testing as they are mandatory defaults */ |
| 209 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_2, ts_SI2_default); |
| 210 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_4, ts_SI4_default); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 211 | } |
| 212 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 213 | /* Attach L1CTL to master test_CT (classic tests, non-handler mode) */ |
| 214 | function f_init_l1ctl() runs on test_CT { |
| 215 | map(self:L1CTL, system:L1CTL); |
| 216 | f_connect_reset(L1CTL); |
| 217 | } |
| 218 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 219 | type function void_fn(charstring id) runs on ConnHdlr; |
| 220 | |
| 221 | /* create a new test component */ |
| 222 | function f_start_handler(void_fn fn, ConnHdlrPars pars) |
| 223 | runs on test_CT return ConnHdlr { |
| 224 | var charstring id := testcasename(); |
| 225 | var ConnHdlr vc_conn; |
| 226 | |
| 227 | vc_conn := ConnHdlr.create(id); |
| 228 | /* connect to RSL Emulation main component */ |
| 229 | connect(vc_conn:RSL, vc_RSL:CLIENT_PT); |
| 230 | connect(vc_conn:RSL_PROC, vc_RSL:RSL_PROC); |
| 231 | |
| 232 | vc_conn.start(f_handler_init(fn, id, pars)); |
| 233 | return vc_conn; |
| 234 | } |
| 235 | |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 236 | template ASP_RSL_Unitdata ts_RSL_UD(template RSL_Message rsl, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) := { |
| 237 | streamId := sid, |
| 238 | rsl := rsl |
| 239 | } |
| 240 | |
| 241 | template ASP_RSL_Unitdata tr_RSL_UD(template RSL_Message rsl, |
| 242 | template IpaStreamId sid := IPAC_PROTO_RSL_TRX0) := { |
| 243 | streamId := sid, |
| 244 | rsl := rsl |
| 245 | } |
| 246 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 247 | private altstep as_Tguard() runs on ConnHdlr { |
| 248 | [] g_Tguard.timeout { |
| 249 | setverdict(fail, "Tguard timeout"); |
| 250 | self.stop; |
| 251 | } |
| 252 | } |
| 253 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 254 | private function f_l1_tune(L1CTL_PT L1CTL) { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 255 | f_L1CTL_FBSB(L1CTL, { false, mp_trx0_arfcn }, CCCH_MODE_COMBINED); |
| 256 | } |
| 257 | |
| 258 | private function f_trxc_connect() runs on ConnHdlr { |
| 259 | map(self:BB_TRXC, system:BB_TRXC); |
| 260 | var Result res; |
| 261 | res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(BB_TRXC, "127.0.0.1", mp_bb_trxc_port, |
| 262 | "127.0.0.1", 0, -1, {udp:={}}, {}); |
| 263 | g_bb_trxc_conn_id := res.connId; |
| 264 | } |
| 265 | |
| 266 | private function f_trxc_fake_rssi(uint8_t rssi) runs on ConnHdlr { |
| 267 | BB_TRXC.send(ts_TRXC_Send(g_bb_trxc_conn_id, ts_TRXC_FAKE_RSSI(rssi))); |
| 268 | } |
| 269 | |
| 270 | private function f_trx_fake_toffs256(int16_t toffs256) runs on ConnHdlr { |
| 271 | BB_TRXC.send(ts_TRXC_Send(g_bb_trxc_conn_id, ts_TRXC_FAKE_TIMING(toffs256))); |
| 272 | } |
| 273 | |
| 274 | /* first function started in ConnHdlr component */ |
| 275 | private function f_handler_init(void_fn fn, charstring id, ConnHdlrPars pars) |
| 276 | runs on ConnHdlr { |
| 277 | g_pars := pars; |
| 278 | g_chan_nr := pars.chan_nr; |
| 279 | |
| 280 | map(self:L1CTL, system:L1CTL); |
| 281 | f_connect_reset(L1CTL); |
| 282 | |
| 283 | f_trxc_connect(); |
| 284 | |
| 285 | g_Tguard.start(pars.t_guard); |
| 286 | activate(as_Tguard()); |
| 287 | |
| 288 | f_rslem_register(0, pars.chan_nr); |
| 289 | |
| 290 | /* call the user-supplied test case function */ |
| 291 | fn.apply(id); |
| 292 | } |
| 293 | |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 294 | function f_rsl_transceive(template RSL_Message tx, template RSL_Message exp_rx, charstring id) |
| 295 | runs on ConnHdlr { |
| 296 | timer T := 3.0; |
| 297 | RSL.send(tx); |
| 298 | T.start; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 299 | alt { |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 300 | [] RSL.receive(exp_rx) { |
| 301 | T.stop; |
| 302 | setverdict(pass); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 303 | } |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 304 | [] T.timeout { |
| 305 | setverdict(fail, "Timeout expecting " & id); |
| 306 | self.stop; |
| 307 | } |
| 308 | [] RSL.receive { |
| 309 | setverdict(fail, "Unexpected RSL message received"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 310 | } |
| 311 | } |
| 312 | } |
| 313 | |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 314 | function f_rsl_chan_act(RSL_IE_ChannelMode mode) runs on ConnHdlr { |
| 315 | f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, mode), tr_RSL_CHAN_ACT_ACK(g_chan_nr), |
| 316 | "RSL CHAN ACT"); |
| 317 | } |
| 318 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 319 | function f_rsl_chan_deact() runs on ConnHdlr { |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 320 | f_rsl_transceive(ts_RSL_RF_CHAN_REL(g_chan_nr), tr_RSL_RF_CHAN_REL_ACK(g_chan_nr), |
| 321 | "RF CHAN REL"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 322 | } |
| 323 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 324 | private template ConnHdlrPars t_Pars(template RslChannelNr chan_nr, |
| 325 | template RSL_IE_ChannelMode chan_mode, |
| 326 | float t_guard := 20.0) := { |
| 327 | chan_nr := valueof(chan_nr), |
| 328 | chan_mode := valueof(chan_mode), |
| 329 | t_guard := t_guard, |
| 330 | l1_pars := { |
| 331 | dtx_enabled := false, |
| 332 | meas_ul := { |
| 333 | full := { |
| 334 | rxlev := dbm2rxlev(-53), |
| 335 | rxqual := 0 |
| 336 | }, |
| 337 | sub := { |
| 338 | rxlev := dbm2rxlev(-53), |
| 339 | rxqual := 0 |
| 340 | } |
| 341 | }, |
| 342 | timing_offset_256syms := 0, |
| 343 | bs_power_level := 0, |
| 344 | ms_power_level := 0, |
| 345 | ms_actual_ta := 0 |
| 346 | } |
| 347 | } |
| 348 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 349 | /*********************************************************************** |
| 350 | * Channel Activation / Deactivation |
| 351 | ***********************************************************************/ |
| 352 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 353 | /* Stress test: Do 500 channel activations/deactivations in rapid succession */ |
| 354 | function f_TC_chan_act_stress(charstring id) runs on ConnHdlr { |
| 355 | for (var integer i := 0; i < 500; i := i+1) { |
| 356 | f_rsl_chan_act(g_pars.chan_mode); |
| 357 | f_rsl_chan_deact(); |
| 358 | } |
| 359 | setverdict(pass); |
| 360 | } |
| 361 | testcase TC_chan_act_stress() runs on test_CT { |
| 362 | var ConnHdlr vc_conn; |
| 363 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 364 | f_init(testcasename()); |
| 365 | vc_conn := f_start_handler(refers(f_TC_chan_act_stress), pars); |
| 366 | vc_conn.done; |
| 367 | } |
| 368 | |
| 369 | /* Test if re-activation of an already active channel fails as expected */ |
| 370 | function f_TC_chan_act_react(charstring id) runs on ConnHdlr { |
| 371 | f_rsl_chan_act(g_pars.chan_mode); |
| 372 | /* attempt to activate the same lchan again -> expect reject */ |
| 373 | RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode)); |
| 374 | alt { |
| 375 | [] RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)) { |
| 376 | setverdict(fail, "Unexpected CHAN ACT ACK on double activation"); |
| 377 | } |
| 378 | [] RSL.receive(tr_RSL_CHAN_ACT_NACK(g_chan_nr)) { |
| 379 | setverdict(pass); |
| 380 | } |
| 381 | } |
| 382 | f_rsl_chan_deact(); |
| 383 | } |
| 384 | testcase TC_chan_act_react() runs on test_CT { |
| 385 | var ConnHdlr vc_conn; |
| 386 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 387 | f_init(testcasename()); |
| 388 | vc_conn := f_start_handler(refers(f_TC_chan_act_react), pars); |
| 389 | vc_conn.done; |
| 390 | } |
| 391 | |
| 392 | /* Attempt to de-activate a channel that's not active */ |
| 393 | function f_TC_chan_deact_not_active(charstring id) runs on ConnHdlr { |
| 394 | timer T := 3.0; |
| 395 | RSL.send(ts_RSL_RF_CHAN_REL(g_chan_nr)); |
| 396 | T.start; |
| 397 | alt { |
| 398 | [] RSL.receive(tr_RSL_RF_CHAN_REL_ACK(g_chan_nr)) { |
| 399 | setverdict(pass); |
| 400 | } |
| 401 | [] T.timeout { |
| 402 | setverdict(fail, "Timeout expecting RF_CHAN_REL_ACK"); |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | testcase TC_chan_deact_not_active() runs on test_CT { |
| 407 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 408 | f_init(testcasename()); |
| 409 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_chan_deact_not_active), pars); |
| 410 | vc_conn.done; |
| 411 | } |
| 412 | |
| 413 | /* attempt to activate channel with wrong RSL Channel Nr IE; expect NACK */ |
| 414 | function f_TC_chan_act_wrong_nr(charstring id) runs on ConnHdlr { |
| 415 | RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode)); |
| 416 | alt { |
| 417 | [] RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)) { |
| 418 | setverdict(fail, "Unexpected CHAN ACT ACK"); |
| 419 | } |
| 420 | [] RSL.receive(tr_RSL_CHAN_ACT_NACK(g_chan_nr)) { |
| 421 | setverdict(pass); |
| 422 | } |
| 423 | } |
| 424 | } |
| 425 | private type record WrongChanNrCase { |
| 426 | RslChannelNr chan_nr, |
| 427 | charstring description |
| 428 | } |
| 429 | private type record of WrongChanNrCase WrongChanNrCases; |
| 430 | private template WrongChanNrCase t_WCN(template RslChannelNr chan_nr, charstring desc) := { |
| 431 | chan_nr := chan_nr, |
| 432 | description := desc |
| 433 | } |
| 434 | |
| 435 | testcase TC_chan_act_wrong_nr() runs on test_CT { |
| 436 | var ConnHdlr vc_conn; |
| 437 | var ConnHdlrPars pars; |
| 438 | |
| 439 | f_init(testcasename()); |
| 440 | |
| 441 | var WrongChanNrCases wrong := { |
| 442 | valueof(t_WCN(t_RslChanNr_RACH(0), "RACH is not a dedicated channel")), |
| 443 | valueof(t_WCN(t_RslChanNr_RACH(1), "RACH doesn't exist on timeslot")), |
| 444 | valueof(t_WCN(t_RslChanNr_BCCH(0), "BCCH is not a dedicated channel")), |
| 445 | valueof(t_WCN(t_RslChanNr_PCH_AGCH(0), "PCH/AGCH is not a dedicated channel")), |
| 446 | valueof(t_WCN(t_RslChanNr_Bm(0), "TS0 cannot be TCH/F")), |
| 447 | valueof(t_WCN(t_RslChanNr_Lm(0, 0), "TS0 cannot be TCH/H")), |
| 448 | valueof(t_WCN(t_RslChanNr_Lm(0, 1), "TS0 cannot be TCH/H")), |
| 449 | valueof(t_WCN(t_RslChanNr_PDCH(0), "TS0 cannot be PDCH")), |
| 450 | valueof(t_WCN(t_RslChanNr_SDCCH8(0, 0), "TS0 cannot be SDCCH/8")), |
| 451 | valueof(t_WCN(t_RslChanNr_SDCCH8(0, 7), "TS0 cannot be SDCCH/8")), |
| 452 | valueof(t_WCN(t_RslChanNr_SDCCH4(7, 0), "TS7 cannot be SDCCH/4")), |
| 453 | valueof(t_WCN(t_RslChanNr_SDCCH4(7, 3), "TS7 cannot be SDCCH/4")), |
| 454 | valueof(t_WCN(t_RslChanNr_Lm(1, 0), "TS1 cannot be TCH/H")) |
| 455 | }; |
| 456 | |
| 457 | for (var integer i := 0; i < sizeof(wrong); i := i+1) { |
| 458 | pars := valueof(t_Pars(wrong[i].chan_nr, ts_RSL_ChanMode_SIGN)); |
| 459 | vc_conn := f_start_handler(refers(f_TC_chan_act_wrong_nr), pars); |
| 460 | vc_conn.done; |
| 461 | } |
| 462 | } |
| 463 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 464 | /*********************************************************************** |
| 465 | * RACH Handling |
| 466 | ***********************************************************************/ |
| 467 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 468 | function f_TC_chan_req(charstring id) runs on ConnHdlr { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 469 | f_l1_tune(L1CTL); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 470 | |
| 471 | RSL.clear; |
| 472 | //L1.send(DCCH_establish_req:{ra := 23}); |
| 473 | /* This arrives on CCHAN, so we cannot test here */ |
| 474 | //RSL.receive(tr_RSL_CHAN_RQD(int2oct(23,1))); |
| 475 | } |
| 476 | testcase TC_chan_req() runs on test_CT { |
| 477 | var ConnHdlr vc_conn; |
| 478 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 479 | f_init(testcasename()); |
| 480 | vc_conn := f_start_handler(refers(f_TC_chan_req), pars); |
| 481 | vc_conn.done; |
| 482 | } |
| 483 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 484 | /*********************************************************************** |
| 485 | * Measurement Processing / Reporting |
| 486 | ***********************************************************************/ |
| 487 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 488 | template LapdmAddressField ts_LapdmAddr(LapdmSapi sapi, boolean c_r) := { |
| 489 | spare := '0'B, |
| 490 | lpd := 0, |
| 491 | sapi := sapi, |
| 492 | c_r := c_r, |
| 493 | ea := true |
| 494 | } |
| 495 | |
| 496 | template LapdmFrameB ts_LAPDm_B(LapdmSapi sapi, boolean c_r, boolean p, octetstring pl) := { |
| 497 | addr := ts_LapdmAddr(sapi, c_r), |
| 498 | ctrl := t_LapdmCtrlUI(p), |
| 499 | len := 0, /* overwritten */ |
| 500 | m := false, |
| 501 | el := 1, |
| 502 | payload := pl |
| 503 | } |
| 504 | |
| 505 | /* handle incoming downlink SACCH and respond with uplink SACCH (meas res) */ |
| 506 | altstep as_l1_sacch() runs on ConnHdlr { |
| 507 | var L1ctlDlMessage l1_dl; |
| 508 | [] L1CTL.receive(t_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
| 509 | log("SACCH received: ", l1_dl.payload.data_ind.payload); |
| 510 | var GsmRrL3Message meas_rep := valueof(ts_MEAS_REP(true, 23, 23, 0, 0, omit)); |
| 511 | var LapdmFrameB lb := valueof(ts_LAPDm_B(0, false, false, enc_GsmRrL3Message(meas_rep))); |
| 512 | log("LAPDm: ", lb); |
| 513 | var octetstring pl := '0000'O & enc_LapdmFrameB(lb); |
| 514 | L1CTL.send(t_L1CTL_DATA_REQ(g_chan_nr, ts_RslLinkID_SACCH(0), pl)); |
| 515 | repeat; |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | altstep as_l1_dcch() runs on ConnHdlr { |
| 520 | var L1ctlDlMessage l1_dl; |
| 521 | [] L1CTL.receive(t_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_DCCH(?))) -> value l1_dl { |
| 522 | log("DCCH received: ", l1_dl.payload.data_ind.payload); |
| 523 | var octetstring pl := '010301'O; |
| 524 | L1CTL.send(t_L1CTL_DATA_REQ(g_chan_nr, ts_RslLinkID_DCCH(0), pl)); |
| 525 | repeat; |
| 526 | } |
| 527 | } |
| 528 | |
| 529 | type record MeasElem { |
| 530 | uint6_t rxlev, |
| 531 | uint3_t rxqual |
| 532 | } |
| 533 | |
| 534 | type record MeasElemFS { |
| 535 | MeasElem full, |
| 536 | MeasElem sub |
| 537 | } |
| 538 | |
| 539 | type record ConnL1Pars { |
| 540 | boolean dtx_enabled, |
| 541 | MeasElemFS meas_ul, |
| 542 | int16_t timing_offset_256syms, |
| 543 | uint5_t bs_power_level, |
| 544 | uint5_t ms_power_level, |
| 545 | uint8_t ms_actual_ta |
| 546 | } |
| 547 | |
| 548 | /* Convert tiing offset from 1/256th symbol to RSL Timing Offset */ |
| 549 | private function toffs256s_to_rsl(int16_t toffs256s) return uint8_t { |
| 550 | return 63 + (toffs256s/256); |
| 551 | } |
| 552 | |
| 553 | /* build a template for matching measurement results against */ |
| 554 | private function f_build_meas_res_tmpl() runs on ConnHdlr return template RSL_Message { |
| 555 | var ConnL1Pars l1p := g_pars.l1_pars; |
| 556 | var template RSL_IE_UplinkMeas ul_meas := { |
| 557 | len := 3, |
| 558 | rfu := '0'B, |
| 559 | dtx_d := l1p.dtx_enabled, |
| 560 | rxlev_f_u := l1p.meas_ul.full.rxlev, |
| 561 | reserved1 := '00'B, |
| 562 | rxlev_s_u := l1p.meas_ul.sub.rxlev, |
| 563 | reserved2 := '00'B, |
| 564 | rxq_f_u := l1p.meas_ul.full.rxqual, |
| 565 | rxq_s_u := l1p.meas_ul.sub.rxqual, |
| 566 | supp_meas_info := omit |
| 567 | }; |
| 568 | /* HACK HACK HACK FIXME HACK HACK HACK see https://osmocom.org/issues/2988 */ |
| 569 | ul_meas.rxlev_f_u := ?; |
| 570 | ul_meas.rxlev_s_u := ?; |
| 571 | ul_meas.rxq_f_u := ?; |
| 572 | ul_meas.rxq_s_u := ?; |
| 573 | var template RSL_IE_BS_Power bs_power := { |
| 574 | reserved := 0, |
| 575 | epc := false, |
| 576 | fpc := false, |
| 577 | power_level := l1p.bs_power_level |
| 578 | }; |
| 579 | var template RSL_IE_L1Info l1_info := { |
| 580 | ms_power_lvl := l1p.ms_power_level, |
| 581 | fpc := false, |
| 582 | reserved := 0, |
| 583 | actual_ta := l1p.ms_actual_ta |
| 584 | }; |
| 585 | var uint8_t offs := toffs256s_to_rsl(l1p.timing_offset_256syms); |
| 586 | var template uint8_t t_toffs := (offs-1 .. offs+1); /* some tolerance */ |
| 587 | return tr_RSL_MEAS_RES_OSMO(g_chan_nr, g_next_meas_res_nr, ul_meas, bs_power, l1_info, |
| 588 | ?, t_toffs); |
| 589 | } |
| 590 | |
| 591 | /* verify we regularly receive measurement reports with incrementing numbers */ |
| 592 | altstep as_meas_res() runs on ConnHdlr { |
| 593 | var RSL_Message rsl; |
| 594 | [] RSL.receive(f_build_meas_res_tmpl()) -> value rsl { |
| 595 | /* increment counter of next to-be-expected meas rep */ |
| 596 | g_next_meas_res_nr := (g_next_meas_res_nr + 1) mod 256; |
| 597 | /* Re-start the timer expecting the next MEAS RES */ |
| 598 | g_Tmeas_exp.start; |
| 599 | repeat; |
| 600 | } |
| 601 | [] RSL.receive(tr_RSL_MEAS_RES(g_chan_nr, g_next_meas_res_nr)) -> value rsl { |
| 602 | setverdict(fail, "Received unspecific MEAS RES ", rsl); |
| 603 | self.stop; |
| 604 | } |
| 605 | [] RSL.receive(tr_RSL_MEAS_RES(?)) -> value rsl { |
| 606 | setverdict(fail, "Received unexpected MEAS RES ", rsl); |
| 607 | self.stop; |
| 608 | } |
| 609 | [] g_Tmeas_exp.timeout { |
| 610 | setverdict(fail, "Didn't receive expected measurement result") |
| 611 | self.stop; |
| 612 | } |
| 613 | } |
| 614 | |
| 615 | /* Establish dedicated channel: L1CTL + RSL side */ |
| 616 | private function f_est_dchan() runs on ConnHdlr { |
| 617 | var GsmFrameNumber fn; |
| 618 | var ImmediateAssignment imm_ass; |
| 619 | var integer ra := 23; |
| 620 | |
| 621 | fn := f_L1CTL_RACH(L1CTL, ra); |
| 622 | /* This arrives on CCHAN, so we cannot test for receiving CHAN RQDhere */ |
| 623 | //RSL.receive(tr_RSL_CHAN_RQD(int2oct(23,1))); |
| 624 | |
| 625 | /* Activate channel on BTS side */ |
| 626 | f_rsl_chan_act(g_pars.chan_mode); |
| 627 | |
| 628 | /* Send IMM.ASS via CCHAN */ |
| 629 | var ChannelDescription ch_desc := { |
| 630 | chan_nr := g_pars.chan_nr, |
| 631 | tsc := 7, |
| 632 | h := false, |
| 633 | arfcn := mp_trx0_arfcn, |
| 634 | maio_hsn := omit |
| 635 | }; |
| 636 | var MobileAllocation ma := { |
| 637 | len := 0, |
| 638 | ma := ''B |
| 639 | }; |
| 640 | var GsmRrMessage rr_msg := valueof(ts_IMM_ASS(ra, fn, 0, ch_desc, ma)); |
| 641 | RSL.send(ts_RSL_IMM_ASSIGN(enc_GsmRrMessage(rr_msg))); |
| 642 | |
| 643 | /* receive IMM.ASS on MS side */ |
| 644 | var ImmediateAssignment ia_um; |
| 645 | ia_um := f_L1CTL_WAIT_IMM_ASS(L1CTL, ra, fn); |
| 646 | /* enable dedicated mode */ |
| 647 | f_L1CTL_DM_EST_REQ_IA(L1CTL, ia_um); |
| 648 | } |
| 649 | |
| 650 | /* establish DChan, verify existance + contents of measurement reports */ |
| 651 | function f_TC_meas_res_periodic(charstring id) runs on ConnHdlr { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 652 | f_l1_tune(L1CTL); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 653 | RSL.clear; |
| 654 | |
| 655 | g_pars.l1_pars.meas_ul.full.rxlev := dbm2rxlev(-100); |
| 656 | g_pars.l1_pars.meas_ul.sub.rxlev := g_pars.l1_pars.meas_ul.full.rxlev; |
| 657 | f_trxc_fake_rssi(100); |
| 658 | |
| 659 | g_pars.l1_pars.timing_offset_256syms := 512; /* 2 symbols */ |
| 660 | f_trx_fake_toffs256(g_pars.l1_pars.timing_offset_256syms); |
| 661 | |
| 662 | f_est_dchan(); |
| 663 | |
| 664 | /* run for a number of seconds, send SACCH + FACCH from MS side and verify |
| 665 | * RSL measurement reports on Abis side */ |
| 666 | timer T := 8.0; |
| 667 | T.start; |
| 668 | alt { |
| 669 | [] as_l1_sacch(); |
| 670 | [] as_meas_res(); |
| 671 | [] as_l1_dcch(); |
| 672 | [] L1CTL.receive { repeat; } |
| 673 | [g_Tmeas_exp.running] T.timeout { |
| 674 | /* as_meas_res() would have done setverdict(fail) / self.stop in case |
| 675 | * of any earlier errors, so if we reach this timeout, we're good */ |
| 676 | setverdict(pass); |
| 677 | } |
| 678 | [] T.timeout { |
| 679 | setverdict(fail, "No MEAS RES received at all"); |
| 680 | } |
| 681 | } |
| 682 | f_rsl_chan_deact(); |
| 683 | } |
| 684 | testcase TC_meas_res_sign_tchf() runs on test_CT { |
| 685 | var ConnHdlr vc_conn; |
| 686 | var ConnHdlrPars pars; |
| 687 | f_init(testcasename()); |
| 688 | for (var integer tn := 1; tn <= 4; tn := tn+1) { |
| 689 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 690 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars); |
| 691 | vc_conn.done; |
| 692 | } |
| 693 | } |
| 694 | testcase TC_meas_res_sign_tchh() runs on test_CT { |
| 695 | var ConnHdlr vc_conn; |
| 696 | var ConnHdlrPars pars; |
| 697 | f_init(testcasename()); |
| 698 | for (var integer ss := 0; ss <= 1; ss := ss+1) { |
| 699 | pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), ts_RSL_ChanMode_SIGN)); |
| 700 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars); |
| 701 | vc_conn.done; |
| 702 | } |
| 703 | } |
| 704 | testcase TC_meas_res_sign_sdcch4() runs on test_CT { |
| 705 | var ConnHdlr vc_conn; |
| 706 | var ConnHdlrPars pars; |
| 707 | f_init(testcasename()); |
| 708 | for (var integer ss := 0; ss <= 3; ss := ss+1) { |
| 709 | pars := valueof(t_Pars(t_RslChanNr_SDCCH4(0, ss), ts_RSL_ChanMode_SIGN)); |
| 710 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars); |
| 711 | vc_conn.done; |
| 712 | } |
| 713 | } |
| 714 | testcase TC_meas_res_sign_sdcch8() runs on test_CT { |
| 715 | var ConnHdlr vc_conn; |
| 716 | var ConnHdlrPars pars; |
| 717 | f_init(testcasename()); |
| 718 | for (var integer ss := 0; ss <= 7; ss := ss+1) { |
| 719 | pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6, ss), ts_RSL_ChanMode_SIGN)); |
| 720 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars); |
| 721 | vc_conn.done; |
| 722 | } |
| 723 | } |
| 724 | |
| 725 | /* Test if a channel without valid uplink bursts generates RSL CONN FAIL IND */ |
| 726 | private function f_TC_conn_fail_crit(charstring id) runs on ConnHdlr { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 727 | f_l1_tune(L1CTL); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 728 | RSL.clear; |
| 729 | |
| 730 | f_est_dchan(); |
| 731 | f_sleep(2.0); |
| 732 | L1CTL.send(t_L1CTL_DM_REL_REQ(g_chan_nr)); |
| 733 | |
| 734 | timer T := 40.0; |
| 735 | T.start; |
| 736 | alt { |
| 737 | [] RSL.receive(tr_RSL_CONN_FAIL_IND(g_chan_nr, ?)) { |
| 738 | setverdict(pass) |
| 739 | } |
| 740 | [] RSL.receive { repeat }; |
| 741 | [] T.timeout { |
| 742 | setverdict(fail, "No CONN FAIL IND received"); |
| 743 | } |
| 744 | } |
| 745 | f_rsl_chan_deact(); |
| 746 | } |
| 747 | testcase TC_conn_fail_crit() runs on test_CT { |
| 748 | var ConnHdlr vc_conn; |
| 749 | var ConnHdlrPars pars; |
| 750 | f_init(testcasename()); |
| 751 | pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6, 3), ts_RSL_ChanMode_SIGN)); |
| 752 | pars.t_guard := 60.0; |
| 753 | vc_conn := f_start_handler(refers(f_TC_conn_fail_crit), pars); |
| 754 | vc_conn.done; |
| 755 | } |
| 756 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 757 | /*********************************************************************** |
| 758 | * Paging |
| 759 | ***********************************************************************/ |
| 760 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 761 | function tmsi_is_dummy(TMSIP_TMSI_V tmsi) return boolean { |
| 762 | if (tmsi == 'FFFFFFFF'O) { |
| 763 | return true; |
| 764 | } else { |
| 765 | return false; |
| 766 | } |
| 767 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 768 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 769 | altstep as_l1_count_paging(inout integer num_paging_rcv_msgs, inout integer num_paging_rcv_ids) |
| 770 | runs on test_CT { |
| 771 | var L1ctlDlMessage dl; |
| 772 | [] L1CTL.receive(t_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?, c_DummyUI)) { |
| 773 | repeat; |
| 774 | } |
| 775 | [] L1CTL.receive(t_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0))) -> value dl { |
| 776 | var octetstring without_plen := |
| 777 | substr(dl.payload.data_ind.payload, 1, lengthof(dl.payload.data_ind.payload)-1); |
| 778 | var PDU_ML3_NW_MS rr := dec_PDU_ML3_NW_MS(without_plen); |
| 779 | if (match(rr, tr_PAGING_REQ1)) { |
| 780 | num_paging_rcv_msgs := num_paging_rcv_msgs + 1; |
| 781 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 782 | if (isvalue(rr.msgs.rrm.pagingReq_Type1.mobileIdentity2)) { |
| 783 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 784 | } |
| 785 | } else if (match(rr, tr_PAGING_REQ2)) { |
| 786 | num_paging_rcv_msgs := num_paging_rcv_msgs + 1; |
| 787 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type2.mobileIdentity1)) { |
| 788 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 789 | } |
| 790 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type2.mobileIdentity2)) { |
| 791 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 792 | } |
| 793 | if (isvalue(rr.msgs.rrm.pagingReq_Type2.mobileIdentity3)) { |
| 794 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 795 | } |
| 796 | } else if (match(rr, tr_PAGING_REQ3)) { |
| 797 | num_paging_rcv_msgs := num_paging_rcv_msgs + 1; |
| 798 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity1)) { |
| 799 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 800 | } |
| 801 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity2)) { |
| 802 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 803 | } |
| 804 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity3)) { |
| 805 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 806 | } |
| 807 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity4)) { |
| 808 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 809 | } |
| 810 | } |
| 811 | repeat; |
| 812 | } |
| 813 | } |
| 814 | |
| 815 | type record PagingTestCfg { |
| 816 | boolean combined_ccch, |
| 817 | integer bs_ag_blks_res, |
| 818 | float load_factor, |
| 819 | boolean exp_load_ind, |
| 820 | boolean exp_overload, |
| 821 | boolean use_tmsi |
| 822 | } |
| 823 | |
| 824 | type record PagingTestState { |
| 825 | integer num_paging_sent, |
| 826 | integer num_paging_rcv_msgs, |
| 827 | integer num_paging_rcv_ids, |
| 828 | integer num_overload |
| 829 | } |
| 830 | |
| 831 | /* receive + ignore RSL RF RES IND */ |
| 832 | altstep as_rsl_res_ind() runs on test_CT { |
| 833 | [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_RF_RES_IND)) { |
| 834 | repeat; |
| 835 | } |
| 836 | } |
| 837 | |
| 838 | /* Helper function for paging related testing */ |
| 839 | private function f_TC_paging(PagingTestCfg cfg) runs on test_CT return PagingTestState { |
| 840 | f_init(testcasename()); |
| 841 | f_init_l1ctl(); |
| 842 | f_l1_tune(L1CTL); |
| 843 | |
| 844 | var PagingTestState st := { |
| 845 | num_paging_sent := 0, |
| 846 | num_paging_rcv_msgs := 0, |
| 847 | num_paging_rcv_ids := 0, |
| 848 | num_overload := 0 |
| 849 | }; |
| 850 | |
| 851 | var float max_pch_blocks_per_sec := f_pch_block_rate_est(cfg.combined_ccch, cfg.bs_ag_blks_res); |
| 852 | var float max_pch_imsi_per_sec; |
| 853 | if (cfg.use_tmsi) { |
| 854 | max_pch_imsi_per_sec := max_pch_blocks_per_sec * 4.0; /* Type 3 */ |
| 855 | } else { |
| 856 | max_pch_imsi_per_sec := max_pch_blocks_per_sec * 2.0; /* Type 1 */ |
| 857 | } |
| 858 | var float pch_blocks_per_sec := max_pch_imsi_per_sec * cfg.load_factor; |
| 859 | var float interval := 1.0 / pch_blocks_per_sec; |
| 860 | log("pch_blocks_per_sec=", pch_blocks_per_sec, " interval=", interval); |
| 861 | |
| 862 | for (var integer i := 0; i < float2int(20.0/interval); i := i+1) { |
| 863 | /* build mobile Identity */ |
| 864 | var MobileL3_CommonIE_Types.MobileIdentityLV mi; |
| 865 | if (cfg.use_tmsi) { |
| 866 | mi := valueof(ts_MI_TMSI_LV(f_rnd_octstring(4))); |
| 867 | } else { |
| 868 | mi := valueof(ts_MI_IMSI_LV(f_gen_imsi(i))); |
| 869 | } |
| 870 | var octetstring mi_enc_lv := enc_MobileIdentityLV(mi); |
| 871 | var octetstring mi_enc := substr(mi_enc_lv, 1, lengthof(mi_enc_lv)-1); |
| 872 | |
| 873 | /* Send RSL PAGING COMMAND */ |
| 874 | RSL_CCHAN.send(ts_RSL_UD(ts_RSL_PAGING_CMD(mi_enc, i mod 4))); |
| 875 | st.num_paging_sent := st.num_paging_sent + 1; |
| 876 | |
| 877 | /* Wait for interval to next PAGING COMMAND */ |
| 878 | timer T_itv := interval; |
| 879 | T_itv.start; |
| 880 | alt { |
| 881 | /* check for presence of CCCH LOAD IND (paging load) */ |
| 882 | [cfg.exp_overload] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND(0))) { |
| 883 | st.num_overload := st.num_overload + 1; |
| 884 | repeat; |
| 885 | } |
| 886 | [not cfg.exp_overload] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND(0))) { |
| 887 | setverdict(fail, "Unexpected PCH Overload"); |
| 888 | } |
| 889 | [cfg.exp_load_ind] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND)) { |
| 890 | log("Rx LOAD_IND"); |
| 891 | /* FIXME: analyze/verify interval + contents */ |
| 892 | repeat; |
| 893 | } |
| 894 | /* check if paging requests arrive on Um side */ |
| 895 | [] as_l1_count_paging(st.num_paging_rcv_msgs, st.num_paging_rcv_ids); |
| 896 | [] L1CTL.receive { repeat; } |
| 897 | [] T_itv.timeout { } |
| 898 | [] as_rsl_res_ind(); |
| 899 | } |
| 900 | } |
| 901 | |
| 902 | /* wait for max 18s for paging queue to drain (size: 200, ~ 13 per s -> 15s) */ |
| 903 | timer T_wait := 18.0; |
| 904 | T_wait.start; |
| 905 | alt { |
| 906 | [] as_l1_count_paging(st.num_paging_rcv_msgs, st.num_paging_rcv_ids); |
| 907 | [] L1CTL.receive { repeat; } |
| 908 | /* 65535 == empty paging queue, we can terminate*/ |
| 909 | [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND(65535))) { } |
| 910 | [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND)) { repeat; } |
| 911 | [] T_wait.timeout { |
| 912 | setverdict(fail, "Waiting for empty paging queue"); |
| 913 | } |
| 914 | [] as_rsl_res_ind(); |
| 915 | } |
| 916 | |
| 917 | log("num_paging_sent=", st.num_paging_sent, " rcvd_msgs=", st.num_paging_rcv_msgs, |
| 918 | " rcvd_ids=", st.num_paging_rcv_ids); |
| 919 | return st; |
| 920 | } |
| 921 | |
| 922 | /* Create ~ 80% paging load (IMSI only) sustained for about 20s, verifying that |
| 923 | * - the number of Mobile Identities on Um PCH match the number of pages on RSL |
| 924 | * - that CCCH LOAD IND (PCH) are being generated |
| 925 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 926 | testcase TC_paging_imsi_80percent() runs on test_CT { |
| 927 | var PagingTestCfg cfg := { |
| 928 | combined_ccch := true, |
| 929 | bs_ag_blks_res := 1, |
| 930 | load_factor := 0.8, |
| 931 | exp_load_ind := true, |
| 932 | exp_overload := false, |
| 933 | use_tmsi := false |
| 934 | }; |
| 935 | var PagingTestState st := f_TC_paging(cfg); |
| 936 | if (st.num_paging_sent != st.num_paging_rcv_ids) { |
| 937 | setverdict(fail, "Expected ", st.num_paging_sent, " pagings but have ", |
| 938 | st.num_paging_rcv_ids); |
| 939 | } else { |
| 940 | setverdict(pass); |
| 941 | } |
| 942 | } |
| 943 | |
| 944 | /* Create ~ 80% paging load (TMSI only) sustained for about 20s, verifying that |
| 945 | * - the number of Mobile Identities on Um PCH match the number of pages on RSL |
| 946 | * - that CCCH LOAD IND (PCH) are being generated |
| 947 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 948 | testcase TC_paging_tmsi_80percent() runs on test_CT { |
| 949 | var PagingTestCfg cfg := { |
| 950 | combined_ccch := true, |
| 951 | bs_ag_blks_res := 1, |
| 952 | load_factor := 0.8, |
| 953 | exp_load_ind := true, |
| 954 | exp_overload := false, |
| 955 | use_tmsi := true |
| 956 | }; |
| 957 | var PagingTestState st := f_TC_paging(cfg); |
| 958 | if (st.num_paging_sent != st.num_paging_rcv_ids) { |
| 959 | setverdict(fail, "Expected ", st.num_paging_sent, " pagings but have ", |
| 960 | st.num_paging_rcv_ids); |
| 961 | } else { |
| 962 | setverdict(pass); |
| 963 | } |
| 964 | } |
| 965 | |
| 966 | /* Create ~ 200% paging load (IMSI only) sustained for about 20s, verifying that |
| 967 | * - the number of Mobile Identities on Um PCH are ~ 82% of the number of pages on RSL |
| 968 | * - that CCCH LOAD IND (PCH) are being generated and reach 0 at some point |
| 969 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 970 | testcase TC_paging_imsi_200percent() runs on test_CT { |
| 971 | var PagingTestCfg cfg := { |
| 972 | combined_ccch := true, |
| 973 | bs_ag_blks_res := 1, |
| 974 | load_factor := 2.0, |
| 975 | exp_load_ind := true, |
| 976 | exp_overload := true, |
| 977 | use_tmsi := false |
| 978 | }; |
| 979 | var PagingTestState st := f_TC_paging(cfg); |
| 980 | /* We expect about 80-85% to pass, given that we can fill the paging buffer of 200 |
| 981 | * slots and will fully drain that buffer before returning */ |
| 982 | var template integer tpl := (st.num_paging_sent*80/100 .. st.num_paging_sent *85/100); |
| 983 | if (not match(st.num_paging_rcv_ids, tpl)) { |
| 984 | setverdict(fail, "Expected ", tpl, " pagings but have ", st.num_paging_rcv_ids); |
| 985 | } else { |
| 986 | setverdict(pass); |
| 987 | } |
| 988 | } |
| 989 | |
| 990 | /* Create ~ 200% paging load (TMSI only) sustained for about 20s, verifying that |
| 991 | * - the number of Mobile Identities on Um PCH are ~ 82% of the number of pages on RSL |
| 992 | * - that CCCH LOAD IND (PCH) are being generated and reach 0 at some point |
| 993 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 994 | testcase TC_paging_tmsi_200percent() runs on test_CT { |
| 995 | var PagingTestCfg cfg := { |
| 996 | combined_ccch := true, |
| 997 | bs_ag_blks_res := 1, |
| 998 | load_factor := 2.0, |
| 999 | exp_load_ind := true, |
| 1000 | exp_overload := true, |
| 1001 | use_tmsi := true |
| 1002 | }; |
| 1003 | var PagingTestState st := f_TC_paging(cfg); |
| 1004 | /* We expect about 70% to pass, given that we can fill the paging buffer of 200 |
| 1005 | * slots and will fully drain that buffer before returning */ |
| 1006 | var template integer tpl := (st.num_paging_sent*68/100 .. st.num_paging_sent *72/100); |
| 1007 | if (not match(st.num_paging_rcv_ids, tpl)) { |
| 1008 | setverdict(fail, "Expected ", tpl, " pagings but have ", st.num_paging_rcv_ids); |
| 1009 | } else { |
| 1010 | setverdict(pass); |
| 1011 | } |
| 1012 | } |
| 1013 | |
| 1014 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 1015 | /*********************************************************************** |
| 1016 | * Immediate Assignment / AGCH |
| 1017 | ***********************************************************************/ |
| 1018 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1019 | testcase TC_imm_ass() runs on test_CT { |
| 1020 | f_init(testcasename()); |
| 1021 | for (var integer i := 0; i < 1000; i := i+1) { |
| 1022 | var octetstring ia_enc := f_rnd_octstring(8); |
| 1023 | RSL_CCHAN.send(ts_RSL_UD(ts_RSL_IMM_ASSIGN(ia_enc, 0))); |
| 1024 | f_sleep(0.02); |
| 1025 | } |
| 1026 | /* FIXME: check if imm.ass arrive on Um side */ |
| 1027 | /* FIXME: check for DELETE INDICATION */ |
| 1028 | f_sleep(100.0); |
| 1029 | } |
| 1030 | |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 1031 | /*********************************************************************** |
| 1032 | * BCCH |
| 1033 | ***********************************************************************/ |
| 1034 | |
| 1035 | /* tuple of Frame Number + decoded SI */ |
| 1036 | type record SystemInformationFn { |
| 1037 | GsmFrameNumber frame_number, |
| 1038 | SystemInformation si |
| 1039 | } |
| 1040 | |
| 1041 | /* an arbitrary-length vector of decoded SI + gsmtap header */ |
| 1042 | type record of SystemInformationFn SystemInformationVector; |
| 1043 | |
| 1044 | /* an array of SI-vectors indexed by TC value */ |
| 1045 | type SystemInformationVector SystemInformationVectorPerTc[8]; |
| 1046 | |
| 1047 | /* determine if a given SI vector contains given SI type at least once */ |
| 1048 | function f_si_vecslot_contains(SystemInformationVector arr, RrMessageType key, boolean bcch_ext := false) return boolean { |
| 1049 | for (var integer i:= 0; i< sizeof(arr); i := i + 1) { |
| 1050 | var integer fn_mod51 := arr[i].frame_number mod 51; |
| 1051 | if (not bcch_ext and fn_mod51 == 2 or |
| 1052 | bcch_ext and fn_mod51 == 6) { |
| 1053 | if (arr[i].si.header.message_type == key) { |
| 1054 | return true; |
| 1055 | } |
| 1056 | } |
| 1057 | } |
| 1058 | return false; |
| 1059 | } |
| 1060 | |
| 1061 | /* ensure a given TC slot of the SI vector contains given SI type at least once at TC */ |
| 1062 | function f_ensure_si_vec_contains(SystemInformationVectorPerTc arr, integer tc, RrMessageType key, boolean ext_bcch := false) { |
| 1063 | if (not f_si_vecslot_contains(arr[tc], key, ext_bcch)) { |
| 1064 | setverdict(fail, "No ", key, " in TC=", tc, "!"); |
| 1065 | } |
| 1066 | } |
| 1067 | |
| 1068 | /* check if a given SI vector contains given SI type at least once on any TC */ |
| 1069 | function f_si_vec_contains(SystemInformationVectorPerTc arr, RrMessageType key) return boolean { |
| 1070 | for (var integer tc:= 0; tc < sizeof(arr); tc := tc + 1) { |
| 1071 | if (f_si_vecslot_contains(arr[tc], key) or |
| 1072 | f_si_vecslot_contains(arr[tc], key, true)) { |
| 1073 | return true; |
| 1074 | } |
| 1075 | } |
| 1076 | return false; |
| 1077 | } |
| 1078 | |
| 1079 | /* determine if a given SI vector contains given SI type at least N of M times */ |
| 1080 | function f_si_vecslot_contains_n_of_m(SystemInformationVector arr, RrMessageType key, boolean bcch_ext := false, integer n := 1, integer m := 4) return boolean { |
| 1081 | var integer count := 0; |
| 1082 | if (sizeof(arr) < m) { |
| 1083 | setverdict(fail, "Error: Insufficient SI in array"); |
| 1084 | self.stop; |
| 1085 | } |
| 1086 | for (var integer i:= 0; i < m; i := i + 1) { |
| 1087 | var integer fn_mod51 := arr[i].frame_number mod 51; |
| 1088 | if (not bcch_ext and fn_mod51 == 2 or |
| 1089 | bcch_ext and fn_mod51 == 6) { |
| 1090 | if (arr[i].si.header.message_type == key) { |
| 1091 | count := count + 1; |
| 1092 | } |
| 1093 | } |
| 1094 | } |
| 1095 | if (count >= n) { |
| 1096 | return true; |
| 1097 | } else { |
| 1098 | return false; |
| 1099 | } |
| 1100 | } |
| 1101 | |
| 1102 | /* ensure a given TC slot of the SI vector contains given SI type at least N out of M times at TC */ |
| 1103 | function f_ensure_si_vec_contains_n_of_m(SystemInformationVectorPerTc arr, integer tc, RrMessageType key, boolean ext_bcch := false, integer n, integer m) { |
| 1104 | if (not f_si_vecslot_contains_n_of_m(arr[tc], key, ext_bcch, n, m)) { |
| 1105 | setverdict(fail, "Not ", n, "/", m, " of ", key, " in TC=", tc, "!"); |
| 1106 | } |
| 1107 | } |
| 1108 | |
| 1109 | /* determine if a given SI vector contains given SI type at least once */ |
| 1110 | function f_si_vecslot_contains_only(SystemInformationVector arr, RrMessageType key, boolean bcch_ext := false) return boolean { |
| 1111 | for (var integer i:= 0; i< sizeof(arr); i := i + 1) { |
| 1112 | var integer fn_mod51 := arr[i].frame_number mod 51; |
| 1113 | if (not bcch_ext and fn_mod51 == 2 or |
| 1114 | bcch_ext and fn_mod51 == 6) { |
| 1115 | if (arr[i].si.header.message_type != key) { |
| 1116 | return false; |
| 1117 | } |
| 1118 | } |
| 1119 | } |
| 1120 | return true; |
| 1121 | } |
| 1122 | |
| 1123 | /* ensure a given TC slot of the SI vector contains only given SI type */ |
| 1124 | function f_ensure_si_vec_contains_only(SystemInformationVectorPerTc arr, integer tc, RrMessageType key, boolean ext_bcch := false) { |
| 1125 | if (not f_si_vecslot_contains_only(arr[tc], key, ext_bcch)) { |
| 1126 | setverdict(fail, "Not all ", key, " in TC=", tc, "!"); |
| 1127 | } |
| 1128 | } |
| 1129 | |
| 1130 | /* SI configuration of cell, against which we validate actual SI messages */ |
| 1131 | type set SystemInformationConfig { |
| 1132 | boolean bcch_extended, |
| 1133 | boolean si1_present, |
| 1134 | boolean si2bis_present, |
| 1135 | boolean si2ter_present, |
| 1136 | boolean si2quater_present, |
| 1137 | boolean si7_present, |
| 1138 | boolean si8_present, |
| 1139 | boolean si9_present, |
| 1140 | boolean si13_present, |
| 1141 | boolean si13alt_present, |
| 1142 | boolean si15_present, |
| 1143 | boolean si16_present, |
| 1144 | boolean si17_present, |
| 1145 | boolean si2n_present, |
| 1146 | boolean si21_present, |
| 1147 | boolean si22_present |
| 1148 | } |
| 1149 | |
| 1150 | /* validate the SI scheduling according to TS 45.002 version 14.1.0 Release 14, Section 6.3.1.3 */ |
| 1151 | function f_validate_si_scheduling(SystemInformationConfig cfg, SystemInformationVectorPerTc si_per_tc) { |
| 1152 | var integer i; |
| 1153 | for (i := 0; i < sizeof(si_per_tc); i := i + 1) { |
| 1154 | if (sizeof(si_per_tc[i]) == 0) { |
| 1155 | setverdict(fail, "No SI messages for TC=0!"); |
| 1156 | } |
| 1157 | } |
| 1158 | if (cfg.si1_present) { |
| 1159 | /* ii) System Information Type 1 needs to be sent if frequency hopping is in use or |
| 1160 | * when the NCH is present in a cell. If the MS finds another message on BCCH Norm |
| 1161 | * when TC = 0, it can assume that System Information Type 1 is not in use. */ |
| 1162 | f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_1); |
| 1163 | /* make sure *ALL* contain SI1 */ |
| 1164 | f_ensure_si_vec_contains_only(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_1); |
| 1165 | } |
| 1166 | f_ensure_si_vec_contains(si_per_tc, 1, SYSTEM_INFORMATION_TYPE_2); |
| 1167 | /* iii) A SI 2 message will be sent at least every time TC = 1 */ |
| 1168 | f_ensure_si_vec_contains(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_3); |
| 1169 | f_ensure_si_vec_contains(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_3); |
| 1170 | f_ensure_si_vec_contains(si_per_tc, 3, SYSTEM_INFORMATION_TYPE_4); |
| 1171 | f_ensure_si_vec_contains(si_per_tc, 7, SYSTEM_INFORMATION_TYPE_4); |
| 1172 | |
| 1173 | /* iii) System information type 2 bis or 2 ter messages are sent if needed, as determined by the |
| 1174 | * system operator. If only one of them is needed, it is sent when TC = 5. If both are |
| 1175 | * needed, 2bis is sent when TC = 5 and 2ter is sent at least once within any of 4 |
| 1176 | * consecutive occurrences of TC = 4. */ |
| 1177 | if (cfg.si2bis_present and not cfg.si2ter_present) { |
| 1178 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2bis); |
| 1179 | } else if (cfg.si2ter_present and not cfg.si2bis_present) { |
| 1180 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2ter); |
| 1181 | } else if (cfg.si2ter_present and cfg.si2bis_present) { |
| 1182 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2bis); |
| 1183 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2ter, false, 1, 4); |
| 1184 | } |
| 1185 | |
| 1186 | if (cfg.si7_present or cfg.si8_present) { |
| 1187 | /* vi) Use of System Information type 7 and 8 is not always necessary. It is necessary |
| 1188 | * if System Information type 4 does not contain all information needed for cell |
| 1189 | * selection and reselection. */ |
| 1190 | if (not cfg.bcch_extended) { |
| 1191 | testcase.stop("Error: SI7/SI8 require BCCH Extd."); |
| 1192 | } |
| 1193 | if (cfg.si7_present) { |
| 1194 | f_ensure_si_vec_contains(si_per_tc, 7, SYSTEM_INFORMATION_TYPE_7, true); |
| 1195 | } |
| 1196 | if (cfg.si8_present) { |
| 1197 | f_ensure_si_vec_contains(si_per_tc, 3, SYSTEM_INFORMATION_TYPE_8, true); |
| 1198 | } |
| 1199 | } |
| 1200 | |
| 1201 | if (cfg.si2quater_present) { |
| 1202 | /* iii) System information type 2 quater is sent if needed, as determined by the system |
| 1203 | * operator. If sent on BCCH Norm, it shall be sent when TC = 5 if neither of 2bis |
| 1204 | * and 2ter are used, otherwise it shall be sent at least once within any of 4 |
| 1205 | * consecutive occurrences of TC = 4. If sent on BCCH Ext, it is sent at least once |
| 1206 | * within any of 4 consecutive occurrences of TC = 5. */ |
| 1207 | if (not (cfg.bcch_extended)) { |
| 1208 | if (not (cfg.si2bis_present or cfg.si2ter_present)) { |
| 1209 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2quater); |
| 1210 | } else { |
| 1211 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2quater, false, 1, 4); |
| 1212 | } |
| 1213 | } else { |
| 1214 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2quater, true, 1, 4); |
| 1215 | } |
| 1216 | } |
| 1217 | if (cfg.si9_present) { |
| 1218 | /* vi) System Information type 9 is sent in those blocks with TC = 4 which are specified |
| 1219 | * in system information type 3 as defined in 3GPP TS 44.018. */ |
| 1220 | f_ensure_si_vec_contains(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_9); // FIXME SI3 |
| 1221 | } |
| 1222 | if (cfg.si13_present) { |
| 1223 | /* vii) System Information type 13 is only related to the GPRS service. System Information |
| 1224 | * Type 13 need only be sent if GPRS support is indicated in one or more of System |
| 1225 | * Information Type 3 or 4 or 7 or 8 messages. These messages also indicate if the |
| 1226 | * message is sent on the BCCH Norm or if the message is transmitted on the BCCH Ext. |
| 1227 | * In the case that the message is sent on the BCCH Norm, it is sent at least once |
| 1228 | * within any of 4 consecutive occurrences of TC=4. */ |
| 1229 | if (not cfg.bcch_extended) { |
| 1230 | log("not-bccch-extended"); |
| 1231 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_13, false, 1, 4); |
| 1232 | } else { |
| 1233 | log("bccch-extended"); |
| 1234 | f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_13, true); |
| 1235 | } |
| 1236 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_13alt)) { |
| 1237 | setverdict(fail, "Cannot have SI13alt and SI13"); |
| 1238 | } |
| 1239 | } |
| 1240 | if (cfg.si16_present or cfg.si17_present) { |
| 1241 | /* viii) System Information type 16 and 17 are only related to the SoLSA service. They |
| 1242 | * should not be sent in a cell where network sharing is used (see rule xv). */ |
| 1243 | if (cfg.si22_present) { |
| 1244 | testcase.stop("Error: Cannot have SI16/SI17 and SI22!"); |
| 1245 | } |
| 1246 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_22)) { |
| 1247 | setverdict(fail, "Cannot have SI16/SI17 and SI22!"); |
| 1248 | } |
| 1249 | if (not cfg.bcch_extended) { |
| 1250 | testcase.stop("Error: SI16/SI17 requires BCCH Extd!"); |
| 1251 | } |
| 1252 | if (cfg.si16_present) { |
| 1253 | f_ensure_si_vec_contains(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_16, true); |
| 1254 | } |
| 1255 | if (cfg.si17_present) { |
| 1256 | f_ensure_si_vec_contains(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_17, true); |
| 1257 | } |
| 1258 | } |
| 1259 | |
| 1260 | /* ix) System Information type 18 and 20 are sent in order to transmit non-GSM |
| 1261 | * broadcast information. The frequency with which they are sent is determined by the |
| 1262 | * system operator. System Information type 9 identifies the scheduling of System |
| 1263 | * Information type 18 and 20 messages. */ |
| 1264 | |
| 1265 | /* x) System Information Type 19 is sent if COMPACT neighbours exist. If System |
| 1266 | * Information Type 19 is present, then its scheduling shall be indicated in System |
| 1267 | * Information Type 9. */ |
| 1268 | |
| 1269 | if (cfg.si15_present) { |
| 1270 | /* xi) System Information Type 15 is broadcast if dynamic ARFCN mapping is used in the |
| 1271 | * PLMN. If sent on BCCH Norm, it is sent at least once within any of 4 consecutive |
| 1272 | * occurrences of TC = 4. If sent on BCCH Ext, it is sent at least once within any of |
| 1273 | * 4 consecutive occurrences of TC = 1. */ |
| 1274 | if (not cfg.bcch_extended) { |
| 1275 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_15, false, 1, 4); |
| 1276 | } else { |
| 1277 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 1, SYSTEM_INFORMATION_TYPE_15, true, 1, 4); |
| 1278 | } |
| 1279 | } |
| 1280 | if (cfg.si13alt_present) { |
| 1281 | /* xii) System Information type 13 alt is only related to the GERAN Iu mode. System |
| 1282 | * Information Type 13 alt need only be sent if GERAN Iu mode support is indicated in |
| 1283 | * one or more of System Information Type 3 or 4 or 7 or 8 messages and SI 13 is not |
| 1284 | * broadcast. These messages also indicate if the message is sent on the BCCH Norm or |
| 1285 | * if the message is transmitted on the BCCH Ext. In the case that the message is sent |
| 1286 | * on the BCCH Norm, it is sent at least once within any of 4 consecutive occurrences |
| 1287 | * of TC = 4. */ |
| 1288 | if (cfg.si13_present) { |
| 1289 | testcase.stop("Error: Cannot have SI13alt and SI13"); |
| 1290 | } |
| 1291 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_13)) { |
| 1292 | setverdict(fail, "Cannot have SI13alt and SI13"); |
| 1293 | } |
| 1294 | if (not cfg.bcch_extended) { |
| 1295 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_13alt, false, 1, 4); |
| 1296 | } else { |
| 1297 | f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_13alt, true); |
| 1298 | } |
| 1299 | } |
| 1300 | if (cfg.si2n_present) { |
| 1301 | /* xiii) System Information Type 2n is optionally sent on BCCH Norm or BCCH Ext if needed, |
| 1302 | * as determined by the system operator. In the case that the message is sent on the |
| 1303 | * BCCH Norm, it is sent at least once within any of 4 consecutive occurrences of TC = |
| 1304 | * 4. If the message is sent on BCCH Ext, it is sent at least once within any of 2 |
| 1305 | * consecutive occurrences of TC = 4. */ |
| 1306 | if (not cfg.bcch_extended) { |
| 1307 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2n, false, 1, 4); |
| 1308 | } else { |
| 1309 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2n, true, 2, 4); |
| 1310 | } |
| 1311 | } |
| 1312 | if (cfg.si21_present) { |
| 1313 | /* xiv) System Information Type 21 is optionally sent on BCCH Norm or BCCH Ext, as |
| 1314 | * determined by the system operator. If Extended Access Barring is in use in the cell |
| 1315 | * then this message is sent at least once within any of 4 consecutive occurrences of |
| 1316 | * TC = 4 regardless if it is sent on BCCH Norm or BCCH Ext. If BCCH Ext is used in a |
| 1317 | * cell then this message shall only be sent on BCCH Ext. */ |
| 1318 | if (not cfg.bcch_extended) { |
| 1319 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_21, false, 1, 4); |
| 1320 | } else { |
| 1321 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_21, true, 1, 4); |
| 1322 | if (f_si_vecslot_contains(si_per_tc[4], SYSTEM_INFORMATION_TYPE_21)) { |
| 1323 | setverdict(fail, "Cannot have SI21 on BCCH Norm if BCCH Extd enabled!"); |
| 1324 | } |
| 1325 | } |
| 1326 | } |
| 1327 | if (cfg.si22_present) { |
| 1328 | /* xv) System Information Type 22 is sent if network sharing is in use in the cell. It |
| 1329 | * should not be sent in a cell where SoLSA is used (see rule viii). System |
| 1330 | * Information Type 22 instances shall be sent on BCCH Ext within any occurrence of TC |
| 1331 | * =2 and TC=6. */ |
| 1332 | if (cfg.si16_present or cfg.si17_present) { |
| 1333 | testcase.stop("Error: Cannot have SI16/SI17 and SI22!"); |
| 1334 | } |
| 1335 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_16) or |
| 1336 | f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_17)) { |
| 1337 | setverdict(fail, "Cannot have SI16/SI17 and SI22!"); |
| 1338 | } |
| 1339 | if (not cfg.bcch_extended) { |
| 1340 | testcase.stop("Error: SI22 requires BCCH Extd!"); |
| 1341 | } else { |
| 1342 | f_ensure_si_vec_contains_only(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_22, true); |
| 1343 | f_ensure_si_vec_contains_only(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_22, true); |
| 1344 | } |
| 1345 | } |
| 1346 | } |
| 1347 | |
| 1348 | /* sample Systme Information for specified duration via L1CTL */ |
| 1349 | function f_l1_sample_si(L1CTL_PT pt, float duration := 8.0) return SystemInformationVectorPerTc { |
| 1350 | timer T := duration; |
| 1351 | var SystemInformationVectorPerTc si_per_tc; |
| 1352 | var L1ctlDlMessage l1_dl; |
| 1353 | |
| 1354 | /* initialize all per-TC vectors empty */ |
| 1355 | for (var integer i:= 0; i < sizeof(si_per_tc); i := i+1) { |
| 1356 | si_per_tc[i] := {}; |
| 1357 | } |
| 1358 | |
| 1359 | /* flush all previous L1 queued msgs */ |
| 1360 | pt.clear; |
| 1361 | |
| 1362 | T.start; |
| 1363 | alt { |
| 1364 | [] pt.receive(t_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl { |
| 1365 | /* somehow dec_SystemInformation will try to decode even non-RR as SI */ |
| 1366 | if (not (l1_dl.payload.data_ind.payload[1] == '06'O)) { |
| 1367 | log("Ignoring non-RR SI ", l1_dl); |
| 1368 | repeat; |
| 1369 | } |
| 1370 | var SystemInformationFn sig := { |
| 1371 | frame_number := l1_dl.dl_info.frame_nr, |
| 1372 | si := dec_SystemInformation(l1_dl.payload.data_ind.payload) |
| 1373 | } |
| 1374 | var integer tc := f_gsm_compute_tc(sig.frame_number); |
| 1375 | log("SI received at TC=", tc, ": ", sig.si); |
| 1376 | /* append to the per-TC bucket */ |
| 1377 | si_per_tc[tc] := si_per_tc[tc] & { sig }; |
| 1378 | repeat; |
| 1379 | } |
| 1380 | [] pt.receive { repeat; } |
| 1381 | [] T.timeout { } |
| 1382 | } |
| 1383 | |
| 1384 | for (var integer i:= 0; i < sizeof(si_per_tc); i := i+1) { |
| 1385 | log(testcasename(), ": TC=", i, " has #of SI=", sizeof(si_per_tc[i])); |
| 1386 | } |
| 1387 | log("si_per_tc=", si_per_tc); |
| 1388 | return si_per_tc; |
| 1389 | } |
| 1390 | |
| 1391 | /* helper function: Set given SI via RSL + validate scheduling. |
| 1392 | * CALLER MUST MAKE SURE TO CHANGE GLOBAL si_cfg! */ |
| 1393 | function f_TC_si_sched() runs on test_CT { |
| 1394 | var SystemInformationVectorPerTc si_per_tc; |
| 1395 | f_init_l1ctl(); |
| 1396 | f_l1_tune(L1CTL); |
| 1397 | |
| 1398 | /* Sample + Validate Scheduling */ |
| 1399 | si_per_tc := f_l1_sample_si(L1CTL); |
| 1400 | f_validate_si_scheduling(si_cfg, si_per_tc); |
| 1401 | |
| 1402 | setverdict(pass); |
| 1403 | } |
| 1404 | |
| 1405 | testcase TC_si_sched_default() runs on test_CT { |
| 1406 | f_init(); |
| 1407 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_2, ts_SI2_default); |
| 1408 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_4, ts_SI4_default); |
| 1409 | f_TC_si_sched(); |
| 1410 | } |
| 1411 | |
| 1412 | testcase TC_si_sched_2bis() runs on test_CT { |
| 1413 | f_init(); |
| 1414 | si_cfg.si2bis_present := true; |
| 1415 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O); |
| 1416 | f_TC_si_sched(); |
| 1417 | } |
| 1418 | |
| 1419 | testcase TC_si_sched_2ter() runs on test_CT { |
| 1420 | f_init(); |
| 1421 | si_cfg.si2ter_present := true; |
| 1422 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O); |
| 1423 | f_TC_si_sched(); |
| 1424 | } |
| 1425 | |
| 1426 | testcase TC_si_sched_2ter_2bis() runs on test_CT { |
| 1427 | f_init(); |
| 1428 | si_cfg.si2bis_present := true; |
| 1429 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O); |
| 1430 | si_cfg.si2ter_present := true; |
| 1431 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O); |
| 1432 | f_TC_si_sched(); |
| 1433 | } |
| 1434 | |
| 1435 | testcase TC_si_sched_2quater() runs on test_CT { |
| 1436 | f_init(); |
| 1437 | si_cfg.si2quater_present := true; |
| 1438 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2quater, '050607a8a0364aa698d72ff424feee0506d5e7fff02043'O); |
| 1439 | f_TC_si_sched(); |
| 1440 | } |
| 1441 | |
| 1442 | testcase TC_si_sched_13() runs on test_CT { |
| 1443 | f_init(); |
| 1444 | si_cfg.si13_present := true; |
| 1445 | //f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, fixme); |
| 1446 | f_TC_si_sched(); |
| 1447 | } |
| 1448 | |
| 1449 | testcase TC_si_sched_13_2bis_2ter_2quater() runs on test_CT { |
| 1450 | f_init(); |
| 1451 | si_cfg.si2bis_present := true; |
| 1452 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O); |
| 1453 | si_cfg.si2ter_present := true; |
| 1454 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O); |
| 1455 | si_cfg.si2quater_present := true; |
| 1456 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2quater, '050607a8a0364aa698d72ff424feee0506d5e7fff02043'O); |
| 1457 | si_cfg.si13_present := true; |
| 1458 | //f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, fixme); |
| 1459 | f_TC_si_sched(); |
| 1460 | } |
| 1461 | |
| 1462 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1463 | testcase TC_bcch_info() runs on test_CT { |
| 1464 | f_init(testcasename()); |
| 1465 | /* FIXME: enable / disable individual BCCH info */ |
| 1466 | //ts_RSL_BCCH_INFO(si_type, info); |
| 1467 | /* expect no ERROR REPORT after either of them * |
| 1468 | /* negative test: ensure ERROR REPORT on unsupported types */ |
| 1469 | } |
| 1470 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 1471 | /*********************************************************************** |
| 1472 | * Low-Level Protocol Errors / ERROR REPORT |
| 1473 | ***********************************************************************/ |
| 1474 | |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 1475 | private function f_exp_err_rep(template RSL_Cause cause) runs on test_CT { |
| 1476 | timer T := 5.0; |
| 1477 | T.start; |
| 1478 | alt { |
| 1479 | [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_ERROR_REPORT(cause))) { |
| 1480 | setverdict(pass); |
| 1481 | } |
| 1482 | [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_ERROR_REPORT(?))) { |
| 1483 | setverdict(fail, "Wrong cause in RSL ERR REP"); |
| 1484 | } |
| 1485 | [] RSL_CCHAN.receive { |
| 1486 | repeat; |
| 1487 | } |
| 1488 | [] T.timeout { |
| 1489 | setverdict(fail, "Timeout waiting for RSL ERR REP"); |
| 1490 | } |
| 1491 | } |
| 1492 | } |
| 1493 | |
| 1494 | /* Provoke a protocol error (message too short) and match on ERROR REPORT */ |
| 1495 | testcase TC_rsl_protocol_error() runs on test_CT { |
| 1496 | f_init(testcasename()); |
| 1497 | var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O)); |
| 1498 | rsl.ies := omit; |
| 1499 | RSL_CCHAN.send(ts_RSL_UD(rsl)); |
| 1500 | |
| 1501 | f_exp_err_rep(RSL_ERR_PROTO); |
| 1502 | } |
| 1503 | |
| 1504 | /* Provoke a mandatory IE error and match on ERROR REPORT */ |
| 1505 | testcase TC_rsl_mand_ie_error() runs on test_CT { |
| 1506 | f_init(testcasename()); |
| 1507 | |
| 1508 | var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O)); |
| 1509 | rsl.ies := { rsl.ies[0] }; |
| 1510 | RSL_CCHAN.send(ts_RSL_UD(rsl)); |
| 1511 | |
| 1512 | f_exp_err_rep(RSL_ERR_MAND_IE_ERROR); |
| 1513 | } |
| 1514 | |
| 1515 | /* Provoke an IE content error and match on ERROR REPORT */ |
| 1516 | testcase TC_rsl_ie_content_error() runs on test_CT { |
| 1517 | f_init(testcasename()); |
| 1518 | var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O)); |
| 1519 | rsl.ies[1].body.sysinfo_type := RSL_SYSTEM_INFO_5; |
| 1520 | RSL_CCHAN.send(ts_RSL_UD(rsl)); |
| 1521 | |
| 1522 | f_exp_err_rep(RSL_ERR_IE_CONTENT); |
| 1523 | } |
| 1524 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 1525 | /*********************************************************************** |
| 1526 | * IPA CRCX/MDCX/DLCS media stream handling |
| 1527 | ***********************************************************************/ |
| 1528 | |
Harald Welte | a871a38 | 2018-02-25 02:03:14 +0100 | [diff] [blame] | 1529 | /* Send IPA DLCX to inactive lchan */ |
| 1530 | function f_TC_ipa_dlcx_not_active(charstring id) runs on ConnHdlr { |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 1531 | f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, 0), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?), |
| 1532 | "IPA DLCX ACK"); |
Harald Welte | a871a38 | 2018-02-25 02:03:14 +0100 | [diff] [blame] | 1533 | } |
| 1534 | testcase TC_ipa_dlcx_not_active() runs on test_CT { |
| 1535 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 1536 | f_init(testcasename()); |
| 1537 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_dlcx_not_active), pars); |
| 1538 | vc_conn.done; |
| 1539 | } |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1540 | |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 1541 | /* Send IPA CRCX twice to inactive lchan */ |
| 1542 | function f_TC_ipa_crcx_twice_not_active(charstring id) runs on ConnHdlr { |
| 1543 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?), |
| 1544 | "IPA CRCX ACK"); |
| 1545 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_NACK(g_chan_nr, RSL_ERR_RES_UNAVAIL), |
| 1546 | "IPA CRCX NACK"); |
| 1547 | } |
| 1548 | testcase TC_ipa_crcx_twice_not_active() runs on test_CT { |
| 1549 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 1550 | f_init(testcasename()); |
| 1551 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_twice_not_active), pars); |
| 1552 | vc_conn.done; |
| 1553 | } |
| 1554 | |
| 1555 | /* Regular sequence of CRCX/MDCX/DLCX */ |
| 1556 | function f_TC_ipa_crcx_mdcx_dlcx_not_active(charstring id) runs on ConnHdlr { |
| 1557 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?), |
| 1558 | "IPA CRCX ACK"); |
| 1559 | var uint32_t remote_ip := f_rnd_int(c_UINT32_MAX); |
| 1560 | var uint16_t remote_port := f_rnd_int(c_UINT16_MAX); |
| 1561 | var uint7_t rtp_pt2 := f_rnd_int(127); |
| 1562 | var uint16_t fake_conn_id := 23; /* we're too lazy to read it out from the CRCX ACK above */ |
| 1563 | f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2), |
| 1564 | tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2), |
| 1565 | "IPA MDCX ACK"); |
| 1566 | f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, fake_conn_id), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?), |
| 1567 | "IPA DLCX ACK"); |
| 1568 | } |
| 1569 | testcase TC_ipa_crcx_mdcx_dlcx_not_active() runs on test_CT { |
| 1570 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 1571 | f_init(testcasename()); |
| 1572 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_mdcx_dlcx_not_active), pars); |
| 1573 | vc_conn.done; |
| 1574 | } |
| 1575 | |
Harald Welte | 3ae11da | 2018-02-25 13:36:06 +0100 | [diff] [blame] | 1576 | /* Sequence of CRCX, 2x MDCX, DLCX */ |
| 1577 | function f_TC_ipa_crcx_mdcx_mdcx_dlcx_not_active(charstring id) runs on ConnHdlr { |
| 1578 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?), |
| 1579 | "IPA CRCX ACK"); |
| 1580 | var uint32_t remote_ip := f_rnd_int(c_UINT32_MAX); |
| 1581 | var uint16_t remote_port := f_rnd_int(c_UINT16_MAX); |
| 1582 | var uint7_t rtp_pt2 := f_rnd_int(127); |
| 1583 | var uint16_t fake_conn_id := 23; /* we're too lazy to read it out from the CRCX ACK above */ |
| 1584 | f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2), |
| 1585 | tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2), |
| 1586 | "IPA MDCX ACK"); |
| 1587 | /* Second MDCX */ |
| 1588 | remote_ip := f_rnd_int(c_UINT32_MAX); |
| 1589 | remote_port := f_rnd_int(c_UINT16_MAX); |
| 1590 | f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2), |
| 1591 | tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2), |
| 1592 | "IPA MDCX ACK"); |
| 1593 | f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, fake_conn_id), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?), |
| 1594 | "IPA DLCX ACK"); |
| 1595 | } |
| 1596 | testcase TC_ipa_crcx_mdcx_mdcx_dlcx_not_active() runs on test_CT { |
| 1597 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 1598 | f_init(testcasename()); |
| 1599 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_mdcx_mdcx_dlcx_not_active), pars); |
| 1600 | vc_conn.done; |
| 1601 | } |
| 1602 | |
Harald Welte | 9912eb5 | 2018-02-25 13:30:15 +0100 | [diff] [blame] | 1603 | /* IPA CRCX on SDCCH/4 and SDCCH/8 (doesn't make sense) */ |
| 1604 | function f_TC_ipa_crcx_sdcch_not_active(charstring id) runs on ConnHdlr { |
| 1605 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_NACK(g_chan_nr, ?), |
| 1606 | "IPA CRCX NACK"); |
| 1607 | } |
| 1608 | testcase TC_ipa_crcx_sdcch_not_active() runs on test_CT { |
| 1609 | var ConnHdlrPars pars; |
| 1610 | var ConnHdlr vc_conn; |
| 1611 | f_init(testcasename()); |
| 1612 | |
| 1613 | pars := valueof(t_Pars(t_RslChanNr_SDCCH4(0,1), ts_RSL_ChanMode_SIGN)); |
| 1614 | vc_conn := f_start_handler(refers(f_TC_ipa_crcx_sdcch_not_active), pars); |
| 1615 | vc_conn.done; |
| 1616 | |
| 1617 | pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6,5), ts_RSL_ChanMode_SIGN)); |
| 1618 | vc_conn := f_start_handler(refers(f_TC_ipa_crcx_sdcch_not_active), pars); |
| 1619 | vc_conn.done; |
| 1620 | } |
| 1621 | |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 1622 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1623 | /* TODO Areas: |
| 1624 | |
| 1625 | * channel activation |
| 1626 | ** with BS_Power / MS_Power, bypassing power control loop |
| 1627 | ** on primary vs. secondary TRX |
| 1628 | ** with encryption from initial activation on |
| 1629 | ** with timing advance from initial activation on |
| 1630 | * mode modify |
| 1631 | ** encryption |
| 1632 | ** multirate |
| 1633 | * check DEACTIVATE SACCH |
| 1634 | * encryption command / intricate logic about tx-only/tx+rx/... |
| 1635 | ** unsupported algorithm |
| 1636 | * handover detection |
| 1637 | * MS Power Control |
| 1638 | * BS Power Control |
| 1639 | * Physical Context |
| 1640 | * SACCH info modify |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1641 | * CCCH Load Indication for PCH and RACH |
| 1642 | * Delete Indication on AGCH overflow |
| 1643 | * SMS Broadcast Req / Cmd / CBCH LOad Ind |
| 1644 | * RF resource ind |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1645 | * error handling |
| 1646 | * discriminator error |
| 1647 | ** type error |
| 1648 | ** sequence error |
| 1649 | ** IE duplicated? |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1650 | |
| 1651 | */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1652 | |
| 1653 | control { |
| 1654 | execute( TC_chan_act_stress() ); |
| 1655 | execute( TC_chan_act_react() ); |
| 1656 | execute( TC_chan_deact_not_active() ); |
| 1657 | execute( TC_chan_act_wrong_nr() ); |
| 1658 | execute( TC_chan_req() ); |
| 1659 | execute( TC_meas_res_sign_tchf() ); |
| 1660 | execute( TC_meas_res_sign_tchh() ); |
| 1661 | execute( TC_meas_res_sign_sdcch4() ); |
| 1662 | execute( TC_meas_res_sign_sdcch8() ); |
| 1663 | execute( TC_conn_fail_crit() ); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1664 | execute( TC_paging_imsi_80percent() ); |
| 1665 | execute( TC_paging_tmsi_80percent() ); |
| 1666 | execute( TC_paging_imsi_200percent() ); |
| 1667 | execute( TC_paging_tmsi_200percent() ); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 1668 | execute( TC_rsl_protocol_error() ); |
| 1669 | execute( TC_rsl_mand_ie_error() ); |
| 1670 | execute( TC_rsl_ie_content_error() ); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 1671 | execute( TC_si_sched_default() ); |
| 1672 | execute( TC_si_sched_2bis() ); |
| 1673 | execute( TC_si_sched_2ter() ); |
| 1674 | execute( TC_si_sched_2ter_2bis() ); |
| 1675 | execute( TC_si_sched_2quater() ); |
| 1676 | execute( TC_si_sched_13() ); |
| 1677 | execute( TC_si_sched_13_2bis_2ter_2quater() ); |
Harald Welte | a871a38 | 2018-02-25 02:03:14 +0100 | [diff] [blame] | 1678 | execute( TC_ipa_dlcx_not_active() ); |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 1679 | execute( TC_ipa_crcx_twice_not_active() ); |
| 1680 | execute( TC_ipa_crcx_mdcx_dlcx_not_active() ); |
Harald Welte | 3ae11da | 2018-02-25 13:36:06 +0100 | [diff] [blame] | 1681 | execute( TC_ipa_crcx_mdcx_mdcx_dlcx_not_active() ); |
Harald Welte | 9912eb5 | 2018-02-25 13:30:15 +0100 | [diff] [blame] | 1682 | execute( TC_ipa_crcx_sdcch_not_active() ); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1683 | } |
| 1684 | |
| 1685 | |
| 1686 | } |