Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 1 | module PCU_Tests_RAW { |
| 2 | |
| 3 | /* "RAW" PCU tests: Talk directly to the PCU socket of OsmoPCU on the one hand side (emulating |
| 4 | the BTS/BSC side PCU socket server) and the Gb interface on the other hand side. No NS/BSSGP |
| 5 | Emulation is used; rather, we simply use the NS_CodecPort to implement both standard and non- |
| 6 | standard procedures on the NS and BSSGP level. The goal of these tests is to test exactly |
| 7 | those NS and BSSGP implementations on the BSS (PCU) side. */ |
| 8 | |
| 9 | import from General_Types all; |
| 10 | import from Osmocom_Types all; |
Harald Welte | 7fd25cf | 2019-03-21 22:14:02 +0100 | [diff] [blame^] | 11 | import from GSM_Types all; |
| 12 | import from GSM_RR_Types all; |
| 13 | |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 14 | import from NS_Types all; |
| 15 | import from BSSGP_Types all; |
| 16 | import from Osmocom_Gb_Types all; |
| 17 | |
| 18 | import from BSSGP_Emulation all; /* BssgpConfig */ |
| 19 | import from NS_Emulation all; /* NSConfiguration */ |
| 20 | |
| 21 | import from UD_Types all; |
| 22 | import from PCUIF_Types all; |
| 23 | import from PCUIF_CodecPort all; |
| 24 | import from IPL4asp_Types all; |
| 25 | import from NS_CodecPort all; |
| 26 | import from NS_CodecPort_CtrlFunct all; |
| 27 | import from Native_Functions all; |
| 28 | import from PCU_Tests all; |
| 29 | |
| 30 | modulepar { |
| 31 | charstring mp_pcu_sock_path := PCU_SOCK_DEFAULT; |
| 32 | } |
| 33 | |
| 34 | type component RAW_NS_CT { |
| 35 | /* UDP port towards the bottom (IUT) */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 36 | port NS_CODEC_PT NSCP[4]; |
| 37 | var ConnectionId g_ns_conn_id[4] := {-1, -1, -1, -1}; |
| 38 | var NSConfiguration g_nsconfig[4]; |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 39 | timer g_T_guard; |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 40 | } |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 41 | |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 42 | type component RAW_PCU_CT { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 43 | /* PCUIF (we emulate the BTS part) */ |
| 44 | port PCUIF_CODEC_PT PCU; |
| 45 | var ConnectionId g_pcu_conn_id := -1; |
| 46 | } |
| 47 | |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 48 | type component RAW_Test_CT extends RAW_NS_CT, RAW_PCU_CT { |
| 49 | } |
| 50 | |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 51 | private altstep as_Tguard() runs on RAW_NS_CT { |
| 52 | [] g_T_guard.timeout { |
| 53 | setverdict(fail, "Timeout of T_guard"); |
| 54 | mtc.stop; |
| 55 | } |
| 56 | } |
| 57 | |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 58 | function f_init_pcuif() runs on RAW_PCU_CT { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 59 | map(self:PCU, system:PCU); |
| 60 | |
| 61 | /* Connect the Unix Domain Socket */ |
| 62 | g_pcu_conn_id := f_pcuif_listen(PCU, mp_pcu_sock_path); |
| 63 | PCU.receive(UD_connected:?); |
| 64 | |
| 65 | /* Wait for PCU_VERSION and return INFO_IND */ |
| 66 | PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_TXT_IND(0, PCU_VERSION, ?))); |
| 67 | /* FIXME: make sure to use parameters from mp_gb_cfg.cell_id in the PCU INFO IND */ |
| 68 | var template PCUIF_Message info_ind := ts_PCUIF_INFO_IND(bts_nr := 0, |
| 69 | nsei := mp_nsconfig.nsei, |
| 70 | nsvci := mp_nsconfig.nsvci, |
| 71 | bvci := mp_gb_cfg.bvci, |
| 72 | local_port := mp_nsconfig.remote_udp_port, |
| 73 | remote_port := mp_nsconfig.local_udp_port, |
| 74 | remote_ip := f_inet_haddr(mp_nsconfig.local_ip) |
| 75 | ); |
| 76 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, info_ind)); |
| 77 | } |
| 78 | |
Harald Welte | 0466d16 | 2019-03-21 21:30:21 +0100 | [diff] [blame] | 79 | function f_pcuif_tx(template (value) PCUIF_Message msg) runs on RAW_PCU_CT { |
| 80 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, msg)); |
| 81 | } |
| 82 | |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 83 | function f_init_ns_codec(integer idx := 0, float guard_secs := 60.0) runs on RAW_NS_CT { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 84 | var Result res; |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 85 | |
| 86 | if (not g_T_guard.running) { |
| 87 | g_T_guard.start(guard_secs); |
| 88 | activate(as_Tguard()); |
| 89 | } |
| 90 | |
| 91 | if (not isbound(g_nsconfig) or not isbound(g_nsconfig[idx])) { |
| 92 | /* copy most parts from mp_nsconfig */ |
| 93 | g_nsconfig[idx] := mp_nsconfig; |
| 94 | /* adjust those parts different for each NS-VC */ |
| 95 | g_nsconfig[idx].nsvci := mp_nsconfig.nsvci + idx; |
| 96 | g_nsconfig[idx].local_udp_port := mp_nsconfig.local_udp_port + idx; |
| 97 | } |
| 98 | |
| 99 | map(self:NSCP[idx], system:NSCP); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 100 | /* Connect the UDP socket */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 101 | log("connecting NSCP[", idx, "] to ", g_nsconfig[idx]); |
| 102 | res := f_IPL4_connect(NSCP[idx], g_nsconfig[idx].remote_ip, g_nsconfig[idx].remote_udp_port, |
| 103 | g_nsconfig[idx].local_ip, g_nsconfig[idx].local_udp_port, 0, { udp := {}}); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 104 | if (not ispresent(res.connId)) { |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 105 | setverdict(fail, "Could not connect NS UDP socket, check your configuration ", g_nsconfig[idx]); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 106 | mtc.stop; |
| 107 | } |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 108 | g_ns_conn_id[idx] := res.connId; |
| 109 | |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 110 | } |
| 111 | |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 112 | function f_ns_exp(template PDU_NS exp_rx, integer idx := 0) runs on RAW_NS_CT return PDU_NS { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 113 | var NS_RecvFrom nrf; |
| 114 | log("f_ns_exp() expecting ", exp_rx); |
| 115 | alt { |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 116 | [] NSCP[idx].receive(t_NS_RecvFrom(exp_rx)) -> value nrf { } |
| 117 | [] NSCP[idx].receive { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 118 | setverdict(fail, "Received unexpected NS: ", nrf); |
| 119 | mtc.stop; |
| 120 | } |
| 121 | } |
| 122 | return nrf.msg; |
| 123 | } |
| 124 | |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 125 | /* perform outbound NS-ALIVE procedure */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 126 | function f_outgoing_ns_alive(integer idx := 0) runs on RAW_NS_CT { |
| 127 | NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], t_NS_ALIVE)); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 128 | alt { |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 129 | [] NSCP[idx].receive(t_NS_RecvFrom(t_NS_ALIVE_ACK)); |
| 130 | [] NSCP[idx].receive { repeat; } |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 131 | } |
| 132 | } |
| 133 | |
Harald Welte | ecd159e | 2019-03-16 13:36:07 +0100 | [diff] [blame] | 134 | /* perform outbound NS-ALIVE procedure */ |
| 135 | function f_outgoing_ns_alive_no_ack(integer idx := 0, float tout := 10.0) runs on RAW_NS_CT { |
| 136 | timer T := tout; |
| 137 | NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], t_NS_ALIVE)); |
| 138 | T.start; |
| 139 | alt { |
| 140 | [] NSCP[idx].receive(t_NS_RecvFrom(t_NS_ALIVE_ACK)) { |
| 141 | setverdict(fail, "Received unexpected NS-ALIVE ACK"); |
| 142 | } |
| 143 | [] NSCP[idx].receive { repeat; } |
| 144 | [] T.timeout { |
| 145 | setverdict(pass); |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | /* ensure no matching message is received within 'tout' */ |
| 151 | function f_ensure_no_ns(template PDU_NS ns := ?, integer idx := 0, float tout := 3.0) |
| 152 | runs on RAW_Test_CT { |
| 153 | timer T := tout; |
| 154 | T.start; |
| 155 | alt { |
| 156 | [] NSCP[idx].receive(t_NS_RecvFrom(ns)) { |
| 157 | setverdict(fail, "NS-ALIVE from unconfigured (possibly initial) endpoint"); |
| 158 | } |
| 159 | [] T.timeout { |
| 160 | setverdict(pass); |
| 161 | } |
| 162 | } |
| 163 | } |
| 164 | |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 165 | /* perform outbound NS-BLOCK procedure */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 166 | function f_outgoing_ns_block(NsCause cause, integer idx := 0) runs on RAW_NS_CT { |
| 167 | NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_BLOCK(cause, g_nsconfig[idx].nsvci))); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 168 | alt { |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 169 | [] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_BLOCK_ACK(g_nsconfig[idx].nsvci))); |
| 170 | [] NSCP[idx].receive { repeat; } |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 171 | } |
| 172 | } |
| 173 | |
| 174 | /* receive NS-ALIVE and ACK it */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 175 | altstep as_rx_alive_tx_ack(boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT { |
| 176 | [] NSCP[idx].receive(t_NS_RecvFrom(t_NS_ALIVE)) { |
| 177 | NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], t_NS_ALIVE_ACK)); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 178 | if (not oneshot) { repeat; } |
| 179 | } |
| 180 | } |
| 181 | |
Harald Welte | 64d0731 | 2019-03-20 09:48:39 +0100 | [diff] [blame] | 182 | /* Transmit BSSGP RESET for given BVCI and expect ACK */ |
| 183 | function f_tx_bvc_reset_rx_ack(BssgpBvci bvci, integer idx := 0, boolean exp_ack := true) |
| 184 | runs on RAW_NS_CT { |
| 185 | var PDU_BSSGP bssgp_tx := valueof(ts_BVC_RESET(BSSGP_CAUSE_NET_SV_CAP_MOD_GT_ZERO_KBPS, bvci, |
| 186 | mp_gb_cfg.cell_id)); |
| 187 | timer T := 5.0; |
| 188 | NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_UNITDATA(t_SduCtrlB, 0, enc_PDU_BSSGP(bssgp_tx)))); |
| 189 | T.start; |
| 190 | alt { |
| 191 | [exp_ack] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_UNITDATA(t_SduCtrlB, 0, |
| 192 | decmatch tr_BVC_RESET_ACK(bvci, ?)))) { |
| 193 | setverdict(pass); |
| 194 | } |
| 195 | [exp_ack] T.timeout { |
| 196 | setverdict(fail, "No response to BVC-RESET"); |
| 197 | } |
| 198 | [not exp_ack] T.timeout { |
| 199 | setverdict(pass); |
| 200 | } |
| 201 | [] NSCP[idx].receive { repeat; } |
| 202 | } |
| 203 | } |
| 204 | |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 205 | /* Receive a BSSGP RESET for given BVCI and ACK it */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 206 | altstep as_rx_bvc_reset_tx_ack(BssgpBvci bvci, boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 207 | var NS_RecvFrom ns_rf; |
| 208 | /* FIXME: nail down received cell_id in match */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 209 | [] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_UNITDATA(t_SduCtrlB, 0, |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 210 | decmatch tr_BVC_RESET(?, bvci, ?)))) |
| 211 | -> value ns_rf { |
| 212 | var PDU_BSSGP bssgp_rx := dec_PDU_BSSGP(ns_rf.msg.pDU_NS_Unitdata.nS_SDU); |
| 213 | var PDU_BSSGP bssgp_tx := valueof(ts_BVC_RESET_ACK(bvci, mp_gb_cfg.cell_id)); |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 214 | NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_UNITDATA(t_SduCtrlB, 0, enc_PDU_BSSGP(bssgp_tx)))); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 215 | if (not oneshot) { repeat; } |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | |
| 220 | /* Receive a BSSGP UNBLOCK for given BVCI and ACK it */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 221 | altstep as_rx_bvc_unblock_tx_ack(BssgpBvci bvci, boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 222 | var NS_RecvFrom ns_rf; |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 223 | [] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_UNITDATA(t_SduCtrlB, 0, |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 224 | decmatch t_BVC_UNBLOCK(bvci)))) |
| 225 | -> value ns_rf { |
| 226 | var PDU_BSSGP bssgp_rx := dec_PDU_BSSGP(ns_rf.msg.pDU_NS_Unitdata.nS_SDU); |
| 227 | var PDU_BSSGP bssgp_tx := valueof(t_BVC_UNBLOCK_ACK(bvci)); |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 228 | NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_UNITDATA(t_SduCtrlB, 0, enc_PDU_BSSGP(bssgp_tx)))); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 229 | if (not oneshot) { repeat; } |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | /* Receive a BSSGP FLOW-CONTROL-BVC and ACK it */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 234 | altstep as_rx_bvc_fc_tx_ack(BssgpBvci bvci, boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 235 | var NS_RecvFrom ns_rf; |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 236 | [] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_UNITDATA(t_SduCtrlB, bvci, |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 237 | decmatch tr_BVC_FC_BVC))) |
| 238 | -> value ns_rf { |
| 239 | var PDU_BSSGP bssgp_rx := dec_PDU_BSSGP(ns_rf.msg.pDU_NS_Unitdata.nS_SDU); |
| 240 | var OCT1 tag := bssgp_rx.pDU_BSSGP_FLOW_CONTROL_BVC.tag.unstructured_Value; |
| 241 | var PDU_BSSGP bssgp_tx := valueof(t_BVC_FC_BVC_ACK(tag)); |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 242 | NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_UNITDATA(t_SduCtrlB, bvci, enc_PDU_BSSGP(bssgp_tx)))); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 243 | if (not oneshot) { repeat; } |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | /********************************************************************************** |
| 248 | * Classic Gb/IP bring-up test cases using NS-{RESET,BLOCK,UNBLOCK} and no IP-SNS * |
| 249 | **********************************************************************************/ |
| 250 | |
| 251 | /* Receive a NS-RESET and ACK it */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 252 | private altstep as_rx_ns_reset_ack(boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 253 | var NS_RecvFrom ns_rf; |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 254 | [] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_RESET(NS_CAUSE_OM_INTERVENTION, g_nsconfig[idx].nsvci, |
| 255 | g_nsconfig[idx].nsei))) -> value ns_rf { |
| 256 | NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_RESET_ACK(g_nsconfig[idx].nsvci, |
| 257 | g_nsconfig[idx].nsei))); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 258 | if (not oneshot) { repeat; } |
| 259 | } |
| 260 | } |
| 261 | /* Receive a NS-UNBLOCK and ACK it */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 262 | private altstep as_rx_ns_unblock_ack(boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 263 | var NS_RecvFrom ns_rf; |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 264 | [] NSCP[idx].receive(t_NS_RecvFrom(t_NS_UNBLOCK)) -> value ns_rf { |
| 265 | NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], t_NS_UNBLOCK_ACK)); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 266 | if (not oneshot) { repeat; } |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | /* test the NS-RESET procedure */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 271 | testcase TC_ns_reset() runs on RAW_Test_CT { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 272 | f_init_ns_codec(); |
| 273 | f_init_pcuif(); |
| 274 | |
| 275 | |
| 276 | /* Expect inbound NS-RESET procedure */ |
| 277 | as_rx_ns_reset_ack(oneshot := true); |
| 278 | setverdict(pass); |
| 279 | } |
| 280 | |
| 281 | /* ensure NS-RESET are re-transmitted */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 282 | testcase TC_ns_reset_retrans() runs on RAW_Test_CT { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 283 | f_init_ns_codec(); |
| 284 | f_init_pcuif(); |
| 285 | |
| 286 | var integer i; |
| 287 | for (i := 0; i < 3; i := i+1) { |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 288 | NSCP[0].receive(t_NS_RecvFrom(tr_NS_RESET(NS_CAUSE_OM_INTERVENTION, |
| 289 | g_nsconfig[0].nsvci, g_nsconfig[0].nsei))); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | /* Expect inbound NS-RESET procedure */ |
| 293 | as_rx_ns_reset_ack(oneshot := true); |
| 294 | setverdict(pass); |
| 295 | } |
| 296 | |
| 297 | /* test the inbound NS-ALIVE procedure after NS-RESET */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 298 | testcase TC_ns_alive() runs on RAW_Test_CT { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 299 | f_init_ns_codec(); |
| 300 | f_init_pcuif(); |
| 301 | |
| 302 | /* Expect inbound NS-RESET procedure */ |
| 303 | as_rx_ns_reset_ack(oneshot := true); |
| 304 | |
| 305 | /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */ |
| 306 | as_rx_alive_tx_ack(oneshot := true); |
| 307 | setverdict(pass); |
| 308 | } |
| 309 | |
| 310 | /* Test for NS-RESET after NS-ALIVE timeout */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 311 | testcase TC_ns_alive_timeout_reset() runs on RAW_Test_CT { |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 312 | f_init_ns_codec(guard_secs := 100.0); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 313 | f_init_pcuif(); |
| 314 | |
| 315 | /* Expect inbound NS-RESET procedure */ |
| 316 | as_rx_ns_reset_ack(oneshot := true); |
| 317 | |
| 318 | /* wait for at least one NS-ALIVE */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 319 | NSCP[0].receive(t_NS_RecvFrom(t_NS_ALIVE)); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 320 | |
| 321 | /* wait for NS-RESET to re-appear, ignoring any NS-ALIVE until then */ |
| 322 | alt { |
| 323 | [] as_rx_ns_reset_ack(oneshot := true) { setverdict(pass); } |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 324 | [] NSCP[0].receive(t_NS_RecvFrom(t_NS_ALIVE)) { repeat; } |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 325 | } |
| 326 | } |
| 327 | |
| 328 | /* test for NS-RESET/NS-ALIVE/NS-UNBLOCK */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 329 | testcase TC_ns_unblock() runs on RAW_Test_CT { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 330 | f_init_ns_codec(); |
| 331 | f_init_pcuif(); |
| 332 | |
| 333 | /* Expect inbound NS-RESET procedure */ |
| 334 | as_rx_ns_reset_ack(oneshot := true); |
| 335 | |
| 336 | /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */ |
| 337 | as_rx_alive_tx_ack(oneshot := true); |
| 338 | activate(as_rx_alive_tx_ack()); |
| 339 | |
| 340 | as_rx_ns_unblock_ack(oneshot := true); |
| 341 | setverdict(pass); |
| 342 | } |
| 343 | |
| 344 | /* test for NS-UNBLOCK re-transmissions */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 345 | testcase TC_ns_unblock_retrans() runs on RAW_Test_CT { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 346 | f_init_ns_codec(); |
| 347 | f_init_pcuif(); |
| 348 | |
| 349 | /* Expect inbound NS-RESET procedure */ |
| 350 | as_rx_ns_reset_ack(oneshot := true); |
| 351 | |
| 352 | /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */ |
| 353 | as_rx_alive_tx_ack(oneshot := true); |
| 354 | activate(as_rx_alive_tx_ack()); |
| 355 | |
| 356 | /* wait for first NS-UNBLOCK, don't respond */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 357 | NSCP[0].receive(t_NS_RecvFrom(t_NS_UNBLOCK)); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 358 | |
| 359 | /* wait for re-transmission of NS-UNBLOCK */ |
| 360 | as_rx_ns_unblock_ack(oneshot := true); |
| 361 | setverdict(pass); |
| 362 | } |
| 363 | |
| 364 | /* full bring-up of the Gb link for NS and BSSGP layer up to BVC-FC */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 365 | testcase TC_ns_full_bringup() runs on RAW_Test_CT { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 366 | f_init_ns_codec(); |
| 367 | f_init_pcuif(); |
| 368 | |
| 369 | /* Expect inbound NS-RESET procedure */ |
| 370 | as_rx_ns_reset_ack(oneshot := true); |
| 371 | |
| 372 | /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */ |
| 373 | as_rx_alive_tx_ack(oneshot := true); |
| 374 | activate(as_rx_alive_tx_ack()); |
| 375 | |
| 376 | as_rx_ns_unblock_ack(oneshot := true); |
| 377 | |
| 378 | f_outgoing_ns_alive(); |
| 379 | |
| 380 | /* Expect BVC-RESET for signaling (0) and ptp BVCI */ |
| 381 | as_rx_bvc_reset_tx_ack(0, oneshot := true); |
| 382 | as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvci, oneshot := true); |
| 383 | as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvci, oneshot := true); |
| 384 | |
| 385 | /* wait for one FLOW-CONTROL BVC and then ACK any further in the future */ |
| 386 | as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvci, oneshot := true); |
| 387 | activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvci)); |
| 388 | setverdict(pass); |
| 389 | } |
| 390 | |
| 391 | /* test outbound (SGSN-originated) NS-BLOCK procedure */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 392 | testcase TC_ns_so_block() runs on RAW_Test_CT { |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 393 | f_init_ns_codec(); |
| 394 | f_init_pcuif(); |
| 395 | |
| 396 | /* Expect inbound NS-RESET procedure */ |
| 397 | as_rx_ns_reset_ack(oneshot := true); |
| 398 | |
| 399 | /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */ |
| 400 | as_rx_alive_tx_ack(oneshot := true); |
| 401 | activate(as_rx_alive_tx_ack()); |
| 402 | |
| 403 | as_rx_ns_unblock_ack(oneshot := true); |
| 404 | |
| 405 | f_outgoing_ns_alive(); |
| 406 | |
| 407 | f_outgoing_ns_block(NS_CAUSE_EQUIPMENT_FAILURE); |
| 408 | setverdict(pass); |
| 409 | } |
| 410 | |
Harald Welte | 7fd25cf | 2019-03-21 22:14:02 +0100 | [diff] [blame^] | 411 | /* Test component with PCUIF + BSSGP/NS Emulation (no L1CTL) */ |
| 412 | type component bssgp_pcuif_CT extends bssgp_CT, RAW_PCU_CT { |
| 413 | } |
| 414 | |
| 415 | testcase TC_pcuif_suspend() runs on bssgp_pcuif_CT { |
| 416 | var OCT6 ra_id := enc_RoutingAreaIdentification(mp_gb_cfg.cell_id.ra_id); |
| 417 | var GprsTlli tlli := 'FFFFFFFF'O; |
| 418 | |
| 419 | /* Initialize PCU interface side */ |
| 420 | f_init_pcuif(); |
| 421 | |
| 422 | /* Initialize NS/BSSGP side */ |
| 423 | f_init_bssgp(); |
| 424 | |
| 425 | f_sleep(1.0); |
| 426 | f_pcuif_tx(ts_PCUIF_SUSP_REQ(0, tlli, ra_id, 0)); |
| 427 | BSSGP_SIG[0].receive(tr_BD_BSSGP(tr_BSSGP_SUSPEND(tlli, mp_gb_cfg.cell_id.ra_id))); |
| 428 | |
| 429 | setverdict(pass); |
| 430 | } |
| 431 | |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 432 | |
| 433 | control { |
| 434 | execute( TC_ns_reset() ); |
| 435 | execute( TC_ns_reset_retrans() ); |
| 436 | execute( TC_ns_alive() ); |
| 437 | execute( TC_ns_alive_timeout_reset() ); |
| 438 | execute( TC_ns_unblock() ); |
| 439 | execute( TC_ns_unblock_retrans() ); |
| 440 | execute( TC_ns_full_bringup() ); |
| 441 | execute( TC_ns_so_block() ); |
Harald Welte | 7fd25cf | 2019-03-21 22:14:02 +0100 | [diff] [blame^] | 442 | |
| 443 | execute( TC_pcuif_suspend() ); |
Harald Welte | 9fbcf4b | 2018-12-07 07:56:52 +0100 | [diff] [blame] | 444 | } |
| 445 | |
| 446 | |
| 447 | |
| 448 | |
| 449 | |
| 450 | |
| 451 | } |