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