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