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