Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 1 | module PCU_Tests_SNS { |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 2 | |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 3 | /* Osmocom PCU test suite for IP Sub-Network-Service (SNS) in TTCN-3 |
| 4 | * (C) 2018-2019 Harald Welte <laforge@gnumonks.org> |
| 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 | |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 13 | import from Osmocom_Types all; |
Pau Espin Pedrol | 8dd59fb | 2020-04-29 15:08:16 +0200 | [diff] [blame] | 14 | import from PCU_Tests_NS all; |
Pau Espin Pedrol | 0e6ed2e | 2020-04-29 14:33:13 +0200 | [diff] [blame] | 15 | import from SGSN_Components all; |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 16 | import from Osmocom_Gb_Types all; |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 17 | import from NS_Emulation all; |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 18 | import from NS_Types all; |
Alexander Couzens | 3c268da | 2020-09-07 04:25:05 +0200 | [diff] [blame] | 19 | import from RAW_NS all; |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 20 | |
| 21 | /********************************************************************************** |
| 22 | * Modern Gb/IP bring-up test cases using IP Sub-Network Service (SNS) |
| 23 | **********************************************************************************/ |
| 24 | |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 25 | /* perform inbound SNS-SIZE procedure */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 26 | function f_incoming_sns_size(template (omit) NsCause cause := omit, integer idx := 0) |
| 27 | runs on RAW_NS_CT { |
Harald Welte | b63c3a1 | 2019-02-22 23:27:12 +0100 | [diff] [blame] | 28 | log("f_incoming_sns_size(idx=", idx, ")"); |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 29 | var PDU_NS rx; |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 30 | var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx]; |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 31 | |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 32 | if (nsvc_cfg.provider.ip.address_family == AF_INET) { |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 33 | /* expect one single SNS-SIZE with RESET flag; 4x v4 EP; no v6 EP */ |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 34 | rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := 8, |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 35 | num_v4 := 4, num_v6 := omit), idx); |
| 36 | } else { |
| 37 | /* expect one single SNS-SIZE with RESET flag; no v4 EP; 4x v6 EP */ |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 38 | rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := 8, |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 39 | num_v4 := omit, num_v6 := 4), idx); |
| 40 | } |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 41 | NSCP[idx].send(ts_SNS_SIZE_ACK(g_nsconfig.nsei, cause)); |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | /* perform outbound SNS-SIZE procedure */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 45 | function f_outgoing_sns_size(template (omit) NsCause cause := omit, integer idx:= 0) |
| 46 | runs on RAW_NS_CT { |
Harald Welte | b63c3a1 | 2019-02-22 23:27:12 +0100 | [diff] [blame] | 47 | log("f_outgoing_sns_size(idx=", idx, ")"); |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 48 | var PDU_NS rx; |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 49 | var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx]; |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 50 | |
| 51 | if (nsvc_cfg.provider.ip.address_family == AF_INET) { |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 52 | NSCP[idx].send(ts_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := 1, |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 53 | num_v4 := 1, num_v6 := omit) |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 54 | ); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 55 | } else { |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 56 | NSCP[idx].send(ts_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := 1, |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 57 | num_v4 := omit, num_v6 := 1) |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 58 | ); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 59 | } |
| 60 | /* expect one single SNS-SIZE with RESET flag; 4x v4 EP; no v6 EP */ |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 61 | rx := f_ns_exp(tr_SNS_SIZE_ACK(g_nsconfig.nsei, cause), idx); |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | /* perform inbound SNS-CONFIG procedure */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 65 | function f_incoming_sns_config(template (omit) NsCause cause := omit, integer idx := 0) |
| 66 | runs on RAW_NS_CT { |
Harald Welte | b63c3a1 | 2019-02-22 23:27:12 +0100 | [diff] [blame] | 67 | log("f_incoming_sns_config(idx=", idx, ")"); |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 68 | var PDU_NS rx; |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 69 | var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx]; |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 70 | |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 71 | if (nsvc_cfg.provider.ip.address_family == AF_INET) { |
| 72 | var template IP4_Elements v4_elem := { tr_SNS_IPv4(nsvc_cfg.provider.ip.remote_ip, |
| 73 | nsvc_cfg.provider.ip.remote_udp_port) }; |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 74 | rx := f_ns_exp(tr_SNS_CONFIG(g_nsconfig.nsei, end_flag := true, v4 := v4_elem), idx); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 75 | } else { |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 76 | var template IP6_Elements v6_elem := { tr_SNS_IPv6(nsvc_cfg.provider.ip.remote_ip, |
| 77 | nsvc_cfg.provider.ip.remote_udp_port) }; |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 78 | rx := f_ns_exp(tr_SNS_CONFIG(g_nsconfig.nsei, end_flag := true, v6 := v6_elem), idx); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 79 | } |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 80 | NSCP[idx].send(ts_SNS_CONFIG_ACK(g_nsconfig.nsei, cause)); |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | /* perform outbound SNS-CONFIG procedure */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 84 | function f_outgoing_sns_config(template (omit) NsCause cause := omit, integer idx := 0) |
| 85 | runs on RAW_NS_CT { |
Harald Welte | b63c3a1 | 2019-02-22 23:27:12 +0100 | [diff] [blame] | 86 | log("f_outgoing_sns_config(idx=", idx, ")"); |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 87 | var PDU_NS rx; |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 88 | var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx]; |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 89 | |
| 90 | if (nsvc_cfg.provider.ip.address_family == AF_INET) { |
| 91 | var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip, |
| 92 | nsvc_cfg.provider.ip.local_udp_port) } |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 93 | NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, v4)); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 94 | } else { |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 95 | var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip, |
| 96 | nsvc_cfg.provider.ip.local_udp_port) } |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 97 | NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, omit, v6)); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 98 | } |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 99 | rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig.nsei, cause), idx); |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 100 | } |
| 101 | |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 102 | /* perform outbound SNS-CONFIG procedure (separate endpoints: 1 for control, 1 for user */ |
| 103 | function f_outgoing_sns_config_1c1u(template (omit) NsCause cause := omit, integer idx := 0) |
| 104 | runs on RAW_NS_CT { |
Harald Welte | b63c3a1 | 2019-02-22 23:27:12 +0100 | [diff] [blame] | 105 | log("f_outgoing_sns_config_1c1u(idx=", idx, ")"); |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 106 | var PDU_NS rx; |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 107 | |
| 108 | if (mp_nsconfig.nsvc[0].provider.ip.address_family == AF_INET) { |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 109 | var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig.nsvc[0].provider.ip.local_ip, |
| 110 | g_nsconfig.nsvc[0].provider.ip.local_udp_port, 1, 0), |
| 111 | ts_SNS_IPv4(g_nsconfig.nsvc[1].provider.ip.local_ip, |
| 112 | g_nsconfig.nsvc[1].provider.ip.local_udp_port, 0, 1) }; |
| 113 | NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, v4)); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 114 | } else { |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 115 | var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig.nsvc[0].provider.ip.local_ip, |
| 116 | g_nsconfig.nsvc[0].provider.ip.local_udp_port, 1, 0), |
| 117 | ts_SNS_IPv6(g_nsconfig.nsvc[1].provider.ip.local_ip, |
| 118 | g_nsconfig.nsvc[1].provider.ip.local_udp_port, 0, 1) }; |
| 119 | NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, omit, v6)); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 120 | } |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 121 | rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig.nsei, cause), idx); |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 122 | } |
| 123 | |
Harald Welte | ecd159e | 2019-03-16 13:36:07 +0100 | [diff] [blame] | 124 | /* perform outbound SNS-CONFIG procedure (separate endpoints: 1 for control, 1 for user */ |
| 125 | function f_outgoing_sns_config_1c1u_separate(template (omit) NsCause cause := omit, integer idx := 0) |
| 126 | runs on RAW_NS_CT { |
| 127 | log("f_outgoing_sns_config_1c1u_separate(idx=", idx, ")"); |
| 128 | var PDU_NS rx; |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 129 | if (mp_nsconfig.nsvc[0].provider.ip.address_family == AF_INET) { |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 130 | var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig.nsvc[1].provider.ip.local_ip, |
| 131 | g_nsconfig.nsvc[1].provider.ip.local_udp_port, 1, 0), |
| 132 | ts_SNS_IPv4(g_nsconfig.nsvc[2].provider.ip.local_ip, |
| 133 | g_nsconfig.nsvc[2].provider.ip.local_udp_port, 0, 1) }; |
| 134 | NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, v4)); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 135 | } else { |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 136 | var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig.nsvc[1].provider.ip.local_ip, |
| 137 | g_nsconfig.nsvc[1].provider.ip.local_udp_port, 1, 0), |
| 138 | ts_SNS_IPv6(g_nsconfig.nsvc[2].provider.ip.local_ip, |
| 139 | g_nsconfig.nsvc[2].provider.ip.local_udp_port, 0, 1) }; |
| 140 | NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, omit, v6)); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 141 | } |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 142 | rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig.nsei, cause), idx); |
Harald Welte | ecd159e | 2019-03-16 13:36:07 +0100 | [diff] [blame] | 143 | } |
| 144 | |
Alexander Couzens | 2a0ac80 | 2020-12-09 02:19:29 +0100 | [diff] [blame] | 145 | function f_outgoing_sns_add(integer idx_add, uint8_t w_sig := 1, uint8_t w_user := 1, integer idx := 0, template (omit) NsCause cause := omit) |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 146 | runs on RAW_NS_CT { |
| 147 | log("f_outgoing_sns_add(idx_add=", idx_add, ")"); |
| 148 | var PDU_NS rx; |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 149 | var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx_add]; |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 150 | if (nsvc_cfg.provider.ip.address_family == AF_INET) { |
| 151 | var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip, |
| 152 | nsvc_cfg.provider.ip.local_udp_port, |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 153 | w_sig, w_user) }; |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 154 | NSCP[idx].send(ts_SNS_ADD(g_nsconfig.nsei, 23, v4)); |
| 155 | rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 23, cause, v4)); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 156 | } else { |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 157 | var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip, |
| 158 | nsvc_cfg.provider.ip.local_udp_port, |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 159 | w_sig, w_user) }; |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 160 | NSCP[idx].send(ts_SNS_ADD(g_nsconfig.nsei, 23, omit, v6)); |
| 161 | rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 23, cause, omit, v6)); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 162 | } |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | function f_outgoing_sns_del(integer idx_del, uint8_t w_sig := 1, uint8_t w_user := 1, integer idx := 0) |
| 166 | runs on RAW_NS_CT { |
| 167 | log("f_outgoing_sns_del(idx_del=", idx_del, ")"); |
| 168 | var PDU_NS rx; |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 169 | var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx_del]; |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 170 | if (nsvc_cfg.provider.ip.address_family == AF_INET) { |
| 171 | var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip, |
| 172 | nsvc_cfg.provider.ip.local_udp_port, |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 173 | w_sig, w_user) }; |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 174 | NSCP[idx].send(ts_SNS_DEL(g_nsconfig.nsei, 24, omit, v4)); |
| 175 | rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 24, omit, v4)); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 176 | } else { |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 177 | var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip, |
| 178 | nsvc_cfg.provider.ip.local_udp_port, |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 179 | w_sig, w_user) }; |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 180 | NSCP[idx].send(ts_SNS_DEL(g_nsconfig.nsei, 24, omit, omit, v6)); |
| 181 | rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 24, omit, omit, v6)); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 182 | } |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 183 | } |
| 184 | |
Harald Welte | 7209955 | 2019-02-23 15:09:22 +0100 | [diff] [blame] | 185 | function f_outgoing_sns_chg_weight(integer idx_chg, uint8_t w_sig, uint8_t w_user, integer idx := 0) |
| 186 | runs on RAW_NS_CT { |
| 187 | log("f_outgoing_sns_chg_weight(idx_chg=", idx_chg, ")"); |
| 188 | var PDU_NS rx; |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 189 | var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx_chg]; |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 190 | if (nsvc_cfg.provider.ip.address_family == AF_INET) { |
| 191 | var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip, |
| 192 | nsvc_cfg.provider.ip.local_udp_port, |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 193 | w_sig, w_user) }; |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 194 | NSCP[idx].send(ts_SNS_CHG_WEIGHT(g_nsconfig.nsei, 25, v4)); |
| 195 | rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 25, omit, v4)); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 196 | } else { |
Harald Welte | 90f1974 | 2020-11-06 19:34:40 +0100 | [diff] [blame] | 197 | var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip, |
| 198 | nsvc_cfg.provider.ip.local_udp_port, |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 199 | w_sig, w_user) }; |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 200 | NSCP[idx].send(ts_SNS_CHG_WEIGHT(g_nsconfig.nsei, 25, omit, v6)); |
| 201 | rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 25, omit, omit, v6)); |
Alexander Couzens | 7b1e44f | 2020-08-25 23:33:17 +0200 | [diff] [blame] | 202 | } |
Harald Welte | 7209955 | 2019-02-23 15:09:22 +0100 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | |
| 206 | |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 207 | |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 208 | |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 209 | /* PCU-originated SNS-SIZE: successful case */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 210 | testcase TC_sns_po_size_success() runs on RAW_Test_CT { |
Alexander Couzens | 2beaa20 | 2020-09-11 20:08:41 +0200 | [diff] [blame] | 211 | f_init_ns_codec(mp_nsconfig); |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 212 | f_init_pcuif(); |
| 213 | f_incoming_sns_size(); |
| 214 | f_sleep(1.0); |
| 215 | setverdict(pass); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 216 | f_clean_ns_codec(); |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | /* PCU-originated SNS-SIZE: NACK from our side */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 220 | testcase TC_sns_po_size_nack() runs on RAW_Test_CT { |
Alexander Couzens | 2beaa20 | 2020-09-11 20:08:41 +0200 | [diff] [blame] | 221 | f_init_ns_codec(mp_nsconfig); |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 222 | f_init_pcuif(); |
| 223 | f_incoming_sns_size(NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED); |
| 224 | /* FIXME: ensure we don't get a SNS-CONFIG */ |
| 225 | /* FIXME: ensure we get re-transmitted SNS-SIZE attempts */ |
| 226 | f_sleep(10.0); |
| 227 | setverdict(pass); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 228 | f_clean_ns_codec(); |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | /* PCU-originated SNS-CONFIG: successful case */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 232 | testcase TC_sns_po_config_success() runs on RAW_Test_CT { |
Alexander Couzens | 2beaa20 | 2020-09-11 20:08:41 +0200 | [diff] [blame] | 233 | f_init_ns_codec(mp_nsconfig); |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 234 | f_init_pcuif(); |
| 235 | f_incoming_sns_size(); |
| 236 | f_incoming_sns_config(); |
| 237 | f_sleep(1.0); |
| 238 | setverdict(pass); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 239 | f_clean_ns_codec(); |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | /* PCU-originated SNS-CONFIG: successful case */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 243 | testcase TC_sns_po_config_nack() runs on RAW_Test_CT { |
Alexander Couzens | 2beaa20 | 2020-09-11 20:08:41 +0200 | [diff] [blame] | 244 | f_init_ns_codec(mp_nsconfig); |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 245 | f_init_pcuif(); |
| 246 | f_incoming_sns_size(); |
| 247 | f_incoming_sns_config(NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED); |
| 248 | /* FIXME: ensure we get re-transmitted SNS-CONFIG attempts */ |
| 249 | f_sleep(10.0); |
| 250 | setverdict(pass); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 251 | f_clean_ns_codec(); |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | |
| 255 | /* SGSN-originated SNS-SIZE: successful case */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 256 | testcase TC_sns_so_config_success() runs on RAW_Test_CT { |
Alexander Couzens | 2beaa20 | 2020-09-11 20:08:41 +0200 | [diff] [blame] | 257 | f_init_ns_codec(mp_nsconfig); |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 258 | f_init_pcuif(); |
| 259 | f_incoming_sns_size(); |
| 260 | f_incoming_sns_config(); |
| 261 | f_outgoing_sns_config(); |
| 262 | |
| 263 | /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */ |
| 264 | as_rx_alive_tx_ack(oneshot := true); |
| 265 | activate(as_rx_alive_tx_ack()); |
| 266 | |
| 267 | f_outgoing_ns_alive(); |
| 268 | |
| 269 | /* Expect BVC-RESET for signaling (0) and ptp BVCI */ |
Harald Welte | e97e3af | 2020-10-09 14:56:54 +0200 | [diff] [blame] | 270 | as_rx_bvc_reset_tx_ack(0, omit, omit, oneshot := true); |
| 271 | as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id, omit, oneshot := true); |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 272 | as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true); |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 273 | |
| 274 | /* wait for one FLOW-CONTROL BVC and then ACK any further in the future */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 275 | as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true); |
| 276 | activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci)); |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 277 | setverdict(pass); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 278 | f_clean_ns_codec(); |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 279 | } |
| 280 | |
Harald Welte | 64d0731 | 2019-03-20 09:48:39 +0100 | [diff] [blame] | 281 | private function f_sns_bringup_1c1u(boolean sgsn_originated_reset := false) runs on RAW_Test_CT { |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 282 | /* Activate two NS codec ports */ |
Alexander Couzens | 2beaa20 | 2020-09-11 20:08:41 +0200 | [diff] [blame] | 283 | f_init_ns_codec(mp_nsconfig); |
| 284 | f_init_ns_codec(mp_nsconfig, 1); |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 285 | f_init_pcuif(); |
| 286 | /* Perform Size + BSS-originated config */ |
| 287 | f_incoming_sns_size(); |
| 288 | f_incoming_sns_config(); |
| 289 | /* perform SGSN-originated config using idx==0 for signalling and idx==1 for user traffic */ |
| 290 | f_outgoing_sns_config_1c1u(); |
| 291 | |
| 292 | /* wait for one ALIVE cycle, then ACK any further ALIVE in the background |
| 293 | * for both NS-VCs */ |
| 294 | as_rx_alive_tx_ack(oneshot := true, idx := 0); |
| 295 | activate(as_rx_alive_tx_ack(idx := 0)); |
| 296 | as_rx_alive_tx_ack(oneshot := true, idx := 1); |
| 297 | activate(as_rx_alive_tx_ack(idx := 1)); |
| 298 | |
| 299 | /* perform outgoing ALIVE procedure for both NS-VCs */ |
| 300 | f_outgoing_ns_alive(0); |
| 301 | f_outgoing_ns_alive(1); |
| 302 | |
Harald Welte | 64d0731 | 2019-03-20 09:48:39 +0100 | [diff] [blame] | 303 | if (sgsn_originated_reset) { |
Alexander Couzens | 195c9e7 | 2020-10-26 23:09:16 +0100 | [diff] [blame] | 304 | /* Expect BVC-RESET, but ignore it to prevent a race condition of BVC RESETs */ |
| 305 | var template PDU_NS pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, 0, omit)); |
| 306 | f_ns_exp(pdu); |
| 307 | /* SGSN originated BVC-RESET on an uninitialized signalling BVC */ |
Harald Welte | e97e3af | 2020-10-09 14:56:54 +0200 | [diff] [blame] | 308 | f_tx_bvc_reset_rx_ack(0, omit, omit); |
Alexander Couzens | 195c9e7 | 2020-10-26 23:09:16 +0100 | [diff] [blame] | 309 | |
| 310 | /* Expect BVC-RESET PTP BVC, but ignore it to prevent a race condition of BVC RESETs */ |
| 311 | pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id)); |
| 312 | f_ns_exp(pdu); |
| 313 | /* SGSN originated BVC-RESET on an uninitialized PTP BVC */ |
Harald Welte | e97e3af | 2020-10-09 14:56:54 +0200 | [diff] [blame] | 314 | f_tx_bvc_reset_rx_ack(mp_gb_cfg.bvc[0].bvci, omit, mp_gb_cfg.bvc[0].cell_id); |
Harald Welte | 64d0731 | 2019-03-20 09:48:39 +0100 | [diff] [blame] | 315 | } else { |
Alexander Couzens | 195c9e7 | 2020-10-26 23:09:16 +0100 | [diff] [blame] | 316 | /* Expect BVC-RESET for signaling BVCI=0 */ |
Harald Welte | e97e3af | 2020-10-09 14:56:54 +0200 | [diff] [blame] | 317 | as_rx_bvc_reset_tx_ack(0, omit, omit, oneshot := true); |
Alexander Couzens | 195c9e7 | 2020-10-26 23:09:16 +0100 | [diff] [blame] | 318 | /* Expect BVC-RESET from the PCU on PTP BVC */ |
Harald Welte | e97e3af | 2020-10-09 14:56:54 +0200 | [diff] [blame] | 319 | as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id, omit, oneshot := true); |
Harald Welte | 64d0731 | 2019-03-20 09:48:39 +0100 | [diff] [blame] | 320 | } |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 321 | /* Expect UNBLOCK for ptp BVCI on signaling NS-VC (idx==0) */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 322 | as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true); |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 323 | |
| 324 | /* wait for one FLOW-CONTROL BVC and then ACK any further in the future. Flow |
| 325 | * control happens on the p-t-p BVCI and hence on index 1 */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 326 | as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true, idx := 1); |
| 327 | activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, idx := 1)); |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 328 | } |
| 329 | |
| 330 | /* Test full IP-SNS bring-up with two NS-VCs, one sig-only and one user-only */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 331 | testcase TC_sns_1c1u() runs on RAW_Test_CT { |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 332 | f_sns_bringup_1c1u(); |
| 333 | setverdict(pass); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 334 | f_clean_ns_codec(); |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 335 | } |
| 336 | |
Harald Welte | 64d0731 | 2019-03-20 09:48:39 +0100 | [diff] [blame] | 337 | private function f_sns_bringup_1c1u_separate(boolean sgsn_originated_reset := false) runs on RAW_Test_CT { |
Harald Welte | ecd159e | 2019-03-16 13:36:07 +0100 | [diff] [blame] | 338 | /* Activate two NS codec ports */ |
Alexander Couzens | 2beaa20 | 2020-09-11 20:08:41 +0200 | [diff] [blame] | 339 | f_init_ns_codec(mp_nsconfig); |
| 340 | f_init_ns_codec(mp_nsconfig, 1); |
| 341 | f_init_ns_codec(mp_nsconfig, 2); |
Harald Welte | ecd159e | 2019-03-16 13:36:07 +0100 | [diff] [blame] | 342 | f_init_pcuif(); |
| 343 | /* Perform Size + BSS-originated config */ |
| 344 | f_incoming_sns_size(); |
| 345 | f_incoming_sns_config(); |
| 346 | /* perform SGSN-originated config using idx==0 for signalling and idx==1 for user traffic */ |
| 347 | f_outgoing_sns_config_1c1u_separate(); |
| 348 | |
| 349 | /* wait for one ALIVE cycle, then ACK any further ALIVE in the background |
| 350 | * for both NS-VCs */ |
| 351 | as_rx_alive_tx_ack(oneshot := true, idx := 1); |
| 352 | activate(as_rx_alive_tx_ack(idx := 1)); |
| 353 | as_rx_alive_tx_ack(oneshot := true, idx := 2); |
| 354 | activate(as_rx_alive_tx_ack(idx := 2)); |
| 355 | /* ensure there's no NS-ALIVE received on idx==0 */ |
| 356 | f_ensure_no_ns(t_NS_ALIVE, idx := 0); |
| 357 | |
| 358 | /* perform outgoing ALIVE procedure for both NS-VCs */ |
| 359 | f_outgoing_ns_alive(1); |
| 360 | f_outgoing_ns_alive(2); |
| 361 | /* ensure there's no response to NS-ALIVE sent on idx==0 */ |
| 362 | f_outgoing_ns_alive_no_ack(idx := 0); |
| 363 | |
Harald Welte | 64d0731 | 2019-03-20 09:48:39 +0100 | [diff] [blame] | 364 | if (sgsn_originated_reset) { |
Alexander Couzens | 195c9e7 | 2020-10-26 23:09:16 +0100 | [diff] [blame] | 365 | /* Expect BVC-RESET, but ignore it to prevent a race condition of BVC RESETs */ |
| 366 | var template PDU_NS pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, 0, omit)); |
| 367 | f_ns_exp(pdu, idx := 1); |
| 368 | /* SGSN originated BVC-RESET on an uninitialized sign BVC */ |
Harald Welte | e97e3af | 2020-10-09 14:56:54 +0200 | [diff] [blame] | 369 | f_tx_bvc_reset_rx_ack(0, omit, omit, idx := 1); |
Alexander Couzens | 195c9e7 | 2020-10-26 23:09:16 +0100 | [diff] [blame] | 370 | |
| 371 | /* Expect BVC-RESET PTP BVC, but ignore it to prevent a race condition of BVC RESETs */ |
| 372 | pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id)); |
| 373 | f_ns_exp(pdu, idx := 1); |
Harald Welte | e97e3af | 2020-10-09 14:56:54 +0200 | [diff] [blame] | 374 | f_tx_bvc_reset_rx_ack(mp_gb_cfg.bvc[0].bvci, omit, mp_gb_cfg.bvc[0].cell_id, idx := 1); |
Harald Welte | 64d0731 | 2019-03-20 09:48:39 +0100 | [diff] [blame] | 375 | } else { |
Alexander Couzens | 195c9e7 | 2020-10-26 23:09:16 +0100 | [diff] [blame] | 376 | /* Expect BVC-RESET for signaling BVCI=0 */ |
Harald Welte | e97e3af | 2020-10-09 14:56:54 +0200 | [diff] [blame] | 377 | as_rx_bvc_reset_tx_ack(0, omit, omit, oneshot := true, idx := 1); |
Alexander Couzens | 195c9e7 | 2020-10-26 23:09:16 +0100 | [diff] [blame] | 378 | /* Expect BVC-RESET from the PCU on PTP BVC */ |
Harald Welte | e97e3af | 2020-10-09 14:56:54 +0200 | [diff] [blame] | 379 | as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id, omit, oneshot := true, idx := 1); |
Harald Welte | 64d0731 | 2019-03-20 09:48:39 +0100 | [diff] [blame] | 380 | } |
Harald Welte | ecd159e | 2019-03-16 13:36:07 +0100 | [diff] [blame] | 381 | /* Expect UNBLOCK for ptp BVCI on signaling NS-VC (idx==1) */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 382 | as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true, idx := 1); |
Harald Welte | ecd159e | 2019-03-16 13:36:07 +0100 | [diff] [blame] | 383 | |
| 384 | /* wait for one FLOW-CONTROL BVC and then ACK any further in the future. Flow |
| 385 | * control happens on the p-t-p BVCI and hence on index 1 */ |
Harald Welte | 5339b2e | 2020-10-04 22:52:56 +0200 | [diff] [blame] | 386 | as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true, idx := 2); |
| 387 | activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, idx := 2)); |
Harald Welte | ecd159e | 2019-03-16 13:36:07 +0100 | [diff] [blame] | 388 | } |
| 389 | |
| 390 | /* Test full IP-SNS bring-up with two NS-VCs, one sig-only and one user-only - and where |
| 391 | * the initial IP/port for the SNS procedure is *not* part of the NS-VCs later */ |
| 392 | testcase TC_sns_1c1u_separate() runs on RAW_Test_CT { |
| 393 | f_sns_bringup_1c1u_separate(); |
| 394 | setverdict(pass); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 395 | f_clean_ns_codec(); |
Harald Welte | ecd159e | 2019-03-16 13:36:07 +0100 | [diff] [blame] | 396 | } |
| 397 | |
Harald Welte | 64d0731 | 2019-03-20 09:48:39 +0100 | [diff] [blame] | 398 | /* Test full IP-SNS bring-up with two NS-VCs, one sig-only and one user-only and use |
| 399 | * SGSN-originated BVC-RESET rather than BSS-originated */ |
| 400 | testcase TC_sns_1c1u_so_bvc_reset() runs on RAW_Test_CT { |
| 401 | f_sns_bringup_1c1u_separate(sgsn_originated_reset := true); |
| 402 | setverdict(pass); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 403 | f_clean_ns_codec(); |
Harald Welte | 64d0731 | 2019-03-20 09:48:39 +0100 | [diff] [blame] | 404 | } |
| 405 | |
| 406 | /* Transmit BVC-RESET before NS-ALIVE of PCU was ACKed: expect no response */ |
| 407 | testcase TC_sns_1c1u_so_bvc_reset_too_early() runs on RAW_Test_CT { |
| 408 | /* Activate two NS codec ports */ |
Alexander Couzens | 2beaa20 | 2020-09-11 20:08:41 +0200 | [diff] [blame] | 409 | f_init_ns_codec(mp_nsconfig); |
| 410 | f_init_ns_codec(mp_nsconfig, 1); |
| 411 | f_init_ns_codec(mp_nsconfig, 2); |
Harald Welte | 64d0731 | 2019-03-20 09:48:39 +0100 | [diff] [blame] | 412 | f_init_pcuif(); |
| 413 | /* Perform Size + BSS-originated config */ |
| 414 | f_incoming_sns_size(); |
| 415 | f_incoming_sns_config(); |
| 416 | /* perform SGSN-originated config using idx==0 for signalling and idx==1 for user traffic */ |
| 417 | f_outgoing_sns_config_1c1u_separate(); |
| 418 | |
| 419 | /* DON'T ACK ANY INBOUND NS-ALIVE HERE! */ |
| 420 | |
| 421 | /* perform outgoing ALIVE procedure for both NS-VCs */ |
| 422 | f_outgoing_ns_alive(1); |
| 423 | f_outgoing_ns_alive(2); |
| 424 | /* ensure there's no response to NS-ALIVE sent on idx==0 */ |
| 425 | f_outgoing_ns_alive_no_ack(idx := 0); |
| 426 | |
| 427 | /* Transmit BVC-RESET and expect no ACK*/ |
Harald Welte | e97e3af | 2020-10-09 14:56:54 +0200 | [diff] [blame] | 428 | f_tx_bvc_reset_rx_ack(0, omit, omit, idx := 1, exp_ack := false); |
| 429 | f_tx_bvc_reset_rx_ack(mp_gb_cfg.bvc[0].bvci, omit, mp_gb_cfg.bvc[0].cell_id, idx := 1, exp_ack := false); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 430 | f_clean_ns_codec(); |
Harald Welte | 64d0731 | 2019-03-20 09:48:39 +0100 | [diff] [blame] | 431 | } |
| 432 | |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 433 | /* Test adding new IP endpoints at runtime */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 434 | testcase TC_sns_add() runs on RAW_Test_CT { |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 435 | f_sns_bringup_1c1u(); |
| 436 | |
Alexander Couzens | 2373afc | 2020-12-09 02:19:49 +0100 | [diff] [blame] | 437 | /* create another NS codec port on the tester side */ |
Alexander Couzens | 2beaa20 | 2020-09-11 20:08:41 +0200 | [diff] [blame] | 438 | f_init_ns_codec(mp_nsconfig, 2); |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 439 | |
| 440 | f_outgoing_sns_add(idx_add := 2, w_sig := 0, w_user := 1, idx := 0); |
| 441 | |
| 442 | /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */ |
| 443 | as_rx_alive_tx_ack(oneshot := true, idx := 2); |
| 444 | activate(as_rx_alive_tx_ack(idx := 2)); |
| 445 | |
| 446 | f_outgoing_ns_alive(2); |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 447 | setverdict(pass); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 448 | f_clean_ns_codec(); |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 449 | } |
| 450 | |
Alexander Couzens | 2a0ac80 | 2020-12-09 02:19:29 +0100 | [diff] [blame] | 451 | /* Test adding an already present IP endpoint at runtime */ |
| 452 | testcase TC_sns_add_nack() runs on RAW_Test_CT { |
| 453 | f_sns_bringup_1c1u(); |
| 454 | |
| 455 | f_outgoing_sns_add(idx_add := 0, w_sig := 0, w_user := 1, idx := 0, cause := NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED); |
| 456 | setverdict(pass); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 457 | f_clean_ns_codec(); |
Alexander Couzens | 2a0ac80 | 2020-12-09 02:19:29 +0100 | [diff] [blame] | 458 | } |
| 459 | |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 460 | /* Test deleting IP endpoints at runtime */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 461 | testcase TC_sns_del() runs on RAW_Test_CT { |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 462 | f_sns_bringup_1c1u(); |
| 463 | |
| 464 | f_outgoing_sns_del(idx_del := 1, w_sig := 0, w_user := 1, idx := 0); |
| 465 | /* FIXME: ensure we don't receive anything on just-deleted NS-VC anymore */ |
| 466 | setverdict(pass); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 467 | f_clean_ns_codec(); |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 468 | } |
| 469 | |
Harald Welte | 7209955 | 2019-02-23 15:09:22 +0100 | [diff] [blame] | 470 | /* Test changing weights at runtime */ |
Harald Welte | ea3c7e9 | 2019-03-01 19:34:55 +0100 | [diff] [blame] | 471 | testcase TC_sns_chg_weight() runs on RAW_Test_CT { |
Harald Welte | 7209955 | 2019-02-23 15:09:22 +0100 | [diff] [blame] | 472 | f_sns_bringup_1c1u(); |
| 473 | |
| 474 | /* change w_user from 1 to 200 */ |
| 475 | f_outgoing_sns_chg_weight(idx_chg := 1, w_sig := 0, w_user := 200, idx := 0); |
| 476 | setverdict(pass); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 477 | f_clean_ns_codec(); |
Harald Welte | 7209955 | 2019-02-23 15:09:22 +0100 | [diff] [blame] | 478 | } |
| 479 | |
Harald Welte | 16e92f4 | 2019-03-02 00:03:44 +0100 | [diff] [blame] | 480 | import from PCUIF_Types all; |
| 481 | import from PCUIF_CodecPort all; |
| 482 | |
Harald Welte | 3b33583 | 2019-03-15 22:38:06 +0100 | [diff] [blame] | 483 | altstep as_pcu_activate() runs on RAW_PCU_CT { |
| 484 | var PCUIF_send_data sd; |
| 485 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_ACT_REQ(?, ?, ?))) -> value sd { repeat; } |
| 486 | |
| 487 | } |
| 488 | |
Harald Welte | 16e92f4 | 2019-03-02 00:03:44 +0100 | [diff] [blame] | 489 | testcase TC_pcuif_rach() runs on RAW_Test_CT { |
| 490 | f_sns_bringup_1c1u(); |
Harald Welte | 3b33583 | 2019-03-15 22:38:06 +0100 | [diff] [blame] | 491 | activate(as_pcu_activate()); |
Harald Welte | 16e92f4 | 2019-03-02 00:03:44 +0100 | [diff] [blame] | 492 | |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 493 | f_pcuif_tx(ts_PCUIF_RACH_IND(bts_nr:=0, trx_nr:=0, ts_nr:=0, ra:=23, |
| 494 | is_11bit:=0, burst_type:=BURST_TYPE_0, |
Harald Welte | 16e92f4 | 2019-03-02 00:03:44 +0100 | [diff] [blame] | 495 | fn:=42, arfcn:=871, qta:=0)); |
| 496 | PCU.receive(t_SD_PCUIF(g_pcu_conn_id, |
| 497 | tr_PCUIF_DATA_REQ(bts_nr:=0, trx_nr:=0, ts_nr:=0, block_nr:=?, fn:=?, |
| 498 | sapi:=PCU_IF_SAPI_AGCH, data:=?))); |
| 499 | setverdict(pass); |
Alexander Couzens | c316572 | 2021-01-11 02:51:45 +0100 | [diff] [blame] | 500 | f_clean_ns_codec(); |
Harald Welte | 16e92f4 | 2019-03-02 00:03:44 +0100 | [diff] [blame] | 501 | } |
| 502 | |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 503 | |
| 504 | |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 505 | control { |
| 506 | execute( TC_sns_po_size_success() ); |
| 507 | execute( TC_sns_po_size_nack() ); |
| 508 | execute( TC_sns_po_config_success() ); |
| 509 | execute( TC_sns_po_config_nack() ); |
| 510 | execute( TC_sns_so_config_success() ); |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 511 | execute( TC_sns_1c1u() ); |
Harald Welte | ecd159e | 2019-03-16 13:36:07 +0100 | [diff] [blame] | 512 | execute( TC_sns_1c1u_separate() ); |
Harald Welte | 64d0731 | 2019-03-20 09:48:39 +0100 | [diff] [blame] | 513 | execute( TC_sns_1c1u_so_bvc_reset() ); |
| 514 | execute( TC_sns_1c1u_so_bvc_reset_too_early() ); |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 515 | execute( TC_sns_add() ); |
Alexander Couzens | 2a0ac80 | 2020-12-09 02:19:29 +0100 | [diff] [blame] | 516 | execute( TC_sns_add_nack() ); |
Harald Welte | 630d0e6 | 2019-02-22 23:26:40 +0100 | [diff] [blame] | 517 | execute( TC_sns_del() ); |
Harald Welte | 7209955 | 2019-02-23 15:09:22 +0100 | [diff] [blame] | 518 | execute( TC_sns_chg_weight() ); |
Harald Welte | 16e92f4 | 2019-03-02 00:03:44 +0100 | [diff] [blame] | 519 | |
| 520 | execute( TC_pcuif_rach() ); |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 521 | } |
| 522 | |
| 523 | } |