Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1 | module BSC_Tests { |
| 2 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 3 | import from General_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 4 | import from Osmocom_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 5 | import from GSM_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 6 | import from IPL4asp_Types all; |
| 7 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 8 | import from BSSAP_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 9 | import from BSSAP_Adapter all; |
| 10 | import from BSSAP_CodecPort all; |
| 11 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 12 | import from IPA_Emulation all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 13 | import from IPA_Types all; |
| 14 | import from RSL_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 15 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 16 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 17 | import from Osmocom_CTRL_Types all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 18 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 19 | import from MobileL3_CommonIE_Types all; |
| 20 | import from L3_Templates all; |
| 21 | import from GSM_RR_Types all; |
| 22 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 23 | import from RSL_Tests all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 24 | |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 25 | const integer NUM_BTS := 1; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 26 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 27 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 28 | |
| 29 | /* BSC specific CTRL helper functions */ |
| 30 | function f_ctrl_get_bts(IPA_CTRL_PT pt, integer bts_nr, charstring suffix) return CtrlValue { |
| 31 | return f_ctrl_get(pt, "bts." & int2str(bts_nr) & "." & suffix); |
| 32 | } |
| 33 | |
| 34 | template charstring ts_bts(integer bts_nr) := "bts." & int2str(bts_nr) & "."; |
| 35 | template charstring ts_bts_trx(integer bts_nr, integer trx_nr ) := |
| 36 | valueof(ts_bts(bts_nr)) & "trx." & int2str(trx_nr) & "."; |
| 37 | |
| 38 | function f_ctrl_get_exp_bts(IPA_CTRL_PT pt, integer bts_nr, CtrlVariable suffix, template CtrlValue exp) { |
| 39 | f_ctrl_get_exp(pt, valueof(ts_bts(bts_nr)) & suffix, exp); |
| 40 | } |
| 41 | |
| 42 | function f_ctrl_get_exp_trx(IPA_CTRL_PT pt, integer bts_nr, integer trx_nr, CtrlVariable suffix, |
| 43 | template CtrlValue exp) |
| 44 | { |
| 45 | f_ctrl_get_exp(pt, valueof(ts_bts_trx(bts_nr, trx_nr)) & suffix, exp); |
| 46 | } |
| 47 | |
| 48 | |
| 49 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 50 | type record BTS_State { |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 51 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 52 | } |
| 53 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 54 | type component test_CT extends BSSAP_Adapter_CT { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 55 | var BTS_State bts[NUM_BTS]; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 56 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 57 | |
| 58 | var IPA_Client ctrl; |
| 59 | port IPA_CTRL_PT IPA_CTRL; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 60 | |
| 61 | var boolean g_initialized := false; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 62 | timer T_guard := 30.0; |
| 63 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | modulepar { |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 67 | charstring mp_bsc_ip := "127.0.0.1"; |
| 68 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 69 | integer mp_bsc_ctrl_port := 4249; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 70 | } |
| 71 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 72 | type record IPA_Client { |
| 73 | IPA_Emulation_CT vc_IPA, |
| 74 | IPA_CCM_Parameters ccm_pars, |
| 75 | charstring id |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 76 | } |
| 77 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 78 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 79 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 80 | timer T := 10.0; |
| 81 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 82 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 83 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 84 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 85 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 86 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
| 87 | |
| 88 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
| 89 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 90 | |
| 91 | clnt.vc_IPA.start(IPA_Emulation.main_client(bsc_host, bsc_port, "", -1, clnt.ccm_pars)); |
| 92 | |
| 93 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 94 | T.start; |
| 95 | alt { |
| 96 | [] IPA_RSL[i].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_ID_ACK}) { |
| 97 | T.stop; |
| 98 | IPA_RSL[i].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_PAGING_LOAD_IND(23))); |
| 99 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 100 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 101 | [] IPA_RSL[i].receive { repeat } |
| 102 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 103 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 104 | self.stop; |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 109 | function f_ipa_ctrl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i) |
| 110 | runs on test_CT { |
| 111 | timer T := 10.0; |
| 112 | |
| 113 | clnt.id := "IPA" & int2str(i) & "-CTRL"; |
| 114 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 115 | |
| 116 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 117 | connect(clnt.vc_IPA:IPA_CTRL_PORT, self:IPA_CTRL); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 118 | |
| 119 | clnt.vc_IPA.start(IPA_Emulation.main_client(bsc_host, bsc_port, "", -1)); |
| 120 | |
| 121 | /* wait for IPA CTRL link to connect and send UP */ |
| 122 | T.start; |
| 123 | alt { |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 124 | [] IPA_CTRL.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP}) { } |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 125 | [] T.timeout { |
| 126 | setverdict(fail, "Timeout CTRL waiting for ASP_IPA_EVENT_UP"); |
| 127 | self.stop; |
| 128 | } |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 133 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 134 | timer T := secs_max; |
| 135 | T.start; |
| 136 | while (true) { |
| 137 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 138 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 139 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 140 | * until all MO's are initialized */ |
| 141 | T.start(1.0); |
| 142 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 143 | return; |
| 144 | } |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 145 | f_sleep(0.5); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 146 | if (not T.running) { |
| 147 | setverdict(fail, "Timeout waiting for oml-connection-state ", status); |
| 148 | self.stop; |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 153 | function f_sleep(float seconds) { |
| 154 | timer T := seconds; |
| 155 | T.start; |
| 156 | T.timeout; |
| 157 | } |
| 158 | |
| 159 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 160 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 161 | [] T_guard.timeout { setverdict(fail, "Timeout of T_guard"); } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 162 | /* always respond with RESET ACK to RESET */ |
| 163 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value ud_ind { |
| 164 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
| 165 | ts_BSSMAP_ResetAck)); |
| 166 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | function f_init() runs on test_CT { |
| 170 | var integer i; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 171 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 172 | if (g_initialized) { |
| 173 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 174 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 175 | g_initialized := true; |
| 176 | |
| 177 | /* Call a function of our 'parent component' BSSAP_Adapter_CT to start the |
| 178 | * MSC-side BSSAP emulation */ |
| 179 | f_bssap_init("VirtMSC"); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 180 | f_ipa_ctrl_start(ctrl, mp_bsc_ip, mp_bsc_ctrl_port, 0); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 181 | |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 182 | for (i := 0; i < NUM_BTS; i := i+1) { |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 183 | /* wait until osmo-bts-omldummy has respawned */ |
| 184 | f_wait_oml(i, "degraded", 5.0); |
| 185 | /* start RSL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 186 | f_ipa_rsl_start(bts[i].rsl, mp_bsc_ip, mp_bsc_rsl_port, i); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 187 | /* wait until BSC tells us "connected" */ |
| 188 | f_wait_oml(i, "connected", 5.0); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 189 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 190 | f_sleep(0.5); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 191 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 192 | T_guard.start; |
| 193 | activate(as_Tguard()); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 194 | } |
| 195 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 196 | function f_exp_ipa_rx(integer bts_nr, template RSL_Message t_rx, float t_secs := 2.0, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
| 197 | runs on test_CT return RSL_Message { |
| 198 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 199 | timer T := t_secs; |
| 200 | |
| 201 | T.start; |
| 202 | alt { |
| 203 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(sid, t_rx)) -> value rx_rsl_ud { |
| 204 | T.stop; |
| 205 | } |
| 206 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 207 | [] T.timeout { |
| 208 | setverdict(fail, "Timeout expecting ", t_rx); |
| 209 | self.stop; |
| 210 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 211 | } |
| 212 | return rx_rsl_ud.rsl; |
| 213 | } |
| 214 | |
| 215 | function f_ipa_tx(integer bts_nr, template RSL_Message t_tx, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
| 216 | runs on test_CT { |
| 217 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(sid, t_tx)); |
| 218 | } |
| 219 | |
| 220 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 221 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 222 | testcase TC_chan_act_noreply() runs on test_CT { |
| 223 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 224 | |
| 225 | f_init(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 226 | f_bssap_reset(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 227 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 228 | IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23))); |
| 229 | f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 230 | setverdict(pass); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 231 | } |
| 232 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 233 | /* verify if the "chreq:total" counter increments as expected */ |
| 234 | testcase TC_chan_act_counter() runs on test_CT { |
| 235 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 236 | var integer chreq_total; |
| 237 | |
| 238 | f_init(); |
| 239 | f_bssap_reset(); |
| 240 | |
| 241 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 242 | IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23))); |
| 243 | f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 244 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 245 | |
| 246 | setverdict(pass); |
| 247 | } |
| 248 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 249 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
| 250 | testcase TC_chan_act_ack_noest() runs on test_CT { |
| 251 | var RSL_Message rx_rsl; |
| 252 | |
| 253 | f_init(); |
| 254 | f_bssap_reset(); |
| 255 | |
| 256 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 257 | f_ipa_tx(0, ts_RSL_CHAN_RQD('23'O, 23)); |
| 258 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 259 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 260 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 23)); |
| 261 | |
| 262 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 263 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 264 | |
| 265 | setverdict(pass); |
| 266 | } |
| 267 | |
| 268 | /* Test behavior if MSC never answers to CR */ |
| 269 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
| 270 | var RSL_Message rx_rsl; |
| 271 | |
| 272 | f_init(); |
| 273 | f_bssap_reset(); |
| 274 | |
| 275 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 276 | f_ipa_tx(0, ts_RSL_CHAN_RQD('23'O, 23)); |
| 277 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 278 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 279 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 23)); |
| 280 | |
| 281 | var octetstring l3 := '00010203040506'O |
| 282 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 283 | |
| 284 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 285 | |
| 286 | /* expect BSC to disable the channel again if there's no response from MSC */ |
| 287 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 288 | |
| 289 | setverdict(pass); |
| 290 | } |
| 291 | |
| 292 | /* Test behavior if MSC answers with CREF to CR */ |
| 293 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 294 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 295 | var RSL_Message rx_rsl; |
| 296 | |
| 297 | f_init(); |
| 298 | f_bssap_reset(); |
| 299 | |
| 300 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 301 | f_ipa_tx(0, ts_RSL_CHAN_RQD('23'O, 23)); |
| 302 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 303 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 304 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 23)); |
| 305 | |
| 306 | var octetstring l3 := '00010203040506'O |
| 307 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 308 | |
| 309 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 310 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 311 | |
| 312 | /* expect BSC to disable the channel */ |
| 313 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 314 | |
| 315 | setverdict(pass); |
| 316 | } |
| 317 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 318 | type record DchanTuple { |
| 319 | integer sccp_conn_id, |
| 320 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 321 | } |
| 322 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 323 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 324 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 325 | runs on test_CT return DchanTuple { |
| 326 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 327 | var RSL_Message rx_rsl; |
| 328 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 329 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 330 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 331 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 332 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 333 | dt.rsl_chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 334 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, fn+1)); |
| 335 | |
| 336 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 337 | |
| 338 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 339 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 340 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 341 | |
| 342 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 343 | } |
| 344 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 345 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 346 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
| 347 | var RSL_Message rx_rsl; |
| 348 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 349 | |
| 350 | f_init(); |
| 351 | f_bssap_reset(); |
| 352 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 353 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 354 | |
| 355 | /* simulate RLL REL IND */ |
| 356 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 357 | |
| 358 | /* expect BSC to disable the channel */ |
| 359 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 360 | /* respond with CHAN REL ACK */ |
| 361 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 362 | |
| 363 | /* expect DISC_IND on MSC side */ |
| 364 | BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)); |
| 365 | |
| 366 | setverdict(pass); |
| 367 | } |
| 368 | |
| 369 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 370 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 371 | var BSSAP_N_DATA_ind rx_di; |
| 372 | var RSL_Message rx_rsl; |
| 373 | var DchanTuple dt; |
| 374 | |
| 375 | f_init(); |
| 376 | f_bssap_reset(); |
| 377 | |
| 378 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 379 | |
| 380 | /* simulate CONN FAIL IND */ |
| 381 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, 0)); |
| 382 | /* TODO: different cause values? */ |
| 383 | |
| 384 | /* expect BSC to disable the channel */ |
| 385 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 386 | /* respond with CHAN REL ACK */ |
| 387 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 388 | |
| 389 | /* expect Clear Request from BSC */ |
| 390 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 391 | |
| 392 | /* Instruct BSC to clear channel */ |
| 393 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 394 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 395 | |
| 396 | /* expect Clear Complete from BSC */ |
| 397 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 398 | |
| 399 | /* release the SCCP connection */ |
| 400 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 401 | |
| 402 | /* wait for SCCP emulation to do its job */ |
| 403 | f_sleep(1.0); |
| 404 | |
| 405 | setverdict(pass); |
| 406 | } |
| 407 | |
| 408 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 409 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 410 | var BSSAP_N_DATA_ind rx_di; |
| 411 | var RSL_Message rx_rsl; |
| 412 | var DchanTuple dt; |
| 413 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 414 | |
| 415 | f_init(); |
| 416 | f_bssap_reset(); |
| 417 | |
| 418 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 419 | |
| 420 | /* Instruct BSC to clear channel */ |
| 421 | var BssmapCause cause := 0; |
| 422 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 423 | |
| 424 | /* expect Clear Complete from BSC on A */ |
| 425 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 426 | /* release the SCCP connection */ |
| 427 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 428 | } |
| 429 | |
| 430 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 431 | IPA_RSL[0].clear; |
| 432 | alt { |
| 433 | /* ignore DEACTIVATE SACCH (if any) */ |
| 434 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 435 | tr_RSL_DEACT_SACCH(dt.rsl_chan_nr))) { |
| 436 | repeat; |
| 437 | } |
| 438 | /* acknowledge RLL release (if any)*/ |
| 439 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 440 | tr_RSL_REL_REQ(dt.rsl_chan_nr, ?))) { |
| 441 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
| 442 | f_ipa_tx(0, ts_RSL_REL_CONF(dt.rsl_chan_nr, main_dcch)); |
| 443 | repeat; |
| 444 | } |
| 445 | /* Expect RF channel release from BSC on Abis */ |
| 446 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 447 | tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
| 448 | /* respond with CHAN REL ACK */ |
| 449 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | setverdict(pass); |
| 454 | } |
| 455 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 456 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 457 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
| 458 | var RSL_Message rx_rsl; |
| 459 | var DchanTuple dt; |
| 460 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 461 | |
| 462 | f_init(); |
| 463 | f_bssap_reset(); |
| 464 | |
| 465 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 466 | |
| 467 | /* release the SCCP connection */ |
| 468 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 469 | |
| 470 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 471 | IPA_RSL[0].clear; |
| 472 | alt { |
| 473 | /* ignore DEACTIVATE SACCH (if any) */ |
| 474 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 475 | tr_RSL_DEACT_SACCH(dt.rsl_chan_nr))) { |
| 476 | repeat; |
| 477 | } |
| 478 | /* acknowledge RLL release (if any)*/ |
| 479 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 480 | tr_RSL_REL_REQ(dt.rsl_chan_nr, ?))) { |
| 481 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
| 482 | f_ipa_tx(0, ts_RSL_REL_CONF(dt.rsl_chan_nr, main_dcch)); |
| 483 | repeat; |
| 484 | } |
| 485 | /* Expect RF channel release from BSC on Abis */ |
| 486 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 487 | tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
| 488 | /* respond with CHAN REL ACK */ |
| 489 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | setverdict(pass); |
| 494 | } |
| 495 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 496 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 497 | testcase TC_chan_rel_a_reset() runs on test_CT { |
| 498 | var RSL_Message rx_rsl; |
| 499 | var DchanTuple dt; |
| 500 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 501 | |
| 502 | f_init(); |
| 503 | f_bssap_reset(); |
| 504 | |
| 505 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 506 | |
| 507 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 508 | IPA_RSL[0].clear; |
| 509 | |
| 510 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
| 511 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_sccp_addr_peer, g_sccp_addr_own, ts_BSSMAP_Reset(0))); |
| 512 | interleave { |
| 513 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_sccp_addr_own, g_sccp_addr_peer, tr_BSSMAP_ResetAck)) { } |
| 514 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 515 | } |
| 516 | |
| 517 | alt { |
| 518 | /* ignore DEACTIVATE SACCH (if any) */ |
| 519 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 520 | tr_RSL_DEACT_SACCH(dt.rsl_chan_nr))) { |
| 521 | repeat; |
| 522 | } |
| 523 | /* acknowledge RLL release (if any)*/ |
| 524 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 525 | tr_RSL_REL_REQ(dt.rsl_chan_nr, ?))) { |
| 526 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
| 527 | f_ipa_tx(0, ts_RSL_REL_CONF(dt.rsl_chan_nr, main_dcch)); |
| 528 | repeat; |
| 529 | } |
| 530 | /* Expect RF channel release from BSC on Abis */ |
| 531 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 532 | tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
| 533 | /* respond with CHAN REL ACK */ |
| 534 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 535 | } |
| 536 | /* ignore any user data */ |
| 537 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_MsgTypeR(?))) { |
| 538 | repeat; |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | setverdict(pass); |
| 543 | } |
| 544 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 545 | |
| 546 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 547 | var charstring ctrl_resp; |
| 548 | |
| 549 | f_init(); |
| 550 | f_bssap_reset(); |
| 551 | |
| 552 | /* See https://osmocom.org/issues/2729 */ |
| 553 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
| 554 | setverdict(pass); |
| 555 | } |
| 556 | |
| 557 | testcase TC_ctrl() runs on test_CT { |
| 558 | var charstring ctrl_resp; |
| 559 | |
| 560 | f_init(); |
| 561 | f_bssap_reset(); |
| 562 | |
| 563 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 564 | |
| 565 | f_ctrl_get_exp(IPA_CTRL, "mcc", "1"); |
| 566 | f_ctrl_get_exp(IPA_CTRL, "mnc", "1"); |
| 567 | f_ctrl_get_exp(IPA_CTRL, "short-name", "OsmoBSC"); |
| 568 | f_ctrl_get_exp(IPA_CTRL, "long-name", "OsmoBSC"); |
| 569 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "1"); |
| 570 | |
| 571 | var integer bts_nr := 0; |
| 572 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 573 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 574 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 575 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 576 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 577 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 578 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 579 | |
| 580 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 581 | f_sleep(2.0); |
| 582 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 583 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 584 | } |
| 585 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 586 | |
| 587 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 588 | |
| 589 | setverdict(pass); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 590 | } |
| 591 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 592 | function f_bssap_tx_ud(template PDU_BSSAP bssap) runs on test_CT { |
| 593 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_sccp_addr_peer, g_sccp_addr_own, bssap)); |
| 594 | } |
| 595 | |
| 596 | |
| 597 | /*********************************************************************** |
| 598 | * Paging Testing |
| 599 | ***********************************************************************/ |
| 600 | |
| 601 | type record Cell_Identity { |
| 602 | GsmMcc mcc, |
| 603 | GsmMnc mnc, |
| 604 | GsmLac lac, |
| 605 | GsmCellId ci |
| 606 | }; |
| 607 | private const Cell_Identity cid := { '001'H, '001'H, 1, 0 }; |
| 608 | |
| 609 | |
| 610 | /* core paging test helper function; used by most paging test cases */ |
| 611 | private function f_pageing_helper(hexstring imsi, |
| 612 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
| 613 | template RSL_ChanNeeded rsl_chneed := omit, |
| 614 | template OCT4 tmsi := omit) runs on test_CT |
| 615 | { |
| 616 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
| 617 | var MobileIdentity mi; |
| 618 | var template octetstring id_enc; /* FIXME */ |
| 619 | var RSL_Message rx_rsl; |
| 620 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
| 621 | |
| 622 | f_init(); |
| 623 | f_bssap_reset(); |
| 624 | |
| 625 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
| 626 | IPA_RSL[0].clear; |
| 627 | |
| 628 | if (isvalue(rsl_chneed)) { |
| 629 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 630 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 631 | } else { |
| 632 | bssmap_chneed := omit; |
| 633 | } |
| 634 | |
| 635 | f_bssap_tx_ud(ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed)); |
| 636 | |
| 637 | /* FIXME: Disabled due to bugs in both GSM_RR_Types and MobileL3_CommonIE_Types IMSI encoder |
| 638 | if (isvalue(tmsi)) { |
| 639 | mi := valueof(t_Osmo_MI_TMSI(oct2int(valueof(tmsi)))); |
| 640 | } else { |
| 641 | mi := valueof(ts_Osmo_MI_IMSI(imsi)); |
| 642 | } |
| 643 | id_enc := enc_MobileIdentity(mi); |
| 644 | */ |
| 645 | id_enc := ?; |
| 646 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_PAGING_CMD(id_enc)); |
| 647 | /* check channel type, paging group */ |
| 648 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 649 | setverdict(fail, "Paging for wrong paging group"); |
| 650 | } |
| 651 | if (ispresent(rsl_chneed) and |
| 652 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 653 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 654 | } |
| 655 | |
| 656 | setverdict(pass); |
| 657 | } |
| 658 | |
| 659 | /* PAGING by IMSI + TMSI */ |
| 660 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 661 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 662 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 663 | f_pageing_helper('001010123456789'H, cid_list); |
| 664 | } |
| 665 | |
| 666 | /* PAGING by IMSI + TMSI */ |
| 667 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 668 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 669 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 670 | f_pageing_helper('001010100000001'H, cid_list, omit, 'A1B2C301'O); |
| 671 | } |
| 672 | |
| 673 | /* Paging with different "channel needed' values */ |
| 674 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 675 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 676 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 677 | f_pageing_helper('001010100000002'H, cid_list, RSL_CHANNEED_ANY, 'A1B2C302'O); |
| 678 | } |
| 679 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 680 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 681 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 682 | f_pageing_helper('001010100000003'H, cid_list, RSL_CHANNEED_SDCCH, 'A1B2C303'O); |
| 683 | } |
| 684 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 685 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 686 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 687 | f_pageing_helper('001010000000004'H, cid_list, RSL_CHANNEED_TCH_F, 'A1B2C304'O); |
| 688 | } |
| 689 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 690 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 691 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 692 | f_pageing_helper('001010000000005'H, cid_list, RSL_CHANNEED_TCH_ForH, 'A1B2C305'O); |
| 693 | } |
| 694 | |
| 695 | /* Paging by CGI */ |
| 696 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 697 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 698 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(cid.mcc, cid.mnc, cid.lac, cid.ci) } }; |
| 699 | f_pageing_helper('001010000000006'H, cid_list); |
| 700 | } |
| 701 | |
| 702 | /* Paging by LAC+CI */ |
| 703 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 704 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 705 | cid_list := { cIl_LAC_CI := { ts_BSSMAP_CI_LAC_CI(cid.lac, cid.ci) } }; |
| 706 | f_pageing_helper('001010000000007'H, cid_list); |
| 707 | } |
| 708 | |
| 709 | /* Paging by CI */ |
| 710 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 711 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 712 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
| 713 | f_pageing_helper('001010000000008'H, cid_list); |
| 714 | } |
| 715 | |
| 716 | /* Paging by LAI */ |
| 717 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 718 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 719 | cid_list := { cIl_LAI := { ts_BSSMAP_CI_LAI(cid.mcc, cid.mnc, cid.lac) } }; |
| 720 | f_pageing_helper('001010000000009'H, cid_list); |
| 721 | } |
| 722 | |
| 723 | /* Paging by LAC */ |
| 724 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 725 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 726 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
| 727 | f_pageing_helper('001010000000010'H, cid_list); |
| 728 | } |
| 729 | |
| 730 | /* Paging by "all in BSS" */ |
| 731 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 732 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 733 | cid_list := { cIl_allInBSS := ''O }; |
| 734 | f_pageing_helper('001010000000011'H, cid_list); |
| 735 | } |
| 736 | |
| 737 | /* Paging by PLMN+LAC+RNC */ |
| 738 | /* Paging by RNC */ |
| 739 | /* Paging by LAC+RNC */ |
| 740 | |
| 741 | /* Paging on multiple cells (multiple in one LAC): Verify all of them page */ |
| 742 | /* Paging on multiple cells (multiple entries in list): Verify all of them page */ |
| 743 | /* Verify paging retransmission interval + count */ |
| 744 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 745 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 746 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 747 | /* Verify PCH load */ |
| 748 | testcase TC_paging_imsi_load() runs on test_CT { |
| 749 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 750 | timer T := 4.0; |
| 751 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 752 | f_pageing_helper('001010123456789'H, cid_list); |
| 753 | |
| 754 | /* tell BSC there is no paging space anymore */ |
| 755 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 756 | |
| 757 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 758 | * there would be 8 retransmissions during 4 seconds */ |
| 759 | T.start; |
| 760 | alt { |
| 761 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 762 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
| 763 | self.stop; |
| 764 | } |
| 765 | [] T.timeout { |
| 766 | setverdict(pass); |
| 767 | } |
| 768 | } |
| 769 | } |
| 770 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 771 | /* Verify paging stops after A-RESET */ |
| 772 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 773 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 774 | timer T := 3.0; |
| 775 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 776 | f_pageing_helper('001010123456789'H, cid_list); |
| 777 | |
| 778 | /* Perform a BSSMAP Reset and wait for ACK */ |
| 779 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_sccp_addr_peer, g_sccp_addr_own, ts_BSSMAP_Reset(0))); |
| 780 | alt { |
| 781 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_sccp_addr_own, g_sccp_addr_peer, tr_BSSMAP_ResetAck)) { } |
| 782 | [] BSSAP.receive { repeat; } |
| 783 | } |
| 784 | |
| 785 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
| 786 | IPA_RSL[0].clear; |
| 787 | |
| 788 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 789 | T.start; |
| 790 | alt { |
| 791 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 792 | setverdict(fail, "Received PAGING after A-RESET"); |
| 793 | self.stop; |
| 794 | } |
| 795 | [] T.timeout { |
| 796 | setverdict(pass); |
| 797 | } |
| 798 | } |
| 799 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 800 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 801 | control { |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 802 | execute( TC_ctrl_msc_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 803 | execute( TC_ctrl() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 804 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 805 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 806 | execute( TC_chan_act_ack_noest() ); |
| 807 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 808 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 809 | execute( TC_chan_rel_rll_rel_ind() ); |
| 810 | execute( TC_chan_rel_conn_fail() ); |
| 811 | execute( TC_chan_rel_hard_clear() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 812 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 813 | execute( TC_chan_rel_a_reset() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 814 | |
| 815 | execute( TC_paging_imsi_nochan() ); |
| 816 | execute( TC_paging_tmsi_nochan() ); |
| 817 | execute( TC_paging_tmsi_any() ); |
| 818 | execute( TC_paging_tmsi_sdcch() ); |
| 819 | execute( TC_paging_tmsi_tch_f() ); |
| 820 | execute( TC_paging_tmsi_tch_hf() ); |
| 821 | execute( TC_paging_imsi_nochan_cgi() ); |
| 822 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 823 | execute( TC_paging_imsi_nochan_ci() ); |
| 824 | execute( TC_paging_imsi_nochan_lai() ); |
| 825 | execute( TC_paging_imsi_nochan_lac() ); |
| 826 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 827 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 828 | execute( TC_paging_imsi_load() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 829 | } |
| 830 | |
| 831 | } |