Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1 | module HNBGW_Tests { |
| 2 | |
| 3 | /* Integration Tests for OsmoHNBGW |
| 4 | * (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Released under the terms of GNU General Public License, Version 2 or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 11 | * |
| 12 | * This test suite tests OsmoHNBGW while emulating the hNodeB as well as MSC, SGSN, MGW |
| 13 | * See README for more details. |
| 14 | */ |
| 15 | |
| 16 | import from Misc_Helpers all; |
| 17 | import from General_Types all; |
| 18 | import from GSM_Types all; |
| 19 | import from Osmocom_Types all; |
| 20 | import from IPL4asp_Types all; |
Neels Hofmeyr | 1e31146 | 2023-01-11 01:19:12 +0100 | [diff] [blame] | 21 | import from Native_Functions all; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 22 | |
| 23 | import from Osmocom_CTRL_Functions all; |
| 24 | import from Osmocom_CTRL_Types all; |
| 25 | import from Osmocom_CTRL_Adapter all; |
| 26 | |
| 27 | import from StatsD_Types all; |
| 28 | import from StatsD_CodecPort all; |
| 29 | import from StatsD_CodecPort_CtrlFunct all; |
| 30 | import from StatsD_Checker all; |
| 31 | |
| 32 | import from Osmocom_VTY_Functions all; |
| 33 | import from TELNETasp_PortType all; |
| 34 | |
| 35 | import from HNBAP_Templates all; |
Harald Welte | af3e216 | 2024-03-27 21:54:20 +0100 | [diff] [blame^] | 36 | import from HNBAP_IEs all; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 37 | import from HNBAP_PDU_Descriptions all; |
| 38 | |
| 39 | import from RUA_IEs all; |
| 40 | import from RUA_Templates all; |
| 41 | import from RUA_Emulation all; |
| 42 | |
| 43 | import from Iuh_Emulation all; |
| 44 | |
| 45 | import from RANAP_Types all; |
| 46 | import from RANAP_PDU_Descriptions all; |
| 47 | import from RANAP_PDU_Contents all; |
| 48 | import from RANAP_IEs all; |
| 49 | import from RANAP_Templates all; |
Neels Hofmeyr | b1bf16d | 2023-06-27 02:10:04 +0200 | [diff] [blame] | 50 | import from RANAP_CodecPort all; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 51 | |
| 52 | import from RAN_Adapter all; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 53 | import from RAN_Emulation all; |
| 54 | |
| 55 | import from MGCP_Emulation all; |
| 56 | import from MGCP_Types all; |
| 57 | import from MGCP_Templates all; |
| 58 | import from MGCP_CodecPort all; |
| 59 | import from SDP_Types all; |
Pau Espin Pedrol | 1158cc6 | 2024-03-21 17:21:35 +0100 | [diff] [blame] | 60 | import from SDP_Templates all; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 61 | |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 62 | import from PFCP_Types all; |
| 63 | import from PFCP_Emulation all; |
| 64 | import from PFCP_Templates all; |
| 65 | import from PFCP_CodecPort all; |
| 66 | |
Neels Hofmeyr | 75d905b | 2023-04-27 00:30:25 +0200 | [diff] [blame] | 67 | import from TCCConversion_Functions all; |
Neels Hofmeyr | 7a48df1 | 2023-04-20 20:43:43 +0200 | [diff] [blame] | 68 | import from MobileL3_Types all; |
Neels Hofmeyr | 7d0e680 | 2023-04-20 20:43:55 +0200 | [diff] [blame] | 69 | import from MobileL3_CommonIE_Types all; |
| 70 | import from MobileL3_GMM_SM_Types all; |
Neels Hofmeyr | 7a48df1 | 2023-04-20 20:43:43 +0200 | [diff] [blame] | 71 | import from L3_Templates all; |
Neels Hofmeyr | 7d0e680 | 2023-04-20 20:43:55 +0200 | [diff] [blame] | 72 | import from L3_Common all; |
Neels Hofmeyr | 7a48df1 | 2023-04-20 20:43:43 +0200 | [diff] [blame] | 73 | |
Neels Hofmeyr | b1bf16d | 2023-06-27 02:10:04 +0200 | [diff] [blame] | 74 | import from SCCPasp_Types all; |
| 75 | |
Neels Hofmeyr | 7a48df1 | 2023-04-20 20:43:43 +0200 | [diff] [blame] | 76 | const integer NUM_MSC := 4; |
| 77 | const integer NUM_SGSN := 4; |
| 78 | |
| 79 | const integer FIRST_MSC_IDX := 0; |
| 80 | const integer FIRST_SGSN_IDX := NUM_MSC; |
Neels Hofmeyr | 75d905b | 2023-04-27 00:30:25 +0200 | [diff] [blame] | 81 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 82 | modulepar { |
| 83 | /* IP address at which the HNodeB can be reached */ |
| 84 | charstring mp_hnodeb_ip := "127.0.0.1"; |
| 85 | integer mp_hnodeb_port := -1; |
| 86 | |
| 87 | /* IP address at which the test binds */ |
| 88 | charstring mp_hnbgw_ip := "127.0.0.1"; |
| 89 | integer mp_hnbgw_iuh_port := 29169; |
Neels Hofmeyr | ffcb889 | 2023-06-27 01:09:57 +0200 | [diff] [blame] | 90 | integer mp_hnbgw_ctrl_port := 4262; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 91 | |
| 92 | charstring mp_mgw_ip := "127.0.0.1"; |
| 93 | integer mp_mgw_port := 2427; |
| 94 | |
Neels Hofmeyr | 7a48df1 | 2023-04-20 20:43:43 +0200 | [diff] [blame] | 95 | RAN_Configurations mp_cn_cfg := { |
| 96 | /* MSCs (NUM_MSC entries) */ |
| 97 | { |
| 98 | transport := RANAP_TRANSPORT_IuCS, |
| 99 | sccp_service_type := "mtp3_itu", |
| 100 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 101 | own_pc := 188, /* 0.23.4 first MSC emulation */ |
| 102 | own_ssn := 142, |
| 103 | peer_pc := 189, /* 0.23.5 osmo-hnbgw */ |
| 104 | peer_ssn := 142, |
| 105 | sio := '83'O, |
| 106 | rctx := 1 |
| 107 | }, |
| 108 | { |
| 109 | transport := RANAP_TRANSPORT_IuCS, |
| 110 | sccp_service_type := "mtp3_itu", |
| 111 | sctp_addr := { 23907, "127.0.0.1", 2905, "127.0.0.1" }, |
| 112 | own_pc := 2, /* 0.0.2 second MSC emulation */ |
| 113 | own_ssn := 142, |
| 114 | peer_pc := 189, /* 0.23.5 osmo-hnbgw */ |
| 115 | peer_ssn := 142, |
| 116 | sio := '83'O, |
| 117 | rctx := 3 |
| 118 | }, |
| 119 | { |
| 120 | transport := RANAP_TRANSPORT_IuCS, |
| 121 | sccp_service_type := "mtp3_itu", |
| 122 | sctp_addr := { 23909, "127.0.0.1", 2905, "127.0.0.1" }, |
| 123 | own_pc := 3, /* 0.0.3 third MSC emulation */ |
| 124 | own_ssn := 142, |
| 125 | peer_pc := 189, /* 0.23.5 osmo-hnbgw */ |
| 126 | peer_ssn := 142, |
| 127 | sio := '83'O, |
| 128 | rctx := 5 |
| 129 | }, |
| 130 | { |
| 131 | transport := RANAP_TRANSPORT_IuCS, |
| 132 | sccp_service_type := "mtp3_itu", |
| 133 | sctp_addr := { 23911, "127.0.0.1", 2905, "127.0.0.1" }, |
| 134 | own_pc := 4, /* 0.0.4 fourth MSC emulation */ |
| 135 | own_ssn := 142, |
| 136 | peer_pc := 189, /* 0.23.5 osmo-hnbgw */ |
| 137 | peer_ssn := 142, |
| 138 | sio := '83'O, |
| 139 | rctx := 7 |
| 140 | }, |
| 141 | |
| 142 | /* SGSNs (NUM_SGSN entries) */ |
| 143 | { |
| 144 | transport := RANAP_TRANSPORT_IuCS, |
| 145 | sccp_service_type := "mtp3_itu", |
| 146 | sctp_addr := { /* local */ 23906, "127.0.0.1", /* remote */ 2905, "127.0.0.1" }, |
| 147 | own_pc := 185, /* 0.23.1 first SGSN emulation */ |
| 148 | own_ssn := 142, |
| 149 | peer_pc := 189, /* 2237, 1.23.5 osmo-hnbgw */ |
| 150 | peer_ssn := 142, |
| 151 | sio := '83'O, |
| 152 | rctx := 2 |
| 153 | }, |
| 154 | { |
| 155 | transport := RANAP_TRANSPORT_IuCS, |
| 156 | sccp_service_type := "mtp3_itu", |
| 157 | sctp_addr := { /* local */ 23908, "127.0.0.1", /* remote */ 2905, "127.0.0.1" }, |
| 158 | own_pc := 10, /* 0.1.2 second SGSN emulation */ |
| 159 | own_ssn := 142, |
| 160 | peer_pc := 189, /* 2237, 1.23.5 osmo-hnbgw */ |
| 161 | peer_ssn := 142, |
| 162 | sio := '83'O, |
| 163 | rctx := 4 |
| 164 | }, |
| 165 | { |
| 166 | transport := RANAP_TRANSPORT_IuCS, |
| 167 | sccp_service_type := "mtp3_itu", |
| 168 | sctp_addr := { /* local */ 23910, "127.0.0.1", /* remote */ 2905, "127.0.0.1" }, |
| 169 | own_pc := 11, /* 0.1.3 third SGSN emulation */ |
| 170 | own_ssn := 142, |
| 171 | peer_pc := 189, /* 2237, 1.23.5 osmo-hnbgw */ |
| 172 | peer_ssn := 142, |
| 173 | sio := '83'O, |
| 174 | rctx := 6 |
| 175 | }, |
| 176 | { |
| 177 | transport := RANAP_TRANSPORT_IuCS, |
| 178 | sccp_service_type := "mtp3_itu", |
| 179 | sctp_addr := { /* local */ 23912, "127.0.0.1", /* remote */ 2905, "127.0.0.1" }, |
| 180 | own_pc := 12, /* 0.1.4 fourth SGSN emulation */ |
| 181 | own_ssn := 142, |
| 182 | peer_pc := 189, /* 2237, 1.23.5 osmo-hnbgw */ |
| 183 | peer_ssn := 142, |
| 184 | sio := '83'O, |
| 185 | rctx := 8 |
| 186 | } |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 187 | }; |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 188 | |
Neels Hofmeyr | bacb74f | 2022-08-29 16:24:12 +0200 | [diff] [blame] | 189 | boolean mp_enable_pfcp_tests := false; |
| 190 | |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 191 | /* IP address at which we listen for PFCP to emulate a UPF in ttcn3 */ |
| 192 | charstring mp_pfcp_ip_local := "127.0.0.1"; |
| 193 | |
| 194 | /* IP address from which the SUT (osmo-hnbgw) sends PFCP requests, and to which the ttcn3 UPF emulation sends |
| 195 | * PFCP responses. */ |
| 196 | charstring mp_pfcp_ip_remote := "127.0.0.2"; |
Pau Espin Pedrol | 6c87ad9 | 2023-07-18 11:24:25 +0200 | [diff] [blame] | 197 | |
| 198 | boolean mp_validate_talloc_asn1 := true; |
Pau Espin Pedrol | ee4ce86 | 2023-11-02 12:23:25 +0100 | [diff] [blame] | 199 | |
| 200 | /* The X31 timer configured at osmo-hnbgw (seconds). This provided an idea on |
| 201 | * minimum time the test must wait to consider this timer triggered */ |
| 202 | integer mp_hnbgw_timer_x31 := 5; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | function MSC_UnitdataCallback(RANAP_PDU ranap) runs on RAN_Emulation_CT return template RANAP_PDU { |
| 206 | // TODO: Actually implement unitdata handling |
Neels Hofmeyr | cf6dc49 | 2023-06-27 00:51:08 +0200 | [diff] [blame] | 207 | return omit; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | const RanOps MSC_RanOps := { |
| 211 | ranap_create_cb := refers(RAN_Emulation.RanapExpectedCreateCallback), |
| 212 | ranap_unitdata_cb := refers(MSC_UnitdataCallback), |
| 213 | ps_domain := false, |
| 214 | decode_dtap := false, |
| 215 | role_ms := false, |
| 216 | protocol := RAN_PROTOCOL_RANAP, |
| 217 | transport := RANAP_TRANSPORT_IuCS, |
| 218 | use_osmux := false, |
Eric Wild | 6e511ce | 2022-04-02 21:35:56 +0200 | [diff] [blame] | 219 | bssap_reset_retries := 1, |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 220 | sccp_addr_local := omit, |
| 221 | sccp_addr_peer := omit |
| 222 | } |
| 223 | |
Pau Espin Pedrol | 264679f | 2023-11-29 15:52:00 +0100 | [diff] [blame] | 224 | type record MgwResponse { |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 225 | integer resp, |
| 226 | HostName mgw_rtp_ip, |
Pau Espin Pedrol | 0c35a63 | 2023-11-29 16:00:35 +0100 | [diff] [blame] | 227 | /* if set, used after first received MDCX: */ |
| 228 | HostName mgw_rtp_ip_mdcx optional, |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 229 | PortNumber mgw_rtp_port, |
| 230 | MgcpConnectionId mgcp_connection_id |
| 231 | } |
| 232 | type record MgcpParameters { |
| 233 | integer got_crcx_count, |
| 234 | integer got_dlcx_count, |
| 235 | MgcpCallId mgcp_call_id optional, |
| 236 | MgcpEndpoint mgcp_ep, |
Pau Espin Pedrol | 264679f | 2023-11-29 15:52:00 +0100 | [diff] [blame] | 237 | MgwResponse mgw_conn_ran, |
| 238 | MgwResponse mgw_conn_cn, |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 239 | uint7_t rtp_payload_type, |
| 240 | charstring rtp_sdp_format, |
| 241 | HostName hnb_rtp_ip, |
| 242 | PortNumber hnb_rtp_port, |
| 243 | HostName cn_rtp_ip, |
| 244 | PortNumber cn_rtp_port, |
| 245 | boolean use_osmux, |
| 246 | integer got_osmux_count |
| 247 | } |
| 248 | |
| 249 | template (value) MgcpParameters t_MgcpParams := { |
| 250 | got_crcx_count := 0, |
| 251 | got_dlcx_count := 0, |
| 252 | mgcp_call_id := omit, |
| 253 | mgcp_ep := "rtpbridge/1@mgw", |
Pau Espin Pedrol | b85ac2f | 2023-11-29 15:48:57 +0100 | [diff] [blame] | 254 | mgw_conn_ran := { |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 255 | resp := 1, |
| 256 | mgw_rtp_ip := "127.1.2.1", |
Pau Espin Pedrol | 0c35a63 | 2023-11-29 16:00:35 +0100 | [diff] [blame] | 257 | mgw_rtp_ip_mdcx := omit, |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 258 | mgw_rtp_port := 10000, |
| 259 | mgcp_connection_id := '11111'H |
| 260 | }, |
Pau Espin Pedrol | b85ac2f | 2023-11-29 15:48:57 +0100 | [diff] [blame] | 261 | mgw_conn_cn := { |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 262 | resp := 1, |
| 263 | mgw_rtp_ip := "127.1.2.2", |
Pau Espin Pedrol | 0c35a63 | 2023-11-29 16:00:35 +0100 | [diff] [blame] | 264 | mgw_rtp_ip_mdcx := omit, |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 265 | mgw_rtp_port := 20000, |
| 266 | mgcp_connection_id := '22222'H |
| 267 | }, |
Philipp Maier | 6c5ba075 | 2023-07-04 16:53:40 +0200 | [diff] [blame] | 268 | rtp_payload_type := 112, |
| 269 | rtp_sdp_format := "VND.3GPP.IUFP", |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 270 | hnb_rtp_ip := "127.1.1.1", |
| 271 | hnb_rtp_port := 10001, |
| 272 | cn_rtp_ip := "127.1.3.1", |
| 273 | cn_rtp_port := 20001, |
| 274 | use_osmux := false, |
| 275 | got_osmux_count := 0 |
| 276 | } |
| 277 | |
| 278 | type record TestHdlrParams { |
| 279 | integer hnb_idx, |
Neels Hofmeyr | 7a48df1 | 2023-04-20 20:43:43 +0200 | [diff] [blame] | 280 | /* cn_idx indicates which CN link from g_cn[] to connect to the test component. |
| 281 | * See also f_cn_idx(). */ |
| 282 | integer cn_idx, |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 283 | hexstring imsi, |
| 284 | boolean ps_domain, |
| 285 | MgcpParameters mgcp_pars optional, |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 286 | HnbConfig hnb optional, |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 287 | boolean expect_separate_sccp_cr, |
| 288 | integer tx_sccp_cr_data_len, |
Neels Hofmeyr | 7d0e680 | 2023-04-20 20:43:55 +0200 | [diff] [blame] | 289 | charstring pfcp_local_addr, |
Neels Hofmeyr | b1bf16d | 2023-06-27 02:10:04 +0200 | [diff] [blame] | 290 | octetstring nas_pdu optional, |
| 291 | /* local and remote SCCP addresses, used in TC_mscpool_paging_* */ |
| 292 | SCCP_PAR_Address sccp_addr_msc optional, |
| 293 | SCCP_PAR_Address sccp_addr_hnbgw optional |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | /* We extend: |
| 297 | * RUA_ConnHdlr (for the Iuh side, emulating the HNB) |
| 298 | * RAN_ConnHdlr (for the Iu side, emulating the MSC) |
| 299 | * MGCP_ConnHdlr (for the MGCP side, emulating the MGW) |
| 300 | */ |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 301 | type component ConnHdlr extends RAN_ConnHdlr, MGCP_ConnHdlr, RUA_ConnHdlr, PFCP_ConnHdlr { |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 302 | var integer g_sccp_conn_id; |
| 303 | var TestHdlrParams g_pars; |
| 304 | timer g_Tguard; |
Neels Hofmeyr | 72a8d62 | 2023-01-26 13:47:01 +0100 | [diff] [blame] | 305 | |
| 306 | port TELNETasp_PT HNBGWVTY; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 307 | } |
| 308 | |
| 309 | |
| 310 | const MGCPOps MSC_MGCPOps := { |
| 311 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 312 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 313 | } |
| 314 | |
| 315 | function f_create_ranap_exp(octetstring l3_enc) runs on ConnHdlr { |
| 316 | BSSAP_PROC.call(RAN_register:{l3_enc, self}) { |
| 317 | [] BSSAP_PROC.getreply(RAN_register:{?, ?}) {}; |
| 318 | } |
| 319 | } |
| 320 | |
| 321 | |
Daniel Willmann | c79679a | 2022-08-23 17:48:39 +0200 | [diff] [blame] | 322 | const integer NUM_HNB := 2; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 323 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 324 | type record HnbConfig { |
| 325 | LocationAreaIdentification lai, |
| 326 | integer sac |
| 327 | } |
| 328 | |
| 329 | type component test_CT extends CTRL_Adapter_CT { |
| 330 | var boolean g_initialized := false; |
| 331 | |
| 332 | /********************* Iu side */ |
Neels Hofmeyr | 7a48df1 | 2023-04-20 20:43:43 +0200 | [diff] [blame] | 333 | var RAN_Adapter g_cn[NUM_MSC + NUM_SGSN]; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 334 | |
| 335 | /********************* Iuh side */ |
| 336 | var HnbConfig g_hnb_cfg[NUM_HNB]; |
| 337 | var Iuh_Emulation_CT vc_Iuh[NUM_HNB]; |
| 338 | var RUA_Emulation_CT vc_RUA[NUM_HNB]; |
| 339 | port HNBAP_PT HNBAP[NUM_HNB]; |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 340 | /* Number of HNBs to be used/started by the test */ |
| 341 | var integer g_num_hnbs := NUM_HNB; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 342 | |
| 343 | var MGCP_Emulation_CT vc_MGCP; |
| 344 | port TELNETasp_PT HNBGWVTY; |
| 345 | /* global test case guard timer (actual timeout value is set in f_init()) */ |
| 346 | timer T_guard := 30.0; |
Neels Hofmeyr | 7d0e680 | 2023-04-20 20:43:55 +0200 | [diff] [blame] | 347 | |
| 348 | /* The cnlink type 'msc' or 'sgsn', to be used in CTRL commands to obtain counters */ |
| 349 | var charstring g_ctr_cn_node_name; |
| 350 | /* Counter state */ |
| 351 | var CounterNameValsList g_ctr_cn; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 352 | } |
| 353 | |
| 354 | /* global altstep for global guard timer; */ |
| 355 | altstep as_Tguard() runs on test_CT { |
| 356 | [] T_guard.timeout { |
| 357 | setverdict(fail, "Timeout of T_guard"); |
| 358 | mtc.stop; |
| 359 | } |
| 360 | } |
| 361 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 362 | function f_init_vty(charstring id := "foo") runs on test_CT { |
| 363 | if (HNBGWVTY.checkstate("Mapped")) { |
| 364 | /* skip initialization if already executed once */ |
| 365 | return; |
| 366 | } |
| 367 | map(self:HNBGWVTY, system:HNBGWVTY); |
| 368 | f_vty_set_prompts(HNBGWVTY); |
| 369 | f_vty_transceive(HNBGWVTY, "enable"); |
| 370 | } |
| 371 | |
| 372 | function f_init_mgcp(charstring id) runs on test_CT { |
| 373 | id := id & "-MGCP"; |
| 374 | var MGCPOps ops := { |
| 375 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 376 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 377 | } |
| 378 | var MGCP_conn_parameters pars := { |
| 379 | callagent_ip := mp_hnbgw_ip, |
| 380 | callagent_udp_port := -1, |
| 381 | mgw_ip := mp_mgw_ip, |
| 382 | mgw_udp_port := mp_mgw_port, |
| 383 | multi_conn_mode := false |
| 384 | } |
| 385 | |
| 386 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 387 | map(vc_MGCP:MGCP, system:MGCP_CODEC_PT); |
| 388 | vc_MGCP.start(MGCP_Emulation.main(ops, pars, id)); |
| 389 | } |
| 390 | |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 391 | function f_init_pfcp(charstring id) runs on ConnHdlr { |
| 392 | id := id & "-PFCP"; |
| 393 | |
| 394 | var PFCP_Emulation_Cfg pfcp_cfg := { |
| 395 | pfcp_bind_ip := mp_pfcp_ip_local, |
| 396 | pfcp_bind_port := PFCP_PORT, |
| 397 | pfcp_remote_ip := mp_pfcp_ip_remote, |
| 398 | pfcp_remote_port := PFCP_PORT, |
| 399 | role := UPF |
| 400 | }; |
| 401 | |
| 402 | vc_PFCP := PFCP_Emulation_CT.create(id) alive; |
| 403 | connect(self:PFCP, vc_PFCP:CLIENT); |
| 404 | connect(self:PFCP_PROC, vc_PFCP:CLIENT_PROC); |
| 405 | vc_PFCP.start(PFCP_Emulation.main(pfcp_cfg)); |
| 406 | } |
| 407 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 408 | function f_init_hnodeb(charstring id, integer hnb_idx, RuaOps rua_ops) runs on test_CT { |
| 409 | id := id & "-Iuh" & int2str(hnb_idx); |
| 410 | |
| 411 | /* Iuh lower layer (RUA/HNBAP demux) */ |
| 412 | var Iuh_conn_parameters iuh_pars; |
| 413 | iuh_pars.remote_ip := mp_hnbgw_ip; |
| 414 | iuh_pars.remote_sctp_port := mp_hnbgw_iuh_port; |
| 415 | iuh_pars.local_ip := mp_hnodeb_ip; |
| 416 | iuh_pars.local_sctp_port := mp_hnodeb_port + hnb_idx; |
| 417 | vc_Iuh[hnb_idx] := Iuh_Emulation_CT.create(id); |
| 418 | connect(self:HNBAP[hnb_idx], vc_Iuh[hnb_idx]:HNBAP); |
| 419 | |
| 420 | vc_RUA[hnb_idx] := RUA_Emulation_CT.create(id & "-RUA"); |
| 421 | connect(vc_RUA[hnb_idx]:RUA, vc_Iuh[hnb_idx]:RUA); |
| 422 | |
| 423 | /* Start Iuh side components */ |
| 424 | vc_Iuh[hnb_idx].start(Iuh_Emulation.main(iuh_pars, id)); |
| 425 | vc_RUA[hnb_idx].start(RUA_Emulation.main(rua_ops, id & "-RUA")); |
| 426 | } |
| 427 | |
Neels Hofmeyr | 3d5a0da | 2023-06-27 00:57:46 +0200 | [diff] [blame] | 428 | private type record of boolean BooleanList; |
| 429 | |
| 430 | private function f_vty_cnlink_allow_attach(TELNETasp_PT pt, boolean ps_domain, BooleanList allow_attach_list) |
| 431 | { |
| 432 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 433 | |
| 434 | var charstring msc_sgsn; |
| 435 | if (ps_domain) { |
| 436 | msc_sgsn := "sgsn"; |
| 437 | } else { |
| 438 | msc_sgsn := "msc"; |
| 439 | } |
| 440 | |
| 441 | f_vty_enter_config(pt); |
| 442 | for (var integer cn_nr := 0; cn_nr < sizeof(allow_attach_list); cn_nr := cn_nr+1) { |
| 443 | if (f_strstr(config, "\n" & msc_sgsn & " " & int2str(cn_nr) & "\n") < 0) { |
| 444 | /* There is no 'msc N' for this cn_nr in the running config, so don't create an empty cn by |
| 445 | * stepping into that config node. */ |
| 446 | log(msc_sgsn, cn_nr, " is not configured, skipping"); |
| 447 | continue; |
| 448 | } |
| 449 | f_vty_transceive(pt, msc_sgsn & " " & int2str(cn_nr)); |
| 450 | |
| 451 | if (allow_attach_list[cn_nr]) { |
| 452 | /* strict := false: ignore if osmo-hnbgw does not support this config option (latest build) */ |
| 453 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 454 | } else { |
| 455 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 456 | } |
| 457 | f_vty_transceive(pt, "exit"); |
| 458 | } |
| 459 | f_vty_transceive(pt, "exit"); |
| 460 | } |
| 461 | |
| 462 | /* Start RAN adapter for CN link N. |
| 463 | * e.g. link for 'msc 0' = (ps_domain := false, cn_nr := 0) |
| 464 | * link for 'sgsn 3' = (ps_domain := true, cn_nr := 3) |
| 465 | */ |
| 466 | private function f_cn_nr_init(boolean ps_domain, integer cn_nr) runs on test_CT { |
| 467 | var RanOps ranops := MSC_RanOps; |
| 468 | ranops.ps_domain := ps_domain; |
| 469 | var integer cn_idx := f_cn_idx(ps_domain, cn_nr); |
| 470 | var charstring msc_sgsn := "msc"; |
| 471 | if (ps_domain) { |
| 472 | msc_sgsn := "sgsn"; |
| 473 | } |
| 474 | f_ran_adapter_init(g_cn[cn_idx], mp_cn_cfg[cn_idx], "HNBGW_Test." & msc_sgsn & int2str(cn_nr), ranops); |
| 475 | f_ran_adapter_start(g_cn[cn_idx]); |
| 476 | } |
| 477 | |
| 478 | private function f_cn_idx_disconnect(integer cn_idx) runs on test_CT { |
| 479 | f_ran_adapter_cleanup(g_cn[cn_idx]); |
| 480 | } |
| 481 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 482 | /* global initialization function */ |
Neels Hofmeyr | 333ea39 | 2023-06-27 00:58:05 +0200 | [diff] [blame] | 483 | function f_init(charstring id := "HNBGW", float guard_timeout := 30.0, integer nr_msc := 1, integer nr_sgsn := 1, |
| 484 | boolean start_hnb := true) runs on test_CT { |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 485 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 486 | T_guard.start(guard_timeout); |
| 487 | activate(as_Tguard()); |
| 488 | |
| 489 | /* RUA/RANAP emulation on top of lower-layer Iuh */ |
| 490 | var RuaOps rua_ops := { |
| 491 | create_cb := refers(IuhRanapCreateCallback), |
| 492 | unitdata_cb := refers(IuhRanapUnitdataCallback) |
| 493 | }; |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 494 | for (var integer i := 0; i < g_num_hnbs; i := i+1) { |
Daniel Willmann | c79679a | 2022-08-23 17:48:39 +0200 | [diff] [blame] | 495 | g_hnb_cfg[i] := { |
| 496 | lai := { |
Neels Hofmeyr | 497216f | 2023-06-27 00:59:26 +0200 | [diff] [blame] | 497 | mcc_mnc := '00F110'H, |
Daniel Willmann | c79679a | 2022-08-23 17:48:39 +0200 | [diff] [blame] | 498 | lac := 2342 + i |
| 499 | }, |
| 500 | sac := 55 |
| 501 | }; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 502 | f_init_hnodeb(testcasename(), i, rua_ops); |
| 503 | } |
| 504 | |
Neels Hofmeyr | 3d5a0da | 2023-06-27 00:57:46 +0200 | [diff] [blame] | 505 | f_init_vty("VirtHNBGW"); |
Neels Hofmeyr | ffcb889 | 2023-06-27 01:09:57 +0200 | [diff] [blame] | 506 | f_ipa_ctrl_start_client(mp_hnbgw_ip, mp_hnbgw_ctrl_port); |
| 507 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 508 | /* MSC emulation */ |
Neels Hofmeyr | 3d5a0da | 2023-06-27 00:57:46 +0200 | [diff] [blame] | 509 | |
| 510 | /* Make sure each MSC's internal state is "DISCONNECTED" at first */ |
| 511 | for (var integer i := 0; i < NUM_MSC; i := i + 1) { |
| 512 | f_vty_transceive(HNBGWVTY, "msc " & int2str(i) & " ranap reset", strict := false); |
| 513 | } |
| 514 | |
| 515 | var BooleanList allow_attach := { false, false, false, false }; |
Neels Hofmeyr | 7a48df1 | 2023-04-20 20:43:43 +0200 | [diff] [blame] | 516 | for (var integer i := 0; i < nr_msc; i := i + 1) { |
| 517 | var integer cn_idx := FIRST_MSC_IDX + i; |
Neels Hofmeyr | 3d5a0da | 2023-06-27 00:57:46 +0200 | [diff] [blame] | 518 | allow_attach[i] := true; |
| 519 | f_cn_nr_init(ps_domain := false, cn_nr := i); |
Neels Hofmeyr | 7a48df1 | 2023-04-20 20:43:43 +0200 | [diff] [blame] | 520 | } |
Neels Hofmeyr | 3d5a0da | 2023-06-27 00:57:46 +0200 | [diff] [blame] | 521 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 522 | f_vty_cnlink_allow_attach(HNBGWVTY, false, allow_attach); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 523 | |
| 524 | /* SGSN emulation */ |
Neels Hofmeyr | 3d5a0da | 2023-06-27 00:57:46 +0200 | [diff] [blame] | 525 | |
| 526 | /* Make sure each SGSN's internal state is "DISCONNECTED" at first */ |
| 527 | for (var integer i := 0; i < NUM_SGSN; i := i + 1) { |
| 528 | f_vty_transceive(HNBGWVTY, "sgsn " & int2str(i) & " ranap reset", strict := false); |
Neels Hofmeyr | 7a48df1 | 2023-04-20 20:43:43 +0200 | [diff] [blame] | 529 | } |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 530 | |
Neels Hofmeyr | 3d5a0da | 2023-06-27 00:57:46 +0200 | [diff] [blame] | 531 | allow_attach := { false, false, false, false }; |
| 532 | for (var integer i := 0; i < nr_sgsn; i := i + 1) { |
| 533 | var integer cn_idx := FIRST_SGSN_IDX + i; |
| 534 | allow_attach[i] := true; |
| 535 | f_cn_nr_init(ps_domain := true, cn_nr := i); |
| 536 | } |
| 537 | f_vty_cnlink_allow_attach(HNBGWVTY, true, allow_attach); |
| 538 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 539 | f_init_mgcp(id); |
Neels Hofmeyr | 333ea39 | 2023-06-27 00:58:05 +0200 | [diff] [blame] | 540 | |
| 541 | if (start_hnb) { |
| 542 | f_start_hnbs(); |
| 543 | } |
Neels Hofmeyr | 467eb7e | 2023-08-10 03:38:07 +0200 | [diff] [blame] | 544 | |
| 545 | /* Sometimes, the RUA InitialUE-Message from a test happens too quickly, before the RANAP RESET from |
| 546 | * RAN_Emulation is through, after above f_cn_nr_init(). In the pcap it seems to be a matter of 50 ms. Give some |
| 547 | * grace. */ |
| 548 | f_sleep(1.0); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 549 | } |
| 550 | |
| 551 | friend function f_shutdown_helper() runs on test_CT { |
Pau Espin Pedrol | 6c87ad9 | 2023-07-18 11:24:25 +0200 | [diff] [blame] | 552 | if (mp_validate_talloc_asn1) { |
| 553 | f_verify_talloc_bytes(HNBGWVTY, {"asn1_context"}, 1); |
| 554 | } |
Neels Hofmeyr | 75d905b | 2023-04-27 00:30:25 +0200 | [diff] [blame] | 555 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 556 | all component.stop; |
| 557 | setverdict(pass); |
| 558 | mtc.stop; |
| 559 | } |
| 560 | |
| 561 | /* helper function to start all of the simulated hNodeBs */ |
| 562 | function f_start_hnbs() runs on test_CT { |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 563 | for (var integer i:= 0; i < g_num_hnbs; i := i+1) { |
Harald Welte | d71d596 | 2024-03-27 19:17:19 +0100 | [diff] [blame] | 564 | f_hnbap_hnb_register(i, i); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 565 | } |
| 566 | } |
| 567 | |
| 568 | /*********************************************************************** |
| 569 | * code running in test_CT, preparing start of per-UE ConnHdlr |
| 570 | ***********************************************************************/ |
| 571 | |
| 572 | /* inbound RUA connection establishment on Iuh side */ |
| 573 | function IuhRanapCreateCallback(ContextId context_id, RUA_IEs.CN_DomainIndicator domain, charstring id) |
| 574 | runs on RUA_Emulation_CT return RUA_ConnHdlr { |
| 575 | log("CreateCallback"); |
| 576 | return null; |
| 577 | } |
| 578 | |
| 579 | /* inbound RUA connectionless data on Iuh side */ |
| 580 | function IuhRanapUnitdataCallback(RANAP_PDU ranap) |
| 581 | runs on RUA_Emulation_CT return template RANAP_PDU { |
| 582 | log("UnitdataCallback"); |
| 583 | return omit; |
| 584 | } |
| 585 | |
| 586 | private function f_start_handler_create(TestHdlrParams pars) runs on test_CT return ConnHdlr { |
| 587 | var ConnHdlr vc_conn; |
| 588 | var charstring id := testcasename() & int2str(pars.hnb_idx); |
| 589 | |
| 590 | vc_conn := ConnHdlr.create(id); |
| 591 | |
| 592 | /* Iuh RUA part */ |
| 593 | connect(vc_conn:RUA, vc_RUA[pars.hnb_idx]:CLIENT); |
| 594 | |
Neels Hofmeyr | 7a48df1 | 2023-04-20 20:43:43 +0200 | [diff] [blame] | 595 | /* MSC or SGSN */ |
| 596 | connect(vc_conn:BSSAP, g_cn[pars.cn_idx].vc_RAN:CLIENT); |
| 597 | connect(vc_conn:BSSAP_PROC, g_cn[pars.cn_idx].vc_RAN:PROC); |
| 598 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 599 | /* MGCP part */ |
| 600 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
| 601 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
| 602 | |
| 603 | return vc_conn; |
| 604 | } |
| 605 | |
| 606 | private function f_start_handler_run(ConnHdlr vc_conn, void_fn fn, TestHdlrParams pars) runs on test_CT { |
| 607 | var charstring id := testcasename(); // & int2str(pars.ran_idx); |
| 608 | /* We cannot use vc_conn.start(f_init_handler(fn, id, pars)); as we cannot have |
| 609 | * a stand-alone 'derefers()' call, see https://www.eclipse.org/forums/index.php/t/1091364/ */ |
| 610 | pars.hnb := g_hnb_cfg[pars.hnb_idx]; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 611 | vc_conn.start(derefers(fn)(id, pars)); |
| 612 | } |
| 613 | |
| 614 | function f_start_handler_with_pars(void_fn fn, template (value) TestHdlrParams pars) |
| 615 | runs on test_CT return ConnHdlr { |
| 616 | var ConnHdlr vc_conn; |
| 617 | vc_conn := f_start_handler_create(valueof(pars)); |
| 618 | f_start_handler_run(vc_conn, fn, valueof(pars)); |
| 619 | return vc_conn; |
| 620 | } |
| 621 | |
| 622 | /*********************************************************************** |
| 623 | * code running inside per-UE ConnHdlr |
| 624 | ***********************************************************************/ |
| 625 | |
| 626 | type function void_fn(charstring id, TestHdlrParams pars) runs on ConnHdlr; |
| 627 | |
| 628 | function f_init_handler(TestHdlrParams pars, float t_guard := 20.0) runs on ConnHdlr { |
| 629 | /* make parameters available via component variable */ |
| 630 | g_pars := pars; |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 631 | |
| 632 | f_init_pfcp(testcasename()); |
| 633 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 634 | /* start guard timer and activate it as default */ |
| 635 | g_Tguard.start(t_guard); |
| 636 | activate(as_Tguard_ConnHdlr()); |
| 637 | |
Neels Hofmeyr | 72a8d62 | 2023-01-26 13:47:01 +0100 | [diff] [blame] | 638 | map(self:HNBGWVTY, system:HNBGWVTY); |
| 639 | f_vty_set_prompts(HNBGWVTY); |
| 640 | f_vty_transceive(HNBGWVTY, "enable"); |
| 641 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 642 | /* TODO: CTRL? */ |
Neels Hofmeyr | 5951722 | 2023-06-23 04:46:59 +0200 | [diff] [blame] | 643 | |
| 644 | f_sleep(1.0); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 645 | } |
| 646 | |
| 647 | /* global altstep for global guard timer; */ |
| 648 | private altstep as_Tguard_ConnHdlr() runs on ConnHdlr { |
| 649 | [] g_Tguard.timeout { |
| 650 | setverdict(fail, "Timeout of T_guard"); |
| 651 | mtc.stop; |
| 652 | } |
| 653 | } |
| 654 | |
Neels Hofmeyr | dc416c9 | 2023-03-09 02:47:50 +0100 | [diff] [blame] | 655 | private function f_bssap_expect(template (present) RANAP_PDU exp_rx) runs on ConnHdlr return RANAP_PDU |
| 656 | { |
| 657 | var RANAP_PDU rx; |
| 658 | timer T := 5.0; |
| 659 | T.start; |
| 660 | alt { |
| 661 | [] BSSAP.receive(exp_rx) -> value rx { |
| 662 | setverdict(pass); |
| 663 | } |
| 664 | [] BSSAP.receive(RANAP_PDU:?) { |
| 665 | setverdict(fail, "Got an unexpected RANAP message on BSSAP port, was waiting for ", exp_rx); |
| 666 | mtc.stop; |
| 667 | } |
| 668 | [] T.timeout { |
| 669 | setverdict(fail, "Timeout waiting for RANAP on BSSAP port: ", exp_rx); |
| 670 | mtc.stop; |
| 671 | } |
| 672 | } |
| 673 | T.stop; |
| 674 | return rx; |
| 675 | } |
| 676 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 677 | /* send RANAP on Iuh and expect it to show up on Iu */ |
| 678 | function f_iuh2iu(template (present) RANAP_PDU tx, template RANAP_PDU exp_rx := omit) |
| 679 | runs on ConnHdlr return RANAP_PDU { |
| 680 | var RANAP_PDU rx; |
| 681 | timer T := 5.0; |
| 682 | |
| 683 | if (istemplatekind(exp_rx, "omit")) { |
| 684 | exp_rx := tx; |
| 685 | } |
| 686 | |
| 687 | RUA.send(tx); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 688 | |
Neels Hofmeyr | dc416c9 | 2023-03-09 02:47:50 +0100 | [diff] [blame] | 689 | return f_bssap_expect(exp_rx); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 690 | } |
| 691 | |
| 692 | /* send RANAP on Iu and expect it to show up on Iuh */ |
| 693 | function f_iu2iuh(template (present) RANAP_PDU tx, template RANAP_PDU exp_rx := omit) |
| 694 | runs on ConnHdlr return RANAP_PDU { |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 695 | if (istemplatekind(exp_rx, "omit")) { |
| 696 | exp_rx := tx; |
| 697 | } |
| 698 | |
| 699 | BSSAP.send(tx); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 700 | |
Neels Hofmeyr | 735b656 | 2023-03-09 02:51:28 +0100 | [diff] [blame] | 701 | return f_rua_expect(exp_rx) |
| 702 | } |
| 703 | |
| 704 | /* expect to receive a specific RUA message on Iuh */ |
| 705 | private function f_rua_expect(template (present) RANAP_PDU exp_rx) runs on ConnHdlr return RANAP_PDU |
| 706 | { |
| 707 | var RANAP_PDU rx; |
| 708 | timer T := 5.0; |
| 709 | T.start; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 710 | alt { |
| 711 | [] RUA.receive(exp_rx) -> value rx { |
| 712 | setverdict(pass); |
| 713 | } |
Neels Hofmeyr | 735b656 | 2023-03-09 02:51:28 +0100 | [diff] [blame] | 714 | [] RUA.receive(RANAP_PDU:?) { |
| 715 | setverdict(fail, "Got an unexpected RUA message, was waiting for ", exp_rx); |
| 716 | mtc.stop; |
| 717 | } |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 718 | [] T.timeout { |
| 719 | setverdict(fail, "Timeout waiting for Iuh ", exp_rx); |
Neels Hofmeyr | 735b656 | 2023-03-09 02:51:28 +0100 | [diff] [blame] | 720 | mtc.stop; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 721 | } |
| 722 | } |
Neels Hofmeyr | 735b656 | 2023-03-09 02:51:28 +0100 | [diff] [blame] | 723 | T.stop; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 724 | return rx; |
| 725 | } |
| 726 | |
| 727 | /* send RANAP on Iuh and expect it to show up on Iu */ |
| 728 | function f_iuh2iu_connect(template (present) RANAP_PDU tx, template RANAP_PDU exp_rx := omit) |
| 729 | runs on ConnHdlr return RANAP_PDU { |
| 730 | var RANAP_PDU rx; |
| 731 | timer T := 5.0; |
| 732 | |
| 733 | if (istemplatekind(exp_rx, "omit")) { |
| 734 | exp_rx := tx; |
| 735 | } |
| 736 | |
| 737 | /* create an expect on the Iu side for the random NAS portion */ |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 738 | if (g_pars.expect_separate_sccp_cr) { |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 739 | f_ran_register_sccp_cr_without_payload(); |
| 740 | } else { |
| 741 | var template (omit) octetstring nas := f_ranap_extract_l3(valueof(tx)); |
| 742 | f_ran_register_exp(valueof(nas)); |
| 743 | } |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 744 | |
| 745 | /* send it via Iuh (creating a RUA connection) */ |
| 746 | RUA.send(RUA_Conn_Req:{g_pars.ps_domain, tx}); |
| 747 | |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 748 | if (g_pars.expect_separate_sccp_cr) { |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 749 | /* Acknowledge the empty SCCP CR. RAN_Emulation does the confirmation, no need to respond. */ |
| 750 | BSSAP.receive(tr_RANAP_Conn_Req()); |
| 751 | } |
| 752 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 753 | /* expect to receive it on the Iu side */ |
Neels Hofmeyr | dc416c9 | 2023-03-09 02:47:50 +0100 | [diff] [blame] | 754 | return f_bssap_expect(exp_rx); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 755 | } |
| 756 | |
Neels Hofmeyr | 99b7d40 | 2023-02-20 14:26:31 +0100 | [diff] [blame] | 757 | /* 3GPP TS 48.006 9.2 Connection release: |
| 758 | * |
| 759 | * The MSC sends a SCCP released message. This message shall not contain |
| 760 | * any user data field. |
| 761 | * |
| 762 | * So what we expect normally is: |
| 763 | * |
| 764 | * HNBGW MSC |
| 765 | * RUA --id-Disconnect-------> | ---Data-Form-1(!)---> | Iu-ReleaseComplete |
| 766 | * | <--Released---------- | (no data) |
| 767 | * |
| 768 | * This function tests osmo-hnbgw behavior if the CN fails to send a RLSD: |
| 769 | * after some timeout, osmo-hnbgw should send a RLSD to the CN. |
| 770 | */ |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 771 | function f_iuh2iu_disconnect(template (present) RANAP_PDU tx, RUA_IEs.Cause cause, |
| 772 | template RANAP_PDU exp_rx := omit) |
| 773 | runs on ConnHdlr return RANAP_PDU { |
| 774 | var RANAP_PDU rx |
Pau Espin Pedrol | ee4ce86 | 2023-11-02 12:23:25 +0100 | [diff] [blame] | 775 | timer T := int2float(mp_hnbgw_timer_x31) + 1.0; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 776 | |
| 777 | if (istemplatekind(exp_rx, "omit")) { |
| 778 | exp_rx := tx; |
| 779 | } |
| 780 | |
| 781 | /* send it via Iuh (creating a RUA connection) */ |
| 782 | RUA.send(RUA_Disc_Req:{tx, cause}); |
| 783 | |
| 784 | /* expect to receive it on the Iu side */ |
Neels Hofmeyr | dc416c9 | 2023-03-09 02:47:50 +0100 | [diff] [blame] | 785 | rx := f_bssap_expect(exp_rx); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 786 | |
| 787 | /* expect disconnect on the Iu side */ |
Neels Hofmeyr | dc416c9 | 2023-03-09 02:47:50 +0100 | [diff] [blame] | 788 | T.start; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 789 | alt { |
| 790 | [] BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_IND) { |
| 791 | setverdict(pass); |
| 792 | } |
| 793 | [] T.timeout { |
| 794 | setverdict(fail, "Timeout waiting for Iu disconnect"); |
| 795 | return rx; |
| 796 | } |
| 797 | |
| 798 | } |
| 799 | return rx; |
| 800 | } |
| 801 | |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 802 | private function f_build_initial_ue_with_nas(TestHdlrParams pars, octetstring nas) |
| 803 | return RANAP_PDU { |
Harald Welte | 3f216c5 | 2024-03-27 20:40:17 +0100 | [diff] [blame] | 804 | var RANAP_IEs.LAI lai := { |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 805 | pLMNidentity := hex2oct(pars.hnb.lai.mcc_mnc), |
| 806 | lAC := int2oct(pars.hnb.lai.lac, 2), |
| 807 | iE_Extensions := omit |
| 808 | }; |
Harald Welte | 3f216c5 | 2024-03-27 20:40:17 +0100 | [diff] [blame] | 809 | var RANAP_IEs.SAI sai := { |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 810 | pLMNidentity := lai.pLMNidentity, |
| 811 | lAC := lai.lAC, |
| 812 | sAC := int2oct(pars.hnb.sac, 2), |
| 813 | iE_Extensions := omit |
| 814 | } |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 815 | var IuSignallingConnectionIdentifier sigc_id := int2bit(f_rnd_int(1000), 24); |
| 816 | var GlobalRNC_ID grnc_id := { |
| 817 | pLMNidentity := lai.pLMNidentity, |
| 818 | rNC_ID := 2342 |
| 819 | } |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 820 | var template RANAP_PDU ret; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 821 | if (pars.ps_domain) { |
Harald Welte | 3f216c5 | 2024-03-27 20:40:17 +0100 | [diff] [blame] | 822 | var RANAP_IEs.RAC rac := '00'O; |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 823 | ret := ts_RANAP_initialUE_PS(lai, rac, sai, nas, sigc_id, grnc_id); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 824 | } else { |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 825 | ret := ts_RANAP_initialUE_CS(lai, sai, nas, sigc_id, grnc_id); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 826 | } |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 827 | return valueof(ret); |
| 828 | } |
| 829 | |
| 830 | /* build a RANAP InitialUE based on the TestHdlrParams */ |
| 831 | friend function f_build_initial_ue(TestHdlrParams pars) return RANAP_PDU { |
| 832 | |
| 833 | var octetstring nas; |
| 834 | |
| 835 | if (pars.tx_sccp_cr_data_len == 0) { |
| 836 | nas := f_rnd_octstring(10); |
| 837 | } else { |
| 838 | /* The test asks for an exact number of Optional Data bytes. */ |
| 839 | |
| 840 | /* First see what size the RANAP part of the payload data is, |
| 841 | * to adjust the NAS PDU size to the size requested by the test (pars.tx_sccp_cr_data_len). */ |
| 842 | var RANAP_PDU initial_ue := f_build_initial_ue_with_nas(pars, '00'O); |
| 843 | |
| 844 | var octetstring ranap_plus_one_byte_nas := enc_RANAP_PDU(initial_ue); |
| 845 | var integer ranap_length := lengthof(ranap_plus_one_byte_nas) - 1; |
| 846 | |
| 847 | log("ranap_plus_one_byte_nas = ", lengthof(ranap_plus_one_byte_nas), " bytes, ", initial_ue, " = ", |
| 848 | ranap_plus_one_byte_nas); |
| 849 | log("ranap_length = ", ranap_length); |
| 850 | |
| 851 | /* SCCP CR has a payload length limit of 130 bytes. To trigger this limit, the RANAP + NAS PDU has to be |
| 852 | * > 130 bytes. It doesn't need to be 131 bytes in the NAS PDU alone, but let's just make it definitely |
| 853 | * large enough. To test for this limit, pars.tx_sccp_cr_data_len asks for a specific amount of data len. */ |
| 854 | nas := f_rnd_octstring(pars.tx_sccp_cr_data_len - ranap_length); |
| 855 | } |
| 856 | |
| 857 | var RANAP_PDU ret := f_build_initial_ue_with_nas(pars, nas); |
| 858 | |
| 859 | if (pars.tx_sccp_cr_data_len != 0) { |
| 860 | for (var integer attempts := 0; attempts < 2; attempts := attempts + 1) { |
| 861 | var octetstring check_len := enc_RANAP_PDU(ret); |
| 862 | log("final RANAP PDU length = ", lengthof(check_len)); |
| 863 | if (lengthof(check_len) == pars.tx_sccp_cr_data_len) { |
| 864 | return ret; |
| 865 | } |
| 866 | nas := f_rnd_octstring(lengthof(nas) + (pars.tx_sccp_cr_data_len - lengthof(check_len))); |
| 867 | log("that was off, changed NAS length to ", lengthof(nas), " and trying again"); |
| 868 | ret := f_build_initial_ue_with_nas(pars, nas); |
| 869 | } |
| 870 | setverdict(fail, "Ended up with wrong Optional Data length"); |
| 871 | mtc.stop; |
| 872 | } |
| 873 | return ret; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 874 | } |
| 875 | |
| 876 | /* build a RANAP RAB AssignmentResponse based on the TestHdlrParams */ |
| 877 | friend function f_build_rab_ass_resp(TestHdlrParams pars) return RANAP_PDU { |
| 878 | var template RAB_SetupOrModifiedList rab_sml; |
| 879 | |
| 880 | rab_sml := ts_RAB_SMdL(t_RAB_id(23), f_ts_RAB_TLA("192.168.1.23"), t_RAB_binding_port(1234)); |
| 881 | |
| 882 | return valueof(ts_RANAP_RabAssResp(rab_sml)); |
| 883 | } |
| 884 | |
| 885 | |
| 886 | /*********************************************************************** |
| 887 | * HNBAP Testing |
| 888 | ***********************************************************************/ |
| 889 | |
| 890 | |
Harald Welte | d71d596 | 2024-03-27 19:17:19 +0100 | [diff] [blame] | 891 | function f_hnbap_hnb_register(integer hnb_idx := 0, integer cell_id := 0, boolean expect_reject := false) runs on test_CT |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 892 | { |
| 893 | timer T := 2.0; |
| 894 | |
Neels Hofmeyr | fffe79b | 2023-06-27 01:16:15 +0200 | [diff] [blame] | 895 | HNBAP[hnb_idx].send(ts_HNBAP_HNBRegisterRequest(char2oct("TTCN3-HNB-" & int2str(hnb_idx)), |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 896 | '00F110'O, |
Daniel Willmann | c79679a | 2022-08-23 17:48:39 +0200 | [diff] [blame] | 897 | int2bit(1 + cell_id, 28), |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 898 | int2oct(2, 2), |
| 899 | int2oct(3, 1), |
| 900 | int2oct(4, 2))); |
| 901 | |
| 902 | T.start; |
| 903 | alt { |
| 904 | [] HNBAP[hnb_idx].receive(tr_HNBAP_HNBRegisterAccept(?)) { |
Daniel Willmann | c79679a | 2022-08-23 17:48:39 +0200 | [diff] [blame] | 905 | if (expect_reject) { |
| 906 | setverdict(fail, "Rx HNB Register Accept while expecting reject"); |
| 907 | } else { |
| 908 | setverdict(pass); |
| 909 | } |
| 910 | } |
| 911 | [] HNBAP[hnb_idx].receive(tr_HNBAP_HNBRegisterReject(?)) { |
| 912 | if (expect_reject) { |
| 913 | setverdict(pass); |
| 914 | } else { |
| 915 | setverdict(fail, "Rx HNB Register Reject while expecting accept"); |
| 916 | } |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 917 | } |
| 918 | [] HNBAP[hnb_idx].receive(IUHEM_Event:?) { |
| 919 | repeat; |
| 920 | } |
| 921 | [] T.timeout { |
Daniel Willmann | c79679a | 2022-08-23 17:48:39 +0200 | [diff] [blame] | 922 | setverdict(fail, "Timeout waiting for HNB Register response"); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 923 | } |
| 924 | } |
| 925 | } |
| 926 | |
Harald Welte | af3e216 | 2024-03-27 21:54:20 +0100 | [diff] [blame^] | 927 | function f_hnbap_ue_register(integer hnb_idx := 0, template (present) UE_Identity ue_id, boolean expect_reject := false) runs on test_CT |
| 928 | { |
| 929 | timer T := 2.0; |
| 930 | |
| 931 | HNBAP[hnb_idx].send(ts_HNBAP_UERegisterRequest(ue_id)); |
| 932 | |
| 933 | T.start; |
| 934 | alt { |
| 935 | [] HNBAP[hnb_idx].receive(tr_HNBAP_UERegisterAccept(ue_id)) { |
| 936 | if (expect_reject) { |
| 937 | setverdict(fail, "Rx UE Register Accept while expecting reject"); |
| 938 | } else { |
| 939 | setverdict(pass); |
| 940 | } |
| 941 | } |
| 942 | [] HNBAP[hnb_idx].receive(tr_HNBAP_UERegisterReject(ue_id, ?)) { |
| 943 | if (expect_reject) { |
| 944 | setverdict(pass); |
| 945 | } else { |
| 946 | setverdict(fail, "Rx UE Register Reject while expecting accept"); |
| 947 | } |
| 948 | } |
| 949 | [] HNBAP[hnb_idx].receive(IUHEM_Event:?) { |
| 950 | repeat; |
| 951 | } |
| 952 | [] T.timeout { |
| 953 | setverdict(fail, "Timeout waiting for UE Register response"); |
| 954 | } |
| 955 | } |
| 956 | } |
| 957 | |
| 958 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 959 | testcase TC_hnb_register() runs on test_CT { |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 960 | g_num_hnbs := 1; |
Neels Hofmeyr | 333ea39 | 2023-06-27 00:58:05 +0200 | [diff] [blame] | 961 | f_init(start_hnb := false); |
Harald Welte | d71d596 | 2024-03-27 19:17:19 +0100 | [diff] [blame] | 962 | f_hnbap_hnb_register(0); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 963 | f_shutdown_helper(); |
| 964 | } |
| 965 | |
Pau Espin Pedrol | acf4f22 | 2022-09-27 14:33:40 +0200 | [diff] [blame] | 966 | /* Try to register the same HNB from 2 different concurrent connections. Second |
| 967 | * one should be rejected. */ |
Daniel Willmann | c79679a | 2022-08-23 17:48:39 +0200 | [diff] [blame] | 968 | testcase TC_hnb_register_duplicate() runs on test_CT { |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 969 | g_num_hnbs := 2; |
Neels Hofmeyr | 333ea39 | 2023-06-27 00:58:05 +0200 | [diff] [blame] | 970 | f_init(start_hnb := false); |
Harald Welte | d71d596 | 2024-03-27 19:17:19 +0100 | [diff] [blame] | 971 | f_hnbap_hnb_register(0); |
| 972 | f_hnbap_hnb_register(1, 0, expect_reject := true); |
Daniel Willmann | c79679a | 2022-08-23 17:48:39 +0200 | [diff] [blame] | 973 | f_verify_talloc_count(HNBGWVTY, {"struct hnb_context"}, expect_count := 1); |
| 974 | f_shutdown_helper(); |
| 975 | } |
| 976 | |
Pau Espin Pedrol | acf4f22 | 2022-09-27 14:33:40 +0200 | [diff] [blame] | 977 | /* Try to register the same HNB in the same connection already established, aka |
| 978 | * duplicate HNB Register Request. It should be accepted and new configuration |
| 979 | * applied. TS 25.469 8.2.4 */ |
| 980 | testcase TC_hnb_register_duplicate_reuse_sctp_assoc() runs on test_CT { |
| 981 | g_num_hnbs := 1; |
Neels Hofmeyr | 333ea39 | 2023-06-27 00:58:05 +0200 | [diff] [blame] | 982 | f_init(start_hnb := false); |
Harald Welte | d71d596 | 2024-03-27 19:17:19 +0100 | [diff] [blame] | 983 | f_hnbap_hnb_register(0); |
| 984 | f_hnbap_hnb_register(0); |
Pau Espin Pedrol | acf4f22 | 2022-09-27 14:33:40 +0200 | [diff] [blame] | 985 | f_verify_talloc_count(HNBGWVTY, {"struct hnb_context"}, expect_count := 1); |
| 986 | f_shutdown_helper(); |
| 987 | } |
| 988 | |
Pau Espin Pedrol | f0b9fa0 | 2022-09-12 13:31:07 +0200 | [diff] [blame] | 989 | /* Drop HNBAP conn (HNBAP DEREG) and reconnect it (HNBAP REG) using same SCTP association. |
| 990 | * Related: OS#5676, SYS#6113 */ |
| 991 | testcase TC_hnb_reregister_reuse_sctp_assoc() runs on test_CT { |
| 992 | g_num_hnbs := 1; |
Neels Hofmeyr | 333ea39 | 2023-06-27 00:58:05 +0200 | [diff] [blame] | 993 | f_init(start_hnb := false); |
Harald Welte | d71d596 | 2024-03-27 19:17:19 +0100 | [diff] [blame] | 994 | f_hnbap_hnb_register(0); |
Pau Espin Pedrol | f0b9fa0 | 2022-09-12 13:31:07 +0200 | [diff] [blame] | 995 | HNBAP[0].send(ts_HNBAP_HNBDe_Register(ts_HnbapCause(unspecified))); |
Harald Welte | d71d596 | 2024-03-27 19:17:19 +0100 | [diff] [blame] | 996 | f_hnbap_hnb_register(0); |
Pau Espin Pedrol | f0b9fa0 | 2022-09-12 13:31:07 +0200 | [diff] [blame] | 997 | f_verify_talloc_count(HNBGWVTY, {"struct hnb_context"}, expect_count := 1); |
| 998 | f_shutdown_helper(); |
| 999 | } |
| 1000 | |
Harald Welte | af3e216 | 2024-03-27 21:54:20 +0100 | [diff] [blame^] | 1001 | /* regular UE registration */ |
| 1002 | testcase TC_ue_register() runs on test_CT { |
| 1003 | var UE_Identity ue_id := { iMSI := imsi_hex2oct(f_gen_imsi(1)) }; |
| 1004 | g_num_hnbs := 1; |
| 1005 | f_init(start_hnb := true); |
| 1006 | f_hnbap_ue_register(0, ue_id); |
| 1007 | f_shutdown_helper(); |
| 1008 | } |
| 1009 | |
| 1010 | /* UE registration from unregistered HNB */ |
| 1011 | testcase TC_ue_register_before_hnb_register() runs on test_CT { |
| 1012 | var UE_Identity ue_id := { iMSI := imsi_hex2oct(f_gen_imsi(1)) }; |
| 1013 | g_num_hnbs := 1; |
| 1014 | f_init(start_hnb := false); |
| 1015 | f_hnbap_ue_register(0, ue_id, expect_reject := true); |
| 1016 | f_shutdown_helper(); |
| 1017 | } |
| 1018 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1019 | /*********************************************************************** |
| 1020 | * RUA / RANAP Testing |
| 1021 | ***********************************************************************/ |
| 1022 | |
Neels Hofmeyr | 7a48df1 | 2023-04-20 20:43:43 +0200 | [diff] [blame] | 1023 | /* Translate from {msc,sgsn}x{0..n} to the proper index to use in g_cn[]. |
| 1024 | * g_cn[] stores CN links, MSCs and SGSNs in the same array. |
| 1025 | * For example, for 'sgsn 23', use g_cn[ f_cn_idx(ps_domain := true, cn_nr := 23) ]. |
| 1026 | * |
| 1027 | * Note the naming: |
| 1028 | * cn_nr is the number used in the cfg file, as in 'msc 0'. |
| 1029 | * cn_idx is the array index in g_cn[]. |
| 1030 | */ |
| 1031 | private function f_cn_idx(boolean ps_domain, integer cn_nr := 0) return integer |
| 1032 | { |
| 1033 | if (ps_domain) { |
| 1034 | return FIRST_SGSN_IDX + cn_nr; |
| 1035 | } |
| 1036 | return FIRST_MSC_IDX + cn_nr; |
| 1037 | } |
| 1038 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1039 | private template (value) TestHdlrParams |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 1040 | t_pars(integer imsi_suffix, boolean ps_domain := false, integer hnb_idx := 0, |
Neels Hofmeyr | 7a48df1 | 2023-04-20 20:43:43 +0200 | [diff] [blame] | 1041 | boolean expect_separate_sccp_cr := false, integer tx_sccp_cr_data_len := 0, |
| 1042 | integer cn_nr := 0) := { |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1043 | hnb_idx := hnb_idx, |
Neels Hofmeyr | 7a48df1 | 2023-04-20 20:43:43 +0200 | [diff] [blame] | 1044 | cn_idx := f_cn_idx(ps_domain, cn_nr), |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1045 | imsi := f_gen_imsi(imsi_suffix), |
| 1046 | ps_domain := ps_domain, |
Pau Espin Pedrol | af74650 | 2023-11-29 16:18:28 +0100 | [diff] [blame] | 1047 | mgcp_pars := t_MgcpParams, |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 1048 | hnb := omit, /* filled in later */ |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 1049 | expect_separate_sccp_cr := expect_separate_sccp_cr, |
| 1050 | tx_sccp_cr_data_len := tx_sccp_cr_data_len, |
Neels Hofmeyr | 7d0e680 | 2023-04-20 20:43:55 +0200 | [diff] [blame] | 1051 | pfcp_local_addr := mp_pfcp_ip_local, |
Neels Hofmeyr | b1bf16d | 2023-06-27 02:10:04 +0200 | [diff] [blame] | 1052 | nas_pdu := omit, |
| 1053 | sccp_addr_msc := omit, |
| 1054 | sccp_addr_hnbgw := omit |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1055 | } |
| 1056 | |
| 1057 | /* Create an Iuh connection; send InitialUE; expect it to appear on new SCCP conenction */ |
| 1058 | friend function f_tc_initial_ue(charstring id, TestHdlrParams pars) runs on ConnHdlr { |
| 1059 | f_init_handler(pars); |
| 1060 | var RANAP_PDU tx := f_build_initial_ue(g_pars); |
| 1061 | f_iuh2iu_connect(tx); |
| 1062 | } |
| 1063 | testcase TC_ranap_cs_initial_ue() runs on test_CT { |
| 1064 | var ConnHdlr vc_conn; |
| 1065 | |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 1066 | g_num_hnbs := 1; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1067 | f_init(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1068 | |
| 1069 | vc_conn := f_start_handler_with_pars(refers(f_tc_initial_ue), t_pars(1)); |
| 1070 | vc_conn.done; |
Neels Hofmeyr | 3a9140e | 2023-06-23 04:50:39 +0200 | [diff] [blame] | 1071 | |
| 1072 | f_shutdown_helper(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1073 | } |
| 1074 | testcase TC_ranap_ps_initial_ue() runs on test_CT { |
| 1075 | var ConnHdlr vc_conn; |
| 1076 | |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 1077 | g_num_hnbs := 1; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1078 | f_init(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1079 | |
| 1080 | vc_conn := f_start_handler_with_pars(refers(f_tc_initial_ue), t_pars(2, true)); |
| 1081 | vc_conn.done; |
Neels Hofmeyr | 3a9140e | 2023-06-23 04:50:39 +0200 | [diff] [blame] | 1082 | |
| 1083 | f_shutdown_helper(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1084 | } |
| 1085 | |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 1086 | private function f_vty_set_sccp_max_optional_data(TELNETasp_PT pt, integer val := -1) |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 1087 | { |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 1088 | var charstring valstr; |
| 1089 | if (val < 0) { |
| 1090 | valstr := "standard"; |
| 1091 | } else { |
| 1092 | valstr := int2str(val); |
| 1093 | } |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 1094 | f_vty_enter_config(pt); |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 1095 | f_vty_transceive(pt, "cs7 instance 0"); |
| 1096 | f_vty_transceive(pt, "sccp max-optional-data " & valstr); |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 1097 | f_vty_transceive(pt, "end"); |
| 1098 | } |
| 1099 | |
| 1100 | testcase TC_ranap_cs_initial_ue_empty_cr() runs on test_CT { |
| 1101 | var ConnHdlr vc_conn; |
| 1102 | |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 1103 | g_num_hnbs := 1; |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 1104 | f_init(); |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 1105 | |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 1106 | f_vty_set_sccp_max_optional_data(HNBGWVTY, 0); |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 1107 | |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 1108 | vc_conn := f_start_handler_with_pars(refers(f_tc_initial_ue), t_pars(1, expect_separate_sccp_cr := true)); |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 1109 | vc_conn.done; |
| 1110 | |
| 1111 | /* reset */ |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 1112 | f_vty_set_sccp_max_optional_data(HNBGWVTY); |
Neels Hofmeyr | 3a9140e | 2023-06-23 04:50:39 +0200 | [diff] [blame] | 1113 | |
| 1114 | f_shutdown_helper(); |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 1115 | } |
| 1116 | testcase TC_ranap_ps_initial_ue_empty_cr() runs on test_CT { |
| 1117 | var ConnHdlr vc_conn; |
| 1118 | |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 1119 | g_num_hnbs := 1; |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 1120 | f_init(); |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 1121 | |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 1122 | f_vty_set_sccp_max_optional_data(HNBGWVTY, 0); |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 1123 | |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 1124 | vc_conn := f_start_handler_with_pars(refers(f_tc_initial_ue), t_pars(2, true, expect_separate_sccp_cr := true)); |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 1125 | vc_conn.done; |
| 1126 | |
| 1127 | /* reset */ |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 1128 | f_vty_set_sccp_max_optional_data(HNBGWVTY); |
Neels Hofmeyr | 3a9140e | 2023-06-23 04:50:39 +0200 | [diff] [blame] | 1129 | |
| 1130 | f_shutdown_helper(); |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 1131 | } |
| 1132 | |
| 1133 | type record Testdata_CR_Limit { |
| 1134 | integer data_len, |
| 1135 | integer max_optional_data, |
| 1136 | boolean expect_separate_sccp_cr |
| 1137 | }; |
| 1138 | type record of Testdata_CR_Limit Testdata_CR_Limits; |
| 1139 | |
| 1140 | testcase TC_sccp_cr_limit() runs on test_CT { |
| 1141 | g_num_hnbs := 1; |
| 1142 | f_init(); |
Neels Hofmeyr | f2c9502 | 2023-04-19 01:24:39 +0200 | [diff] [blame] | 1143 | |
| 1144 | const Testdata_CR_Limits tests := { |
| 1145 | { data_len := 130, max_optional_data := -1, expect_separate_sccp_cr := false }, |
| 1146 | { data_len := 131, max_optional_data := -1, expect_separate_sccp_cr := true }, |
| 1147 | |
| 1148 | { data_len := 100, max_optional_data := 100, expect_separate_sccp_cr := false }, |
| 1149 | { data_len := 101, max_optional_data := 100, expect_separate_sccp_cr := true }, |
| 1150 | |
| 1151 | { data_len := 200, max_optional_data := 200, expect_separate_sccp_cr := false }, |
| 1152 | { data_len := 201, max_optional_data := 200, expect_separate_sccp_cr := true } |
| 1153 | }; |
| 1154 | |
| 1155 | var integer csps; |
| 1156 | for (csps := 0; csps < 2; csps := csps + 1) { |
| 1157 | var boolean ps_domain := (csps > 0); |
| 1158 | |
| 1159 | var integer i; |
| 1160 | for (i := 0; i < lengthof(tests); i := i + 1) { |
| 1161 | var Testdata_CR_Limit t := tests[i]; |
| 1162 | f_logp(HNBGWVTY, |
| 1163 | "TEST PART TC_sccp_cr_limit ps_domain=" & f_bool2str(ps_domain) |
| 1164 | & " data_len=" & int2str(t.data_len) |
| 1165 | & " max_optional_data=" & int2str(t.max_optional_data) |
| 1166 | & " expect_separate_sccp_cr=" & f_bool2str(t.expect_separate_sccp_cr) |
| 1167 | ); |
| 1168 | |
| 1169 | f_vty_set_sccp_max_optional_data(HNBGWVTY, t.max_optional_data); |
| 1170 | var ConnHdlr vc_conn; |
| 1171 | vc_conn := f_start_handler_with_pars(refers(f_tc_initial_ue), |
| 1172 | t_pars(100 + i, |
| 1173 | ps_domain := ps_domain, |
| 1174 | expect_separate_sccp_cr := t.expect_separate_sccp_cr, |
| 1175 | tx_sccp_cr_data_len := t.data_len)); |
| 1176 | vc_conn.done; |
| 1177 | } |
| 1178 | } |
| 1179 | |
| 1180 | /* reset */ |
| 1181 | f_vty_set_sccp_max_optional_data(HNBGWVTY); |
Neels Hofmeyr | 3a9140e | 2023-06-23 04:50:39 +0200 | [diff] [blame] | 1182 | |
| 1183 | f_shutdown_helper(); |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 1184 | } |
| 1185 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1186 | /* Reply to a received CRCX with an OK (or the reply configured in cpars), using the given parameters. |
| 1187 | * Return true when an OK reply was sent, false otherwise. |
| 1188 | * Count occurrence of Osmux, include Osmux parameters in the reply if necessary. */ |
| 1189 | function f_handle_crcx(inout MgcpParameters pars, MgcpCommand mgcp_cmd) return template MgcpResponse { |
Pau Espin Pedrol | 264679f | 2023-11-29 15:52:00 +0100 | [diff] [blame] | 1190 | var MgwResponse conn := pars.mgw_conn_ran; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1191 | if (pars.got_crcx_count > 0) { |
Pau Espin Pedrol | b85ac2f | 2023-11-29 15:48:57 +0100 | [diff] [blame] | 1192 | conn := pars.mgw_conn_cn; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1193 | } |
| 1194 | pars.got_crcx_count := pars.got_crcx_count + 1; |
| 1195 | |
| 1196 | var MgcpMessage mgcp_msg := { |
| 1197 | command := mgcp_cmd |
| 1198 | } |
| 1199 | var template MgcpResponse mgcp_resp; |
| 1200 | var MgcpOsmuxCID osmux_cid; |
| 1201 | var MgcpCallId call_id := f_MgcpCmd_extract_call_id(mgcp_cmd); |
| 1202 | if (ispresent(pars.mgcp_call_id)) { |
| 1203 | if (pars.mgcp_call_id != call_id) { |
| 1204 | setverdict(fail, "CRCX contained unexpected call id. Expected:", pars.mgcp_call_id, " got:", call_id); |
| 1205 | mtc.stop; |
| 1206 | } |
| 1207 | } else { |
| 1208 | pars.mgcp_call_id := call_id; |
| 1209 | } |
| 1210 | |
| 1211 | /* When the endpoint contains a wildcard we keep the endpoint |
| 1212 | * identifier we have set up in pars. Otherwise we use the |
| 1213 | * endpoint name that the call agent has supplied */ |
| 1214 | if (match(mgcp_cmd.line.ep, t_MGCP_EP_wildcard) == false) { |
| 1215 | pars.mgcp_ep := mgcp_cmd.line.ep; |
| 1216 | } |
| 1217 | |
| 1218 | if (conn.resp == -1) { |
| 1219 | /* Reply with rror */ |
| 1220 | var MgcpResponse mgcp_rsp := { |
| 1221 | line := { |
| 1222 | code := "542", |
| 1223 | trans_id := mgcp_cmd.line.trans_id, |
| 1224 | string := "FORCED_FAIL" |
| 1225 | }, |
| 1226 | sdp := omit |
| 1227 | |
| 1228 | } |
| 1229 | var MgcpParameter mgcp_rsp_param := { |
| 1230 | code := "Z", |
| 1231 | val := pars.mgcp_ep |
| 1232 | }; |
| 1233 | mgcp_rsp.params[0] := mgcp_rsp_param; |
| 1234 | return mgcp_rsp; |
| 1235 | } |
| 1236 | |
| 1237 | if (conn.resp == 0) { |
| 1238 | /* Do not reply at all */ |
| 1239 | return omit; |
| 1240 | } |
| 1241 | |
| 1242 | if (conn.resp != 1) { |
| 1243 | setverdict(fail, "Unexpected value for pars.mgw_conn_*.resp, expect -1, 0 or 1"); |
| 1244 | mtc.stop; |
| 1245 | } |
| 1246 | |
| 1247 | var SDP_Message sdp := valueof(ts_SDP(conn.mgw_rtp_ip, conn.mgw_rtp_ip, |
| 1248 | hex2str(pars.mgcp_call_id), "42", |
| 1249 | conn.mgw_rtp_port, |
| 1250 | { int2str(pars.rtp_payload_type) }, |
| 1251 | { valueof(ts_SDP_rtpmap(pars.rtp_payload_type, |
| 1252 | pars.rtp_sdp_format)), |
| 1253 | valueof(ts_SDP_ptime(20)) })); |
| 1254 | |
| 1255 | if (f_mgcp_contains_par(mgcp_msg, "X-OSMUX")) { |
| 1256 | if (not pars.use_osmux) { |
| 1257 | setverdict(fail, "MSC sent X-Osmux parameter in MGCP, but not expecting any Osmux"); |
| 1258 | mtc.stop; |
| 1259 | } |
| 1260 | pars.got_osmux_count := pars.got_osmux_count + 1; |
| 1261 | /* we expect MSC to use wildcard here, i.e. osmux_cid == -1 */ |
| 1262 | osmux_cid := f_MgcpCmd_extract_osmux_cid(mgcp_cmd); |
| 1263 | log("f_handle_crcx(): got Osmux CID: ", osmux_cid); |
| 1264 | if (osmux_cid != -1) { |
| 1265 | setverdict(fail, "MSC using unexpected CID " & int2str(osmux_cid) & " != -1"); |
| 1266 | mtc.stop; |
| 1267 | } |
| 1268 | |
| 1269 | osmux_cid := 0; |
| 1270 | mgcp_resp := ts_CRCX_ACK_osmux(mgcp_cmd.line.trans_id, conn.mgcp_connection_id, osmux_cid, sdp); |
| 1271 | } else { |
| 1272 | mgcp_resp := ts_CRCX_ACK(mgcp_cmd.line.trans_id, conn.mgcp_connection_id, sdp); |
| 1273 | } |
| 1274 | |
| 1275 | f_mgcp_par_append(mgcp_resp.params, ts_MgcpParSpecEP(pars.mgcp_ep)); |
| 1276 | |
| 1277 | return mgcp_resp; |
| 1278 | } |
| 1279 | |
Daniel Willmann | 3e15b7b | 2022-02-21 17:07:02 +0100 | [diff] [blame] | 1280 | friend function f_create_rab(inout MgcpParameters pars) runs on ConnHdlr { |
| 1281 | f_rab_ass_req(pars); |
| 1282 | f_rab_ass_resp(pars); |
| 1283 | } |
| 1284 | |
| 1285 | friend function f_rab_ass_req(inout MgcpParameters pars) runs on ConnHdlr { |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1286 | var MgcpCommand mgcp_cmd; |
| 1287 | var RANAP_PDU tx; |
| 1288 | var template RAB_SetupOrModifyList rab_sml; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1289 | timer T := 5.0; |
| 1290 | |
| 1291 | /* Send RAB Assignment Request */ |
| 1292 | rab_sml := ts_RAB_SML(t_RAB_id(23), f_ts_RAB_TLA(pars.cn_rtp_ip), t_RAB_binding_port(pars.cn_rtp_port)); |
| 1293 | tx := valueof(ts_RANAP_RabAssReq(rab_sml)); |
| 1294 | BSSAP.send(tx); |
| 1295 | T.start; |
| 1296 | |
| 1297 | /* Handle MGCP CRCX */ |
| 1298 | alt { |
| 1299 | [] MGCP.receive(tr_CRCX) -> value mgcp_cmd { |
| 1300 | log("CRCX1", mgcp_cmd); |
| 1301 | var template MgcpResponse mgcp_rsp := f_handle_crcx(pars, mgcp_cmd); |
| 1302 | MGCP.send(valueof(mgcp_rsp)); |
| 1303 | } |
| 1304 | [] T.timeout { |
| 1305 | setverdict(fail, "Timeout waiting for MGCP"); |
| 1306 | } |
| 1307 | } |
Neels Hofmeyr | 735b656 | 2023-03-09 02:51:28 +0100 | [diff] [blame] | 1308 | T.stop; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1309 | |
| 1310 | /* Expect RAB Assignment Request with IP/port from CRCX ACK via Iuh */ |
Pau Espin Pedrol | b85ac2f | 2023-11-29 15:48:57 +0100 | [diff] [blame] | 1311 | rab_sml := ts_RAB_SML(t_RAB_id(23), f_ts_RAB_TLA(pars.mgw_conn_ran.mgw_rtp_ip), t_RAB_binding_port(pars.mgw_conn_ran.mgw_rtp_port)); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1312 | tx := valueof(ts_RANAP_RabAssReq(rab_sml)); |
| 1313 | |
Neels Hofmeyr | 735b656 | 2023-03-09 02:51:28 +0100 | [diff] [blame] | 1314 | f_rua_expect(tx); |
Daniel Willmann | 3e15b7b | 2022-02-21 17:07:02 +0100 | [diff] [blame] | 1315 | } |
| 1316 | |
| 1317 | friend function f_rab_ass_resp(inout MgcpParameters pars) runs on ConnHdlr { |
| 1318 | var MgcpCommand mgcp_cmd; |
| 1319 | var RANAP_PDU tx; |
| 1320 | var template RAB_SetupOrModifiedList rab_smdl; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1321 | |
| 1322 | /* Send back RAB Assignment Response via Iuh */ |
| 1323 | rab_smdl := ts_RAB_SMdL(t_RAB_id(23), f_ts_RAB_TLA(pars.hnb_rtp_ip), t_RAB_binding_port(pars.hnb_rtp_port)); |
| 1324 | tx := valueof(ts_RANAP_RabAssResp(rab_smdl)); |
| 1325 | RUA.send(tx); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1326 | |
| 1327 | interleave { |
| 1328 | /* Expect MDCX with IP/port from RAB Assignment Response */ |
| 1329 | [] MGCP.receive(tr_MDCX(tr_SDP(pars.hnb_rtp_ip, pars.hnb_rtp_port))) -> value mgcp_cmd { |
Pau Espin Pedrol | 0c35a63 | 2023-11-29 16:00:35 +0100 | [diff] [blame] | 1330 | var HostName mgw_rtp_ip; |
Pau Espin Pedrol | af74650 | 2023-11-29 16:18:28 +0100 | [diff] [blame] | 1331 | var boolean exp_rua_rab_reass := false; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1332 | log("MDCX1", mgcp_cmd); |
Pau Espin Pedrol | 0c35a63 | 2023-11-29 16:00:35 +0100 | [diff] [blame] | 1333 | if (ispresent(pars.mgw_conn_ran.mgw_rtp_ip_mdcx)) { |
| 1334 | mgw_rtp_ip := pars.mgw_conn_ran.mgw_rtp_ip_mdcx; |
Pau Espin Pedrol | af74650 | 2023-11-29 16:18:28 +0100 | [diff] [blame] | 1335 | if (pars.mgw_conn_ran.mgw_rtp_ip != pars.mgw_conn_ran.mgw_rtp_ip_mdcx) { |
| 1336 | exp_rua_rab_reass := true; |
| 1337 | } |
Pau Espin Pedrol | 0c35a63 | 2023-11-29 16:00:35 +0100 | [diff] [blame] | 1338 | } else { |
| 1339 | mgw_rtp_ip := pars.mgw_conn_ran.mgw_rtp_ip; |
| 1340 | } |
| 1341 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1342 | /* Verify SDP of MDCX */ |
Pau Espin Pedrol | 0c35a63 | 2023-11-29 16:00:35 +0100 | [diff] [blame] | 1343 | var SDP_Message sdp := valueof(ts_SDP(mgw_rtp_ip, mgw_rtp_ip, hex2str(pars.mgcp_call_id), "42", pars.mgw_conn_ran.mgw_rtp_port, |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1344 | { int2str(pars.rtp_payload_type) }, { valueof(ts_SDP_rtpmap(pars.rtp_payload_type, pars.rtp_sdp_format)), valueof(ts_SDP_ptime(20)) } )); |
Pau Espin Pedrol | b85ac2f | 2023-11-29 15:48:57 +0100 | [diff] [blame] | 1345 | var template MgcpResponse mgcp_rsp := ts_MDCX_ACK(mgcp_cmd.line.trans_id, pars.mgw_conn_ran.mgcp_connection_id, sdp); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1346 | MGCP.send(valueof(mgcp_rsp)); |
Pau Espin Pedrol | af74650 | 2023-11-29 16:18:28 +0100 | [diff] [blame] | 1347 | |
| 1348 | /* If IP address changed, we expect HNBGW to Modify the RAB through RAB-Ass-Req: */ |
| 1349 | if (exp_rua_rab_reass) { |
| 1350 | var template RAB_SetupOrModifyList rab_sml; |
| 1351 | /* Expect RAB Assignment Request with IP/port from MDCX ACK via Iuh */ |
| 1352 | rab_sml := ts_RAB_SML(t_RAB_id(23), f_ts_RAB_TLA(pars.mgw_conn_ran.mgw_rtp_ip_mdcx), t_RAB_binding_port(pars.mgw_conn_ran.mgw_rtp_port)); |
| 1353 | tx := valueof(ts_RANAP_RabAssReq(rab_sml)); |
| 1354 | |
| 1355 | f_rua_expect(tx); |
| 1356 | /* Send back RAB Assignment Response via Iuh */ |
| 1357 | rab_smdl := ts_RAB_SMdL(t_RAB_id(23), f_ts_RAB_TLA(pars.hnb_rtp_ip), t_RAB_binding_port(pars.hnb_rtp_port)); |
| 1358 | tx := valueof(ts_RANAP_RabAssResp(rab_smdl)); |
| 1359 | RUA.send(tx); |
| 1360 | /* This shouldn't trigger any MGCP, since nothing changed on the HNB IP side. Continue below. */ |
| 1361 | } |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1362 | } |
| 1363 | /* Handle CRCX for second leg of endpoint, answer with IP/port */ |
| 1364 | [] MGCP.receive(tr_CRCX(pars.mgcp_ep, tr_SDP(pars.cn_rtp_ip, pars.cn_rtp_port))) -> value mgcp_cmd { |
| 1365 | log("CRCX2", mgcp_cmd); |
| 1366 | /* Verify SDP of CRCX */ |
| 1367 | var template MgcpResponse mgcp_rsp := f_handle_crcx(pars, mgcp_cmd); |
| 1368 | MGCP.send(valueof(mgcp_rsp)); |
| 1369 | } |
| 1370 | } |
| 1371 | |
| 1372 | /* Expect RAB Assignment Response with IP/port from second CRCX ACK */ |
Pau Espin Pedrol | b85ac2f | 2023-11-29 15:48:57 +0100 | [diff] [blame] | 1373 | rab_smdl := ts_RAB_SMdL(t_RAB_id(23), f_ts_RAB_TLA(pars.mgw_conn_cn.mgw_rtp_ip), t_RAB_binding_port(pars.mgw_conn_cn.mgw_rtp_port)); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1374 | tx := valueof(ts_RANAP_RabAssResp(rab_smdl)); |
| 1375 | |
Neels Hofmeyr | dc416c9 | 2023-03-09 02:47:50 +0100 | [diff] [blame] | 1376 | f_bssap_expect(tx); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1377 | } |
| 1378 | |
| 1379 | private altstep as_mgcp_dlcx(inout TestHdlrParams pars) runs on ConnHdlr { |
| 1380 | var MgcpCommand mgcp_cmd; |
| 1381 | |
| 1382 | [] MGCP.receive(tr_DLCX(pars.mgcp_pars.mgcp_ep)) -> value mgcp_cmd { |
| 1383 | log("DLCX", mgcp_cmd); |
| 1384 | MGCP.send(ts_DLCX_ACK2(mgcp_cmd.line.trans_id)); |
| 1385 | pars.mgcp_pars.got_dlcx_count := pars.mgcp_pars.got_dlcx_count + 1; |
Daniel Willmann | 3e15b7b | 2022-02-21 17:07:02 +0100 | [diff] [blame] | 1386 | if (pars.mgcp_pars.got_dlcx_count != pars.mgcp_pars.got_crcx_count) { |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1387 | repeat; |
| 1388 | } |
| 1389 | setverdict(pass); |
| 1390 | } |
| 1391 | } |
| 1392 | |
| 1393 | friend function f_tc_rab_assignment(charstring id, TestHdlrParams pars) runs on ConnHdlr { |
| 1394 | var MgcpCommand mgcp_cmd; |
| 1395 | var RANAP_PDU tx; |
| 1396 | timer T := 5.0; |
| 1397 | |
| 1398 | f_init_handler(pars); |
| 1399 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1400 | |
| 1401 | tx := f_build_initial_ue(g_pars); |
| 1402 | f_iuh2iu_connect(tx); |
| 1403 | |
| 1404 | f_create_rab(pars.mgcp_pars); |
| 1405 | |
| 1406 | /* Send Iu Release */ |
| 1407 | tx := valueof(ts_RANAP_IuReleaseCommand(ts_RanapCause_om_intervention)); |
| 1408 | f_iu2iuh(tx); |
| 1409 | |
| 1410 | T.start; |
| 1411 | alt { |
| 1412 | [] as_mgcp_dlcx(pars) {} |
| 1413 | [] T.timeout { |
| 1414 | setverdict(fail, "Timeout waiting for DLCX"); |
| 1415 | } |
| 1416 | } |
| 1417 | |
| 1418 | tx := valueof(ts_RANAP_IuReleaseComplete()); |
| 1419 | f_iuh2iu(tx); |
| 1420 | } |
| 1421 | |
| 1422 | testcase TC_rab_assignment() runs on test_CT { |
| 1423 | var ConnHdlr vc_conn; |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 1424 | g_num_hnbs := 1; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1425 | f_init(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1426 | |
| 1427 | vc_conn := f_start_handler_with_pars(refers(f_tc_rab_assignment), t_pars(3)); |
| 1428 | vc_conn.done; |
Neels Hofmeyr | 3a9140e | 2023-06-23 04:50:39 +0200 | [diff] [blame] | 1429 | |
| 1430 | f_shutdown_helper(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1431 | } |
| 1432 | |
Daniel Willmann | 3e15b7b | 2022-02-21 17:07:02 +0100 | [diff] [blame] | 1433 | friend function f_tc_rab_assign_fail(charstring id, TestHdlrParams pars) runs on ConnHdlr { |
| 1434 | var MgcpCommand mgcp_cmd; |
| 1435 | var RANAP_PDU tx; |
| 1436 | timer T := 5.0; |
| 1437 | |
| 1438 | f_init_handler(pars); |
| 1439 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1440 | |
| 1441 | tx := f_build_initial_ue(g_pars); |
| 1442 | f_iuh2iu_connect(tx); |
| 1443 | |
| 1444 | f_rab_ass_req(pars.mgcp_pars); |
| 1445 | |
| 1446 | /* Send RAB failed list in response */ |
| 1447 | tx := valueof(ts_RANAP_RabAssResp(rab_fl := ts_RAB_FL(t_RAB_id(23), ts_RanapCause_om_intervention))); |
| 1448 | f_iuh2iu(tx); |
| 1449 | |
| 1450 | T.start; |
| 1451 | alt { |
| 1452 | [] as_mgcp_dlcx(pars) {} |
| 1453 | [] T.timeout { |
| 1454 | setverdict(fail, "Timeout waiting for DLCX"); |
| 1455 | } |
| 1456 | } |
| 1457 | } |
| 1458 | |
| 1459 | testcase TC_rab_assign_fail() runs on test_CT { |
| 1460 | var ConnHdlr vc_conn; |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 1461 | g_num_hnbs := 1; |
Daniel Willmann | 3e15b7b | 2022-02-21 17:07:02 +0100 | [diff] [blame] | 1462 | f_init(); |
Daniel Willmann | 3e15b7b | 2022-02-21 17:07:02 +0100 | [diff] [blame] | 1463 | |
| 1464 | vc_conn := f_start_handler_with_pars(refers(f_tc_rab_assign_fail), t_pars(4)); |
| 1465 | vc_conn.done; |
Neels Hofmeyr | 3a9140e | 2023-06-23 04:50:39 +0200 | [diff] [blame] | 1466 | |
| 1467 | f_shutdown_helper(); |
Daniel Willmann | 3e15b7b | 2022-02-21 17:07:02 +0100 | [diff] [blame] | 1468 | } |
| 1469 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1470 | friend function f_tc_rab_release(charstring id, TestHdlrParams pars) runs on ConnHdlr { |
| 1471 | var MgcpCommand mgcp_cmd; |
| 1472 | var RANAP_PDU tx; |
| 1473 | timer T := 15.0; |
| 1474 | |
| 1475 | f_init_handler(pars); |
| 1476 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1477 | |
| 1478 | tx := f_build_initial_ue(g_pars); |
| 1479 | f_iuh2iu_connect(tx); |
| 1480 | |
| 1481 | f_create_rab(pars.mgcp_pars); |
| 1482 | |
| 1483 | /* Send RAB Release */ |
Daniel Willmann | 9e789be | 2022-02-22 13:30:51 +0100 | [diff] [blame] | 1484 | tx := valueof(ts_RANAP_RabAssReq(rab_rl := ts_RAB_RL(t_RAB_id(23), ts_RanapCause_om_intervention))); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1485 | BSSAP.send(tx); |
| 1486 | |
| 1487 | T.start; |
| 1488 | |
| 1489 | alt { |
| 1490 | [] as_mgcp_dlcx(pars) {} |
| 1491 | [] T.timeout { |
| 1492 | setverdict(fail, "Timeout waiting for DLCX"); |
| 1493 | } |
| 1494 | } |
Neels Hofmeyr | 735b656 | 2023-03-09 02:51:28 +0100 | [diff] [blame] | 1495 | T.stop; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1496 | |
Neels Hofmeyr | 735b656 | 2023-03-09 02:51:28 +0100 | [diff] [blame] | 1497 | f_rua_expect(tx); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1498 | } |
| 1499 | |
| 1500 | testcase TC_rab_release() runs on test_CT { |
| 1501 | var ConnHdlr vc_conn; |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 1502 | g_num_hnbs := 1; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1503 | f_init(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1504 | |
| 1505 | vc_conn := f_start_handler_with_pars(refers(f_tc_rab_release), t_pars(5)); |
| 1506 | vc_conn.done; |
Neels Hofmeyr | 3a9140e | 2023-06-23 04:50:39 +0200 | [diff] [blame] | 1507 | |
| 1508 | f_shutdown_helper(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1509 | } |
| 1510 | |
Daniel Willmann | 37c877f | 2022-02-22 16:47:06 +0100 | [diff] [blame] | 1511 | friend function f_tc_rab_assign_mgcp_to(charstring id, TestHdlrParams pars) runs on ConnHdlr { |
| 1512 | var MgcpCommand mgcp_cmd; |
| 1513 | var RANAP_PDU tx; |
| 1514 | var template RAB_SetupOrModifyList rab_sml; |
| 1515 | timer T := 15.0; |
| 1516 | |
| 1517 | T.start; |
| 1518 | f_init_handler(pars); |
| 1519 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 1520 | |
| 1521 | tx := f_build_initial_ue(g_pars); |
| 1522 | f_iuh2iu_connect(tx); |
| 1523 | |
| 1524 | |
| 1525 | /* Send RAB Assignment Request */ |
| 1526 | rab_sml := ts_RAB_SML(t_RAB_id(23), f_ts_RAB_TLA(pars.mgcp_pars.cn_rtp_ip), t_RAB_binding_port(pars.mgcp_pars.cn_rtp_port)); |
| 1527 | tx := valueof(ts_RANAP_RabAssReq(rab_sml)); |
| 1528 | BSSAP.send(tx); |
| 1529 | |
| 1530 | /* Ignore MGCP CRCX */ |
| 1531 | alt { |
| 1532 | [] MGCP.receive(tr_CRCX) -> value mgcp_cmd { |
| 1533 | log("Ignoreing CRCX1", mgcp_cmd); |
| 1534 | repeat; |
| 1535 | } |
| 1536 | [] BSSAP.receive(tr_RANAP_IuReleaseRequest(?)) { } |
| 1537 | [] T.timeout { |
| 1538 | setverdict(fail, "Timeout waiting for IuRelease"); |
| 1539 | } |
| 1540 | } |
| 1541 | |
| 1542 | /* Send Iu Release */ |
| 1543 | tx := valueof(ts_RANAP_IuReleaseCommand(ts_RanapCause_om_intervention)); |
| 1544 | f_iu2iuh(tx); |
| 1545 | |
| 1546 | tx := valueof(ts_RANAP_IuReleaseComplete()); |
| 1547 | f_iuh2iu(tx); |
| 1548 | } |
| 1549 | |
| 1550 | testcase TC_rab_assign_mgcp_to() runs on test_CT { |
| 1551 | var ConnHdlr vc_conn; |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 1552 | g_num_hnbs := 1; |
Daniel Willmann | 37c877f | 2022-02-22 16:47:06 +0100 | [diff] [blame] | 1553 | f_init(); |
Daniel Willmann | 37c877f | 2022-02-22 16:47:06 +0100 | [diff] [blame] | 1554 | |
| 1555 | vc_conn := f_start_handler_with_pars(refers(f_tc_rab_assign_mgcp_to), t_pars(6)); |
| 1556 | vc_conn.done; |
Neels Hofmeyr | 3a9140e | 2023-06-23 04:50:39 +0200 | [diff] [blame] | 1557 | |
| 1558 | f_shutdown_helper(); |
Daniel Willmann | 37c877f | 2022-02-22 16:47:06 +0100 | [diff] [blame] | 1559 | } |
| 1560 | |
Pau Espin Pedrol | af74650 | 2023-11-29 16:18:28 +0100 | [diff] [blame] | 1561 | /* Test case where IuUP IP address announced by HNB and updated through MDCX |
| 1562 | * makes MGW select a new local IuUP address. HNBGW is expected to update the HNB |
| 1563 | * through RAB-Modify-Req. */ |
| 1564 | testcase TC_rab_assign_mgw_iuup_addr_chg() runs on test_CT { |
| 1565 | var ConnHdlr vc_conn; |
| 1566 | g_num_hnbs := 1; |
| 1567 | f_init(); |
| 1568 | var template (value) TestHdlrParams pars := t_pars(3); |
| 1569 | /* Emulate change of local IuUP IP address after rx MDCX: */ |
| 1570 | pars.mgcp_pars.mgw_conn_ran.mgw_rtp_ip_mdcx := "127.3.2.1"; |
| 1571 | |
| 1572 | vc_conn := f_start_handler_with_pars(refers(f_tc_rab_assignment), pars); |
| 1573 | vc_conn.done; |
| 1574 | |
| 1575 | f_shutdown_helper(); |
| 1576 | } |
| 1577 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1578 | /* Create an Iuh connection; send InitialUE; transceive data both directions */ |
| 1579 | friend function f_tc_ranap_bidir(charstring id, TestHdlrParams pars) runs on ConnHdlr { |
| 1580 | f_init_handler(pars); |
| 1581 | |
| 1582 | /* HNB -> MSC: InitialUE */ |
| 1583 | f_iuh2iu_connect(f_build_initial_ue(g_pars)); |
| 1584 | |
| 1585 | /* MSC <- HNB: DirectTransfer */ |
| 1586 | f_iu2iuh(ts_RANAP_DirectTransfer(f_rnd_octstring(10))); |
| 1587 | /* MSC -> HNB: DirectTransfer */ |
| 1588 | f_iuh2iu(ts_RANAP_DirectTransfer(f_rnd_octstring(10))); |
| 1589 | |
| 1590 | /* HNB <- MSC: CommonID */ |
| 1591 | f_iu2iuh(ts_RANAP_CommonId(hex2oct(pars.imsi))); |
| 1592 | } |
| 1593 | testcase TC_ranap_cs_bidir() runs on test_CT { |
| 1594 | var ConnHdlr vc_conn; |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 1595 | g_num_hnbs := 1; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1596 | f_init(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1597 | |
| 1598 | vc_conn := f_start_handler_with_pars(refers(f_tc_ranap_bidir), t_pars(3)); |
| 1599 | vc_conn.done; |
Neels Hofmeyr | 3a9140e | 2023-06-23 04:50:39 +0200 | [diff] [blame] | 1600 | |
| 1601 | f_shutdown_helper(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1602 | } |
| 1603 | testcase TC_ranap_ps_bidir() runs on test_CT { |
| 1604 | var ConnHdlr vc_conn; |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 1605 | g_num_hnbs := 1; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1606 | f_init(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1607 | |
| 1608 | vc_conn := f_start_handler_with_pars(refers(f_tc_ranap_bidir), t_pars(4, true)); |
| 1609 | vc_conn.done; |
Neels Hofmeyr | 3a9140e | 2023-06-23 04:50:39 +0200 | [diff] [blame] | 1610 | |
| 1611 | f_shutdown_helper(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1612 | } |
| 1613 | |
| 1614 | |
| 1615 | private function f_tc_ranap_mo_disconnect(charstring id, TestHdlrParams pars) runs on ConnHdlr { |
| 1616 | f_init_handler(pars); |
| 1617 | |
| 1618 | /* HNB -> MSC: InitialUE */ |
| 1619 | f_iuh2iu_connect(f_build_initial_ue(g_pars)); |
| 1620 | |
| 1621 | /* MSC <- HNB: DirectTransfer */ |
| 1622 | f_iu2iuh(ts_RANAP_DirectTransfer(f_rnd_octstring(10))); |
| 1623 | /* MSC -> HNB: DirectTransfer */ |
| 1624 | f_iuh2iu(ts_RANAP_DirectTransfer(f_rnd_octstring(10))); |
| 1625 | |
| 1626 | /* MSC <- HNB: RUA disconnect */ |
| 1627 | f_iuh2iu_disconnect(ts_RANAP_IuReleaseComplete, RUA_IEs.Cause:{misc:=processing_overload}); |
| 1628 | } |
| 1629 | testcase TC_ranap_cs_mo_disconnect() runs on test_CT { |
| 1630 | var ConnHdlr vc_conn; |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 1631 | g_num_hnbs := 1; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1632 | f_init(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1633 | |
| 1634 | vc_conn := f_start_handler_with_pars(refers(f_tc_ranap_mo_disconnect), t_pars(5)); |
| 1635 | vc_conn.done; |
Neels Hofmeyr | 3a9140e | 2023-06-23 04:50:39 +0200 | [diff] [blame] | 1636 | |
| 1637 | f_shutdown_helper(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1638 | } |
| 1639 | testcase TC_ranap_ps_mo_disconnect() runs on test_CT { |
| 1640 | var ConnHdlr vc_conn; |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 1641 | g_num_hnbs := 1; |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1642 | f_init(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1643 | |
| 1644 | vc_conn := f_start_handler_with_pars(refers(f_tc_ranap_mo_disconnect), t_pars(6)); |
| 1645 | vc_conn.done; |
Neels Hofmeyr | 3a9140e | 2023-06-23 04:50:39 +0200 | [diff] [blame] | 1646 | |
| 1647 | f_shutdown_helper(); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1648 | } |
| 1649 | |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1650 | type record FTeid { |
| 1651 | HostName addr, |
| 1652 | OCT4 teid |
| 1653 | } |
| 1654 | |
| 1655 | type record FTeids { |
| 1656 | FTeid local, |
| 1657 | FTeid remote |
| 1658 | } |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1659 | |
| 1660 | |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1661 | /* 'local' and 'remote' refer to the GTP information from the UPF's point of view: |
| 1662 | * HNB UPF CN |
| 1663 | * access.remote <---> access.local | core.local <---> core.remote |
| 1664 | */ |
| 1665 | type record GtpParameters { |
| 1666 | FTeids core, |
| 1667 | FTeids access |
| 1668 | } |
| 1669 | |
| 1670 | /* HNB UPF CN |
| 1671 | * access.remote <---> access.local | core.local <---> core.remote |
| 1672 | * 127.0.0.4 127.0.0.3 127.0.0.2 127.0.0.1 |
| 1673 | * 0x44004400 0x30303030 0x22002200 0x10101010 |
| 1674 | */ |
| 1675 | template GtpParameters t_GtpParameters := { |
| 1676 | core := { |
| 1677 | local := { |
| 1678 | addr := "127.0.0.2", |
| 1679 | teid := '22002200'O |
| 1680 | }, |
| 1681 | remote := { |
| 1682 | addr := "127.0.0.1", |
| 1683 | teid := '10101010'O |
| 1684 | } |
| 1685 | }, |
| 1686 | access := { |
| 1687 | local := { |
| 1688 | addr := "127.0.0.3", |
| 1689 | teid := '30303030'O |
| 1690 | }, |
| 1691 | remote := { |
| 1692 | addr := "127.0.0.4", |
| 1693 | teid := '44004400'O |
| 1694 | } |
| 1695 | } |
| 1696 | } |
| 1697 | |
Neels Hofmeyr | 6549928 | 2023-04-25 02:31:51 +0200 | [diff] [blame] | 1698 | private function f_pfcp_expect(template (present) PDU_PFCP exp_rx, float wait_time := 5.0) runs on ConnHdlr return PDU_PFCP |
Neels Hofmeyr | 6bbfe05 | 2023-03-09 02:51:46 +0100 | [diff] [blame] | 1699 | { |
| 1700 | var PDU_PFCP rx; |
Neels Hofmeyr | 6549928 | 2023-04-25 02:31:51 +0200 | [diff] [blame] | 1701 | timer T := wait_time; |
Neels Hofmeyr | 6bbfe05 | 2023-03-09 02:51:46 +0100 | [diff] [blame] | 1702 | T.start; |
| 1703 | alt { |
| 1704 | [] PFCP.receive(exp_rx) -> value rx { |
| 1705 | setverdict(pass); |
| 1706 | } |
| 1707 | [] PFCP.receive(PDU_PFCP:?) { |
| 1708 | setverdict(fail, "Got an unexpected PFCP message, was waiting for ", exp_rx); |
| 1709 | mtc.stop; |
| 1710 | } |
| 1711 | [] T.timeout { |
| 1712 | setverdict(fail, "Timeout waiting for PFCP ", exp_rx); |
| 1713 | mtc.stop; |
| 1714 | } |
| 1715 | } |
| 1716 | T.stop; |
| 1717 | return rx; |
| 1718 | } |
| 1719 | |
Neels Hofmeyr | bacb74f | 2022-08-29 16:24:12 +0200 | [diff] [blame] | 1720 | friend function f_tc_ps_rab_assignment_with_pfcp(charstring id, TestHdlrParams pars) runs on ConnHdlr { |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1721 | var RANAP_PDU tx; |
| 1722 | var RANAP_PDU rx; |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1723 | |
| 1724 | f_init_handler(pars); |
| 1725 | |
| 1726 | f_pfcp_register(); |
| 1727 | |
| 1728 | var PDU_PFCP m; |
| 1729 | var Node_ID upf_node_id := valueof(ts_PFCP_Node_ID_fqdn("\07osmocom\03org")); |
| 1730 | |
Neels Hofmeyr | 6549928 | 2023-04-25 02:31:51 +0200 | [diff] [blame] | 1731 | m := f_pfcp_expect(tr_PFCP_Assoc_Setup_Req(), wait_time := 15.0); |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1732 | PFCP.send(ts_PFCP_Assoc_Setup_Resp(m.sequence_number, upf_node_id, |
| 1733 | ts_PFCP_Cause(REQUEST_ACCEPTED), 1234)); |
| 1734 | |
| 1735 | tx := f_build_initial_ue(g_pars); |
| 1736 | f_iuh2iu_connect(tx); |
| 1737 | |
| 1738 | var GtpParameters gtp_pars := valueof(t_GtpParameters); |
| 1739 | var template RAB_SetupOrModifyList rab_sml; |
| 1740 | |
| 1741 | /* Send RAB Assignment Request */ |
| 1742 | rab_sml := ts_RAB_SML_ps(t_RAB_id(23), f_ts_RAB_TLA(gtp_pars.core.remote.addr), gtp_pars.core.remote.teid); |
| 1743 | tx := valueof(ts_RANAP_RabAssReq(rab_sml)); |
| 1744 | BSSAP.send(tx); |
| 1745 | |
| 1746 | /* Expect PFCP Session Establishment Request. */ |
Neels Hofmeyr | 6bbfe05 | 2023-03-09 02:51:46 +0100 | [diff] [blame] | 1747 | m := f_pfcp_expect(tr_PFCP_Session_Est_Req()); |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1748 | var F_SEID hnbgw_f_seid := m.message_body.pfcp_session_establishment_request.CP_F_SEID; |
| 1749 | var PFCP_Session_Establishment_Request serq := m.message_body.pfcp_session_establishment_request; |
| 1750 | |
| 1751 | /* Acting as UPF, invent a new PFCP SEID to send to HNBGW. Respond to the Session Establishment. |
| 1752 | * The PFCP response must have the same sequence_number as the request. */ |
Neels Hofmeyr | 1e31146 | 2023-01-11 01:19:12 +0100 | [diff] [blame] | 1753 | var F_SEID up_f_seid := valueof(ts_PFCP_F_SEID_ipv4(f_inet_addr("127.0.0.1"), '1111111111111111'O)); |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1754 | var template PDU_PFCP r := ts_PFCP_Session_Est_Resp(m.sequence_number, upf_node_id, hnbgw_f_seid.seid); |
| 1755 | r.message_body.pfcp_session_establishment_response := { |
| 1756 | offending_ie := omit, |
| 1757 | UP_F_SEID := up_f_seid, |
| 1758 | created_PDR_list := { |
| 1759 | ts_PFCP_Created_PDR(pdr_id := serq.create_PDR_list[0].grouped_ie.pdr_id, |
| 1760 | local_F_TEID := ts_PFCP_F_TEID_ipv4(gtp_pars.core.local.teid, |
Neels Hofmeyr | 1e31146 | 2023-01-11 01:19:12 +0100 | [diff] [blame] | 1761 | f_inet_addr(gtp_pars.core.local.addr))), |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1762 | ts_PFCP_Created_PDR(pdr_id := serq.create_PDR_list[1].grouped_ie.pdr_id, |
| 1763 | local_F_TEID := ts_PFCP_F_TEID_ipv4(gtp_pars.access.local.teid, |
Neels Hofmeyr | 1e31146 | 2023-01-11 01:19:12 +0100 | [diff] [blame] | 1764 | f_inet_addr(gtp_pars.access.local.addr))) |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1765 | }, |
| 1766 | load_control_information := omit, |
| 1767 | overload_control_information := omit, |
| 1768 | node_list := omit, |
| 1769 | failed_rule_id := omit, |
| 1770 | created_traffic_endpoint_list := omit |
| 1771 | }; |
| 1772 | PFCP.send(r); |
| 1773 | |
| 1774 | /* Expect on Iuh: RAB Assignment Request with IP/port from PFCP Session Est Resp */ |
| 1775 | rab_sml := ts_RAB_SML_ps(t_RAB_id(23), f_ts_RAB_TLA(gtp_pars.access.local.addr), |
| 1776 | gtp_pars.access.local.teid); |
| 1777 | rx := valueof(ts_RANAP_RabAssReq(rab_sml)); |
Neels Hofmeyr | 735b656 | 2023-03-09 02:51:28 +0100 | [diff] [blame] | 1778 | f_rua_expect(rx); |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1779 | |
| 1780 | /* Send back RAB Assignment Response via Iuh */ |
| 1781 | var template RAB_SetupOrModifiedList rab_smdl; |
| 1782 | rab_smdl := ts_RAB_SMdL_ps(t_RAB_id(23), f_ts_RAB_TLA(gtp_pars.access.remote.addr), |
| 1783 | gtp_pars.access.remote.teid); |
| 1784 | tx := valueof(ts_RANAP_RabAssResp(rab_smdl)); |
| 1785 | RUA.send(tx); |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1786 | |
Neels Hofmeyr | 6bbfe05 | 2023-03-09 02:51:46 +0100 | [diff] [blame] | 1787 | m := f_pfcp_expect(tr_PFCP_Session_Mod_Req(up_f_seid.seid)); |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1788 | r := ts_PFCP_Session_Mod_Resp(m.sequence_number, hnbgw_f_seid.seid); |
| 1789 | PFCP.send(r); |
| 1790 | |
| 1791 | rab_smdl := ts_RAB_SMdL_ps(t_RAB_id(23), f_ts_RAB_TLA(gtp_pars.core.local.addr), gtp_pars.core.local.teid); |
Neels Hofmeyr | dc416c9 | 2023-03-09 02:47:50 +0100 | [diff] [blame] | 1792 | f_bssap_expect(tr_RANAP_RabAssResp(rab_smdl)); |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1793 | |
| 1794 | f_sleep(2.0); |
| 1795 | tx := valueof(ts_RANAP_IuReleaseCommand(ts_RanapCause_om_intervention)); |
| 1796 | f_iu2iuh(tx); |
| 1797 | |
| 1798 | tx := valueof(ts_RANAP_IuReleaseComplete()); |
| 1799 | f_iuh2iu(tx); |
| 1800 | |
Neels Hofmeyr | 6bbfe05 | 2023-03-09 02:51:46 +0100 | [diff] [blame] | 1801 | m := f_pfcp_expect(tr_PFCP_Session_Del_Req(up_f_seid.seid)); |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1802 | PFCP.send(ts_PFCP_Session_Del_Resp(m.sequence_number, hnbgw_f_seid.seid)); |
| 1803 | |
| 1804 | f_sleep(2.0); |
| 1805 | } |
| 1806 | |
Neels Hofmeyr | bacb74f | 2022-08-29 16:24:12 +0200 | [diff] [blame] | 1807 | testcase TC_ps_rab_assignment_with_pfcp() runs on test_CT { |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1808 | var ConnHdlr vc_conn; |
Pau Espin Pedrol | 83a4961 | 2022-09-12 21:11:05 +0200 | [diff] [blame] | 1809 | g_num_hnbs := 1; |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1810 | f_init(); |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1811 | f_sleep(1.0); |
| 1812 | |
Neels Hofmeyr | bacb74f | 2022-08-29 16:24:12 +0200 | [diff] [blame] | 1813 | vc_conn := f_start_handler_with_pars(refers(f_tc_ps_rab_assignment_with_pfcp), t_pars(7, ps_domain := true)); |
| 1814 | vc_conn.done; |
Neels Hofmeyr | 3a9140e | 2023-06-23 04:50:39 +0200 | [diff] [blame] | 1815 | |
| 1816 | f_shutdown_helper(); |
Neels Hofmeyr | bacb74f | 2022-08-29 16:24:12 +0200 | [diff] [blame] | 1817 | } |
| 1818 | |
| 1819 | altstep as_disallow_pfcp() runs on ConnHdlr { |
| 1820 | [] PFCP.receive(PDU_PFCP:?) { |
| 1821 | setverdict(fail, "Received PFCP message, but no PFCP communication expected"); |
| 1822 | mtc.stop; |
| 1823 | } |
| 1824 | } |
| 1825 | |
| 1826 | friend function f_tc_ps_rab_assignment_without_pfcp(charstring id, TestHdlrParams pars) runs on ConnHdlr { |
| 1827 | var RANAP_PDU tx; |
| 1828 | var RANAP_PDU rx; |
| 1829 | timer T := 5.0; |
| 1830 | |
| 1831 | f_init_handler(pars); |
| 1832 | |
| 1833 | f_pfcp_register(); |
| 1834 | activate(as_disallow_pfcp()); |
| 1835 | |
| 1836 | tx := f_build_initial_ue(g_pars); |
| 1837 | f_iuh2iu_connect(tx); |
| 1838 | |
| 1839 | var GtpParameters gtp_pars := valueof(t_GtpParameters); |
| 1840 | var template RAB_SetupOrModifyList rab_sml; |
| 1841 | |
| 1842 | /* Send RAB Assignment Request */ |
| 1843 | rab_sml := ts_RAB_SML_ps(t_RAB_id(23), f_ts_RAB_TLA(gtp_pars.core.remote.addr), gtp_pars.core.remote.teid); |
| 1844 | tx := valueof(ts_RANAP_RabAssReq(rab_sml)); |
| 1845 | BSSAP.send(tx); |
| 1846 | |
| 1847 | /* Expect on Iuh: unmodified RAB Assignment Request */ |
| 1848 | rx := valueof(ts_RANAP_RabAssReq(rab_sml)); |
Neels Hofmeyr | 735b656 | 2023-03-09 02:51:28 +0100 | [diff] [blame] | 1849 | f_rua_expect(rx); |
Neels Hofmeyr | bacb74f | 2022-08-29 16:24:12 +0200 | [diff] [blame] | 1850 | |
| 1851 | /* Send back RAB Assignment Response via Iuh */ |
| 1852 | var template RAB_SetupOrModifiedList rab_smdl; |
| 1853 | rab_smdl := ts_RAB_SMdL_ps(t_RAB_id(23), f_ts_RAB_TLA(gtp_pars.access.remote.addr), |
| 1854 | gtp_pars.access.remote.teid); |
| 1855 | tx := valueof(ts_RANAP_RabAssResp(rab_smdl)); |
| 1856 | RUA.send(tx); |
| 1857 | |
| 1858 | /* Expect on IuPS: unmodified RAB Assignment Response */ |
Neels Hofmeyr | dc416c9 | 2023-03-09 02:47:50 +0100 | [diff] [blame] | 1859 | f_bssap_expect(tr_RANAP_RabAssResp(rab_smdl)); |
Neels Hofmeyr | bacb74f | 2022-08-29 16:24:12 +0200 | [diff] [blame] | 1860 | |
| 1861 | f_sleep(2.0); |
| 1862 | tx := valueof(ts_RANAP_IuReleaseCommand(ts_RanapCause_om_intervention)); |
| 1863 | f_iu2iuh(tx); |
| 1864 | |
| 1865 | tx := valueof(ts_RANAP_IuReleaseComplete()); |
| 1866 | f_iuh2iu(tx); |
| 1867 | |
| 1868 | f_sleep(2.0); |
| 1869 | } |
| 1870 | |
| 1871 | testcase TC_ps_rab_assignment_without_pfcp() runs on test_CT { |
| 1872 | var ConnHdlr vc_conn; |
| 1873 | f_init(); |
Neels Hofmeyr | bacb74f | 2022-08-29 16:24:12 +0200 | [diff] [blame] | 1874 | f_sleep(1.0); |
| 1875 | |
| 1876 | vc_conn := f_start_handler_with_pars(refers(f_tc_ps_rab_assignment_without_pfcp), t_pars(7, ps_domain := true)); |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1877 | vc_conn.done; |
Neels Hofmeyr | 3a9140e | 2023-06-23 04:50:39 +0200 | [diff] [blame] | 1878 | |
| 1879 | f_shutdown_helper(); |
Neels Hofmeyr | a56e8fd | 2022-05-08 01:16:55 +0200 | [diff] [blame] | 1880 | } |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 1881 | |
Neels Hofmeyr | 7d0e680 | 2023-04-20 20:43:55 +0200 | [diff] [blame] | 1882 | /* Default list of counters for a 'cn' entity to test the cnpool feature. */ |
| 1883 | const CounterNameVals counternames_cnpool := { |
| 1884 | { "cnpool:subscr:new", 0 }, |
| 1885 | { "cnpool:subscr:known", 0 }, |
| 1886 | { "cnpool:subscr:reattach", 0 }, |
| 1887 | { "cnpool:subscr:attach_lost", 0 }, |
| 1888 | { "cnpool:subscr:paged", 0 } |
| 1889 | }; |
| 1890 | private function f_ctrs_cn_init(boolean ps_domain, integer cn_count := 0, |
| 1891 | CounterNameVals counternames := counternames_cnpool) runs on test_CT { |
| 1892 | if (ps_domain) { |
| 1893 | g_ctr_cn_node_name := "sgsn"; |
| 1894 | if (cn_count == 0) { |
| 1895 | cn_count := NUM_SGSN; |
| 1896 | } |
| 1897 | } else { |
| 1898 | g_ctr_cn_node_name := "msc"; |
| 1899 | if (cn_count == 0) { |
| 1900 | cn_count := NUM_MSC; |
| 1901 | } |
| 1902 | } |
| 1903 | g_ctr_cn := f_counter_name_vals_get_n(IPA_CTRL, g_ctr_cn_node_name, cn_count, counternames); |
| 1904 | log("initial " & g_ctr_cn_node_name & " rate counters: ", g_ctr_cn); |
| 1905 | } |
| 1906 | |
| 1907 | /* f_ctrs_cn_init(); |
| 1908 | * f_do_thing(on_cn := 0); |
| 1909 | * f_do_thing(on_cn := 0); |
| 1910 | * f_do_other(on_cn := 1); |
| 1911 | * f_ctrs_cn_add(0, "thing", 2); |
| 1912 | * f_ctrs_cn_add(1, "other"); |
| 1913 | * f_ctrs_cn_verify(); |
| 1914 | */ |
| 1915 | private function f_ctrs_cn_verify() runs on test_CT { |
| 1916 | log("verifying", g_ctr_cn_node_name, " rate counters: ", g_ctr_cn); |
| 1917 | f_counter_name_vals_expect_n(IPA_CTRL, g_ctr_cn_node_name, g_ctr_cn); |
| 1918 | } |
| 1919 | |
| 1920 | /* convenience: f_ctrs_cn_add() and f_ctrs_cn_verify() in one call. |
| 1921 | * f_ctrs_cn_init(); |
| 1922 | * f_do_thing(on_cn := 0); |
| 1923 | * f_do_thing(on_cn := 0); |
| 1924 | * f_do_thing(on_cn := 0); |
| 1925 | * f_ctrs_cn_expect(0, "thing", 3); |
| 1926 | */ |
| 1927 | private function f_ctrs_cn_expect(integer cn_nr, charstring countername, integer val := 1) runs on test_CT { |
| 1928 | f_ctrs_cn_add(cn_nr, countername, val); |
| 1929 | f_ctrs_cn_verify(); |
| 1930 | } |
| 1931 | |
| 1932 | private function f_ctrs_cn_add(integer cn_nr, charstring countername, integer val := 1) runs on test_CT { |
| 1933 | f_counter_name_vals_list_add(g_ctr_cn, cn_nr, countername, val); |
| 1934 | } |
| 1935 | |
| 1936 | private function f_perform_compl_l3(octetstring nas, boolean do_clear := true, boolean expect_iu_l3 := true) |
| 1937 | runs on ConnHdlr { |
| 1938 | timer T := 10.0; |
| 1939 | |
| 1940 | /* create an expect on the Iu side for the random NAS portion */ |
| 1941 | if (g_pars.expect_separate_sccp_cr) { |
| 1942 | f_ran_register_sccp_cr_without_payload(); |
| 1943 | } else { |
| 1944 | f_ran_register_exp(nas); |
| 1945 | } |
| 1946 | |
| 1947 | /* send Connect via Iuh (creating a RUA connection) */ |
| 1948 | var RANAP_PDU tx := f_build_initial_ue_with_nas(g_pars, nas); |
| 1949 | RUA.send(RUA_Conn_Req:{g_pars.ps_domain, tx}); |
| 1950 | |
| 1951 | if (expect_iu_l3) { |
| 1952 | /* Expect same message to arrive at CN */ |
| 1953 | f_bssap_expect(tx); |
| 1954 | } |
| 1955 | } |
| 1956 | |
| 1957 | private function f_tc_cnpool_compl_l3(charstring id, TestHdlrParams pars) runs on ConnHdlr { |
| 1958 | f_init_handler(pars); |
| 1959 | f_perform_compl_l3(g_pars.nas_pdu); |
| 1960 | } |
| 1961 | |
| 1962 | private function f_TC_cnpool_compl_l3(boolean ps_domain, octetstring nas_pdu, integer cn_nr, |
| 1963 | template (omit) charstring inc_countername := omit) runs on test_CT { |
| 1964 | var ConnHdlr vc_conn; |
| 1965 | var template (value) TestHdlrParams pars := t_pars(0, ps_domain := ps_domain, cn_nr := cn_nr); |
| 1966 | pars.nas_pdu := nas_pdu; |
| 1967 | log("XXX ", pars); |
| 1968 | vc_conn := f_start_handler_with_pars(refers(f_tc_cnpool_compl_l3), pars); |
| 1969 | vc_conn.done; |
| 1970 | |
| 1971 | if (not istemplatekind(inc_countername, "omit")) { |
| 1972 | f_ctrs_cn_expect(cn_nr, valueof(inc_countername)); |
| 1973 | } |
| 1974 | } |
| 1975 | |
| 1976 | function f_TC_cnpool_compl_l3_list(boolean ps_domain, ro_octetstring compl3, Osmocom_Types.ro_integer cn_nrs, |
| 1977 | charstring inc_countername) runs on test_CT { |
| 1978 | var integer n := lengthof(compl3); |
| 1979 | if (n < lengthof(cn_nrs)) { |
| 1980 | n := lengthof(cn_nrs); |
| 1981 | } |
| 1982 | for (var integer i := 0; i < n; i := i + 1) { |
| 1983 | var integer cn_nr := cn_nrs[i mod lengthof(cn_nrs)]; |
| 1984 | f_TC_cnpool_compl_l3(ps_domain, compl3[i mod lengthof(compl3)], cn_nr, inc_countername); |
| 1985 | } |
| 1986 | } |
| 1987 | |
| 1988 | type enumerated Compl3Type { |
| 1989 | /* CS */ |
| 1990 | LU, |
| 1991 | CMSERV, |
| 1992 | PAGRESP, |
| 1993 | IMSIDETACH, |
| 1994 | |
| 1995 | /* PS */ |
| 1996 | ATTACHREQ, |
| 1997 | RAUREQ, |
| 1998 | DETREQ |
| 1999 | }; |
| 2000 | |
| 2001 | private function f_gen_one_compl_l3(Compl3Type compl3type, template (value) MobileIdentityLV mi, |
| 2002 | integer ps_nri := -1 |
| 2003 | ) return octetstring |
| 2004 | { |
| 2005 | /* CS */ |
| 2006 | if (compl3type == LU) { |
| 2007 | return enc_PDU_ML3_MS_NW(valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(mi), '00F110'O))); |
| 2008 | } |
| 2009 | if (compl3type == CMSERV) { |
| 2010 | return enc_PDU_ML3_MS_NW(valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(mi)))); |
| 2011 | } |
| 2012 | if (compl3type == PAGRESP) { |
| 2013 | return enc_PDU_ML3_MS_NW(valueof(ts_PAG_RESP(valueof(mi)))); |
| 2014 | } |
| 2015 | if (compl3type == IMSIDETACH) { |
| 2016 | return enc_PDU_ML3_MS_NW(valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(mi)))); |
| 2017 | } |
| 2018 | |
| 2019 | /* PS */ |
| 2020 | var template (omit) NetworkResourceIdentifierContainerTLV nri := omit; |
| 2021 | if (ps_nri >= 0) { |
| 2022 | nri := valueof(ts_GMM_NRI(ps_nri)); |
| 2023 | } |
| 2024 | |
| 2025 | if (compl3type == ATTACHREQ) { |
| 2026 | return enc_PDU_L3_MS_SGSN(valueof(ts_GMM_ATTACH_REQ(valueof(mi), f_RAI('001'H, '01'H, '2a2a'O, '17'O), |
| 2027 | nri := nri))); |
| 2028 | } |
| 2029 | if (compl3type == RAUREQ) { |
| 2030 | return enc_PDU_L3_MS_SGSN(valueof(ts_GMM_RAU_REQ(valueof(mi), GPRS_UPD_T_PERIODIC, |
| 2031 | f_RAI('001'H, '01'H, '2a2a'O, '17'O), |
| 2032 | nri := nri))); |
| 2033 | } |
| 2034 | if (compl3type == DETREQ) { |
| 2035 | return enc_PDU_L3_MS_SGSN(valueof(ts_GMM_DET_REQ_MO_mi(c_GMM_DTT_MO_GPRS, power_off := false, |
| 2036 | p_tmsi := valueof(ts_MI_TLV(mi.mobileIdentityV))))); |
| 2037 | } |
| 2038 | |
| 2039 | setverdict(fail, "unknown complete layer 3 type"); |
| 2040 | mtc.stop; |
| 2041 | } |
| 2042 | |
| 2043 | type record of Compl3Type ro_Compl3Type; |
| 2044 | type record of MobileIdentityLV ro_MobileIdentityLV; |
| 2045 | type record of octetstring ro_octetstring; |
| 2046 | |
| 2047 | /* Generate a list of n Complete Layer 3 NAS PDUs, |
| 2048 | * rotating through the message kinds listed in 'types' and the mobile identities in mis. |
| 2049 | */ |
| 2050 | private function f_gen_compl_l3(ro_Compl3Type types, ro_MobileIdentityLV mis, integer n) return ro_octetstring |
| 2051 | { |
| 2052 | var ro_octetstring res := {}; |
| 2053 | for (var integer i := 0; i < n; i := i + 1) { |
| 2054 | var integer ti := i mod lengthof(types); |
| 2055 | var integer mi := i mod lengthof(mis); |
| 2056 | res[i] := f_gen_one_compl_l3(types[ti], mis[mi]); |
| 2057 | } |
| 2058 | return res; |
| 2059 | } |
| 2060 | |
| 2061 | private function f_gen_mi_imsi(integer n) return MobileIdentityLV |
| 2062 | { |
| 2063 | return valueof(ts_MI_IMSI_LV(f_gen_imsi(n))); |
| 2064 | } |
| 2065 | |
| 2066 | private function f_gen_mi_imsis(integer n) return ro_MobileIdentityLV |
| 2067 | { |
| 2068 | var ro_MobileIdentityLV mis := {}; |
| 2069 | for (var integer i := 0; i < n; i := i + 1) { |
| 2070 | mis[i] := f_gen_mi_imsi(n); |
| 2071 | } |
| 2072 | return mis; |
| 2073 | } |
| 2074 | |
| 2075 | function f_vty_set_roundrobin_next(TELNETasp_PT VTY, boolean ps_domain, integer cn_nr) |
| 2076 | { |
| 2077 | var charstring msc_sgsn; |
| 2078 | if (ps_domain) { |
| 2079 | msc_sgsn := "sgsn"; |
| 2080 | } else { |
| 2081 | msc_sgsn := "msc"; |
| 2082 | } |
| 2083 | f_vty_transceive(VTY, "cnpool roundrobin next " & msc_sgsn & " " & int2str(cn_nr)); |
| 2084 | } |
| 2085 | |
| 2086 | private function f_gen_compl3_by_domain(boolean ps_domain, integer n, template (omit) ro_MobileIdentityLV mis := omit) return ro_octetstring{ |
| 2087 | var ro_Compl3Type types; |
| 2088 | if (ps_domain) { |
| 2089 | types := { ATTACHREQ, RAUREQ, DETREQ }; |
| 2090 | } else { |
| 2091 | types := { LU, CMSERV, PAGRESP, IMSIDETACH }; |
| 2092 | } |
| 2093 | if (istemplatekind(mis, "omit")) { |
| 2094 | mis := f_gen_mi_imsis(n); |
| 2095 | } |
| 2096 | return f_gen_compl_l3(types, valueof(mis), n); |
| 2097 | } |
| 2098 | |
| 2099 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 2100 | testcase TC_mscpool_L3Compl_on_1_cnlink() runs on test_CT { |
| 2101 | f_TC_cnpool_L3Compl_on_1_cnlink(ps_domain := false); |
| 2102 | } |
| 2103 | testcase TC_sgsnpool_L3Compl_on_1_cnlink() runs on test_CT { |
| 2104 | f_TC_cnpool_L3Compl_on_1_cnlink(ps_domain := true); |
| 2105 | } |
| 2106 | function f_TC_cnpool_L3Compl_on_1_cnlink(boolean ps_domain) runs on test_CT { |
| 2107 | |
| 2108 | f_init(); |
| 2109 | |
| 2110 | f_ctrs_cn_init(ps_domain := ps_domain); |
| 2111 | |
| 2112 | var ro_octetstring compl3 := f_gen_compl3_by_domain(ps_domain, 4); |
| 2113 | f_TC_cnpool_compl_l3_list(ps_domain, compl3, {0, 0, 0, 0}, "cnpool:subscr:new"); |
| 2114 | |
| 2115 | f_shutdown_helper(); |
| 2116 | } |
| 2117 | |
| 2118 | /* Three Layer 3 Complete by IMSI are round-robin'ed across two connected MSCs */ |
| 2119 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 2120 | f_TC_cnpool_L3Complete_by_imsi_round_robin(ps_domain := false); |
| 2121 | } |
| 2122 | testcase TC_sgsnpool_L3Complete_no_nri_round_robin() runs on test_CT { |
| 2123 | f_TC_cnpool_L3Complete_by_imsi_round_robin(ps_domain := true); |
| 2124 | } |
| 2125 | function f_TC_cnpool_L3Complete_by_imsi_round_robin(boolean ps_domain) runs on test_CT { |
| 2126 | |
| 2127 | f_init(nr_msc := 2, nr_sgsn := 2); |
| 2128 | f_sleep(1.0); |
| 2129 | |
| 2130 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 2131 | * would be randomly affected by which other tests ran before this. */ |
| 2132 | f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0); |
| 2133 | |
| 2134 | f_ctrs_cn_init(ps_domain := ps_domain); |
| 2135 | |
| 2136 | var ro_octetstring compl3 := f_gen_compl3_by_domain(ps_domain, 3); |
| 2137 | |
| 2138 | f_TC_cnpool_compl_l3_list(ps_domain, compl3, |
| 2139 | /* Third Complete Layer 3 wraps back to msc 0 */ |
| 2140 | cn_nrs := {0, 1, 0}, |
| 2141 | inc_countername := "cnpool:subscr:new"); |
| 2142 | |
| 2143 | f_shutdown_helper(); |
| 2144 | } |
| 2145 | |
| 2146 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain a NULL-NRI (0, 1) |
| 2147 | * (configured in osmo-hnbgw.cfg). */ |
| 2148 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 2149 | f_TC_cnpool_LU_by_tmsi_null_nri_N_round_robin(ps_domain := false, nri_val := 0); |
| 2150 | } |
| 2151 | /* For NRI == 1, one of the MSC also has the NULL-NRI as part of its owned NRIs, but the NULL-NRI setting is stronger |
| 2152 | * than that. */ |
| 2153 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 2154 | f_TC_cnpool_LU_by_tmsi_null_nri_N_round_robin(ps_domain := false, nri_val := 1); |
| 2155 | } |
| 2156 | function f_TC_cnpool_LU_by_tmsi_null_nri_N_round_robin(boolean ps_domain, integer nri_val) runs on test_CT { |
| 2157 | |
| 2158 | f_init(nr_msc := 2, nr_sgsn := 2); |
| 2159 | f_sleep(1.0); |
| 2160 | |
| 2161 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 2162 | * would be randomly affected by which other tests ran before this. */ |
| 2163 | f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0); |
| 2164 | |
| 2165 | f_ctrs_cn_init(ps_domain := ps_domain); |
| 2166 | |
| 2167 | var ro_MobileIdentityLV mis := { valueof(ts_MI_TMSI_NRI_LV(nri_val)) }; |
| 2168 | var ro_octetstring compl3; |
| 2169 | if (ps_domain) { |
| 2170 | compl3 := { |
| 2171 | f_gen_one_compl_l3(ATTACHREQ, mis[0], nri_val) |
| 2172 | }; |
| 2173 | } else { |
| 2174 | compl3 := f_gen_compl_l3({LU}, mis, 1); |
| 2175 | } |
| 2176 | |
| 2177 | f_TC_cnpool_compl_l3_list(ps_domain, compl3, |
| 2178 | /* The third Complete Layer 3 wraps back to msc 0 */ |
| 2179 | {0, 1, 0}, |
| 2180 | "cnpool:subscr:reattach"); |
| 2181 | f_shutdown_helper(); |
| 2182 | } |
| 2183 | |
| 2184 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 2185 | * assigned to any MSC (configured in osmo-hnbgw.cfg). */ |
| 2186 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 2187 | f_TC_cnpool_L3Complete_by_tmsi_unassigned_nri_round_robin(ps_domain := false); |
| 2188 | } |
| 2189 | function f_TC_cnpool_L3Complete_by_tmsi_unassigned_nri_round_robin(boolean ps_domain) runs on test_CT { |
| 2190 | |
| 2191 | f_init(nr_msc := 2, nr_sgsn := 2); |
| 2192 | f_sleep(1.0); |
| 2193 | |
| 2194 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 2195 | * would be randomly affected by which other tests ran before this. */ |
| 2196 | f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0); |
| 2197 | |
| 2198 | f_ctrs_cn_init(ps_domain := ps_domain); |
| 2199 | |
| 2200 | /* 3 NRIs that are not assigned to any MSC */ |
| 2201 | var ro_MobileIdentityLV mis := { |
| 2202 | valueof(ts_MI_TMSI_NRI_LV(1000)), |
| 2203 | valueof(ts_MI_TMSI_NRI_LV(768)), |
| 2204 | valueof(ts_MI_TMSI_NRI_LV(819)) |
| 2205 | }; |
| 2206 | |
| 2207 | var ro_octetstring compl3 := f_gen_compl3_by_domain(ps_domain, 3, mis); |
| 2208 | f_TC_cnpool_compl_l3_list(ps_domain, compl3, { 0, 1, 0 }, "cnpool:subscr:new"); |
| 2209 | |
| 2210 | f_shutdown_helper(); |
| 2211 | } |
| 2212 | |
| 2213 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 2214 | * assigned to a CN link that is currently not connected (configured in osmo-hnbgw.cfg). */ |
| 2215 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 2216 | f_TC_cnpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin(ps_domain := false); |
| 2217 | } |
| 2218 | function f_TC_cnpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin(boolean ps_domain) runs on test_CT { |
| 2219 | |
| 2220 | f_init(nr_msc := 2, nr_sgsn := 2); |
| 2221 | f_sleep(1.0); |
| 2222 | |
| 2223 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 2224 | * would be randomly affected by which other tests ran before this. */ |
| 2225 | f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0); |
| 2226 | |
| 2227 | f_ctrs_cn_init(ps_domain := ps_domain); |
| 2228 | |
| 2229 | /* 3 NRIs that are assigned to an unconnected MSC */ |
| 2230 | var ro_MobileIdentityLV mis := { |
| 2231 | valueof(ts_MI_TMSI_NRI_LV(512)), |
| 2232 | valueof(ts_MI_TMSI_NRI_LV(767)), |
| 2233 | valueof(ts_MI_TMSI_NRI_LV(750)) |
| 2234 | }; |
| 2235 | |
| 2236 | var ro_octetstring compl3 := f_gen_compl3_by_domain(ps_domain, 3, mis); |
| 2237 | |
| 2238 | f_TC_cnpool_compl_l3(ps_domain, compl3[0], cn_nr := 0); |
| 2239 | f_ctrs_cn_add(2, "cnpool:subscr:attach_lost"); |
| 2240 | f_ctrs_cn_add(0, "cnpool:subscr:new"); |
| 2241 | f_ctrs_cn_verify(); |
| 2242 | |
| 2243 | f_TC_cnpool_compl_l3(ps_domain, compl3[1], cn_nr := 1); |
| 2244 | f_ctrs_cn_add(2, "cnpool:subscr:attach_lost"); |
| 2245 | f_ctrs_cn_add(1, "cnpool:subscr:new"); |
| 2246 | f_ctrs_cn_verify(); |
| 2247 | |
| 2248 | f_TC_cnpool_compl_l3(ps_domain, compl3[2], cn_nr := 0); |
| 2249 | f_ctrs_cn_add(2, "cnpool:subscr:attach_lost"); |
| 2250 | f_ctrs_cn_add(0, "cnpool:subscr:new"); |
| 2251 | f_ctrs_cn_verify(); |
| 2252 | |
| 2253 | f_shutdown_helper(); |
| 2254 | } |
| 2255 | |
| 2256 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 2257 | * osmo-hnbgw.cfg). */ |
| 2258 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 2259 | f_TC_cnpool_L3Complete_valid_nri_1(ps_domain := false); |
| 2260 | } |
| 2261 | testcase TC_sgsnpool_L3Complete_valid_nri_1() runs on test_CT { |
| 2262 | f_TC_cnpool_L3Complete_valid_nri_1(ps_domain := true); |
| 2263 | } |
| 2264 | function f_TC_cnpool_L3Complete_valid_nri_1(boolean ps_domain) runs on test_CT { |
| 2265 | |
| 2266 | f_init(nr_msc := 2, nr_sgsn := 2); |
| 2267 | f_sleep(1.0); |
| 2268 | |
| 2269 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 2270 | * this is not using round-robin. */ |
| 2271 | f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0); |
| 2272 | |
| 2273 | f_ctrs_cn_init(ps_domain := ps_domain); |
| 2274 | |
| 2275 | var ro_octetstring compl3; |
| 2276 | |
| 2277 | /* 3 NRIs of the second MSC's range (256-511) */ |
| 2278 | var ro_MobileIdentityLV mis := { |
| 2279 | valueof(ts_MI_TMSI_NRI_LV(256)), |
| 2280 | valueof(ts_MI_TMSI_NRI_LV(260)), |
| 2281 | valueof(ts_MI_TMSI_NRI_LV(511)) |
| 2282 | }; |
| 2283 | if (ps_domain) { |
| 2284 | compl3 := { |
| 2285 | f_gen_one_compl_l3(RAUREQ, mis[0], 256), |
| 2286 | f_gen_one_compl_l3(RAUREQ, mis[1], 260), |
| 2287 | f_gen_one_compl_l3(RAUREQ, mis[2], 511) |
| 2288 | }; |
| 2289 | } else { |
| 2290 | compl3 := f_gen_compl3_by_domain(ps_domain, 3, mis); |
| 2291 | } |
| 2292 | |
| 2293 | f_TC_cnpool_compl_l3_list(ps_domain, compl3, {1, 1, 1}, "cnpool:subscr:known"); |
| 2294 | |
| 2295 | f_shutdown_helper(); |
| 2296 | } |
| 2297 | |
| 2298 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-hnbgw.cfg), |
| 2299 | * while a round-robin remains unaffected by that. */ |
| 2300 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 2301 | f_TC_cnpool_L3Complete_valid_nri_2(ps_domain := false); |
| 2302 | } |
| 2303 | testcase TC_sgsnpool_L3Complete_valid_nri_2() runs on test_CT { |
| 2304 | f_TC_cnpool_L3Complete_valid_nri_2(ps_domain := true); |
| 2305 | } |
| 2306 | function f_TC_cnpool_L3Complete_valid_nri_2(boolean ps_domain) runs on test_CT { |
| 2307 | |
| 2308 | f_init(nr_msc := 3, nr_sgsn := 3); |
| 2309 | f_sleep(1.0); |
| 2310 | |
| 2311 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 2312 | * this is not using round-robin. */ |
| 2313 | f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 1); |
| 2314 | |
| 2315 | f_ctrs_cn_init(ps_domain := ps_domain); |
| 2316 | |
| 2317 | var ro_octetstring compl3; |
| 2318 | |
| 2319 | /* 2 NRIs of the third MSC's range (512-767) */ |
| 2320 | var ro_MobileIdentityLV mis := { |
| 2321 | valueof(ts_MI_TMSI_NRI_LV(512)), |
| 2322 | valueof(ts_MI_TMSI_NRI_LV(678)) |
| 2323 | }; |
| 2324 | if (ps_domain) { |
| 2325 | compl3 := { |
| 2326 | f_gen_one_compl_l3(ATTACHREQ, mis[0], 512), |
| 2327 | f_gen_one_compl_l3(ATTACHREQ, mis[1], 678) |
| 2328 | }; |
| 2329 | } else { |
| 2330 | compl3 := f_gen_compl3_by_domain(ps_domain, 2, mis); |
| 2331 | } |
| 2332 | |
| 2333 | f_TC_cnpool_compl_l3_list(ps_domain, compl3, {2, 2}, "cnpool:subscr:known"); |
| 2334 | |
| 2335 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 2336 | f_TC_cnpool_compl_l3_list(ps_domain, f_gen_compl3_by_domain(ps_domain, 1), {1}, "cnpool:subscr:new"); |
| 2337 | |
| 2338 | f_shutdown_helper(); |
| 2339 | } |
| 2340 | |
| 2341 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 2342 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 2343 | f_TC_cnpool_nri_from_other_PLMN(ps_domain := false); |
| 2344 | } |
| 2345 | testcase TC_sgsnpool_nri_from_other_PLMN() runs on test_CT { |
| 2346 | f_TC_cnpool_nri_from_other_PLMN(ps_domain := true); |
| 2347 | } |
| 2348 | function f_TC_cnpool_nri_from_other_PLMN(boolean ps_domain) runs on test_CT { |
| 2349 | |
| 2350 | f_init(nr_msc := 3, nr_sgsn := 3); |
| 2351 | f_sleep(1.0); |
| 2352 | |
| 2353 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 2354 | * instead, and hits msc 0. */ |
| 2355 | f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0); |
| 2356 | |
| 2357 | f_ctrs_cn_init(ps_domain := ps_domain); |
| 2358 | |
| 2359 | var ro_octetstring compl3; |
| 2360 | |
| 2361 | var ro_MobileIdentityLV mis := { |
| 2362 | valueof(ts_MI_TMSI_NRI_LV(260)), |
| 2363 | valueof(ts_MI_TMSI_NRI_LV(555)) |
| 2364 | }; |
| 2365 | if (ps_domain) { |
| 2366 | compl3 := { |
| 2367 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-hnbgw.cfg */ |
| 2368 | enc_PDU_L3_MS_SGSN(valueof(ts_GMM_ATTACH_REQ(mis[0], f_RAI('999'H, '99'H, '2a2a'O, |
| 2369 | '17'O), |
| 2370 | nri := ts_GMM_NRI(260) |
| 2371 | ))), |
| 2372 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 2373 | f_gen_one_compl_l3(ATTACHREQ, mis[1], 555) |
| 2374 | } |
| 2375 | } else { |
| 2376 | compl3 := { |
| 2377 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-hnbgw.cfg */ |
| 2378 | enc_PDU_ML3_MS_NW(valueof(ts_LU_REQ(LU_Type_IMSI_Attach, mis[0], '99F999'O))), |
| 2379 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 2380 | enc_PDU_ML3_MS_NW(valueof(ts_LU_REQ(LU_Type_IMSI_Attach, mis[1], '00F110'O))) |
| 2381 | }; |
| 2382 | } |
| 2383 | |
| 2384 | /* Foreign NRI: roundrobin */ |
| 2385 | f_TC_cnpool_compl_l3(ps_domain, compl3[0], cn_nr := 0, inc_countername := "cnpool:subscr:new"); |
| 2386 | |
| 2387 | /* Local NRI: matching msc */ |
| 2388 | f_TC_cnpool_compl_l3(ps_domain, compl3[1], cn_nr := 2, inc_countername := "cnpool:subscr:known"); |
| 2389 | |
| 2390 | f_shutdown_helper(); |
| 2391 | } |
| 2392 | |
Neels Hofmeyr | b1bf16d | 2023-06-27 02:10:04 +0200 | [diff] [blame] | 2393 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 2394 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 2395 | friend function f_tc_mscpool_paging_imsi(charstring id, TestHdlrParams pars) runs on ConnHdlr { |
| 2396 | f_init_handler(pars); |
| 2397 | |
| 2398 | var hexstring imsi := '001010000000123'H; |
| 2399 | var RANAP_IEs.CN_DomainIndicator domain_ind; |
| 2400 | if (pars.ps_domain) { |
| 2401 | domain_ind := ps_domain; |
| 2402 | } else { |
| 2403 | domain_ind := cs_domain; |
| 2404 | } |
| 2405 | var template (value) RANAP_PDU paging := ts_RANAP_Paging(domain_ind, imsi_hex2oct(imsi)); |
| 2406 | BSSAP.send(ts_RANAP_UNITDATA_req(pars.sccp_addr_hnbgw, pars.sccp_addr_msc, paging)); |
| 2407 | /* TODO: Expect RUA ConnectionlessTransfer Paging (on all HNB). |
| 2408 | * We could verify the Paging sent from osmo-hnbgw to RUA with some effort, |
| 2409 | * but, this test does not care whether the Paging was forwarded to RUA or not, only that osmo-hnbgw *received* |
| 2410 | * the Paging. In the CN pool decisions, osmo-hnbgw should match up Paging Response to an earlier Paging. |
| 2411 | */ |
| 2412 | |
| 2413 | f_sleep(1.0); |
| 2414 | |
| 2415 | /* Despite the round robin pointing at the second MSC ('roundrobin next msc 1'), the earlier Paging for the same IMSI |
| 2416 | * causes this Paging Response to go to the first MSC ('msc 0'). */ |
| 2417 | f_perform_compl_l3(f_gen_one_compl_l3(PAGRESP, ts_MI_IMSI_LV(imsi))); |
| 2418 | f_sleep(1.0); |
| 2419 | } |
| 2420 | |
| 2421 | testcase TC_mscpool_paging_imsi() runs on test_CT { |
| 2422 | f_init(nr_msc := 3); |
| 2423 | f_sleep(1.0); |
| 2424 | |
| 2425 | var boolean ps_domain := false; |
| 2426 | |
| 2427 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 2428 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 2429 | f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0); |
| 2430 | |
| 2431 | f_ctrs_cn_init(ps_domain := ps_domain); |
| 2432 | |
| 2433 | var ConnHdlr vc_conn1; |
| 2434 | var template (value) TestHdlrParams pars1 := t_pars(0, ps_domain := ps_domain, cn_nr := 0); |
| 2435 | pars1.sccp_addr_hnbgw := g_cn[valueof(pars1.cn_idx)].sccp_addr_peer; |
| 2436 | pars1.sccp_addr_msc := g_cn[valueof(pars1.cn_idx)].sccp_addr_own; |
| 2437 | vc_conn1 := f_start_handler_with_pars(refers(f_tc_mscpool_paging_imsi), pars1); |
| 2438 | vc_conn1.done; |
| 2439 | f_ctrs_cn_expect(0, "cnpool:subscr:paged"); |
| 2440 | f_shutdown_helper(); |
| 2441 | } |
| 2442 | |
| 2443 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 2444 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 2445 | friend function f_tc_mscpool_paging_tmsi(charstring id, TestHdlrParams pars) runs on ConnHdlr { |
| 2446 | f_init_handler(pars); |
| 2447 | |
| 2448 | var hexstring imsi := '001010000000124'H; |
| 2449 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
| 2450 | var octetstring tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v); |
| 2451 | |
| 2452 | var RANAP_IEs.CN_DomainIndicator domain_ind; |
| 2453 | if (pars.ps_domain) { |
| 2454 | domain_ind := ps_domain; |
| 2455 | } else { |
| 2456 | domain_ind := cs_domain; |
| 2457 | } |
| 2458 | var template (value) RANAP_PDU paging := ts_RANAP_Paging_temp_id(domain_ind, imsi_hex2oct(imsi), |
| 2459 | ts_RANAP_TemporaryUE_ID_TMSI(tmsi)); |
| 2460 | BSSAP.send(ts_RANAP_UNITDATA_req(pars.sccp_addr_hnbgw, pars.sccp_addr_msc, paging)); |
| 2461 | /* TODO: Expect RUA ConnectionlessTransfer Paging (on all HNB). |
| 2462 | * We could verify the Paging sent from osmo-hnbgw to RUA with some effort, |
| 2463 | * but, this test does not care whether the Paging was forwarded to RUA or not, only that osmo-hnbgw *received* |
| 2464 | * the Paging. In the CN pool decisions, osmo-hnbgw should match up Paging Response to an earlier Paging. |
| 2465 | */ |
| 2466 | |
| 2467 | f_sleep(1.0); |
| 2468 | |
| 2469 | /* Despite the round robin pointing at the third MSC ('roundrobin next msc 2'), the earlier Paging for the same |
| 2470 | * TMSI causes this Paging Response to go to the first MSC ('msc 0'). */ |
| 2471 | f_perform_compl_l3(f_gen_one_compl_l3(PAGRESP, ts_MI_TMSI_NRI_LV(nri_v))); |
| 2472 | f_sleep(1.0); |
| 2473 | } |
| 2474 | testcase TC_mscpool_paging_tmsi() runs on test_CT { |
| 2475 | f_init(nr_msc := 3); |
| 2476 | f_sleep(1.0); |
| 2477 | |
| 2478 | var boolean ps_domain := false; |
| 2479 | |
| 2480 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 2481 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 2482 | f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0); |
| 2483 | |
| 2484 | f_ctrs_cn_init(ps_domain := ps_domain); |
| 2485 | |
| 2486 | var ConnHdlr vc_conn1; |
| 2487 | var template (value) TestHdlrParams pars1 := t_pars(0, ps_domain := ps_domain, cn_nr := 0); |
| 2488 | pars1.sccp_addr_hnbgw := g_cn[valueof(pars1.cn_idx)].sccp_addr_peer; |
| 2489 | pars1.sccp_addr_msc := g_cn[valueof(pars1.cn_idx)].sccp_addr_own; |
| 2490 | vc_conn1 := f_start_handler_with_pars(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 2491 | vc_conn1.done; |
| 2492 | f_ctrs_cn_expect(0, "cnpool:subscr:paged"); |
| 2493 | f_shutdown_helper(); |
| 2494 | } |
| 2495 | |
Neels Hofmeyr | 7d0e680 | 2023-04-20 20:43:55 +0200 | [diff] [blame] | 2496 | /* For round-robin, skip a CN link that has 'no allow-attach' set. */ |
| 2497 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 2498 | |
| 2499 | f_init(nr_msc := 3); |
| 2500 | f_sleep(1.0); |
| 2501 | |
| 2502 | var boolean ps_domain := false; |
| 2503 | |
| 2504 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 2505 | f_vty_cnlink_allow_attach(HNBGWVTY, ps_domain, {true, false, true}); |
| 2506 | |
| 2507 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 2508 | * would be randomly affected by which other tests ran before this. */ |
| 2509 | f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0); |
| 2510 | |
| 2511 | f_ctrs_cn_init(ps_domain := ps_domain); |
| 2512 | |
| 2513 | f_TC_cnpool_compl_l3_list(ps_domain, f_gen_compl3_by_domain(ps_domain, 3), |
| 2514 | /* msc 1 is skipped */ |
| 2515 | {0, 2, 0}, |
| 2516 | "cnpool:subscr:new"); |
| 2517 | |
| 2518 | f_shutdown_helper(); |
| 2519 | } |
| 2520 | |
| 2521 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 2522 | * TMSI NRI. */ |
| 2523 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 2524 | |
| 2525 | f_init(nr_msc := 3); |
| 2526 | f_sleep(1.0); |
| 2527 | |
| 2528 | var boolean ps_domain := false; |
| 2529 | |
| 2530 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 2531 | f_vty_cnlink_allow_attach(HNBGWVTY, ps_domain, {true, false, true}); |
| 2532 | |
| 2533 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 2534 | * would be randomly affected by which other tests ran before this. */ |
| 2535 | f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0); |
| 2536 | |
| 2537 | f_ctrs_cn_init(ps_domain := ps_domain); |
| 2538 | |
| 2539 | var ro_MobileIdentityLV mis := { |
| 2540 | valueof(ts_MI_TMSI_NRI_LV(260)), |
| 2541 | valueof(ts_MI_IMSI_LV('001010000000002'H)), |
| 2542 | valueof(ts_MI_IMSI_LV('001010000000003'H)) |
| 2543 | }; |
| 2544 | |
| 2545 | var ro_octetstring compl3 := f_gen_compl3_by_domain(ps_domain, 3, mis); |
| 2546 | |
| 2547 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 2548 | f_TC_cnpool_compl_l3(ps_domain, compl3[0], cn_nr := 1, inc_countername := "cnpool:subscr:known"); |
| 2549 | |
| 2550 | /* Normal round robin skips msc 1, because it has 'no allow-attach' */ |
| 2551 | f_TC_cnpool_compl_l3(ps_domain, compl3[1], cn_nr := 0, inc_countername := "cnpool:subscr:new"); |
| 2552 | f_TC_cnpool_compl_l3(ps_domain, compl3[2], cn_nr := 2, inc_countername := "cnpool:subscr:new"); |
| 2553 | |
| 2554 | f_shutdown_helper(); |
| 2555 | } |
| 2556 | |
| 2557 | /* When a peer point-code gets an SCCP N-PCSTATE saying it is unreachable, immediately mark the CN link as unusable. */ |
| 2558 | testcase TC_mscpool_sccp_n_pcstate_detaches_cnlink() runs on test_CT { |
| 2559 | f_TC_cnpool_sccp_n_pcstate_detaches_cnlink(ps_domain := false); |
| 2560 | } |
| 2561 | testcase TC_sgsnpool_sccp_n_pcstate_detaches_cnlink() runs on test_CT { |
| 2562 | f_TC_cnpool_sccp_n_pcstate_detaches_cnlink(ps_domain := true); |
| 2563 | } |
| 2564 | function f_TC_cnpool_sccp_n_pcstate_detaches_cnlink(boolean ps_domain) runs on test_CT |
| 2565 | { |
| 2566 | |
| 2567 | f_init(nr_msc := 2, nr_sgsn := 2); |
| 2568 | f_sleep(1.0); |
| 2569 | |
| 2570 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 2571 | * would be randomly affected by which other tests ran before this. */ |
| 2572 | f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0); |
| 2573 | |
| 2574 | f_ctrs_cn_init(ps_domain := ps_domain); |
| 2575 | |
| 2576 | var ro_octetstring compl3 := f_gen_compl3_by_domain(ps_domain, 3); |
| 2577 | |
| 2578 | f_TC_cnpool_compl_l3(ps_domain, compl3[0], cn_nr := 0, inc_countername := "cnpool:subscr:new"); |
| 2579 | f_TC_cnpool_compl_l3(ps_domain, compl3[1], cn_nr := 1, inc_countername := "cnpool:subscr:new"); |
| 2580 | |
| 2581 | f_logp(HNBGWVTY, "disconnecting msc0"); |
| 2582 | f_cn_idx_disconnect(f_cn_idx(ps_domain, 0)); |
| 2583 | |
| 2584 | /* Now round-robin would wrap to the first MSC, but since the first MSC is disconnected, it wraps around to the |
| 2585 | * second. */ |
| 2586 | f_TC_cnpool_compl_l3(ps_domain, compl3[2], cn_nr := 1, inc_countername := "cnpool:subscr:new"); |
| 2587 | |
| 2588 | f_shutdown_helper(); |
| 2589 | } |
| 2590 | |
| 2591 | /* When a CN link point-code gets an SCCP N-PCSTATE saying it is now reachable, immediately trigger RESET and bring up the |
| 2592 | * MSC. */ |
| 2593 | testcase TC_mscpool_sccp_n_pcstate_attaches_cnlink() runs on test_CT { |
| 2594 | f_TC_cnpool_sccp_n_pcstate_attaches_cnlink(ps_domain := false); |
| 2595 | } |
| 2596 | testcase TC_sgsnpool_sccp_n_pcstate_attaches_cnlink() runs on test_CT { |
| 2597 | f_TC_cnpool_sccp_n_pcstate_attaches_cnlink(ps_domain := true); |
| 2598 | } |
| 2599 | function f_TC_cnpool_sccp_n_pcstate_attaches_cnlink(boolean ps_domain) runs on test_CT |
| 2600 | { |
| 2601 | f_init(nr_msc := 1, nr_sgsn := 1); |
| 2602 | f_sleep(1.0); |
| 2603 | |
| 2604 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 2605 | * would be randomly affected by which other tests ran before this. */ |
| 2606 | f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0); |
| 2607 | |
| 2608 | var ro_octetstring compl3 := f_gen_compl3_by_domain(ps_domain, 3); |
| 2609 | |
| 2610 | f_ctrs_cn_init(ps_domain := ps_domain); |
| 2611 | |
| 2612 | /* There is only one MSC, round robin stays on msc0 */ |
| 2613 | f_TC_cnpool_compl_l3(ps_domain := ps_domain, nas_pdu := compl3[0], cn_nr := 0, inc_countername := "cnpool:subscr:new"); |
| 2614 | f_TC_cnpool_compl_l3(ps_domain := ps_domain, nas_pdu := compl3[1], cn_nr := 0, inc_countername := "cnpool:subscr:new"); |
| 2615 | |
| 2616 | f_logp(HNBGWVTY, "connecting cnlink 1"); |
| 2617 | f_cn_nr_init(ps_domain, 1); |
| 2618 | f_vty_cnlink_allow_attach(HNBGWVTY, ps_domain, { true, true }); |
| 2619 | f_sleep(1.0); |
| 2620 | |
| 2621 | /* This time round-robin wraps to the second MSC, because it is now online. */ |
| 2622 | f_TC_cnpool_compl_l3(ps_domain := ps_domain, nas_pdu := compl3[2], cn_nr := 1, inc_countername := "cnpool:subscr:new"); |
| 2623 | |
| 2624 | f_shutdown_helper(); |
| 2625 | } |
| 2626 | |
Neels Hofmeyr | d019cc0 | 2023-06-02 16:31:23 +0200 | [diff] [blame] | 2627 | private function f_vty_add_sccp_addr(TELNETasp_PT pt, charstring addr_name, charstring pc, integer cs7_nr := 0) |
| 2628 | { |
| 2629 | f_vty_enter_config(pt); |
| 2630 | f_vty_transceive(pt, "cs7 instance 0"); |
| 2631 | f_vty_transceive(pt, "sccp-address " & addr_name); |
| 2632 | f_vty_transceive(pt, "point-code " & pc); |
| 2633 | f_vty_transceive(pt, "end"); |
| 2634 | } |
| 2635 | |
| 2636 | private function f_vty_set_cnlink_addr(TELNETasp_PT pt, charstring cnlink_and_nr, charstring addr_name) |
| 2637 | { |
| 2638 | f_vty_enter_config(pt); |
| 2639 | f_vty_transceive(pt, cnlink_and_nr); |
| 2640 | f_vty_transceive(pt, "remote-addr " & addr_name); |
| 2641 | f_vty_transceive(pt, "end"); |
| 2642 | } |
| 2643 | |
| 2644 | private function f_vty_apply_sccp(TELNETasp_PT pt) |
| 2645 | { |
| 2646 | f_vty_enter_config(pt); |
| 2647 | f_vty_transceive(pt, "apply sccp"); |
| 2648 | f_vty_transceive(pt, "end"); |
| 2649 | } |
| 2650 | |
| 2651 | template (present) RUA_Disc_Req tr_RUA_Disc_Req := { |
| 2652 | ranap := ?, |
| 2653 | cause := ? |
| 2654 | }; |
| 2655 | |
| 2656 | /* With a cnlink up, change the SCCP address, and verify that it restarts upon vty 'apply sccp' */ |
| 2657 | private function f_tc_apply_sccp(charstring id, TestHdlrParams pars) runs on ConnHdlr |
| 2658 | { |
| 2659 | f_init_handler(pars); |
| 2660 | f_perform_compl_l3(f_gen_compl3_by_domain(pars.ps_domain, 1)[0]); |
| 2661 | |
| 2662 | f_sleep(1.0); |
| 2663 | f_logp(HNBGWVTY, "Changing SCCP address, don't apply yet"); |
| 2664 | |
| 2665 | f_vty_add_sccp_addr(HNBGWVTY, "msc-foo", "0.42.4"); |
| 2666 | f_vty_set_cnlink_addr(HNBGWVTY, "msc 0", "msc-foo"); |
| 2667 | |
| 2668 | /* No effect yet, link still open both ways */ |
| 2669 | f_sleep(1.0); |
| 2670 | f_iuh2iu(ts_RANAP_DirectTransfer(f_rnd_octstring(10))); |
| 2671 | f_iu2iuh(ts_RANAP_DirectTransfer(f_rnd_octstring(10))); |
| 2672 | |
| 2673 | f_logp(HNBGWVTY, "Apply SCCP address changes"); |
| 2674 | f_vty_apply_sccp(HNBGWVTY); |
| 2675 | |
| 2676 | /* We modified the SCCP configuration, expect disconnect of UE that was active on the aborted link. */ |
| 2677 | RUA.receive(RUA_Disc_Ind:?); |
| 2678 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_IND); |
| 2679 | |
| 2680 | /* Would be nice to test reconnection on the other point-code, too. That would require another cnlink in |
| 2681 | * osmo-stp.cfg and module parameters... */ |
| 2682 | |
| 2683 | f_sleep(1.0); |
| 2684 | } |
| 2685 | testcase TC_apply_sccp() runs on test_CT |
| 2686 | { |
| 2687 | f_init(); |
| 2688 | f_sleep(1.0); |
| 2689 | |
| 2690 | var ConnHdlr vc_conn; |
| 2691 | var template (value) TestHdlrParams pars := t_pars(0); |
| 2692 | vc_conn := f_start_handler_with_pars(refers(f_tc_apply_sccp), pars); |
| 2693 | vc_conn.done; |
| 2694 | |
| 2695 | f_shutdown_helper(); |
| 2696 | } |
| 2697 | |
Neels Hofmeyr | c3c01d3 | 2023-11-07 02:19:00 +0100 | [diff] [blame] | 2698 | /* In the field, we encountered a "normal" RAB Assignment that concludes successfully, followed by another RAB |
| 2699 | * Assignment that has different SDU subflow parameters, and does not contain RTP information. At the time of writing, |
| 2700 | * it seems that the second RAB Assignment causes a crash. Play through this scenario. */ |
| 2701 | friend function f_tc_second_rab_assignment(charstring id, TestHdlrParams pars) runs on ConnHdlr { |
| 2702 | var MgcpCommand mgcp_cmd; |
| 2703 | var RANAP_PDU tx; |
| 2704 | timer T := 5.0; |
| 2705 | |
| 2706 | f_init_handler(pars); |
| 2707 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 2708 | |
| 2709 | tx := f_build_initial_ue(g_pars); |
| 2710 | f_iuh2iu_connect(tx); |
| 2711 | |
| 2712 | f_create_rab(pars.mgcp_pars); |
| 2713 | |
| 2714 | /* Now send a second RAB Assignment with different subflows and omitting transportLayerInformation. (Assuming |
| 2715 | * the first RAB Assignment's transportLayerInformation remains in use unchanged.) */ |
| 2716 | var template RAB_SetupOrModifyList rab_sml; |
| 2717 | rab_sml := ts_RAB_SML2(t_RAB_id(23), |
| 2718 | ts_RabParams, |
| 2719 | user_plane_info := omit, |
| 2720 | transport_layer_info := omit); |
| 2721 | tx := valueof(ts_RANAP_RabAssReq(rab_sml)); |
| 2722 | BSSAP.send(tx); |
| 2723 | T.start; |
| 2724 | |
| 2725 | /* Expect this secondary RAB Assignment to go through unchanged. */ |
| 2726 | f_rua_expect(tx); |
| 2727 | |
| 2728 | /* I'm guessing that the RAB Assignment Response also omits transportLayerInformation, so far not known because |
| 2729 | * osmo-hnbgw crashed before we could receive the response. */ |
| 2730 | |
| 2731 | /* Send back RAB Assignment Response via Iuh */ |
| 2732 | var template RAB_SetupOrModifiedList rab_smdl; |
| 2733 | rab_smdl := ts_RAB_SMdL_no_tla(t_RAB_id(23)); |
| 2734 | tx := valueof(ts_RANAP_RabAssResp(rab_smdl)); |
| 2735 | RUA.send(tx); |
| 2736 | f_bssap_expect(tx); |
| 2737 | |
| 2738 | /* Send Iu Release */ |
| 2739 | tx := valueof(ts_RANAP_IuReleaseCommand(ts_RanapCause_om_intervention)); |
| 2740 | f_iu2iuh(tx); |
| 2741 | |
| 2742 | T.start; |
| 2743 | alt { |
| 2744 | [] as_mgcp_dlcx(pars) {} |
| 2745 | [] T.timeout { |
| 2746 | setverdict(fail, "Timeout waiting for DLCX"); |
| 2747 | } |
| 2748 | } |
| 2749 | |
| 2750 | tx := valueof(ts_RANAP_IuReleaseComplete()); |
| 2751 | f_iuh2iu(tx); |
| 2752 | } |
| 2753 | |
| 2754 | testcase TC_second_rab_assignment() runs on test_CT { |
| 2755 | var ConnHdlr vc_conn; |
| 2756 | g_num_hnbs := 1; |
| 2757 | f_init(); |
| 2758 | |
| 2759 | vc_conn := f_start_handler_with_pars(refers(f_tc_second_rab_assignment), t_pars(3)); |
| 2760 | vc_conn.done; |
| 2761 | |
| 2762 | f_shutdown_helper(); |
| 2763 | } |
| 2764 | |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 2765 | control { |
| 2766 | execute(TC_hnb_register()); |
Daniel Willmann | c79679a | 2022-08-23 17:48:39 +0200 | [diff] [blame] | 2767 | execute(TC_hnb_register_duplicate()); |
Pau Espin Pedrol | acf4f22 | 2022-09-27 14:33:40 +0200 | [diff] [blame] | 2768 | execute(TC_hnb_register_duplicate_reuse_sctp_assoc()); |
Harald Welte | af3e216 | 2024-03-27 21:54:20 +0100 | [diff] [blame^] | 2769 | execute(TC_ue_register()); |
| 2770 | execute(TC_ue_register_before_hnb_register()); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 2771 | execute(TC_ranap_cs_initial_ue()); |
| 2772 | execute(TC_ranap_ps_initial_ue()); |
Neels Hofmeyr | f0b9ed1 | 2022-06-07 17:46:32 +0200 | [diff] [blame] | 2773 | execute(TC_ranap_cs_initial_ue_empty_cr()); |
| 2774 | execute(TC_ranap_ps_initial_ue_empty_cr()); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 2775 | execute(TC_ranap_cs_bidir()); |
| 2776 | execute(TC_ranap_ps_bidir()); |
| 2777 | execute(TC_rab_assignment()); |
| 2778 | execute(TC_rab_release()); |
Daniel Willmann | 3e15b7b | 2022-02-21 17:07:02 +0100 | [diff] [blame] | 2779 | execute(TC_rab_assign_fail()); |
Daniel Willmann | 37c877f | 2022-02-22 16:47:06 +0100 | [diff] [blame] | 2780 | execute(TC_rab_assign_mgcp_to()); |
Pau Espin Pedrol | af74650 | 2023-11-29 16:18:28 +0100 | [diff] [blame] | 2781 | execute(TC_rab_assign_mgw_iuup_addr_chg()); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 2782 | execute(TC_ranap_cs_mo_disconnect()); |
| 2783 | execute(TC_ranap_ps_mo_disconnect()); |
Neels Hofmeyr | bacb74f | 2022-08-29 16:24:12 +0200 | [diff] [blame] | 2784 | |
| 2785 | if (mp_enable_pfcp_tests) { |
| 2786 | execute(TC_ps_rab_assignment_with_pfcp()); |
| 2787 | } else { |
| 2788 | execute(TC_ps_rab_assignment_without_pfcp()); |
| 2789 | } |
Pau Espin Pedrol | f0b9fa0 | 2022-09-12 13:31:07 +0200 | [diff] [blame] | 2790 | |
Neels Hofmeyr | 7d0e680 | 2023-04-20 20:43:55 +0200 | [diff] [blame] | 2791 | execute( TC_mscpool_L3Compl_on_1_cnlink() ); |
| 2792 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 2793 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 2794 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 2795 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 2796 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 2797 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 2798 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 2799 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
Neels Hofmeyr | b1bf16d | 2023-06-27 02:10:04 +0200 | [diff] [blame] | 2800 | execute( TC_mscpool_paging_imsi() ); |
| 2801 | execute( TC_mscpool_paging_tmsi() ); |
Neels Hofmeyr | 7d0e680 | 2023-04-20 20:43:55 +0200 | [diff] [blame] | 2802 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 2803 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
| 2804 | execute( TC_mscpool_sccp_n_pcstate_detaches_cnlink() ); |
| 2805 | execute( TC_mscpool_sccp_n_pcstate_attaches_cnlink() ); |
| 2806 | |
| 2807 | execute( TC_sgsnpool_L3Compl_on_1_cnlink() ); |
| 2808 | execute( TC_sgsnpool_L3Complete_no_nri_round_robin() ); |
| 2809 | execute( TC_sgsnpool_L3Complete_valid_nri_1() ); |
| 2810 | execute( TC_sgsnpool_L3Complete_valid_nri_2() ); |
| 2811 | execute( TC_sgsnpool_nri_from_other_PLMN() ); |
| 2812 | execute( TC_sgsnpool_sccp_n_pcstate_detaches_cnlink() ); |
| 2813 | execute( TC_sgsnpool_sccp_n_pcstate_attaches_cnlink() ); |
| 2814 | |
Oliver Smith | aa919b4 | 2023-11-14 11:30:55 +0100 | [diff] [blame] | 2815 | /* Run only on nightly since it makes osmo-hnbgw <= 1.5.0 crash: OS#6253 */ |
| 2816 | if (f_osmo_repo_is("nightly")) { |
| 2817 | execute(TC_second_rab_assignment()); |
| 2818 | } |
Neels Hofmeyr | c3c01d3 | 2023-11-07 02:19:00 +0100 | [diff] [blame] | 2819 | |
Pau Espin Pedrol | f0b9fa0 | 2022-09-12 13:31:07 +0200 | [diff] [blame] | 2820 | /* Run at the end since it makes osmo-hnbgw <= 1.3.0 crash: OS#5676 */ |
| 2821 | execute(TC_hnb_reregister_reuse_sctp_assoc()); |
Neels Hofmeyr | d019cc0 | 2023-06-02 16:31:23 +0200 | [diff] [blame] | 2822 | |
| 2823 | /* Run at the end since it messes with the SCCP config */ |
| 2824 | execute( TC_apply_sccp() ); |
Daniel Willmann | 19b8d90 | 2022-01-05 09:12:34 +0100 | [diff] [blame] | 2825 | } |
| 2826 | |
| 2827 | } |