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