Alexander Couzens | 8e1dfd0 | 2020-09-07 04:26:20 +0200 | [diff] [blame] | 1 | module SGSN_Tests_NS { |
| 2 | |
| 3 | /* Osmocom SGSN test suite in TTCN-3 |
| 4 | * (C) 2020 sysmocom - s.f.m.c. GmbH |
| 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 | |
| 13 | import from Osmocom_Types all; |
| 14 | import from Osmocom_Gb_Types all; |
| 15 | import from Osmocom_VTY_Functions all; |
Alexander Couzens | 8e1dfd0 | 2020-09-07 04:26:20 +0200 | [diff] [blame] | 16 | import from NS_Types all; |
| 17 | import from RAW_NS all; |
| 18 | import from SGSN_Tests all; |
| 19 | |
| 20 | type component RAW_Test_CT extends RAW_NS_CT, test_CT { |
| 21 | } |
| 22 | |
| 23 | testcase TC_NS_connect_reset() runs on RAW_Test_CT { |
| 24 | f_init_vty(); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 25 | f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0); |
Alexander Couzens | 8e1dfd0 | 2020-09-07 04:26:20 +0200 | [diff] [blame] | 26 | |
| 27 | /* Send a NS-ALIVE */ |
| 28 | f_outgoing_ns_reset(); |
| 29 | |
| 30 | f_sleep(1.0); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 31 | f_clean_ns_codec(); |
Alexander Couzens | 8e1dfd0 | 2020-09-07 04:26:20 +0200 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | testcase TC_NS_connect_alive() runs on RAW_Test_CT { |
| 35 | f_init_vty(); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 36 | f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0); |
Alexander Couzens | 8e1dfd0 | 2020-09-07 04:26:20 +0200 | [diff] [blame] | 37 | |
| 38 | /* Send a NS-ALIVE */ |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 39 | NSCP[0].send(t_NS_ALIVE); |
Alexander Couzens | 8e1dfd0 | 2020-09-07 04:26:20 +0200 | [diff] [blame] | 40 | alt { |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 41 | [] NSCP[0].receive(t_NS_ALIVE_ACK); |
| 42 | [] NSCP[0].receive(tr_NS_STATUS(*)) { setverdict(fail); } |
Alexander Couzens | 8e1dfd0 | 2020-09-07 04:26:20 +0200 | [diff] [blame] | 43 | [] NSCP[0].receive { repeat; } |
| 44 | } |
| 45 | |
| 46 | f_sleep(1.0); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 47 | f_clean_ns_codec(); |
Alexander Couzens | 8e1dfd0 | 2020-09-07 04:26:20 +0200 | [diff] [blame] | 48 | } |
| 49 | |
Harald Welte | 424ec52 | 2021-03-23 18:20:12 +0100 | [diff] [blame] | 50 | /* perform outgoing SNS-SIZE procedure */ |
| 51 | testcase TC_SNS_size() runs on RAW_Test_CT { |
| 52 | f_init_vty(); |
| 53 | f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0); |
| 54 | g_handle_rx_alive := true; |
| 55 | |
| 56 | f_outgoing_sns_size(); |
| 57 | setverdict(pass); |
| 58 | } |
| 59 | |
| 60 | /* outgoing SNS-SIZE procedure with more BSS side IPs than SGSN can handle */ |
| 61 | testcase TC_SNS_size_too_big() runs on RAW_Test_CT { |
| 62 | f_init_vty(); |
| 63 | f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0); |
| 64 | g_handle_rx_alive := true; |
| 65 | |
| 66 | f_outgoing_sns_size(cause := NS_CAUSE_INVALID_NR_OF_NSVCS, num_ip := 100); |
| 67 | setverdict(pass); |
| 68 | } |
| 69 | |
| 70 | /* perform outgoing SNS-CONFIG procedure (for BSS) */ |
| 71 | testcase TC_SNS_config_bss() runs on RAW_Test_CT { |
| 72 | f_init_vty(); |
| 73 | f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0); |
| 74 | g_handle_rx_alive := true; |
| 75 | |
| 76 | f_outgoing_sns_size(); |
| 77 | f_outgoing_sns_config(); |
| 78 | setverdict(pass); |
| 79 | } |
| 80 | |
| 81 | /* perform incoming SNS-CONFIG procedure (for SGSN) */ |
| 82 | testcase TC_SNS_config_sgsn() runs on RAW_Test_CT { |
| 83 | f_init_vty(); |
| 84 | f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0); |
| 85 | g_handle_rx_alive := true; |
| 86 | |
| 87 | f_outgoing_sns_size(); |
| 88 | f_outgoing_sns_config(); |
| 89 | f_incoming_sns_config(); |
| 90 | setverdict(pass); |
| 91 | } |
| 92 | |
| 93 | /* perform full SNS handshake and then outbound NS-ALIVE */ |
| 94 | testcase TC_SNS_and_alive() runs on RAW_Test_CT { |
| 95 | f_init_vty(); |
| 96 | f_init_ns_codec(mp_nsconfig[0], guard_secs := 120.0); |
| 97 | g_handle_rx_alive := true; |
| 98 | |
| 99 | f_outgoing_sns_size(); |
| 100 | f_outgoing_sns_config(); |
| 101 | f_incoming_sns_config(); |
| 102 | f_outgoing_ns_alive(); |
| 103 | setverdict(pass); |
| 104 | } |
| 105 | |
Alexander Couzens | 8e1dfd0 | 2020-09-07 04:26:20 +0200 | [diff] [blame] | 106 | control { |
Harald Welte | 424ec52 | 2021-03-23 18:20:12 +0100 | [diff] [blame] | 107 | |
| 108 | if (mp_nsconfig[0].handle_sns) { |
| 109 | execute( TC_SNS_size() ); |
| 110 | execute( TC_SNS_size_too_big() ); |
| 111 | execute( TC_SNS_config_bss() ); |
| 112 | execute( TC_SNS_config_sgsn() ); |
| 113 | execute( TC_SNS_and_alive() ); |
| 114 | } else { |
| 115 | execute( TC_NS_connect_alive() ); |
| 116 | execute( TC_NS_connect_reset() ); |
| 117 | } |
Alexander Couzens | 8e1dfd0 | 2020-09-07 04:26:20 +0200 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | } |