Harald Welte | a0895f9 | 2018-03-08 11:51:23 +0100 | [diff] [blame] | 1 | module PCU_Tests { |
Harald Welte | 3a19440 | 2017-07-22 17:07:51 +0200 | [diff] [blame] | 2 | |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 3 | import from General_Types all; |
| 4 | import from Osmocom_Types all; |
| 5 | import from GSM_Types all; |
| 6 | import from GSM_RR_Types all; |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 7 | import from Osmocom_Gb_Types all; |
Harald Welte | 3a19440 | 2017-07-22 17:07:51 +0200 | [diff] [blame] | 8 | import from BSSGP_Types all; |
Harald Welte | 6e594f2 | 2017-07-23 16:19:35 +0200 | [diff] [blame] | 9 | import from BSSGP_Emulation all; |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 10 | import from NS_Types all; |
Harald Welte | 6e594f2 | 2017-07-23 16:19:35 +0200 | [diff] [blame] | 11 | import from NS_Emulation all; |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 12 | import from LLC_Types all; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 13 | import from LLC_Templates all; |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 14 | import from RLCMAC_Types all; |
| 15 | import from RLCMAC_CSN1_Types all; |
| 16 | import from LAPDm_RAW_PT all; |
Harald Welte | 060e27a | 2018-03-03 20:38:19 +0100 | [diff] [blame] | 17 | import from GPRS_Context all; |
| 18 | import from GPRS_TBF all; |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 19 | import from L1CTL_PortType all; |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 20 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 21 | modulepar { |
| 22 | BssgpConfig mp_gb_cfg := { |
Harald Welte | 7024baa | 2018-03-02 23:37:51 +0100 | [diff] [blame] | 23 | nsei := 1234, |
| 24 | bvci := 1234, |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 25 | cell_id := { |
| 26 | ra_id := { |
| 27 | lai := { |
| 28 | mcc_mnc := '26242F'H, lac := 13135 |
| 29 | }, |
| 30 | rac := 0 |
| 31 | }, |
| 32 | cell_id := 20960 |
| 33 | }, |
| 34 | sgsn_role := true |
| 35 | }; |
Alexander Couzens | 2c12b24 | 2018-07-31 00:30:11 +0200 | [diff] [blame] | 36 | |
| 37 | NSConfiguration mp_nsconfig := { |
| 38 | local_udp_port := 23000, |
| 39 | local_ip := "127.0.0.1", |
| 40 | remote_udp_port := 21000, |
| 41 | remote_ip := "127.0.0.1", |
| 42 | nsvci := 0, |
| 43 | nsei := 2342 |
| 44 | }; |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 45 | } |
| 46 | |
Harald Welte | 7024baa | 2018-03-02 23:37:51 +0100 | [diff] [blame] | 47 | type component dummy_CT extends BSSGP_Client_CT { |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 48 | var lapdm_CT lapdm_component; |
| 49 | port LAPDm_PT L1; |
| 50 | |
Harald Welte | 6e594f2 | 2017-07-23 16:19:35 +0200 | [diff] [blame] | 51 | var NS_CT ns_component; |
| 52 | var BSSGP_CT bssgp_component; |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 53 | |
| 54 | var MmContext g_mmctx := { |
Harald Welte | acc93ab | 2018-03-02 21:39:09 +0100 | [diff] [blame] | 55 | tlli := 'FFFFFFFF'O, |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 56 | n_u := 0 |
| 57 | }; |
| 58 | |
| 59 | var boolean g_initialized := false; |
Harald Welte | 6e594f2 | 2017-07-23 16:19:35 +0200 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | function f_init() runs on dummy_CT { |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 63 | if (g_initialized == true) { |
| 64 | return; |
| 65 | } |
| 66 | g_initialized := true; |
Harald Welte | 6e594f2 | 2017-07-23 16:19:35 +0200 | [diff] [blame] | 67 | /* create a new NS component */ |
| 68 | ns_component := NS_CT.create; |
| 69 | bssgp_component := BSSGP_CT.create; |
| 70 | /* connect our BSSGP port to the BSSGP Emulation */ |
Alexander Couzens | 0e510e6 | 2018-07-28 23:06:00 +0200 | [diff] [blame] | 71 | connect(self:BSSGP[0], bssgp_component:BSSGP_SP); |
| 72 | connect(self:BSSGP_SIG[0], bssgp_component:BSSGP_SP_SIG); |
| 73 | connect(self:BSSGP_PROC[0], bssgp_component:BSSGP_PROC); |
Harald Welte | 6e594f2 | 2017-07-23 16:19:35 +0200 | [diff] [blame] | 74 | /* connect lower-end of BSSGP with BSSGP_CODEC_PORT (maps to NS_PT*/ |
| 75 | connect(bssgp_component:BSCP, ns_component:NS_SP); |
| 76 | /* connect lower-end of NS emulation to NS_CODEC_PORT (on top of IPl4) */ |
| 77 | map(ns_component:NSCP, system:NS_CODEC_PORT); |
Alexander Couzens | 2c12b24 | 2018-07-31 00:30:11 +0200 | [diff] [blame] | 78 | ns_component.start(NSStart(mp_nsconfig)); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 79 | bssgp_component.start(BssgpStart(mp_gb_cfg)); |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 80 | |
| 81 | lapdm_component := lapdm_CT.create; |
| 82 | connect(self:L1, lapdm_component:LAPDM_SP); |
| 83 | map(lapdm_component:L1CTL, system:L1CTL); |
| 84 | lapdm_component.start(LAPDmStart()); |
Harald Welte | 54242db | 2018-03-03 22:38:54 +0100 | [diff] [blame] | 85 | |
| 86 | f_bssgp_client_register(g_mmctx.imsi, g_mmctx.tlli, mp_gb_cfg.cell_id); |
| 87 | f_bssgp_establish(); |
| 88 | } |
| 89 | |
| 90 | function f_exit() runs on dummy_CT { |
| 91 | lapdm_component.stop; |
| 92 | ns_component.stop; |
| 93 | bssgp_component.stop; |
Harald Welte | 3a19440 | 2017-07-22 17:07:51 +0200 | [diff] [blame] | 94 | } |
| 95 | |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 96 | function f_bssgp_dec_and_log(in octetstring inp) { |
| 97 | log("BSSGP Input: ", inp); |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 98 | var PDU_BSSGP dec := dec_PDU_BSSGP(inp); |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 99 | log("BSSGP Decoded: ", dec); |
Harald Welte | 3a19440 | 2017-07-22 17:07:51 +0200 | [diff] [blame] | 100 | } |
| 101 | |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 102 | testcase TC_selftest_bssgp() runs on dummy_CT { |
Harald Welte | 3a19440 | 2017-07-22 17:07:51 +0200 | [diff] [blame] | 103 | const octetstring c_bvc_reset_pcu := '2204820000078108088832f44000c80051e0'O; |
| 104 | const octetstring c_bvc_reset_q := '2204820000078100'O; |
| 105 | const octetstring c_status_pcu := '4107810515882204820000078103'O; |
| 106 | const octetstring c_reset_ack_q := '2304820000'O; |
| 107 | const octetstring c_reset_ack_pcu := '23048200c4'O; |
| 108 | const octetstring c_unblock_pcu := '24048200c4'O; |
| 109 | const octetstring c_unblock_ack_q := '25048200c4'O; |
| 110 | const octetstring c_fc_bvc_pcu := '261e8101058200fa038200c8018200fa1c8200c806820000'O; |
| 111 | const octetstring c_fc_bvc_ack_q := '271e8101'O; |
| 112 | const octetstring c_gmm_mo_att_req := '01bb146ddd000004088832f44000c80051e000800e003b01c001080103e5e000110a0005f4fb146ddd32f44000c8001d1b53432b37159ef9090070000dd9c6321200e00019b32c642401c0002017057bf0ec'O; |
| 113 | const octetstring c_gmm_mt_ac_req := '00bb146ddd0050001682ffff0a8204030e9c41c001081200102198c72477ea104895e8b959acc58b108182f4d045'O; |
| 114 | const octetstring c_gmm_mo_ac_resp := '01bb146ddd000004088832f44000c80051e000800e000e01c00508130122fa361f5fdd623d'O; |
| 115 | const octetstring c_gmm_mt_att_acc := '00bb146ddd0050001682ffff0a8204030e9841c005080201340432f44000c8001805f4fb146ddd0967d0'O; |
| 116 | const octetstring c_gmm_mt_det_req := '00bb146ddd0050001682ffff0a8204030e8941c00908050215f0b6'O; |
| 117 | const octetstring c_gmm_mo_att_cpl := '01fb146ddd000004088832f44000c80051e000800e000801c009080339d7bc'O; |
| 118 | |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 119 | f_bssgp_dec_and_log(c_bvc_reset_pcu); |
| 120 | f_bssgp_dec_and_log(c_bvc_reset_q); |
| 121 | f_bssgp_dec_and_log(c_status_pcu); |
| 122 | f_bssgp_dec_and_log(c_reset_ack_q); |
| 123 | f_bssgp_dec_and_log(c_reset_ack_pcu); |
| 124 | f_bssgp_dec_and_log(c_unblock_pcu); |
| 125 | f_bssgp_dec_and_log(c_unblock_ack_q); |
| 126 | f_bssgp_dec_and_log(c_fc_bvc_pcu); |
| 127 | f_bssgp_dec_and_log(c_fc_bvc_ack_q); |
| 128 | f_bssgp_dec_and_log(c_gmm_mo_att_req); |
| 129 | f_bssgp_dec_and_log(c_gmm_mt_ac_req); |
| 130 | f_bssgp_dec_and_log(c_gmm_mo_ac_resp); |
| 131 | f_bssgp_dec_and_log(c_gmm_mt_att_acc); |
| 132 | f_bssgp_dec_and_log(c_gmm_mt_det_req); |
| 133 | f_bssgp_dec_and_log(c_gmm_mo_att_cpl); |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 134 | |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 135 | log(ts_BSSGP_PS_PAGING_IMSI(196, '262420123456789'H)); |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | function f_ns_assert_prepr(in octetstring a, in octetstring b) { |
| 139 | log("NS Input: ", a); |
| 140 | log("NS Expected: ", b); |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 141 | |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 142 | if (a != b) { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 143 | setverdict(fail, "Values mismatch", a, b); |
| 144 | mtc.stop; |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 145 | } else { |
| 146 | setverdict(pass); |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | function f_ns_dec_and_log(in octetstring inp) { |
| 151 | log("NS Input: ", inp); |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 152 | var PDU_NS dec := dec_PDU_NS(inp); |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 153 | log("NS Decoded: ", dec); |
| 154 | } |
| 155 | |
| 156 | testcase TC_selftest_ns() runs on dummy_CT { |
| 157 | const octetstring c_ns_reset_pcu := '000000c4271e813d'O; |
| 158 | |
| 159 | /* single byte length to two byte length */ |
| 160 | f_ns_assert_prepr('04058101'O, '0405000101'O); |
| 161 | f_ns_assert_prepr('040589000102030405060708'O, '04050009000102030405060708'O); |
| 162 | /* two byte length to two byte length */ |
| 163 | f_ns_assert_prepr('0405000101'O, '0405000101'O); |
| 164 | /* special case: NS-UNITDATA */ |
| 165 | f_ns_assert_prepr('00aabbccddeeffaa29822342'O, '00aabbccddeeffaa2900022342'O); |
| 166 | /* multiple TLVs */ |
| 167 | f_ns_assert_prepr('234281aa4382bbbb'O, '23420001aa430002bbbb'O); |
| 168 | /* zero-length */ |
| 169 | f_ns_assert_prepr('230080'O, '23000000'O); |
| 170 | |
| 171 | f_ns_dec_and_log(c_ns_reset_pcu); |
Harald Welte | 3a19440 | 2017-07-22 17:07:51 +0200 | [diff] [blame] | 172 | } |
| 173 | |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 174 | const octetstring gmm_auth_req := '081200102198c72477ea104895e8b959acc58b108182'O; |
| 175 | |
Harald Welte | 9d83dd0 | 2018-03-02 17:00:22 +0100 | [diff] [blame] | 176 | /* Wrap downlink GMM into LLC, encode + send it via BSSGP to PCU */ |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 177 | function tx_gmm(BIT1 c_r, in octetstring gmm_pdu, BIT4 sapi := c_LLC_SAPI_LLGMM) runs on dummy_CT { |
| 178 | var PDU_LLC llc; |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 179 | |
Harald Welte | 0e23a8f | 2017-12-12 16:47:48 +0100 | [diff] [blame] | 180 | //log("GMM Tx: ", dec_PDU_L3_SGSN_MS(gmm_pdu)); |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 181 | |
| 182 | log(c_r, g_mmctx.n_u, gmm_pdu, sapi); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 183 | llc := valueof(ts_LLC_UI(gmm_pdu, sapi, c_r, g_mmctx.n_u)); |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 184 | log(llc); |
| 185 | g_mmctx.n_u := g_mmctx.n_u + 1; |
| 186 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 187 | log(ts_BSSGP_DL_UD(g_mmctx.tlli, enc_PDU_LLC(llc))); |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 188 | |
Alexander Couzens | 0e510e6 | 2018-07-28 23:06:00 +0200 | [diff] [blame] | 189 | BSSGP[0].send(ts_BSSGP_DL_UD(g_mmctx.tlli, enc_PDU_LLC(llc))); |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 190 | } |
| 191 | |
Harald Welte | 9d83dd0 | 2018-03-02 17:00:22 +0100 | [diff] [blame] | 192 | /* Establish BSSGP connection to PCU */ |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 193 | function f_bssgp_establish() runs on dummy_CT { |
Harald Welte | 7024baa | 2018-03-02 23:37:51 +0100 | [diff] [blame] | 194 | timer T:= 10.0; |
Harald Welte | 13d391e | 2017-07-23 19:52:33 +0200 | [diff] [blame] | 195 | |
Harald Welte | 6e594f2 | 2017-07-23 16:19:35 +0200 | [diff] [blame] | 196 | f_init(); |
Harald Welte | 13d391e | 2017-07-23 19:52:33 +0200 | [diff] [blame] | 197 | T.start |
| 198 | alt { |
Alexander Couzens | 0e510e6 | 2018-07-28 23:06:00 +0200 | [diff] [blame] | 199 | [] BSSGP[0].receive(t_BssgpStsInd(?, ?, BVC_S_UNBLOCKED)) { } |
| 200 | [] BSSGP[0].receive { repeat; } |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 201 | [] T.timeout { |
| 202 | setverdict(fail, "Timeout establishing BSSGP connection"); |
| 203 | mtc.stop; |
| 204 | } |
Harald Welte | 13d391e | 2017-07-23 19:52:33 +0200 | [diff] [blame] | 205 | } |
| 206 | T.stop |
| 207 | log("BSSGP successfully initialized"); |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 208 | } |
| 209 | |
Harald Welte | 9d83dd0 | 2018-03-02 17:00:22 +0100 | [diff] [blame] | 210 | /* Send PS-PAGING via BSSGP to PCU, expect it to show up on L1/Um */ |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 211 | testcase TC_paging() runs on dummy_CT { |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 212 | var GsmTmsi tmsi := hex2int('01234567'H); |
Harald Welte | a35a9ca | 2018-03-08 17:59:39 +0100 | [diff] [blame] | 213 | g_mmctx.imsi := '262420123456789'H; |
| 214 | g_mmctx.tlli := f_random_tlli(); |
| 215 | f_init(); |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 216 | |
Stefan Sperling | f82bbb6 | 2018-05-03 19:14:28 +0200 | [diff] [blame] | 217 | /* Send paging on signalling BVCI 0 since osmo-pcu does not support paging on PTP yet. */ |
Alexander Couzens | 0e510e6 | 2018-07-28 23:06:00 +0200 | [diff] [blame] | 218 | BSSGP_SIG[0].send(ts_BSSGP_PS_PAGING_IMSI(0, g_mmctx.imsi)); |
| 219 | BSSGP_SIG[0].send(ts_BSSGP_PS_PAGING_PTMSI(0, g_mmctx.imsi, tmsi)); |
Harald Welte | 13d391e | 2017-07-23 19:52:33 +0200 | [diff] [blame] | 220 | |
| 221 | while (true) { |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 222 | var BssgpDecoded bd; |
Harald Welte | 13d391e | 2017-07-23 19:52:33 +0200 | [diff] [blame] | 223 | alt { |
Alexander Couzens | 0e510e6 | 2018-07-28 23:06:00 +0200 | [diff] [blame] | 224 | [] BSSGP[0].receive(tr_BD_L3_MT(?)) -> value bd { |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 225 | log("BSSGP Rx: ", bd); |
Harald Welte | 13d391e | 2017-07-23 19:52:33 +0200 | [diff] [blame] | 226 | } |
Alexander Couzens | 0e510e6 | 2018-07-28 23:06:00 +0200 | [diff] [blame] | 227 | [] BSSGP[0].receive(t_BssgpStsInd(?, ?, BVC_S_UNBLOCKED)) { repeat; } |
| 228 | [] BSSGP[0].receive { repeat; } |
Harald Welte | 13d391e | 2017-07-23 19:52:33 +0200 | [diff] [blame] | 229 | } |
| 230 | } |
Harald Welte | 6e594f2 | 2017-07-23 16:19:35 +0200 | [diff] [blame] | 231 | } |
| 232 | |
Harald Welte | 9d83dd0 | 2018-03-02 17:00:22 +0100 | [diff] [blame] | 233 | /* Establish an UL TBF: Tune to ARFCN, send RACH, receive AGCH, enable TBF Rx */ |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 234 | function f_establish_ul_tbf() runs on dummy_CT { |
| 235 | timer T := 5.0; |
| 236 | var BCCH_tune_req tune_req := { { false, 871 }, true }; |
| 237 | L1.send(tune_req); |
| 238 | /* FIXME: wait for confirm */ |
| 239 | |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 240 | var TBF_UL_establish_req est_req := { tbf_nr := 0, ra := hex2int('7B'H) }; |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 241 | L1.send(est_req); |
| 242 | T.start; |
| 243 | /* FIXME: wait for confirm */ |
| 244 | alt { |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 245 | [] L1.receive(TBF_UL_establish_res:?) {} |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 246 | [] L1.receive { repeat; } |
Harald Welte | 54242db | 2018-03-03 22:38:54 +0100 | [diff] [blame] | 247 | [] T.timeout { |
| 248 | setverdict(fail, "Timeout establishing UL TBF"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 249 | mtc.stop; |
Harald Welte | 54242db | 2018-03-03 22:38:54 +0100 | [diff] [blame] | 250 | } |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 251 | } |
| 252 | T.stop; |
| 253 | } |
| 254 | |
Harald Welte | 9d83dd0 | 2018-03-02 17:00:22 +0100 | [diff] [blame] | 255 | /* compute a random TLLI; FIXME: what about TLLI prefix / local/foreign/...? */ |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 256 | function f_random_tlli() return GprsTlli { |
Harald Welte | acc93ab | 2018-03-02 21:39:09 +0100 | [diff] [blame] | 257 | var GprsTlli tlli := f_rnd_octstring(4); |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 258 | return tlli; |
| 259 | } |
| 260 | |
Harald Welte | 7024baa | 2018-03-02 23:37:51 +0100 | [diff] [blame] | 261 | /* Compute the frame number of the uplink block based on current fn + rrbp */ |
| 262 | function f_rrbp_fn(GsmFrameNumber fn, MacRrbp rrbp) return GsmFrameNumber { |
| 263 | var integer add; |
| 264 | select (rrbp) { |
| 265 | case (RRBP_Nplus13_mod_2715648) { |
| 266 | add := 13; |
| 267 | } |
| 268 | case (RRBP_Nplus17_or_18_mod_2715648) { |
| 269 | add := 17; /* FIXME: What about 'or 18'? */ |
| 270 | } |
| 271 | case (RRBP_Nplus21_or_22_mod_2715648) { |
| 272 | add := 21; /* FIXME: What about 'or 22'? */ |
| 273 | } |
| 274 | case (RRBP_Nplus26_mod_2715648) { |
| 275 | add := 26; |
| 276 | } |
| 277 | } |
| 278 | return (fn + add) mod 2715648; |
| 279 | } |
| 280 | |
Harald Welte | 060e27a | 2018-03-03 20:38:19 +0100 | [diff] [blame] | 281 | |
| 282 | function f_bssgp_wait_ul_ud(template BssgpDecoded bd_exp) runs on dummy_CT { |
| 283 | timer T := 5.0; |
| 284 | T.start; |
| 285 | alt { |
Alexander Couzens | 0e510e6 | 2018-07-28 23:06:00 +0200 | [diff] [blame] | 286 | [] BSSGP[0].receive(bd_exp) { |
Harald Welte | 060e27a | 2018-03-03 20:38:19 +0100 | [diff] [blame] | 287 | log("found matching BSSGP UL-UNITDATA PDU"); |
| 288 | } |
| 289 | [] T.timeout { |
| 290 | setverdict(fail, "Timeout waiting for ", bd_exp); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 291 | mtc.stop; |
Harald Welte | 060e27a | 2018-03-03 20:38:19 +0100 | [diff] [blame] | 292 | } |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | |
| 297 | function f_ul_tbf(inout UlTbfState us) runs on dummy_CT { |
| 298 | var RLCMAC_ph_data_ind dl; |
| 299 | |
| 300 | /* Establish an UL-TBF */ |
| 301 | f_establish_ul_tbf(); |
| 302 | |
| 303 | while (true) { |
| 304 | var RlcmacUlBlock blk; |
| 305 | if (f_ul_tbf_get_next_block(blk, us, g_mmctx, true) == false) { |
| 306 | break; |
| 307 | } |
| 308 | |
| 309 | /* Send the block to L1 for transmission */ |
| 310 | log("L1=", blk); |
| 311 | L1.send(RLCMAC_ph_data_req:{dyn:={tbf_id := 0, cs := us.tbf.initial_cs, block := blk}}); |
| 312 | } |
| 313 | |
| 314 | alt { |
| 315 | [] L1.receive(RLCMAC_ph_data_ind:{cs:=?, ts_nr:=?, fn:=?, block:=tr_RLCMAC_ACK_NACK(0, g_mmctx.tlli)}) -> value dl { |
| 316 | log("found matching ACK/NACK"); |
| 317 | /* send CTRL ACK in uplink */ |
| 318 | var GsmFrameNumber ul_fn := f_rrbp_fn(dl.fn, dl.block.ctrl.mac_hdr.rrbp); |
| 319 | var RlcmacUlCtrlMsg ctrl_ack := valueof(ts_RlcMacUlCtrl_PKT_CTRL_ACK(g_mmctx.tlli)); |
| 320 | var RlcmacUlBlock ul_block := valueof(ts_RLC_UL_CTRL_ACK(ctrl_ack)); |
| 321 | L1.send(ts_PH_DATA_ABS(0, CS1, dl.ts_nr, ul_fn, {false, 871}, ul_block)); |
| 322 | /* wait for the final ACK */ |
| 323 | if (dl.block.ctrl.payload.u.ul_ack_nack.gprs.ack_nack_desc.final_ack == '0'B) { |
| 324 | repeat; |
| 325 | } |
| 326 | } |
| 327 | [] L1.receive { repeat; } |
| 328 | } |
| 329 | |
| 330 | for (var integer i := 0; i < sizeof(us.tbf.llc_pdus_enc); i := i+1) { |
| 331 | f_bssgp_wait_ul_ud(tr_BD_BSSGP(tr_BSSGP_UL_UD(g_mmctx.tlli, ?, us.tbf.llc_pdus_enc[i]))); |
| 332 | } |
| 333 | setverdict(pass); |
Harald Welte | 54242db | 2018-03-03 22:38:54 +0100 | [diff] [blame] | 334 | |
| 335 | L1.send(DCCH_release_req:{}); |
Harald Welte | 060e27a | 2018-03-03 20:38:19 +0100 | [diff] [blame] | 336 | } |
| 337 | |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 338 | testcase TC_rach() runs on dummy_CT { |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 339 | var BssgpBvci bvci := 196; |
Harald Welte | 7024baa | 2018-03-02 23:37:51 +0100 | [diff] [blame] | 340 | g_mmctx.imsi := '262420123456789'H; |
| 341 | g_mmctx.tlli := f_random_tlli(); |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 342 | |
| 343 | f_init(); |
| 344 | |
Harald Welte | 7024baa | 2018-03-02 23:37:51 +0100 | [diff] [blame] | 345 | f_bssgp_client_register(g_mmctx.imsi, g_mmctx.tlli, mp_gb_cfg.cell_id); |
| 346 | |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 347 | f_bssgp_establish(); |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | |
| 351 | testcase TC_nsem() runs on dummy_CT { |
| 352 | |
| 353 | f_bssgp_establish(); |
| 354 | |
| 355 | while (true) { |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 356 | var BssgpDecoded bd; |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 357 | alt { |
Alexander Couzens | 0e510e6 | 2018-07-28 23:06:00 +0200 | [diff] [blame] | 358 | [] BSSGP[0].receive(tr_BD_BSSGP(?)) -> value bd { |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 359 | log("BSSGP Rx: ", bd); |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 360 | //log("GMM Rx: ", dec_PDU_L3_MS_SGSN(pdu.payload)); |
Harald Welte | acc93ab | 2018-03-02 21:39:09 +0100 | [diff] [blame] | 361 | g_mmctx.tlli := bd.bssgp.pDU_BSSGP_UL_UNITDATA.tLLI; |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 362 | tx_gmm(LLC_CR_DL_CMD, gmm_auth_req); |
| 363 | } |
Alexander Couzens | 0e510e6 | 2018-07-28 23:06:00 +0200 | [diff] [blame] | 364 | [] BSSGP[0].receive(t_BssgpStsInd(?, ?, BVC_S_UNBLOCKED)) { repeat; } |
| 365 | [] BSSGP[0].receive { repeat; } |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 366 | } |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | |
| 371 | function f_llc_dec_and_log(in octetstring inp) { |
| 372 | log("LLC Input: ", inp); |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 373 | var PDU_LLC dec := dec_PDU_LLC(inp); |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 374 | log("LLC Decoded: ", dec); |
| 375 | } |
| 376 | |
| 377 | function f_llc_assert(in octetstring a, in octetstring b) { |
| 378 | log("LLC Input: ", a); |
| 379 | log("LLC Expected: ", b); |
| 380 | |
| 381 | if (a != b) { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 382 | setverdict(fail, "LLC input ", b, " != expected ", a); |
| 383 | mtc.stop; |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 384 | } else { |
| 385 | setverdict(pass); |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | |
| 390 | testcase TC_selftest_llc() runs on dummy_CT { |
| 391 | const octetstring c_gmm_att_pcu := '01c001080103e5e000210a0005f4fb146ddd32f44000c8001d1b53432b37159ef9090070000dd9c6321200e00019b32c642401c00020170580460b'O; |
| 392 | const octetstring c_gmm_att_pcu_nofcs := '01c001080103e5e000210a0005f4fb146ddd32f44000c8001d1b53432b37159ef9090070000dd9c6321200e00019b32c642401c000201705'O; |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 393 | |
| 394 | f_llc_dec_and_log(c_gmm_att_pcu); |
| 395 | |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 396 | //f_llc_assert(f_LLC_append_fcs(c_gmm_att_pcu_nofcs), c_gmm_att_pcu); |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 397 | |
Harald Welte | 5ac3149 | 2018-02-15 20:39:13 +0100 | [diff] [blame] | 398 | log(valueof(ts_LLC_UI(gmm_auth_req, c_LLC_SAPI_LLGMM, LLC_CR_DL_CMD, g_mmctx.n_u))); |
| 399 | log(ts_LLC_UI(gmm_auth_req, c_LLC_SAPI_LLGMM, LLC_CR_DL_CMD, g_mmctx.n_u)); |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 400 | } |
| 401 | |
| 402 | testcase TC_selftest_rlcmac() runs on dummy_CT { |
| 403 | var RlcmacDlCtrlBlock dcb; |
| 404 | var RlcmacUlCtrlBlock ucb; |
| 405 | const octetstring c_dl_ul_ack_nack := '40240080400000000000000077628dbba14b2b2b2b2b2b'O; |
| 406 | const octetstring c_dl_data := '0f00007341c001081200102198c72477ea104895e8b959acc58b108182f4d0454300'O; |
| 407 | const octetstring c_dl_data2 := '070002165dc0012b2b2b43c0012b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b00'O; |
| 408 | const octetstring c_ul_ctrl_ack := '4006ec51b7772b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b'O; |
| 409 | const octetstring c_ul_dl_ack_nack := '4008004000000000000000701000edc0000b2b2b2b2b2b'O; |
| 410 | const octetstring c_dl_ul_assign := '482857628dbbaf0126e68800082b2b2b2b2b2b2b2b2b2b'O; |
| 411 | |
| 412 | log(c_dl_ul_ack_nack); |
| 413 | dcb := dec_RlcmacDlCtrlBlock(c_dl_ul_ack_nack); |
| 414 | log(dcb); |
| 415 | //log(dec_RlcmacDlCtrlMsg(dcb.payload)); |
| 416 | |
| 417 | f_rlcmac_dld_decenc(c_dl_data); |
| 418 | |
| 419 | f_rlcmac_dld_decenc(c_dl_data2); |
| 420 | |
| 421 | log(c_ul_ctrl_ack); |
| 422 | ucb := dec_RlcmacUlCtrlBlock(c_ul_ctrl_ack); |
| 423 | log(ucb); |
| 424 | //log(dec_RlcmacUlCtrlMsg(ucb.payload)); |
| 425 | |
| 426 | log(c_ul_dl_ack_nack); |
| 427 | ucb := dec_RlcmacUlCtrlBlock(c_ul_dl_ack_nack); |
| 428 | log(ucb); |
| 429 | //log(dec_RlcmacUlCtrlMsg(ucb.payload)); |
| 430 | |
| 431 | log(c_dl_ul_assign); |
| 432 | dcb := dec_RlcmacDlCtrlBlock(c_dl_ul_assign); |
| 433 | log(dcb); |
| 434 | //log(dec_RlcmacDlCtrlMsg(dcb.payload)); |
| 435 | |
| 436 | const octetstring c_uld_tlli_noext := '080101a61cab5201c001080103e5e000310a0005f4e61cab5232f44000c8001d1b00'O; |
| 437 | f_rlcmac_uld_decenc(c_uld_tlli_noext); |
| 438 | |
| 439 | const octetstring c_uld_tlli_ext7pad := '0001041da61cab5200201705a96e102b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b00'O; |
| 440 | log("ULD_decenc"); |
| 441 | f_rlcmac_uld_decenc(c_uld_tlli_ext7pad); |
| 442 | log("UL_decenc"); |
| 443 | f_rlcmac_ul_decenc(c_uld_tlli_ext7pad); |
| 444 | |
| 445 | f_rlcmac_ul_decenc(c_ul_dl_ack_nack); |
| 446 | } |
| 447 | |
| 448 | function f_rlcmac_ul_decenc(in octetstring buf) { |
| 449 | log("=================================="); |
| 450 | log("In: ", buf); |
| 451 | var RlcmacUlBlock udb := dec_RlcmacUlBlock(buf); |
| 452 | log("Dec: ", udb); |
| 453 | var octetstring enc := enc_RlcmacUlBlock(udb); |
| 454 | log("Enc: ", enc); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 455 | if (enc != buf) { |
| 456 | setverdict(fail, "Re-encoded data doesn't equal input data"); |
| 457 | mtc.stop; |
| 458 | } |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 459 | } |
| 460 | |
| 461 | function f_rlcmac_uld_decenc(in octetstring buf) { |
| 462 | log("=================================="); |
| 463 | log("In: ", buf); |
| 464 | var RlcmacUlDataBlock udb := dec_RlcmacUlDataBlock(buf); |
| 465 | log("Dec: ", udb); |
| 466 | var octetstring enc := enc_RlcmacUlDataBlock(udb); |
| 467 | log("Enc: ", enc); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 468 | if (enc != buf) { |
| 469 | setverdict(fail, "Re-encoded data doesn't equal input data"); |
| 470 | mtc.stop; |
| 471 | } |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 472 | } |
| 473 | |
| 474 | function f_rlcmac_dld_decenc(in octetstring buf) { |
| 475 | log("=================================="); |
| 476 | log("In: ", buf); |
| 477 | var RlcmacDlDataBlock udb := dec_RlcmacDlDataBlock(buf); |
| 478 | log("Dec: ", udb); |
| 479 | var octetstring enc := enc_RlcmacDlDataBlock(udb); |
| 480 | log("Enc: ", enc); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 481 | if (enc != buf) { |
| 482 | setverdict(fail, "Re-encoded data doesn't equal input data"); |
| 483 | mtc.stop; |
| 484 | } |
Harald Welte | 244cd8a | 2017-08-26 09:25:20 +0200 | [diff] [blame] | 485 | } |
| 486 | |
| 487 | |
| 488 | testcase TC_selftest_rr() runs on dummy_CT { |
| 489 | //const octetstring c_paging_none := '06210001F02B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B'O |
| 490 | const octetstring c_paging_none := '1506210001F0'O; |
| 491 | const octetstring c_ia_tbf := '2d063f100fe3677bd8440000c800100b2b2b2b2b2b2b2b'O |
| 492 | log(c_paging_none); |
| 493 | log(dec_GsmRrMessage(c_paging_none)); |
| 494 | |
| 495 | log(c_ia_tbf); |
| 496 | log(dec_GsmRrMessage(c_ia_tbf)); |
| 497 | } |
| 498 | |
Harald Welte | 060e27a | 2018-03-03 20:38:19 +0100 | [diff] [blame] | 499 | function f_seq_octstr(integer len) return octetstring { |
| 500 | var octetstring payload := ''O; |
| 501 | for (var integer i := 0; i < len; i := i+1 ) { |
| 502 | payload := payload & int2oct(i mod 256, 1); |
| 503 | } |
| 504 | return payload; |
| 505 | } |
| 506 | |
Harald Welte | 54242db | 2018-03-03 22:38:54 +0100 | [diff] [blame] | 507 | testcase TC_ul_tbf_single_llc_sizes() runs on dummy_CT { |
| 508 | g_mmctx.imsi := '262420123456789'H; |
| 509 | g_mmctx.tlli := f_random_tlli(); |
| 510 | f_init(); |
| 511 | |
| 512 | for (var integer len := 1; len <= 1560; len := len+1) { |
| 513 | log("Testing Uplink TBF with single LLC-PDU of ", len, " bytes"); |
| 514 | var octetstring payload := f_seq_octstr(len); |
| 515 | var UlTbfPars ul_tbf_pars := { |
| 516 | ack_mode := true, |
| 517 | initial_cs := CS1, |
| 518 | llc_pdus := { |
| 519 | valueof(ts_LLC_UI(payload, c_LLC_SAPI_LLGMM, '0'B, g_mmctx.n_u)) |
| 520 | } |
| 521 | } |
| 522 | var UlTbfState ul_tbf_state; |
| 523 | f_UlTbfState_init(ul_tbf_state, ul_tbf_pars); |
| 524 | f_ul_tbf(ul_tbf_state); |
| 525 | f_sleep(1.0); |
| 526 | } |
| 527 | |
| 528 | f_exit(); |
| 529 | } |
| 530 | |
Harald Welte | 060e27a | 2018-03-03 20:38:19 +0100 | [diff] [blame] | 531 | testcase TC_ul_tbf() runs on dummy_CT { |
| 532 | g_mmctx.imsi := '262420123456789'H; |
| 533 | g_mmctx.tlli := f_random_tlli(); |
| 534 | f_init(); |
Harald Welte | 060e27a | 2018-03-03 20:38:19 +0100 | [diff] [blame] | 535 | |
Harald Welte | 54242db | 2018-03-03 22:38:54 +0100 | [diff] [blame] | 536 | var octetstring payload := f_seq_octstr(1023); |
Harald Welte | 060e27a | 2018-03-03 20:38:19 +0100 | [diff] [blame] | 537 | var UlTbfPars ul_tbf_pars := { |
| 538 | ack_mode := true, |
| 539 | initial_cs := CS1, |
| 540 | llc_pdus := { |
| 541 | valueof(ts_LLC_UI(payload, c_LLC_SAPI_LLGMM, '0'B, g_mmctx.n_u)), |
Harald Welte | 54242db | 2018-03-03 22:38:54 +0100 | [diff] [blame] | 542 | valueof(ts_LLC_UI(payload, c_LLC_SAPI_LLGMM, '0'B, g_mmctx.n_u+1)), |
| 543 | valueof(ts_LLC_UI(payload, c_LLC_SAPI_LLGMM, '0'B, g_mmctx.n_u+2)), |
| 544 | valueof(ts_LLC_UI(payload, c_LLC_SAPI_LLGMM, '0'B, g_mmctx.n_u+3)), |
| 545 | valueof(ts_LLC_UI(payload, c_LLC_SAPI_LLGMM, '0'B, g_mmctx.n_u+4)), |
| 546 | valueof(ts_LLC_UI(payload, c_LLC_SAPI_LLGMM, '0'B, g_mmctx.n_u+5)) |
Harald Welte | 060e27a | 2018-03-03 20:38:19 +0100 | [diff] [blame] | 547 | } |
| 548 | }; |
| 549 | var UlTbfState ul_tbf_state; |
| 550 | f_UlTbfState_init(ul_tbf_state, ul_tbf_pars); |
| 551 | f_ul_tbf(ul_tbf_state); |
Harald Welte | 54242db | 2018-03-03 22:38:54 +0100 | [diff] [blame] | 552 | |
| 553 | f_exit(); |
Harald Welte | 060e27a | 2018-03-03 20:38:19 +0100 | [diff] [blame] | 554 | } |
| 555 | |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 556 | testcase TC_dl_tbf() runs on dummy_CT { |
| 557 | g_mmctx.imsi := '262420123456789'H; |
| 558 | g_mmctx.tlli := f_random_tlli(); |
| 559 | f_init(); |
| 560 | |
| 561 | f_establish_dl_tbf(); |
| 562 | |
| 563 | f_exit(); |
| 564 | } |
| 565 | |
| 566 | function f_wait_tbf_dl(TbfNr tbf_nr, GprsTlli tlli) runs on dummy_CT return ImmediateAssignment { |
| 567 | var LAPDm_ph_data ph_data; |
| 568 | var GsmRrMessage rr; |
| 569 | timer T := 10.0; |
| 570 | T.start; |
| 571 | alt { |
| 572 | [] L1.receive(LAPDm_ph_data:{sacch:=?,sapi:=0,lapdm:={bbis:=?}}) -> value ph_data { |
| 573 | rr := dec_GsmRrMessage(ph_data.lapdm.bbis.payload); |
| 574 | log("PCH/AGCH DL RR: ", rr); |
| 575 | if (match(rr, t_RR_IMM_ASS_TBF_DL(tlli))) { |
| 576 | var TbfPars tbf_pars := valueof(t_TbfParsInit); |
| 577 | log("Received IMM.ASS for our TLLI!"); |
| 578 | tbf_pars.tfi[rr.payload.imm_ass.pkt_chan_desc.tn] := |
| 579 | rr.payload.imm_ass.rest_octets.hh.dl.group1.tfi_assignment; |
| 580 | L1.send(TBF_DL_establish_req:{tbf_nr, tbf_pars}); |
| 581 | } else { |
| 582 | repeat; |
| 583 | } |
| 584 | } |
| 585 | [] L1.receive { repeat }; |
| 586 | [] T.timeout { |
| 587 | setverdict(fail, "Timeout waiting for IMM ASS") |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 588 | mtc.stop; |
Harald Welte | b669ee0 | 2018-03-09 12:50:02 +0100 | [diff] [blame] | 589 | } |
| 590 | } |
| 591 | T.stop; |
| 592 | return rr.payload.imm_ass; |
| 593 | } |
| 594 | |
| 595 | /* Establish an UL TBF: Tune to ARFCN, send RACH, receive AGCH, enable TBF Rx */ |
| 596 | function f_establish_dl_tbf() runs on dummy_CT { |
| 597 | timer T := 5.0; |
| 598 | var BCCH_tune_req tune_req := { { false, 871 }, true }; |
| 599 | L1.send(tune_req); |
| 600 | /* FIXME: wait for confirm */ |
| 601 | |
| 602 | /* sending a GMM PDU as DL-UNITDATA should trigger Paging + DL TBF Assignment */ |
| 603 | tx_gmm('1'B, '01020304'O, c_LLC_SAPI_LLGMM); |
| 604 | |
| 605 | /* Expect an IMM.ASS for PDCH on the AGCH */ |
| 606 | f_wait_tbf_dl(0, g_mmctx.tlli); |
| 607 | |
| 608 | var RLCMAC_ph_data_ind dl; |
| 609 | alt { |
| 610 | [] L1.receive(RLCMAC_ph_data_ind:{cs:=?, ts_nr:=?, fn:=?, block:=tr_RLCMAC_DATA_RRBP}) -> |
| 611 | value dl { |
| 612 | var uint6_t tfi := dl.block.data.mac_hdr.hdr_ext.tfi; |
| 613 | var GsmFrameNumber ul_fn := f_rrbp_fn(dl.fn, dl.block.data.mac_hdr.mac_hdr.rrbp); |
| 614 | var AckNackDescription an_desc := { /* FIXME: compute this based on state */ |
| 615 | final_ack := '1'B, |
| 616 | starting_seq_nr := 0, |
| 617 | receive_block_bitmap := '0000000000000000000000000000000000000000000000000000000000000001'B |
| 618 | } |
| 619 | var RlcmacUlCtrlMsg ctrl_ack; |
| 620 | ctrl_ack := valueof(ts_RlcMacUlCtrl_PKT_DL_ACK(tfi, an_desc)); |
| 621 | var RlcmacUlBlock ul_block := valueof(ts_RLC_UL_CTRL_ACK(ctrl_ack)); |
| 622 | L1.send(ts_PH_DATA_ABS(0, CS1, dl.ts_nr, ul_fn, {false, 871}, ul_block)); |
| 623 | log("Sent DL ACK: ", ul_block); |
| 624 | } |
| 625 | [] L1.receive { repeat; } |
| 626 | } |
| 627 | |
| 628 | f_sleep(10.0); |
| 629 | } |
| 630 | |
| 631 | |
Harald Welte | 3a19440 | 2017-07-22 17:07:51 +0200 | [diff] [blame] | 632 | control { |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 633 | execute(TC_selftest_ns()); |
Max | cdce375 | 2018-11-06 18:57:19 +0100 | [diff] [blame^] | 634 | execute(TC_ul_tbf_single_llc_sizes()); |
| 635 | execute(TC_ul_tbf()); |
Harald Welte | 3a19440 | 2017-07-22 17:07:51 +0200 | [diff] [blame] | 636 | } |
| 637 | }; |