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