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 | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 25 | const integer NUM_BTS := 3; |
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 | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 28 | /* make sure to sync this with the osmo-bts.cfg you're using */ |
| 29 | const integer NUM_TCHF_PER_BTS := 5; |
| 30 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 31 | |
| 32 | /* BSC specific CTRL helper functions */ |
| 33 | function f_ctrl_get_bts(IPA_CTRL_PT pt, integer bts_nr, charstring suffix) return CtrlValue { |
| 34 | return f_ctrl_get(pt, "bts." & int2str(bts_nr) & "." & suffix); |
| 35 | } |
| 36 | |
| 37 | template charstring ts_bts(integer bts_nr) := "bts." & int2str(bts_nr) & "."; |
| 38 | template charstring ts_bts_trx(integer bts_nr, integer trx_nr ) := |
| 39 | valueof(ts_bts(bts_nr)) & "trx." & int2str(trx_nr) & "."; |
| 40 | |
| 41 | function f_ctrl_get_exp_bts(IPA_CTRL_PT pt, integer bts_nr, CtrlVariable suffix, template CtrlValue exp) { |
| 42 | f_ctrl_get_exp(pt, valueof(ts_bts(bts_nr)) & suffix, exp); |
| 43 | } |
| 44 | |
| 45 | function f_ctrl_get_exp_trx(IPA_CTRL_PT pt, integer bts_nr, integer trx_nr, CtrlVariable suffix, |
| 46 | template CtrlValue exp) |
| 47 | { |
| 48 | f_ctrl_get_exp(pt, valueof(ts_bts_trx(bts_nr, trx_nr)) & suffix, exp); |
| 49 | } |
| 50 | |
| 51 | |
| 52 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 53 | type record BTS_State { |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 54 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 55 | } |
| 56 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 57 | type component test_CT extends BSSAP_Adapter_CT { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 58 | var BTS_State bts[NUM_BTS]; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 59 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 60 | |
| 61 | var IPA_Client ctrl; |
| 62 | port IPA_CTRL_PT IPA_CTRL; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 63 | |
| 64 | var boolean g_initialized := false; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 65 | timer T_guard := 30.0; |
| 66 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | modulepar { |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 70 | charstring mp_bsc_ip := "127.0.0.1"; |
| 71 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 72 | integer mp_bsc_ctrl_port := 4249; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 73 | } |
| 74 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 75 | type record IPA_Client { |
| 76 | IPA_Emulation_CT vc_IPA, |
| 77 | IPA_CCM_Parameters ccm_pars, |
| 78 | charstring id |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 79 | } |
| 80 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 81 | 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] | 82 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 83 | timer T := 10.0; |
| 84 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 85 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 86 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 87 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 88 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 89 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
| 90 | |
| 91 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
| 92 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 93 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 94 | clnt.vc_IPA.start(IPA_Emulation.main_client(bsc_host, bsc_port, "", 10000+i, clnt.ccm_pars)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 95 | |
| 96 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 97 | T.start; |
| 98 | alt { |
| 99 | [] IPA_RSL[i].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_ID_ACK}) { |
| 100 | T.stop; |
| 101 | IPA_RSL[i].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_PAGING_LOAD_IND(23))); |
| 102 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 103 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 104 | [] IPA_RSL[i].receive { repeat } |
| 105 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 106 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 107 | self.stop; |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 112 | function f_ipa_ctrl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i) |
| 113 | runs on test_CT { |
| 114 | timer T := 10.0; |
| 115 | |
| 116 | clnt.id := "IPA" & int2str(i) & "-CTRL"; |
| 117 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 118 | |
| 119 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 120 | connect(clnt.vc_IPA:IPA_CTRL_PORT, self:IPA_CTRL); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 121 | |
| 122 | clnt.vc_IPA.start(IPA_Emulation.main_client(bsc_host, bsc_port, "", -1)); |
| 123 | |
| 124 | /* wait for IPA CTRL link to connect and send UP */ |
| 125 | T.start; |
| 126 | alt { |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 127 | [] IPA_CTRL.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP}) { } |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 128 | [] T.timeout { |
| 129 | setverdict(fail, "Timeout CTRL waiting for ASP_IPA_EVENT_UP"); |
| 130 | self.stop; |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 136 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 137 | timer T := secs_max; |
| 138 | T.start; |
| 139 | while (true) { |
| 140 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 141 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 142 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 143 | * until all MO's are initialized */ |
| 144 | T.start(1.0); |
| 145 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 146 | return; |
| 147 | } |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 148 | f_sleep(0.5); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 149 | if (not T.running) { |
| 150 | setverdict(fail, "Timeout waiting for oml-connection-state ", status); |
| 151 | self.stop; |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 156 | function f_sleep(float seconds) { |
| 157 | timer T := seconds; |
| 158 | T.start; |
| 159 | T.timeout; |
| 160 | } |
| 161 | |
| 162 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 163 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 164 | [] T_guard.timeout { setverdict(fail, "Timeout of T_guard"); } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 165 | /* always respond with RESET ACK to RESET */ |
| 166 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value ud_ind { |
| 167 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
| 168 | ts_BSSMAP_ResetAck)); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 169 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 170 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | function f_init() runs on test_CT { |
| 174 | var integer i; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 175 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 176 | if (g_initialized) { |
| 177 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 178 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 179 | g_initialized := true; |
| 180 | |
| 181 | /* Call a function of our 'parent component' BSSAP_Adapter_CT to start the |
| 182 | * MSC-side BSSAP emulation */ |
| 183 | f_bssap_init("VirtMSC"); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 184 | 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] | 185 | |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 186 | for (i := 0; i < NUM_BTS; i := i+1) { |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 187 | /* wait until osmo-bts-omldummy has respawned */ |
| 188 | f_wait_oml(i, "degraded", 5.0); |
| 189 | /* start RSL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 190 | 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] | 191 | /* wait until BSC tells us "connected" */ |
| 192 | f_wait_oml(i, "connected", 5.0); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 193 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 194 | f_sleep(0.5); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 195 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 196 | T_guard.start; |
| 197 | activate(as_Tguard()); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 198 | } |
| 199 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 200 | function f_exp_ipa_rx(integer bts_nr, template RSL_Message t_rx, float t_secs := 2.0, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
| 201 | runs on test_CT return RSL_Message { |
| 202 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 203 | timer T := t_secs; |
| 204 | |
| 205 | T.start; |
| 206 | alt { |
| 207 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(sid, t_rx)) -> value rx_rsl_ud { |
| 208 | T.stop; |
| 209 | } |
| 210 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 211 | [] T.timeout { |
| 212 | setverdict(fail, "Timeout expecting ", t_rx); |
| 213 | self.stop; |
| 214 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 215 | } |
| 216 | return rx_rsl_ud.rsl; |
| 217 | } |
| 218 | |
| 219 | function f_ipa_tx(integer bts_nr, template RSL_Message t_tx, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
| 220 | runs on test_CT { |
| 221 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(sid, t_tx)); |
| 222 | } |
| 223 | |
| 224 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 225 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 226 | testcase TC_chan_act_noreply() runs on test_CT { |
| 227 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 228 | |
| 229 | f_init(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 230 | f_bssap_reset(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 231 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 232 | IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23))); |
| 233 | f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 234 | setverdict(pass); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 235 | } |
| 236 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 237 | /* verify if the "chreq:total" counter increments as expected */ |
| 238 | testcase TC_chan_act_counter() runs on test_CT { |
| 239 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 240 | var integer chreq_total; |
| 241 | |
| 242 | f_init(); |
| 243 | f_bssap_reset(); |
| 244 | |
| 245 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 246 | IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23))); |
| 247 | f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 248 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 249 | |
| 250 | setverdict(pass); |
| 251 | } |
| 252 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 253 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
| 254 | testcase TC_chan_act_ack_noest() runs on test_CT { |
| 255 | var RSL_Message rx_rsl; |
| 256 | |
| 257 | f_init(); |
| 258 | f_bssap_reset(); |
| 259 | |
| 260 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 261 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 262 | |
| 263 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 264 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 265 | |
| 266 | setverdict(pass); |
| 267 | } |
| 268 | |
| 269 | /* Test behavior if MSC never answers to CR */ |
| 270 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
| 271 | var RSL_Message rx_rsl; |
| 272 | |
| 273 | f_init(); |
| 274 | f_bssap_reset(); |
| 275 | |
| 276 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 277 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 278 | |
| 279 | var octetstring l3 := '00010203040506'O |
| 280 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 281 | |
| 282 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 283 | |
| 284 | /* expect BSC to disable the channel again if there's no response from MSC */ |
| 285 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 286 | |
| 287 | setverdict(pass); |
| 288 | } |
| 289 | |
| 290 | /* Test behavior if MSC answers with CREF to CR */ |
| 291 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 292 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 293 | var RSL_Message rx_rsl; |
| 294 | |
| 295 | f_init(); |
| 296 | f_bssap_reset(); |
| 297 | |
| 298 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 299 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 300 | |
| 301 | var octetstring l3 := '00010203040506'O |
| 302 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 303 | |
| 304 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 305 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 306 | |
| 307 | /* expect BSC to disable the channel */ |
| 308 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 309 | |
| 310 | setverdict(pass); |
| 311 | } |
| 312 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 313 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 314 | testcase TC_chan_act_nack() runs on test_CT { |
| 315 | var RSL_Message rx_rsl; |
| 316 | var integer chact_nack; |
| 317 | |
| 318 | f_init(); |
| 319 | f_bssap_reset(); |
| 320 | |
| 321 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 322 | |
| 323 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 324 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 325 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 326 | |
| 327 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 328 | |
| 329 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 330 | f_sleep(0.5); |
| 331 | |
| 332 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 333 | |
| 334 | setverdict(pass); |
| 335 | } |
| 336 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 337 | /* Test for channel exhaustion due to RACH overload */ |
| 338 | testcase TC_chan_exhaustion() runs on test_CT { |
| 339 | var ASP_RSL_Unitdata rsl_ud; |
| 340 | var integer i; |
| 341 | var integer chreq_total, chreq_nochan; |
| 342 | |
| 343 | f_init(); |
| 344 | f_bssap_reset(); |
| 345 | |
| 346 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 347 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 348 | |
| 349 | /* expect 5xTCH/F to succeed */ |
| 350 | for (i := 0; i < NUM_TCHF_PER_BTS; i := i+1) { |
| 351 | f_chreq_act_ack('23'O, i); |
| 352 | } |
| 353 | |
| 354 | IPA_RSL[0].clear; |
| 355 | |
| 356 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+NUM_TCHF_PER_BTS); |
| 357 | |
| 358 | /* now expect additional channel activations to fail */ |
| 359 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 360 | |
| 361 | alt { |
| 362 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 363 | tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV))) { |
| 364 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 365 | } |
| 366 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_IMM_ASSIGN(?))) -> value rsl_ud { |
| 367 | var GsmRrMessage rr; |
| 368 | /* match on IMM ASS REJ */ |
| 369 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 370 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 371 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 372 | chreq_total+NUM_TCHF_PER_BTS+1); |
| 373 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 374 | chreq_nochan+1); |
| 375 | setverdict(pass); |
| 376 | } else { |
| 377 | repeat; |
| 378 | } |
| 379 | } |
| 380 | [] IPA_RSL[0].receive { repeat; } |
| 381 | } |
| 382 | } |
| 383 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 384 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 385 | type record DchanTuple { |
| 386 | integer sccp_conn_id, |
| 387 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 388 | } |
| 389 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 390 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 391 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 392 | runs on test_CT return RslChannelNr { |
| 393 | var RSL_Message rx_rsl; |
| 394 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 395 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 396 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 397 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 398 | return chan_nr; |
| 399 | } |
| 400 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 401 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 402 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 403 | runs on test_CT return DchanTuple { |
| 404 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 405 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 406 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 407 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 408 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 409 | |
| 410 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 411 | |
| 412 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 413 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 414 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 415 | |
| 416 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 417 | } |
| 418 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 419 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 420 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
| 421 | var RSL_Message rx_rsl; |
| 422 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 423 | |
| 424 | f_init(); |
| 425 | f_bssap_reset(); |
| 426 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 427 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 428 | |
| 429 | /* simulate RLL REL IND */ |
| 430 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 431 | |
| 432 | /* expect BSC to disable the channel */ |
| 433 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 434 | /* respond with CHAN REL ACK */ |
| 435 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 436 | |
| 437 | /* expect DISC_IND on MSC side */ |
| 438 | BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)); |
| 439 | |
| 440 | setverdict(pass); |
| 441 | } |
| 442 | |
| 443 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 444 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 445 | var BSSAP_N_DATA_ind rx_di; |
| 446 | var RSL_Message rx_rsl; |
| 447 | var DchanTuple dt; |
| 448 | |
| 449 | f_init(); |
| 450 | f_bssap_reset(); |
| 451 | |
| 452 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 453 | |
| 454 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 455 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 456 | /* TODO: different cause values? */ |
| 457 | |
| 458 | /* expect BSC to disable the channel */ |
| 459 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 460 | /* respond with CHAN REL ACK */ |
| 461 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 462 | |
| 463 | /* expect Clear Request from BSC */ |
| 464 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 465 | |
| 466 | /* Instruct BSC to clear channel */ |
| 467 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 468 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 469 | |
| 470 | /* expect Clear Complete from BSC */ |
| 471 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 472 | |
| 473 | /* release the SCCP connection */ |
| 474 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 475 | |
| 476 | /* wait for SCCP emulation to do its job */ |
| 477 | f_sleep(1.0); |
| 478 | |
| 479 | setverdict(pass); |
| 480 | } |
| 481 | |
| 482 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 483 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 484 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 485 | var DchanTuple dt; |
| 486 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 487 | |
| 488 | f_init(); |
| 489 | f_bssap_reset(); |
| 490 | |
| 491 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 492 | |
| 493 | /* Instruct BSC to clear channel */ |
| 494 | var BssmapCause cause := 0; |
| 495 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 496 | |
| 497 | /* expect Clear Complete from BSC on A */ |
| 498 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 499 | /* release the SCCP connection */ |
| 500 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 501 | } |
| 502 | |
| 503 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 504 | IPA_RSL[0].clear; |
| 505 | alt { |
| 506 | /* ignore DEACTIVATE SACCH (if any) */ |
| 507 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 508 | tr_RSL_DEACT_SACCH(dt.rsl_chan_nr))) { |
| 509 | repeat; |
| 510 | } |
| 511 | /* acknowledge RLL release (if any)*/ |
| 512 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 513 | tr_RSL_REL_REQ(dt.rsl_chan_nr, ?))) { |
| 514 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
| 515 | f_ipa_tx(0, ts_RSL_REL_CONF(dt.rsl_chan_nr, main_dcch)); |
| 516 | repeat; |
| 517 | } |
| 518 | /* Expect RF channel release from BSC on Abis */ |
| 519 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 520 | tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
| 521 | /* respond with CHAN REL ACK */ |
| 522 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 523 | } |
| 524 | } |
| 525 | |
| 526 | setverdict(pass); |
| 527 | } |
| 528 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 529 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 530 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 531 | var DchanTuple dt; |
| 532 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 533 | |
| 534 | f_init(); |
| 535 | f_bssap_reset(); |
| 536 | |
| 537 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 538 | |
| 539 | /* release the SCCP connection */ |
| 540 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 541 | |
| 542 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 543 | IPA_RSL[0].clear; |
| 544 | alt { |
| 545 | /* ignore DEACTIVATE SACCH (if any) */ |
| 546 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 547 | tr_RSL_DEACT_SACCH(dt.rsl_chan_nr))) { |
| 548 | repeat; |
| 549 | } |
| 550 | /* acknowledge RLL release (if any)*/ |
| 551 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 552 | tr_RSL_REL_REQ(dt.rsl_chan_nr, ?))) { |
| 553 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
| 554 | f_ipa_tx(0, ts_RSL_REL_CONF(dt.rsl_chan_nr, main_dcch)); |
| 555 | repeat; |
| 556 | } |
| 557 | /* Expect RF channel release from BSC on Abis */ |
| 558 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 559 | tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
| 560 | /* respond with CHAN REL ACK */ |
| 561 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 562 | } |
| 563 | } |
| 564 | |
| 565 | setverdict(pass); |
| 566 | } |
| 567 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 568 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 569 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 570 | var DchanTuple dt; |
| 571 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 572 | |
| 573 | f_init(); |
| 574 | f_bssap_reset(); |
| 575 | |
| 576 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 577 | |
| 578 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 579 | IPA_RSL[0].clear; |
| 580 | |
| 581 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
| 582 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_sccp_addr_peer, g_sccp_addr_own, ts_BSSMAP_Reset(0))); |
| 583 | interleave { |
| 584 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_sccp_addr_own, g_sccp_addr_peer, tr_BSSMAP_ResetAck)) { } |
| 585 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 586 | } |
| 587 | |
| 588 | alt { |
| 589 | /* ignore DEACTIVATE SACCH (if any) */ |
| 590 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 591 | tr_RSL_DEACT_SACCH(dt.rsl_chan_nr))) { |
| 592 | repeat; |
| 593 | } |
| 594 | /* acknowledge RLL release (if any)*/ |
| 595 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 596 | tr_RSL_REL_REQ(dt.rsl_chan_nr, ?))) { |
| 597 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
| 598 | f_ipa_tx(0, ts_RSL_REL_CONF(dt.rsl_chan_nr, main_dcch)); |
| 599 | repeat; |
| 600 | } |
| 601 | /* Expect RF channel release from BSC on Abis */ |
| 602 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 603 | tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
| 604 | /* respond with CHAN REL ACK */ |
| 605 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 606 | } |
| 607 | /* ignore any user data */ |
| 608 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_MsgTypeR(?))) { |
| 609 | repeat; |
| 610 | } |
| 611 | } |
| 612 | |
| 613 | setverdict(pass); |
| 614 | } |
| 615 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 616 | /* Test behavior if RSL EST IND for non-active channel */ |
| 617 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 618 | timer T := 2.0; |
| 619 | |
| 620 | f_init(); |
| 621 | f_bssap_reset(); |
| 622 | |
| 623 | var octetstring l3 := '00010203040506'O; |
| 624 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 625 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 626 | |
| 627 | T.start; |
| 628 | alt { |
| 629 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 630 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 631 | } |
| 632 | [] BSSAP.receive {} |
| 633 | [] IPA_RSL[0].receive {} |
| 634 | [] T.timeout {} |
| 635 | } |
| 636 | |
| 637 | setverdict(pass); |
| 638 | } |
| 639 | |
| 640 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 641 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 642 | var RslChannelNr chan_nr; |
| 643 | |
| 644 | f_init(); |
| 645 | f_bssap_reset(); |
| 646 | |
| 647 | chan_nr := f_chreq_act_ack() |
| 648 | |
| 649 | var octetstring l3 := '00010203040506'O; |
| 650 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 651 | |
| 652 | timer T := 2.0; |
| 653 | T.start; |
| 654 | alt { |
| 655 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 656 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 657 | } |
| 658 | [] BSSAP.receive { repeat; } |
| 659 | [] IPA_RSL[0].receive { repeat; } |
| 660 | [] T.timeout {} |
| 661 | } |
| 662 | |
| 663 | setverdict(pass); |
| 664 | } |
| 665 | |
| 666 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 667 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 668 | timer T := 2.0; |
| 669 | |
| 670 | f_init(); |
| 671 | f_bssap_reset(); |
| 672 | |
| 673 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 674 | |
| 675 | var octetstring l3 := '00010203040506'O; |
| 676 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 677 | |
| 678 | T.start; |
| 679 | alt { |
| 680 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 681 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 682 | } |
| 683 | [] BSSAP.receive { repeat; } |
| 684 | [] IPA_RSL[0].receive { repeat; } |
| 685 | [] T.timeout {} |
| 686 | } |
| 687 | |
| 688 | setverdict(pass); |
| 689 | } |
| 690 | |
| 691 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 692 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 693 | timer T := 2.0; |
| 694 | |
| 695 | f_init(); |
| 696 | f_bssap_reset(); |
| 697 | |
| 698 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 699 | |
| 700 | var octetstring l3 := '00010203040506'O; |
| 701 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 702 | |
| 703 | T.start; |
| 704 | alt { |
| 705 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 706 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 707 | } |
| 708 | [] BSSAP.receive { repeat; } |
| 709 | [] IPA_RSL[0].receive { repeat; } |
| 710 | [] T.timeout {} |
| 711 | } |
| 712 | |
| 713 | setverdict(pass); |
| 714 | } |
| 715 | |
| 716 | |
| 717 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 718 | |
| 719 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 720 | var charstring ctrl_resp; |
| 721 | |
| 722 | f_init(); |
| 723 | f_bssap_reset(); |
| 724 | |
| 725 | /* See https://osmocom.org/issues/2729 */ |
| 726 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
| 727 | setverdict(pass); |
| 728 | } |
| 729 | |
| 730 | testcase TC_ctrl() runs on test_CT { |
| 731 | var charstring ctrl_resp; |
| 732 | |
| 733 | f_init(); |
| 734 | f_bssap_reset(); |
| 735 | |
| 736 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 737 | |
| 738 | f_ctrl_get_exp(IPA_CTRL, "mcc", "1"); |
| 739 | f_ctrl_get_exp(IPA_CTRL, "mnc", "1"); |
| 740 | f_ctrl_get_exp(IPA_CTRL, "short-name", "OsmoBSC"); |
| 741 | f_ctrl_get_exp(IPA_CTRL, "long-name", "OsmoBSC"); |
| 742 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "1"); |
| 743 | |
| 744 | var integer bts_nr := 0; |
| 745 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 746 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 747 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 748 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 749 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 750 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 751 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 752 | |
| 753 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 754 | f_sleep(2.0); |
| 755 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 756 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 757 | } |
| 758 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 759 | |
| 760 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 761 | |
| 762 | setverdict(pass); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 763 | } |
| 764 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 765 | function f_bssap_tx_ud(template PDU_BSSAP bssap) runs on test_CT { |
| 766 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_sccp_addr_peer, g_sccp_addr_own, bssap)); |
| 767 | } |
| 768 | |
| 769 | |
| 770 | /*********************************************************************** |
| 771 | * Paging Testing |
| 772 | ***********************************************************************/ |
| 773 | |
| 774 | type record Cell_Identity { |
| 775 | GsmMcc mcc, |
| 776 | GsmMnc mnc, |
| 777 | GsmLac lac, |
| 778 | GsmCellId ci |
| 779 | }; |
| 780 | private const Cell_Identity cid := { '001'H, '001'H, 1, 0 }; |
| 781 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 782 | type set of integer BtsIdList; |
| 783 | |
| 784 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 785 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 786 | if (bts_id == bts_ids[j]) { |
| 787 | return true; |
| 788 | } |
| 789 | } |
| 790 | return false; |
| 791 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 792 | |
| 793 | /* core paging test helper function; used by most paging test cases */ |
| 794 | private function f_pageing_helper(hexstring imsi, |
| 795 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 796 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 797 | template RSL_ChanNeeded rsl_chneed := omit, |
| 798 | template OCT4 tmsi := omit) runs on test_CT |
| 799 | { |
| 800 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
| 801 | var MobileIdentity mi; |
| 802 | var template octetstring id_enc; /* FIXME */ |
| 803 | var RSL_Message rx_rsl; |
| 804 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 805 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 806 | |
| 807 | f_init(); |
| 808 | f_bssap_reset(); |
| 809 | |
| 810 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 811 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
| 812 | IPA_RSL[bts_ids[i]].clear; |
| 813 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 814 | |
| 815 | if (isvalue(rsl_chneed)) { |
| 816 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 817 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 818 | } else { |
| 819 | bssmap_chneed := omit; |
| 820 | } |
| 821 | |
| 822 | f_bssap_tx_ud(ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed)); |
| 823 | |
| 824 | /* FIXME: Disabled due to bugs in both GSM_RR_Types and MobileL3_CommonIE_Types IMSI encoder |
| 825 | if (isvalue(tmsi)) { |
| 826 | mi := valueof(t_Osmo_MI_TMSI(oct2int(valueof(tmsi)))); |
| 827 | } else { |
| 828 | mi := valueof(ts_Osmo_MI_IMSI(imsi)); |
| 829 | } |
| 830 | id_enc := enc_MobileIdentity(mi); |
| 831 | */ |
| 832 | id_enc := ?; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 833 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
| 834 | rx_rsl := f_exp_ipa_rx(bts_ids[i], tr_RSL_PAGING_CMD(id_enc)); |
| 835 | /* check channel type, paging group */ |
| 836 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 837 | setverdict(fail, "Paging for wrong paging group"); |
| 838 | } |
| 839 | if (ispresent(rsl_chneed) and |
| 840 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 841 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 842 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 843 | } |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 844 | /* do a quick check on all not-included BTSs if they received paging */ |
| 845 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 846 | timer T := 0.1; |
| 847 | if (f_bts_in_list(i, bts_ids)) { |
| 848 | continue; |
| 849 | } |
| 850 | T.start; |
| 851 | alt { |
| 852 | [] IPA_RSL[i].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(id_enc))) { |
| 853 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 854 | } |
| 855 | [] IPA_RSL[i].receive { repeat; } |
| 856 | [] T.timeout { } |
| 857 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 858 | } |
| 859 | |
| 860 | setverdict(pass); |
| 861 | } |
| 862 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 863 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
| 864 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 865 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 866 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 867 | /* PAGING by IMSI + TMSI */ |
| 868 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 869 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 870 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 871 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 872 | } |
| 873 | |
| 874 | /* PAGING by IMSI + TMSI */ |
| 875 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 876 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 877 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 878 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, 'A1B2C301'O); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 879 | } |
| 880 | |
| 881 | /* Paging with different "channel needed' values */ |
| 882 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 883 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 884 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 885 | f_pageing_helper('001010100000002'H, cid_list, c_BtsId_all, RSL_CHANNEED_ANY, 'A1B2C302'O); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 886 | } |
| 887 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 888 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 889 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 890 | f_pageing_helper('001010100000003'H, cid_list, c_BtsId_all, RSL_CHANNEED_SDCCH, 'A1B2C303'O); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 891 | } |
| 892 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 893 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 894 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 895 | f_pageing_helper('001010000000004'H, cid_list, c_BtsId_all, RSL_CHANNEED_TCH_F, 'A1B2C304'O); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 896 | } |
| 897 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 898 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 899 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 900 | f_pageing_helper('001010000000005'H, cid_list, c_BtsId_all, RSL_CHANNEED_TCH_ForH, 'A1B2C305'O); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 901 | } |
| 902 | |
| 903 | /* Paging by CGI */ |
| 904 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 905 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 906 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(cid.mcc, cid.mnc, cid.lac, cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 907 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 908 | } |
| 909 | |
| 910 | /* Paging by LAC+CI */ |
| 911 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 912 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 913 | cid_list := { cIl_LAC_CI := { ts_BSSMAP_CI_LAC_CI(cid.lac, cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 914 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 915 | } |
| 916 | |
| 917 | /* Paging by CI */ |
| 918 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 919 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 920 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 921 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 922 | } |
| 923 | |
| 924 | /* Paging by LAI */ |
| 925 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 926 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 927 | cid_list := { cIl_LAI := { ts_BSSMAP_CI_LAI(cid.mcc, cid.mnc, cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 928 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 929 | } |
| 930 | |
| 931 | /* Paging by LAC */ |
| 932 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 933 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 934 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 935 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 936 | } |
| 937 | |
| 938 | /* Paging by "all in BSS" */ |
| 939 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 940 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 941 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 942 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 943 | } |
| 944 | |
| 945 | /* Paging by PLMN+LAC+RNC */ |
| 946 | /* Paging by RNC */ |
| 947 | /* Paging by LAC+RNC */ |
| 948 | |
| 949 | /* Paging on multiple cells (multiple in one LAC): Verify all of them page */ |
| 950 | /* Paging on multiple cells (multiple entries in list): Verify all of them page */ |
| 951 | /* Verify paging retransmission interval + count */ |
| 952 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 953 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 954 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 955 | /* Verify PCH load */ |
| 956 | testcase TC_paging_imsi_load() runs on test_CT { |
| 957 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 958 | timer T := 4.0; |
| 959 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 960 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 961 | |
| 962 | /* tell BSC there is no paging space anymore */ |
| 963 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 964 | |
| 965 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 966 | * there would be 8 retransmissions during 4 seconds */ |
| 967 | T.start; |
| 968 | alt { |
| 969 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 970 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
| 971 | self.stop; |
| 972 | } |
| 973 | [] T.timeout { |
| 974 | setverdict(pass); |
| 975 | } |
| 976 | } |
| 977 | } |
| 978 | |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 979 | /* Verify PCH load */ |
| 980 | testcase TC_paging_counter() runs on test_CT { |
| 981 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 982 | timer T := 4.0; |
| 983 | var integer i; |
| 984 | var integer paging_attempted_bsc; |
| 985 | var integer paging_attempted_bts[NUM_BTS]; |
| 986 | var integer paging_expired_bts[NUM_BTS]; |
| 987 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 988 | |
| 989 | f_init(); |
| 990 | |
| 991 | /* read counters before paging */ |
| 992 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 993 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 994 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 995 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 996 | } |
| 997 | |
| 998 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 999 | |
| 1000 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 1001 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 1002 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1003 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 1004 | paging_attempted_bts[i]+1); |
| 1005 | } |
| 1006 | |
| 1007 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 1008 | f_sleep(12.0); |
| 1009 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1010 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 1011 | paging_expired_bts[i]+1); |
| 1012 | } |
| 1013 | setverdict(pass); |
| 1014 | |
| 1015 | } |
| 1016 | |
| 1017 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1018 | /* Verify paging stops after A-RESET */ |
| 1019 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 1020 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1021 | timer T := 3.0; |
| 1022 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1023 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1024 | |
| 1025 | /* Perform a BSSMAP Reset and wait for ACK */ |
| 1026 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_sccp_addr_peer, g_sccp_addr_own, ts_BSSMAP_Reset(0))); |
| 1027 | alt { |
| 1028 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_sccp_addr_own, g_sccp_addr_peer, tr_BSSMAP_ResetAck)) { } |
| 1029 | [] BSSAP.receive { repeat; } |
| 1030 | } |
| 1031 | |
| 1032 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
| 1033 | IPA_RSL[0].clear; |
| 1034 | |
| 1035 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 1036 | T.start; |
| 1037 | alt { |
| 1038 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1039 | setverdict(fail, "Received PAGING after A-RESET"); |
| 1040 | self.stop; |
| 1041 | } |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1042 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1043 | setverdict(fail, "Received PAGING after A-RESET"); |
| 1044 | self.stop; |
| 1045 | } |
| 1046 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1047 | setverdict(fail, "Received PAGING after A-RESET"); |
| 1048 | self.stop; |
| 1049 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1050 | [] T.timeout { |
| 1051 | setverdict(pass); |
| 1052 | } |
| 1053 | } |
| 1054 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1055 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 1056 | /* Test RSL link drop causes counter increment */ |
| 1057 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 1058 | var integer rsl_fail; |
| 1059 | |
| 1060 | f_init(); |
| 1061 | f_bssap_reset(); |
| 1062 | |
| 1063 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 1064 | |
| 1065 | bts[0].rsl.vc_IPA.stop; |
| 1066 | |
| 1067 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 1068 | |
| 1069 | setverdict(pass); |
| 1070 | } |
| 1071 | |
| 1072 | /* TODO: Test OML link drop causes counter increment */ |
| 1073 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1074 | control { |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1075 | execute( TC_ctrl_msc_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1076 | execute( TC_ctrl() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1077 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1078 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1079 | execute( TC_chan_act_ack_noest() ); |
| 1080 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 1081 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1082 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1083 | execute( TC_chan_exhaustion() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1084 | execute( TC_chan_rel_rll_rel_ind() ); |
| 1085 | execute( TC_chan_rel_conn_fail() ); |
| 1086 | execute( TC_chan_rel_hard_clear() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1087 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1088 | execute( TC_chan_rel_a_reset() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1089 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1090 | execute( TC_rll_est_ind_inact_lchan() ); |
| 1091 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 1092 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 1093 | execute( TC_rll_est_ind_inval_sacch() ); |
| 1094 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1095 | execute( TC_paging_imsi_nochan() ); |
| 1096 | execute( TC_paging_tmsi_nochan() ); |
| 1097 | execute( TC_paging_tmsi_any() ); |
| 1098 | execute( TC_paging_tmsi_sdcch() ); |
| 1099 | execute( TC_paging_tmsi_tch_f() ); |
| 1100 | execute( TC_paging_tmsi_tch_hf() ); |
| 1101 | execute( TC_paging_imsi_nochan_cgi() ); |
| 1102 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 1103 | execute( TC_paging_imsi_nochan_ci() ); |
| 1104 | execute( TC_paging_imsi_nochan_lai() ); |
| 1105 | execute( TC_paging_imsi_nochan_lac() ); |
| 1106 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1107 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1108 | execute( TC_paging_imsi_load() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 1109 | |
| 1110 | execute( TC_rsl_drop_counter() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1111 | } |
| 1112 | |
| 1113 | } |