Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1 | module BTS_Tests { |
| 2 | |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3 | import from Misc_Helpers all; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 4 | import from General_Types all; |
| 5 | import from GSM_Types all; |
| 6 | import from GSM_RR_Types all; |
| 7 | import from Osmocom_Types all; |
| 8 | import from GSM_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; |
Neels Hofmeyr | 6a84b23 | 2018-04-03 19:12:36 +0200 | [diff] [blame] | 14 | import from Osmocom_CTRL_Functions all; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 15 | |
| 16 | import from RSL_Types all; |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 17 | import from IPA_Types all; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 18 | import from IPA_Emulation all; |
Stefan Sperling | 0ec1c26 | 2018-10-15 15:12:52 +0200 | [diff] [blame] | 19 | import from IPA_Testing all; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 20 | import from RSL_Emulation all; |
| 21 | |
| 22 | import from IPL4asp_Types all; |
| 23 | import from TRXC_Types all; |
| 24 | import from TRXC_CodecPort all; |
| 25 | import from TRXC_CodecPort_CtrlFunct all; |
| 26 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 27 | import from PCUIF_Types all; |
| 28 | import from PCUIF_CodecPort all; |
| 29 | |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 30 | import from MobileL3_CommonIE_Types all; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 31 | import from MobileL3_RRM_Types all; |
| 32 | import from MobileL3_Types all; |
| 33 | import from L3_Templates all; |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 34 | |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 35 | import from Osmocom_VTY_Functions all; |
| 36 | import from TELNETasp_PortType all; |
| 37 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 38 | /* The tests assume a BTS with the following timeslot configuration: |
| 39 | * TS0 : Combined CCCH + SDCCH/4 |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 40 | * TS1 : TCH/F |
| 41 | * TS2 : TCH/F |
| 42 | * TS3 : TCH/F_PDCH (IPA Style) |
| 43 | * TS4 : TCH/F_TCH/H_PDCH (Osmocom Style) |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 44 | * TS5 : TCH/H |
| 45 | * TS6 : SDCCH/8 |
| 46 | * TS7 : PDCH |
| 47 | */ |
| 48 | |
| 49 | modulepar { |
| 50 | charstring mp_rsl_ip := "127.0.0.2"; |
| 51 | integer mp_rsl_port := 3003; |
| 52 | integer mp_trx0_arfcn := 871; |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 53 | charstring mp_bts_trxc_ip := "127.0.0.1"; |
| 54 | integer mp_bts_trxc_port := 5701; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 55 | charstring mp_pcu_socket := PCU_SOCK_DEFAULT; |
Neels Hofmeyr | 6a84b23 | 2018-04-03 19:12:36 +0200 | [diff] [blame] | 56 | charstring mp_ctrl_ip := "127.0.0.1"; |
| 57 | integer mp_ctrl_port := 4238; |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 58 | integer mp_tolerance_rxqual := 1; |
| 59 | integer mp_tolerance_rxlev := 3; |
| 60 | integer mp_tolerance_timing_offset_256syms := 0; |
Pau Espin Pedrol | 752ffd5 | 2018-06-07 13:55:45 +0200 | [diff] [blame] | 61 | integer mp_rxlev_exp := 57; |
Pau Espin Pedrol | e9571aa | 2018-10-22 17:13:07 +0200 | [diff] [blame] | 62 | integer mp_ul_rxlev_exp := 10; |
Pau Espin Pedrol | ed359cb | 2018-09-28 16:08:24 +0200 | [diff] [blame] | 63 | integer mp_ms_power_level_exp := 7; |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 64 | integer mp_ms_actual_ta_exp := 0; |
| 65 | integer mp_timing_offset_256syms_exp := 512; |
Pau Espin Pedrol | 315e471 | 2018-11-01 16:27:07 +0100 | [diff] [blame] | 66 | /* Time to wait for RSL conn from BTS during startup of test */ |
Philipp Maier | 12567e4 | 2019-04-17 14:10:05 +0200 | [diff] [blame] | 67 | float mp_ipa_up_timeout := 15.0; |
Philipp Maier | e63229e | 2019-04-26 12:21:37 +0200 | [diff] [blame] | 68 | float mp_ipa_up_delay := 0.0; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 69 | } |
| 70 | |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 71 | type record of RslChannelNr ChannelNrs; |
| 72 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 73 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 74 | /* IPA Emulation component underneath RSL */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 75 | var IPA_Emulation_CT vc_IPA; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 76 | /* RSL Emulation component (for ConnHdlr tests) */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 77 | var RSL_Emulation_CT vc_RSL; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 78 | /* Direct RSL_CCHAN_PT */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 79 | port RSL_CCHAN_PT RSL_CCHAN; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 80 | |
| 81 | /* L1CTL port (for classic tests) */ |
| 82 | port L1CTL_PT L1CTL; |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 83 | |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 84 | /* TRXC port (for classic tests) */ |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 85 | port TRXC_CODEC_PT BTS_TRXC; |
| 86 | var integer g_bts_trxc_conn_id; |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 87 | |
Harald Welte | f50e3ae | 2018-09-10 10:27:56 +0200 | [diff] [blame] | 88 | /* VTY connections to both BTS and BSC */ |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 89 | port TELNETasp_PT BTSVTY; |
Harald Welte | f50e3ae | 2018-09-10 10:27:56 +0200 | [diff] [blame] | 90 | port TELNETasp_PT BSCVTY; |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 91 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 92 | /* PCU Interface of BTS */ |
| 93 | port PCUIF_CODEC_PT PCU; |
| 94 | var integer g_pcu_conn_id; |
| 95 | /* Last PCU INFO IND we received */ |
| 96 | var PCUIF_Message g_pcu_last_info; |
| 97 | |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 98 | /* SI configuration */ |
| 99 | var SystemInformationConfig si_cfg := { |
| 100 | bcch_extended := false, |
| 101 | si1_present := false, |
| 102 | si2bis_present := false, |
| 103 | si2ter_present := false, |
| 104 | si2quater_present := false, |
| 105 | si7_present := false, |
| 106 | si8_present := false, |
| 107 | si9_present := false, |
| 108 | si13_present := false, |
| 109 | si13alt_present := false, |
| 110 | si15_present := false, |
| 111 | si16_present := false, |
| 112 | si17_present := false, |
| 113 | si2n_present := false, |
| 114 | si21_present := false, |
| 115 | si22_present := false |
| 116 | }; |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 117 | |
| 118 | /* all logical channels available on the BTS */ |
| 119 | var ChannelNrs g_AllChannels; |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 120 | var ChannelNrs g_AllChanTypes; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | /* an individual call / channel */ |
| 124 | type component ConnHdlr extends RSL_DchanHdlr { |
| 125 | port L1CTL_PT L1CTL; |
| 126 | |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 127 | port TRXC_CODEC_PT BTS_TRXC; |
| 128 | var integer g_bts_trxc_conn_id; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 129 | |
| 130 | timer g_Tguard; |
| 131 | timer g_Tmeas_exp := 2.0; /* >= 103 SACCH multiframe ~ 500ms */ |
| 132 | |
| 133 | var ConnHdlrPars g_pars; |
| 134 | var uint8_t g_next_meas_res_nr := 0; |
Harald Welte | fa45e9e | 2018-03-10 18:59:03 +0100 | [diff] [blame] | 135 | var boolean g_first_meas_res := true; |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 136 | |
| 137 | /* PCU Interface of BTS */ |
| 138 | port PCUIF_CODEC_PT PCU; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | function f_init_rsl(charstring id) runs on test_CT { |
| 142 | vc_IPA := IPA_Emulation_CT.create(id & "-RSL-IPA"); |
| 143 | vc_RSL := RSL_Emulation_CT.create(id & "-RSL"); |
| 144 | |
| 145 | map(vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
| 146 | connect(vc_IPA:IPA_RSL_PORT, vc_RSL:IPA_PT); |
| 147 | connect(self:RSL_CCHAN, vc_RSL:CCHAN_PT); |
| 148 | |
| 149 | vc_IPA.start(IPA_Emulation.main_server(mp_rsl_ip, mp_rsl_port)); |
| 150 | vc_RSL.start(RSL_Emulation.main(false)); |
| 151 | } |
| 152 | |
| 153 | type record ConnHdlrPars { |
| 154 | RslChannelNr chan_nr, |
| 155 | RSL_IE_ChannelMode chan_mode, |
| 156 | float t_guard, |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 157 | ConnL1Pars l1_pars, |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 158 | TestSpecUnion spec optional, |
| 159 | RSL_IE_EncryptionInfo encr optional |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | /* Test-specific parameters */ |
| 163 | type union TestSpecUnion { |
| 164 | RllTestCase rll |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 165 | } |
| 166 | |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 167 | template (value) RachControlParameters ts_RachCtrl_default := { |
Harald Welte | 0fd1fb0 | 2018-03-10 17:19:50 +0100 | [diff] [blame] | 168 | max_retrans := RACH_MAX_RETRANS_7, |
| 169 | tx_integer := '1001'B, /* 12 slots */ |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 170 | cell_barr_access := false, |
| 171 | re_not_allowed := true, |
Harald Welte | b9585f8 | 2018-03-10 17:18:47 +0100 | [diff] [blame] | 172 | acc := '0000010000000000'B |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 173 | }; |
| 174 | |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 175 | template (value) CellSelectionParameters ts_CellSelPar_default := { |
Harald Welte | 0fd1fb0 | 2018-03-10 17:19:50 +0100 | [diff] [blame] | 176 | cell_resel_hyst_2dB := 2, |
Pau Espin Pedrol | ed359cb | 2018-09-28 16:08:24 +0200 | [diff] [blame] | 177 | ms_txpwr_max_cch := mp_ms_power_level_exp, |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 178 | acs := '0'B, |
| 179 | neci := true, |
| 180 | rxlev_access_min := 0 |
| 181 | } |
| 182 | |
| 183 | template (value) LocationAreaIdentification ts_LAI_default := { |
| 184 | mcc_mnc := '262F42'H, |
| 185 | lac := 42 |
| 186 | } |
| 187 | |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 188 | /* Default SYSTEM INFORMATION 3 */ |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 189 | template (value) SystemInformation ts_SI3_default := { |
| 190 | header := ts_RrHeader(SYSTEM_INFORMATION_TYPE_3, 18), |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 191 | payload := { |
| 192 | si3 := { |
| 193 | cell_id := 23, |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 194 | lai := ts_LAI_default, |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 195 | ctrl_chan_desc := { |
| 196 | msc_r99 := true, |
| 197 | att := true, |
| 198 | bs_ag_blks_res := 1, |
| 199 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 200 | si22ind := false, |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 201 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 202 | spare := '00'B, |
| 203 | bs_pa_mfrms := 0, /* 2 multiframes */ |
| 204 | t3212 := 1 /* 6 minutes */ |
| 205 | }, |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 206 | cell_options := { |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 207 | dn_ind := false, |
| 208 | pwrc := false, |
| 209 | dtx := MS_MAY_USE_UL_DTX, |
Harald Welte | 0fd1fb0 | 2018-03-10 17:19:50 +0100 | [diff] [blame] | 210 | radio_link_tout_div4 := (32/4)-1 |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 211 | }, |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 212 | cell_sel_par := ts_CellSelPar_default, |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 213 | rach_control := ts_RachCtrl_default, |
Harald Welte | 3778acc | 2018-03-09 19:32:31 +0100 | [diff] [blame] | 214 | rest_octets := '2B2B2B2B'O |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 215 | } |
| 216 | } |
| 217 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 218 | |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 219 | template (value) SystemInformation ts_SI2_default := { |
| 220 | header := ts_RrHeader(SYSTEM_INFORMATION_TYPE_2, 22), |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 221 | payload := { |
| 222 | si2 := { |
| 223 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 224 | ncc_permitted := '11111111'B, |
| 225 | rach_control := ts_RachCtrl_default |
| 226 | } |
| 227 | } |
| 228 | } |
| 229 | |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 230 | template (value) SystemInformation ts_SI4_default := { |
| 231 | header := ts_RrHeader(SYSTEM_INFORMATION_TYPE_4, 12), /* no CBCH / restoct */ |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 232 | payload := { |
| 233 | si4 := { |
| 234 | lai := ts_LAI_default, |
| 235 | cell_sel_par := ts_CellSelPar_default, |
| 236 | rach_control := ts_RachCtrl_default, |
| 237 | cbch_chan_desc := omit, |
| 238 | cbch_mobile_alloc := omit, |
| 239 | rest_octets := ''O |
| 240 | } |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | function f_rsl_bcch_fill_raw(RSL_IE_SysinfoType rsl_si_type, octetstring si_enc) |
| 245 | runs on test_CT { |
| 246 | log("Setting ", rsl_si_type, ": ", si_enc); |
| 247 | RSL_CCHAN.send(ts_RSL_UD(ts_RSL_BCCH_INFO(rsl_si_type, si_enc))); |
| 248 | } |
| 249 | |
| 250 | function f_rsl_bcch_fill(RSL_IE_SysinfoType rsl_si_type, template (value) SystemInformation si_dec) |
| 251 | runs on test_CT { |
| 252 | var octetstring si_enc := enc_SystemInformation(valueof(si_dec)); |
| 253 | log("Setting ", rsl_si_type, ": ", si_dec); |
| 254 | f_rsl_bcch_fill_raw(rsl_si_type, si_enc); |
| 255 | } |
| 256 | |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 257 | private function f_init_vty(charstring id) runs on test_CT { |
| 258 | map(self:BTSVTY, system:BTSVTY); |
| 259 | f_vty_set_prompts(BTSVTY); |
| 260 | f_vty_transceive(BTSVTY, "enable"); |
| 261 | } |
| 262 | |
Harald Welte | f50e3ae | 2018-09-10 10:27:56 +0200 | [diff] [blame] | 263 | private function f_init_vty_bsc() runs on test_CT { |
| 264 | map(self:BSCVTY, system:BSCVTY); |
| 265 | f_vty_set_prompts(BSCVTY, "OsmoBSC"); |
| 266 | f_vty_transceive(BSCVTY, "enable"); |
| 267 | } |
| 268 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 269 | /* PCU socket may at any time receive a new INFO.ind */ |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 270 | private altstep as_pcu_info_ind(PCUIF_CODEC_PT pt, integer pcu_conn_id, |
| 271 | out PCUIF_Message pcu_last_info) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 272 | var PCUIF_send_data sd; |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 273 | [] pt.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(0, ?))) -> value sd { |
| 274 | pcu_last_info := sd.data; |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 275 | } |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 276 | [] pt.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(?, ?, ?))) -> value sd { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 277 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Invalid PCU Version/BTS Number received"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 278 | } |
| 279 | } |
| 280 | |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 281 | private function f_init_pcu(PCUIF_CODEC_PT pt, charstring id, |
| 282 | out integer pcu_conn_id, out PCUIF_Message pcu_last_info) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 283 | timer T := 2.0; |
| 284 | var PCUIF_send_data sd; |
Harald Welte | 8427162 | 2018-03-10 17:21:03 +0100 | [diff] [blame] | 285 | if (mp_pcu_socket == "") { |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 286 | pcu_conn_id := -1; |
Harald Welte | 8427162 | 2018-03-10 17:21:03 +0100 | [diff] [blame] | 287 | return; |
| 288 | } |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 289 | pcu_conn_id := f_pcuif_connect(pt, mp_pcu_socket); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 290 | |
| 291 | T.start; |
| 292 | alt { |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 293 | [] as_pcu_info_ind(pt, pcu_conn_id, pcu_last_info); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 294 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 295 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU INFO_IND"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 296 | } |
| 297 | } |
| 298 | } |
| 299 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 300 | /* global init function */ |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 301 | function f_init(charstring id := "BTS-Test") runs on test_CT { |
Pau Espin Pedrol | 315e471 | 2018-11-01 16:27:07 +0100 | [diff] [blame] | 302 | timer T := mp_ipa_up_timeout; |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 303 | g_AllChannels := { |
| 304 | /* TS 1..4: TCH/F */ |
| 305 | valueof(ts_RslChanNr_Bm(1)), valueof(ts_RslChanNr_Bm(2)), |
| 306 | valueof(ts_RslChanNr_Bm(3)), valueof(ts_RslChanNr_Bm(4)), |
| 307 | /* TS 5: TCH/H */ |
| 308 | valueof(ts_RslChanNr_Lm(5,0)), valueof(ts_RslChanNr_Lm(5,1)), |
| 309 | /* TS 0: SDCCH/4 */ |
| 310 | valueof(ts_RslChanNr_SDCCH4(0,0)), valueof(ts_RslChanNr_SDCCH4(0,1)), |
| 311 | valueof(ts_RslChanNr_SDCCH4(0,2)), valueof(ts_RslChanNr_SDCCH4(0,3)), |
| 312 | /* TS 6: SDCCH/8 */ |
| 313 | valueof(ts_RslChanNr_SDCCH8(6,0)), valueof(ts_RslChanNr_SDCCH8(6,1)), |
| 314 | valueof(ts_RslChanNr_SDCCH8(6,2)), valueof(ts_RslChanNr_SDCCH8(6,3)), |
| 315 | valueof(ts_RslChanNr_SDCCH8(6,4)), valueof(ts_RslChanNr_SDCCH8(6,5)), |
| 316 | valueof(ts_RslChanNr_SDCCH8(6,6)), valueof(ts_RslChanNr_SDCCH8(6,7)) |
| 317 | }; |
| 318 | |
Pau Espin Pedrol | 3dcf38f | 2018-10-22 14:07:54 +0200 | [diff] [blame] | 319 | /* FIXME: FACCH/H is unreliable with calypso firmware, see OS#3653 */ |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 320 | if (mp_bts_trxc_port != -1) { |
Pau Espin Pedrol | 3dcf38f | 2018-10-22 14:07:54 +0200 | [diff] [blame] | 321 | g_AllChanTypes := { |
| 322 | /* TS 1..4: TCH/F */ |
| 323 | valueof(ts_RslChanNr_Bm(1)), |
| 324 | /* TS 5: TCH/H */ |
| 325 | valueof(ts_RslChanNr_Lm(5,1)), |
| 326 | /* TS 0: SDCCH/4 */ |
| 327 | valueof(ts_RslChanNr_SDCCH4(0,2)), |
| 328 | /* TS 6: SDCCH/8 */ |
| 329 | valueof(ts_RslChanNr_SDCCH8(6,4)) |
| 330 | }; |
| 331 | } else { |
| 332 | g_AllChanTypes := { |
| 333 | /* TS 1..4: TCH/F */ |
| 334 | valueof(ts_RslChanNr_Bm(1)), |
| 335 | /* TS 0: SDCCH/4 */ |
| 336 | valueof(ts_RslChanNr_SDCCH4(0,2)), |
| 337 | /* TS 6: SDCCH/8 */ |
| 338 | valueof(ts_RslChanNr_SDCCH8(6,4)) |
| 339 | }; |
| 340 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 341 | f_init_rsl(id); |
Harald Welte | 83f6dbf | 2018-06-03 18:26:50 +0200 | [diff] [blame] | 342 | T.start; |
| 343 | alt { |
| 344 | [] RSL_CCHAN.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP}); |
| 345 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 346 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for ASP_IPA_EVENT_UP"); |
Harald Welte | 83f6dbf | 2018-06-03 18:26:50 +0200 | [diff] [blame] | 347 | } |
| 348 | } |
Harald Welte | 2d14259 | 2018-02-25 13:19:44 +0100 | [diff] [blame] | 349 | f_sleep(0.5); /* workaround for OS#3000 */ |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 350 | f_init_vty(id); |
Neels Hofmeyr | 6a84b23 | 2018-04-03 19:12:36 +0200 | [diff] [blame] | 351 | f_ipa_ctrl_start(mp_ctrl_ip, mp_ctrl_port); |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 352 | |
| 353 | /* Send SI3 to the BTS, it is needed for various computations */ |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 354 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_3, ts_SI3_default); |
| 355 | /* SI2 + SI4 are required for SI testing as they are mandatory defaults */ |
| 356 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_2, ts_SI2_default); |
| 357 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_4, ts_SI4_default); |
Harald Welte | 57fe823 | 2018-02-26 17:52:50 +0100 | [diff] [blame] | 358 | |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 359 | map(self:PCU, system:PCU); |
| 360 | f_init_pcu(PCU, id, g_pcu_conn_id, g_pcu_last_info); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 361 | |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 362 | if (mp_bts_trxc_port != -1) { |
Harald Welte | 8427162 | 2018-03-10 17:21:03 +0100 | [diff] [blame] | 363 | var TrxcMessage ret; |
| 364 | /* start with a default moderate timing offset equalling TA=2 */ |
| 365 | f_main_trxc_connect(); |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 366 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, valueof(ts_TRXC_FAKE_TIMING(2*256))); |
Harald Welte | 8427162 | 2018-03-10 17:21:03 +0100 | [diff] [blame] | 367 | } |
Philipp Maier | d95f340 | 2019-04-18 17:50:52 +0200 | [diff] [blame] | 368 | |
| 369 | /* Wait some extra time to make sure the BTS emits a stable carrier. |
| 370 | * (this is only relevant when running the tests with a physical BTS.) */ |
| 371 | f_sleep(mp_ipa_up_delay); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 372 | } |
| 373 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 374 | /* Attach L1CTL to master test_CT (classic tests, non-handler mode) */ |
| 375 | function f_init_l1ctl() runs on test_CT { |
| 376 | map(self:L1CTL, system:L1CTL); |
| 377 | f_connect_reset(L1CTL); |
| 378 | } |
| 379 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 380 | type function void_fn(charstring id) runs on ConnHdlr; |
| 381 | |
| 382 | /* create a new test component */ |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 383 | function f_start_handler(void_fn fn, ConnHdlrPars pars, boolean pcu_comp := false) |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 384 | runs on test_CT return ConnHdlr { |
| 385 | var charstring id := testcasename(); |
| 386 | var ConnHdlr vc_conn; |
| 387 | |
| 388 | vc_conn := ConnHdlr.create(id); |
| 389 | /* connect to RSL Emulation main component */ |
| 390 | connect(vc_conn:RSL, vc_RSL:CLIENT_PT); |
| 391 | connect(vc_conn:RSL_PROC, vc_RSL:RSL_PROC); |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 392 | if (pcu_comp) { |
| 393 | /* the ConnHdlr component wants to talk directly to the PCU, so disconnect |
| 394 | * it from the test_CT and connect it to the component. This obviously only |
| 395 | * works for one component, i.e. no concurrency */ |
| 396 | unmap(self:PCU, system:PCU); |
| 397 | map(vc_conn:PCU, system:PCU); |
| 398 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 399 | |
| 400 | vc_conn.start(f_handler_init(fn, id, pars)); |
| 401 | return vc_conn; |
| 402 | } |
| 403 | |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 404 | template ASP_RSL_Unitdata ts_RSL_UD(template RSL_Message rsl, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) := { |
| 405 | streamId := sid, |
| 406 | rsl := rsl |
| 407 | } |
| 408 | |
| 409 | template ASP_RSL_Unitdata tr_RSL_UD(template RSL_Message rsl, |
| 410 | template IpaStreamId sid := IPAC_PROTO_RSL_TRX0) := { |
| 411 | streamId := sid, |
| 412 | rsl := rsl |
| 413 | } |
| 414 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 415 | private altstep as_Tguard() runs on ConnHdlr { |
| 416 | [] g_Tguard.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 417 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Tguard timeout"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 418 | } |
| 419 | } |
| 420 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 421 | private function f_l1_tune(L1CTL_PT L1CTL) { |
Pau Espin Pedrol | 752ffd5 | 2018-06-07 13:55:45 +0200 | [diff] [blame] | 422 | f_L1CTL_FBSB(L1CTL, { false, mp_trx0_arfcn }, CCCH_MODE_COMBINED, mp_rxlev_exp); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 423 | } |
| 424 | |
| 425 | private function f_trxc_connect() runs on ConnHdlr { |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 426 | map(self:BTS_TRXC, system:BTS_TRXC); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 427 | var Result res; |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 428 | res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(BTS_TRXC, mp_bts_trxc_ip, mp_bts_trxc_port, |
Harald Welte | a4d8f35 | 2018-03-01 15:47:20 +0100 | [diff] [blame] | 429 | "", -1, -1, {udp:={}}, {}); |
Harald Welte | 9220f63 | 2018-05-23 20:27:02 +0200 | [diff] [blame] | 430 | if (not ispresent(res.connId)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 431 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Could not connect to trx-control interface of trxcon, check your configuration"); |
Harald Welte | 9220f63 | 2018-05-23 20:27:02 +0200 | [diff] [blame] | 432 | } |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 433 | g_bts_trxc_conn_id := res.connId; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 434 | } |
| 435 | |
| 436 | private function f_trxc_fake_rssi(uint8_t rssi) runs on ConnHdlr { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 437 | var TrxcMessage ret; |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 438 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, valueof(ts_TRXC_FAKE_RSSI(rssi))); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 439 | } |
| 440 | |
| 441 | private function f_trx_fake_toffs256(int16_t toffs256) runs on ConnHdlr { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 442 | var TrxcMessage ret; |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 443 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, valueof(ts_TRXC_FAKE_TIMING(toffs256))); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 444 | } |
| 445 | |
| 446 | /* first function started in ConnHdlr component */ |
| 447 | private function f_handler_init(void_fn fn, charstring id, ConnHdlrPars pars) |
| 448 | runs on ConnHdlr { |
| 449 | g_pars := pars; |
| 450 | g_chan_nr := pars.chan_nr; |
| 451 | |
| 452 | map(self:L1CTL, system:L1CTL); |
| 453 | f_connect_reset(L1CTL); |
| 454 | |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 455 | if (mp_bts_trxc_port != -1) { |
Harald Welte | 8427162 | 2018-03-10 17:21:03 +0100 | [diff] [blame] | 456 | f_trxc_connect(); |
| 457 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 458 | |
| 459 | g_Tguard.start(pars.t_guard); |
| 460 | activate(as_Tguard()); |
| 461 | |
| 462 | f_rslem_register(0, pars.chan_nr); |
| 463 | |
| 464 | /* call the user-supplied test case function */ |
| 465 | fn.apply(id); |
| 466 | } |
| 467 | |
Harald Welte | b1726c9 | 2018-03-30 11:56:38 +0200 | [diff] [blame] | 468 | function f_rsl_transceive_ret(template RSL_Message tx, template RSL_Message exp_rx, charstring id, |
| 469 | boolean ignore_other := false) |
| 470 | runs on ConnHdlr return RSL_Message { |
| 471 | var RSL_Message rx; |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 472 | timer T := 3.0; |
| 473 | RSL.send(tx); |
| 474 | T.start; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 475 | alt { |
Harald Welte | b1726c9 | 2018-03-30 11:56:38 +0200 | [diff] [blame] | 476 | [] RSL.receive(exp_rx) -> value rx { |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 477 | T.stop; |
| 478 | setverdict(pass); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 479 | } |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 480 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 481 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout expecting " & id); |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 482 | } |
Harald Welte | 21240e6 | 2018-03-11 21:43:35 +0100 | [diff] [blame] | 483 | [not ignore_other] as_l1_sacch(); |
| 484 | [not ignore_other] as_meas_res(); |
| 485 | [not ignore_other] as_l1_dcch(); |
| 486 | [not ignore_other] RSL.receive { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 487 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RSL message received"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 488 | } |
Harald Welte | 21240e6 | 2018-03-11 21:43:35 +0100 | [diff] [blame] | 489 | [ignore_other] RSL.receive { repeat; } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 490 | } |
Harald Welte | b1726c9 | 2018-03-30 11:56:38 +0200 | [diff] [blame] | 491 | return rx; |
| 492 | } |
| 493 | |
| 494 | function f_rsl_transceive(template RSL_Message tx, template RSL_Message exp_rx, charstring id, |
| 495 | boolean ignore_other := false) |
| 496 | runs on ConnHdlr { |
| 497 | var RSL_Message rx := f_rsl_transceive_ret(tx, exp_rx, id, ignore_other); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 498 | } |
| 499 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 500 | function f_rsl_chan_act(RSL_IE_ChannelMode mode, boolean encr_enable := false) |
| 501 | runs on ConnHdlr { |
| 502 | var RSL_Message ch_act := valueof(ts_RSL_CHAN_ACT(g_chan_nr, mode)); |
| 503 | if (encr_enable) { |
| 504 | /* append encryption related IEs, if requested */ |
| 505 | var RSL_IE_EncryptionInfo encr_info; |
| 506 | encr_info := valueof(ts_RSL_IE_EncrInfo(g_pars.encr.alg_id, g_pars.encr.key)); |
| 507 | ch_act.ies := ch_act.ies & { valueof(t_RSL_IE(RSL_IE_ENCR_INFO, RSL_IE_Body:{encr_info := |
| 508 | encr_info})) }; |
| 509 | } |
| 510 | f_rsl_transceive(ch_act, tr_RSL_CHAN_ACT_ACK(g_chan_nr), "RSL CHAN ACT"); |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 511 | } |
| 512 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 513 | function f_rsl_chan_deact() runs on ConnHdlr { |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 514 | f_rsl_transceive(ts_RSL_RF_CHAN_REL(g_chan_nr), tr_RSL_RF_CHAN_REL_ACK(g_chan_nr), |
Harald Welte | 21240e6 | 2018-03-11 21:43:35 +0100 | [diff] [blame] | 515 | "RF CHAN REL", true); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 516 | } |
| 517 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 518 | private template ConnHdlrPars t_Pars(template RslChannelNr chan_nr, |
| 519 | template RSL_IE_ChannelMode chan_mode, |
| 520 | float t_guard := 20.0) := { |
| 521 | chan_nr := valueof(chan_nr), |
| 522 | chan_mode := valueof(chan_mode), |
| 523 | t_guard := t_guard, |
| 524 | l1_pars := { |
| 525 | dtx_enabled := false, |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 526 | toa256_enabled := false, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 527 | meas_ul := { |
| 528 | full := { |
Pau Espin Pedrol | e9571aa | 2018-10-22 17:13:07 +0200 | [diff] [blame] | 529 | rxlev := mp_ul_rxlev_exp, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 530 | rxqual := 0 |
| 531 | }, |
| 532 | sub := { |
Pau Espin Pedrol | e9571aa | 2018-10-22 17:13:07 +0200 | [diff] [blame] | 533 | rxlev := mp_ul_rxlev_exp, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 534 | rxqual := 0 |
| 535 | } |
| 536 | }, |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 537 | timing_offset_256syms := mp_timing_offset_256syms_exp, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 538 | bs_power_level := 0, |
Pau Espin Pedrol | ed359cb | 2018-09-28 16:08:24 +0200 | [diff] [blame] | 539 | ms_power_level := mp_ms_power_level_exp, |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 540 | ms_actual_ta := mp_ms_actual_ta_exp |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 541 | }, |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 542 | spec := omit, |
| 543 | encr := omit |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 544 | } |
| 545 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 546 | /*********************************************************************** |
| 547 | * Channel Activation / Deactivation |
| 548 | ***********************************************************************/ |
| 549 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 550 | /* Stress test: Do 500 channel activations/deactivations in rapid succession */ |
| 551 | function f_TC_chan_act_stress(charstring id) runs on ConnHdlr { |
| 552 | for (var integer i := 0; i < 500; i := i+1) { |
| 553 | f_rsl_chan_act(g_pars.chan_mode); |
| 554 | f_rsl_chan_deact(); |
| 555 | } |
| 556 | setverdict(pass); |
| 557 | } |
| 558 | testcase TC_chan_act_stress() runs on test_CT { |
| 559 | var ConnHdlr vc_conn; |
| 560 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 561 | f_init(testcasename()); |
| 562 | vc_conn := f_start_handler(refers(f_TC_chan_act_stress), pars); |
| 563 | vc_conn.done; |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 564 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 565 | } |
| 566 | |
| 567 | /* Test if re-activation of an already active channel fails as expected */ |
| 568 | function f_TC_chan_act_react(charstring id) runs on ConnHdlr { |
| 569 | f_rsl_chan_act(g_pars.chan_mode); |
| 570 | /* attempt to activate the same lchan again -> expect reject */ |
| 571 | RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode)); |
| 572 | alt { |
| 573 | [] RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 574 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected CHAN ACT ACK on double activation"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 575 | } |
| 576 | [] RSL.receive(tr_RSL_CHAN_ACT_NACK(g_chan_nr)) { |
| 577 | setverdict(pass); |
| 578 | } |
| 579 | } |
| 580 | f_rsl_chan_deact(); |
| 581 | } |
| 582 | testcase TC_chan_act_react() runs on test_CT { |
| 583 | var ConnHdlr vc_conn; |
| 584 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
Harald Welte | 294b0a2 | 2018-03-10 23:26:48 +0100 | [diff] [blame] | 585 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 586 | vc_conn := f_start_handler(refers(f_TC_chan_act_react), pars); |
| 587 | vc_conn.done; |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 588 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 589 | } |
| 590 | |
| 591 | /* Attempt to de-activate a channel that's not active */ |
| 592 | function f_TC_chan_deact_not_active(charstring id) runs on ConnHdlr { |
| 593 | timer T := 3.0; |
| 594 | RSL.send(ts_RSL_RF_CHAN_REL(g_chan_nr)); |
| 595 | T.start; |
| 596 | alt { |
| 597 | [] RSL.receive(tr_RSL_RF_CHAN_REL_ACK(g_chan_nr)) { |
| 598 | setverdict(pass); |
| 599 | } |
| 600 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 601 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout expecting RF_CHAN_REL_ACK"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 602 | } |
| 603 | } |
| 604 | } |
| 605 | testcase TC_chan_deact_not_active() runs on test_CT { |
| 606 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
Harald Welte | 294b0a2 | 2018-03-10 23:26:48 +0100 | [diff] [blame] | 607 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 608 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_chan_deact_not_active), pars); |
| 609 | vc_conn.done; |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 610 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 611 | } |
| 612 | |
| 613 | /* attempt to activate channel with wrong RSL Channel Nr IE; expect NACK */ |
| 614 | function f_TC_chan_act_wrong_nr(charstring id) runs on ConnHdlr { |
| 615 | RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode)); |
| 616 | alt { |
| 617 | [] RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 618 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected CHAN ACT ACK"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 619 | } |
| 620 | [] RSL.receive(tr_RSL_CHAN_ACT_NACK(g_chan_nr)) { |
| 621 | setverdict(pass); |
| 622 | } |
| 623 | } |
| 624 | } |
| 625 | private type record WrongChanNrCase { |
| 626 | RslChannelNr chan_nr, |
| 627 | charstring description |
| 628 | } |
| 629 | private type record of WrongChanNrCase WrongChanNrCases; |
| 630 | private template WrongChanNrCase t_WCN(template RslChannelNr chan_nr, charstring desc) := { |
| 631 | chan_nr := chan_nr, |
| 632 | description := desc |
| 633 | } |
| 634 | |
| 635 | testcase TC_chan_act_wrong_nr() runs on test_CT { |
| 636 | var ConnHdlr vc_conn; |
| 637 | var ConnHdlrPars pars; |
| 638 | |
Harald Welte | 294b0a2 | 2018-03-10 23:26:48 +0100 | [diff] [blame] | 639 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 640 | |
| 641 | var WrongChanNrCases wrong := { |
| 642 | valueof(t_WCN(t_RslChanNr_RACH(0), "RACH is not a dedicated channel")), |
| 643 | valueof(t_WCN(t_RslChanNr_RACH(1), "RACH doesn't exist on timeslot")), |
| 644 | valueof(t_WCN(t_RslChanNr_BCCH(0), "BCCH is not a dedicated channel")), |
| 645 | valueof(t_WCN(t_RslChanNr_PCH_AGCH(0), "PCH/AGCH is not a dedicated channel")), |
| 646 | valueof(t_WCN(t_RslChanNr_Bm(0), "TS0 cannot be TCH/F")), |
| 647 | valueof(t_WCN(t_RslChanNr_Lm(0, 0), "TS0 cannot be TCH/H")), |
| 648 | valueof(t_WCN(t_RslChanNr_Lm(0, 1), "TS0 cannot be TCH/H")), |
| 649 | valueof(t_WCN(t_RslChanNr_PDCH(0), "TS0 cannot be PDCH")), |
| 650 | valueof(t_WCN(t_RslChanNr_SDCCH8(0, 0), "TS0 cannot be SDCCH/8")), |
| 651 | valueof(t_WCN(t_RslChanNr_SDCCH8(0, 7), "TS0 cannot be SDCCH/8")), |
| 652 | valueof(t_WCN(t_RslChanNr_SDCCH4(7, 0), "TS7 cannot be SDCCH/4")), |
| 653 | valueof(t_WCN(t_RslChanNr_SDCCH4(7, 3), "TS7 cannot be SDCCH/4")), |
| 654 | valueof(t_WCN(t_RslChanNr_Lm(1, 0), "TS1 cannot be TCH/H")) |
| 655 | }; |
| 656 | |
| 657 | for (var integer i := 0; i < sizeof(wrong); i := i+1) { |
| 658 | pars := valueof(t_Pars(wrong[i].chan_nr, ts_RSL_ChanMode_SIGN)); |
| 659 | vc_conn := f_start_handler(refers(f_TC_chan_act_wrong_nr), pars); |
| 660 | vc_conn.done; |
| 661 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 662 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 663 | } |
| 664 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 665 | /* execute the same callback function on a variety of logical channels */ |
| 666 | private function f_testmatrix_each_chan(ConnHdlrPars pars, void_fn fn) runs on test_CT { |
| 667 | var ConnHdlr vc_conn; |
| 668 | f_init(testcasename()); |
| 669 | |
| 670 | /* test on each of the channels we have */ |
| 671 | for (var integer i := 0; i < sizeof(g_AllChanTypes); i := i+1) { |
| 672 | pars.chan_nr := valueof(g_AllChanTypes[i]); |
| 673 | |
| 674 | log(testcasename(), ": XXX Starting on ", g_AllChanTypes[i]); |
| 675 | vc_conn := f_start_handler(fn, pars); |
| 676 | vc_conn.done; |
| 677 | } |
| 678 | |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 679 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 680 | } |
| 681 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 682 | /*********************************************************************** |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 683 | * SACCH handling |
| 684 | ***********************************************************************/ |
| 685 | |
| 686 | private function f_exp_sacch(boolean exp) runs on ConnHdlr { |
| 687 | timer T_sacch := 3.0; |
| 688 | T_sacch.start; |
| 689 | alt { |
| 690 | [not exp] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(0))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 691 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received SACCH when not expecting it"); |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 692 | } |
| 693 | [not exp] T_sacch.timeout { |
| 694 | setverdict(pass); |
| 695 | } |
| 696 | [exp] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(0))) { |
| 697 | setverdict(pass); |
| 698 | } |
| 699 | [exp] T_sacch.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 700 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Timeout waiting for SACCH on ", g_chan_nr)); |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 701 | } |
| 702 | [] L1CTL.receive { repeat; } |
| 703 | [] RSL.receive { repeat; } |
| 704 | } |
| 705 | } |
| 706 | |
| 707 | /* Test if DEACTIVATE SACCH actualy deactivates its transmission (TS 48.058 4.6) */ |
| 708 | private function f_TC_deact_sacch(charstring id) runs on ConnHdlr { |
| 709 | f_l1_tune(L1CTL); |
| 710 | RSL.clear; |
| 711 | |
| 712 | /* activate the logical channel */ |
| 713 | f_est_dchan(); |
| 714 | L1CTL.clear; |
| 715 | |
| 716 | /* check that SACCH actually are received as expected */ |
| 717 | f_exp_sacch(true); |
| 718 | |
| 719 | /* deactivate SACCH on the logical channel */ |
| 720 | RSL.send(ts_RSL_DEACT_SACCH(g_chan_nr)); |
| 721 | f_sleep(1.0); |
| 722 | L1CTL.clear; |
| 723 | |
| 724 | /* check that no SACCH are received anymore */ |
| 725 | f_exp_sacch(false); |
| 726 | |
| 727 | /* release the channel */ |
| 728 | f_rsl_chan_deact(); |
| 729 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 730 | } |
| 731 | testcase TC_deact_sacch() runs on test_CT { |
| 732 | var ConnHdlr vc_conn; |
| 733 | var ConnHdlrPars pars; |
| 734 | f_init(); |
| 735 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 736 | //for (var integer i := 0; i < 1; i := i+1) { |
| 737 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 738 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 739 | vc_conn := f_start_handler(refers(f_TC_deact_sacch), pars); |
| 740 | vc_conn.done; |
| 741 | } |
| 742 | /* TODO: do the above in parallel, rather than sequentially? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 743 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 744 | } |
| 745 | |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 746 | /* verify that given SACCH payload is present */ |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 747 | private function f_sacch_present(template octetstring l3_exp) runs on ConnHdlr { |
| 748 | var L1ctlDlMessage dl; |
| 749 | /* check that the specified SI5 value is actually sent */ |
| 750 | timer T_sacch := 3.0; |
| 751 | L1CTL.clear; |
| 752 | T_sacch.start; |
| 753 | alt { |
| 754 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(0))) -> value dl { |
| 755 | var octetstring l3 := substr(dl.payload.data_ind.payload, 4, 19); |
| 756 | if (match(l3, l3_exp)) { |
| 757 | setverdict(pass); |
| 758 | } else { |
| 759 | repeat; |
| 760 | } |
| 761 | } |
| 762 | [] L1CTL.receive { repeat; } |
| 763 | [] T_sacch.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 764 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Timeout waiting for SACCH ", l3_exp)); |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 765 | } |
| 766 | } |
| 767 | } |
| 768 | |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 769 | /* verify that given SACCH payload is not present */ |
| 770 | private function f_sacch_missing(template octetstring l3_exp) runs on ConnHdlr { |
| 771 | var L1ctlDlMessage dl; |
| 772 | /* check that the specified SI5 value is actually sent */ |
| 773 | timer T_sacch := 3.0; |
| 774 | L1CTL.clear; |
| 775 | T_sacch.start; |
| 776 | alt { |
| 777 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(0))) -> value dl { |
| 778 | var octetstring l3 := substr(dl.payload.data_ind.payload, 4, 19); |
| 779 | if (match(l3, l3_exp)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 780 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Received unexpected SACCH ", dl)); |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 781 | } else { |
| 782 | repeat; |
| 783 | } |
| 784 | } |
| 785 | [] L1CTL.receive { repeat; } |
| 786 | [] T_sacch.timeout { |
| 787 | setverdict(pass); |
| 788 | } |
| 789 | } |
| 790 | } |
| 791 | |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 792 | /* Test for default SACCH FILL transmitted in DL SACCH (all channel types) */ |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 793 | private function f_TC_sacch_filling(charstring id) runs on ConnHdlr { |
| 794 | /* Set a known default SACCH filling for SI5 */ |
| 795 | var octetstring si5 := f_rnd_octstring(19); |
| 796 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
| 797 | |
| 798 | f_l1_tune(L1CTL); |
| 799 | RSL.clear; |
| 800 | |
| 801 | /* activate the logical channel */ |
| 802 | f_est_dchan(); |
| 803 | |
| 804 | /* check that the specified SI5 value is actually sent */ |
| 805 | f_sacch_present(si5); |
| 806 | |
| 807 | /* release the channel */ |
| 808 | RSL.clear; |
| 809 | f_rsl_chan_deact(); |
| 810 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 811 | } |
| 812 | testcase TC_sacch_filling() runs on test_CT { |
| 813 | var ConnHdlr vc_conn; |
| 814 | var ConnHdlrPars pars; |
| 815 | f_init(); |
| 816 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 817 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 818 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 819 | vc_conn := f_start_handler(refers(f_TC_sacch_filling), pars); |
| 820 | vc_conn.done; |
| 821 | } |
| 822 | /* TODO: do the above in parallel, rather than sequentially? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 823 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 824 | } |
| 825 | |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 826 | /* Test for lchan-specific SACCH INFO MODIFY (TS 48.058 4.12) */ |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 827 | private function f_TC_sacch_info_mod(charstring id) runs on ConnHdlr { |
| 828 | /* Set a known default SACCH filling for SI5 */ |
| 829 | var octetstring si5 := f_rnd_octstring(19); |
| 830 | var octetstring si5_diff := f_rnd_octstring(19); |
| 831 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
| 832 | |
| 833 | f_l1_tune(L1CTL); |
| 834 | RSL.clear; |
| 835 | |
| 836 | log("Activating channel, expecting standard SI5"); |
| 837 | /* activate the logical channel */ |
| 838 | f_est_dchan(); |
| 839 | /* check that the specified SI5 value is actually sent */ |
| 840 | f_sacch_present(si5); |
| 841 | |
| 842 | /* set channel-specific different SI5 */ |
| 843 | log("Setting channel specific SACCH INFO, expecting it"); |
| 844 | RSL.send(ts_RSL_SACCH_INF_MOD(g_chan_nr, RSL_SYSTEM_INFO_5, si5_diff)) |
| 845 | /* check that the specified lchan-specific value is now used */ |
| 846 | f_sacch_present(si5_diff); |
| 847 | |
| 848 | /* deactivate the channel and re-activate it, this should result in default SI5 */ |
| 849 | log("De-activating and re-activating channel, expecting standard SI5"); |
| 850 | f_rsl_chan_deact(); |
| 851 | f_rsl_chan_act(valueof(ts_RSL_ChanMode_SIGN)); |
| 852 | /* Verify that the TRX-wide default SACCH filling is present again */ |
| 853 | f_sacch_present(si5); |
| 854 | |
| 855 | /* release the channel */ |
| 856 | RSL.clear; |
| 857 | f_rsl_chan_deact(); |
| 858 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 859 | } |
| 860 | testcase TC_sacch_info_mod() runs on test_CT { |
| 861 | var ConnHdlr vc_conn; |
| 862 | var ConnHdlrPars pars; |
| 863 | f_init(); |
| 864 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 865 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 866 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 867 | vc_conn := f_start_handler(refers(f_TC_sacch_info_mod), pars); |
| 868 | vc_conn.done; |
| 869 | } |
| 870 | /* TODO: do the above in parallel, rather than sequentially? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 871 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 872 | } |
| 873 | |
Harald Welte | 075d84c | 2018-03-12 13:07:24 +0100 | [diff] [blame] | 874 | /* Test SACCH scheduling of multiple different SI message types */ |
| 875 | private function f_TC_sacch_multi(charstring id) runs on ConnHdlr { |
| 876 | var octetstring si5 := f_rnd_octstring(19); |
| 877 | var octetstring si5bis := f_rnd_octstring(19); |
| 878 | var octetstring si5ter := f_rnd_octstring(19); |
| 879 | var octetstring si6 := f_rnd_octstring(19); |
| 880 | |
| 881 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
| 882 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5bis, si5bis)); |
| 883 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5ter, si5ter)); |
| 884 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_6, si6)); |
| 885 | |
| 886 | f_l1_tune(L1CTL); |
| 887 | RSL.clear; |
| 888 | |
| 889 | /* activate the logical channel */ |
| 890 | f_est_dchan(); |
| 891 | L1CTL.clear; |
| 892 | |
| 893 | /* check that SACCH actually are received as expected */ |
| 894 | f_sacch_present(si5); |
| 895 | f_sacch_present(si5bis); |
| 896 | f_sacch_present(si5ter); |
| 897 | f_sacch_present(si6); |
| 898 | |
| 899 | /* release the channel */ |
| 900 | f_rsl_chan_deact(); |
| 901 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 902 | } |
| 903 | testcase TC_sacch_multi() runs on test_CT { |
| 904 | var ConnHdlr vc_conn; |
| 905 | var ConnHdlrPars pars; |
| 906 | f_init(); |
| 907 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 908 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 909 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 910 | vc_conn := f_start_handler(refers(f_TC_sacch_multi), pars); |
| 911 | vc_conn.done; |
| 912 | } |
| 913 | /* TODO: do the above in parallel, rather than sequentially? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 914 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 075d84c | 2018-03-12 13:07:24 +0100 | [diff] [blame] | 915 | } |
| 916 | |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 917 | /* Test if SACH information is modified as expected */ |
| 918 | private function f_TC_sacch_multi_chg(charstring id) runs on ConnHdlr { |
| 919 | var octetstring si5 := f_rnd_octstring(19); |
| 920 | var octetstring si6 := f_rnd_octstring(19); |
| 921 | |
| 922 | /* First, configure both SI5 and SI6 to be transmitted */ |
| 923 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
| 924 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_6, si6)); |
| 925 | |
| 926 | f_l1_tune(L1CTL); |
| 927 | RSL.clear; |
| 928 | |
| 929 | /* activate the logical channel */ |
| 930 | f_est_dchan(); |
| 931 | L1CTL.clear; |
| 932 | |
| 933 | /* check that SACCH actually are received as expected */ |
| 934 | f_sacch_present(si5); |
| 935 | f_sacch_present(si6); |
| 936 | |
| 937 | /* disable SI6 */ |
| 938 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_6, ''O)); |
| 939 | |
| 940 | /* check that SI5 is still transmitted */ |
| 941 | f_sacch_present(si5); |
| 942 | /* check if SI6 is now gone */ |
| 943 | f_sacch_missing(si6); |
| 944 | |
| 945 | /* release the channel */ |
| 946 | f_rsl_chan_deact(); |
| 947 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 948 | } |
| 949 | testcase TC_sacch_multi_chg() runs on test_CT { |
| 950 | var ConnHdlr vc_conn; |
| 951 | var ConnHdlrPars pars; |
| 952 | f_init(); |
| 953 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 954 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 955 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 956 | vc_conn := f_start_handler(refers(f_TC_sacch_multi_chg), pars); |
| 957 | vc_conn.done; |
| 958 | } |
| 959 | /* TODO: do the above in parallel, rather than sequentially? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 960 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 961 | } |
| 962 | |
Harald Welte | 075d84c | 2018-03-12 13:07:24 +0100 | [diff] [blame] | 963 | /* TODO: Test for SACCH information present in RSL CHAN ACT (overrides FILLING) */ |
| 964 | /* TODO: Test for SACCH transmission rules in the context of special CHAN ACT (HO) */ |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 965 | |
| 966 | |
| 967 | /*********************************************************************** |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 968 | * RACH Handling |
| 969 | ***********************************************************************/ |
| 970 | |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 971 | /* like L1SAP_IS_PACKET_RACH */ |
| 972 | private function ra_is_ps(OCT1 ra) return boolean { |
Harald Welte | 56c0580 | 2018-02-28 21:39:35 +0100 | [diff] [blame] | 973 | if ((ra and4b 'F0'O == '70'O) and (ra and4b '0F'O != '0F'O)) { |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 974 | return true; |
| 975 | } |
| 976 | return false; |
| 977 | } |
| 978 | |
| 979 | /* generate a random RACH for circuit-switched */ |
| 980 | private function f_rnd_ra_cs() return OCT1 { |
| 981 | var OCT1 ra; |
| 982 | do { |
| 983 | ra := f_rnd_octstring(1); |
| 984 | } while (ra_is_ps(ra)); |
| 985 | return ra; |
| 986 | } |
| 987 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 988 | /* generate a random RACH for packet-switched */ |
| 989 | private function f_rnd_ra_ps() return OCT1 { |
| 990 | var OCT1 ra; |
| 991 | do { |
| 992 | ra := f_rnd_octstring(1); |
| 993 | } while (not ra_is_ps(ra)); |
| 994 | return ra; |
| 995 | } |
| 996 | |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 997 | /* generate a random 11-bit RA (packet-switched only) */ |
| 998 | private function f_rnd_ra11_ps() return BIT11 { |
| 999 | var integer ra11 := f_rnd_int(bit2int('11111111111'B)); |
| 1000 | return int2bit(ra11, 11); |
| 1001 | } |
| 1002 | |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1003 | /* Send 1000 RACH requests and check their RA+FN on the RSL side */ |
| 1004 | testcase TC_rach_content() runs on test_CT { |
| 1005 | f_init(testcasename()); |
| 1006 | f_init_l1ctl(); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1007 | f_l1_tune(L1CTL); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1008 | |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1009 | var GsmFrameNumber fn_last := 0; |
Max | a199a2e | 2019-02-25 16:31:11 +0100 | [diff] [blame] | 1010 | var boolean test_failed := false; |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1011 | for (var integer i := 0; i < 1000; i := i+1) { |
| 1012 | var OCT1 ra := f_rnd_ra_cs(); |
| 1013 | var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra)); |
| 1014 | if (fn == fn_last) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1015 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Two RACH in same FN?!?"); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1016 | } |
| 1017 | fn_last := fn; |
| 1018 | |
| 1019 | timer T := 5.0; |
Harald Welte | 56c0580 | 2018-02-28 21:39:35 +0100 | [diff] [blame] | 1020 | T.start; |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1021 | alt { |
| 1022 | [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(ra, fn, ?))) { |
| 1023 | T.stop; |
| 1024 | } |
| 1025 | [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(?, ?, ?))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1026 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected CHAN RQD"); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1027 | } |
| 1028 | [] RSL_CCHAN.receive { repeat; } |
| 1029 | [] T.timeout { |
Max | a199a2e | 2019-02-25 16:31:11 +0100 | [diff] [blame] | 1030 | test_failed := true; |
| 1031 | log("[", i, "] Timeout waiting for CHAN RQD FN=", fn, " RA=", ra); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1032 | } |
| 1033 | } |
| 1034 | } |
Max | ba06feb | 2019-03-05 10:52:46 +0100 | [diff] [blame] | 1035 | if (test_failed) { |
| 1036 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Some out of 1000 RACH requests timed out")); |
Max | a199a2e | 2019-02-25 16:31:11 +0100 | [diff] [blame] | 1037 | } |
Max | ba06feb | 2019-03-05 10:52:46 +0100 | [diff] [blame] | 1038 | setverdict(pass); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1039 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1040 | } |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1041 | |
| 1042 | /* Send 1000 RACH Requests (flood ~ 89/s) and count if count(Abis) == count(Um) */ |
| 1043 | testcase TC_rach_count() runs on test_CT { |
Harald Welte | 294b0a2 | 2018-03-10 23:26:48 +0100 | [diff] [blame] | 1044 | f_init(); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1045 | f_init_l1ctl(); |
Harald Welte | 294b0a2 | 2018-03-10 23:26:48 +0100 | [diff] [blame] | 1046 | f_sleep(1.0); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1047 | f_l1_tune(L1CTL); |
| 1048 | |
| 1049 | var GsmFrameNumber fn_last := 0; |
| 1050 | for (var integer i := 0; i < 1000; i := i+1) { |
| 1051 | var OCT1 ra := f_rnd_ra_cs(); |
| 1052 | var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra)); |
| 1053 | if (fn == fn_last) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1054 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Two RACH in same FN?!?"); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1055 | } |
| 1056 | fn_last := fn; |
| 1057 | } |
| 1058 | var integer rsl_chrqd := 0; |
| 1059 | timer T := 3.0; |
Harald Welte | 56c0580 | 2018-02-28 21:39:35 +0100 | [diff] [blame] | 1060 | T.start; |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1061 | alt { |
| 1062 | [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(?,?))) { |
| 1063 | rsl_chrqd := rsl_chrqd + 1; |
Harald Welte | c3a3f45 | 2018-02-26 17:37:47 +0100 | [diff] [blame] | 1064 | f_timer_safe_restart(T); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1065 | repeat; |
| 1066 | } |
| 1067 | [] RSL_CCHAN.receive { repeat; } |
| 1068 | [] T.timeout { } |
| 1069 | } |
| 1070 | if (rsl_chrqd == 1000) { |
| 1071 | setverdict(pass); |
| 1072 | } else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1073 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Received only ", rsl_chrqd, " out of 1000 RACH")); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1074 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1075 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1076 | } |
| 1077 | |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1078 | private function f_main_trxc_connect() runs on test_CT { |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 1079 | map(self:BTS_TRXC, system:BTS_TRXC); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1080 | var Result res; |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 1081 | res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(BTS_TRXC, mp_bts_trxc_ip, mp_bts_trxc_port, |
Harald Welte | d3a88a6 | 2018-03-01 16:04:52 +0100 | [diff] [blame] | 1082 | "", -1, -1, {udp:={}}, {}); |
Harald Welte | 9220f63 | 2018-05-23 20:27:02 +0200 | [diff] [blame] | 1083 | if (not ispresent(res.connId)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1084 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Could not connect to trx-control interface of trxcon, check your configuration"); |
Harald Welte | 9220f63 | 2018-05-23 20:27:02 +0200 | [diff] [blame] | 1085 | } |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 1086 | g_bts_trxc_conn_id := res.connId; |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1087 | } |
| 1088 | |
| 1089 | private function f_rach_toffs(int16_t toffs256, boolean expect_pass) runs on test_CT { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 1090 | var TrxcMessage ret; |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1091 | /* tell fake_trx to use a given timing offset for all bursts */ |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 1092 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, valueof(ts_TRXC_FAKE_TIMING(toffs256))); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1093 | f_sleep(0.5); |
| 1094 | |
| 1095 | /* Transmit RACH request + wait for confirmation */ |
| 1096 | var OCT1 ra := f_rnd_ra_cs(); |
| 1097 | var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra)); |
| 1098 | |
| 1099 | /* Check for expected result */ |
| 1100 | timer T := 1.5; |
| 1101 | T.start; |
| 1102 | alt { |
| 1103 | [expect_pass] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(ra, fn))) { |
| 1104 | setverdict(pass); |
| 1105 | } |
| 1106 | [not expect_pass] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(ra, fn))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1107 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("RACH passed but was expected to be dropped: ", toffs256)); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1108 | } |
| 1109 | [] RSL_CCHAN.receive { repeat; } |
| 1110 | [not expect_pass] T.timeout { |
| 1111 | setverdict(pass); |
| 1112 | } |
| 1113 | [expect_pass] T.timeout { |
Max | 6e05304 | 2019-03-14 16:34:22 +0100 | [diff] [blame] | 1114 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Timeout waiting for CHAN RQD: FN=", fn, " RA=", ra)); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1115 | } |
| 1116 | } |
| 1117 | } |
| 1118 | |
| 1119 | /* Test if dropping of RACH Based on NM_ATT_MAX_TA works */ |
| 1120 | testcase TC_rach_max_ta() runs on test_CT { |
| 1121 | f_init(testcasename()); |
| 1122 | f_init_l1ctl(); |
| 1123 | f_l1_tune(L1CTL); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1124 | f_sleep(1.0); |
| 1125 | |
| 1126 | /* default max-ta is 63 (full range of GSM timing advance */ |
| 1127 | |
Vadim Yanitskiy | c81d6e4 | 2018-03-05 22:39:01 +0700 | [diff] [blame] | 1128 | /* We allow early arrival up to 2 symbols */ |
| 1129 | f_rach_toffs(-1*256, true); |
| 1130 | f_rach_toffs(-2*256, true); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1131 | f_rach_toffs(-10*256, false); |
| 1132 | |
| 1133 | /* 0 / 32 / 63 bits is legal / permitted */ |
| 1134 | f_rach_toffs(0, true); |
| 1135 | f_rach_toffs(32*256, true); |
| 1136 | f_rach_toffs(63*256, true); |
| 1137 | |
| 1138 | /* more than 63 bits is not legal / permitted */ |
| 1139 | f_rach_toffs(64*256, false); |
| 1140 | f_rach_toffs(127*256, false); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1141 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1142 | } |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1143 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 1144 | /*********************************************************************** |
| 1145 | * Measurement Processing / Reporting |
| 1146 | ***********************************************************************/ |
| 1147 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1148 | template LapdmAddressField ts_LapdmAddr(LapdmSapi sapi, boolean c_r) := { |
| 1149 | spare := '0'B, |
| 1150 | lpd := 0, |
| 1151 | sapi := sapi, |
| 1152 | c_r := c_r, |
| 1153 | ea := true |
| 1154 | } |
| 1155 | |
Harald Welte | d879bd9 | 2018-03-12 15:01:23 +0100 | [diff] [blame] | 1156 | template LapdmFrameAB ts_LAPDm_AB(LapdmSapi sapi, boolean c_r, boolean p, octetstring pl) := { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1157 | addr := ts_LapdmAddr(sapi, c_r), |
Harald Welte | d879bd9 | 2018-03-12 15:01:23 +0100 | [diff] [blame] | 1158 | ctrl := ts_LapdmCtrlUI(p), |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1159 | len := 0, /* overwritten */ |
| 1160 | m := false, |
| 1161 | el := 1, |
| 1162 | payload := pl |
| 1163 | } |
| 1164 | |
| 1165 | /* handle incoming downlink SACCH and respond with uplink SACCH (meas res) */ |
| 1166 | altstep as_l1_sacch() runs on ConnHdlr { |
| 1167 | var L1ctlDlMessage l1_dl; |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 1168 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1169 | log("SACCH received: ", l1_dl.payload.data_ind.payload); |
Pau Espin Pedrol | e9571aa | 2018-10-22 17:13:07 +0200 | [diff] [blame] | 1170 | var GsmRrL3Message meas_rep := valueof(ts_MEAS_REP(true, mp_rxlev_exp, mp_rxlev_exp, 0, 0, omit)); |
Harald Welte | d879bd9 | 2018-03-12 15:01:23 +0100 | [diff] [blame] | 1171 | var LapdmFrameAB lb := valueof(ts_LAPDm_AB(0, false, false, enc_GsmRrL3Message(meas_rep))); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1172 | log("LAPDm: ", lb); |
Pau Espin Pedrol | ed359cb | 2018-09-28 16:08:24 +0200 | [diff] [blame] | 1173 | |
| 1174 | var L1ctlDataReq data_req := { |
| 1175 | l1header := valueof(ts_SacchL1Header(g_pars.l1_pars.ms_power_level, false, g_pars.l1_pars.ms_actual_ta)), |
| 1176 | l2_payload := f_pad_oct(enc_LapdmFrameAB(lb), 21, '2B'O) |
| 1177 | } |
| 1178 | log("Sending Measurement Report: ", data_req); |
| 1179 | L1CTL.send(ts_L1CTL_DATA_REQ_SACCH(g_chan_nr, ts_RslLinkID_SACCH(0), data_req)); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1180 | repeat; |
| 1181 | } |
| 1182 | } |
| 1183 | |
| 1184 | altstep as_l1_dcch() runs on ConnHdlr { |
| 1185 | var L1ctlDlMessage l1_dl; |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 1186 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_DCCH(?))) -> value l1_dl { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1187 | log("DCCH received: ", l1_dl.payload.data_ind.payload); |
| 1188 | var octetstring pl := '010301'O; |
Vadim Yanitskiy | 31e7c67 | 2018-07-27 02:23:16 +0700 | [diff] [blame] | 1189 | L1CTL.send(ts_L1CTL_DATA_REQ(g_chan_nr, ts_RslLinkID_DCCH(0), |
| 1190 | f_pad_oct(pl, 23, '2B'O))); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1191 | repeat; |
| 1192 | } |
| 1193 | } |
| 1194 | |
| 1195 | type record MeasElem { |
| 1196 | uint6_t rxlev, |
| 1197 | uint3_t rxqual |
| 1198 | } |
| 1199 | |
| 1200 | type record MeasElemFS { |
| 1201 | MeasElem full, |
| 1202 | MeasElem sub |
| 1203 | } |
| 1204 | |
| 1205 | type record ConnL1Pars { |
| 1206 | boolean dtx_enabled, |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 1207 | boolean toa256_enabled, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1208 | MeasElemFS meas_ul, |
| 1209 | int16_t timing_offset_256syms, |
| 1210 | uint5_t bs_power_level, |
| 1211 | uint5_t ms_power_level, |
| 1212 | uint8_t ms_actual_ta |
| 1213 | } |
| 1214 | |
| 1215 | /* Convert tiing offset from 1/256th symbol to RSL Timing Offset */ |
| 1216 | private function toffs256s_to_rsl(int16_t toffs256s) return uint8_t { |
| 1217 | return 63 + (toffs256s/256); |
| 1218 | } |
| 1219 | |
Harald Welte | d568439 | 2018-03-10 18:22:04 +0100 | [diff] [blame] | 1220 | private function f_max(integer a, integer b) return integer { |
| 1221 | if (a > b) { |
| 1222 | return a; |
| 1223 | } else { |
| 1224 | return b; |
| 1225 | } |
| 1226 | } |
| 1227 | |
| 1228 | private function f_min(integer a, integer b) return integer { |
| 1229 | if (a < b) { |
| 1230 | return a; |
| 1231 | } else { |
| 1232 | return b; |
| 1233 | } |
| 1234 | } |
| 1235 | |
| 1236 | /* compute negative tolerance val-tolerance, ensure >= min */ |
| 1237 | private function f_tolerance_neg(integer val, integer min, integer tolerance) return integer { |
| 1238 | val := val - tolerance; |
| 1239 | return f_max(val, min); |
| 1240 | } |
| 1241 | |
| 1242 | /* compute positive tolerance val+tolerance, ensure <= max */ |
| 1243 | private function f_tolerance_pos(integer val, integer max, integer tolerance) return integer { |
| 1244 | val := val + tolerance; |
| 1245 | return f_min(val, max); |
| 1246 | } |
| 1247 | |
| 1248 | /* return a template of (val-tolerance .. val+tolerance) ensuring it is within (min .. max) */ |
| 1249 | private function f_tolerance(integer val, integer min, integer max, integer tolerance) |
| 1250 | return template integer { |
| 1251 | var template integer ret; |
| 1252 | ret := (f_tolerance_neg(val, min, tolerance) .. f_tolerance_pos(val, max, tolerance)); |
| 1253 | return ret; |
| 1254 | } |
| 1255 | |
| 1256 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1257 | /* build a template for matching measurement results against */ |
| 1258 | private function f_build_meas_res_tmpl() runs on ConnHdlr return template RSL_Message { |
| 1259 | var ConnL1Pars l1p := g_pars.l1_pars; |
| 1260 | var template RSL_IE_UplinkMeas ul_meas := { |
| 1261 | len := 3, |
| 1262 | rfu := '0'B, |
| 1263 | dtx_d := l1p.dtx_enabled, |
Harald Welte | d568439 | 2018-03-10 18:22:04 +0100 | [diff] [blame] | 1264 | rxlev_f_u := f_tolerance(l1p.meas_ul.full.rxlev, 0, 63, mp_tolerance_rxlev), |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1265 | reserved1 := '00'B, |
Harald Welte | d568439 | 2018-03-10 18:22:04 +0100 | [diff] [blame] | 1266 | rxlev_s_u := f_tolerance(l1p.meas_ul.sub.rxlev, 0, 63, mp_tolerance_rxlev), |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1267 | reserved2 := '00'B, |
Harald Welte | d568439 | 2018-03-10 18:22:04 +0100 | [diff] [blame] | 1268 | rxq_f_u := f_tolerance(l1p.meas_ul.full.rxqual, 0, 7, mp_tolerance_rxqual), |
| 1269 | rxq_s_u := f_tolerance(l1p.meas_ul.sub.rxqual, 0, 7, mp_tolerance_rxqual), |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1270 | supp_meas_info := omit |
| 1271 | }; |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 1272 | if (l1p.toa256_enabled) { |
Harald Welte | 15de8ba | 2018-06-29 08:51:42 +0200 | [diff] [blame] | 1273 | ul_meas.len := (3+8); |
| 1274 | ul_meas.supp_meas_info := { |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 1275 | toa256_mean := f_tolerance(l1p.timing_offset_256syms, -63*256, 192*256, mp_tolerance_timing_offset_256syms), |
Harald Welte | 15de8ba | 2018-06-29 08:51:42 +0200 | [diff] [blame] | 1276 | toa256_min := ?, |
| 1277 | toa256_max := ?, |
| 1278 | toa256_std_dev := ? |
| 1279 | } |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 1280 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1281 | var template RSL_IE_BS_Power bs_power := { |
| 1282 | reserved := 0, |
| 1283 | epc := false, |
| 1284 | fpc := false, |
| 1285 | power_level := l1p.bs_power_level |
| 1286 | }; |
| 1287 | var template RSL_IE_L1Info l1_info := { |
| 1288 | ms_power_lvl := l1p.ms_power_level, |
| 1289 | fpc := false, |
| 1290 | reserved := 0, |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 1291 | actual_ta := f_tolerance(l1p.ms_actual_ta, 0, 63, mp_tolerance_timing_offset_256syms/256) |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1292 | }; |
| 1293 | var uint8_t offs := toffs256s_to_rsl(l1p.timing_offset_256syms); |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 1294 | var template uint8_t t_toffs := f_tolerance(offs, 0, 255, mp_tolerance_timing_offset_256syms/256); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1295 | return tr_RSL_MEAS_RES_OSMO(g_chan_nr, g_next_meas_res_nr, ul_meas, bs_power, l1_info, |
| 1296 | ?, t_toffs); |
| 1297 | } |
| 1298 | |
| 1299 | /* verify we regularly receive measurement reports with incrementing numbers */ |
Vadim Yanitskiy | 41baf00 | 2018-10-04 17:44:50 +0700 | [diff] [blame] | 1300 | altstep as_meas_res(boolean verify_meas := true) runs on ConnHdlr { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1301 | var RSL_Message rsl; |
Vadim Yanitskiy | 41baf00 | 2018-10-04 17:44:50 +0700 | [diff] [blame] | 1302 | [not verify_meas] RSL.receive(tr_RSL_MEAS_RES(?)) { repeat; } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1303 | [] RSL.receive(f_build_meas_res_tmpl()) -> value rsl { |
| 1304 | /* increment counter of next to-be-expected meas rep */ |
| 1305 | g_next_meas_res_nr := (g_next_meas_res_nr + 1) mod 256; |
| 1306 | /* Re-start the timer expecting the next MEAS RES */ |
Harald Welte | c3a3f45 | 2018-02-26 17:37:47 +0100 | [diff] [blame] | 1307 | f_timer_safe_restart(g_Tmeas_exp); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1308 | repeat; |
| 1309 | } |
| 1310 | [] RSL.receive(tr_RSL_MEAS_RES(g_chan_nr, g_next_meas_res_nr)) -> value rsl { |
Harald Welte | fa45e9e | 2018-03-10 18:59:03 +0100 | [diff] [blame] | 1311 | /* increment counter of next to-be-expected meas rep */ |
| 1312 | g_next_meas_res_nr := (g_next_meas_res_nr + 1) mod 256; |
| 1313 | if (g_first_meas_res) { |
| 1314 | g_first_meas_res := false; |
| 1315 | repeat; |
| 1316 | } else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1317 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Received unspecific MEAS RES ", rsl)); |
Harald Welte | fa45e9e | 2018-03-10 18:59:03 +0100 | [diff] [blame] | 1318 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1319 | } |
| 1320 | [] RSL.receive(tr_RSL_MEAS_RES(?)) -> value rsl { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1321 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Received unexpected MEAS RES ", rsl)); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1322 | } |
Pau Espin Pedrol | 425b62f | 2018-07-06 16:11:43 +0200 | [diff] [blame] | 1323 | [g_Tmeas_exp.running] g_Tmeas_exp.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1324 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Didn't receive expected measurement result") |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1325 | } |
| 1326 | } |
| 1327 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 1328 | private function f_alg_id_to_l1ctl(RSL_AlgId rsl_alg_id) return uint8_t { |
| 1329 | select (rsl_alg_id) { |
| 1330 | case (RSL_ALG_ID_A5_0) { return 0; } |
| 1331 | case (RSL_ALG_ID_A5_1) { return 1; } |
| 1332 | case (RSL_ALG_ID_A5_2) { return 2; } |
| 1333 | case (RSL_ALG_ID_A5_3) { return 3; } |
| 1334 | case (RSL_ALG_ID_A5_4) { return 4; } |
| 1335 | case (RSL_ALG_ID_A5_5) { return 5; } |
| 1336 | case (RSL_ALG_ID_A5_6) { return 6; } |
| 1337 | case (RSL_ALG_ID_A5_7) { return 7; } |
| 1338 | case else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1339 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unknwon Algorithm ID"); |
| 1340 | /* Make compiler happy by calling mtc.stop here. It is already |
| 1341 | * called in f_shutdown */ |
Daniel Willmann | 17ddd85 | 2018-07-05 17:33:20 +0200 | [diff] [blame] | 1342 | mtc.stop; |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 1343 | } |
| 1344 | } |
| 1345 | } |
| 1346 | |
| 1347 | private function f_alg_id_to_l3(RSL_AlgId rsl_alg_id) return BIT3 { |
| 1348 | select (rsl_alg_id) { |
| 1349 | case (RSL_ALG_ID_A5_1) { return '000'B; } |
| 1350 | case (RSL_ALG_ID_A5_2) { return '001'B; } |
| 1351 | case (RSL_ALG_ID_A5_3) { return '010'B; } |
| 1352 | case (RSL_ALG_ID_A5_4) { return '011'B; } |
| 1353 | case (RSL_ALG_ID_A5_5) { return '100'B; } |
| 1354 | case (RSL_ALG_ID_A5_6) { return '101'B; } |
| 1355 | case (RSL_ALG_ID_A5_7) { return '110'B; } |
| 1356 | case else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1357 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unknwon Algorithm ID"); |
| 1358 | /* Make compiler happy by calling mtc.stop here. It is already |
| 1359 | * called in f_shutdown */ |
Daniel Willmann | 17ddd85 | 2018-07-05 17:33:20 +0200 | [diff] [blame] | 1360 | mtc.stop; |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 1361 | } |
| 1362 | } |
| 1363 | } |
| 1364 | |
Pau Espin Pedrol | 6451b04 | 2018-10-24 20:36:16 +0200 | [diff] [blame] | 1365 | /* Send RACH request through l1CTL and wait for ChanReq on RSL BST->BSC */ |
| 1366 | private function f_rach_req_wait_chan_rqd(integer ra) runs on ConnHdlr return GsmFrameNumber { |
| 1367 | var GsmFrameNumber fn; |
| 1368 | timer T := 8.0; |
| 1369 | |
| 1370 | /* advertise to RSL Emulation that we expect to receive confirmation from RACH */ |
| 1371 | RSL.send(ts_RSLDC_ChanRqd_anyFN(int2oct(ra,1))); |
| 1372 | |
| 1373 | f_L1CTL_PARAM(L1CTL, g_pars.l1_pars.ms_actual_ta, g_pars.l1_pars.ms_power_level); |
| 1374 | /* Send the actual RACH */ |
| 1375 | fn := f_L1CTL_RACH(L1CTL, ra); |
| 1376 | |
| 1377 | T.start; |
| 1378 | alt { |
| 1379 | [] RSL.receive(tr_RSL_CHAN_RQD(int2oct(ra,1), fn)) { setverdict(pass, "Received CHAN-RQD from RACH REQ") } |
| 1380 | [] T.timeout { |
| 1381 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Timeout waiting for CHAN-RQD from RACH REQ <", ra, ", ", fn, ">")); |
| 1382 | } |
| 1383 | } |
| 1384 | T.stop |
| 1385 | return fn; |
| 1386 | } |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 1387 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1388 | /* Establish dedicated channel: L1CTL + RSL side */ |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 1389 | private function f_est_dchan(boolean encr_enable := false) runs on ConnHdlr { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1390 | var GsmFrameNumber fn; |
| 1391 | var ImmediateAssignment imm_ass; |
| 1392 | var integer ra := 23; |
| 1393 | |
Pau Espin Pedrol | 6451b04 | 2018-10-24 20:36:16 +0200 | [diff] [blame] | 1394 | /* Send RACH request and wait for ChanReq */ |
| 1395 | fn := f_rach_req_wait_chan_rqd(ra); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1396 | |
| 1397 | /* Activate channel on BTS side */ |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 1398 | f_rsl_chan_act(g_pars.chan_mode, encr_enable); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1399 | |
| 1400 | /* Send IMM.ASS via CCHAN */ |
| 1401 | var ChannelDescription ch_desc := { |
| 1402 | chan_nr := g_pars.chan_nr, |
| 1403 | tsc := 7, |
| 1404 | h := false, |
| 1405 | arfcn := mp_trx0_arfcn, |
| 1406 | maio_hsn := omit |
| 1407 | }; |
| 1408 | var MobileAllocation ma := { |
| 1409 | len := 0, |
| 1410 | ma := ''B |
| 1411 | }; |
| 1412 | var GsmRrMessage rr_msg := valueof(ts_IMM_ASS(ra, fn, 0, ch_desc, ma)); |
| 1413 | RSL.send(ts_RSL_IMM_ASSIGN(enc_GsmRrMessage(rr_msg))); |
| 1414 | |
| 1415 | /* receive IMM.ASS on MS side */ |
| 1416 | var ImmediateAssignment ia_um; |
| 1417 | ia_um := f_L1CTL_WAIT_IMM_ASS(L1CTL, ra, fn); |
| 1418 | /* enable dedicated mode */ |
| 1419 | f_L1CTL_DM_EST_REQ_IA(L1CTL, ia_um); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 1420 | /* enable encryption, if requested */ |
| 1421 | if (encr_enable) { |
| 1422 | var uint8_t alg_id := f_alg_id_to_l1ctl(g_pars.encr.alg_id); |
| 1423 | f_L1CTL_CRYPTO_REQ(L1CTL, g_pars.chan_nr, alg_id, g_pars.encr.key); |
| 1424 | } |
Harald Welte | fa45e9e | 2018-03-10 18:59:03 +0100 | [diff] [blame] | 1425 | |
| 1426 | g_first_meas_res := true; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1427 | } |
| 1428 | |
| 1429 | /* establish DChan, verify existance + contents of measurement reports */ |
| 1430 | function f_TC_meas_res_periodic(charstring id) runs on ConnHdlr { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1431 | f_l1_tune(L1CTL); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1432 | RSL.clear; |
| 1433 | |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 1434 | if (mp_bts_trxc_port != -1) { |
Pau Espin Pedrol | e9571aa | 2018-10-22 17:13:07 +0200 | [diff] [blame] | 1435 | f_trxc_fake_rssi(rxlev2dbm(mp_ul_rxlev_exp)); |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 1436 | f_trx_fake_toffs256(g_pars.l1_pars.timing_offset_256syms); |
| 1437 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1438 | |
| 1439 | f_est_dchan(); |
| 1440 | |
| 1441 | /* run for a number of seconds, send SACCH + FACCH from MS side and verify |
| 1442 | * RSL measurement reports on Abis side */ |
| 1443 | timer T := 8.0; |
| 1444 | T.start; |
| 1445 | alt { |
| 1446 | [] as_l1_sacch(); |
| 1447 | [] as_meas_res(); |
| 1448 | [] as_l1_dcch(); |
| 1449 | [] L1CTL.receive { repeat; } |
| 1450 | [g_Tmeas_exp.running] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1451 | /* as_meas_res() would have done Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail) in case |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1452 | * of any earlier errors, so if we reach this timeout, we're good */ |
| 1453 | setverdict(pass); |
| 1454 | } |
| 1455 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1456 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "No MEAS RES received at all"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1457 | } |
| 1458 | } |
| 1459 | f_rsl_chan_deact(); |
Harald Welte | 3dc2046 | 2018-03-10 23:03:38 +0100 | [diff] [blame] | 1460 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1461 | } |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 1462 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1463 | testcase TC_meas_res_sign_tchf() runs on test_CT { |
| 1464 | var ConnHdlr vc_conn; |
| 1465 | var ConnHdlrPars pars; |
| 1466 | f_init(testcasename()); |
| 1467 | for (var integer tn := 1; tn <= 4; tn := tn+1) { |
| 1468 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 1469 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars); |
| 1470 | vc_conn.done; |
| 1471 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1472 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1473 | } |
| 1474 | testcase TC_meas_res_sign_tchh() runs on test_CT { |
| 1475 | var ConnHdlr vc_conn; |
| 1476 | var ConnHdlrPars pars; |
| 1477 | f_init(testcasename()); |
| 1478 | for (var integer ss := 0; ss <= 1; ss := ss+1) { |
| 1479 | pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), ts_RSL_ChanMode_SIGN)); |
| 1480 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars); |
| 1481 | vc_conn.done; |
| 1482 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1483 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1484 | } |
| 1485 | testcase TC_meas_res_sign_sdcch4() runs on test_CT { |
| 1486 | var ConnHdlr vc_conn; |
| 1487 | var ConnHdlrPars pars; |
| 1488 | f_init(testcasename()); |
| 1489 | for (var integer ss := 0; ss <= 3; ss := ss+1) { |
| 1490 | pars := valueof(t_Pars(t_RslChanNr_SDCCH4(0, ss), ts_RSL_ChanMode_SIGN)); |
| 1491 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars); |
| 1492 | vc_conn.done; |
| 1493 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1494 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1495 | } |
| 1496 | testcase TC_meas_res_sign_sdcch8() runs on test_CT { |
| 1497 | var ConnHdlr vc_conn; |
| 1498 | var ConnHdlrPars pars; |
| 1499 | f_init(testcasename()); |
| 1500 | for (var integer ss := 0; ss <= 7; ss := ss+1) { |
| 1501 | pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6, ss), ts_RSL_ChanMode_SIGN)); |
| 1502 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars); |
| 1503 | vc_conn.done; |
| 1504 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1505 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1506 | } |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 1507 | testcase TC_meas_res_sign_tchh_toa256() runs on test_CT { |
| 1508 | var ConnHdlr vc_conn; |
| 1509 | var ConnHdlrPars pars; |
| 1510 | f_init(testcasename()); |
| 1511 | f_vty_config(BTSVTY, "bts 0", "supp-meas-info toa256"); |
| 1512 | for (var integer ss := 0; ss <= 1; ss := ss+1) { |
| 1513 | pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), ts_RSL_ChanMode_SIGN)); |
| 1514 | pars.l1_pars.toa256_enabled := true; |
| 1515 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars); |
| 1516 | vc_conn.done; |
| 1517 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1518 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 1519 | } |
| 1520 | |
Philipp Maier | 4d1e9c9 | 2018-12-20 11:11:56 +0100 | [diff] [blame] | 1521 | /* establish DChan, and send MS POWER CONTROL messages via RSL, verify that |
| 1522 | * the BTS is forwarding those values to the MS via the SACCH L1 header. */ |
| 1523 | function f_tc_rsl_ms_pwr_ctrl(charstring id) runs on ConnHdlr { |
| 1524 | var L1ctlDlMessage l1_dl; |
| 1525 | var RSL_IE_MS_Power ms_power; |
| 1526 | var RSL_Message rsl; |
| 1527 | var uint5_t power_level := 0; |
| 1528 | |
| 1529 | f_l1_tune(L1CTL); |
| 1530 | RSL.clear; |
| 1531 | |
| 1532 | f_est_dchan(); |
| 1533 | |
| 1534 | ms_power.reserved := 0; |
| 1535 | ms_power.fpc_epc := false; |
| 1536 | |
| 1537 | /* Send the first power control command. This will disable any BTS/TRX |
| 1538 | * internal power control and switch the MS (which is not in scope of |
| 1539 | * this test) to a constant power level. We start with a power level |
| 1540 | * of 0 */ |
| 1541 | ms_power.power_level := power_level; |
| 1542 | rsl := valueof(ts_RSL_MS_PWR_CTRL(g_chan_nr, ms_power)); |
| 1543 | RSL.send(rsl); |
| 1544 | |
| 1545 | alt { |
| 1546 | |
| 1547 | /* Pick all SACCH blocks for checking */ |
| 1548 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
| 1549 | |
| 1550 | /* The first byte of the L1 header contains the power level. |
| 1551 | * The reserved bits and the fpc bit is set to 0, so we may |
| 1552 | * compare directly. */ |
| 1553 | if (not (l1_dl.payload.data_ind.payload[0] == int2oct(power_level, 1))) { |
| 1554 | setverdict(fail, "Power level in L1 header does not match the signaled (RSL) power level."); |
| 1555 | } |
| 1556 | |
| 1557 | /* Signal a new power level via RSL for the next turn. */ |
| 1558 | if (power_level < 31) { |
| 1559 | power_level := power_level + 1; |
| 1560 | ms_power.power_level := power_level; |
| 1561 | rsl := valueof(ts_RSL_MS_PWR_CTRL(g_chan_nr, ms_power)); |
| 1562 | RSL.send(rsl); |
| 1563 | repeat; |
| 1564 | } |
| 1565 | |
| 1566 | } |
| 1567 | |
| 1568 | /* Ignore all other blocks */ |
| 1569 | [] L1CTL.receive { repeat; } |
| 1570 | |
| 1571 | } |
| 1572 | |
| 1573 | f_rsl_chan_deact(); |
| 1574 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1575 | |
| 1576 | setverdict(pass); |
| 1577 | } |
| 1578 | |
| 1579 | testcase TC_rsl_ms_pwr_ctrl() runs on test_CT { |
| 1580 | var ConnHdlr vc_conn; |
| 1581 | var ConnHdlrPars pars; |
| 1582 | f_init(testcasename()); |
| 1583 | |
| 1584 | for (var integer tn := 1; tn <= 4; tn := tn+1) { |
| 1585 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 1586 | vc_conn := f_start_handler(refers(f_tc_rsl_ms_pwr_ctrl), pars); |
| 1587 | vc_conn.done; |
| 1588 | } |
| 1589 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 1590 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1591 | |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 1592 | /* Test if a channel without valid uplink bursts generates RSL CONN FAIL IND (TS 48.058 4.10) */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1593 | private function f_TC_conn_fail_crit(charstring id) runs on ConnHdlr { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1594 | f_l1_tune(L1CTL); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1595 | RSL.clear; |
| 1596 | |
| 1597 | f_est_dchan(); |
| 1598 | f_sleep(2.0); |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 1599 | L1CTL.send(ts_L1CTL_DM_REL_REQ(g_chan_nr)); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1600 | |
| 1601 | timer T := 40.0; |
| 1602 | T.start; |
| 1603 | alt { |
| 1604 | [] RSL.receive(tr_RSL_CONN_FAIL_IND(g_chan_nr, ?)) { |
| 1605 | setverdict(pass) |
| 1606 | } |
| 1607 | [] RSL.receive { repeat }; |
| 1608 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1609 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "No CONN FAIL IND received"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1610 | } |
| 1611 | } |
| 1612 | f_rsl_chan_deact(); |
| 1613 | } |
| 1614 | testcase TC_conn_fail_crit() runs on test_CT { |
| 1615 | var ConnHdlr vc_conn; |
| 1616 | var ConnHdlrPars pars; |
| 1617 | f_init(testcasename()); |
| 1618 | pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6, 3), ts_RSL_ChanMode_SIGN)); |
| 1619 | pars.t_guard := 60.0; |
| 1620 | vc_conn := f_start_handler(refers(f_TC_conn_fail_crit), pars); |
| 1621 | vc_conn.done; |
| 1622 | } |
| 1623 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 1624 | /*********************************************************************** |
| 1625 | * Paging |
| 1626 | ***********************************************************************/ |
| 1627 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1628 | function tmsi_is_dummy(TMSIP_TMSI_V tmsi) return boolean { |
| 1629 | if (tmsi == 'FFFFFFFF'O) { |
| 1630 | return true; |
| 1631 | } else { |
| 1632 | return false; |
| 1633 | } |
| 1634 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1635 | |
Philipp Maier | 82cb0b1 | 2018-08-31 14:41:39 +0200 | [diff] [blame] | 1636 | type record allowedFn { integer frame_nr } |
| 1637 | template allowedFn bs_ag_blks_res_0 := { frame_nr := (6, 12, 16, 22, 26, 32, 36, 42, 46) } |
| 1638 | template allowedFn bs_ag_blks_res_1 := { frame_nr := (12, 16, 22, 26, 32, 36, 42, 46) } |
| 1639 | template allowedFn bs_ag_blks_res_2 := { frame_nr := (16, 22, 26, 32, 36, 42, 46) } |
| 1640 | template allowedFn bs_ag_blks_res_3 := { frame_nr := (22, 26, 32, 36, 42, 46) } |
| 1641 | template allowedFn bs_ag_blks_res_4 := { frame_nr := (26, 32, 36, 42, 46) } |
| 1642 | template allowedFn bs_ag_blks_res_5 := { frame_nr := (32, 36, 42, 46) } |
| 1643 | template allowedFn bs_ag_blks_res_6 := { frame_nr := (36, 42, 46) } |
| 1644 | template allowedFn bs_ag_blks_res_7 := { frame_nr := (42, 46) } |
| 1645 | function check_pch_fn(integer frame_nr, integer bs_ag_blks_res) runs on test_CT |
| 1646 | { |
| 1647 | var integer frame_nr_51; |
| 1648 | frame_nr_51 := frame_nr mod 51 |
| 1649 | |
| 1650 | var allowedFn fn_check; |
| 1651 | fn_check.frame_nr := frame_nr_51; |
| 1652 | |
| 1653 | if (bs_ag_blks_res < 0 or bs_ag_blks_res > 7) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1654 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "bs_ag_blks_res out of valid range (0..7)"); |
Philipp Maier | 82cb0b1 | 2018-08-31 14:41:39 +0200 | [diff] [blame] | 1655 | return; |
| 1656 | } |
| 1657 | |
| 1658 | if (bs_ag_blks_res == 0 and match(fn_check, bs_ag_blks_res_0)) { |
| 1659 | return; |
| 1660 | } |
| 1661 | if (bs_ag_blks_res == 1 and match(fn_check, bs_ag_blks_res_1)) { |
| 1662 | return; |
| 1663 | } |
| 1664 | if (bs_ag_blks_res == 2 and match(fn_check, bs_ag_blks_res_2)) { |
| 1665 | return; |
| 1666 | } |
| 1667 | if (bs_ag_blks_res == 3 and match(fn_check, bs_ag_blks_res_3)) { |
| 1668 | return; |
| 1669 | } |
| 1670 | if (bs_ag_blks_res == 4 and match(fn_check, bs_ag_blks_res_4)) { |
| 1671 | return; |
| 1672 | } |
| 1673 | if (bs_ag_blks_res == 5 and match(fn_check, bs_ag_blks_res_5)) { |
| 1674 | return; |
| 1675 | } |
| 1676 | if (bs_ag_blks_res == 6 and match(fn_check, bs_ag_blks_res_6)) { |
| 1677 | return; |
| 1678 | } |
| 1679 | if (bs_ag_blks_res == 7 and match(fn_check, bs_ag_blks_res_7)) { |
| 1680 | return; |
| 1681 | } |
| 1682 | |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1683 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "received paging on AGCH"); |
Philipp Maier | 82cb0b1 | 2018-08-31 14:41:39 +0200 | [diff] [blame] | 1684 | return; |
| 1685 | } |
| 1686 | |
| 1687 | altstep as_l1_count_paging(inout integer num_paging_rcv_msgs, inout integer num_paging_rcv_ids, PagingTestCfg cfg) |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1688 | runs on test_CT { |
| 1689 | var L1ctlDlMessage dl; |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 1690 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?, c_DummyUI)) { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1691 | repeat; |
| 1692 | } |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 1693 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0))) -> value dl { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1694 | var octetstring without_plen := |
| 1695 | substr(dl.payload.data_ind.payload, 1, lengthof(dl.payload.data_ind.payload)-1); |
| 1696 | var PDU_ML3_NW_MS rr := dec_PDU_ML3_NW_MS(without_plen); |
Philipp Maier | 82cb0b1 | 2018-08-31 14:41:39 +0200 | [diff] [blame] | 1697 | |
| 1698 | check_pch_fn(dl.dl_info.frame_nr, cfg.bs_ag_blks_res); |
| 1699 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1700 | if (match(rr, tr_PAGING_REQ1)) { |
| 1701 | num_paging_rcv_msgs := num_paging_rcv_msgs + 1; |
| 1702 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 1703 | if (isvalue(rr.msgs.rrm.pagingReq_Type1.mobileIdentity2)) { |
| 1704 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 1705 | } |
| 1706 | } else if (match(rr, tr_PAGING_REQ2)) { |
| 1707 | num_paging_rcv_msgs := num_paging_rcv_msgs + 1; |
| 1708 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type2.mobileIdentity1)) { |
| 1709 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 1710 | } |
| 1711 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type2.mobileIdentity2)) { |
| 1712 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 1713 | } |
| 1714 | if (isvalue(rr.msgs.rrm.pagingReq_Type2.mobileIdentity3)) { |
| 1715 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 1716 | } |
| 1717 | } else if (match(rr, tr_PAGING_REQ3)) { |
| 1718 | num_paging_rcv_msgs := num_paging_rcv_msgs + 1; |
| 1719 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity1)) { |
| 1720 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 1721 | } |
| 1722 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity2)) { |
| 1723 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 1724 | } |
| 1725 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity3)) { |
| 1726 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 1727 | } |
| 1728 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity4)) { |
| 1729 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 1730 | } |
| 1731 | } |
| 1732 | repeat; |
| 1733 | } |
| 1734 | } |
| 1735 | |
| 1736 | type record PagingTestCfg { |
| 1737 | boolean combined_ccch, |
| 1738 | integer bs_ag_blks_res, |
| 1739 | float load_factor, |
| 1740 | boolean exp_load_ind, |
| 1741 | boolean exp_overload, |
| 1742 | boolean use_tmsi |
| 1743 | } |
| 1744 | |
| 1745 | type record PagingTestState { |
| 1746 | integer num_paging_sent, |
| 1747 | integer num_paging_rcv_msgs, |
| 1748 | integer num_paging_rcv_ids, |
| 1749 | integer num_overload |
| 1750 | } |
| 1751 | |
| 1752 | /* receive + ignore RSL RF RES IND */ |
| 1753 | altstep as_rsl_res_ind() runs on test_CT { |
| 1754 | [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_RF_RES_IND)) { |
| 1755 | repeat; |
| 1756 | } |
| 1757 | } |
| 1758 | |
| 1759 | /* Helper function for paging related testing */ |
| 1760 | private function f_TC_paging(PagingTestCfg cfg) runs on test_CT return PagingTestState { |
| 1761 | f_init(testcasename()); |
| 1762 | f_init_l1ctl(); |
| 1763 | f_l1_tune(L1CTL); |
| 1764 | |
| 1765 | var PagingTestState st := { |
| 1766 | num_paging_sent := 0, |
| 1767 | num_paging_rcv_msgs := 0, |
| 1768 | num_paging_rcv_ids := 0, |
| 1769 | num_overload := 0 |
| 1770 | }; |
| 1771 | |
| 1772 | var float max_pch_blocks_per_sec := f_pch_block_rate_est(cfg.combined_ccch, cfg.bs_ag_blks_res); |
| 1773 | var float max_pch_imsi_per_sec; |
| 1774 | if (cfg.use_tmsi) { |
| 1775 | max_pch_imsi_per_sec := max_pch_blocks_per_sec * 4.0; /* Type 3 */ |
| 1776 | } else { |
| 1777 | max_pch_imsi_per_sec := max_pch_blocks_per_sec * 2.0; /* Type 1 */ |
| 1778 | } |
| 1779 | var float pch_blocks_per_sec := max_pch_imsi_per_sec * cfg.load_factor; |
| 1780 | var float interval := 1.0 / pch_blocks_per_sec; |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 1781 | var float time_total := 20.0; |
| 1782 | var integer pkt_total := float2int(time_total * pch_blocks_per_sec); |
| 1783 | log("pch_blocks_total=", pkt_total," pch_blocks_per_sec=", pch_blocks_per_sec, " interval=", interval); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1784 | |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 1785 | timer T_total := 300.0; /* big value (far bigger than time_total), used to count elapsed time */ |
| 1786 | T_total.start; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1787 | |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 1788 | timer T_itv := 0.0; |
| 1789 | T_itv.start; |
| 1790 | while (st.num_paging_sent < pkt_total) { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1791 | alt { |
| 1792 | /* check for presence of CCCH LOAD IND (paging load) */ |
| 1793 | [cfg.exp_overload] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND(0))) { |
| 1794 | st.num_overload := st.num_overload + 1; |
| 1795 | repeat; |
| 1796 | } |
| 1797 | [not cfg.exp_overload] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND(0))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1798 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected PCH Overload"); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1799 | } |
| 1800 | [cfg.exp_load_ind] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND)) { |
| 1801 | log("Rx LOAD_IND"); |
| 1802 | /* FIXME: analyze/verify interval + contents */ |
| 1803 | repeat; |
| 1804 | } |
| 1805 | /* check if paging requests arrive on Um side */ |
Philipp Maier | 82cb0b1 | 2018-08-31 14:41:39 +0200 | [diff] [blame] | 1806 | [] as_l1_count_paging(st.num_paging_rcv_msgs, st.num_paging_rcv_ids, cfg); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1807 | [] L1CTL.receive { repeat; } |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 1808 | [] T_itv.timeout { |
| 1809 | /* Send paging cmds based on elapsed time */ |
| 1810 | var integer new_sent := f_min(pkt_total, float2int(T_total.read * pch_blocks_per_sec) + 1); |
| 1811 | while (st.num_paging_sent < new_sent) { |
| 1812 | /* build mobile Identity */ |
| 1813 | var MobileL3_CommonIE_Types.MobileIdentityLV mi; |
| 1814 | if (cfg.use_tmsi) { |
| 1815 | mi := valueof(ts_MI_TMSI_LV(f_rnd_octstring(4))); |
| 1816 | } else { |
| 1817 | mi := valueof(ts_MI_IMSI_LV(f_gen_imsi(st.num_paging_sent))); |
| 1818 | } |
| 1819 | var octetstring mi_enc_lv := enc_MobileIdentityLV(mi); |
| 1820 | var octetstring mi_enc := substr(mi_enc_lv, 1, lengthof(mi_enc_lv)-1); |
| 1821 | |
| 1822 | /* Send RSL PAGING COMMAND */ |
| 1823 | RSL_CCHAN.send(ts_RSL_UD(ts_RSL_PAGING_CMD(mi_enc, st.num_paging_sent mod 4))); |
| 1824 | |
| 1825 | st.num_paging_sent := st.num_paging_sent + 1; |
| 1826 | } |
| 1827 | if (st.num_paging_sent < pkt_total) { |
| 1828 | /* Wait for interval to next PAGING COMMAND */ |
| 1829 | var float time_now := T_total.read; |
| 1830 | var float next_sched := int2float(st.num_paging_sent)*interval; |
| 1831 | if (next_sched > time_now) { |
| 1832 | T_itv.start(next_sched - time_now); |
| 1833 | } else { |
| 1834 | T_itv.start(0.0); |
| 1835 | } |
| 1836 | } else { |
| 1837 | /* We are done, no need to keep counting */ |
| 1838 | T_total.stop; |
| 1839 | } |
| 1840 | } |
| 1841 | [] T_total.timeout { } |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1842 | [] as_rsl_res_ind(); |
| 1843 | } |
| 1844 | } |
| 1845 | |
| 1846 | /* wait for max 18s for paging queue to drain (size: 200, ~ 13 per s -> 15s) */ |
| 1847 | timer T_wait := 18.0; |
| 1848 | T_wait.start; |
| 1849 | alt { |
Philipp Maier | 82cb0b1 | 2018-08-31 14:41:39 +0200 | [diff] [blame] | 1850 | [] as_l1_count_paging(st.num_paging_rcv_msgs, st.num_paging_rcv_ids, cfg); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1851 | [] L1CTL.receive { repeat; } |
| 1852 | /* 65535 == empty paging queue, we can terminate*/ |
| 1853 | [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND(65535))) { } |
| 1854 | [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND)) { repeat; } |
| 1855 | [] T_wait.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1856 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Waiting for empty paging queue"); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1857 | } |
| 1858 | [] as_rsl_res_ind(); |
| 1859 | } |
| 1860 | |
| 1861 | log("num_paging_sent=", st.num_paging_sent, " rcvd_msgs=", st.num_paging_rcv_msgs, |
| 1862 | " rcvd_ids=", st.num_paging_rcv_ids); |
| 1863 | return st; |
| 1864 | } |
| 1865 | |
| 1866 | /* Create ~ 80% paging load (IMSI only) sustained for about 20s, verifying that |
| 1867 | * - the number of Mobile Identities on Um PCH match the number of pages on RSL |
| 1868 | * - that CCCH LOAD IND (PCH) are being generated |
| 1869 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 1870 | testcase TC_paging_imsi_80percent() runs on test_CT { |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 1871 | var SystemInformation si3 := valueof(ts_SI3_default); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1872 | var PagingTestCfg cfg := { |
| 1873 | combined_ccch := true, |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 1874 | bs_ag_blks_res := si3.payload.si3.ctrl_chan_desc.bs_ag_blks_res, |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1875 | load_factor := 0.8, |
| 1876 | exp_load_ind := true, |
| 1877 | exp_overload := false, |
| 1878 | use_tmsi := false |
| 1879 | }; |
| 1880 | var PagingTestState st := f_TC_paging(cfg); |
| 1881 | if (st.num_paging_sent != st.num_paging_rcv_ids) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1882 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Expected ", st.num_paging_sent, " pagings but have ", |
| 1883 | st.num_paging_rcv_ids)); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1884 | } else { |
| 1885 | setverdict(pass); |
| 1886 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1887 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1888 | } |
| 1889 | |
| 1890 | /* Create ~ 80% paging load (TMSI only) sustained for about 20s, verifying that |
| 1891 | * - the number of Mobile Identities on Um PCH match the number of pages on RSL |
| 1892 | * - that CCCH LOAD IND (PCH) are being generated |
| 1893 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 1894 | testcase TC_paging_tmsi_80percent() runs on test_CT { |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 1895 | var SystemInformation si3 := valueof(ts_SI3_default); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1896 | var PagingTestCfg cfg := { |
| 1897 | combined_ccch := true, |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 1898 | bs_ag_blks_res := si3.payload.si3.ctrl_chan_desc.bs_ag_blks_res, |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1899 | load_factor := 0.8, |
| 1900 | exp_load_ind := true, |
| 1901 | exp_overload := false, |
| 1902 | use_tmsi := true |
| 1903 | }; |
| 1904 | var PagingTestState st := f_TC_paging(cfg); |
| 1905 | if (st.num_paging_sent != st.num_paging_rcv_ids) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1906 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Expected ", st.num_paging_sent, " pagings but have ", |
| 1907 | st.num_paging_rcv_ids)); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1908 | } else { |
| 1909 | setverdict(pass); |
| 1910 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1911 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1912 | } |
| 1913 | |
| 1914 | /* Create ~ 200% paging load (IMSI only) sustained for about 20s, verifying that |
| 1915 | * - the number of Mobile Identities on Um PCH are ~ 82% of the number of pages on RSL |
| 1916 | * - that CCCH LOAD IND (PCH) are being generated and reach 0 at some point |
| 1917 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 1918 | testcase TC_paging_imsi_200percent() runs on test_CT { |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 1919 | var SystemInformation si3 := valueof(ts_SI3_default); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1920 | var PagingTestCfg cfg := { |
| 1921 | combined_ccch := true, |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 1922 | bs_ag_blks_res := si3.payload.si3.ctrl_chan_desc.bs_ag_blks_res, |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1923 | load_factor := 2.0, |
| 1924 | exp_load_ind := true, |
| 1925 | exp_overload := true, |
| 1926 | use_tmsi := false |
| 1927 | }; |
| 1928 | var PagingTestState st := f_TC_paging(cfg); |
| 1929 | /* We expect about 80-85% to pass, given that we can fill the paging buffer of 200 |
| 1930 | * slots and will fully drain that buffer before returning */ |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 1931 | var template integer tpl := (st.num_paging_sent*78/100 .. st.num_paging_sent *85/100); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1932 | if (not match(st.num_paging_rcv_ids, tpl)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1933 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Expected ", tpl, " pagings but have ", st.num_paging_rcv_ids)); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1934 | } else { |
| 1935 | setverdict(pass); |
| 1936 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1937 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1938 | } |
| 1939 | |
| 1940 | /* Create ~ 200% paging load (TMSI only) sustained for about 20s, verifying that |
| 1941 | * - the number of Mobile Identities on Um PCH are ~ 82% of the number of pages on RSL |
| 1942 | * - that CCCH LOAD IND (PCH) are being generated and reach 0 at some point |
| 1943 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 1944 | testcase TC_paging_tmsi_200percent() runs on test_CT { |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 1945 | var SystemInformation si3 := valueof(ts_SI3_default); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1946 | var PagingTestCfg cfg := { |
| 1947 | combined_ccch := true, |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 1948 | bs_ag_blks_res := si3.payload.si3.ctrl_chan_desc.bs_ag_blks_res, |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1949 | load_factor := 2.0, |
| 1950 | exp_load_ind := true, |
| 1951 | exp_overload := true, |
| 1952 | use_tmsi := true |
| 1953 | }; |
| 1954 | var PagingTestState st := f_TC_paging(cfg); |
| 1955 | /* We expect about 70% to pass, given that we can fill the paging buffer of 200 |
| 1956 | * slots and will fully drain that buffer before returning */ |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 1957 | var template integer tpl := (st.num_paging_sent*64/100 .. st.num_paging_sent *72/100); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1958 | if (not match(st.num_paging_rcv_ids, tpl)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1959 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Expected ", tpl, " pagings but have ", st.num_paging_rcv_ids)); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1960 | } else { |
| 1961 | setverdict(pass); |
| 1962 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1963 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1964 | } |
| 1965 | |
| 1966 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 1967 | /*********************************************************************** |
| 1968 | * Immediate Assignment / AGCH |
| 1969 | ***********************************************************************/ |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 1970 | const MobileAllocation c_MA_null := { |
| 1971 | len := 0, |
| 1972 | ma := ''B |
| 1973 | } |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 1974 | |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 1975 | template (value) ChannelDescription ts_ChanDesc(template (value) RslChannelNr chan_nr, uint3_t tsc := 7, |
| 1976 | uint12_t arfcn := 871) := { |
| 1977 | chan_nr := chan_nr, |
| 1978 | tsc := tsc, |
| 1979 | h := false, |
| 1980 | arfcn := arfcn, |
| 1981 | maio_hsn := omit |
| 1982 | } |
| 1983 | |
| 1984 | private function f_fmt_ia_stats(integer num_tx, integer num_rx, integer num_del) return charstring { |
| 1985 | return int2str(num_tx) & " sent, " |
| 1986 | & int2str(num_rx) & " received, " |
| 1987 | & int2str(num_del) & " deleted"; |
| 1988 | } |
| 1989 | |
| 1990 | private function f_TC_imm_ass(integer num_total, float sleep_s, float exp_pass) runs on test_CT { |
| 1991 | var L1ctlDlMessage l1_dl; |
| 1992 | timer T := 10.0; |
| 1993 | var integer num_tx := 0; |
| 1994 | var integer num_rx := 0; |
| 1995 | var integer num_del := 0; |
| 1996 | var charstring res_str; |
| 1997 | var float rx_ratio; |
| 1998 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1999 | f_init(testcasename()); |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 2000 | f_init_l1ctl(); |
| 2001 | f_l1_tune(L1CTL); |
| 2002 | |
| 2003 | for (var integer i := 0; i < num_total; i := i+1) { |
| 2004 | var ChannelDescription ch_desc := valueof(ts_ChanDesc(valueof(t_RslChanNr_SDCCH4(0, 0)))); |
| 2005 | var GsmRrMessage ia := valueof(ts_IMM_ASS(42, i, 5, ch_desc, c_MA_null)); |
| 2006 | var octetstring ia_enc := enc_GsmRrMessage(ia); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 2007 | RSL_CCHAN.send(ts_RSL_UD(ts_RSL_IMM_ASSIGN(ia_enc, 0))); |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 2008 | num_tx := num_tx+1; |
| 2009 | f_sleep(sleep_s); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 2010 | } |
| 2011 | /* FIXME: check if imm.ass arrive on Um side */ |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 2012 | T.start; |
| 2013 | alt { |
| 2014 | [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_DELETE_IND(?, 0))) { |
| 2015 | num_del := num_del+1; |
| 2016 | repeat; |
| 2017 | } |
| 2018 | [] RSL_CCHAN.receive { |
| 2019 | repeat; |
| 2020 | } |
| 2021 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?)) -> value l1_dl { |
| 2022 | /* somehow dec_SystemInformation will try to decode even non-RR as SI */ |
| 2023 | var GsmRrMessage rr := dec_GsmRrMessage(l1_dl.payload.data_ind.payload); |
| 2024 | if (not match(rr, tr_IMM_ASS(42, ?, 5, ?, ?))) { |
| 2025 | /* FIXME: Why are we seeing paging requests on PCH/AGCH? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2026 | //Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Unexpected IMM-ASS values on AGCH: ", rr)); |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 2027 | } else { |
| 2028 | num_rx := num_rx+1; |
| 2029 | } |
| 2030 | repeat; |
| 2031 | } |
| 2032 | [] L1CTL.receive { repeat; } |
| 2033 | [] T.timeout { } |
| 2034 | } |
| 2035 | res_str := f_fmt_ia_stats(num_tx, num_rx, num_del); |
| 2036 | log("AGCH test: " & res_str); |
| 2037 | if (num_rx + num_del != num_tx) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2038 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "RX + DEL != TX ?!?: " & res_str); |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 2039 | } |
| 2040 | rx_ratio := int2float(num_rx) / int2float(num_tx); |
| 2041 | if (rx_ratio < exp_pass*0.8 or rx_ratio > exp_pass*1.2) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2042 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "RX ratio ("&float2str(rx_ratio)&") far from expected ("&float2str(exp_pass)&") " & res_str); |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 2043 | } else { |
| 2044 | setverdict(pass); |
| 2045 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2046 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 2047 | } |
| 2048 | |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 2049 | /* send a long burst of 1000 IMM.ASS with 20ms spacing (50 per s); expect 75% of them to be deleted */ |
| 2050 | testcase TC_imm_ass_1000_20ms() runs on test_CT { |
| 2051 | f_TC_imm_ass(1000, 0.02, 0.25); |
| 2052 | } |
| 2053 | |
| 2054 | /* send a short burst of 200 IMM.ASS without any spacing; expect 95% of them to be deleted */ |
| 2055 | testcase TC_imm_ass_200_0ms() runs on test_CT { |
| 2056 | f_TC_imm_ass(200, 0.0, 0.05); |
| 2057 | } |
| 2058 | |
| 2059 | /* send 150 IMM.ASS at rate of 13/s; expect none of them to be deleted */ |
| 2060 | testcase TC_imm_ass_200_76ms() runs on test_CT { |
| 2061 | f_TC_imm_ass(150, 0.076, 1.00); |
| 2062 | } |
| 2063 | |
| 2064 | |
| 2065 | |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2066 | /*********************************************************************** |
| 2067 | * BCCH |
| 2068 | ***********************************************************************/ |
| 2069 | |
| 2070 | /* tuple of Frame Number + decoded SI */ |
| 2071 | type record SystemInformationFn { |
| 2072 | GsmFrameNumber frame_number, |
| 2073 | SystemInformation si |
| 2074 | } |
| 2075 | |
| 2076 | /* an arbitrary-length vector of decoded SI + gsmtap header */ |
| 2077 | type record of SystemInformationFn SystemInformationVector; |
| 2078 | |
| 2079 | /* an array of SI-vectors indexed by TC value */ |
| 2080 | type SystemInformationVector SystemInformationVectorPerTc[8]; |
| 2081 | |
| 2082 | /* determine if a given SI vector contains given SI type at least once */ |
| 2083 | function f_si_vecslot_contains(SystemInformationVector arr, RrMessageType key, boolean bcch_ext := false) return boolean { |
| 2084 | for (var integer i:= 0; i< sizeof(arr); i := i + 1) { |
| 2085 | var integer fn_mod51 := arr[i].frame_number mod 51; |
| 2086 | if (not bcch_ext and fn_mod51 == 2 or |
| 2087 | bcch_ext and fn_mod51 == 6) { |
| 2088 | if (arr[i].si.header.message_type == key) { |
| 2089 | return true; |
| 2090 | } |
| 2091 | } |
| 2092 | } |
| 2093 | return false; |
| 2094 | } |
| 2095 | |
| 2096 | /* ensure a given TC slot of the SI vector contains given SI type at least once at TC */ |
| 2097 | function f_ensure_si_vec_contains(SystemInformationVectorPerTc arr, integer tc, RrMessageType key, boolean ext_bcch := false) { |
| 2098 | if (not f_si_vecslot_contains(arr[tc], key, ext_bcch)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2099 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("No ", key, " in TC=", tc, "!")); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2100 | } |
| 2101 | } |
| 2102 | |
| 2103 | /* check if a given SI vector contains given SI type at least once on any TC */ |
| 2104 | function f_si_vec_contains(SystemInformationVectorPerTc arr, RrMessageType key) return boolean { |
| 2105 | for (var integer tc:= 0; tc < sizeof(arr); tc := tc + 1) { |
| 2106 | if (f_si_vecslot_contains(arr[tc], key) or |
| 2107 | f_si_vecslot_contains(arr[tc], key, true)) { |
| 2108 | return true; |
| 2109 | } |
| 2110 | } |
| 2111 | return false; |
| 2112 | } |
| 2113 | |
| 2114 | /* determine if a given SI vector contains given SI type at least N of M times */ |
| 2115 | function f_si_vecslot_contains_n_of_m(SystemInformationVector arr, RrMessageType key, boolean bcch_ext := false, integer n := 1, integer m := 4) return boolean { |
| 2116 | var integer count := 0; |
| 2117 | if (sizeof(arr) < m) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2118 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Error: Insufficient SI in array"); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2119 | } |
| 2120 | for (var integer i:= 0; i < m; i := i + 1) { |
| 2121 | var integer fn_mod51 := arr[i].frame_number mod 51; |
| 2122 | if (not bcch_ext and fn_mod51 == 2 or |
| 2123 | bcch_ext and fn_mod51 == 6) { |
| 2124 | if (arr[i].si.header.message_type == key) { |
| 2125 | count := count + 1; |
| 2126 | } |
| 2127 | } |
| 2128 | } |
| 2129 | if (count >= n) { |
| 2130 | return true; |
| 2131 | } else { |
| 2132 | return false; |
| 2133 | } |
| 2134 | } |
| 2135 | |
| 2136 | /* ensure a given TC slot of the SI vector contains given SI type at least N out of M times at TC */ |
| 2137 | function f_ensure_si_vec_contains_n_of_m(SystemInformationVectorPerTc arr, integer tc, RrMessageType key, boolean ext_bcch := false, integer n, integer m) { |
| 2138 | if (not f_si_vecslot_contains_n_of_m(arr[tc], key, ext_bcch, n, m)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2139 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Not ", n, "/", m, " of ", key, " in TC=", tc, "!")); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2140 | } |
| 2141 | } |
| 2142 | |
| 2143 | /* determine if a given SI vector contains given SI type at least once */ |
| 2144 | function f_si_vecslot_contains_only(SystemInformationVector arr, RrMessageType key, boolean bcch_ext := false) return boolean { |
| 2145 | for (var integer i:= 0; i< sizeof(arr); i := i + 1) { |
| 2146 | var integer fn_mod51 := arr[i].frame_number mod 51; |
| 2147 | if (not bcch_ext and fn_mod51 == 2 or |
| 2148 | bcch_ext and fn_mod51 == 6) { |
| 2149 | if (arr[i].si.header.message_type != key) { |
| 2150 | return false; |
| 2151 | } |
| 2152 | } |
| 2153 | } |
| 2154 | return true; |
| 2155 | } |
| 2156 | |
| 2157 | /* ensure a given TC slot of the SI vector contains only given SI type */ |
| 2158 | function f_ensure_si_vec_contains_only(SystemInformationVectorPerTc arr, integer tc, RrMessageType key, boolean ext_bcch := false) { |
| 2159 | if (not f_si_vecslot_contains_only(arr[tc], key, ext_bcch)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2160 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Not all ", key, " in TC=", tc, "!")); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2161 | } |
| 2162 | } |
| 2163 | |
| 2164 | /* SI configuration of cell, against which we validate actual SI messages */ |
| 2165 | type set SystemInformationConfig { |
| 2166 | boolean bcch_extended, |
| 2167 | boolean si1_present, |
| 2168 | boolean si2bis_present, |
| 2169 | boolean si2ter_present, |
| 2170 | boolean si2quater_present, |
| 2171 | boolean si7_present, |
| 2172 | boolean si8_present, |
| 2173 | boolean si9_present, |
| 2174 | boolean si13_present, |
| 2175 | boolean si13alt_present, |
| 2176 | boolean si15_present, |
| 2177 | boolean si16_present, |
| 2178 | boolean si17_present, |
| 2179 | boolean si2n_present, |
| 2180 | boolean si21_present, |
| 2181 | boolean si22_present |
| 2182 | } |
| 2183 | |
| 2184 | /* validate the SI scheduling according to TS 45.002 version 14.1.0 Release 14, Section 6.3.1.3 */ |
| 2185 | function f_validate_si_scheduling(SystemInformationConfig cfg, SystemInformationVectorPerTc si_per_tc) { |
| 2186 | var integer i; |
| 2187 | for (i := 0; i < sizeof(si_per_tc); i := i + 1) { |
| 2188 | if (sizeof(si_per_tc[i]) == 0) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2189 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("No SI messages for TC=", i)); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2190 | } |
| 2191 | } |
| 2192 | if (cfg.si1_present) { |
| 2193 | /* ii) System Information Type 1 needs to be sent if frequency hopping is in use or |
| 2194 | * when the NCH is present in a cell. If the MS finds another message on BCCH Norm |
| 2195 | * when TC = 0, it can assume that System Information Type 1 is not in use. */ |
| 2196 | f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_1); |
| 2197 | /* make sure *ALL* contain SI1 */ |
| 2198 | f_ensure_si_vec_contains_only(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_1); |
| 2199 | } |
| 2200 | f_ensure_si_vec_contains(si_per_tc, 1, SYSTEM_INFORMATION_TYPE_2); |
| 2201 | /* iii) A SI 2 message will be sent at least every time TC = 1 */ |
| 2202 | f_ensure_si_vec_contains(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_3); |
| 2203 | f_ensure_si_vec_contains(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_3); |
| 2204 | f_ensure_si_vec_contains(si_per_tc, 3, SYSTEM_INFORMATION_TYPE_4); |
| 2205 | f_ensure_si_vec_contains(si_per_tc, 7, SYSTEM_INFORMATION_TYPE_4); |
| 2206 | |
| 2207 | /* iii) System information type 2 bis or 2 ter messages are sent if needed, as determined by the |
| 2208 | * system operator. If only one of them is needed, it is sent when TC = 5. If both are |
| 2209 | * needed, 2bis is sent when TC = 5 and 2ter is sent at least once within any of 4 |
| 2210 | * consecutive occurrences of TC = 4. */ |
| 2211 | if (cfg.si2bis_present and not cfg.si2ter_present) { |
| 2212 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2bis); |
| 2213 | } else if (cfg.si2ter_present and not cfg.si2bis_present) { |
| 2214 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2ter); |
| 2215 | } else if (cfg.si2ter_present and cfg.si2bis_present) { |
| 2216 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2bis); |
| 2217 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2ter, false, 1, 4); |
| 2218 | } |
| 2219 | |
| 2220 | if (cfg.si7_present or cfg.si8_present) { |
| 2221 | /* vi) Use of System Information type 7 and 8 is not always necessary. It is necessary |
| 2222 | * if System Information type 4 does not contain all information needed for cell |
| 2223 | * selection and reselection. */ |
| 2224 | if (not cfg.bcch_extended) { |
| 2225 | testcase.stop("Error: SI7/SI8 require BCCH Extd."); |
| 2226 | } |
| 2227 | if (cfg.si7_present) { |
| 2228 | f_ensure_si_vec_contains(si_per_tc, 7, SYSTEM_INFORMATION_TYPE_7, true); |
| 2229 | } |
| 2230 | if (cfg.si8_present) { |
| 2231 | f_ensure_si_vec_contains(si_per_tc, 3, SYSTEM_INFORMATION_TYPE_8, true); |
| 2232 | } |
| 2233 | } |
| 2234 | |
| 2235 | if (cfg.si2quater_present) { |
| 2236 | /* iii) System information type 2 quater is sent if needed, as determined by the system |
| 2237 | * operator. If sent on BCCH Norm, it shall be sent when TC = 5 if neither of 2bis |
| 2238 | * and 2ter are used, otherwise it shall be sent at least once within any of 4 |
| 2239 | * consecutive occurrences of TC = 4. If sent on BCCH Ext, it is sent at least once |
| 2240 | * within any of 4 consecutive occurrences of TC = 5. */ |
| 2241 | if (not (cfg.bcch_extended)) { |
| 2242 | if (not (cfg.si2bis_present or cfg.si2ter_present)) { |
| 2243 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2quater); |
| 2244 | } else { |
| 2245 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2quater, false, 1, 4); |
| 2246 | } |
| 2247 | } else { |
| 2248 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2quater, true, 1, 4); |
| 2249 | } |
| 2250 | } |
| 2251 | if (cfg.si9_present) { |
| 2252 | /* vi) System Information type 9 is sent in those blocks with TC = 4 which are specified |
| 2253 | * in system information type 3 as defined in 3GPP TS 44.018. */ |
| 2254 | f_ensure_si_vec_contains(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_9); // FIXME SI3 |
| 2255 | } |
| 2256 | if (cfg.si13_present) { |
| 2257 | /* vii) System Information type 13 is only related to the GPRS service. System Information |
| 2258 | * Type 13 need only be sent if GPRS support is indicated in one or more of System |
| 2259 | * Information Type 3 or 4 or 7 or 8 messages. These messages also indicate if the |
| 2260 | * message is sent on the BCCH Norm or if the message is transmitted on the BCCH Ext. |
| 2261 | * In the case that the message is sent on the BCCH Norm, it is sent at least once |
| 2262 | * within any of 4 consecutive occurrences of TC=4. */ |
| 2263 | if (not cfg.bcch_extended) { |
| 2264 | log("not-bccch-extended"); |
| 2265 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_13, false, 1, 4); |
| 2266 | } else { |
| 2267 | log("bccch-extended"); |
| 2268 | f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_13, true); |
| 2269 | } |
| 2270 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_13alt)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2271 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI13alt and SI13"); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2272 | } |
| 2273 | } |
| 2274 | if (cfg.si16_present or cfg.si17_present) { |
| 2275 | /* viii) System Information type 16 and 17 are only related to the SoLSA service. They |
| 2276 | * should not be sent in a cell where network sharing is used (see rule xv). */ |
| 2277 | if (cfg.si22_present) { |
| 2278 | testcase.stop("Error: Cannot have SI16/SI17 and SI22!"); |
| 2279 | } |
| 2280 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_22)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2281 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI16/SI17 and SI22!"); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2282 | } |
| 2283 | if (not cfg.bcch_extended) { |
| 2284 | testcase.stop("Error: SI16/SI17 requires BCCH Extd!"); |
| 2285 | } |
| 2286 | if (cfg.si16_present) { |
| 2287 | f_ensure_si_vec_contains(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_16, true); |
| 2288 | } |
| 2289 | if (cfg.si17_present) { |
| 2290 | f_ensure_si_vec_contains(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_17, true); |
| 2291 | } |
| 2292 | } |
| 2293 | |
| 2294 | /* ix) System Information type 18 and 20 are sent in order to transmit non-GSM |
| 2295 | * broadcast information. The frequency with which they are sent is determined by the |
| 2296 | * system operator. System Information type 9 identifies the scheduling of System |
| 2297 | * Information type 18 and 20 messages. */ |
| 2298 | |
| 2299 | /* x) System Information Type 19 is sent if COMPACT neighbours exist. If System |
| 2300 | * Information Type 19 is present, then its scheduling shall be indicated in System |
| 2301 | * Information Type 9. */ |
| 2302 | |
| 2303 | if (cfg.si15_present) { |
| 2304 | /* xi) System Information Type 15 is broadcast if dynamic ARFCN mapping is used in the |
| 2305 | * PLMN. If sent on BCCH Norm, it is sent at least once within any of 4 consecutive |
| 2306 | * occurrences of TC = 4. If sent on BCCH Ext, it is sent at least once within any of |
| 2307 | * 4 consecutive occurrences of TC = 1. */ |
| 2308 | if (not cfg.bcch_extended) { |
| 2309 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_15, false, 1, 4); |
| 2310 | } else { |
| 2311 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 1, SYSTEM_INFORMATION_TYPE_15, true, 1, 4); |
| 2312 | } |
| 2313 | } |
| 2314 | if (cfg.si13alt_present) { |
| 2315 | /* xii) System Information type 13 alt is only related to the GERAN Iu mode. System |
| 2316 | * Information Type 13 alt need only be sent if GERAN Iu mode support is indicated in |
| 2317 | * one or more of System Information Type 3 or 4 or 7 or 8 messages and SI 13 is not |
| 2318 | * broadcast. These messages also indicate if the message is sent on the BCCH Norm or |
| 2319 | * if the message is transmitted on the BCCH Ext. In the case that the message is sent |
| 2320 | * on the BCCH Norm, it is sent at least once within any of 4 consecutive occurrences |
| 2321 | * of TC = 4. */ |
| 2322 | if (cfg.si13_present) { |
| 2323 | testcase.stop("Error: Cannot have SI13alt and SI13"); |
| 2324 | } |
| 2325 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_13)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2326 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI13alt and SI13"); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2327 | } |
| 2328 | if (not cfg.bcch_extended) { |
| 2329 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_13alt, false, 1, 4); |
| 2330 | } else { |
| 2331 | f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_13alt, true); |
| 2332 | } |
| 2333 | } |
| 2334 | if (cfg.si2n_present) { |
| 2335 | /* xiii) System Information Type 2n is optionally sent on BCCH Norm or BCCH Ext if needed, |
| 2336 | * as determined by the system operator. In the case that the message is sent on the |
| 2337 | * BCCH Norm, it is sent at least once within any of 4 consecutive occurrences of TC = |
| 2338 | * 4. If the message is sent on BCCH Ext, it is sent at least once within any of 2 |
| 2339 | * consecutive occurrences of TC = 4. */ |
| 2340 | if (not cfg.bcch_extended) { |
| 2341 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2n, false, 1, 4); |
| 2342 | } else { |
| 2343 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2n, true, 2, 4); |
| 2344 | } |
| 2345 | } |
| 2346 | if (cfg.si21_present) { |
| 2347 | /* xiv) System Information Type 21 is optionally sent on BCCH Norm or BCCH Ext, as |
| 2348 | * determined by the system operator. If Extended Access Barring is in use in the cell |
| 2349 | * then this message is sent at least once within any of 4 consecutive occurrences of |
| 2350 | * TC = 4 regardless if it is sent on BCCH Norm or BCCH Ext. If BCCH Ext is used in a |
| 2351 | * cell then this message shall only be sent on BCCH Ext. */ |
| 2352 | if (not cfg.bcch_extended) { |
| 2353 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_21, false, 1, 4); |
| 2354 | } else { |
| 2355 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_21, true, 1, 4); |
| 2356 | if (f_si_vecslot_contains(si_per_tc[4], SYSTEM_INFORMATION_TYPE_21)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2357 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI21 on BCCH Norm if BCCH Extd enabled!"); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2358 | } |
| 2359 | } |
| 2360 | } |
| 2361 | if (cfg.si22_present) { |
| 2362 | /* xv) System Information Type 22 is sent if network sharing is in use in the cell. It |
| 2363 | * should not be sent in a cell where SoLSA is used (see rule viii). System |
| 2364 | * Information Type 22 instances shall be sent on BCCH Ext within any occurrence of TC |
| 2365 | * =2 and TC=6. */ |
| 2366 | if (cfg.si16_present or cfg.si17_present) { |
| 2367 | testcase.stop("Error: Cannot have SI16/SI17 and SI22!"); |
| 2368 | } |
| 2369 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_16) or |
| 2370 | f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_17)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2371 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI16/SI17 and SI22!"); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2372 | } |
| 2373 | if (not cfg.bcch_extended) { |
| 2374 | testcase.stop("Error: SI22 requires BCCH Extd!"); |
| 2375 | } else { |
| 2376 | f_ensure_si_vec_contains_only(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_22, true); |
| 2377 | f_ensure_si_vec_contains_only(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_22, true); |
| 2378 | } |
| 2379 | } |
| 2380 | } |
| 2381 | |
| 2382 | /* sample Systme Information for specified duration via L1CTL */ |
| 2383 | function f_l1_sample_si(L1CTL_PT pt, float duration := 8.0) return SystemInformationVectorPerTc { |
| 2384 | timer T := duration; |
| 2385 | var SystemInformationVectorPerTc si_per_tc; |
| 2386 | var L1ctlDlMessage l1_dl; |
| 2387 | |
| 2388 | /* initialize all per-TC vectors empty */ |
| 2389 | for (var integer i:= 0; i < sizeof(si_per_tc); i := i+1) { |
| 2390 | si_per_tc[i] := {}; |
| 2391 | } |
| 2392 | |
| 2393 | /* flush all previous L1 queued msgs */ |
| 2394 | pt.clear; |
| 2395 | |
| 2396 | T.start; |
| 2397 | alt { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 2398 | [] pt.receive(tr_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2399 | /* somehow dec_SystemInformation will try to decode even non-RR as SI */ |
| 2400 | if (not (l1_dl.payload.data_ind.payload[1] == '06'O)) { |
| 2401 | log("Ignoring non-RR SI ", l1_dl); |
| 2402 | repeat; |
| 2403 | } |
| 2404 | var SystemInformationFn sig := { |
| 2405 | frame_number := l1_dl.dl_info.frame_nr, |
| 2406 | si := dec_SystemInformation(l1_dl.payload.data_ind.payload) |
| 2407 | } |
| 2408 | var integer tc := f_gsm_compute_tc(sig.frame_number); |
| 2409 | log("SI received at TC=", tc, ": ", sig.si); |
| 2410 | /* append to the per-TC bucket */ |
| 2411 | si_per_tc[tc] := si_per_tc[tc] & { sig }; |
| 2412 | repeat; |
| 2413 | } |
| 2414 | [] pt.receive { repeat; } |
| 2415 | [] T.timeout { } |
| 2416 | } |
| 2417 | |
| 2418 | for (var integer i:= 0; i < sizeof(si_per_tc); i := i+1) { |
| 2419 | log(testcasename(), ": TC=", i, " has #of SI=", sizeof(si_per_tc[i])); |
| 2420 | } |
| 2421 | log("si_per_tc=", si_per_tc); |
| 2422 | return si_per_tc; |
| 2423 | } |
| 2424 | |
| 2425 | /* helper function: Set given SI via RSL + validate scheduling. |
| 2426 | * CALLER MUST MAKE SURE TO CHANGE GLOBAL si_cfg! */ |
| 2427 | function f_TC_si_sched() runs on test_CT { |
| 2428 | var SystemInformationVectorPerTc si_per_tc; |
| 2429 | f_init_l1ctl(); |
| 2430 | f_l1_tune(L1CTL); |
| 2431 | |
| 2432 | /* Sample + Validate Scheduling */ |
| 2433 | si_per_tc := f_l1_sample_si(L1CTL); |
| 2434 | f_validate_si_scheduling(si_cfg, si_per_tc); |
| 2435 | |
| 2436 | setverdict(pass); |
| 2437 | } |
| 2438 | |
| 2439 | testcase TC_si_sched_default() runs on test_CT { |
| 2440 | f_init(); |
Harald Welte | 0cae455 | 2018-03-09 22:20:26 +0100 | [diff] [blame] | 2441 | /* 2+3+4 are mandatory and set in f_init() */ |
| 2442 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2443 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 0cae455 | 2018-03-09 22:20:26 +0100 | [diff] [blame] | 2444 | } |
| 2445 | |
| 2446 | testcase TC_si_sched_1() runs on test_CT { |
| 2447 | f_init(); |
| 2448 | si_cfg.si1_present := true; |
| 2449 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_1, '5506198fb38000000000000000000000000000e504002b'O); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2450 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2451 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2452 | } |
| 2453 | |
| 2454 | testcase TC_si_sched_2bis() runs on test_CT { |
| 2455 | f_init(); |
| 2456 | si_cfg.si2bis_present := true; |
| 2457 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O); |
| 2458 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2459 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2460 | } |
| 2461 | |
| 2462 | testcase TC_si_sched_2ter() runs on test_CT { |
| 2463 | f_init(); |
| 2464 | si_cfg.si2ter_present := true; |
| 2465 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O); |
| 2466 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2467 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2468 | } |
| 2469 | |
| 2470 | testcase TC_si_sched_2ter_2bis() runs on test_CT { |
| 2471 | f_init(); |
| 2472 | si_cfg.si2bis_present := true; |
| 2473 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O); |
| 2474 | si_cfg.si2ter_present := true; |
| 2475 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O); |
| 2476 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2477 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2478 | } |
| 2479 | |
| 2480 | testcase TC_si_sched_2quater() runs on test_CT { |
| 2481 | f_init(); |
| 2482 | si_cfg.si2quater_present := true; |
| 2483 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2quater, '050607a8a0364aa698d72ff424feee0506d5e7fff02043'O); |
| 2484 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2485 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2486 | } |
| 2487 | |
| 2488 | testcase TC_si_sched_13() runs on test_CT { |
| 2489 | f_init(); |
| 2490 | si_cfg.si13_present := true; |
Harald Welte | 5618c2a | 2018-04-15 16:24:46 +0200 | [diff] [blame] | 2491 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, '0106009000185a6fc9e08410ab2b2b2b2b2b2b2b2b2b2b'O); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2492 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2493 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2494 | } |
| 2495 | |
| 2496 | testcase TC_si_sched_13_2bis_2ter_2quater() runs on test_CT { |
| 2497 | f_init(); |
| 2498 | si_cfg.si2bis_present := true; |
| 2499 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O); |
| 2500 | si_cfg.si2ter_present := true; |
| 2501 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O); |
| 2502 | si_cfg.si2quater_present := true; |
| 2503 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2quater, '050607a8a0364aa698d72ff424feee0506d5e7fff02043'O); |
| 2504 | si_cfg.si13_present := true; |
Harald Welte | 5618c2a | 2018-04-15 16:24:46 +0200 | [diff] [blame] | 2505 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, '0106009000185a6fc9e08410ab2b2b2b2b2b2b2b2b2b2b'O); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2506 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2507 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 2508 | } |
| 2509 | |
| 2510 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 2511 | testcase TC_bcch_info() runs on test_CT { |
| 2512 | f_init(testcasename()); |
| 2513 | /* FIXME: enable / disable individual BCCH info */ |
| 2514 | //ts_RSL_BCCH_INFO(si_type, info); |
| 2515 | /* expect no ERROR REPORT after either of them * |
| 2516 | /* negative test: ensure ERROR REPORT on unsupported types */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2517 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 2518 | } |
| 2519 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 2520 | /*********************************************************************** |
| 2521 | * Low-Level Protocol Errors / ERROR REPORT |
| 2522 | ***********************************************************************/ |
| 2523 | |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 2524 | private function f_exp_err_rep(template RSL_Cause cause) runs on test_CT { |
| 2525 | timer T := 5.0; |
| 2526 | T.start; |
| 2527 | alt { |
| 2528 | [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_ERROR_REPORT(cause))) { |
| 2529 | setverdict(pass); |
| 2530 | } |
| 2531 | [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_ERROR_REPORT(?))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2532 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Wrong cause in RSL ERR REP"); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 2533 | } |
| 2534 | [] RSL_CCHAN.receive { |
| 2535 | repeat; |
| 2536 | } |
| 2537 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2538 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RSL ERR REP"); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 2539 | } |
| 2540 | } |
| 2541 | } |
| 2542 | |
| 2543 | /* Provoke a protocol error (message too short) and match on ERROR REPORT */ |
| 2544 | testcase TC_rsl_protocol_error() runs on test_CT { |
| 2545 | f_init(testcasename()); |
| 2546 | var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O)); |
| 2547 | rsl.ies := omit; |
| 2548 | RSL_CCHAN.send(ts_RSL_UD(rsl)); |
| 2549 | |
| 2550 | f_exp_err_rep(RSL_ERR_PROTO); |
| 2551 | } |
| 2552 | |
| 2553 | /* Provoke a mandatory IE error and match on ERROR REPORT */ |
| 2554 | testcase TC_rsl_mand_ie_error() runs on test_CT { |
| 2555 | f_init(testcasename()); |
| 2556 | |
| 2557 | var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O)); |
| 2558 | rsl.ies := { rsl.ies[0] }; |
| 2559 | RSL_CCHAN.send(ts_RSL_UD(rsl)); |
| 2560 | |
| 2561 | f_exp_err_rep(RSL_ERR_MAND_IE_ERROR); |
| 2562 | } |
| 2563 | |
| 2564 | /* Provoke an IE content error and match on ERROR REPORT */ |
| 2565 | testcase TC_rsl_ie_content_error() runs on test_CT { |
| 2566 | f_init(testcasename()); |
| 2567 | var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O)); |
| 2568 | rsl.ies[1].body.sysinfo_type := RSL_SYSTEM_INFO_5; |
| 2569 | RSL_CCHAN.send(ts_RSL_UD(rsl)); |
| 2570 | |
| 2571 | f_exp_err_rep(RSL_ERR_IE_CONTENT); |
| 2572 | } |
| 2573 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 2574 | /*********************************************************************** |
| 2575 | * IPA CRCX/MDCX/DLCS media stream handling |
| 2576 | ***********************************************************************/ |
| 2577 | |
Harald Welte | a871a38 | 2018-02-25 02:03:14 +0100 | [diff] [blame] | 2578 | /* Send IPA DLCX to inactive lchan */ |
| 2579 | function f_TC_ipa_dlcx_not_active(charstring id) runs on ConnHdlr { |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 2580 | f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, 0), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?), |
| 2581 | "IPA DLCX ACK"); |
Harald Welte | a871a38 | 2018-02-25 02:03:14 +0100 | [diff] [blame] | 2582 | } |
| 2583 | testcase TC_ipa_dlcx_not_active() runs on test_CT { |
| 2584 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 2585 | f_init(testcasename()); |
| 2586 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_dlcx_not_active), pars); |
| 2587 | vc_conn.done; |
| 2588 | } |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 2589 | |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 2590 | /* Send IPA CRCX twice to inactive lchan */ |
| 2591 | function f_TC_ipa_crcx_twice_not_active(charstring id) runs on ConnHdlr { |
| 2592 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?), |
| 2593 | "IPA CRCX ACK"); |
| 2594 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_NACK(g_chan_nr, RSL_ERR_RES_UNAVAIL), |
| 2595 | "IPA CRCX NACK"); |
| 2596 | } |
| 2597 | testcase TC_ipa_crcx_twice_not_active() runs on test_CT { |
| 2598 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 2599 | f_init(testcasename()); |
| 2600 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_twice_not_active), pars); |
| 2601 | vc_conn.done; |
| 2602 | } |
| 2603 | |
| 2604 | /* Regular sequence of CRCX/MDCX/DLCX */ |
| 2605 | function f_TC_ipa_crcx_mdcx_dlcx_not_active(charstring id) runs on ConnHdlr { |
| 2606 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?), |
| 2607 | "IPA CRCX ACK"); |
| 2608 | var uint32_t remote_ip := f_rnd_int(c_UINT32_MAX); |
| 2609 | var uint16_t remote_port := f_rnd_int(c_UINT16_MAX); |
| 2610 | var uint7_t rtp_pt2 := f_rnd_int(127); |
| 2611 | var uint16_t fake_conn_id := 23; /* we're too lazy to read it out from the CRCX ACK above */ |
| 2612 | f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2), |
| 2613 | tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2), |
| 2614 | "IPA MDCX ACK"); |
| 2615 | f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, fake_conn_id), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?), |
| 2616 | "IPA DLCX ACK"); |
| 2617 | } |
| 2618 | testcase TC_ipa_crcx_mdcx_dlcx_not_active() runs on test_CT { |
| 2619 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 2620 | f_init(testcasename()); |
| 2621 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_mdcx_dlcx_not_active), pars); |
| 2622 | vc_conn.done; |
| 2623 | } |
| 2624 | |
Harald Welte | 3ae11da | 2018-02-25 13:36:06 +0100 | [diff] [blame] | 2625 | /* Sequence of CRCX, 2x MDCX, DLCX */ |
| 2626 | function f_TC_ipa_crcx_mdcx_mdcx_dlcx_not_active(charstring id) runs on ConnHdlr { |
| 2627 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?), |
| 2628 | "IPA CRCX ACK"); |
| 2629 | var uint32_t remote_ip := f_rnd_int(c_UINT32_MAX); |
| 2630 | var uint16_t remote_port := f_rnd_int(c_UINT16_MAX); |
| 2631 | var uint7_t rtp_pt2 := f_rnd_int(127); |
| 2632 | var uint16_t fake_conn_id := 23; /* we're too lazy to read it out from the CRCX ACK above */ |
| 2633 | f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2), |
| 2634 | tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2), |
| 2635 | "IPA MDCX ACK"); |
| 2636 | /* Second MDCX */ |
| 2637 | remote_ip := f_rnd_int(c_UINT32_MAX); |
| 2638 | remote_port := f_rnd_int(c_UINT16_MAX); |
| 2639 | f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2), |
| 2640 | tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2), |
| 2641 | "IPA MDCX ACK"); |
| 2642 | f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, fake_conn_id), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?), |
| 2643 | "IPA DLCX ACK"); |
| 2644 | } |
| 2645 | testcase TC_ipa_crcx_mdcx_mdcx_dlcx_not_active() runs on test_CT { |
| 2646 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 2647 | f_init(testcasename()); |
| 2648 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_mdcx_mdcx_dlcx_not_active), pars); |
| 2649 | vc_conn.done; |
| 2650 | } |
| 2651 | |
Harald Welte | 9912eb5 | 2018-02-25 13:30:15 +0100 | [diff] [blame] | 2652 | /* IPA CRCX on SDCCH/4 and SDCCH/8 (doesn't make sense) */ |
| 2653 | function f_TC_ipa_crcx_sdcch_not_active(charstring id) runs on ConnHdlr { |
| 2654 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_NACK(g_chan_nr, ?), |
| 2655 | "IPA CRCX NACK"); |
| 2656 | } |
| 2657 | testcase TC_ipa_crcx_sdcch_not_active() runs on test_CT { |
| 2658 | var ConnHdlrPars pars; |
| 2659 | var ConnHdlr vc_conn; |
| 2660 | f_init(testcasename()); |
| 2661 | |
| 2662 | pars := valueof(t_Pars(t_RslChanNr_SDCCH4(0,1), ts_RSL_ChanMode_SIGN)); |
| 2663 | vc_conn := f_start_handler(refers(f_TC_ipa_crcx_sdcch_not_active), pars); |
| 2664 | vc_conn.done; |
| 2665 | |
| 2666 | pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6,5), ts_RSL_ChanMode_SIGN)); |
| 2667 | vc_conn := f_start_handler(refers(f_TC_ipa_crcx_sdcch_not_active), pars); |
| 2668 | vc_conn.done; |
| 2669 | } |
| 2670 | |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 2671 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2672 | /*********************************************************************** |
| 2673 | * PCU Socket related tests |
| 2674 | ***********************************************************************/ |
| 2675 | |
| 2676 | private function f_TC_pcu_act_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, boolean exp_success) |
| 2677 | runs on test_CT { |
| 2678 | timer T := 3.0; |
| 2679 | |
| 2680 | /* we don't expect any RTS.req before PDCH are active */ |
| 2681 | T.start; |
| 2682 | alt { |
| 2683 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(bts_nr))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2684 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "PCU RTS.req before PDCH active?"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2685 | } |
| 2686 | [] PCU.receive { repeat; } |
| 2687 | [] T.timeout { } |
| 2688 | } |
| 2689 | |
| 2690 | /* Send PDCH activate request for known PDCH timeslot */ |
| 2691 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_ACT_REQ(bts_nr, trx_nr, ts_nr))); |
| 2692 | |
| 2693 | /* we now expect RTS.req for this timeslot (only) */ |
| 2694 | T.start; |
| 2695 | alt { |
| 2696 | [exp_success] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr))) { |
| 2697 | setverdict(pass); |
| 2698 | } |
| 2699 | [not exp_success] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, |
| 2700 | tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2701 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RTS.req for supposedly failing activation"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2702 | } |
| 2703 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2704 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "RTS.req for wrong TRX/TS"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2705 | } |
| 2706 | [] PCU.receive { repeat; } |
| 2707 | [exp_success] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2708 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU RTS.req"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2709 | } |
| 2710 | [not exp_success] T.timeout { |
| 2711 | setverdict(pass); |
| 2712 | } |
| 2713 | } |
| 2714 | } |
| 2715 | |
| 2716 | private function f_TC_pcu_deact_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) |
| 2717 | runs on test_CT { |
| 2718 | timer T := 3.0; |
| 2719 | |
| 2720 | /* Send PDCH activate request for known PDCH timeslot */ |
| 2721 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_DEACT_REQ(bts_nr, trx_nr, ts_nr))); |
| 2722 | |
| 2723 | PCU.clear; |
| 2724 | /* we now expect no RTS.req for this timeslot */ |
| 2725 | T.start; |
| 2726 | alt { |
| 2727 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2728 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received unexpected PCU RTS.req"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2729 | } |
| 2730 | [] PCU.receive { repeat; } |
| 2731 | [] T.timeout { |
| 2732 | setverdict(pass); |
| 2733 | } |
| 2734 | } |
| 2735 | } |
| 2736 | |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2737 | private function f_init_pcu_test() runs on test_CT { |
| 2738 | f_init(); |
| 2739 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_TXT_IND(0, PCU_VERSION, testcasename()))); |
| 2740 | } |
| 2741 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2742 | /* PDCH activation via PCU socket; check for presence of RTS.req */ |
| 2743 | testcase TC_pcu_act_req() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2744 | f_init_pcu_test(); |
| 2745 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2746 | f_TC_pcu_act_req(0, 0, 7, true); |
| 2747 | } |
| 2748 | |
| 2749 | /* PDCH activation via PCU socket on non-PDCU timeslot */ |
| 2750 | testcase TC_pcu_act_req_wrong_ts() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2751 | f_init_pcu_test(); |
| 2752 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2753 | f_TC_pcu_act_req(0, 0, 1, false); |
| 2754 | } |
| 2755 | |
| 2756 | /* PDCH activation via PCU socket on wrong BTS */ |
| 2757 | testcase TC_pcu_act_req_wrong_bts() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2758 | f_init_pcu_test(); |
| 2759 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2760 | f_TC_pcu_act_req(23, 0, 7, false); |
| 2761 | } |
| 2762 | |
| 2763 | /* PDCH activation via PCU socket on wrong TRX */ |
| 2764 | testcase TC_pcu_act_req_wrong_trx() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2765 | f_init_pcu_test(); |
| 2766 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2767 | f_TC_pcu_act_req(0, 23, 7, false); |
| 2768 | } |
| 2769 | |
| 2770 | /* PDCH deactivation via PCU socket; check for absence of RTS.req */ |
| 2771 | testcase TC_pcu_deact_req() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2772 | f_init_pcu_test(); |
| 2773 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2774 | /* Activate PDCH */ |
| 2775 | f_TC_pcu_act_req(0, 0, 7, true); |
| 2776 | f_sleep(1.0); |
| 2777 | /* and De-Activate again */ |
| 2778 | f_TC_pcu_deact_req(0, 0, 7); |
| 2779 | } |
| 2780 | |
| 2781 | /* Attempt to deactivate a PDCH on a non-PDCH timeslot */ |
| 2782 | testcase TC_pcu_deact_req_wrong_ts() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2783 | f_init_pcu_test(); |
| 2784 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2785 | f_TC_pcu_deact_req(0, 0, 1); |
| 2786 | } |
| 2787 | |
| 2788 | /* Test the PCU->BTS Version and BTS->PCU SI13 handshake */ |
| 2789 | testcase TC_pcu_ver_si13() runs on test_CT { |
| 2790 | const octetstring si13 := '00010203040506070909'O; |
| 2791 | var PCUIF_send_data sd; |
| 2792 | timer T:= 3.0; |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2793 | f_init_pcu_test(); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2794 | |
| 2795 | /* Set SI13 via RSL */ |
| 2796 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, si13); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2797 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2798 | T.start; |
| 2799 | alt { |
| 2800 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_DATA_IND(0, 0, 0, ?, PCU_IF_SAPI_BCCH))) -> value sd { |
| 2801 | if (substr(sd.data.u.data_ind.data, 0, lengthof(si13)) == si13) { |
| 2802 | setverdict(pass); |
| 2803 | } else { |
| 2804 | repeat; |
| 2805 | } |
| 2806 | } |
| 2807 | [] PCU.receive { repeat; } |
| 2808 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2809 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for SI13"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2810 | } |
| 2811 | } |
| 2812 | } |
| 2813 | |
| 2814 | private const octetstring c_PCU_DATA := '000102030405060708090a0b0c0d0e0f10111213141516'O; |
| 2815 | |
| 2816 | /* helper function to send a PCU DATA.req */ |
| 2817 | private function f_pcu_data_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, |
| 2818 | uint8_t block_nr, uint32_t fn, PCUIF_Sapi sapi, octetstring data) |
| 2819 | runs on test_CT |
| 2820 | { |
| 2821 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, |
| 2822 | ts_PCUIF_DATA_REQ(bts_nr, trx_nr, ts_nr, block_nr, fn, sapi, data))); |
| 2823 | } |
| 2824 | |
| 2825 | /* helper function to wait for RTS.ind for given SAPI on given BTS/TRX/TS and then send */ |
| 2826 | private function f_pcu_wait_rts_and_data_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, |
| 2827 | PCUIF_Sapi sapi, octetstring data) |
| 2828 | runs on test_CT |
| 2829 | { |
| 2830 | var PCUIF_send_data sd; |
| 2831 | |
| 2832 | timer T := 3.0; |
| 2833 | T.start; |
| 2834 | alt { |
| 2835 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, |
| 2836 | tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr, sapi))) -> value sd { |
| 2837 | f_pcu_data_req(bts_nr, trx_nr, ts_nr, sd.data.u.rts_req.block_nr, |
| 2838 | sd.data.u.rts_req.fn, sapi, data); |
| 2839 | } |
| 2840 | [] PCU.receive { repeat; } |
| 2841 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2842 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RTS.ind"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2843 | } |
| 2844 | } |
| 2845 | } |
| 2846 | |
| 2847 | /* Send DATA.req on invalid BTS */ |
| 2848 | testcase TC_pcu_data_req_wrong_bts() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2849 | f_init_pcu_test(); |
| 2850 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2851 | f_TC_pcu_act_req(0, 0, 7, true); |
| 2852 | f_pcu_data_req(23, 0, 7, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA); |
| 2853 | /* FIXME: how to check this wasn't actually sent and didn't crash BTS? */ |
| 2854 | f_sleep(10.0); |
| 2855 | } |
| 2856 | |
| 2857 | /* Send DATA.req on invalid TRX */ |
| 2858 | testcase TC_pcu_data_req_wrong_trx() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2859 | f_init_pcu_test(); |
| 2860 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2861 | f_TC_pcu_act_req(0, 0, 7, true); |
| 2862 | f_pcu_data_req(0, 100, 7, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA); |
| 2863 | /* FIXME: how to check this wasn't actually sent and didn't crash BTS? */ |
| 2864 | f_sleep(10.0); |
| 2865 | } |
| 2866 | |
| 2867 | /* Send DATA.req on invalid timeslot */ |
| 2868 | testcase TC_pcu_data_req_wrong_ts() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2869 | f_init_pcu_test(); |
| 2870 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2871 | f_TC_pcu_act_req(0, 0, 7, true); |
| 2872 | f_pcu_data_req(0, 0, 70, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA); |
| 2873 | /* FIXME: how to check this wasn't actually sent and didn't crash BTS? */ |
| 2874 | f_sleep(10.0); |
| 2875 | } |
| 2876 | |
| 2877 | /* Send DATA.req on timeslot that hasn't been activated */ |
| 2878 | testcase TC_pcu_data_req_ts_inactive() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2879 | f_init_pcu_test(); |
| 2880 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2881 | f_pcu_data_req(0, 0, 7, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA); |
| 2882 | /* FIXME: how to check this wasn't actually sent and didn't crash BTS? */ |
| 2883 | f_sleep(2.0); |
| 2884 | } |
| 2885 | |
| 2886 | testcase TC_pcu_data_req_pdtch() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2887 | f_init_pcu_test(); |
| 2888 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2889 | f_TC_pcu_act_req(0, 0, 7, true); |
| 2890 | f_pcu_wait_rts_and_data_req(0, 0, 7, PCU_IF_SAPI_PDTCH, c_PCU_DATA); |
| 2891 | /* FIXME: how to check this was actually sent */ |
| 2892 | f_sleep(2.0); |
| 2893 | } |
| 2894 | |
| 2895 | testcase TC_pcu_data_req_ptcch() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2896 | f_init_pcu_test(); |
| 2897 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2898 | f_TC_pcu_act_req(0, 0, 7, true); |
| 2899 | f_pcu_wait_rts_and_data_req(0, 0, 7, PCU_IF_SAPI_PTCCH, c_PCU_DATA); |
| 2900 | /* FIXME: how to check this was actually sent */ |
| 2901 | f_sleep(2.0); |
| 2902 | } |
| 2903 | |
| 2904 | /* Send AGCH from PCU; check it appears on Um side */ |
| 2905 | testcase TC_pcu_data_req_agch() runs on test_CT { |
| 2906 | timer T := 3.0; |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2907 | f_init_pcu_test(); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2908 | f_init_l1ctl(); |
| 2909 | f_l1_tune(L1CTL); |
| 2910 | |
| 2911 | f_TC_pcu_act_req(0, 0, 7, true); |
| 2912 | f_pcu_data_req(0, 0, 7, 0, 0, PCU_IF_SAPI_AGCH, c_PCU_DATA); |
| 2913 | |
| 2914 | T.start; |
| 2915 | alt { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 2916 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?, c_PCU_DATA)) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2917 | setverdict(pass); |
| 2918 | } |
| 2919 | [] L1CTL.receive { repeat; } |
| 2920 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2921 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU-originated AGCH block on Um"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2922 | } |
| 2923 | } |
| 2924 | } |
| 2925 | |
| 2926 | /* Send IMM.ASS from PCU for PCH; check it appears on Um side */ |
| 2927 | testcase TC_pcu_data_req_imm_ass_pch() runs on test_CT { |
| 2928 | var octetstring imm_ass := f_rnd_octstring(23); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2929 | f_init_pcu_test(); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2930 | f_init_l1ctl(); |
| 2931 | f_l1_tune(L1CTL); |
| 2932 | |
| 2933 | /* append 3 last imsi digits so BTS can compute pagng group */ |
| 2934 | var uint32_t fn := f_PCUIF_tx_imm_ass_pch(PCU, g_pcu_conn_id, imm_ass, '123459987'H); |
| 2935 | |
| 2936 | timer T := 0.5; |
| 2937 | T.start; |
| 2938 | alt { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 2939 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?, imm_ass)) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2940 | /* TODO: verify paging group */ |
| 2941 | setverdict(pass); |
| 2942 | } |
| 2943 | [] L1CTL.receive { repeat; } |
| 2944 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2945 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU-originated AGCH block on Um"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2946 | } |
| 2947 | } |
| 2948 | } |
| 2949 | |
| 2950 | /* Send RACH from Um side, expect it to show up on PCU socket */ |
| 2951 | testcase TC_pcu_rach_content() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 2952 | f_init_pcu_test(); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2953 | f_init_l1ctl(); |
| 2954 | f_l1_tune(L1CTL); |
| 2955 | |
| 2956 | var GsmFrameNumber fn_last := 0; |
| 2957 | for (var integer i := 0; i < 1000; i := i+1) { |
| 2958 | var OCT1 ra := f_rnd_ra_ps(); |
| 2959 | var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra)); |
| 2960 | if (fn == fn_last) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2961 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Two RACH in same FN?!?"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2962 | } |
| 2963 | fn_last := fn; |
| 2964 | |
| 2965 | timer T := 2.0; |
| 2966 | T.start; |
| 2967 | alt { |
| 2968 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RACH_IND(0, oct2int(ra), 0, ?, fn))) { |
| 2969 | T.stop; |
| 2970 | } |
| 2971 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RACH_IND)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2972 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RACH IND"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2973 | } |
| 2974 | [] PCU.receive { repeat; } |
| 2975 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2976 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RACH IND"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 2977 | } |
| 2978 | } |
| 2979 | } |
| 2980 | setverdict(pass); |
| 2981 | } |
| 2982 | |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 2983 | /* Send extended (11-bit, TS1 & TS2) RACH bursts from the Um side, |
| 2984 | * expect them to show up on PCU socket (with proper BURST_TYPE_*). */ |
| 2985 | testcase TC_pcu_ext_rach_content() runs on test_CT { |
| 2986 | var template PCUIF_Message pcu_rach_ind; |
| 2987 | var GsmFrameNumber fn_last := 0; |
| 2988 | var L1ctlRachSynchSeq synch_seq; |
| 2989 | var PCUIF_BurstType pcu_bt; |
| 2990 | var GsmFrameNumber fn; |
| 2991 | var BIT11 ra11; |
| 2992 | |
| 2993 | f_init_pcu_test(); |
| 2994 | f_init_l1ctl(); |
| 2995 | f_l1_tune(L1CTL); |
| 2996 | |
| 2997 | for (var integer i := 0; i < 1000; i := i+1) { |
| 2998 | /* We need to test both TS1 & TS2 */ |
| 2999 | if (i rem 2 == 0) { |
| 3000 | synch_seq := RACH_SYNCH_SEQ_TS1; |
| 3001 | pcu_bt := BURST_TYPE_1; |
| 3002 | } else { |
| 3003 | synch_seq := RACH_SYNCH_SEQ_TS2; |
| 3004 | pcu_bt := BURST_TYPE_2; |
| 3005 | } |
| 3006 | |
| 3007 | ra11 := f_rnd_ra11_ps(); |
| 3008 | fn := f_L1CTL_EXT_RACH(L1CTL, bit2int(ra11), synch_seq); |
| 3009 | if (fn == fn_last) { |
| 3010 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 3011 | "Two RACH in same FN?!?"); |
| 3012 | } |
| 3013 | fn_last := fn; |
| 3014 | |
| 3015 | /* Compose the expected message */ |
| 3016 | pcu_rach_ind := tr_PCUIF_RACH_IND( |
| 3017 | bts_nr := 0, |
| 3018 | ra := bit2int(ra11), |
| 3019 | is_11bit := 1, |
| 3020 | burst_type := pcu_bt, |
| 3021 | fn := fn); |
| 3022 | |
| 3023 | timer T := 2.0; |
| 3024 | T.start; |
| 3025 | alt { |
| 3026 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, pcu_rach_ind)) { |
| 3027 | T.stop; |
| 3028 | } |
| 3029 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RACH_IND)) { |
| 3030 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RACH IND"); |
| 3031 | } |
| 3032 | [] PCU.receive { repeat; } |
| 3033 | [] T.timeout { |
| 3034 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RACH IND"); |
| 3035 | } |
| 3036 | } |
| 3037 | } |
| 3038 | setverdict(pass); |
| 3039 | } |
| 3040 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 3041 | private function f_pad_oct(octetstring str, integer len, OCT1 pad) return octetstring { |
| 3042 | var integer strlen := lengthof(str); |
| 3043 | for (var integer i := 0; i < len-strlen; i := i+1) { |
| 3044 | str := str & pad; |
| 3045 | } |
| 3046 | return str; |
| 3047 | } |
| 3048 | |
| 3049 | /* Send PAGING via RSL, expect it to shw up on PCU socket */ |
| 3050 | testcase TC_pcu_paging_from_rsl() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 3051 | f_init_pcu_test(); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 3052 | |
| 3053 | for (var integer i := 0; i < 100; i := i+1) { |
| 3054 | var MobileL3_CommonIE_Types.MobileIdentityLV mi; |
| 3055 | timer T := 3.0; |
| 3056 | if (i < 50) { |
| 3057 | mi := valueof(ts_MI_TMSI_LV(f_rnd_octstring(4))); |
| 3058 | } else { |
| 3059 | mi := valueof(ts_MI_IMSI_LV(f_gen_imsi(i))); |
| 3060 | } |
| 3061 | var octetstring mi_enc_lv := enc_MobileIdentityLV(mi); |
| 3062 | var octetstring mi_enc := substr(mi_enc_lv, 1, lengthof(mi_enc_lv)-1); |
| 3063 | var octetstring t_mi_lv := f_pad_oct(mi_enc_lv, 9, '00'O); |
| 3064 | |
| 3065 | /* Send RSL PAGING COMMAND */ |
| 3066 | RSL_CCHAN.send(ts_RSL_UD(ts_RSL_PAGING_CMD(mi_enc, i mod 4))); |
| 3067 | T.start; |
| 3068 | alt { |
| 3069 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_PAG_REQ(0, t_mi_lv))) { |
| 3070 | } |
| 3071 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_PAG_REQ)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3072 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected PAGING REQ"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 3073 | } |
| 3074 | [] PCU.receive { repeat; } |
| 3075 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3076 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PAGING REQ"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 3077 | } |
| 3078 | } |
| 3079 | } |
| 3080 | setverdict(pass); |
| 3081 | } |
| 3082 | |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 3083 | /*********************************************************************** |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 3084 | * Osmocom Style Dynamic Timeslot Support |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 3085 | ***********************************************************************/ |
| 3086 | |
| 3087 | private function f_dyn_osmo_pdch_act(integer pcu_conn_id, integer bts_nr, integer trx_nr) |
| 3088 | runs on ConnHdlr { |
| 3089 | var PCUIF_send_data sd; |
| 3090 | /* Expect BTS to immediately acknowledge activation as PDCH */ |
| 3091 | PCU.clear; |
| 3092 | f_rsl_chan_act(g_pars.chan_mode); |
| 3093 | /* expect INFO_IND on PCU interface listing TS as PDCH */ |
| 3094 | alt { |
| 3095 | [] PCU.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(bts_nr, ?))) -> value sd { |
| 3096 | if (substr(sd.data.u.info_ind.trx[trx_nr].pdch_mask, g_chan_nr.tn, 1) != '1'B) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3097 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "PCUIF_INFO_IND PDCH_MASK not '1' after PDCH ACT"); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 3098 | } |
| 3099 | } |
| 3100 | [] PCU.receive { repeat; } |
| 3101 | } |
| 3102 | /* try to activate this PDCH from the PCU point of view */ |
| 3103 | PCU.send(t_SD_PCUIF(pcu_conn_id, ts_PCUIF_ACT_REQ(bts_nr, trx_nr, g_chan_nr.tn))); |
| 3104 | /* FIXME: is there a response? */ |
| 3105 | } |
| 3106 | |
| 3107 | private function f_dyn_osmo_pdch_deact(integer pcu_conn_id, integer bts_nr, integer trx_nr) |
| 3108 | runs on ConnHdlr { |
| 3109 | var PCUIF_send_data sd; |
| 3110 | /* Send RSL CHAN REL (deactivate) */ |
| 3111 | PCU.clear; |
| 3112 | RSL.send(ts_RSL_RF_CHAN_REL(g_chan_nr)); |
| 3113 | /* expect BTS to ask PCU to deactivate the channel */ |
| 3114 | alt { |
| 3115 | [] PCU.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(bts_nr, ?))) -> value sd { |
| 3116 | if (substr(sd.data.u.info_ind.trx[trx_nr].pdch_mask, g_chan_nr.tn, 1) != '0'B) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3117 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "PCUIF_INFO_IND PDCH_MASK not '0' after PDCH DEACT"); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 3118 | } |
| 3119 | } |
| 3120 | [] PCU.receive { repeat; } |
| 3121 | } |
| 3122 | /* Emulate PCU asking BTS to deactivate PDCH */ |
| 3123 | PCU.send(t_SD_PCUIF(pcu_conn_id, ts_PCUIF_DEACT_REQ(bts_nr, trx_nr, g_chan_nr.tn))); |
| 3124 | alt { |
| 3125 | [] RSL.receive(tr_RSL_RF_CHAN_REL_ACK(g_chan_nr)) { |
| 3126 | setverdict(pass); |
| 3127 | } |
| 3128 | [] RSL.receive { repeat; } |
| 3129 | } |
| 3130 | } |
| 3131 | |
| 3132 | /* Activate Osmocom-style dynamic PDCH from BSC side */ |
| 3133 | function f_TC_dyn_osmo_pdch_act_deact(charstring id) runs on ConnHdlr { |
| 3134 | var PCUIF_Message first_info; |
| 3135 | var integer ts_nr := g_chan_nr.tn; |
| 3136 | var integer trx_nr := 0; |
| 3137 | var integer bts_nr := 0; |
| 3138 | var integer pcu_conn_id := -1; |
| 3139 | |
| 3140 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 3141 | |
| 3142 | f_dyn_osmo_pdch_act(pcu_conn_id, bts_nr, trx_nr); |
| 3143 | f_sleep(3.0); |
| 3144 | f_dyn_osmo_pdch_deact(pcu_conn_id, bts_nr, trx_nr); |
| 3145 | setverdict(pass); |
| 3146 | } |
| 3147 | testcase TC_dyn_osmo_pdch_act_deact() runs on test_CT { |
| 3148 | var ConnHdlrPars pars; |
| 3149 | var ConnHdlr vc_conn; |
| 3150 | f_init(testcasename()); |
| 3151 | |
| 3152 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 3153 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_act_deact), pars, true); |
| 3154 | vc_conn.done; |
| 3155 | } |
| 3156 | |
| 3157 | /* send a RF CHAN REL for PDCH on an osmocom dynamci PDCH that's already inactive */ |
| 3158 | function f_TC_dyn_osmo_pdch_unsol_deact(charstring id) runs on ConnHdlr { |
| 3159 | var PCUIF_Message first_info; |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 3160 | var integer pcu_conn_id := -1; |
| 3161 | |
| 3162 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 3163 | |
Neels Hofmeyr | 9c50ca5 | 2018-05-08 20:37:54 +0200 | [diff] [blame] | 3164 | RSL.send(ts_RSL_RF_CHAN_REL(g_chan_nr)); |
| 3165 | /* since the lchan is already released, we don't expect any PCU changes, just a rel ack. */ |
| 3166 | RSL.receive(tr_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 3167 | setverdict(pass); |
| 3168 | } |
| 3169 | testcase TC_dyn_osmo_pdch_unsol_deact() runs on test_CT { |
| 3170 | var ConnHdlrPars pars; |
| 3171 | var ConnHdlr vc_conn; |
| 3172 | f_init(testcasename()); |
| 3173 | |
| 3174 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 3175 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_unsol_deact), pars, true); |
| 3176 | vc_conn.done; |
| 3177 | } |
| 3178 | |
| 3179 | /* try to RSL CHAN ACT a PDCH on an osmocom-style PDCH that's already active */ |
| 3180 | function f_TC_dyn_osmo_pdch_double_act(charstring id) runs on ConnHdlr { |
| 3181 | var PCUIF_Message first_info; |
| 3182 | var integer ts_nr := g_chan_nr.tn; |
| 3183 | var integer trx_nr := 0; |
| 3184 | var integer bts_nr := 0; |
| 3185 | var integer pcu_conn_id := -1; |
| 3186 | |
| 3187 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 3188 | |
| 3189 | f_dyn_osmo_pdch_act(pcu_conn_id, bts_nr, trx_nr); |
Neels Hofmeyr | df936a2 | 2018-05-08 22:07:57 +0200 | [diff] [blame] | 3190 | /* Send a second Chan Activ and expect it to be NACKed */ |
| 3191 | f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode), tr_RSL_CHAN_ACT_NACK(g_chan_nr), |
| 3192 | "RSL CHAN ACT NACK"); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 3193 | setverdict(pass); |
| 3194 | } |
| 3195 | testcase TC_dyn_osmo_pdch_double_act() runs on test_CT { |
| 3196 | var ConnHdlrPars pars; |
| 3197 | var ConnHdlr vc_conn; |
| 3198 | f_init(testcasename()); |
| 3199 | |
| 3200 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 3201 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_double_act), pars, true); |
| 3202 | vc_conn.done; |
| 3203 | } |
| 3204 | |
| 3205 | /* try to RSL CHAN ACT a TCH/F on an osmocom-style PDCH */ |
| 3206 | function f_TC_dyn_osmo_pdch_tchf_act(charstring id) runs on ConnHdlr { |
| 3207 | var PCUIF_Message first_info; |
| 3208 | var integer ts_nr := g_chan_nr.tn; |
| 3209 | var integer trx_nr := 0; |
| 3210 | var integer bts_nr := 0; |
| 3211 | var integer pcu_conn_id := -1; |
| 3212 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(g_chan_nr.tn)); |
| 3213 | |
| 3214 | /* register for the TCH/F channel number */ |
| 3215 | f_rslem_register(0, chan_nr); |
| 3216 | |
| 3217 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 3218 | |
| 3219 | f_rsl_transceive(ts_RSL_CHAN_ACT(chan_nr, g_pars.chan_mode), tr_RSL_CHAN_ACT_ACK(chan_nr), |
| 3220 | "RSL CHAN ACT"); |
| 3221 | setverdict(pass); |
| 3222 | } |
| 3223 | testcase TC_dyn_osmo_pdch_tchf_act() runs on test_CT { |
| 3224 | var ConnHdlrPars pars; |
| 3225 | var ConnHdlr vc_conn; |
| 3226 | f_init(testcasename()); |
| 3227 | |
| 3228 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 3229 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_tchf_act), pars, true); |
| 3230 | vc_conn.done; |
| 3231 | } |
| 3232 | |
| 3233 | /* try to RSL CHAN ACT the TCH/H on an osmocom-style PDCH */ |
| 3234 | function f_TC_dyn_osmo_pdch_tchh_act(charstring id) runs on ConnHdlr { |
| 3235 | var PCUIF_Message first_info; |
| 3236 | var integer ts_nr := g_chan_nr.tn; |
| 3237 | var integer trx_nr := 0; |
| 3238 | var integer bts_nr := 0; |
| 3239 | var integer pcu_conn_id := -1; |
| 3240 | var RslChannelNr chan_nr[2] := { valueof(t_RslChanNr_Lm(g_chan_nr.tn, 0)), |
| 3241 | valueof(t_RslChanNr_Lm(g_chan_nr.tn, 1)) }; |
| 3242 | |
| 3243 | /* register for the TCH/H channel numbers */ |
| 3244 | f_rslem_register(0, chan_nr[0]); |
| 3245 | f_rslem_register(0, chan_nr[1]); |
| 3246 | |
| 3247 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 3248 | |
| 3249 | f_rsl_transceive(ts_RSL_CHAN_ACT(chan_nr[1], g_pars.chan_mode), |
| 3250 | tr_RSL_CHAN_ACT_ACK(chan_nr[1]), "RSL CHAN ACT [1]"); |
| 3251 | f_rsl_transceive(ts_RSL_CHAN_ACT(chan_nr[0], g_pars.chan_mode), |
| 3252 | tr_RSL_CHAN_ACT_ACK(chan_nr[0]), "RSL CHAN ACT [0]"); |
| 3253 | setverdict(pass); |
| 3254 | } |
| 3255 | testcase TC_dyn_osmo_pdch_tchh_act() runs on test_CT { |
| 3256 | var ConnHdlrPars pars; |
| 3257 | var ConnHdlr vc_conn; |
| 3258 | f_init(testcasename()); |
| 3259 | |
| 3260 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 3261 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_tchh_act), pars, true); |
| 3262 | vc_conn.done; |
| 3263 | } |
| 3264 | |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 3265 | /*********************************************************************** |
| 3266 | * IPA Style Dynamic Timeslot Support |
| 3267 | ***********************************************************************/ |
| 3268 | |
| 3269 | private function f_dyn_ipa_pdch_act(integer pcu_conn_id, integer bts_nr, integer trx_nr) |
| 3270 | runs on ConnHdlr { |
| 3271 | var PCUIF_send_data sd; |
| 3272 | /* Expect BTS to immediately acknowledge activation as PDCH */ |
| 3273 | PCU.clear; |
| 3274 | RSL.send(ts_RSL_IPA_PDCH_ACT(g_chan_nr)); |
| 3275 | /* expect INFO_IND on PCU interface listing TS as PDCH */ |
Pau Espin Pedrol | 446e07b | 2019-02-18 21:18:36 +0100 | [diff] [blame] | 3276 | timer T_wait := 2.0; |
| 3277 | T_wait.start; |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 3278 | alt { |
| 3279 | [] PCU.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(bts_nr, ?))) -> value sd { |
| 3280 | if (substr(sd.data.u.info_ind.trx[trx_nr].pdch_mask, g_chan_nr.tn, 1) != '1'B) { |
Pau Espin Pedrol | 446e07b | 2019-02-18 21:18:36 +0100 | [diff] [blame] | 3281 | log("PCUIF_INFO_IND PDCH_MASK not yet '1' after PDCH ACT on TS", g_chan_nr.tn, |
| 3282 | " mask:", sd.data.u.info_ind.trx[trx_nr].pdch_mask); |
| 3283 | repeat; |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 3284 | } |
| 3285 | } |
| 3286 | [] PCU.receive { repeat; } |
Pau Espin Pedrol | 446e07b | 2019-02-18 21:18:36 +0100 | [diff] [blame] | 3287 | [] T_wait.timeout { |
| 3288 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 3289 | log2str("Timeout waiting for PCUIF_INFO_IND PDCH_MASK to be '1' on TS", g_chan_nr.tn)); |
| 3290 | } |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 3291 | } |
| 3292 | /* try to activate this PDCH from the PCU point of view */ |
| 3293 | PCU.send(t_SD_PCUIF(pcu_conn_id, ts_PCUIF_ACT_REQ(bts_nr, trx_nr, g_chan_nr.tn))); |
| 3294 | /* FIXME: is there a response? */ |
| 3295 | |
| 3296 | RSL.receive(tr_RSL_IPA_PDCH_ACT_ACK(g_chan_nr, ?)); |
| 3297 | } |
| 3298 | |
| 3299 | private function f_dyn_ipa_pdch_deact(integer pcu_conn_id, integer bts_nr, integer trx_nr) |
| 3300 | runs on ConnHdlr { |
| 3301 | var PCUIF_send_data sd; |
| 3302 | /* Send RSL CHAN REL (deactivate) */ |
| 3303 | RSL.send(ts_RSL_IPA_PDCH_DEACT(g_chan_nr)); |
| 3304 | PCU.clear; |
| 3305 | /* expect BTS to ask PCU to deactivate the channel */ |
Pau Espin Pedrol | 446e07b | 2019-02-18 21:18:36 +0100 | [diff] [blame] | 3306 | timer T_wait := 2.0; |
| 3307 | T_wait.start; |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 3308 | alt { |
| 3309 | [] PCU.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(bts_nr, ?))) -> value sd { |
| 3310 | if (substr(sd.data.u.info_ind.trx[trx_nr].pdch_mask, g_chan_nr.tn, 1) != '0'B) { |
Pau Espin Pedrol | 446e07b | 2019-02-18 21:18:36 +0100 | [diff] [blame] | 3311 | log("PCUIF_INFO_IND PDCH_MASK not yet '0' after PDCH DEACT on TS", g_chan_nr.tn, |
| 3312 | " mask:", sd.data.u.info_ind.trx[trx_nr].pdch_mask); |
| 3313 | repeat; |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 3314 | } |
| 3315 | } |
| 3316 | [] PCU.receive { repeat; } |
Pau Espin Pedrol | 446e07b | 2019-02-18 21:18:36 +0100 | [diff] [blame] | 3317 | [] T_wait.timeout { |
| 3318 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 3319 | log2str("Timeout waiting for PCUIF_INFO_IND PDCH_MASK to be '0' on TS", g_chan_nr.tn)); |
| 3320 | } |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 3321 | } |
| 3322 | /* Emulate PCU asking BTS to deactivate PDCH */ |
| 3323 | PCU.send(t_SD_PCUIF(pcu_conn_id, ts_PCUIF_DEACT_REQ(bts_nr, trx_nr, g_chan_nr.tn))); |
| 3324 | alt { |
| 3325 | [] RSL.receive(tr_RSL_IPA_PDCH_DEACT_ACK(g_chan_nr)) { |
| 3326 | setverdict(pass); |
| 3327 | } |
| 3328 | [] RSL.receive { repeat; } |
| 3329 | } |
| 3330 | } |
| 3331 | |
| 3332 | /* Activate and de-activate an IPA-style dynamic TCH/F + PDCH */ |
| 3333 | function f_TC_dyn_ipa_pdch_act_deact(charstring id) runs on ConnHdlr { |
| 3334 | var PCUIF_Message first_info; |
| 3335 | var integer ts_nr := g_chan_nr.tn; |
| 3336 | var integer trx_nr := 0; |
| 3337 | var integer bts_nr := 0; |
| 3338 | var integer pcu_conn_id := -1; |
| 3339 | |
| 3340 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 3341 | |
| 3342 | f_dyn_ipa_pdch_act(pcu_conn_id, bts_nr, trx_nr); |
| 3343 | f_sleep(3.0); |
| 3344 | f_dyn_ipa_pdch_deact(pcu_conn_id, bts_nr, trx_nr); |
| 3345 | |
| 3346 | setverdict(pass); |
| 3347 | |
| 3348 | } |
| 3349 | testcase TC_dyn_ipa_pdch_act_deact() runs on test_CT { |
| 3350 | var ConnHdlrPars pars; |
| 3351 | var ConnHdlr vc_conn; |
| 3352 | f_init(); |
| 3353 | |
| 3354 | pars := valueof(t_Pars(t_RslChanNr_Bm(3), ts_RSL_ChanMode_SIGN)); |
| 3355 | vc_conn := f_start_handler(refers(f_TC_dyn_ipa_pdch_act_deact), pars, true); |
| 3356 | vc_conn.done; |
| 3357 | } |
| 3358 | |
| 3359 | /* try to RSL CHAN ACT a TCH/F on an IPA-style PDCH */ |
| 3360 | function f_TC_dyn_ipa_pdch_tchf_act(charstring id) runs on ConnHdlr { |
| 3361 | var PCUIF_Message first_info; |
| 3362 | var integer ts_nr := g_chan_nr.tn; |
| 3363 | var integer trx_nr := 0; |
| 3364 | var integer bts_nr := 0; |
| 3365 | var integer pcu_conn_id := -1; |
| 3366 | |
| 3367 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 3368 | |
| 3369 | f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode), tr_RSL_CHAN_ACT_ACK(g_chan_nr), |
| 3370 | "RSL CHAN ACT"); |
| 3371 | f_rsl_transceive(ts_RSL_RF_CHAN_REL(g_chan_nr), tr_RSL_RF_CHAN_REL_ACK(g_chan_nr), |
| 3372 | "RF CHAN REL", true); |
| 3373 | setverdict(pass); |
| 3374 | } |
| 3375 | testcase TC_dyn_ipa_pdch_tchf_act() runs on test_CT { |
| 3376 | var ConnHdlrPars pars; |
| 3377 | var ConnHdlr vc_conn; |
| 3378 | f_init(testcasename()); |
| 3379 | |
| 3380 | pars := valueof(t_Pars(t_RslChanNr_Bm(3), ts_RSL_ChanMode_SIGN)); |
| 3381 | vc_conn := f_start_handler(refers(f_TC_dyn_ipa_pdch_tchf_act), pars, true); |
| 3382 | vc_conn.done; |
| 3383 | } |
| 3384 | |
| 3385 | /* Activate IPA style dyn PDCH as TCH/F and then illegally try to activate it as PDCH, too */ |
| 3386 | function f_TC_dyn_ipa_pdch_tchf_act_pdch_act_nack(charstring id) runs on ConnHdlr { |
| 3387 | var PCUIF_Message first_info; |
| 3388 | var integer ts_nr := g_chan_nr.tn; |
| 3389 | var integer trx_nr := 0; |
| 3390 | var integer bts_nr := 0; |
| 3391 | var integer pcu_conn_id := -1; |
| 3392 | |
| 3393 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 3394 | |
| 3395 | f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode), tr_RSL_CHAN_ACT_ACK(g_chan_nr), |
| 3396 | "RSL CHAN ACT"); |
| 3397 | |
| 3398 | RSL.send(ts_RSL_IPA_PDCH_ACT(g_chan_nr)); |
| 3399 | alt { |
| 3400 | [] RSL.receive(tr_RSL_IPA_PDCH_ACT_NACK(g_chan_nr, ?)); |
| 3401 | [] RSL.receive(tr_RSL_IPA_PDCH_ACT_ACK(g_chan_nr, ?)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3402 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected PDCH ACT ACK"); |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 3403 | } |
| 3404 | [] RSL.receive { repeat; } |
| 3405 | } |
| 3406 | |
| 3407 | f_rsl_transceive(ts_RSL_RF_CHAN_REL(g_chan_nr), tr_RSL_RF_CHAN_REL_ACK(g_chan_nr), |
| 3408 | "RF CHAN REL", true); |
| 3409 | setverdict(pass); |
| 3410 | } |
| 3411 | testcase TC_dyn_ipa_pdch_tchf_act_pdch_act_nack() runs on test_CT { |
| 3412 | var ConnHdlrPars pars; |
| 3413 | var ConnHdlr vc_conn; |
| 3414 | f_init(testcasename()); |
| 3415 | |
| 3416 | pars := valueof(t_Pars(t_RslChanNr_Bm(3), ts_RSL_ChanMode_SIGN)); |
| 3417 | vc_conn := f_start_handler(refers(f_TC_dyn_ipa_pdch_tchf_act_pdch_act_nack), pars, true); |
| 3418 | vc_conn.done; |
| 3419 | } |
| 3420 | |
| 3421 | /* try to RSL CHAN ACT a TCH/F on an IPA-style PDCH that's already in PDCH mode; expect NACK */ |
| 3422 | function f_TC_dyn_ipa_pdch_act_tchf_act_nack(charstring id) runs on ConnHdlr { |
| 3423 | var PCUIF_Message first_info; |
| 3424 | var integer ts_nr := g_chan_nr.tn; |
| 3425 | var integer trx_nr := 0; |
| 3426 | var integer bts_nr := 0; |
| 3427 | var integer pcu_conn_id := -1; |
| 3428 | |
| 3429 | /* register for the TCH/F channel number */ |
| 3430 | f_rslem_register(0, g_chan_nr); |
| 3431 | |
| 3432 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 3433 | |
| 3434 | f_dyn_ipa_pdch_act(pcu_conn_id, bts_nr, trx_nr); |
| 3435 | |
| 3436 | f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode), tr_RSL_CHAN_ACT_NACK(g_chan_nr), |
| 3437 | "RSL CHAN ACT"); |
| 3438 | |
| 3439 | f_dyn_ipa_pdch_deact(pcu_conn_id, bts_nr, trx_nr); |
| 3440 | |
| 3441 | setverdict(pass); |
| 3442 | } |
| 3443 | testcase TC_dyn_ipa_pdch_act_tchf_act_nack() runs on test_CT { |
| 3444 | var ConnHdlrPars pars; |
| 3445 | var ConnHdlr vc_conn; |
| 3446 | f_init(testcasename()); |
| 3447 | |
| 3448 | pars := valueof(t_Pars(t_RslChanNr_Bm(3), ts_RSL_ChanMode_SIGN)); |
| 3449 | vc_conn := f_start_handler(refers(f_TC_dyn_ipa_pdch_act_tchf_act_nack), pars, true); |
| 3450 | vc_conn.done; |
| 3451 | } |
| 3452 | |
| 3453 | |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3454 | /*********************************************************************** |
| 3455 | * LAPDm / RLL related |
| 3456 | ***********************************************************************/ |
| 3457 | |
| 3458 | private function f_tx_lapdm(template (value) LapdmFrame l, |
| 3459 | template (value) RslLinkId link_id) runs on ConnHdlr { |
| 3460 | var octetstring l2 := enc_LapdmFrame(valueof(l)); |
| 3461 | if (valueof(link_id.c) == SACCH) { |
| 3462 | /* prepend dummy L1 header */ |
Pau Espin Pedrol | a0fb42a | 2018-10-10 15:56:39 +0200 | [diff] [blame] | 3463 | var L1ctlDataReq l1hl2 := { |
| 3464 | l1header := valueof(ts_SacchL1Header(g_pars.l1_pars.ms_power_level, false, g_pars.l1_pars.ms_actual_ta)), |
| 3465 | l2_payload := f_pad_oct(l2, 21, '2B'O) |
| 3466 | } |
| 3467 | L1CTL.send(ts_L1CTL_DATA_REQ_SACCH(g_chan_nr, link_id, l1hl2)); |
| 3468 | } else { |
| 3469 | /* If required, pad L2 frame with constant 0x2b filling */ |
| 3470 | l2 := f_pad_oct(l2, 23, '2B'O); |
| 3471 | |
| 3472 | log("encoding ", l, " to ", l2); |
| 3473 | L1CTL.send(ts_L1CTL_DATA_REQ(g_chan_nr, link_id, l2)); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3474 | } |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3475 | } |
| 3476 | |
| 3477 | type record RllTestCase { |
| 3478 | uint3_t sapi, |
| 3479 | RslLinkId link_id, |
| 3480 | octetstring l3, |
| 3481 | boolean exp |
| 3482 | } |
| 3483 | type record of RllTestCase RllTestCases; |
| 3484 | template RllTestCase t_EITC(uint3_t sapi, RslLinkId id, octetstring l3, boolean exp) := { |
| 3485 | sapi := sapi, |
| 3486 | link_id := id, |
| 3487 | l3 := l3, |
| 3488 | exp := exp |
| 3489 | } |
| 3490 | |
| 3491 | /* execute the same callback function with a set of different parameters (tcs) on a |
| 3492 | * variety of logical channels */ |
| 3493 | private function f_rll_testmatrix(RllTestCases tcs, void_fn fn) runs on test_CT { |
| 3494 | var ConnHdlrPars pars; |
| 3495 | var ConnHdlr vc_conn; |
| 3496 | f_init(testcasename()); |
| 3497 | |
| 3498 | /* test on each of the channels we have */ |
| 3499 | for (var integer i := 0; i < sizeof(g_AllChanTypes); i := i+1) { |
| 3500 | pars := valueof(t_Pars(g_AllChanTypes[i], ts_RSL_ChanMode_SIGN)); |
| 3501 | |
| 3502 | /* test each of the test cases on the current channel */ |
| 3503 | for (var integer j := 0; j < sizeof(tcs); j := j+1) { |
| 3504 | pars.spec.rll := tcs[j]; |
| 3505 | log(testcasename(), ": XXX Starting ", tcs[j] , " on ", g_AllChanTypes[i]); |
| 3506 | vc_conn := f_start_handler(fn, pars); |
| 3507 | vc_conn.done; |
| 3508 | } |
| 3509 | } |
| 3510 | |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3511 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3512 | } |
| 3513 | |
| 3514 | /* test if SABM on Um triggers EST IND (TS 48.058 3.1) */ |
| 3515 | private function f_TC_rll_est_ind(charstring id) runs on ConnHdlr { |
| 3516 | var RllTestCase tc := g_pars.spec.rll; |
| 3517 | timer T := 3.0; |
| 3518 | |
| 3519 | f_l1_tune(L1CTL); |
| 3520 | RSL.clear; |
| 3521 | |
| 3522 | /* activate the logical channel */ |
| 3523 | f_est_dchan(); |
| 3524 | L1CTL.clear; |
| 3525 | |
| 3526 | f_tx_lapdm(ts_LAPDm_SABM(tc.sapi, cr_MO_CMD, true, tc.l3), tc.link_id); |
| 3527 | T.start; |
| 3528 | alt { |
| 3529 | [tc.l3 != ''O] RSL.receive(tr_RSL_EST_IND(g_chan_nr, tc.link_id, tc.l3)) { |
| 3530 | if (tc.exp) { |
| 3531 | setverdict(pass); |
| 3532 | } else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3533 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Unexpected EST IND with L3 in ", tc)); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3534 | } |
| 3535 | } |
| 3536 | [tc.l3 == ''O] RSL.receive(tr_RSL_EST_IND_NOL3(g_chan_nr, tc.link_id)) { |
| 3537 | if (tc.exp) { |
| 3538 | setverdict(pass); |
| 3539 | } else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3540 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Unexpected EST IND without L3 in ", tc)); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3541 | } |
| 3542 | } |
Vadim Yanitskiy | 3567787 | 2018-10-04 17:30:21 +0700 | [diff] [blame] | 3543 | /* We also expect to receive the measurements */ |
| 3544 | [] as_meas_res(verify_meas := false); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3545 | [tc.exp] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3546 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for EST IND"); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3547 | } |
| 3548 | [not tc.exp] T.timeout { |
| 3549 | setverdict(pass); |
| 3550 | } |
| 3551 | } |
| 3552 | |
| 3553 | f_rsl_chan_deact(); |
| 3554 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3555 | f_rslem_unregister(0, g_chan_nr); |
| 3556 | } |
| 3557 | testcase TC_rll_est_ind() runs on test_CT { |
| 3558 | var RllTestCases tcs := { |
Harald Welte | 7aacbbf | 2018-05-09 16:56:41 +0200 | [diff] [blame] | 3559 | /* SAPI0 establishment (contention resolution) */ |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3560 | valueof(t_EITC(0, valueof(ts_RslLinkID_DCCH(0)), '01020304'O, true)), |
Harald Welte | 7aacbbf | 2018-05-09 16:56:41 +0200 | [diff] [blame] | 3561 | /* normal SAPI0 establishment */ |
| 3562 | valueof(t_EITC(0, valueof(ts_RslLinkID_DCCH(0)), ''O, true)), |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3563 | /* SAPI 3 doesn't support contention resolution */ |
| 3564 | valueof(t_EITC(3, valueof(ts_RslLinkID_DCCH(3)), '01020304'O, false)), |
| 3565 | valueof(t_EITC(3, valueof(ts_RslLinkID_SACCH(3)), '01020304'O, false)), |
| 3566 | /* normal SAPI3 establishment on main DCCH */ |
| 3567 | valueof(t_EITC(3, valueof(ts_RslLinkID_DCCH(3)), ''O, true)), |
| 3568 | /* normal SAPI3 establishment on SACCH */ |
| 3569 | valueof(t_EITC(3, valueof(ts_RslLinkID_SACCH(3)), ''O, true)) |
| 3570 | }; |
| 3571 | f_rll_testmatrix(tcs, refers(f_TC_rll_est_ind)); |
| 3572 | } |
| 3573 | |
| 3574 | /* test if RLL EST REQ trigeres SABM on Um; UA on Um triggers EST CONF (TS 48.058 3.2) */ |
| 3575 | private function f_TC_rll_est_req(charstring id) runs on ConnHdlr { |
| 3576 | var RllTestCase tc := g_pars.spec.rll; |
| 3577 | var L1ctlDlMessage dl; |
| 3578 | timer T := 3.0; |
| 3579 | |
| 3580 | f_l1_tune(L1CTL); |
| 3581 | RSL.clear; |
| 3582 | |
| 3583 | /* activate the logical channel */ |
| 3584 | f_est_dchan(); |
| 3585 | L1CTL.clear; |
| 3586 | |
| 3587 | /* Send a RSL EST REQ for SAPI3 on main DCCH */ |
| 3588 | RSL.send(ts_RSL_EST_REQ(g_chan_nr, tc.link_id)); |
| 3589 | T.start; |
| 3590 | alt { |
| 3591 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, ?)) -> value dl { |
| 3592 | var LapdmFrame lapdm; |
| 3593 | var octetstring l2 := dl.payload.data_ind.payload; |
| 3594 | if (dl.dl_info.link_id.c == SACCH) { |
| 3595 | /* remove L1 header */ |
| 3596 | l2 := substr(l2, 2, lengthof(l2)-2); |
| 3597 | } |
| 3598 | lapdm.ab := dec_LapdmFrameAB(l2); |
| 3599 | if (match(lapdm, tr_LAPDm_SABM(tc.sapi, cr_MT_CMD, true, ''O))) { |
| 3600 | setverdict(pass); |
| 3601 | } else { |
| 3602 | repeat; |
| 3603 | } |
| 3604 | } |
| 3605 | [] L1CTL.receive { repeat; } |
| 3606 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3607 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for SABM"); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3608 | } |
| 3609 | } |
| 3610 | |
| 3611 | f_rsl_chan_deact(); |
| 3612 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3613 | f_rslem_unregister(0, g_chan_nr); |
| 3614 | } |
| 3615 | testcase TC_rll_est_req_DCCH_3() runs on test_CT { |
| 3616 | var RllTestCases tcs := { |
| 3617 | /* normal SAPI3 establishment on main DCCH */ |
| 3618 | valueof(t_EITC(3, valueof(ts_RslLinkID_DCCH(3)), ''O, true))//, |
| 3619 | }; |
| 3620 | f_rll_testmatrix(tcs, refers(f_TC_rll_est_req)); |
| 3621 | } |
| 3622 | testcase TC_rll_est_req_ACCH_3() runs on test_CT { |
| 3623 | var RllTestCases tcs := { |
| 3624 | /* normal SAPI3 establishment on SACCH */ |
| 3625 | valueof(t_EITC(3, valueof(ts_RslLinkID_SACCH(3)), ''O, true)) |
| 3626 | } |
| 3627 | f_rll_testmatrix(tcs, refers(f_TC_rll_est_req)); |
| 3628 | } |
| 3629 | |
| 3630 | /* altstep to receive a LAPDm frame matching the given template */ |
| 3631 | private altstep as_l1_exp_lapdm(template LapdmFrame exp) runs on ConnHdlr { |
| 3632 | var L1ctlDlMessage dl; |
| 3633 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, ?)) -> value dl { |
| 3634 | var LapdmFrame lapdm; |
| 3635 | var octetstring l2 := dl.payload.data_ind.payload; |
| 3636 | if (dl.dl_info.link_id.c == SACCH) { |
| 3637 | /* remove L1 header */ |
| 3638 | l2 := substr(l2, 2, lengthof(l2)-2); |
| 3639 | } |
| 3640 | if (ischosen(exp.ab)) { |
| 3641 | lapdm.ab := dec_LapdmFrameAB(l2); |
| 3642 | } else if (ischosen(exp.b4)) { |
| 3643 | lapdm.b4 := dec_LapdmFrameB4(l2); |
| 3644 | } else if (ischosen(exp.bbis)) { |
| 3645 | lapdm.bbis := dec_LapdmFrameBbis(l2); |
| 3646 | } |
| 3647 | log("Rx LAPDm ", lapdm); |
| 3648 | if (match(lapdm, exp)) { |
| 3649 | setverdict(pass); |
| 3650 | } else { |
| 3651 | repeat; |
| 3652 | } |
| 3653 | } |
| 3654 | [] L1CTL.receive { repeat; } |
| 3655 | } |
| 3656 | private function f_l1_exp_lapdm(template LapdmFrame exp, float t := 3.0) runs on ConnHdlr { |
| 3657 | timer T := t; |
| 3658 | T.start; |
| 3659 | alt { |
| 3660 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3661 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Timeout waiting for LAPDm ", exp)); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3662 | } |
| 3663 | [] as_l1_exp_lapdm(exp); |
| 3664 | } |
| 3665 | } |
| 3666 | |
| 3667 | /* establish one Radio Link Layer via SABM -> UA. Use l3 for contention resolution */ |
| 3668 | private function f_est_rll_mo(uint3_t sapi, RslLinkId link_id, octetstring l3) runs on ConnHdlr { |
| 3669 | /* send SABM from MS -> BTS */ |
| 3670 | f_tx_lapdm(ts_LAPDm_SABM(sapi, cr_MO_CMD, true, l3), link_id); |
| 3671 | /* expect RLL EST IND on Abis */ |
| 3672 | alt { |
| 3673 | [l3 != ''O] RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3)); |
| 3674 | [l3 == ''O] RSL.receive(tr_RSL_EST_IND_NOL3(g_chan_nr, link_id)); |
| 3675 | [] RSL.receive(tr_RSL_ERROR_IND(g_chan_nr, link_id, ?)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3676 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Failing due to RSL_ERROR_IND"); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3677 | } |
| 3678 | [] RSL.receive { repeat; } |
| 3679 | } |
| 3680 | /* expect UA from BTS -> MS */ |
| 3681 | f_l1_exp_lapdm(tr_LAPDm_UA(sapi, cr_MT_RSP, true, l3)); |
| 3682 | } |
| 3683 | |
| 3684 | /* test if DISC on Um triggers RLL REL IND (TS 48.058 3.3) */ |
| 3685 | private function f_TC_rll_rel_ind(charstring id) runs on ConnHdlr { |
| 3686 | var RllTestCase tc := g_pars.spec.rll; |
| 3687 | |
| 3688 | f_l1_tune(L1CTL); |
| 3689 | RSL.clear; |
| 3690 | |
| 3691 | /* activate the logical channel */ |
| 3692 | f_est_dchan(); |
| 3693 | L1CTL.clear; |
| 3694 | |
| 3695 | /* first establish the link-layer */ |
| 3696 | f_est_rll_mo(tc.sapi, tc.link_id, tc.l3); |
| 3697 | |
| 3698 | /* then send the DISC */ |
| 3699 | f_tx_lapdm(ts_LAPDm_DISC(tc.sapi, cr_MO_CMD, true), tc.link_id); |
| 3700 | /* ... and expect the REL IND on the RSL side */ |
| 3701 | alt { |
| 3702 | [] RSL.receive(tr_RSL_REL_IND(g_chan_nr, tc.link_id)) { |
| 3703 | setverdict(pass); |
| 3704 | } |
Vadim Yanitskiy | 3567787 | 2018-10-04 17:30:21 +0700 | [diff] [blame] | 3705 | /* We also expect to receive the measurements */ |
| 3706 | [] as_meas_res(verify_meas := false); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3707 | } |
| 3708 | |
| 3709 | /* release the channel */ |
| 3710 | f_rsl_chan_deact(); |
| 3711 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3712 | f_rslem_unregister(0, g_chan_nr); |
| 3713 | } |
| 3714 | testcase TC_rll_rel_ind_DCCH_0() runs on test_CT { |
| 3715 | var RllTestCases tcs := { |
| 3716 | valueof(t_EITC(0, valueof(ts_RslLinkID_DCCH(0)), '01020304'O, true)) |
| 3717 | }; |
| 3718 | f_rll_testmatrix(tcs, refers(f_TC_rll_rel_ind)); |
| 3719 | } |
| 3720 | |
| 3721 | testcase TC_rll_rel_ind_ACCH_0() runs on test_CT { |
| 3722 | var RllTestCases tcs := { |
| 3723 | valueof(t_EITC(0, valueof(ts_RslLinkID_SACCH(0)), ''O, true)) |
| 3724 | }; |
| 3725 | f_rll_testmatrix(tcs, refers(f_TC_rll_rel_ind)); |
| 3726 | } |
| 3727 | testcase TC_rll_rel_ind_DCCH_3() runs on test_CT { |
| 3728 | var RllTestCases tcs := { |
| 3729 | valueof(t_EITC(3, valueof(ts_RslLinkID_DCCH(3)), ''O, true)) |
| 3730 | }; |
| 3731 | f_rll_testmatrix(tcs, refers(f_TC_rll_rel_ind)); |
| 3732 | } |
| 3733 | testcase TC_rll_rel_ind_ACCH_3() runs on test_CT { |
| 3734 | var RllTestCases tcs := { |
| 3735 | valueof(t_EITC(3, valueof(ts_RslLinkID_SACCH(3)), ''O, true)) |
| 3736 | }; |
| 3737 | f_rll_testmatrix(tcs, refers(f_TC_rll_rel_ind)); |
| 3738 | } |
| 3739 | |
| 3740 | /* test if RLL REL REQ triggers DISC on Um; UA/DM triggers RLL REL CONF (TS 48.058 3.4) */ |
| 3741 | private function f_TC_rll_rel_req(charstring id) runs on ConnHdlr { |
| 3742 | var RllTestCase tc := g_pars.spec.rll; |
| 3743 | f_l1_tune(L1CTL); |
| 3744 | RSL.clear; |
| 3745 | |
| 3746 | /* activate the logical channel */ |
| 3747 | f_est_dchan(); |
| 3748 | L1CTL.clear; |
| 3749 | |
| 3750 | /* first establish the link-layer */ |
| 3751 | f_est_rll_mo(tc.sapi, tc.link_id, tc.l3); |
| 3752 | |
| 3753 | /* then send the REL REQ via RSL */ |
| 3754 | RSL.send(ts_RSL_REL_REQ(g_chan_nr, tc.link_id, RSL_REL_MODE_NORMAL)); |
| 3755 | /* ... and expect the DISC on the Um side */ |
| 3756 | alt { |
Harald Welte | bc6199f | 2018-05-10 19:38:18 +0200 | [diff] [blame] | 3757 | [] as_l1_exp_lapdm(tr_LAPDm_DISC(tc.sapi, cr_MT_CMD, true)) { |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3758 | /* FIXME: send a UA in resposne to the DISC */ |
| 3759 | } |
| 3760 | } |
| 3761 | |
| 3762 | /* release the channel */ |
| 3763 | f_rsl_chan_deact(); |
| 3764 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3765 | f_rslem_unregister(0, g_chan_nr); |
| 3766 | } |
| 3767 | testcase TC_rll_rel_req() runs on test_CT { |
| 3768 | var RllTestCases tcs := { |
| 3769 | valueof(t_EITC(0, valueof(ts_RslLinkID_DCCH(0)), '01020304'O, true)), |
| 3770 | valueof(t_EITC(0, valueof(ts_RslLinkID_SACCH(0)), ''O, true)), |
| 3771 | valueof(t_EITC(3, valueof(ts_RslLinkID_DCCH(3)), ''O, true)), |
| 3772 | valueof(t_EITC(3, valueof(ts_RslLinkID_SACCH(3)), ''O, true)) |
| 3773 | }; |
| 3774 | f_rll_testmatrix(tcs, refers(f_TC_rll_rel_req)); |
| 3775 | } |
| 3776 | |
| 3777 | /* test if RLL DATA REQ triggers I-frames on Um (TS 48.058 3.5) */ |
| 3778 | testcase TC_rll_data_req() runs on test_CT { |
| 3779 | } |
| 3780 | |
| 3781 | /* test if I-frames on Um trigger RLL DATA IND (TS 48.058 3.6) */ |
| 3782 | testcase TC_rll_data_ind() runs on test_CT { |
| 3783 | } |
| 3784 | |
| 3785 | /* test if RLL UNIT DATA REQ triggers UI-frame on Um (TS 48.058 3.7) */ |
| 3786 | private function f_TC_rll_ud_req(charstring id) runs on ConnHdlr { |
| 3787 | var RllTestCase tc := g_pars.spec.rll; |
| 3788 | |
| 3789 | f_l1_tune(L1CTL); |
| 3790 | RSL.clear; |
| 3791 | |
| 3792 | f_est_dchan(); |
| 3793 | L1CTL.clear; |
| 3794 | |
| 3795 | /* Send UNITDATA REQ on RSL side */ |
| 3796 | RSL.send(ts_RSL_UNITDATA_REQ(g_chan_nr, tc.link_id, tc.l3)); |
| 3797 | /* Expect it to arrive on the other side */ |
| 3798 | if (tc.link_id.c == SACCH) { |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 3799 | f_l1_exp_lapdm(tr_LAPDm_B4_UI(tc.sapi, cr_MT_CMD, tc.l3)); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3800 | } else { |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 3801 | f_l1_exp_lapdm(tr_LAPDm_UI(tc.sapi, cr_MT_CMD, tc.l3)); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3802 | } |
| 3803 | |
| 3804 | /* release the channel */ |
| 3805 | f_rsl_chan_deact(); |
| 3806 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3807 | f_rslem_unregister(0, g_chan_nr); |
| 3808 | } |
| 3809 | testcase TC_rll_unit_data_req_DCCH() runs on test_CT { |
| 3810 | var octetstring l3 := f_rnd_octstring(15); |
| 3811 | var RllTestCases tcs := { |
| 3812 | valueof(t_EITC(0, valueof(ts_RslLinkID_DCCH(0)), l3, true)), |
| 3813 | valueof(t_EITC(3, valueof(ts_RslLinkID_DCCH(3)), l3, true)) |
| 3814 | }; |
| 3815 | f_rll_testmatrix(tcs, refers(f_TC_rll_ud_req)); |
| 3816 | } |
| 3817 | testcase TC_rll_unit_data_req_ACCH() runs on test_CT { |
| 3818 | var octetstring l3 := f_rnd_octstring(19); |
| 3819 | var RllTestCases tcs := { |
| 3820 | valueof(t_EITC(0, valueof(ts_RslLinkID_SACCH(0)), l3, true)), |
| 3821 | valueof(t_EITC(3, valueof(ts_RslLinkID_SACCH(3)), l3, true)) |
| 3822 | }; |
| 3823 | f_rll_testmatrix(tcs, refers(f_TC_rll_ud_req)); |
| 3824 | } |
| 3825 | |
| 3826 | /* test if UI-frames on Um trigger RLL UNIT DATA IND (TS 48.058 3.8) */ |
| 3827 | private function f_TC_rll_ud_ind(charstring id) runs on ConnHdlr { |
| 3828 | var RllTestCase tc := g_pars.spec.rll; |
| 3829 | |
| 3830 | f_l1_tune(L1CTL); |
| 3831 | RSL.clear; |
| 3832 | |
| 3833 | f_est_dchan(); |
| 3834 | L1CTL.clear; |
| 3835 | |
| 3836 | /* Send LAPDm UI frame. There is no B4 format in uplink! */ |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 3837 | f_tx_lapdm(ts_LAPDm_UI(tc.sapi, cr_MO_CMD, tc.l3), tc.link_id); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3838 | /* Expdct RLL UNITDATA IND on RSL side */ |
| 3839 | alt { |
| 3840 | [] RSL.receive(tr_RSL_UNITDATA_IND(g_chan_nr, tc.link_id, tc.l3)) { |
| 3841 | setverdict(pass); |
| 3842 | } |
| 3843 | [] RSL.receive { repeat; } |
| 3844 | } |
| 3845 | |
| 3846 | /* release the channel */ |
| 3847 | f_rsl_chan_deact(); |
| 3848 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3849 | f_rslem_unregister(0, g_chan_nr); |
| 3850 | } |
| 3851 | testcase TC_rll_unit_data_ind_DCCH() runs on test_CT { |
Stefan Sperling | c418191 | 2018-07-25 17:03:08 +0200 | [diff] [blame] | 3852 | var octetstring l3 := f_rnd_octstring(20); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3853 | var RllTestCases tcs := { |
| 3854 | valueof(t_EITC(0, valueof(ts_RslLinkID_DCCH(0)), l3, true)), |
| 3855 | valueof(t_EITC(3, valueof(ts_RslLinkID_DCCH(3)), l3, true)) |
| 3856 | }; |
| 3857 | f_rll_testmatrix(tcs, refers(f_TC_rll_ud_ind)); |
| 3858 | } |
| 3859 | testcase TC_rll_unit_data_ind_ACCH() runs on test_CT { |
| 3860 | var octetstring l3 := f_rnd_octstring(18); |
| 3861 | var RllTestCases tcs := { |
| 3862 | valueof(t_EITC(0, valueof(ts_RslLinkID_SACCH(0)), l3, true)), |
| 3863 | valueof(t_EITC(3, valueof(ts_RslLinkID_SACCH(3)), l3, true)) |
| 3864 | }; |
| 3865 | f_rll_testmatrix(tcs, refers(f_TC_rll_ud_ind)); |
| 3866 | } |
| 3867 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 3868 | /*********************************************************************** |
| 3869 | * Encryption Related |
| 3870 | ***********************************************************************/ |
| 3871 | |
| 3872 | /* send UNITDATA_REQ from BTS to MS and expect it to arrive */ |
| 3873 | function f_unitdata_mt(RslLinkId link_id, octetstring l3) runs on ConnHdlr { |
| 3874 | RSL.send(ts_RSL_UNITDATA_REQ(g_chan_nr, link_id, l3)); |
| 3875 | if (link_id.c == SACCH) { |
| 3876 | f_l1_exp_lapdm(tr_LAPDm_B4_UI(link_id.sapi, cr_MT_CMD, l3)); |
| 3877 | } else { |
| 3878 | f_l1_exp_lapdm(tr_LAPDm_UI(link_id.sapi, cr_MT_CMD, l3)); |
| 3879 | } |
| 3880 | } |
| 3881 | |
Vadim Yanitskiy | ad131c8 | 2018-10-04 06:18:59 +0700 | [diff] [blame] | 3882 | /* Expect (or not expect) other kinds of messages */ |
| 3883 | private altstep as_rsl_any_ind(boolean exp_any) runs on ConnHdlr { |
| 3884 | [exp_any] RSL.receive { repeat; } |
| 3885 | [not exp_any] RSL.receive { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3886 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RSL message!"); |
Vadim Yanitskiy | ad131c8 | 2018-10-04 06:18:59 +0700 | [diff] [blame] | 3887 | } |
| 3888 | } |
| 3889 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 3890 | /* Send UI frame from MS and expect it to arrive as RLL UNITDATA IND on Abis */ |
Vadim Yanitskiy | 8d8f91c | 2018-10-04 06:19:45 +0700 | [diff] [blame] | 3891 | private function f_unitdata_mo( |
Vadim Yanitskiy | 98e0315 | 2018-10-03 18:06:06 +0700 | [diff] [blame] | 3892 | RslLinkId link_id, |
| 3893 | octetstring l3, |
| 3894 | boolean exp_sacch := true, /* Should tolerate SACCH messages? */ |
Vadim Yanitskiy | b992050 | 2018-10-03 18:29:51 +0700 | [diff] [blame] | 3895 | boolean exp_any := false /* Should tolerate any other RSL messages? */ |
Vadim Yanitskiy | 98e0315 | 2018-10-03 18:06:06 +0700 | [diff] [blame] | 3896 | ) runs on ConnHdlr { |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 3897 | timer T := 3.0; |
| 3898 | f_tx_lapdm(ts_LAPDm_UI(link_id.sapi, cr_MO_CMD, l3), link_id); |
| 3899 | T.start; |
| 3900 | /* Expect RLL UNITDATA IND on RSL side */ |
| 3901 | alt { |
| 3902 | [] RSL.receive(tr_RSL_UNITDATA_IND(g_chan_nr, link_id, l3)) { |
| 3903 | setverdict(pass); |
| 3904 | } |
Vadim Yanitskiy | e0b91a7 | 2018-10-04 15:44:40 +0700 | [diff] [blame] | 3905 | [exp_sacch] as_meas_res(verify_meas := false); |
Vadim Yanitskiy | ad131c8 | 2018-10-04 06:18:59 +0700 | [diff] [blame] | 3906 | [] as_rsl_any_ind(exp_any); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 3907 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3908 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for UNIT_DATA_IND"); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 3909 | } |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 3910 | } |
| 3911 | } |
| 3912 | |
Vadim Yanitskiy | 4d78a70 | 2018-10-03 03:59:34 +0700 | [diff] [blame] | 3913 | /* Send I-frame from MS and expect it to arrive as RLL DATA IND on Abis */ |
| 3914 | private function f_data_mo( |
| 3915 | RslLinkId link_id, |
| 3916 | boolean p, uint3_t nr, uint3_t ns, |
| 3917 | octetstring l3, |
| 3918 | boolean exp_sacch := true, /* Should tolerate SACCH messages? */ |
Vadim Yanitskiy | b992050 | 2018-10-03 18:29:51 +0700 | [diff] [blame] | 3919 | boolean exp_any := false /* Should tolerate any other RSL messages? */ |
Vadim Yanitskiy | 4d78a70 | 2018-10-03 03:59:34 +0700 | [diff] [blame] | 3920 | ) runs on ConnHdlr { |
| 3921 | timer T := 3.0; |
| 3922 | f_tx_lapdm(ts_LAPDm_I(link_id.sapi, cr_MO_CMD, p, nr, ns, l3), link_id); |
| 3923 | T.start; |
| 3924 | /* Expect RLL DATA IND on RSL side */ |
| 3925 | alt { |
| 3926 | [] RSL.receive(tr_RSL_DATA_IND(g_chan_nr, link_id, l3)) { |
| 3927 | setverdict(pass); |
| 3928 | } |
Vadim Yanitskiy | e0b91a7 | 2018-10-04 15:44:40 +0700 | [diff] [blame] | 3929 | [exp_sacch] as_meas_res(verify_meas := false); |
Vadim Yanitskiy | 4d78a70 | 2018-10-03 03:59:34 +0700 | [diff] [blame] | 3930 | [] as_rsl_any_ind(exp_any); |
| 3931 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3932 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for DATA_IND"); |
Vadim Yanitskiy | 4d78a70 | 2018-10-03 03:59:34 +0700 | [diff] [blame] | 3933 | } |
| 3934 | } |
| 3935 | } |
| 3936 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 3937 | /* Test channel activation with A5/n right from the beginning (like in assignment + hand-over) */ |
| 3938 | function f_TC_chan_act_encr(charstring id) runs on ConnHdlr { |
| 3939 | f_l1_tune(L1CTL); |
| 3940 | f_est_dchan(true); |
| 3941 | |
| 3942 | /* now we actually need to transmit some data both ways to check if the encryption works */ |
| 3943 | var L1ctlDlMessage dl; |
| 3944 | |
Stefan Sperling | 603d98e | 2018-07-25 16:47:28 +0200 | [diff] [blame] | 3945 | var octetstring l3 := f_rnd_octstring(20); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 3946 | var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0)); |
| 3947 | |
| 3948 | /* send UNITDATA_REQ from BTS to MS and expect it to arrive */ |
| 3949 | f_unitdata_mt(link_id, l3); |
| 3950 | |
| 3951 | /* Send UI frame from MS and expect it to arrive as RLL UNITDATA IND on Abis */ |
| 3952 | f_unitdata_mo(link_id, l3); |
| 3953 | |
| 3954 | /* release the channel */ |
| 3955 | f_rsl_chan_deact(); |
| 3956 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3957 | f_rslem_unregister(0, g_chan_nr); |
| 3958 | } |
| 3959 | testcase TC_chan_act_a51() runs on test_CT { |
| 3960 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 3961 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_1, f_rnd_octstring(8))); |
| 3962 | f_testmatrix_each_chan(pars, refers(f_TC_chan_act_encr)); |
| 3963 | } |
| 3964 | testcase TC_chan_act_a52() runs on test_CT { |
| 3965 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 3966 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_2, f_rnd_octstring(8))); |
| 3967 | f_testmatrix_each_chan(pars, refers(f_TC_chan_act_encr)); |
| 3968 | } |
| 3969 | testcase TC_chan_act_a53() runs on test_CT { |
| 3970 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 3971 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_3, f_rnd_octstring(8))); |
| 3972 | f_testmatrix_each_chan(pars, refers(f_TC_chan_act_encr)); |
| 3973 | } |
| 3974 | |
| 3975 | |
| 3976 | /* Test unencrypted channel activation followed by explicit ENCR CMD later */ |
| 3977 | function f_TC_encr_cmd(charstring id) runs on ConnHdlr { |
| 3978 | /* L3 payload doesn't matter, as it is passed transparently */ |
| 3979 | var BIT3 l3_alg_id := f_alg_id_to_l3(g_pars.encr.alg_id); |
| 3980 | var octetstring l3 := enc_PDU_ML3_NW_MS(valueof(ts_RRM_CiphModeCmd(l3_alg_id))); |
| 3981 | var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0)); |
| 3982 | |
| 3983 | f_l1_tune(L1CTL); |
| 3984 | |
| 3985 | /* first establish a dedicated channel in the clear */ |
| 3986 | f_est_dchan(false); |
| 3987 | |
| 3988 | /* Establish ABM */ |
| 3989 | f_est_rll_mo(link_id.sapi, link_id, '23420815'O); |
| 3990 | |
| 3991 | /* then send the RSL ENCR CMD with an actual RR CIPH MOD CMD inside */ |
| 3992 | RSL.send(ts_RSL_ENCR_CMD(g_chan_nr, link_id, g_pars.encr.alg_id, g_pars.encr.key, l3)); |
| 3993 | /* expect the L3 to arrive still unencrypted on the MS side */ |
| 3994 | f_l1_exp_lapdm(tr_LAPDm_I(link_id.sapi, cr_MT_CMD, ?, ?, ?, l3)); |
| 3995 | |
| 3996 | /* configure L1 to apply ciphering */ |
| 3997 | var uint8_t alg_id := f_alg_id_to_l1ctl(g_pars.encr.alg_id); |
| 3998 | f_L1CTL_CRYPTO_REQ(L1CTL, g_pars.chan_nr, alg_id, g_pars.encr.key); |
| 3999 | |
Vadim Yanitskiy | 4d78a70 | 2018-10-03 03:59:34 +0700 | [diff] [blame] | 4000 | /* send first ciphered I-frame in response and expect it on RSL */ |
| 4001 | f_data_mo(link_id, true, 1, 0, '0a0b0c0d'O, exp_sacch := true); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 4002 | |
| 4003 | /* now the BTS code should have detected the first properly encrypted uplink I-frame, |
| 4004 | * and hence enable encryption also on the downlink */ |
| 4005 | |
| 4006 | /* expect bi-directional communication work in encrypted mode */ |
| 4007 | f_unitdata_mo(link_id, f_rnd_octstring(15)); |
| 4008 | f_unitdata_mt(link_id, f_rnd_octstring(15)); |
| 4009 | |
| 4010 | /* release the channel */ |
| 4011 | f_rsl_chan_deact(); |
| 4012 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 4013 | f_rslem_unregister(0, g_chan_nr); |
| 4014 | } |
| 4015 | testcase TC_encr_cmd_a51() runs on test_CT { |
| 4016 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 4017 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_1, f_rnd_octstring(8))); |
| 4018 | f_testmatrix_each_chan(pars, refers(f_TC_encr_cmd)); |
| 4019 | } |
| 4020 | testcase TC_encr_cmd_a52() runs on test_CT { |
| 4021 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 4022 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_2, f_rnd_octstring(8))); |
| 4023 | f_testmatrix_each_chan(pars, refers(f_TC_encr_cmd)); |
| 4024 | } |
| 4025 | testcase TC_encr_cmd_a53() runs on test_CT { |
| 4026 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 4027 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_3, f_rnd_octstring(8))); |
| 4028 | f_testmatrix_each_chan(pars, refers(f_TC_encr_cmd)); |
| 4029 | } |
| 4030 | |
| 4031 | private function f_assert_lapdm(octetstring enc, template LapdmFrame exp_match, charstring name := "") { |
| 4032 | var LapdmFrame lf; |
| 4033 | var octetstring reenc; |
| 4034 | |
| 4035 | /* decode the LAPDm frame */ |
| 4036 | if (ischosen(exp_match.ab)) { |
| 4037 | lf.ab := dec_LapdmFrameAB(enc); |
| 4038 | } else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4039 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "unsupported frame type"); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 4040 | } |
| 4041 | |
| 4042 | /* check if decoder result matches expectation */ |
| 4043 | if (not match(lf, exp_match)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4044 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str(name, ": decoded LAPDm doesn't match")); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 4045 | } else { |
| 4046 | log(name, ": matched"); |
| 4047 | setverdict(pass); |
| 4048 | } |
| 4049 | |
| 4050 | /* test if re-encoded frame equals original input */ |
| 4051 | reenc := enc_LapdmFrame(lf); |
| 4052 | if (enc != reenc) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4053 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str(name, ": re-encoded LAPDm frame doesn't match")); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 4054 | } else { |
| 4055 | setverdict(pass); |
| 4056 | } |
| 4057 | } |
| 4058 | |
| 4059 | testcase TC_lapdm_selftest() runs on test_CT { |
| 4060 | f_assert_lapdm('030301'O, tr_LAPDm_UI(0, true, ''O), "ui_s0_empty"); |
| 4061 | f_assert_lapdm('0F0301'O, tr_LAPDm_UI(3, true, ''O), "ui_s3_empty"); |
| 4062 | f_assert_lapdm('013F01'O, tr_LAPDm_SABM(0, false, true, ''O), "sabm_s0_empty"); |
| 4063 | f_assert_lapdm('013F1123420815'O, tr_LAPDm_SABM(0, false, true, '23420815'O), "sabm_s0_l3"); |
| 4064 | f_assert_lapdm('03E101'O, tr_LAPDm_RR(0, true, false, 7), "rr_s0_7"); |
| 4065 | f_assert_lapdm('03000d063505'O, tr_LAPDm_I(0, true, false, 0, 0, '063505'O), "I/0/0"); |
| 4066 | f_assert_lapdm('03e00d063505'O, tr_LAPDm_I(0, true, false, 7, 0, '063505'O), "I/7/0"); |
| 4067 | } |
| 4068 | |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 4069 | /*********************************************************************** |
| 4070 | * DTX Related (see GSM 05.08, section 8.3) |
| 4071 | ***********************************************************************/ |
| 4072 | |
| 4073 | /* XXX These functions must be kept in sync with g_AllChannels defined on test_CT. */ |
| 4074 | function f_g_chan_is_tchf() runs on ConnHdlr return boolean { |
| 4075 | return (g_chan_nr == valueof(ts_RslChanNr_Bm(1)) or |
| 4076 | g_chan_nr == valueof(ts_RslChanNr_Bm(2)) or |
| 4077 | g_chan_nr == valueof(ts_RslChanNr_Bm(3)) or |
| 4078 | g_chan_nr == valueof(ts_RslChanNr_Bm(4))); |
| 4079 | } |
| 4080 | function f_g_chan_is_tchh() runs on ConnHdlr return boolean { |
| 4081 | return (g_chan_nr == valueof(ts_RslChanNr_Lm(5,0)) or |
| 4082 | g_chan_nr == valueof(ts_RslChanNr_Lm(5,1))); |
| 4083 | } |
| 4084 | function f_g_chan_is_sdcch4() runs on ConnHdlr return boolean { |
| 4085 | return (g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,0)) or |
| 4086 | g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,1)) or |
| 4087 | g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,2)) or |
| 4088 | g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,3))); |
| 4089 | } |
| 4090 | function f_g_chan_is_sdcch8() runs on ConnHdlr return boolean { |
| 4091 | return (g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,0)) or |
| 4092 | g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,1)) or |
| 4093 | g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,2)) or |
| 4094 | g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,3)) or |
| 4095 | g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,4)) or |
| 4096 | g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,5)) or |
| 4097 | g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,6)) or |
| 4098 | g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,7))); |
| 4099 | } |
| 4100 | |
| 4101 | function f_test_l2_fill_frames(boolean dtxd) runs on ConnHdlr { |
| 4102 | var L1ctlDlMessage dl; |
| 4103 | var octetstring l2_fill_frame := '0303012B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B'O; |
| 4104 | var octetstring l2_fill_frame_sacch := substr(l2_fill_frame, 0, lengthof(l2_fill_frame) - 2); |
| 4105 | var GsmFrameNumber first_fn; |
| 4106 | var boolean is_first_frame := true; |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 4107 | var integer nfill_frames_sacch := 0; |
| 4108 | var integer nfill_frames_nonsacch := 0; |
| 4109 | var integer expected_fill_frames := 10000; /* initial value causes test failure if not overridden */ |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 4110 | /* Frames numbers (mod 104) for which a fill frame is expected on TCHF if DTX is enabled. */ |
| 4111 | var Integers required_tdma_frames_dtx_tchf := { 52, 53, 54, 55, 56, 57, 58, 59 }; |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 4112 | const integer frame_dtx_tchf_mod := 104; |
| 4113 | /* Frame numbers (mod 104) for which a fill frame is expected at the L1SAP level, |
| 4114 | * which operates in terms of blocks rather than frames. */ |
| 4115 | var Integers required_tdma_blocks_dtx_tchf := { 52, 56 }; |
| 4116 | const integer block_dtx_tchf_mod := 26; |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 4117 | timer T := 5.0; |
| 4118 | |
| 4119 | f_l1_tune(L1CTL); |
| 4120 | RSL.clear; |
| 4121 | L1CTL.clear; |
| 4122 | |
| 4123 | /* activate TCHF signalling channel */ |
| 4124 | f_est_dchan(false); |
| 4125 | |
| 4126 | T.start; |
| 4127 | alt { |
| 4128 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, ?)) -> value dl { |
| 4129 | var GsmFrameNumber fn := dl.dl_info.frame_nr; |
| 4130 | var octetstring l2 := dl.payload.data_ind.payload; |
| 4131 | |
| 4132 | if (is_first_frame) { |
| 4133 | is_first_frame := false; |
| 4134 | first_fn := dl.dl_info.frame_nr; |
| 4135 | } |
| 4136 | |
| 4137 | if (dl.dl_info.link_id.c == SACCH) { |
| 4138 | l2 := substr(l2, 2, lengthof(l2) - 2); /* remove L1 header */ |
| 4139 | if (not match(l2_fill_frame_sacch, l2)) { |
| 4140 | repeat; |
| 4141 | } |
| 4142 | } else if (not match(l2_fill_frame, l2)) { |
| 4143 | repeat; |
| 4144 | } |
| 4145 | |
| 4146 | if (dtxd) { |
| 4147 | if (not f_g_chan_is_tchf()) { |
| 4148 | T.stop; |
| 4149 | f_rsl_chan_deact(); |
| 4150 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4151 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received fill frame on non-TCH/F channel; DTX is only allowed on TCH/F!"); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 4152 | } |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 4153 | if (fn > first_fn + frame_dtx_tchf_mod) { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 4154 | T.stop; |
| 4155 | f_rsl_chan_deact(); |
| 4156 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 4157 | |
| 4158 | /* With DTX enabled we can expect at least 3 fill frames for every 104 frames. |
| 4159 | * 2 SACCH, 1 TCH/F */ |
| 4160 | expected_fill_frames := 3; |
| 4161 | |
| 4162 | if (nfill_frames_sacch + nfill_frames_nonsacch < expected_fill_frames) { |
| 4163 | log("received only ", nfill_frames_sacch, "+", nfill_frames_nonsacch, |
| 4164 | " (SACCH+other) out of ", expected_fill_frames, " expected fill frames"); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4165 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Not enough fill frames received"); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 4166 | } else { |
| 4167 | setverdict(pass); |
| 4168 | } |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 4169 | } else { |
| 4170 | if (dl.dl_info.link_id.c == SACCH) { |
| 4171 | nfill_frames_sacch := nfill_frames_sacch + 1; |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 4172 | repeat; |
| 4173 | } |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 4174 | /* On DTX TCH/F channels, fill frames occur only for specific frame numbers mod 104. |
| 4175 | * Furthermore, the L1SAP layer gives us frame numbers for the start of a block so |
| 4176 | * we should only see the subset of frames numbers which correspond to a block boundary. |
| 4177 | * TCH/F blocks are defined to start at 0,4,8,13,17,21 (modulo 26) */ |
| 4178 | for (var integer i := 0; i < lengthof(required_tdma_blocks_dtx_tchf); i := i + 1) { |
| 4179 | if (fn mod frame_dtx_tchf_mod == required_tdma_blocks_dtx_tchf[i]) { |
| 4180 | nfill_frames_nonsacch := nfill_frames_nonsacch + 1; |
| 4181 | repeat; |
| 4182 | } |
| 4183 | } |
| 4184 | log("Received DTX TCH fill frame with bad frame number: ", fn, |
| 4185 | " (mod ", frame_dtx_tchf_mod, ": ", fn mod frame_dtx_tchf_mod, ")", |
| 4186 | " (mod ", block_dtx_tchf_mod, ": ", fn mod block_dtx_tchf_mod, ")"); |
| 4187 | f_rsl_chan_deact(); |
| 4188 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4189 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected L2 fill frame received on Um"); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 4190 | } |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 4191 | } else { |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 4192 | if (dl.dl_info.link_id.c == SACCH) { |
| 4193 | nfill_frames_sacch := nfill_frames_sacch + 1; |
| 4194 | } else { |
| 4195 | nfill_frames_nonsacch := nfill_frames_nonsacch + 1; |
| 4196 | } |
| 4197 | if (fn > first_fn + frame_dtx_tchf_mod) { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 4198 | T.stop; |
| 4199 | if (f_g_chan_is_tchf()) { |
| 4200 | /* Without DTX we can expect 25 fill frames for every 104 frames. |
| 4201 | * (24 FACCH + 1 SACCH filling) */ |
| 4202 | expected_fill_frames := 25; |
| 4203 | } else if (f_g_chan_is_tchh()) { |
| 4204 | /* We can expect 2 fill frames for every 104 frames. */ |
| 4205 | expected_fill_frames := 2; |
| 4206 | } else if (f_g_chan_is_sdcch4() or f_g_chan_is_sdcch8()) { |
| 4207 | /* We can expect 5 fill frames for every 104 frames. */ |
| 4208 | expected_fill_frames := 5; |
| 4209 | } else { |
| 4210 | f_rsl_chan_deact(); |
| 4211 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4212 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unknown channel type"); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 4213 | } |
| 4214 | |
| 4215 | f_rsl_chan_deact(); |
| 4216 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 4217 | |
| 4218 | if (nfill_frames_sacch + nfill_frames_nonsacch >= expected_fill_frames) { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 4219 | setverdict(pass); |
| 4220 | } else { |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 4221 | log("received only ", nfill_frames_sacch, "+", nfill_frames_nonsacch, |
| 4222 | " (SACCH+other) out of ", expected_fill_frames, " expected fill frames"); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4223 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Not enough fill frames received"); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 4224 | } |
| 4225 | } else { |
| 4226 | repeat; |
| 4227 | } |
| 4228 | } |
| 4229 | } |
| 4230 | [] L1CTL.receive { repeat; } |
| 4231 | [] T.timeout { |
| 4232 | f_rsl_chan_deact(); |
| 4233 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4234 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for L2 fill frames on Um"); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 4235 | } |
| 4236 | } |
| 4237 | } |
| 4238 | |
| 4239 | function f_TC_tch_sign_l2_fill_frame(charstring id) runs on ConnHdlr { |
| 4240 | f_test_l2_fill_frames(false); |
| 4241 | } |
| 4242 | |
| 4243 | function f_TC_tch_sign_l2_fill_frame_dtxd(charstring id) runs on ConnHdlr { |
| 4244 | f_test_l2_fill_frames(true); |
| 4245 | } |
| 4246 | |
| 4247 | function f_tch_sign_l2_fill_frame(boolean dtxd) runs on test_CT { |
| 4248 | var ConnHdlr vc_conn; |
| 4249 | var ConnHdlrPars pars; |
| 4250 | pars.t_guard := 60.0; |
| 4251 | f_init(testcasename()); |
| 4252 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i + 1) { |
| 4253 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN(dtxd))); |
| 4254 | if (dtxd) { |
| 4255 | if (i >= 4) { /* DTX is only allowed on TCH/F */ |
| 4256 | break; |
| 4257 | } |
| 4258 | vc_conn := f_start_handler(refers(f_TC_tch_sign_l2_fill_frame_dtxd), pars); |
| 4259 | } else { |
| 4260 | vc_conn := f_start_handler(refers(f_TC_tch_sign_l2_fill_frame), pars); |
| 4261 | } |
| 4262 | vc_conn.done; |
| 4263 | } |
| 4264 | } |
| 4265 | |
| 4266 | /* Verify that L2 fill frames are sent on TCH in signaling mode if |
| 4267 | * there is nothing to transmit while DTX is disabled on downlink. */ |
| 4268 | testcase TC_tch_sign_l2_fill_frame() runs on test_CT { |
| 4269 | f_tch_sign_l2_fill_frame(false); |
| 4270 | } |
| 4271 | |
| 4272 | /* Verify that particular L2 fill frames are sent on TCH in signaling mode if |
| 4273 | * there is nothing to transmit while DTX is enabled on downlink. */ |
| 4274 | testcase TC_tch_sign_l2_fill_frame_dtxd() runs on test_CT { |
| 4275 | f_tch_sign_l2_fill_frame(true); |
| 4276 | } |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 4277 | |
Stefan Sperling | 0ec1c26 | 2018-10-15 15:12:52 +0200 | [diff] [blame] | 4278 | testcase TC_chopped_ipa_ping() runs on test_CT { |
| 4279 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_rsl_ip, mp_rsl_port, LISTEN_FOR_CLIENT); |
| 4280 | } |
| 4281 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 4282 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 4283 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_rsl_ip, mp_rsl_port, LISTEN_FOR_CLIENT); |
| 4284 | } |
| 4285 | |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 4286 | /* test generation of RLL ERR IND based on Um errors (TS 48.058 3.9) */ |
| 4287 | /* protocol error as per 44.006 */ |
| 4288 | /* link layer failure (repetition of I-frame N200 times without ACK */ |
| 4289 | /* repetition of SABM or DISC N200 times without ACK */ |
| 4290 | /* receptiom of SABM in multi-frame established state */ |
| 4291 | |
| 4292 | |
| 4293 | |
| 4294 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4295 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4296 | /* TODO Areas: |
| 4297 | |
| 4298 | * channel activation |
| 4299 | ** with BS_Power / MS_Power, bypassing power control loop |
| 4300 | ** on primary vs. secondary TRX |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4301 | ** with timing advance from initial activation on |
| 4302 | * mode modify |
| 4303 | ** encryption |
| 4304 | ** multirate |
| 4305 | * check DEACTIVATE SACCH |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4306 | ** unsupported algorithm |
| 4307 | * handover detection |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4308 | * BS Power Control |
| 4309 | * Physical Context |
Harald Welte | 43c5464 | 2018-09-15 17:47:04 +0300 | [diff] [blame] | 4310 | * CCCH Load Indication for RACH |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4311 | * SMS Broadcast Req / Cmd / CBCH LOad Ind |
| 4312 | * RF resource ind |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4313 | * error handling |
Harald Welte | 43c5464 | 2018-09-15 17:47:04 +0300 | [diff] [blame] | 4314 | ** discriminator error |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4315 | ** type error |
| 4316 | ** sequence error |
| 4317 | ** IE duplicated? |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4318 | * PCU interface |
| 4319 | ** TIME_IND from BTS->PCU |
| 4320 | ** DATA_IND from BTS->PCU |
| 4321 | ** verification of PCU-originated DATA_REQ arrival on Um/MS side |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4322 | |
| 4323 | */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 4324 | |
| 4325 | control { |
| 4326 | execute( TC_chan_act_stress() ); |
| 4327 | execute( TC_chan_act_react() ); |
| 4328 | execute( TC_chan_deact_not_active() ); |
| 4329 | execute( TC_chan_act_wrong_nr() ); |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 4330 | execute( TC_deact_sacch() ); |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 4331 | execute( TC_sacch_filling() ); |
| 4332 | execute( TC_sacch_info_mod() ); |
Harald Welte | 075d84c | 2018-03-12 13:07:24 +0100 | [diff] [blame] | 4333 | execute( TC_sacch_multi() ); |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 4334 | execute( TC_sacch_multi_chg() ); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 4335 | execute( TC_rach_content() ); |
| 4336 | execute( TC_rach_count() ); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 4337 | execute( TC_rach_max_ta() ); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 4338 | execute( TC_meas_res_sign_tchf() ); |
| 4339 | execute( TC_meas_res_sign_tchh() ); |
| 4340 | execute( TC_meas_res_sign_sdcch4() ); |
| 4341 | execute( TC_meas_res_sign_sdcch8() ); |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 4342 | execute( TC_meas_res_sign_tchh_toa256() ); |
Philipp Maier | 4d1e9c9 | 2018-12-20 11:11:56 +0100 | [diff] [blame] | 4343 | execute( TC_rsl_ms_pwr_ctrl() ); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 4344 | execute( TC_conn_fail_crit() ); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4345 | execute( TC_paging_imsi_80percent() ); |
| 4346 | execute( TC_paging_tmsi_80percent() ); |
| 4347 | execute( TC_paging_imsi_200percent() ); |
| 4348 | execute( TC_paging_tmsi_200percent() ); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 4349 | execute( TC_rsl_protocol_error() ); |
| 4350 | execute( TC_rsl_mand_ie_error() ); |
| 4351 | execute( TC_rsl_ie_content_error() ); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4352 | execute( TC_si_sched_default() ); |
Harald Welte | 0cae455 | 2018-03-09 22:20:26 +0100 | [diff] [blame] | 4353 | execute( TC_si_sched_1() ); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4354 | execute( TC_si_sched_2bis() ); |
| 4355 | execute( TC_si_sched_2ter() ); |
| 4356 | execute( TC_si_sched_2ter_2bis() ); |
| 4357 | execute( TC_si_sched_2quater() ); |
| 4358 | execute( TC_si_sched_13() ); |
| 4359 | execute( TC_si_sched_13_2bis_2ter_2quater() ); |
Harald Welte | a871a38 | 2018-02-25 02:03:14 +0100 | [diff] [blame] | 4360 | execute( TC_ipa_dlcx_not_active() ); |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 4361 | execute( TC_ipa_crcx_twice_not_active() ); |
| 4362 | execute( TC_ipa_crcx_mdcx_dlcx_not_active() ); |
Harald Welte | 3ae11da | 2018-02-25 13:36:06 +0100 | [diff] [blame] | 4363 | execute( TC_ipa_crcx_mdcx_mdcx_dlcx_not_active() ); |
Harald Welte | 9912eb5 | 2018-02-25 13:30:15 +0100 | [diff] [blame] | 4364 | execute( TC_ipa_crcx_sdcch_not_active() ); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4365 | |
Pau Espin Pedrol | a14a8af | 2018-11-20 13:12:22 +0100 | [diff] [blame] | 4366 | if (mp_pcu_socket != "") { |
| 4367 | execute( TC_pcu_act_req() ); |
| 4368 | execute( TC_pcu_act_req_wrong_ts() ); |
| 4369 | execute( TC_pcu_act_req_wrong_bts() ); |
| 4370 | execute( TC_pcu_act_req_wrong_trx() ); |
| 4371 | execute( TC_pcu_deact_req() ); |
| 4372 | execute( TC_pcu_deact_req_wrong_ts() ); |
| 4373 | execute( TC_pcu_ver_si13() ); |
| 4374 | execute( TC_pcu_data_req_wrong_bts() ); |
| 4375 | execute( TC_pcu_data_req_wrong_trx() ); |
| 4376 | execute( TC_pcu_data_req_wrong_ts() ); |
| 4377 | execute( TC_pcu_data_req_ts_inactive() ); |
| 4378 | execute( TC_pcu_data_req_pdtch() ); |
| 4379 | execute( TC_pcu_data_req_ptcch() ); |
| 4380 | execute( TC_pcu_data_req_agch() ); |
| 4381 | execute( TC_pcu_data_req_imm_ass_pch() ); |
| 4382 | execute( TC_pcu_rach_content() ); |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 4383 | execute( TC_pcu_ext_rach_content() ); |
Pau Espin Pedrol | a14a8af | 2018-11-20 13:12:22 +0100 | [diff] [blame] | 4384 | execute( TC_pcu_paging_from_rsl() ); |
| 4385 | } else { |
| 4386 | log("PCU socket path not available, skipping PCU tests"); |
| 4387 | } |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 4388 | |
| 4389 | execute( TC_dyn_osmo_pdch_act_deact() ); |
| 4390 | execute( TC_dyn_osmo_pdch_unsol_deact() ); |
| 4391 | execute( TC_dyn_osmo_pdch_double_act() ); |
| 4392 | execute( TC_dyn_osmo_pdch_tchf_act() ); |
| 4393 | execute( TC_dyn_osmo_pdch_tchh_act() ); |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 4394 | execute( TC_dyn_ipa_pdch_act_deact() ); |
| 4395 | execute( TC_dyn_ipa_pdch_tchf_act() ); |
| 4396 | execute( TC_dyn_ipa_pdch_tchf_act_pdch_act_nack() ); |
| 4397 | execute( TC_dyn_ipa_pdch_act_tchf_act_nack() ); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 4398 | |
| 4399 | execute( TC_rll_est_ind() ); |
| 4400 | execute( TC_rll_est_req_DCCH_3() ); |
| 4401 | execute( TC_rll_est_req_ACCH_3() ); |
| 4402 | execute( TC_rll_rel_ind_DCCH_0() ); |
| 4403 | execute( TC_rll_rel_ind_DCCH_3() ); |
| 4404 | execute( TC_rll_rel_ind_ACCH_0() ); |
| 4405 | execute( TC_rll_rel_ind_ACCH_3() ); |
| 4406 | execute( TC_rll_rel_req() ); |
| 4407 | execute( TC_rll_unit_data_req_DCCH() ); |
| 4408 | execute( TC_rll_unit_data_req_ACCH() ); |
| 4409 | execute( TC_rll_unit_data_ind_DCCH() ); |
| 4410 | execute( TC_rll_unit_data_ind_ACCH() ); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 4411 | |
| 4412 | execute( TC_chan_act_a51() ); |
| 4413 | execute( TC_chan_act_a52() ); |
| 4414 | execute( TC_chan_act_a53() ); |
| 4415 | execute( TC_encr_cmd_a51() ); |
| 4416 | execute( TC_encr_cmd_a52() ); |
| 4417 | execute( TC_encr_cmd_a53() ); |
| 4418 | |
| 4419 | execute( TC_lapdm_selftest() ); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 4420 | |
| 4421 | execute( TC_tch_sign_l2_fill_frame() ); |
| 4422 | execute( TC_tch_sign_l2_fill_frame_dtxd() ); |
Stefan Sperling | 0ec1c26 | 2018-10-15 15:12:52 +0200 | [diff] [blame] | 4423 | |
| 4424 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 4425 | execute( TC_chopped_ipa_payload() ); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 4426 | } |
| 4427 | |
| 4428 | |
| 4429 | } |