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