Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 1 | module NS_Tests { |
| 2 | |
| 3 | /* Osmocom NS test suite for NS over framerelay or udp ip.access style in TTCN-3 |
| 4 | * (C) 2021 sysmocom s.f.m.c. GmbH <info@sysmocom.de> |
| 5 | * Author: Alexander Couzens <lynxis@fe80.eu> |
| 6 | * All rights reserved. |
| 7 | * |
| 8 | * Released under the terms of GNU General Public License, Version 2 or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 12 | */ |
| 13 | |
| 14 | import from General_Types all; |
| 15 | import from Osmocom_Types all; |
| 16 | import from Osmocom_Gb_Types all; |
| 17 | import from NS_Types all; |
| 18 | import from BSSGP_Types all; |
| 19 | import from UD_Types all; |
| 20 | import from NS_Emulation all; |
| 21 | import from Native_Functions all; |
| 22 | import from IPL4asp_Types all; |
| 23 | import from RAW_NS all; |
| 24 | import from Osmocom_VTY_Functions all; |
| 25 | import from TELNETasp_PortType all; |
| 26 | |
Alexander Couzens | de3dfaa | 2021-08-06 17:59:54 +0200 | [diff] [blame] | 27 | type enumerated SnsRole { |
| 28 | SNS_ROLE_BSS ('00'H), |
| 29 | SNS_ROLE_SGSN ('01'H) |
| 30 | }; |
| 31 | |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 32 | modulepar { |
Alexander Couzens | de3dfaa | 2021-08-06 17:59:54 +0200 | [diff] [blame] | 33 | SnsRole mp_sns_role := SNS_ROLE_BSS; |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 34 | OsmoNsDialect mp_dialect := NS2_DIALECT_IPACCESS; |
| 35 | NSConfiguration mp_nsconfig := { |
| 36 | nsei := 96, |
| 37 | role_sgsn := false, |
| 38 | handle_sns := false, |
| 39 | nsvc := { |
| 40 | { |
| 41 | provider := { |
| 42 | ip := { |
| 43 | address_family := AF_INET, |
| 44 | local_udp_port := 21000, |
| 45 | local_ip := "127.0.0.1", |
| 46 | remote_udp_port := 23000, |
Alexander Couzens | 87e44cf | 2021-02-03 15:15:27 +0100 | [diff] [blame] | 47 | remote_ip := "127.0.0.1", |
| 48 | data_weight := 2, |
| 49 | signalling_weight := 2 |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 50 | } |
| 51 | }, |
| 52 | nsvci := 97 |
Alexander Couzens | 6f17ecc | 2021-05-25 13:43:57 +0200 | [diff] [blame] | 53 | }, |
| 54 | { |
| 55 | provider := { |
| 56 | ip := { |
| 57 | address_family := AF_INET, |
| 58 | local_udp_port := 21000, |
| 59 | local_ip := "127.0.0.1", |
| 60 | remote_udp_port := 23001, |
| 61 | remote_ip := "127.0.0.1", |
| 62 | data_weight := 1, |
| 63 | signalling_weight := 1 |
| 64 | } |
| 65 | }, |
| 66 | nsvci := 98 |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 67 | } |
| 68 | } |
| 69 | }; |
| 70 | } |
| 71 | |
| 72 | type component RAW_Test_CT extends RAW_NS_CT { |
| 73 | port TELNETasp_PT NSVTY; |
| 74 | } |
| 75 | |
| 76 | private function f_init_vty() runs on RAW_Test_CT { |
| 77 | map(self:NSVTY, system:NSVTY); |
| 78 | f_vty_set_prompts(NSVTY); |
| 79 | f_vty_transceive(NSVTY, "enable"); |
| 80 | f_vty_transceive(NSVTY, "nsvc nsei " & int2str(mp_nsconfig.nsei) & " force-unconfigured"); |
Alexander Couzens | bdef810 | 2021-09-03 23:18:27 +0200 | [diff] [blame] | 81 | if (mp_dialect == NS2_DIALECT_SNS) { |
| 82 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(mp_nsconfig.nsei)}, "ip-sns-bind local"); |
| 83 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(mp_nsconfig.nsei)}, "no ip-sns-bind local2"); |
| 84 | f_vty_config2(NSVTY, {"ns", "bind udp local"}, "ip-sns signalling-weight 1 data-weight 1"); |
| 85 | f_vty_config2(NSVTY, {"ns", "bind udp local2"}, "ip-sns signalling-weight 1 data-weight 1"); |
| 86 | } |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | /* ensure no matching message is received within 'tout' */ |
| 90 | function f_ensure_no_ns(integer idx := 0, boolean answer_alive := false, float tout := 3.0) |
| 91 | runs on RAW_Test_CT { |
| 92 | var PDU_NS nrf; |
| 93 | |
| 94 | timer T := tout; |
| 95 | var default d := activate(ax_rx_fail_on_any_ns(idx)); |
| 96 | T.start; |
| 97 | alt { |
| 98 | [answer_alive] as_rx_alive_tx_ack(); |
| 99 | [] T.timeout { |
| 100 | setverdict(pass); |
| 101 | } |
| 102 | } |
| 103 | deactivate(d); |
| 104 | } |
| 105 | |
| 106 | function f_fails_except_reset(integer idx := 0, float tout := 15.0) |
| 107 | runs on RAW_Test_CT { |
| 108 | var PDU_NS nrf; |
| 109 | timer T := 15.0; |
| 110 | T.start; |
| 111 | alt { |
| 112 | [] NSCP[idx].receive(tr_NS_RESET(*, *, *)) { |
| 113 | repeat; |
| 114 | } |
| 115 | [] NSCP[idx].receive(PDU_NS: ?) -> value nrf { |
| 116 | setverdict(fail, "Received unexpected NS: ", nrf); |
| 117 | mtc.stop; |
| 118 | } |
| 119 | [] T.timeout { |
| 120 | setverdict(pass); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | testcase TC_tx_reset() runs on RAW_Test_CT { |
| 126 | f_init_vty(); |
| 127 | f_init_ns_codec(mp_nsconfig, guard_secs := 10.0); |
| 128 | |
| 129 | /* do a NS Reset procedure */ |
| 130 | f_outgoing_ns_reset(); |
| 131 | |
| 132 | setverdict(pass); |
| 133 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 134 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | testcase TC_tx_reset_tx_alive() runs on RAW_Test_CT { |
| 138 | f_init_vty(); |
| 139 | f_init_ns_codec(mp_nsconfig, guard_secs := 10.0); |
| 140 | |
| 141 | /* do a NS Reset procedure */ |
| 142 | f_outgoing_ns_reset(); |
| 143 | |
| 144 | /* check outgoing NS procedure */ |
| 145 | f_outgoing_ns_alive(); |
| 146 | |
| 147 | setverdict(pass); |
| 148 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 149 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | testcase TC_tx_reset_rx_alive() runs on RAW_Test_CT { |
| 153 | f_init_vty(); |
| 154 | f_init_ns_codec(mp_nsconfig, guard_secs := 10.0); |
| 155 | |
| 156 | /* do a NS Reset procedure */ |
| 157 | f_outgoing_ns_reset(); |
| 158 | |
| 159 | activate(as_rx_ns_unblock_ack()); |
| 160 | /* check outgoing NS procedure */ |
| 161 | as_rx_alive_tx_ack(oneshot := true); |
| 162 | |
| 163 | setverdict(pass); |
| 164 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 165 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 166 | } |
| 167 | |
Alexander Couzens | 94d3d10 | 2021-09-06 00:20:42 +0200 | [diff] [blame] | 168 | /* 48.016 7.2.1 transmit a UNIT DATA over a BLOCKED NSVC when ttcn3 blocked it |
| 169 | * |
| 170 | * TTCN -> NS: reset |
| 171 | * TTCN <- NS: reset ack |
| 172 | * TTCN -> NS: unblock |
| 173 | * TTCN <- NS: unblock ack |
| 174 | * TTCN -> NS: block |
| 175 | * TTCN <- NS: block ack |
| 176 | * TTCN -> NS: unitdata |
| 177 | * TTCN <- NS: status (cause blocked) |
| 178 | */ |
| 179 | testcase TC_tx_block_unitdata_over_blocked() runs on RAW_Test_CT { |
| 180 | f_tx_block(); |
| 181 | f_sleep(1.0); |
| 182 | |
| 183 | NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O)); |
| 184 | f_ns_exp(tr_NS_STATUS(NS_CAUSE_NSVC_BLOCKED)); |
| 185 | |
| 186 | setverdict(pass); |
| 187 | f_sleep(1.0); |
| 188 | f_clean_ns_codec(); |
| 189 | } |
| 190 | |
| 191 | /* 48.016 7.2.1 transmit a UNIT DATA over a BLOCKED NSVC when ns2 blocked it |
| 192 | * |
| 193 | * TTCN -> NS: reset |
| 194 | * TTCN <- NS: reset ack |
| 195 | * TTCN -> NS: unblock |
| 196 | * TTCN <- NS: unblock ack |
| 197 | * TTCN <- NS: block |
| 198 | * TTCN -> NS: block ack |
| 199 | * TTCN -> NS: unitdata |
| 200 | * TTCN <- NS: status (cause blocked) |
| 201 | */ |
| 202 | testcase TC_rx_block_unitdata_over_blocked() runs on RAW_Test_CT { |
| 203 | tx_block_by_vty(); |
| 204 | f_sleep(1.0); |
| 205 | |
| 206 | NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O)); |
| 207 | f_ns_exp(tr_NS_STATUS(NS_CAUSE_NSVC_BLOCKED)); |
| 208 | |
| 209 | setverdict(pass); |
| 210 | f_sleep(1.0); |
| 211 | f_clean_ns_codec(); |
| 212 | } |
| 213 | |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 214 | /* 48.016 7.2 unblock procedure |
| 215 | * |
| 216 | * TTCN -> NS: reset |
| 217 | * TTCN <- NS: reset ack |
| 218 | * TTCN -> NS: unblock |
| 219 | * TTCN <- NS: unblock ack |
| 220 | */ |
| 221 | testcase TC_tx_unblock() runs on RAW_Test_CT { |
| 222 | f_init_vty(); |
| 223 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 224 | |
| 225 | /* do a NS Reset procedure */ |
| 226 | f_outgoing_ns_reset(); |
| 227 | /* send alive acks */ |
| 228 | activate(as_rx_alive_tx_ack()); |
| 229 | |
| 230 | f_outgoing_ns_unblock(); |
| 231 | setverdict(pass); |
| 232 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 233 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | /* 48.016 7.2 tx unblock retries |
| 237 | * |
| 238 | * TTCN -> NS: reset |
| 239 | * TTCN <- NS: reset ack |
| 240 | * TTCN -> NS: unblock |
| 241 | * TTCN <- NS: unblock ack |
| 242 | * TTCN -> NS: unblock |
| 243 | * TTCN <- NS: unblock ack |
| 244 | * TTCN -> NS: unblock |
| 245 | * TTCN <- NS: unblock ack |
| 246 | */ |
| 247 | testcase TC_tx_unblock_retries() runs on RAW_Test_CT { |
| 248 | f_init_vty(); |
| 249 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 250 | |
| 251 | /* do a NS Reset procedure */ |
| 252 | f_outgoing_ns_reset(); |
| 253 | /* send alive acks */ |
| 254 | activate(as_rx_alive_tx_ack()); |
| 255 | |
| 256 | f_outgoing_ns_unblock(); |
| 257 | f_outgoing_ns_unblock(); |
| 258 | f_outgoing_ns_unblock(); |
| 259 | setverdict(pass); |
| 260 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 261 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | /* 48.016 7.2 block procedure |
| 265 | * |
| 266 | * TTCN -> NS: reset |
| 267 | * TTCN <- NS: reset ack |
| 268 | * TTCN -> NS: unblock |
| 269 | * TTCN <- NS: unblock ack |
| 270 | * TTCN -> NS: block |
| 271 | * TTCN <- NS: block ack |
| 272 | */ |
Alexander Couzens | 94d3d10 | 2021-09-06 00:20:42 +0200 | [diff] [blame] | 273 | function f_tx_block(float guard_secs := 30.0) runs on RAW_Test_CT { |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 274 | f_init_vty(); |
Alexander Couzens | 94d3d10 | 2021-09-06 00:20:42 +0200 | [diff] [blame] | 275 | f_init_ns_codec(mp_nsconfig, guard_secs := guard_secs); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 276 | |
| 277 | /* do a NS Reset procedure */ |
| 278 | f_outgoing_ns_reset(); |
| 279 | activate(as_rx_alive_tx_ack()); |
| 280 | |
| 281 | f_outgoing_ns_unblock(); |
| 282 | f_sleep(1.0); |
| 283 | |
| 284 | f_outgoing_ns_block(NS_CAUSE_EQUIPMENT_FAILURE); |
| 285 | setverdict(pass); |
| 286 | f_sleep(1.0); |
| 287 | } |
| 288 | |
Alexander Couzens | 94d3d10 | 2021-09-06 00:20:42 +0200 | [diff] [blame] | 289 | testcase TC_tx_block() runs on RAW_Test_CT { |
| 290 | f_tx_block() |
| 291 | f_clean_ns_codec(); |
| 292 | } |
| 293 | |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 294 | /* 48.016 7.2 block procedure by vty |
| 295 | * |
| 296 | * TTCN -> NS: reset |
| 297 | * TTCN <- NS: reset ack |
| 298 | * TTCN -> NS: unblock |
| 299 | * TTCN <- NS: unblock ack |
| 300 | * vty: block nsvc |
| 301 | * TTCN <- NS: block |
| 302 | * TTCN -> NS: block ack |
| 303 | */ |
| 304 | function tx_block_by_vty(float guard_secs := 30.0) runs on RAW_Test_CT { |
| 305 | f_init_vty(); |
| 306 | f_init_ns_codec(mp_nsconfig, guard_secs := guard_secs); |
| 307 | |
| 308 | /* do a NS Reset procedure */ |
| 309 | f_outgoing_ns_reset(); |
| 310 | activate(as_rx_alive_tx_ack()); |
| 311 | |
| 312 | f_outgoing_ns_unblock(); |
| 313 | f_sleep(1.0); |
| 314 | |
| 315 | f_vty_transceive(NSVTY, "nsvc " & int2str(mp_nsconfig.nsvc[0].nsvci) & " block"); |
| 316 | |
| 317 | alt { |
| 318 | [] as_rx_ns_block_ack(oneshot := true, nsvci := mp_nsconfig.nsvc[0].nsvci); |
| 319 | } |
| 320 | setverdict(pass); |
| 321 | } |
| 322 | |
| 323 | testcase TC_tx_block_by_vty() runs on RAW_Test_CT { |
| 324 | tx_block_by_vty(30.0); |
| 325 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 326 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 327 | } |
| 328 | |
| 329 | /* 48.016 7.2 block precedure by vty and reset the NSVC. |
| 330 | * The NSVC should be still blocked after the reset. |
| 331 | */ |
| 332 | testcase TC_tx_block_by_vty_reset() runs on RAW_Test_CT { |
| 333 | timer T := 10.0; |
| 334 | |
| 335 | tx_block_by_vty(60.0); |
| 336 | f_outgoing_ns_reset(); |
| 337 | |
| 338 | var default d := activate(ax_rx_fail_on_any_ns()); |
| 339 | T.start; |
| 340 | alt { |
| 341 | [] as_rx_alive_tx_ack(); |
| 342 | [] T.timeout { setverdict(pass); } |
| 343 | } |
| 344 | deactivate(d); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 345 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 346 | } |
| 347 | |
| 348 | /* 48.016 7.4.1 ignore unexpected NS_ALIVE ACK */ |
| 349 | testcase TC_no_reset_alive_ack() runs on RAW_Test_CT { |
| 350 | f_init_vty(); |
| 351 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 352 | |
| 353 | NSCP[0].send(t_NS_ALIVE_ACK); |
| 354 | f_fails_except_reset(); |
| 355 | setverdict(pass); |
| 356 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 357 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | /* 48.016 7.3.1 NS_RESET with wrong nsei */ |
| 361 | testcase TC_reset_wrong_nsei() runs on RAW_Test_CT { |
| 362 | f_init_vty(); |
| 363 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 364 | |
| 365 | NSCP[0].send(ts_NS_RESET(NS_CAUSE_EQUIPMENT_FAILURE, g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei + 20)); |
| 366 | NSCP[0].receive(tr_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 367 | f_fails_except_reset(); |
| 368 | setverdict(pass); |
| 369 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 370 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 371 | } |
| 372 | |
| 373 | /* 48.016 7.3.1 NS_RESET with wrong nsvci */ |
| 374 | testcase TC_reset_wrong_nsvci() runs on RAW_Test_CT { |
| 375 | f_init_vty(); |
| 376 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 377 | |
| 378 | NSCP[0].send(ts_NS_RESET(NS_CAUSE_EQUIPMENT_FAILURE, g_nsconfig.nsvc[0].nsvci + 20, g_nsconfig.nsei)); |
| 379 | NSCP[0].receive(tr_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 380 | f_fails_except_reset(); |
| 381 | setverdict(pass); |
| 382 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 383 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 384 | } |
| 385 | |
| 386 | /* 48.016 7.3.1 NS_RESET with wrong nsvci + nsei */ |
| 387 | testcase TC_reset_wrong_nsei_nsvci() runs on RAW_Test_CT { |
| 388 | f_init_vty(); |
| 389 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 390 | |
| 391 | NSCP[0].send(ts_NS_RESET(NS_CAUSE_EQUIPMENT_FAILURE, g_nsconfig.nsvc[0].nsvci + 20, g_nsconfig.nsei + 20)); |
| 392 | NSCP[0].receive(tr_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 393 | f_fails_except_reset(); |
| 394 | setverdict(pass); |
| 395 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 396 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 397 | } |
| 398 | |
| 399 | /* 48.016 7.3.1 NS_RESET_ACK with wrong nsei */ |
| 400 | testcase TC_reset_ack_wrong_nsei() runs on RAW_Test_CT { |
| 401 | f_init_vty(); |
| 402 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 403 | |
| 404 | NSCP[0].receive(tr_NS_RESET(*, g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 405 | NSCP[0].send(ts_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei + 20)); |
| 406 | f_fails_except_reset(); |
| 407 | setverdict(pass); |
| 408 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 409 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 410 | } |
| 411 | |
| 412 | /* 48.016 7.3.1 NS_RESET_ACK with wrong nsvci */ |
| 413 | testcase TC_reset_ack_wrong_nsvci() runs on RAW_Test_CT { |
| 414 | f_init_vty(); |
| 415 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 416 | |
| 417 | NSCP[0].receive(tr_NS_RESET(*, g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 418 | NSCP[0].send(ts_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci + 20, g_nsconfig.nsei)); |
| 419 | f_fails_except_reset(); |
| 420 | setverdict(pass); |
| 421 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 422 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 423 | } |
| 424 | |
| 425 | /* 48.016 7.3.1 NS_RESET_ACK with wrong nsvci + nsei */ |
| 426 | testcase TC_reset_ack_wrong_nsei_nsvci() runs on RAW_Test_CT { |
| 427 | f_init_vty(); |
| 428 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 429 | |
| 430 | NSCP[0].receive(tr_NS_RESET(*, g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 431 | NSCP[0].send(ts_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci + 20, g_nsconfig.nsei + 20)); |
| 432 | f_fails_except_reset(); |
| 433 | setverdict(pass); |
| 434 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 435 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 436 | } |
| 437 | |
| 438 | /* 48.016 7.3.1 ignore unexpected NS_RESET_ACK after NS_RESET+ALIVE */ |
| 439 | testcase TC_ignore_reset_ack() runs on RAW_Test_CT { |
| 440 | f_init_vty(); |
| 441 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 442 | |
| 443 | /* do a NS Reset procedure */ |
| 444 | f_outgoing_ns_reset(); |
| 445 | |
| 446 | /* unblock and alive */ |
| 447 | alt { |
| 448 | [] as_rx_ns_unblock_ack(oneshot := true); |
| 449 | [] as_rx_alive_tx_ack(); |
| 450 | } |
| 451 | |
| 452 | NSCP[0].send(ts_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 453 | f_ensure_no_ns(answer_alive := true, tout := 15.0); |
| 454 | setverdict(pass); |
| 455 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 456 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 457 | } |
| 458 | |
| 459 | /* 48.016 7.3 NS_RESET retries */ |
| 460 | testcase TC_reset_retries() runs on RAW_Test_CT { |
| 461 | var integer reset := 0; |
| 462 | |
| 463 | f_init_vty(); |
| 464 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 465 | |
| 466 | alt { |
| 467 | [] NSCP[0].receive(tr_NS_RESET(*, *, *)) { |
| 468 | reset := reset + 1; |
| 469 | if (reset <= 3) { |
| 470 | repeat; |
| 471 | } else { |
| 472 | setverdict(pass); |
| 473 | } |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 478 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 479 | } |
| 480 | |
| 481 | /* 48.016 behave RESET_ACK got dropped |
| 482 | * TTCN -> NS: reset |
| 483 | * TTCN <- NS: reset ack |
| 484 | * TTCN <- NS: unblock |
| 485 | * TTCN -> NS: reset |
| 486 | * TTCN <- NS: reset ack |
| 487 | * TTCN <- NS: unblock |
| 488 | */ |
| 489 | testcase TC_reset_on_block_reset() runs on RAW_Test_CT { |
| 490 | var integer i := 0; |
| 491 | |
| 492 | f_init_vty(); |
| 493 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 494 | |
| 495 | f_outgoing_ns_reset(); |
| 496 | activate(as_rx_alive_tx_ack()); |
| 497 | |
| 498 | alt { |
| 499 | [] NSCP[0].receive(t_NS_UNBLOCK) { |
| 500 | NSCP[0].send(ts_NS_RESET(NS_CAUSE_EQUIPMENT_FAILURE, g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 501 | i := i + 1; |
| 502 | if (i < 3) { |
| 503 | repeat; |
| 504 | } else { |
| 505 | setverdict(pass); |
| 506 | } |
| 507 | } |
| 508 | [] NSCP[0].receive(tr_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)) { repeat; } |
| 509 | } |
| 510 | |
| 511 | f_sleep(1.0); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 512 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 513 | } |
| 514 | |
| 515 | /* 48.016 7.4 test procedure for frame relay with a single nsvci */ |
| 516 | function f_alive_retries_single(boolean reset := false) runs on RAW_Test_CT { |
| 517 | f_init_vty(); |
| 518 | f_init_ns_codec(mp_nsconfig, guard_secs := 60.0); |
| 519 | |
| 520 | /* do a NS Reset procedure */ |
| 521 | f_outgoing_ns_reset(); |
| 522 | |
| 523 | alt { |
| 524 | [] as_rx_ns_unblock_ack(oneshot := true); |
| 525 | [] as_rx_alive_tx_ack(); |
| 526 | } |
| 527 | |
| 528 | /* wait for one alive and answer it */ |
| 529 | as_rx_alive_tx_ack(oneshot := true); |
| 530 | NSCP[0].receive(t_NS_ALIVE); |
| 531 | NSCP[0].receive(t_NS_ALIVE); |
| 532 | NSCP[0].receive(t_NS_ALIVE); |
| 533 | NSCP[0].receive(t_NS_ALIVE); |
| 534 | if (reset) { |
| 535 | NSCP[0].receive(tr_NS_RESET(*, g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 536 | } else { |
| 537 | f_ensure_no_ns(tout := 10.0); |
| 538 | } |
| 539 | |
| 540 | setverdict(pass); |
| 541 | f_sleep(1.0); |
| 542 | } |
| 543 | |
| 544 | testcase TC_alive_retries_single_reset() runs on RAW_Test_CT { |
| 545 | f_alive_retries_single(reset := true); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 546 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 547 | } |
| 548 | |
| 549 | testcase TC_alive_retries_single_no_resp() runs on RAW_Test_CT { |
| 550 | f_alive_retries_single(reset := false); |
Alexander Couzens | 3674405 | 2021-09-06 00:39:07 +0200 | [diff] [blame^] | 551 | f_clean_ns_codec(); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 552 | } |
| 553 | |
Alexander Couzens | cbee32a | 2021-02-27 20:50:20 +0100 | [diff] [blame] | 554 | /* 48.016 SNS test cases */ |
| 555 | |
| 556 | /* do a succesful SNS configuration */ |
Alexander Couzens | 79606cf | 2021-07-27 14:59:29 +0200 | [diff] [blame] | 557 | testcase TC_sns_bss_config_success() runs on RAW_Test_CT { |
Alexander Couzens | cbee32a | 2021-02-27 20:50:20 +0100 | [diff] [blame] | 558 | f_init_vty(); |
| 559 | f_init_ns_codec(mp_nsconfig); |
| 560 | f_incoming_sns_size(); |
| 561 | f_incoming_sns_config(); |
| 562 | f_outgoing_sns_config(); |
| 563 | setverdict(pass); |
| 564 | f_clean_ns_codec(); |
| 565 | } |
| 566 | |
Alexander Couzens | d5ac510 | 2021-02-27 20:53:37 +0100 | [diff] [blame] | 567 | testcase TC_sns_bss_change_weight() runs on RAW_Test_CT { |
Alexander Couzens | 60548b1 | 2021-04-14 19:39:26 +0200 | [diff] [blame] | 568 | g_handle_rx_alive := true; |
Alexander Couzens | d5ac510 | 2021-02-27 20:53:37 +0100 | [diff] [blame] | 569 | f_init_vty(); |
| 570 | f_init_ns_codec(mp_nsconfig); |
| 571 | f_incoming_sns_size(); |
| 572 | f_incoming_sns_config(); |
| 573 | f_outgoing_sns_config(); |
| 574 | activate(as_rx_alive_tx_ack()); |
| 575 | f_vty_config2(NSVTY, {"ns", "bind udp local"}, "ip-sns signalling-weight 99 data-weight 99"); |
| 576 | f_incoming_sns_chg_weight(); |
| 577 | setverdict(pass); |
| 578 | f_clean_ns_codec(); |
| 579 | } |
| 580 | |
Alexander Couzens | 6c723fb | 2021-03-01 00:12:00 +0100 | [diff] [blame] | 581 | /* receive 3x SNS_CHG_WEIGHT but never answer on it */ |
| 582 | testcase TC_sns_bss_change_weight_timeout() runs on RAW_Test_CT { |
| 583 | var integer i := 0; |
| 584 | var template PDU_NS rx; |
| 585 | var NSVCConfiguration nsvc_cfg; |
| 586 | |
Alexander Couzens | 60548b1 | 2021-04-14 19:39:26 +0200 | [diff] [blame] | 587 | g_handle_rx_alive := true; |
Alexander Couzens | 6c723fb | 2021-03-01 00:12:00 +0100 | [diff] [blame] | 588 | f_init_vty(); |
| 589 | f_init_ns_codec(mp_nsconfig); |
| 590 | f_incoming_sns_size(); |
| 591 | f_incoming_sns_config(); |
| 592 | f_outgoing_sns_config(); |
| 593 | activate(as_rx_alive_tx_ack()); |
| 594 | f_vty_config2(NSVTY, {"ns", "bind udp local"}, "ip-sns signalling-weight 99 data-weight 99"); |
| 595 | |
| 596 | nsvc_cfg := g_nsconfig.nsvc[0]; |
| 597 | if (nsvc_cfg.provider.ip.address_family == AF_INET) { |
| 598 | var template IP4_Elements v4_elem := { tr_SNS_IPv4(nsvc_cfg.provider.ip.remote_ip, |
| 599 | nsvc_cfg.provider.ip.remote_udp_port) }; |
| 600 | |
| 601 | rx := tr_SNS_CHG_WEIGHT(g_nsconfig.nsei, ?, v4 := v4_elem); |
| 602 | } else { |
| 603 | var template IP6_Elements v6_elem := { tr_SNS_IPv6(nsvc_cfg.provider.ip.remote_ip, |
| 604 | nsvc_cfg.provider.ip.remote_udp_port) }; |
| 605 | rx := tr_SNS_CHG_WEIGHT(g_nsconfig.nsei, ?, v4 := omit, v6 := v6_elem); |
| 606 | } |
| 607 | |
Alexander Couzens | 60548b1 | 2021-04-14 19:39:26 +0200 | [diff] [blame] | 608 | for (i := 0; i < 3; i := i + 1) { |
| 609 | f_ns_exp(rx); |
Alexander Couzens | 6c723fb | 2021-03-01 00:12:00 +0100 | [diff] [blame] | 610 | } |
| 611 | |
Alexander Couzens | a93cc36 | 2021-04-14 19:39:18 +0200 | [diff] [blame] | 612 | if (nsvc_cfg.provider.ip.address_family == AF_INET) { |
| 613 | /* expect one single SNS-SIZE with RESET flag; 4x v4 EP; no v6 EP */ |
| 614 | rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := ?, |
| 615 | num_v4 := ?, num_v6 := omit), 0); |
| 616 | } else { |
| 617 | /* expect one single SNS-SIZE with RESET flag; no v4 EP; 4x v6 EP */ |
| 618 | rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := ?, |
| 619 | num_v4 := omit, num_v6 := ?), 0); |
| 620 | } |
| 621 | |
Alexander Couzens | 6c723fb | 2021-03-01 00:12:00 +0100 | [diff] [blame] | 622 | setverdict(pass); |
| 623 | f_clean_ns_codec(); |
| 624 | } |
| 625 | |
Alexander Couzens | 6f17ecc | 2021-05-25 13:43:57 +0200 | [diff] [blame] | 626 | testcase TC_sns_bss_add() runs on RAW_Test_CT { |
| 627 | g_handle_rx_alive := true; |
| 628 | f_init_vty(); |
| 629 | f_init_ns_codec(mp_nsconfig); |
| 630 | f_init_ns_codec(mp_nsconfig, 1); |
| 631 | f_incoming_sns_size(); |
| 632 | f_incoming_sns_config(); |
| 633 | f_outgoing_sns_config(); |
| 634 | activate(as_rx_alive_tx_ack()); |
| 635 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "ip-sns-bind local2"); |
| 636 | f_incoming_sns_add(idx_add := 1); |
| 637 | as_rx_alive_tx_ack(oneshot := true, idx := 1); |
| 638 | setverdict(pass); |
| 639 | f_clean_ns_codec(); |
| 640 | } |
| 641 | |
| 642 | testcase TC_sns_bss_del() runs on RAW_Test_CT { |
| 643 | g_handle_rx_alive := true; |
| 644 | f_init_vty(); |
| 645 | f_init_ns_codec(mp_nsconfig); |
| 646 | f_init_ns_codec(mp_nsconfig, 1); |
| 647 | f_incoming_sns_size(); |
| 648 | f_incoming_sns_config(); |
| 649 | f_outgoing_sns_config(); |
| 650 | activate(as_rx_alive_tx_ack()); |
| 651 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "ip-sns-bind local2"); |
| 652 | f_incoming_sns_add(idx_add := 1); |
| 653 | as_rx_alive_tx_ack(oneshot := true, idx := 1); |
| 654 | |
| 655 | /* delete the endpoint */ |
| 656 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "no ip-sns-bind local2"); |
| 657 | f_incoming_sns_del(idx_del := 1); |
| 658 | setverdict(pass); |
| 659 | f_clean_ns_codec(); |
| 660 | } |
| 661 | |
Alexander Couzens | e23387a | 2021-06-06 23:15:42 +0200 | [diff] [blame] | 662 | /* 1. do SNS configuration |
| 663 | * 2. add a bind |
| 664 | * 3. receive the SNS_ADD |
| 665 | * 4. before answering the SNS_ADD, change the weight via vty and remove the bind |
| 666 | */ |
| 667 | testcase TC_sns_bss_add_change_del() runs on RAW_Test_CT { |
| 668 | var PDU_NS rx; |
| 669 | var NSVCConfiguration nsvc_cfg; |
| 670 | |
| 671 | g_handle_rx_alive := true; |
| 672 | f_init_vty(); |
| 673 | f_init_ns_codec(mp_nsconfig); |
| 674 | f_init_ns_codec(mp_nsconfig, 1); |
| 675 | f_incoming_sns_size(); |
| 676 | f_incoming_sns_config(); |
| 677 | f_outgoing_sns_config(); |
| 678 | activate(as_rx_alive_tx_ack()); |
| 679 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "ip-sns-bind local2"); |
| 680 | |
| 681 | /* rx SNS ADD */ |
| 682 | nsvc_cfg := g_nsconfig.nsvc[1]; |
| 683 | if (nsvc_cfg.provider.ip.address_family == AF_INET) { |
| 684 | var template (omit) IP4_Elements v4_elem := { ts_SNS_IPv4(nsvc_cfg.provider.ip.remote_ip, |
| 685 | nsvc_cfg.provider.ip.remote_udp_port, |
| 686 | 1, 1) }; |
| 687 | rx := f_ns_exp(tr_SNS_ADD(g_nsconfig.nsei, ?, v4 := v4_elem), 0); |
| 688 | } else { |
| 689 | var template (omit) IP6_Elements v6_elem := { ts_SNS_IPv6(nsvc_cfg.provider.ip.remote_ip, |
| 690 | nsvc_cfg.provider.ip.remote_udp_port, |
| 691 | 1, 1) }; |
| 692 | rx := f_ns_exp(tr_SNS_ADD(g_nsconfig.nsei, ?, omit, v6_elem), 0); |
| 693 | } |
| 694 | |
| 695 | /* delete the endpoint */ |
| 696 | f_vty_config2(NSVTY, {"ns", "bind udp local2"}, "ip-sns signalling-weight 99 data-weight 99"); |
| 697 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "no ip-sns-bind local2"); |
| 698 | |
| 699 | /* accept the SNS_ADD */ |
| 700 | NSCP[0].send(ts_SNS_ACK(g_nsconfig.nsei, rx.pDU_SNS_Add.transactionID)); |
| 701 | |
| 702 | f_incoming_sns_chg_weight(idx_chg := 1); |
| 703 | f_incoming_sns_del(idx_del := 1, w_sig := 99, w_user := 99); |
| 704 | setverdict(pass); |
| 705 | f_clean_ns_codec(); |
| 706 | } |
| 707 | |
Alexander Couzens | 31f8150 | 2021-07-12 18:15:01 +0200 | [diff] [blame] | 708 | /* Ensure the ns2 code doesn't crash when calling force unconfigured while sending SNS SIZE */ |
| 709 | testcase TC_sns_rx_size_force_unconf() runs on RAW_Test_CT { |
| 710 | g_handle_rx_alive := true; |
| 711 | f_init_vty(); |
| 712 | f_init_ns_codec(mp_nsconfig); |
| 713 | f_init_ns_codec(mp_nsconfig, 1); |
| 714 | f_ns_exp(tr_SNS_SIZE(mp_nsconfig.nsei, rst_flag := true, max_nsvcs := ?, |
| 715 | num_v4 := ?, num_v6 := omit)); |
| 716 | f_vty_transceive(NSVTY, "nsvc nsei " & int2str(mp_nsconfig.nsei) & " force-unconfigured"); |
| 717 | f_ns_exp(tr_SNS_SIZE(mp_nsconfig.nsei, rst_flag := true, max_nsvcs := ?, |
| 718 | num_v4 := ?, num_v6 := omit)); |
| 719 | setverdict(pass); |
| 720 | f_clean_ns_codec(); |
| 721 | } |
| 722 | |
Alexander Couzens | 1650b16 | 2021-06-13 04:05:56 +0200 | [diff] [blame] | 723 | /* Test if SNS fails when all signalling NSVCs failes |
| 724 | * 3GPP TS 48.016 § 7.4b.1.1 |
| 725 | * 1. do success SNS configuration |
| 726 | * 2. change sig weight of the seconds inactive bind |
| 727 | * 3. add second bind to SNS |
| 728 | * 4. stop reacting to NS_ALIVE on first NSVC (only NSVC with sig weight) |
| 729 | * 5. expect SNS SIZE |
Alexander Couzens | 8122ed2 | 2021-08-06 22:01:20 +0200 | [diff] [blame] | 730 | * |
| 731 | * Broken: the test case tests the wrong side. The signalling |
| 732 | * and data weight are valid for the other side. The correct |
| 733 | * test case needs to add a second bind on the ttcn3 side. |
Alexander Couzens | 1650b16 | 2021-06-13 04:05:56 +0200 | [diff] [blame] | 734 | */ |
| 735 | testcase TC_sns_bss_all_signalling_nsvcs_failed() runs on RAW_Test_CT { |
| 736 | g_handle_rx_alive := true; |
| 737 | f_init_vty(); |
| 738 | f_init_ns_codec(mp_nsconfig); |
| 739 | f_init_ns_codec(mp_nsconfig, 1); |
| 740 | f_incoming_sns_size(); |
| 741 | f_incoming_sns_config(); |
| 742 | f_outgoing_sns_config(); |
| 743 | var default d := activate(as_rx_alive_tx_ack()); |
| 744 | |
| 745 | f_vty_config2(NSVTY, {"ns", "bind udp local2"}, "ip-sns signalling-weight 0 data-weight 99"); |
| 746 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "ip-sns-bind local2"); |
| 747 | f_incoming_sns_add(idx_add := 1, w_sig := 0, w_user := 99); |
| 748 | as_rx_alive_tx_ack(oneshot := true, idx := 1); |
| 749 | activate(as_rx_alive_tx_ack(idx := 1)); |
| 750 | /* 2x NSVCs up, stop first NSVC */ |
| 751 | deactivate(d); |
| 752 | /* libosmocore will rotate the SNS binds on failure */ |
| 753 | NSCP[0].receive(t_NS_ALIVE); |
| 754 | NSCP[0].receive(t_NS_ALIVE); |
| 755 | NSCP[0].receive(t_NS_ALIVE); |
| 756 | f_incoming_sns_size(idx := 1); |
| 757 | |
| 758 | setverdict(pass); |
| 759 | f_clean_ns_codec(); |
| 760 | } |
| 761 | |
Alexander Couzens | fdfe638 | 2021-09-03 23:17:35 +0200 | [diff] [blame] | 762 | /* Test if SNS fails when removing a bind which has the last valid connection |
| 763 | * |
| 764 | * ns2 has 2 binds, ttcn3 1 bind. |
| 765 | * |
| 766 | * nsvcs: |
| 767 | * ns2 ttcn3 |
| 768 | * 1*-----------*1 |
| 769 | * / |
| 770 | * 2*-broken--/ |
| 771 | * |
| 772 | * remove the 1st ns2 bind. |
| 773 | */ |
| 774 | testcase TC_sns_bss_remove_bind_fail_sns() runs on RAW_Test_CT { |
| 775 | g_handle_rx_alive := true; |
| 776 | f_init_vty(); |
| 777 | f_init_ns_codec(mp_nsconfig); |
| 778 | f_init_ns_codec(mp_nsconfig, 1); |
| 779 | f_incoming_sns_size(); |
| 780 | f_incoming_sns_config(); |
| 781 | f_outgoing_sns_config(); |
| 782 | var default d := activate(as_rx_alive_tx_ack()); |
| 783 | |
| 784 | f_vty_config2(NSVTY, {"ns", "bind udp local2"}, "ip-sns signalling-weight 1 data-weight 1"); |
| 785 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "ip-sns-bind local2"); |
| 786 | f_incoming_sns_add(idx_add := 1, w_sig := 1, w_user := 1); |
| 787 | /* 2nd bind won't have a valid connection to the ttcn3 */ |
| 788 | NSCP[1].receive(t_NS_ALIVE); |
| 789 | NSCP[1].receive(t_NS_ALIVE); |
| 790 | NSCP[1].receive(t_NS_ALIVE); |
| 791 | NSCP[1].receive(t_NS_ALIVE); |
| 792 | NSCP[1].receive(t_NS_ALIVE); |
| 793 | f_sleep(1.0); |
| 794 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "no ip-sns-bind local"); |
| 795 | setverdict(pass); |
| 796 | f_clean_ns_codec(); |
| 797 | } |
| 798 | |
Alexander Couzens | 5eeebaa | 2021-07-12 18:15:42 +0200 | [diff] [blame] | 799 | testcase TC_idle() runs on RAW_Test_CT { |
| 800 | f_init_vty(); |
| 801 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 802 | |
| 803 | /* do a NS Reset procedure */ |
| 804 | f_outgoing_ns_reset(); |
| 805 | activate(as_rx_alive_tx_ack()); |
| 806 | |
| 807 | f_outgoing_ns_unblock(); |
| 808 | f_sleep(30.0); |
| 809 | |
| 810 | setverdict(pass); |
| 811 | f_sleep(1.0); |
| 812 | f_clean_ns_codec(); |
| 813 | } |
| 814 | |
Alexander Couzens | 358c74c | 2021-08-06 18:01:06 +0200 | [diff] [blame] | 815 | testcase TC_sns_sgsn_config_success() runs on RAW_Test_CT { |
| 816 | f_init_vty(); |
| 817 | f_init_ns_codec(mp_nsconfig); |
| 818 | f_outgoing_sns_size(); |
| 819 | f_outgoing_sns_config(); |
| 820 | f_incoming_sns_config(); |
| 821 | setverdict(pass); |
| 822 | f_clean_ns_codec(); |
| 823 | } |
| 824 | |
Alexander Couzens | 717bb21 | 2021-09-04 01:23:42 +0200 | [diff] [blame] | 825 | /* Ensure a SNS SIZE ACK is transmitted from the correct port */ |
| 826 | testcase TC_sns_sgsn_size_correct_port() runs on RAW_Test_CT { |
| 827 | f_init_vty(); |
| 828 | f_init_ns_codec(mp_nsconfig); |
| 829 | f_init_ns_codec(mp_nsconfig, 1); |
| 830 | f_outgoing_sns_size(max_nsvcs := 10); |
| 831 | f_outgoing_sns_config(); |
| 832 | f_incoming_sns_config(); |
| 833 | NSCP[0].receive(t_NS_ALIVE); |
| 834 | f_outgoing_sns_size(max_nsvcs := 10, idx := 1); |
| 835 | setverdict(pass); |
| 836 | f_clean_ns_codec(); |
| 837 | } |
| 838 | |
Alexander Couzens | 6b51a3c | 2021-08-06 18:23:49 +0200 | [diff] [blame] | 839 | testcase TC_sns_sgsn_add() runs on RAW_Test_CT { |
| 840 | g_handle_rx_alive := true; |
| 841 | f_init_vty(); |
| 842 | f_init_ns_codec(mp_nsconfig); |
| 843 | f_init_ns_codec(mp_nsconfig, 1); |
| 844 | f_outgoing_sns_size(max_nsvcs := 4, num_ip := 4); |
| 845 | f_outgoing_sns_config(); |
| 846 | f_incoming_sns_config(); |
| 847 | activate(as_rx_alive_tx_ack()); |
| 848 | |
| 849 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "ip-sns-bind local2"); |
| 850 | f_incoming_sns_add(idx_add := 1); |
| 851 | as_rx_alive_tx_ack(oneshot := true, idx := 1); |
| 852 | |
| 853 | setverdict(pass); |
| 854 | f_clean_ns_codec(); |
| 855 | } |
| 856 | |
Alexander Couzens | 8a682d6 | 2021-08-06 22:24:47 +0200 | [diff] [blame] | 857 | testcase TC_sns_sgsn_del() runs on RAW_Test_CT { |
| 858 | g_handle_rx_alive := true; |
| 859 | f_init_vty(); |
| 860 | f_init_ns_codec(mp_nsconfig); |
| 861 | f_init_ns_codec(mp_nsconfig, 1); |
| 862 | f_outgoing_sns_size(max_nsvcs := 4, num_ip := 4); |
| 863 | f_outgoing_sns_config(); |
| 864 | f_incoming_sns_config(); |
| 865 | activate(as_rx_alive_tx_ack()); |
| 866 | |
| 867 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "ip-sns-bind local2"); |
| 868 | f_incoming_sns_add(idx_add := 1); |
| 869 | as_rx_alive_tx_ack(oneshot := true, idx := 1); |
| 870 | |
| 871 | /* delete the endpoint */ |
| 872 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "no ip-sns-bind local2"); |
| 873 | f_incoming_sns_del(idx_del := 1); |
| 874 | |
| 875 | setverdict(pass); |
| 876 | f_clean_ns_codec(); |
| 877 | } |
Alexander Couzens | 6b51a3c | 2021-08-06 18:23:49 +0200 | [diff] [blame] | 878 | |
Alexander Couzens | 3921fb5 | 2021-08-12 04:04:20 +0200 | [diff] [blame] | 879 | /* 1. do SNS configuration |
| 880 | * 2. add a bind |
| 881 | * 3. receive the SNS_ADD |
| 882 | * 4. before answering the SNS_ADD, change the weight via vty and remove the bind |
| 883 | */ |
| 884 | testcase TC_sns_sgsn_add_change_del() runs on RAW_Test_CT { |
| 885 | var PDU_NS rx; |
| 886 | var NSVCConfiguration nsvc_cfg; |
| 887 | |
| 888 | g_handle_rx_alive := true; |
| 889 | f_init_vty(); |
| 890 | f_init_ns_codec(mp_nsconfig); |
| 891 | f_init_ns_codec(mp_nsconfig, 1); |
| 892 | f_outgoing_sns_size(max_nsvcs := 4, num_ip := 4); |
| 893 | f_outgoing_sns_config(); |
| 894 | f_incoming_sns_config(); |
| 895 | activate(as_rx_alive_tx_ack()); |
| 896 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "ip-sns-bind local2"); |
| 897 | |
| 898 | /* rx SNS ADD */ |
| 899 | nsvc_cfg := g_nsconfig.nsvc[1]; |
| 900 | if (nsvc_cfg.provider.ip.address_family == AF_INET) { |
| 901 | var template (omit) IP4_Elements v4_elem := { ts_SNS_IPv4(nsvc_cfg.provider.ip.remote_ip, |
| 902 | nsvc_cfg.provider.ip.remote_udp_port, |
| 903 | 1, 1) }; |
| 904 | rx := f_ns_exp(tr_SNS_ADD(g_nsconfig.nsei, ?, v4 := v4_elem), 0); |
| 905 | } else { |
| 906 | var template (omit) IP6_Elements v6_elem := { ts_SNS_IPv6(nsvc_cfg.provider.ip.remote_ip, |
| 907 | nsvc_cfg.provider.ip.remote_udp_port, |
| 908 | 1, 1) }; |
| 909 | rx := f_ns_exp(tr_SNS_ADD(g_nsconfig.nsei, ?, omit, v6_elem), 0); |
| 910 | } |
| 911 | |
| 912 | /* delete the endpoint */ |
| 913 | f_vty_config2(NSVTY, {"ns", "bind udp local2"}, "ip-sns signalling-weight 99 data-weight 99"); |
| 914 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "no ip-sns-bind local2"); |
| 915 | |
| 916 | /* accept the SNS_ADD */ |
| 917 | NSCP[0].send(ts_SNS_ACK(g_nsconfig.nsei, rx.pDU_SNS_Add.transactionID)); |
| 918 | |
| 919 | f_incoming_sns_chg_weight(idx_chg := 1); |
| 920 | f_incoming_sns_del(idx_del := 1, w_sig := 99, w_user := 99); |
| 921 | setverdict(pass); |
| 922 | f_clean_ns_codec(); |
| 923 | } |
| 924 | |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 925 | control { |
Alexander Couzens | e48d355 | 2021-02-27 20:01:16 +0100 | [diff] [blame] | 926 | if (mp_dialect == NS2_DIALECT_STATIC_RESETBLOCK or mp_dialect == NS2_DIALECT_IPACCESS) { |
| 927 | execute( TC_tx_reset() ); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 928 | |
Alexander Couzens | e48d355 | 2021-02-27 20:01:16 +0100 | [diff] [blame] | 929 | /* 48.016 7.2 Block procedure */ |
| 930 | execute( TC_tx_block() ); |
| 931 | execute( TC_tx_block_by_vty() ); |
| 932 | execute( TC_tx_block_by_vty_reset() ); |
Alexander Couzens | 94d3d10 | 2021-09-06 00:20:42 +0200 | [diff] [blame] | 933 | execute( TC_tx_block_unitdata_over_blocked() ); |
| 934 | execute( TC_rx_block_unitdata_over_blocked() ); |
Alexander Couzens | e48d355 | 2021-02-27 20:01:16 +0100 | [diff] [blame] | 935 | // execute( TC_block_other_nsvc() ); // reset, unblock, sleep(1), block over another nsvci |
| 936 | /* 48.016 7.2 Unblock procedure */ |
| 937 | execute( TC_tx_unblock() ); |
| 938 | execute( TC_tx_unblock_retries() ); |
| 939 | // execute( TC_rx_unblock_tx_unblock() ); // wait for an rx unblock pdu, send an unblock pdu, expect unblock ack pdu |
| 940 | // execute( TC_unblockable() ); // block a NS-VCI via vty, try block procedure |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 941 | |
Alexander Couzens | e48d355 | 2021-02-27 20:01:16 +0100 | [diff] [blame] | 942 | /* 48.016 7.2.1 Block Abnormal Condition */ |
| 943 | /* 48.016 7.2.1 Unblock Abnormal Condition */ |
| 944 | /* 48.016 7.3.1 Abnormal Condition */ |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 945 | execute( TC_reset_wrong_nsei() ); |
| 946 | execute( TC_reset_wrong_nsvci() ); |
| 947 | execute( TC_reset_wrong_nsei_nsvci() ); |
| 948 | execute( TC_reset_ack_wrong_nsei() ); |
| 949 | execute( TC_reset_ack_wrong_nsvci() ); |
| 950 | execute( TC_reset_ack_wrong_nsei_nsvci() ); |
| 951 | execute( TC_reset_retries() ); |
| 952 | execute( TC_reset_on_block_reset() ); |
Alexander Couzens | e48d355 | 2021-02-27 20:01:16 +0100 | [diff] [blame] | 953 | execute( TC_ignore_reset_ack() ); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 954 | |
Alexander Couzens | e48d355 | 2021-02-27 20:01:16 +0100 | [diff] [blame] | 955 | /* 48.016 7.4 Test procedure on frame relay */ |
| 956 | execute( TC_tx_reset_tx_alive() ); |
| 957 | execute( TC_tx_reset_rx_alive() ); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 958 | |
Alexander Couzens | e48d355 | 2021-02-27 20:01:16 +0100 | [diff] [blame] | 959 | /* 48.016 7.4.1 Abnormal Condition */ |
| 960 | if (mp_dialect == NS2_DIALECT_STATIC_RESETBLOCK) { |
| 961 | // execute( TC_alive_retries_multi() ); // check if alive retries works and block over an alive nsvc |
| 962 | execute( TC_alive_retries_single_reset() ); |
| 963 | } else if (mp_dialect == NS2_DIALECT_IPACCESS) { |
| 964 | execute( TC_alive_retries_single_no_resp() ); |
| 965 | } |
| 966 | |
| 967 | execute( TC_no_reset_alive_ack() ); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 968 | } |
Alexander Couzens | cbee32a | 2021-02-27 20:50:20 +0100 | [diff] [blame] | 969 | |
| 970 | if (mp_dialect == NS2_DIALECT_SNS) { |
Alexander Couzens | de3dfaa | 2021-08-06 17:59:54 +0200 | [diff] [blame] | 971 | if (mp_sns_role == SNS_ROLE_BSS) { |
| 972 | /* BSS test cases */ |
| 973 | execute( TC_sns_bss_config_success() ); |
| 974 | execute( TC_sns_bss_change_weight() ); |
| 975 | execute( TC_sns_bss_change_weight_timeout() ); |
| 976 | execute( TC_sns_bss_add() ); |
| 977 | execute( TC_sns_bss_del() ); |
| 978 | execute( TC_sns_bss_add_change_del() ); |
Alexander Couzens | 8122ed2 | 2021-08-06 22:01:20 +0200 | [diff] [blame] | 979 | /* execute( TC_sns_bss_all_signalling_nsvcs_failed() ); */ |
Alexander Couzens | de3dfaa | 2021-08-06 17:59:54 +0200 | [diff] [blame] | 980 | execute( TC_sns_rx_size_force_unconf() ); |
Alexander Couzens | fdfe638 | 2021-09-03 23:17:35 +0200 | [diff] [blame] | 981 | execute( TC_sns_bss_remove_bind_fail_sns() ); |
Alexander Couzens | de3dfaa | 2021-08-06 17:59:54 +0200 | [diff] [blame] | 982 | } |
Alexander Couzens | 358c74c | 2021-08-06 18:01:06 +0200 | [diff] [blame] | 983 | |
| 984 | if (mp_sns_role == SNS_ROLE_SGSN) { |
| 985 | execute( TC_sns_sgsn_config_success() ); |
Alexander Couzens | 6b51a3c | 2021-08-06 18:23:49 +0200 | [diff] [blame] | 986 | execute( TC_sns_sgsn_add() ); |
Alexander Couzens | 8a682d6 | 2021-08-06 22:24:47 +0200 | [diff] [blame] | 987 | execute( TC_sns_sgsn_del() ); |
Alexander Couzens | 3921fb5 | 2021-08-12 04:04:20 +0200 | [diff] [blame] | 988 | execute( TC_sns_sgsn_add_change_del() ); |
Alexander Couzens | 717bb21 | 2021-09-04 01:23:42 +0200 | [diff] [blame] | 989 | execute( TC_sns_sgsn_size_correct_port() ); |
Alexander Couzens | 358c74c | 2021-08-06 18:01:06 +0200 | [diff] [blame] | 990 | } |
Alexander Couzens | cbee32a | 2021-02-27 20:50:20 +0100 | [diff] [blame] | 991 | } |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 992 | } |
| 993 | |
| 994 | } |