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 | |
| 27 | modulepar { |
| 28 | OsmoNsDialect mp_dialect := NS2_DIALECT_IPACCESS; |
| 29 | NSConfiguration mp_nsconfig := { |
| 30 | nsei := 96, |
| 31 | role_sgsn := false, |
| 32 | handle_sns := false, |
| 33 | nsvc := { |
| 34 | { |
| 35 | provider := { |
| 36 | ip := { |
| 37 | address_family := AF_INET, |
| 38 | local_udp_port := 21000, |
| 39 | local_ip := "127.0.0.1", |
| 40 | remote_udp_port := 23000, |
Alexander Couzens | 87e44cf | 2021-02-03 15:15:27 +0100 | [diff] [blame] | 41 | remote_ip := "127.0.0.1", |
| 42 | data_weight := 2, |
| 43 | signalling_weight := 2 |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 44 | } |
| 45 | }, |
| 46 | nsvci := 97 |
Alexander Couzens | 6f17ecc | 2021-05-25 13:43:57 +0200 | [diff] [blame^] | 47 | }, |
| 48 | { |
| 49 | provider := { |
| 50 | ip := { |
| 51 | address_family := AF_INET, |
| 52 | local_udp_port := 21000, |
| 53 | local_ip := "127.0.0.1", |
| 54 | remote_udp_port := 23001, |
| 55 | remote_ip := "127.0.0.1", |
| 56 | data_weight := 1, |
| 57 | signalling_weight := 1 |
| 58 | } |
| 59 | }, |
| 60 | nsvci := 98 |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 61 | } |
| 62 | } |
| 63 | }; |
| 64 | } |
| 65 | |
| 66 | type component RAW_Test_CT extends RAW_NS_CT { |
| 67 | port TELNETasp_PT NSVTY; |
| 68 | } |
| 69 | |
| 70 | private function f_init_vty() runs on RAW_Test_CT { |
| 71 | map(self:NSVTY, system:NSVTY); |
| 72 | f_vty_set_prompts(NSVTY); |
| 73 | f_vty_transceive(NSVTY, "enable"); |
| 74 | f_vty_transceive(NSVTY, "nsvc nsei " & int2str(mp_nsconfig.nsei) & " force-unconfigured"); |
Alexander Couzens | 6f17ecc | 2021-05-25 13:43:57 +0200 | [diff] [blame^] | 75 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(mp_nsconfig.nsei)}, "no ip-sns-bind local2"); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | /* ensure no matching message is received within 'tout' */ |
| 79 | function f_ensure_no_ns(integer idx := 0, boolean answer_alive := false, float tout := 3.0) |
| 80 | runs on RAW_Test_CT { |
| 81 | var PDU_NS nrf; |
| 82 | |
| 83 | timer T := tout; |
| 84 | var default d := activate(ax_rx_fail_on_any_ns(idx)); |
| 85 | T.start; |
| 86 | alt { |
| 87 | [answer_alive] as_rx_alive_tx_ack(); |
| 88 | [] T.timeout { |
| 89 | setverdict(pass); |
| 90 | } |
| 91 | } |
| 92 | deactivate(d); |
| 93 | } |
| 94 | |
| 95 | function f_fails_except_reset(integer idx := 0, float tout := 15.0) |
| 96 | runs on RAW_Test_CT { |
| 97 | var PDU_NS nrf; |
| 98 | timer T := 15.0; |
| 99 | T.start; |
| 100 | alt { |
| 101 | [] NSCP[idx].receive(tr_NS_RESET(*, *, *)) { |
| 102 | repeat; |
| 103 | } |
| 104 | [] NSCP[idx].receive(PDU_NS: ?) -> value nrf { |
| 105 | setverdict(fail, "Received unexpected NS: ", nrf); |
| 106 | mtc.stop; |
| 107 | } |
| 108 | [] T.timeout { |
| 109 | setverdict(pass); |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | testcase TC_tx_reset() runs on RAW_Test_CT { |
| 115 | f_init_vty(); |
| 116 | f_init_ns_codec(mp_nsconfig, guard_secs := 10.0); |
| 117 | |
| 118 | /* do a NS Reset procedure */ |
| 119 | f_outgoing_ns_reset(); |
| 120 | |
| 121 | setverdict(pass); |
| 122 | f_sleep(1.0); |
| 123 | } |
| 124 | |
| 125 | testcase TC_tx_reset_tx_alive() 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 | /* check outgoing NS procedure */ |
| 133 | f_outgoing_ns_alive(); |
| 134 | |
| 135 | setverdict(pass); |
| 136 | f_sleep(1.0); |
| 137 | } |
| 138 | |
| 139 | testcase TC_tx_reset_rx_alive() runs on RAW_Test_CT { |
| 140 | f_init_vty(); |
| 141 | f_init_ns_codec(mp_nsconfig, guard_secs := 10.0); |
| 142 | |
| 143 | /* do a NS Reset procedure */ |
| 144 | f_outgoing_ns_reset(); |
| 145 | |
| 146 | activate(as_rx_ns_unblock_ack()); |
| 147 | /* check outgoing NS procedure */ |
| 148 | as_rx_alive_tx_ack(oneshot := true); |
| 149 | |
| 150 | setverdict(pass); |
| 151 | f_sleep(1.0); |
| 152 | } |
| 153 | |
| 154 | /* 48.016 7.2 unblock procedure |
| 155 | * |
| 156 | * TTCN -> NS: reset |
| 157 | * TTCN <- NS: reset ack |
| 158 | * TTCN -> NS: unblock |
| 159 | * TTCN <- NS: unblock ack |
| 160 | */ |
| 161 | testcase TC_tx_unblock() runs on RAW_Test_CT { |
| 162 | f_init_vty(); |
| 163 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 164 | |
| 165 | /* do a NS Reset procedure */ |
| 166 | f_outgoing_ns_reset(); |
| 167 | /* send alive acks */ |
| 168 | activate(as_rx_alive_tx_ack()); |
| 169 | |
| 170 | f_outgoing_ns_unblock(); |
| 171 | setverdict(pass); |
| 172 | f_sleep(1.0); |
| 173 | } |
| 174 | |
| 175 | /* 48.016 7.2 tx unblock retries |
| 176 | * |
| 177 | * TTCN -> NS: reset |
| 178 | * TTCN <- NS: reset ack |
| 179 | * TTCN -> NS: unblock |
| 180 | * TTCN <- NS: unblock ack |
| 181 | * TTCN -> NS: unblock |
| 182 | * TTCN <- NS: unblock ack |
| 183 | * TTCN -> NS: unblock |
| 184 | * TTCN <- NS: unblock ack |
| 185 | */ |
| 186 | testcase TC_tx_unblock_retries() runs on RAW_Test_CT { |
| 187 | f_init_vty(); |
| 188 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 189 | |
| 190 | /* do a NS Reset procedure */ |
| 191 | f_outgoing_ns_reset(); |
| 192 | /* send alive acks */ |
| 193 | activate(as_rx_alive_tx_ack()); |
| 194 | |
| 195 | f_outgoing_ns_unblock(); |
| 196 | f_outgoing_ns_unblock(); |
| 197 | f_outgoing_ns_unblock(); |
| 198 | setverdict(pass); |
| 199 | f_sleep(1.0); |
| 200 | } |
| 201 | |
| 202 | /* 48.016 7.2 block procedure |
| 203 | * |
| 204 | * TTCN -> NS: reset |
| 205 | * TTCN <- NS: reset ack |
| 206 | * TTCN -> NS: unblock |
| 207 | * TTCN <- NS: unblock ack |
| 208 | * TTCN -> NS: block |
| 209 | * TTCN <- NS: block ack |
| 210 | */ |
| 211 | testcase TC_tx_block() runs on RAW_Test_CT { |
| 212 | f_init_vty(); |
| 213 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 214 | |
| 215 | /* do a NS Reset procedure */ |
| 216 | f_outgoing_ns_reset(); |
| 217 | activate(as_rx_alive_tx_ack()); |
| 218 | |
| 219 | f_outgoing_ns_unblock(); |
| 220 | f_sleep(1.0); |
| 221 | |
| 222 | f_outgoing_ns_block(NS_CAUSE_EQUIPMENT_FAILURE); |
| 223 | setverdict(pass); |
| 224 | f_sleep(1.0); |
| 225 | } |
| 226 | |
| 227 | /* 48.016 7.2 block procedure by vty |
| 228 | * |
| 229 | * TTCN -> NS: reset |
| 230 | * TTCN <- NS: reset ack |
| 231 | * TTCN -> NS: unblock |
| 232 | * TTCN <- NS: unblock ack |
| 233 | * vty: block nsvc |
| 234 | * TTCN <- NS: block |
| 235 | * TTCN -> NS: block ack |
| 236 | */ |
| 237 | function tx_block_by_vty(float guard_secs := 30.0) runs on RAW_Test_CT { |
| 238 | f_init_vty(); |
| 239 | f_init_ns_codec(mp_nsconfig, guard_secs := guard_secs); |
| 240 | |
| 241 | /* do a NS Reset procedure */ |
| 242 | f_outgoing_ns_reset(); |
| 243 | activate(as_rx_alive_tx_ack()); |
| 244 | |
| 245 | f_outgoing_ns_unblock(); |
| 246 | f_sleep(1.0); |
| 247 | |
| 248 | f_vty_transceive(NSVTY, "nsvc " & int2str(mp_nsconfig.nsvc[0].nsvci) & " block"); |
| 249 | |
| 250 | alt { |
| 251 | [] as_rx_ns_block_ack(oneshot := true, nsvci := mp_nsconfig.nsvc[0].nsvci); |
| 252 | } |
| 253 | setverdict(pass); |
| 254 | } |
| 255 | |
| 256 | testcase TC_tx_block_by_vty() runs on RAW_Test_CT { |
| 257 | tx_block_by_vty(30.0); |
| 258 | f_sleep(1.0); |
| 259 | } |
| 260 | |
| 261 | /* 48.016 7.2 block precedure by vty and reset the NSVC. |
| 262 | * The NSVC should be still blocked after the reset. |
| 263 | */ |
| 264 | testcase TC_tx_block_by_vty_reset() runs on RAW_Test_CT { |
| 265 | timer T := 10.0; |
| 266 | |
| 267 | tx_block_by_vty(60.0); |
| 268 | f_outgoing_ns_reset(); |
| 269 | |
| 270 | var default d := activate(ax_rx_fail_on_any_ns()); |
| 271 | T.start; |
| 272 | alt { |
| 273 | [] as_rx_alive_tx_ack(); |
| 274 | [] T.timeout { setverdict(pass); } |
| 275 | } |
| 276 | deactivate(d); |
| 277 | } |
| 278 | |
| 279 | /* 48.016 7.4.1 ignore unexpected NS_ALIVE ACK */ |
| 280 | testcase TC_no_reset_alive_ack() runs on RAW_Test_CT { |
| 281 | f_init_vty(); |
| 282 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 283 | |
| 284 | NSCP[0].send(t_NS_ALIVE_ACK); |
| 285 | f_fails_except_reset(); |
| 286 | setverdict(pass); |
| 287 | f_sleep(1.0); |
| 288 | } |
| 289 | |
| 290 | /* 48.016 7.3.1 NS_RESET with wrong nsei */ |
| 291 | testcase TC_reset_wrong_nsei() runs on RAW_Test_CT { |
| 292 | f_init_vty(); |
| 293 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 294 | |
| 295 | NSCP[0].send(ts_NS_RESET(NS_CAUSE_EQUIPMENT_FAILURE, g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei + 20)); |
| 296 | NSCP[0].receive(tr_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 297 | f_fails_except_reset(); |
| 298 | setverdict(pass); |
| 299 | f_sleep(1.0); |
| 300 | } |
| 301 | |
| 302 | /* 48.016 7.3.1 NS_RESET with wrong nsvci */ |
| 303 | testcase TC_reset_wrong_nsvci() runs on RAW_Test_CT { |
| 304 | f_init_vty(); |
| 305 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 306 | |
| 307 | NSCP[0].send(ts_NS_RESET(NS_CAUSE_EQUIPMENT_FAILURE, g_nsconfig.nsvc[0].nsvci + 20, g_nsconfig.nsei)); |
| 308 | NSCP[0].receive(tr_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 309 | f_fails_except_reset(); |
| 310 | setverdict(pass); |
| 311 | f_sleep(1.0); |
| 312 | } |
| 313 | |
| 314 | /* 48.016 7.3.1 NS_RESET with wrong nsvci + nsei */ |
| 315 | testcase TC_reset_wrong_nsei_nsvci() runs on RAW_Test_CT { |
| 316 | f_init_vty(); |
| 317 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 318 | |
| 319 | NSCP[0].send(ts_NS_RESET(NS_CAUSE_EQUIPMENT_FAILURE, g_nsconfig.nsvc[0].nsvci + 20, g_nsconfig.nsei + 20)); |
| 320 | NSCP[0].receive(tr_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 321 | f_fails_except_reset(); |
| 322 | setverdict(pass); |
| 323 | f_sleep(1.0); |
| 324 | } |
| 325 | |
| 326 | /* 48.016 7.3.1 NS_RESET_ACK with wrong nsei */ |
| 327 | testcase TC_reset_ack_wrong_nsei() runs on RAW_Test_CT { |
| 328 | f_init_vty(); |
| 329 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 330 | |
| 331 | NSCP[0].receive(tr_NS_RESET(*, g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 332 | NSCP[0].send(ts_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei + 20)); |
| 333 | f_fails_except_reset(); |
| 334 | setverdict(pass); |
| 335 | f_sleep(1.0); |
| 336 | } |
| 337 | |
| 338 | /* 48.016 7.3.1 NS_RESET_ACK with wrong nsvci */ |
| 339 | testcase TC_reset_ack_wrong_nsvci() runs on RAW_Test_CT { |
| 340 | f_init_vty(); |
| 341 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 342 | |
| 343 | NSCP[0].receive(tr_NS_RESET(*, g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 344 | NSCP[0].send(ts_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci + 20, g_nsconfig.nsei)); |
| 345 | f_fails_except_reset(); |
| 346 | setverdict(pass); |
| 347 | f_sleep(1.0); |
| 348 | } |
| 349 | |
| 350 | /* 48.016 7.3.1 NS_RESET_ACK with wrong nsvci + nsei */ |
| 351 | testcase TC_reset_ack_wrong_nsei_nsvci() runs on RAW_Test_CT { |
| 352 | f_init_vty(); |
| 353 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 354 | |
| 355 | NSCP[0].receive(tr_NS_RESET(*, g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 356 | NSCP[0].send(ts_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci + 20, g_nsconfig.nsei + 20)); |
| 357 | f_fails_except_reset(); |
| 358 | setverdict(pass); |
| 359 | f_sleep(1.0); |
| 360 | } |
| 361 | |
| 362 | /* 48.016 7.3.1 ignore unexpected NS_RESET_ACK after NS_RESET+ALIVE */ |
| 363 | testcase TC_ignore_reset_ack() runs on RAW_Test_CT { |
| 364 | f_init_vty(); |
| 365 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 366 | |
| 367 | /* do a NS Reset procedure */ |
| 368 | f_outgoing_ns_reset(); |
| 369 | |
| 370 | /* unblock and alive */ |
| 371 | alt { |
| 372 | [] as_rx_ns_unblock_ack(oneshot := true); |
| 373 | [] as_rx_alive_tx_ack(); |
| 374 | } |
| 375 | |
| 376 | NSCP[0].send(ts_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 377 | f_ensure_no_ns(answer_alive := true, tout := 15.0); |
| 378 | setverdict(pass); |
| 379 | f_sleep(1.0); |
| 380 | } |
| 381 | |
| 382 | /* 48.016 7.3 NS_RESET retries */ |
| 383 | testcase TC_reset_retries() runs on RAW_Test_CT { |
| 384 | var integer reset := 0; |
| 385 | |
| 386 | f_init_vty(); |
| 387 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 388 | |
| 389 | alt { |
| 390 | [] NSCP[0].receive(tr_NS_RESET(*, *, *)) { |
| 391 | reset := reset + 1; |
| 392 | if (reset <= 3) { |
| 393 | repeat; |
| 394 | } else { |
| 395 | setverdict(pass); |
| 396 | } |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | f_sleep(1.0); |
| 401 | } |
| 402 | |
| 403 | /* 48.016 behave RESET_ACK got dropped |
| 404 | * TTCN -> NS: reset |
| 405 | * TTCN <- NS: reset ack |
| 406 | * TTCN <- NS: unblock |
| 407 | * TTCN -> NS: reset |
| 408 | * TTCN <- NS: reset ack |
| 409 | * TTCN <- NS: unblock |
| 410 | */ |
| 411 | testcase TC_reset_on_block_reset() runs on RAW_Test_CT { |
| 412 | var integer i := 0; |
| 413 | |
| 414 | f_init_vty(); |
| 415 | f_init_ns_codec(mp_nsconfig, guard_secs := 30.0); |
| 416 | |
| 417 | f_outgoing_ns_reset(); |
| 418 | activate(as_rx_alive_tx_ack()); |
| 419 | |
| 420 | alt { |
| 421 | [] NSCP[0].receive(t_NS_UNBLOCK) { |
| 422 | NSCP[0].send(ts_NS_RESET(NS_CAUSE_EQUIPMENT_FAILURE, g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 423 | i := i + 1; |
| 424 | if (i < 3) { |
| 425 | repeat; |
| 426 | } else { |
| 427 | setverdict(pass); |
| 428 | } |
| 429 | } |
| 430 | [] NSCP[0].receive(tr_NS_RESET_ACK(g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)) { repeat; } |
| 431 | } |
| 432 | |
| 433 | f_sleep(1.0); |
| 434 | } |
| 435 | |
| 436 | /* 48.016 7.4 test procedure for frame relay with a single nsvci */ |
| 437 | function f_alive_retries_single(boolean reset := false) runs on RAW_Test_CT { |
| 438 | f_init_vty(); |
| 439 | f_init_ns_codec(mp_nsconfig, guard_secs := 60.0); |
| 440 | |
| 441 | /* do a NS Reset procedure */ |
| 442 | f_outgoing_ns_reset(); |
| 443 | |
| 444 | alt { |
| 445 | [] as_rx_ns_unblock_ack(oneshot := true); |
| 446 | [] as_rx_alive_tx_ack(); |
| 447 | } |
| 448 | |
| 449 | /* wait for one alive and answer it */ |
| 450 | as_rx_alive_tx_ack(oneshot := true); |
| 451 | NSCP[0].receive(t_NS_ALIVE); |
| 452 | NSCP[0].receive(t_NS_ALIVE); |
| 453 | NSCP[0].receive(t_NS_ALIVE); |
| 454 | NSCP[0].receive(t_NS_ALIVE); |
| 455 | if (reset) { |
| 456 | NSCP[0].receive(tr_NS_RESET(*, g_nsconfig.nsvc[0].nsvci, g_nsconfig.nsei)); |
| 457 | } else { |
| 458 | f_ensure_no_ns(tout := 10.0); |
| 459 | } |
| 460 | |
| 461 | setverdict(pass); |
| 462 | f_sleep(1.0); |
| 463 | } |
| 464 | |
| 465 | testcase TC_alive_retries_single_reset() runs on RAW_Test_CT { |
| 466 | f_alive_retries_single(reset := true); |
| 467 | } |
| 468 | |
| 469 | testcase TC_alive_retries_single_no_resp() runs on RAW_Test_CT { |
| 470 | f_alive_retries_single(reset := false); |
| 471 | } |
| 472 | |
Alexander Couzens | cbee32a | 2021-02-27 20:50:20 +0100 | [diff] [blame] | 473 | /* 48.016 SNS test cases */ |
| 474 | |
| 475 | /* do a succesful SNS configuration */ |
| 476 | testcase TC_sns_config_success() runs on RAW_Test_CT { |
| 477 | f_init_vty(); |
| 478 | f_init_ns_codec(mp_nsconfig); |
| 479 | f_incoming_sns_size(); |
| 480 | f_incoming_sns_config(); |
| 481 | f_outgoing_sns_config(); |
| 482 | setverdict(pass); |
| 483 | f_clean_ns_codec(); |
| 484 | } |
| 485 | |
Alexander Couzens | d5ac510 | 2021-02-27 20:53:37 +0100 | [diff] [blame] | 486 | testcase TC_sns_bss_change_weight() runs on RAW_Test_CT { |
Alexander Couzens | 60548b1 | 2021-04-14 19:39:26 +0200 | [diff] [blame] | 487 | g_handle_rx_alive := true; |
Alexander Couzens | d5ac510 | 2021-02-27 20:53:37 +0100 | [diff] [blame] | 488 | f_init_vty(); |
| 489 | f_init_ns_codec(mp_nsconfig); |
| 490 | f_incoming_sns_size(); |
| 491 | f_incoming_sns_config(); |
| 492 | f_outgoing_sns_config(); |
| 493 | activate(as_rx_alive_tx_ack()); |
| 494 | f_vty_config2(NSVTY, {"ns", "bind udp local"}, "ip-sns signalling-weight 99 data-weight 99"); |
| 495 | f_incoming_sns_chg_weight(); |
| 496 | setverdict(pass); |
| 497 | f_clean_ns_codec(); |
| 498 | } |
| 499 | |
Alexander Couzens | 6c723fb | 2021-03-01 00:12:00 +0100 | [diff] [blame] | 500 | /* receive 3x SNS_CHG_WEIGHT but never answer on it */ |
| 501 | testcase TC_sns_bss_change_weight_timeout() runs on RAW_Test_CT { |
| 502 | var integer i := 0; |
| 503 | var template PDU_NS rx; |
| 504 | var NSVCConfiguration nsvc_cfg; |
| 505 | |
Alexander Couzens | 60548b1 | 2021-04-14 19:39:26 +0200 | [diff] [blame] | 506 | g_handle_rx_alive := true; |
Alexander Couzens | 6c723fb | 2021-03-01 00:12:00 +0100 | [diff] [blame] | 507 | f_init_vty(); |
| 508 | f_init_ns_codec(mp_nsconfig); |
| 509 | f_incoming_sns_size(); |
| 510 | f_incoming_sns_config(); |
| 511 | f_outgoing_sns_config(); |
| 512 | activate(as_rx_alive_tx_ack()); |
| 513 | f_vty_config2(NSVTY, {"ns", "bind udp local"}, "ip-sns signalling-weight 99 data-weight 99"); |
| 514 | |
| 515 | nsvc_cfg := g_nsconfig.nsvc[0]; |
| 516 | if (nsvc_cfg.provider.ip.address_family == AF_INET) { |
| 517 | var template IP4_Elements v4_elem := { tr_SNS_IPv4(nsvc_cfg.provider.ip.remote_ip, |
| 518 | nsvc_cfg.provider.ip.remote_udp_port) }; |
| 519 | |
| 520 | rx := tr_SNS_CHG_WEIGHT(g_nsconfig.nsei, ?, v4 := v4_elem); |
| 521 | } else { |
| 522 | var template IP6_Elements v6_elem := { tr_SNS_IPv6(nsvc_cfg.provider.ip.remote_ip, |
| 523 | nsvc_cfg.provider.ip.remote_udp_port) }; |
| 524 | rx := tr_SNS_CHG_WEIGHT(g_nsconfig.nsei, ?, v4 := omit, v6 := v6_elem); |
| 525 | } |
| 526 | |
Alexander Couzens | 60548b1 | 2021-04-14 19:39:26 +0200 | [diff] [blame] | 527 | for (i := 0; i < 3; i := i + 1) { |
| 528 | f_ns_exp(rx); |
Alexander Couzens | 6c723fb | 2021-03-01 00:12:00 +0100 | [diff] [blame] | 529 | } |
| 530 | |
Alexander Couzens | a93cc36 | 2021-04-14 19:39:18 +0200 | [diff] [blame] | 531 | if (nsvc_cfg.provider.ip.address_family == AF_INET) { |
| 532 | /* expect one single SNS-SIZE with RESET flag; 4x v4 EP; no v6 EP */ |
| 533 | rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := ?, |
| 534 | num_v4 := ?, num_v6 := omit), 0); |
| 535 | } else { |
| 536 | /* expect one single SNS-SIZE with RESET flag; no v4 EP; 4x v6 EP */ |
| 537 | rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := ?, |
| 538 | num_v4 := omit, num_v6 := ?), 0); |
| 539 | } |
| 540 | |
Alexander Couzens | 6c723fb | 2021-03-01 00:12:00 +0100 | [diff] [blame] | 541 | setverdict(pass); |
| 542 | f_clean_ns_codec(); |
| 543 | } |
| 544 | |
Alexander Couzens | 6f17ecc | 2021-05-25 13:43:57 +0200 | [diff] [blame^] | 545 | testcase TC_sns_bss_add() runs on RAW_Test_CT { |
| 546 | g_handle_rx_alive := true; |
| 547 | f_init_vty(); |
| 548 | f_init_ns_codec(mp_nsconfig); |
| 549 | f_init_ns_codec(mp_nsconfig, 1); |
| 550 | f_incoming_sns_size(); |
| 551 | f_incoming_sns_config(); |
| 552 | f_outgoing_sns_config(); |
| 553 | activate(as_rx_alive_tx_ack()); |
| 554 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "ip-sns-bind local2"); |
| 555 | f_incoming_sns_add(idx_add := 1); |
| 556 | as_rx_alive_tx_ack(oneshot := true, idx := 1); |
| 557 | setverdict(pass); |
| 558 | f_clean_ns_codec(); |
| 559 | } |
| 560 | |
| 561 | testcase TC_sns_bss_del() runs on RAW_Test_CT { |
| 562 | g_handle_rx_alive := true; |
| 563 | f_init_vty(); |
| 564 | f_init_ns_codec(mp_nsconfig); |
| 565 | f_init_ns_codec(mp_nsconfig, 1); |
| 566 | f_incoming_sns_size(); |
| 567 | f_incoming_sns_config(); |
| 568 | f_outgoing_sns_config(); |
| 569 | activate(as_rx_alive_tx_ack()); |
| 570 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "ip-sns-bind local2"); |
| 571 | f_incoming_sns_add(idx_add := 1); |
| 572 | as_rx_alive_tx_ack(oneshot := true, idx := 1); |
| 573 | |
| 574 | /* delete the endpoint */ |
| 575 | f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "no ip-sns-bind local2"); |
| 576 | f_incoming_sns_del(idx_del := 1); |
| 577 | setverdict(pass); |
| 578 | f_clean_ns_codec(); |
| 579 | } |
| 580 | |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 581 | control { |
Alexander Couzens | e48d355 | 2021-02-27 20:01:16 +0100 | [diff] [blame] | 582 | if (mp_dialect == NS2_DIALECT_STATIC_RESETBLOCK or mp_dialect == NS2_DIALECT_IPACCESS) { |
| 583 | execute( TC_tx_reset() ); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 584 | |
Alexander Couzens | e48d355 | 2021-02-27 20:01:16 +0100 | [diff] [blame] | 585 | /* 48.016 7.2 Block procedure */ |
| 586 | execute( TC_tx_block() ); |
| 587 | execute( TC_tx_block_by_vty() ); |
| 588 | execute( TC_tx_block_by_vty_reset() ); |
| 589 | // execute( TC_block_other_nsvc() ); // reset, unblock, sleep(1), block over another nsvci |
| 590 | /* 48.016 7.2 Unblock procedure */ |
| 591 | execute( TC_tx_unblock() ); |
| 592 | execute( TC_tx_unblock_retries() ); |
| 593 | // execute( TC_rx_unblock_tx_unblock() ); // wait for an rx unblock pdu, send an unblock pdu, expect unblock ack pdu |
| 594 | // execute( TC_unblockable() ); // block a NS-VCI via vty, try block procedure |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 595 | |
Alexander Couzens | e48d355 | 2021-02-27 20:01:16 +0100 | [diff] [blame] | 596 | /* 48.016 7.2.1 Block Abnormal Condition */ |
| 597 | /* 48.016 7.2.1 Unblock Abnormal Condition */ |
| 598 | /* 48.016 7.3.1 Abnormal Condition */ |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 599 | execute( TC_reset_wrong_nsei() ); |
| 600 | execute( TC_reset_wrong_nsvci() ); |
| 601 | execute( TC_reset_wrong_nsei_nsvci() ); |
| 602 | execute( TC_reset_ack_wrong_nsei() ); |
| 603 | execute( TC_reset_ack_wrong_nsvci() ); |
| 604 | execute( TC_reset_ack_wrong_nsei_nsvci() ); |
| 605 | execute( TC_reset_retries() ); |
| 606 | execute( TC_reset_on_block_reset() ); |
Alexander Couzens | e48d355 | 2021-02-27 20:01:16 +0100 | [diff] [blame] | 607 | execute( TC_ignore_reset_ack() ); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 608 | |
Alexander Couzens | e48d355 | 2021-02-27 20:01:16 +0100 | [diff] [blame] | 609 | /* 48.016 7.4 Test procedure on frame relay */ |
| 610 | execute( TC_tx_reset_tx_alive() ); |
| 611 | execute( TC_tx_reset_rx_alive() ); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 612 | |
Alexander Couzens | e48d355 | 2021-02-27 20:01:16 +0100 | [diff] [blame] | 613 | /* 48.016 7.4.1 Abnormal Condition */ |
| 614 | if (mp_dialect == NS2_DIALECT_STATIC_RESETBLOCK) { |
| 615 | // execute( TC_alive_retries_multi() ); // check if alive retries works and block over an alive nsvc |
| 616 | execute( TC_alive_retries_single_reset() ); |
| 617 | } else if (mp_dialect == NS2_DIALECT_IPACCESS) { |
| 618 | execute( TC_alive_retries_single_no_resp() ); |
| 619 | } |
| 620 | |
| 621 | execute( TC_no_reset_alive_ack() ); |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 622 | } |
Alexander Couzens | cbee32a | 2021-02-27 20:50:20 +0100 | [diff] [blame] | 623 | |
| 624 | if (mp_dialect == NS2_DIALECT_SNS) { |
| 625 | execute( TC_sns_config_success() ); |
Alexander Couzens | d5ac510 | 2021-02-27 20:53:37 +0100 | [diff] [blame] | 626 | execute( TC_sns_bss_change_weight() ); |
Alexander Couzens | 6c723fb | 2021-03-01 00:12:00 +0100 | [diff] [blame] | 627 | execute( TC_sns_bss_change_weight_timeout() ); |
Alexander Couzens | 6f17ecc | 2021-05-25 13:43:57 +0200 | [diff] [blame^] | 628 | execute( TC_sns_bss_add() ); |
| 629 | execute( TC_sns_bss_del() ); |
Alexander Couzens | cbee32a | 2021-02-27 20:50:20 +0100 | [diff] [blame] | 630 | } |
Alexander Couzens | 20cd41e | 2021-01-11 02:56:03 +0100 | [diff] [blame] | 631 | } |
| 632 | |
| 633 | } |