Harald Welte | 379d45a | 2017-08-03 09:55:15 +0200 | [diff] [blame] | 1 | module GGSN_Tests { |
| 2 | |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 3 | /* GGSN test suite in TTCN-3 |
| 4 | * (C) 2017-2019 Harald Welte <laforge@gnumonks.org> |
| 5 | * (C) 2018-2019 sysmocom - s.f.m.c. GmbH |
| 6 | * All rights reserved. |
| 7 | * |
| 8 | * Released under the terms of GNU General Public License, Version 2 or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 12 | */ |
| 13 | |
| 14 | |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 15 | import from General_Types all; |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 16 | import from Osmocom_Types all; |
Pau Espin Pedrol | c04c69e | 2020-03-03 16:46:29 +0100 | [diff] [blame] | 17 | import from Misc_Helpers all; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 18 | import from IPL4asp_PortType all; |
| 19 | import from IPL4asp_Types all; |
| 20 | import from GTP_CodecPort all; |
| 21 | import from GTP_CodecPort_CtrlFunct all; |
Harald Welte | c69cf4e | 2018-02-17 20:57:02 +0100 | [diff] [blame] | 22 | import from GTP_Templates all; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 23 | import from GTPC_Types all; |
| 24 | import from GTPU_Types all; |
Harald Welte | 71a3602 | 2017-12-04 18:55:58 +0100 | [diff] [blame] | 25 | import from IPCP_Types all; |
Harald Welte | f829854 | 2019-04-10 10:15:28 +0200 | [diff] [blame] | 26 | import from PAP_Types all; |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 27 | import from IP_Types all; |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 28 | import from ICMP_Types all; |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 29 | import from ICMPv6_Types all; |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 30 | import from Native_Functions all; |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 31 | import from Osmocom_VTY_Functions all; |
| 32 | import from TELNETasp_PortType all; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 33 | |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 34 | import from DIAMETER_Types all; |
| 35 | import from DIAMETER_Templates all; |
| 36 | import from DIAMETER_Emulation all; |
| 37 | |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 38 | const integer GTP0_PORT := 3386; |
| 39 | const integer GTP1C_PORT := 2123; |
| 40 | const integer GTP1U_PORT := 2152; |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 41 | const integer PCRF_PORT := 3868; |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 42 | const integer OCS_PORT := 3869; |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 43 | |
Pau Espin Pedrol | c1b1ddf | 2022-01-19 18:10:30 +0100 | [diff] [blame] | 44 | type enumerated GGSN_Impl { |
| 45 | GGSN_IMPL_OSMOCOM, |
| 46 | GGSN_IMPL_OPEN5GS |
| 47 | }; |
| 48 | |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 49 | modulepar { |
Stefan Sperling | cb782b9 | 2018-04-03 16:03:15 +0200 | [diff] [blame] | 50 | /* Default IP addresses. May be overridden by GGSN_Tests configuration files. */ |
| 51 | |
| 52 | /* The SGSN simulated by TTCN3 will bind to these addresses for GTP control and GTP user planes. */ |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 53 | charstring m_bind_ip_gtpc := "127.23.42.1"; |
| 54 | charstring m_bind_ip_gtpu := "127.23.42.1"; |
| 55 | |
Stefan Sperling | cb782b9 | 2018-04-03 16:03:15 +0200 | [diff] [blame] | 56 | /* Addresses the GGSN which is being tested is listening on for SGSN connections. */ |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 57 | charstring m_ggsn_ip_gtpc := "127.0.0.6"; |
| 58 | charstring m_ggsn_ip_gtpu := "127.0.0.6"; |
Pau Espin Pedrol | f69a438 | 2018-01-29 13:09:00 +0100 | [diff] [blame] | 59 | |
Stefan Sperling | cb782b9 | 2018-04-03 16:03:15 +0200 | [diff] [blame] | 60 | /* |
| 61 | * Our tests expect to see these DNS servers in 'Create PDP context responses' sent by the GGSN. |
| 62 | * These addresses must therefore match 'ip[v6] dns' options configured in osmo-ggsn.conf. |
| 63 | * |
| 64 | * These addresses are not expected to serve actual DNS requests. However, tests may expect to be |
| 65 | * able to ping these addresses (currently, IPv4 addresses must respond with an ICMP 'echo reply', |
| 66 | * and IPv6 addresses may respond with either ICMPv6 'echo reply' or 'destination unreachable'). |
| 67 | */ |
Pau Espin Pedrol | f69a438 | 2018-01-29 13:09:00 +0100 | [diff] [blame] | 68 | charstring m_ggsn_ip4_dns1 := "192.168.100.1" |
| 69 | charstring m_ggsn_ip4_dns2 := "8.8.8.8" |
Pau Espin Pedrol | 363ba48 | 2018-01-29 18:42:00 +0100 | [diff] [blame] | 70 | charstring m_ggsn_ip6_dns1 := "2001:4860:4860::8888" |
| 71 | charstring m_ggsn_ip6_dns2 := "2001:4860:4860::8844" |
Stefan Sperling | cb782b9 | 2018-04-03 16:03:15 +0200 | [diff] [blame] | 72 | |
| 73 | /* |
| 74 | * Additional address ranges are defined in osmo-ggsn.conf from which addresses are assigned |
| 75 | * to MS "behind" the simulated SGSN. These addresses appear on tun devices used by osmo-ggsn. |
| 76 | * The tests expect to be able to send ping packets between any two simulated MS within the same |
| 77 | * address range. This requires IP forwarding to be enabled on the corresponding tun interfaces. |
| 78 | */ |
Pau Espin Pedrol | c1b1ddf | 2022-01-19 18:10:30 +0100 | [diff] [blame] | 79 | |
| 80 | GGSN_Impl m_ggsn_impl := GGSN_IMPL_OSMOCOM; |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 81 | } |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 82 | |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 83 | type set PdpContext { |
| 84 | hexstring imsi, |
| 85 | octetstring msisdn optional, |
| 86 | octetstring apn, |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 87 | ProtConfigOptions pco_req optional, |
| 88 | ProtConfigOptions pco_neg optional, |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 89 | EndUserAddress eua, |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 90 | OCT16 ip6_prefix optional, |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 91 | BIT4 nsapi, |
| 92 | /* TEI (Data) local side */ |
| 93 | OCT4 teid, |
| 94 | /* TEI (Control) local side */ |
| 95 | OCT4 teic, |
| 96 | /* TEI (Data) remote side */ |
| 97 | OCT4 teid_remote, |
| 98 | /* TEI (Control) remote side */ |
Pau Espin Pedrol | 38aeffb | 2022-02-01 20:46:29 +0100 | [diff] [blame] | 99 | OCT4 teic_remote, |
Pau Espin Pedrol | ca587f1 | 2022-02-02 10:42:01 +0100 | [diff] [blame] | 100 | OCT1 ratType optional, |
| 101 | UserLocationInformation uli optional |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 102 | } |
| 103 | |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 104 | type component GT_CT { |
| 105 | port GTPC_PT GTPC; |
| 106 | port GTPU_PT GTPU; |
| 107 | |
Harald Welte | 0be142b | 2017-08-13 13:28:10 +0200 | [diff] [blame] | 108 | var boolean g_initialized := false; |
| 109 | |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 110 | var OCT1 g_restart_ctr := '01'O; |
| 111 | /* FIXME: unify with g_bind_ip + parse from config file */ |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 112 | var OCT4 g_sgsn_ip_c; |
| 113 | var OCT4 g_sgsn_ip_u; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 114 | /* FIXME: parse remName from config file */ |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 115 | var GtpPeer g_peer_c := { connId := 0, remName := m_ggsn_ip_gtpc, remPort := GTP1C_PORT }; |
| 116 | var GtpPeer g_peer_u := { connId := 0, remName := m_ggsn_ip_gtpu, remPort := GTP1U_PORT }; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 117 | timer T_default := 3.0; |
Harald Welte | 5438b9d | 2017-08-13 13:27:48 +0200 | [diff] [blame] | 118 | |
| 119 | /* next to-be-sent GTP-C sequence number */ |
| 120 | var uint16_t g_c_seq_nr; |
| 121 | /* next to-be-sent GTP-U sequence number */ |
| 122 | var uint16_t g_d_seq_nr; |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 123 | |
| 124 | port TELNETasp_PT GGSNVTY; |
Harald Welte | d2394e9 | 2018-04-26 10:21:49 +0200 | [diff] [blame] | 125 | var boolean use_gtpu_txseq := false; |
Pau Espin Pedrol | 0511802 | 2022-02-17 19:49:13 +0100 | [diff] [blame] | 126 | var integer g_use_echo_intval := 0; /* 0 = disabled */ |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 127 | |
| 128 | /* emulated PCRF, used with m_ggsn_impl = GGSN_IMPL_OPEN5GS */ |
Pau Espin Pedrol | 45d5702 | 2022-03-08 13:49:02 +0100 | [diff] [blame] | 129 | var DIAMETER_Emulation_CT vc_Gx; |
| 130 | port DIAMETER_PT Gx_UNIT; |
| 131 | port DIAMETEREM_PROC_PT Gx_PROC; |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 132 | var DIAMETER_Emulation_CT vc_Gy; |
| 133 | port DIAMETER_PT Gy_UNIT; |
| 134 | port DIAMETEREM_PROC_PT Gy_PROC; |
| 135 | var integer g_gy_validity_time := 0; /* In seconds. 0 => disabled, !0 => grant over CC-Time period */ |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | private function f_init_vty() runs on GT_CT { |
| 139 | map(self:GGSNVTY, system:GGSNVTY); |
| 140 | f_vty_set_prompts(GGSNVTY); |
| 141 | f_vty_transceive(GGSNVTY, "enable"); |
| 142 | } |
| 143 | |
| 144 | private function f_vty_set_gpdu_txseq(boolean enable) runs on GT_CT { |
| 145 | f_vty_enter_config(GGSNVTY); |
| 146 | f_vty_transceive(GGSNVTY, "ggsn ggsn0"); |
Pau Espin Pedrol | 205a384 | 2018-07-06 13:24:14 +0200 | [diff] [blame] | 147 | |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 148 | f_vty_transceive(GGSNVTY, "apn internet"); |
| 149 | if (enable) { |
| 150 | f_vty_transceive(GGSNVTY, "g-pdu tx-sequence-numbers"); |
| 151 | } else { |
| 152 | f_vty_transceive(GGSNVTY, "no g-pdu tx-sequence-numbers"); |
| 153 | } |
Pau Espin Pedrol | 205a384 | 2018-07-06 13:24:14 +0200 | [diff] [blame] | 154 | f_vty_transceive(GGSNVTY, "exit"); |
| 155 | |
| 156 | f_vty_transceive(GGSNVTY, "apn inet6"); |
| 157 | if (enable) { |
| 158 | f_vty_transceive(GGSNVTY, "g-pdu tx-sequence-numbers"); |
| 159 | } else { |
| 160 | f_vty_transceive(GGSNVTY, "no g-pdu tx-sequence-numbers"); |
| 161 | } |
| 162 | f_vty_transceive(GGSNVTY, "exit"); |
| 163 | |
| 164 | f_vty_transceive(GGSNVTY, "apn inet46"); |
| 165 | if (enable) { |
| 166 | f_vty_transceive(GGSNVTY, "g-pdu tx-sequence-numbers"); |
| 167 | } else { |
| 168 | f_vty_transceive(GGSNVTY, "no g-pdu tx-sequence-numbers"); |
| 169 | } |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 170 | f_vty_transceive(GGSNVTY, "end"); |
| 171 | } |
| 172 | |
| 173 | private function f_verify_gtpu_txseq(in PDU_GTPU gtpu, in boolean expect_gptu_txseq) return boolean { |
| 174 | if (expect_gptu_txseq) { |
| 175 | if (gtpu.s_bit != '1'B) { |
| 176 | log("GTPU sequence number expected but not present") |
| 177 | return false; |
| 178 | } |
| 179 | } else { |
| 180 | if (gtpu.s_bit != '0'B) { |
| 181 | log("GTPU sequence number not expected but present") |
| 182 | return false; |
| 183 | } |
| 184 | } |
| 185 | return true; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 186 | } |
| 187 | |
Pau Espin Pedrol | 0511802 | 2022-02-17 19:49:13 +0100 | [diff] [blame] | 188 | private function f_vty_enable_echo_interval(integer intval_sec) runs on GT_CT { |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 189 | f_vty_enter_config(GGSNVTY); |
| 190 | f_vty_transceive(GGSNVTY, "ggsn ggsn0"); |
Pau Espin Pedrol | 0511802 | 2022-02-17 19:49:13 +0100 | [diff] [blame] | 191 | if (intval_sec > 0) { |
| 192 | f_vty_transceive(GGSNVTY, "echo-interval " & int2str(intval_sec)); |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 193 | } else { |
| 194 | f_vty_transceive(GGSNVTY, "no echo-interval"); |
| 195 | } |
| 196 | f_vty_transceive(GGSNVTY, "end"); |
| 197 | } |
| 198 | |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 199 | private function DiameterForwardUnitdataCallback(PDU_DIAMETER msg) |
| 200 | runs on DIAMETER_Emulation_CT return template PDU_DIAMETER { |
| 201 | DIAMETER_UNIT.send(msg); |
| 202 | return omit; |
| 203 | } |
| 204 | |
| 205 | private function f_init_diameter(charstring id) runs on GT_CT { |
| 206 | var DIAMETEROps ops := { |
| 207 | create_cb := refers(DIAMETER_Emulation.ExpectedCreateCallback), |
| 208 | unitdata_cb := refers(DiameterForwardUnitdataCallback), |
| 209 | raw := true /* handler mode (single component for all IMSI)) */ |
| 210 | }; |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 211 | var DIAMETER_conn_parameters pars; |
| 212 | |
| 213 | /* Gx setup: */ |
| 214 | pars := { |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 215 | remote_ip := m_ggsn_ip_gtpc, |
| 216 | remote_sctp_port := -1, |
| 217 | local_ip := m_bind_ip_gtpc, |
| 218 | local_sctp_port := PCRF_PORT, |
Pau Espin Pedrol | 45d5702 | 2022-03-08 13:49:02 +0100 | [diff] [blame] | 219 | origin_host := "pcrf.localdomain", |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 220 | origin_realm := "localdomain", |
Pau Espin Pedrol | 33b4749 | 2022-03-08 17:43:01 +0100 | [diff] [blame] | 221 | auth_app_id := omit, |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 222 | vendor_app_id := c_DIAMETER_3GPP_Gx_AID |
| 223 | }; |
Pau Espin Pedrol | 45d5702 | 2022-03-08 13:49:02 +0100 | [diff] [blame] | 224 | vc_Gx := DIAMETER_Emulation_CT.create(id); |
| 225 | map(vc_Gx:DIAMETER, system:DIAMETER_CODEC_PT); |
| 226 | connect(vc_Gx:DIAMETER_UNIT, self:Gx_UNIT); |
| 227 | connect(vc_Gx:DIAMETER_PROC, self:Gx_PROC); |
| 228 | vc_Gx.start(DIAMETER_Emulation.main(ops, pars, id)); |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 229 | |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 230 | /* Gy setup: */ |
| 231 | pars := { |
| 232 | remote_ip := m_ggsn_ip_gtpc, |
| 233 | remote_sctp_port := -1, |
| 234 | local_ip := m_bind_ip_gtpc, |
| 235 | local_sctp_port := OCS_PORT, |
| 236 | origin_host := "ocs.localdomain", |
| 237 | origin_realm := "localdomain", |
| 238 | auth_app_id := c_DIAMETER_CREDIT_CONTROL_AID, |
| 239 | vendor_app_id := omit |
| 240 | }; |
| 241 | vc_Gy := DIAMETER_Emulation_CT.create(id); |
| 242 | map(vc_Gy:DIAMETER, system:DIAMETER_CODEC_PT); |
| 243 | connect(vc_Gy:DIAMETER_UNIT, self:Gy_UNIT); |
| 244 | connect(vc_Gy:DIAMETER_PROC, self:Gy_PROC); |
| 245 | vc_Gy.start(DIAMETER_Emulation.main(ops, pars, id)); |
| 246 | |
Pau Espin Pedrol | 45d5702 | 2022-03-08 13:49:02 +0100 | [diff] [blame] | 247 | f_diameter_wait_capability(Gx_UNIT); |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 248 | f_diameter_wait_capability(Gy_UNIT); |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 249 | /* Give some time for our emulation to get out of SUSPECT list of SUT (3 watchdong ping-pongs): |
| 250 | * RFC6733 sec 5.1 |
| 251 | * RFC3539 sec 3.4.1 [5] |
| 252 | * https://github.com/freeDiameter/freeDiameter/blob/master/libfdcore/p_psm.c#L49 |
| 253 | */ |
| 254 | f_sleep(1.0); |
| 255 | } |
| 256 | |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 257 | function f_init() runs on GT_CT { |
Harald Welte | 0be142b | 2017-08-13 13:28:10 +0200 | [diff] [blame] | 258 | if (g_initialized == true) { |
| 259 | return; |
| 260 | } |
| 261 | g_initialized := true; |
| 262 | |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 263 | g_sgsn_ip_c := f_inet_addr(m_bind_ip_gtpc); |
| 264 | g_sgsn_ip_u := f_inet_addr(m_bind_ip_gtpu); |
| 265 | |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 266 | var Result res; |
| 267 | map(self:GTPC, system:GTPC); |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 268 | res := GTP_CodecPort_CtrlFunct.f_IPL4_listen(GTPC, m_bind_ip_gtpc, GTP1C_PORT, {udp:={}}); |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 269 | log("GTP1C ConnectionID: ", res.connId); |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 270 | g_peer_c.connId := res.connId; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 271 | |
| 272 | map(self:GTPU, system:GTPU); |
Harald Welte | ddeecbb | 2017-08-18 22:53:30 +0200 | [diff] [blame] | 273 | res := GTP_CodecPort_CtrlFunct.f_GTPU_listen(GTPU, m_bind_ip_gtpu, GTP1U_PORT, {udp:={}}); |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 274 | g_peer_u.connId:= res.connId; |
Harald Welte | 5438b9d | 2017-08-13 13:27:48 +0200 | [diff] [blame] | 275 | |
| 276 | g_restart_ctr := f_rnd_octstring(1); |
Harald Welte | 11dbc7b | 2017-08-13 18:57:56 +0200 | [diff] [blame] | 277 | g_c_seq_nr := f_rnd_int(65535); |
| 278 | g_d_seq_nr := f_rnd_int(65535); |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 279 | |
Pau Espin Pedrol | c1b1ddf | 2022-01-19 18:10:30 +0100 | [diff] [blame] | 280 | if (m_ggsn_impl == GGSN_IMPL_OSMOCOM) { |
| 281 | f_init_vty(); |
| 282 | f_vty_set_gpdu_txseq(use_gtpu_txseq); |
Pau Espin Pedrol | 0511802 | 2022-02-17 19:49:13 +0100 | [diff] [blame] | 283 | f_vty_enable_echo_interval(g_use_echo_intval); |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 284 | } else if (m_ggsn_impl == GGSN_IMPL_OPEN5GS) { |
| 285 | f_init_diameter(testcasename()); |
Pau Espin Pedrol | c1b1ddf | 2022-01-19 18:10:30 +0100 | [diff] [blame] | 286 | } |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 287 | } |
| 288 | |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 289 | function f_shutdown_helper() runs on GT_CT { |
| 290 | /* Sleep N3_REQUESTS * T3_REQUEST seconds, nowadays 5*3=15s. |
| 291 | * This ensures all retransmit queues are cleared before jumping |
| 292 | * into next tests, hence avoding situation where a test resuses |
| 293 | * a seqnum still in the GGSN's resp queue (dup req detector). |
| 294 | * See OS#5485 avout decreasing time. We could also add a new |
| 295 | * VTY command that calls gtp_clear_queues() */ |
| 296 | f_sleep(15.0); |
| 297 | setverdict(pass); |
| 298 | } |
| 299 | |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 300 | /* Altstep implementing responses to any incoming echo requests */ |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 301 | private altstep pingpong() runs on GT_CT { |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 302 | var Gtp1cUnitdata ud; |
Harald Welte | 3af8948 | 2017-08-04 16:20:23 +0200 | [diff] [blame] | 303 | var Gtp1uUnitdata udu; |
Pau Espin Pedrol | 0511802 | 2022-02-17 19:49:13 +0100 | [diff] [blame] | 304 | [g_use_echo_intval > 0] GTPC.receive(tr_GTPC_PING(?)) -> value ud { |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 305 | var uint16_t seq := oct2int(ud.gtpc.opt_part.sequenceNumber); |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 306 | GTPC.send(ts_GTPC_PONG(ud.peer, seq, g_restart_ctr)); |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 307 | repeat; |
| 308 | }; |
Pau Espin Pedrol | 0511802 | 2022-02-17 19:49:13 +0100 | [diff] [blame] | 309 | [g_use_echo_intval == 0] GTPC.receive(tr_GTPC_PING(?)) { |
Pau Espin Pedrol | c04c69e | 2020-03-03 16:46:29 +0100 | [diff] [blame] | 310 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 311 | "GTP Echo Req rceived but not enabled in VTY"); |
Harald Welte | 3af8948 | 2017-08-04 16:20:23 +0200 | [diff] [blame] | 312 | }; |
Pau Espin Pedrol | c04c69e | 2020-03-03 16:46:29 +0100 | [diff] [blame] | 313 | [] T_default.timeout { |
| 314 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 315 | "pinpong T_default timeout"); |
| 316 | }; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 317 | } |
| 318 | |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 319 | /* 'internet' in DNS encoding */ |
Harald Welte | ed09743 | 2017-08-13 13:28:49 +0200 | [diff] [blame] | 320 | const octetstring c_ApnInternet := '08696E7465726E6574'O; |
| 321 | const octetstring c_ApnInet6 := '05696E657436'O; |
| 322 | const octetstring c_ApnInet46 := '06696E65743436'O; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 323 | |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 324 | /* return random NSAPI */ |
| 325 | function f_rnd_nsapi() return BIT4 { |
| 326 | return int2bit(f_rnd_int(16), 4); |
| 327 | } |
| 328 | |
| 329 | /* return random TEI[DC] */ |
| 330 | function f_rnd_tei() return OCT4 { |
| 331 | return int2oct(f_rnd_int(4294967296), 4); |
| 332 | } |
| 333 | |
| 334 | /* define an (internal) representation of a PDP context */ |
| 335 | template PdpContext t_DefinePDP(hexstring imsi, octetstring msisdn, octetstring apn, |
Pau Espin Pedrol | 38aeffb | 2022-02-01 20:46:29 +0100 | [diff] [blame] | 336 | EndUserAddress eua, OCT1 ratType := '02'O /* GERAN */) := { |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 337 | imsi := imsi, |
| 338 | msisdn := msisdn, |
| 339 | nsapi := f_rnd_nsapi(), |
| 340 | apn := apn, |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 341 | pco_req := omit, |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 342 | eua := eua, |
| 343 | teid := f_rnd_tei(), |
Pau Espin Pedrol | 38aeffb | 2022-02-01 20:46:29 +0100 | [diff] [blame] | 344 | teic := f_rnd_tei(), |
Pau Espin Pedrol | ca587f1 | 2022-02-02 10:42:01 +0100 | [diff] [blame] | 345 | ratType := ratType, |
| 346 | uli := { |
| 347 | type_gtpc := '98'O, |
| 348 | lengthf := 0 /* filled in by encoder */, |
| 349 | geographicLocationType := '00'O /* CGI */, |
| 350 | geographicLocation := { |
| 351 | geographicLocationCGI := ts_GeographicLocationCGI('262'H, '42F'H, '0001'O, '0002'O) |
| 352 | } |
| 353 | } |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 354 | } |
| 355 | |
| 356 | /* send GTP-C for a given context and increment sequence number */ |
Harald Welte | 41575e9 | 2017-08-13 13:49:57 +0200 | [diff] [blame] | 357 | function f_send_gtpc(in template Gtp1cUnitdata data) runs on GT_CT { |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 358 | GTPC.send(data); |
Harald Welte | 5438b9d | 2017-08-13 13:27:48 +0200 | [diff] [blame] | 359 | g_c_seq_nr := g_c_seq_nr + 1; |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 360 | } |
| 361 | |
| 362 | /* send GTP-U for a given context and increment sequence number */ |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 363 | function f_send_gtpu(inout PdpContext ctx, in octetstring data) runs on GT_CT { |
Harald Welte | 3e0b039 | 2018-04-26 09:46:21 +0200 | [diff] [blame] | 364 | if (use_gtpu_txseq) { |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 365 | GTPU.send(ts_GTP1U_GPDU(g_peer_u, g_d_seq_nr, ctx.teid_remote, data)); |
| 366 | g_d_seq_nr := g_d_seq_nr + 1; |
| 367 | } else { |
| 368 | GTPU.send(ts_GTP1U_GPDU(g_peer_u, omit, ctx.teid_remote, data)); |
| 369 | } |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 370 | } |
| 371 | |
Pau Espin Pedrol | 0f464d6 | 2022-02-23 14:04:29 +0100 | [diff] [blame] | 372 | function f_handle_create_req(inout PdpContext ctx, in Gtp1cUnitdata ud, in template OCT1 exp_cause := '80'O) runs on GT_CT { |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 373 | var CreatePDPContextResponse cpr := ud.gtpc.gtpc_pdu.createPDPContextResponse; |
Pau Espin Pedrol | 0f464d6 | 2022-02-23 14:04:29 +0100 | [diff] [blame] | 374 | |
| 375 | if (not match(cpr.cause.causevalue, exp_cause)) { |
| 376 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 377 | "CreatePDPContextResp: cause expectancies didn't match"); |
| 378 | } |
| 379 | |
| 380 | if (cpr.cause.causevalue == '80'O) { /* Accepted */ |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 381 | /* Check if EUA type corresponds to requested type */ |
| 382 | if (match(ctx.eua, t_EuaIPv4(?)) and |
| 383 | not match(cpr.endUserAddress, tr_EuaIPv4(?))){ |
Pau Espin Pedrol | 8ad031a | 2022-02-16 17:33:43 +0100 | [diff] [blame] | 384 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 385 | "EUAv4 expectancies didn't match"); |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 386 | } |
| 387 | if (match(ctx.eua, t_EuaIPv6(?)) and |
| 388 | not match(cpr.endUserAddress, tr_EuaIPv6(?))) { |
Pau Espin Pedrol | 8ad031a | 2022-02-16 17:33:43 +0100 | [diff] [blame] | 389 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 390 | "EUAv6 expectancies didn't match"); |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 391 | } |
| 392 | if (match(ctx.eua, t_EuaIPv4v6(?, ?)) and |
| 393 | not match(cpr.endUserAddress, tr_EuaIPv4v6(?, ?))) { |
Pau Espin Pedrol | 8ad031a | 2022-02-16 17:33:43 +0100 | [diff] [blame] | 394 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 395 | "EUAv4v6 expectancies didn't match"); |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 396 | } |
Pau Espin Pedrol | 0f464d6 | 2022-02-23 14:04:29 +0100 | [diff] [blame] | 397 | } else if (cpr.cause.causevalue == '81'O) { /* Cause: New PDP type due to network preference */ |
| 398 | /* ETSI TS 129 060 7.3.2 Create PDP Context Response. OS#5449 */ |
| 399 | /* This should only happen if EUA requested type is v4v6: */ |
| 400 | if (not ischosen(ctx.eua.endUserAddress.endUserAddressIPv4andIPv6)) { |
| 401 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 402 | "Cause not expected when requesting a non v4v6 EUA"); |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 403 | } |
Pau Espin Pedrol | 0f464d6 | 2022-02-23 14:04:29 +0100 | [diff] [blame] | 404 | if (not match(cpr.endUserAddress, (tr_EuaIPv4(?), tr_EuaIPv6(?)))) { |
| 405 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 406 | "Cause not expected when requesting+receiving EUAv4v6"); |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 407 | } |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 408 | } else { |
Pau Espin Pedrol | 0f464d6 | 2022-02-23 14:04:29 +0100 | [diff] [blame] | 409 | if (ispresent(cpr.endUserAddress)) { |
| 410 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 411 | "EUA received on createPDPContextResponse cause=" & oct2str(cpr.cause.causevalue)); |
| 412 | } |
| 413 | setverdict(pass); |
| 414 | return; |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 415 | } |
Pau Espin Pedrol | 0f464d6 | 2022-02-23 14:04:29 +0100 | [diff] [blame] | 416 | |
| 417 | /* Check if PCO response corresponds to request */ |
| 418 | if (ispresent(ctx.pco_req)) { |
| 419 | if (match(ctx.pco_req, ts_PCO_IPv4_DNS_CONT) and |
| 420 | not match(cpr.protConfigOptions, tr_PCO_IPv4_DNS_CONT_resp(?))) { |
| 421 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 422 | "IPv4 DNS Container requested, but missing"); |
| 423 | } |
| 424 | if (match(ctx.pco_req, ts_PCO_IPv6_DNS) and |
| 425 | not match(cpr.protConfigOptions, tr_PCO_IPv6_DNS_resp(?))) { |
| 426 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 427 | "IPv6 DNS Container requested, but missing"); |
| 428 | } |
| 429 | } |
| 430 | ctx.teid_remote := cpr.teidDataI.teidDataI; |
| 431 | ctx.teic_remote := cpr.teidControlPlane.teidControlPlane; |
| 432 | ctx.eua := cpr.endUserAddress; |
| 433 | ctx.pco_neg := cpr.protConfigOptions; |
| 434 | setverdict(pass); |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 435 | } |
| 436 | |
Pau Espin Pedrol | cd326c5 | 2022-02-14 18:57:43 +0100 | [diff] [blame] | 437 | function f_handle_update_req(inout PdpContext ctx, in Gtp1cUnitdata ud, in OCT1 exp_cause := '80'O) runs on GT_CT { |
| 438 | var UpdatePDPContextResponseGGSN upr := ud.gtpc.gtpc_pdu.updatePDPContextResponse.updatePDPContextResponseGGSN; |
| 439 | if (exp_cause == '80'O and exp_cause == upr.cause.causevalue) { |
| 440 | ctx.teid_remote := upr.teidDataI.teidDataI; |
| 441 | ctx.teic_remote := upr.teidControlPlane.teidControlPlane; |
| 442 | if (ispresent(upr.protConfigOptions)) { |
| 443 | ctx.pco_neg := upr.protConfigOptions; |
| 444 | } |
| 445 | setverdict(pass); |
| 446 | } else if (exp_cause != '80'O and exp_cause == upr.cause.causevalue) { |
| 447 | setverdict(pass); |
| 448 | } else { |
Pau Espin Pedrol | 8ad031a | 2022-02-16 17:33:43 +0100 | [diff] [blame] | 449 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 450 | "UpdatePDPContextResp: cause expectancies didn't match"); |
Pau Espin Pedrol | cd326c5 | 2022-02-14 18:57:43 +0100 | [diff] [blame] | 451 | } |
| 452 | } |
| 453 | |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 454 | private altstep as_DIA_Gx_CCR(DCC_NONE_CC_Request_Type req_type) runs on GT_CT { |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 455 | var PDU_DIAMETER rx_dia; |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 456 | [] Gx_UNIT.receive(tr_DIA_Gx_CCR(req_type := req_type)) -> value rx_dia { |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 457 | var template (omit) AVP avp; |
| 458 | var octetstring sess_id; |
| 459 | var AVP_Unsigned32 req_num; |
| 460 | |
| 461 | avp := f_DIAMETER_get_avp(rx_dia, c_AVP_Code_BASE_NONE_Session_Id); |
| 462 | sess_id := valueof(avp.avp_data.avp_BASE_NONE_Session_Id); |
| 463 | |
| 464 | avp := f_DIAMETER_get_avp(rx_dia, c_AVP_Code_DCC_NONE_CC_Request_Number); |
| 465 | req_num := valueof(avp.avp_data.avp_DCC_NONE_CC_Request_Number); |
| 466 | |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 467 | Gx_UNIT.send(ts_DIA_Gx_CCA(rx_dia.hop_by_hop_id, rx_dia.end_to_end_id, sess_id, |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 468 | req_type, req_num)); |
| 469 | } |
Pau Espin Pedrol | 45d5702 | 2022-03-08 13:49:02 +0100 | [diff] [blame] | 470 | [] Gx_UNIT.receive(PDU_DIAMETER:?) -> value rx_dia { |
Pau Espin Pedrol | 8ad031a | 2022-02-16 17:33:43 +0100 | [diff] [blame] | 471 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 472 | log2str("Received unexpected DIAMETER ", rx_dia)); |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 473 | } |
| 474 | } |
| 475 | |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 476 | private altstep as_DIA_Gy_CCR(DCC_NONE_CC_Request_Type req_type) runs on GT_CT { |
| 477 | var PDU_DIAMETER rx_dia; |
| 478 | [] Gy_UNIT.receive(tr_DIA_Gy_CCR(req_type := req_type)) -> value rx_dia { |
| 479 | var template (value) PDU_DIAMETER tx_dia; |
| 480 | var template (omit) AVP avp; |
| 481 | var octetstring sess_id; |
| 482 | var AVP_Unsigned32 req_num; |
| 483 | |
| 484 | avp := f_DIAMETER_get_avp(rx_dia, c_AVP_Code_BASE_NONE_Session_Id); |
| 485 | sess_id := valueof(avp.avp_data.avp_BASE_NONE_Session_Id); |
| 486 | |
| 487 | avp := f_DIAMETER_get_avp(rx_dia, c_AVP_Code_DCC_NONE_CC_Request_Number); |
| 488 | req_num := valueof(avp.avp_data.avp_DCC_NONE_CC_Request_Number); |
| 489 | if (g_gy_validity_time > 0) { |
| 490 | tx_dia := ts_DIA_Gy_CCA_ValidityTime(rx_dia.hop_by_hop_id, rx_dia.end_to_end_id, sess_id, |
| 491 | req_type, req_num, g_gy_validity_time); |
| 492 | } else { |
| 493 | tx_dia := ts_DIA_Gy_CCA(rx_dia.hop_by_hop_id, rx_dia.end_to_end_id, sess_id, |
| 494 | req_type, req_num); |
| 495 | } |
| 496 | Gy_UNIT.send(tx_dia); |
| 497 | } |
| 498 | [] Gy_UNIT.receive(PDU_DIAMETER:?) -> value rx_dia { |
| 499 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 500 | log2str("Received unexpected DIAMETER Gy", rx_dia)); |
| 501 | } |
| 502 | } |
| 503 | |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 504 | /* send a PDP context activation */ |
Pau Espin Pedrol | 0f464d6 | 2022-02-23 14:04:29 +0100 | [diff] [blame] | 505 | function f_pdp_ctx_act(inout PdpContext ctx, template OCT1 exp_cause := '80'O) runs on GT_CT return CreatePDPContextResponse { |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 506 | var Gtp1cUnitdata ud; |
Pau Espin Pedrol | 0f464d6 | 2022-02-23 14:04:29 +0100 | [diff] [blame] | 507 | var CreatePDPContextResponse cpr; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 508 | var default d; |
| 509 | |
| 510 | log("sending CreatePDP"); |
Harald Welte | 41575e9 | 2017-08-13 13:49:57 +0200 | [diff] [blame] | 511 | f_send_gtpc(ts_GTPC_CreatePDP(g_peer_c, g_c_seq_nr, ctx.imsi, g_restart_ctr, |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 512 | ctx.teid, ctx.teic, ctx.nsapi, ctx.eua, ctx.apn, |
Pau Espin Pedrol | ca587f1 | 2022-02-02 10:42:01 +0100 | [diff] [blame] | 513 | g_sgsn_ip_c, g_sgsn_ip_u, ctx.msisdn, ctx.pco_req, ctx.ratType, ctx.uli)); |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 514 | T_default.start; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 515 | d := activate(pingpong()); |
Pau Espin Pedrol | 45d5702 | 2022-03-08 13:49:02 +0100 | [diff] [blame] | 516 | if (Gx_PROC.checkstate("Connected")) { |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 517 | as_DIA_Gx_CCR(INITIAL_REQUEST); |
| 518 | } |
| 519 | if (Gy_PROC.checkstate("Connected")) { |
| 520 | as_DIA_Gy_CCR(INITIAL_REQUEST); |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 521 | } |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 522 | alt { |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 523 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, createPDPContextResponse, ctx.teic)) -> value ud { |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 524 | f_handle_create_req(ctx, ud, exp_cause); |
Pau Espin Pedrol | 0f464d6 | 2022-02-23 14:04:29 +0100 | [diff] [blame] | 525 | cpr := ud.gtpc.gtpc_pdu.createPDPContextResponse; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 526 | } |
| 527 | } |
| 528 | deactivate(d); |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 529 | T_default.stop; |
Pau Espin Pedrol | 0f464d6 | 2022-02-23 14:04:29 +0100 | [diff] [blame] | 530 | return cpr; |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 531 | } |
| 532 | |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 533 | function f_pdp_ctx_exp_del_req(PdpContext ctx, template (omit) OCT1 expect_cause := omit, boolean expect_teardown := false) runs on GT_CT { |
| 534 | var Gtp1cUnitdata ud; |
| 535 | var default d; |
| 536 | |
| 537 | T_default.start; |
| 538 | d := activate(pingpong()); |
| 539 | alt { |
| 540 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextRequest, ctx.teic)) -> value ud { |
| 541 | if (istemplatekind(expect_cause, "omit") and not ispresent(ud.gtpc.gtpc_pdu.deletePDPContextRequest.cause.causevalue)) { |
| 542 | setverdict(pass); |
| 543 | } else if (not istemplatekind(expect_cause, "omit") and |
| 544 | ispresent(ud.gtpc.gtpc_pdu.deletePDPContextRequest.cause.causevalue) and |
| 545 | ud.gtpc.gtpc_pdu.deletePDPContextRequest.cause.causevalue == valueof(expect_cause)) { |
| 546 | setverdict(pass); |
| 547 | } else { |
Pau Espin Pedrol | 8ad031a | 2022-02-16 17:33:43 +0100 | [diff] [blame] | 548 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 549 | "DeletePDPContextReq: cause expectancies didn't match"); |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 550 | } |
| 551 | |
| 552 | if (expect_teardown == ispresent(ud.gtpc.gtpc_pdu.deletePDPContextRequest.tearDownIndicator)) { |
| 553 | setverdict(pass); |
| 554 | } else { |
| 555 | setverdict(fail); |
Pau Espin Pedrol | 8ad031a | 2022-02-16 17:33:43 +0100 | [diff] [blame] | 556 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 557 | "DeletePDPContextReq: tearDownIndicator expectancies didn't match"); |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 558 | } |
| 559 | } |
| 560 | } |
| 561 | deactivate(d); |
| 562 | T_default.stop; |
| 563 | } |
| 564 | |
Pau Espin Pedrol | 10ec96e | 2022-02-09 17:03:15 +0100 | [diff] [blame] | 565 | function f_pdp_ctx_del(PdpContext ctx, template BIT1 teardown_ind, OCT1 expect_causevalue := '80'O, boolean expect_diameter := true) runs on GT_CT { |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 566 | var Gtp1cUnitdata ud; |
| 567 | var default d; |
Pau Espin Pedrol | 9a5f42f | 2019-05-27 20:04:35 +0200 | [diff] [blame] | 568 | var OCT4 expect_teid; |
| 569 | |
| 570 | /* 3GPP TS 29.060 sec 7.3.6 specifies TEID used in response |
| 571 | message with cause value "Non existent" shall be zero. */ |
| 572 | if (expect_causevalue == 'C0'O) { |
| 573 | expect_teid := '00000000'O; |
| 574 | } else { |
| 575 | expect_teid := ctx.teic; |
| 576 | } |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 577 | |
Harald Welte | 41575e9 | 2017-08-13 13:49:57 +0200 | [diff] [blame] | 578 | f_send_gtpc(ts_GTPC_DeletePDP(g_peer_c, g_c_seq_nr, ctx.teic_remote, ctx.nsapi, teardown_ind)); |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 579 | T_default.start; |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 580 | d := activate(pingpong()); |
Pau Espin Pedrol | 45d5702 | 2022-03-08 13:49:02 +0100 | [diff] [blame] | 581 | if (Gx_PROC.checkstate("Connected") and expect_diameter) { |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 582 | as_DIA_Gx_CCR(TERMINATION_REQUEST); |
| 583 | } |
| 584 | if (Gy_PROC.checkstate("Connected") and expect_diameter) { |
| 585 | as_DIA_Gy_CCR(TERMINATION_REQUEST); |
Pau Espin Pedrol | 0bcfd9d | 2022-02-02 11:01:35 +0100 | [diff] [blame] | 586 | } |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 587 | alt { |
Pau Espin Pedrol | 9a5f42f | 2019-05-27 20:04:35 +0200 | [diff] [blame] | 588 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextResponse, expect_teid)) -> value ud { |
| 589 | if (ud.gtpc.gtpc_pdu.deletePDPContextResponse.cause.causevalue == expect_causevalue) { |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 590 | setverdict(pass); |
| 591 | } else { |
Pau Espin Pedrol | 8ad031a | 2022-02-16 17:33:43 +0100 | [diff] [blame] | 592 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 593 | "DeletePDPContextResp: cause expectancies didn't match"); |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 594 | } |
| 595 | } |
| 596 | } |
| 597 | deactivate(d); |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 598 | T_default.stop; |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 599 | } |
Pau Espin Pedrol | cd326c5 | 2022-02-14 18:57:43 +0100 | [diff] [blame] | 600 | |
| 601 | /* send a Update PdP Context Request, expect Response */ |
| 602 | function f_pdp_ctx_update(inout PdpContext ctx, OCT1 exp_cause := '80'O, template (omit) OCT4 new_teid := omit, template (omit) OCT4 new_teic := omit) runs on GT_CT { |
| 603 | var Gtp1cUnitdata ud; |
| 604 | var default d; |
| 605 | |
| 606 | if (not istemplatekind(new_teid, "omit")) { |
| 607 | ctx.teid := valueof(new_teid); |
| 608 | } |
| 609 | if (not istemplatekind(new_teic, "omit")) { |
| 610 | ctx.teic := valueof(new_teic); |
| 611 | } |
| 612 | |
| 613 | log("sending UpdatePDP"); |
| 614 | f_send_gtpc(ts_GTPC_UpdatePDP(g_peer_c, ctx.teic_remote, g_c_seq_nr, ctx.imsi, g_restart_ctr, |
| 615 | ctx.teid, ctx.teic, ctx.nsapi, g_sgsn_ip_c, g_sgsn_ip_u, |
| 616 | ctx.pco_req, ctx.ratType, ctx.uli)); |
| 617 | T_default.start; |
| 618 | d := activate(pingpong()); |
| 619 | alt { |
| 620 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, updatePDPContextResponse, ctx.teic)) -> value ud { |
| 621 | f_handle_update_req(ctx, ud, exp_cause); |
| 622 | } |
| 623 | } |
| 624 | deactivate(d); |
| 625 | T_default.stop; |
| 626 | } |
| 627 | |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 628 | /* IPv6 router solicitation fe80::2 -> ff02::2 from 02:88:b5:1f:25:59 */ |
| 629 | const octetstring c_router_solicit := '6000000000103afffe800000000000000000000000000002ff02000000000000000000000000000285009f2b0000000001010288b51f2559'O; |
| 630 | /* IPv6 neighbor solicitation fe80::2 -> ff02::1:ff00:2 from 02:88:b5:1f:25:59 */ |
| 631 | const octetstring c_neigh_solicit:= '6000000000203afffe800000000000000000000000000002ff0200000000000000000001ff00000287009f9600000000fe80000000000000000000000000000201010288b51f2559'O; |
Harald Welte | f1e0d5a | 2017-08-05 08:51:22 +0200 | [diff] [blame] | 632 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 633 | /* template for sending an ICMPv4 echo request */ |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 634 | template PDU_ICMP ts_ICMPv4_ERQ := { |
| 635 | echo := { |
| 636 | type_field := 8, |
| 637 | code := 0, |
| 638 | checksum := '0000'O, |
| 639 | identifier := '0345'O, |
| 640 | sequence_number := '0001'O, |
| 641 | data := ''O |
| 642 | } |
| 643 | } |
| 644 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 645 | /* template for receiving/matching an ICMPv4 echo request */ |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 646 | template PDU_ICMP tr_ICMPv4_ERQ := { |
| 647 | echo := { |
| 648 | type_field := 8, |
| 649 | code := 0, |
| 650 | checksum := ?, |
| 651 | identifier := ?, |
| 652 | sequence_number := ?, |
| 653 | data := ? |
| 654 | } |
| 655 | } |
| 656 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 657 | /* template for receiving/matching an ICMPv4 echo reply */ |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 658 | template PDU_ICMP tr_ICMPv4_ERP(template octetstring data := *) := { |
| 659 | echo_reply := { |
| 660 | type_field := 0, |
| 661 | code := 0, |
| 662 | checksum := ?, |
| 663 | identifier := ?, |
| 664 | sequence_number := ?, |
| 665 | data := data |
| 666 | } |
| 667 | } |
| 668 | |
| 669 | /* template for receiving/matching an ICMPv6 Destination Unreachable */ |
| 670 | template PDU_ICMP tr_ICMPv4_DU := { |
| 671 | destination_unreachable := { |
| 672 | type_field := 1, |
| 673 | code := ?, |
| 674 | checksum := ?, |
| 675 | unused := ?, |
| 676 | original_ip_msg := ? |
| 677 | } |
| 678 | } |
| 679 | |
| 680 | /* template to construct IPv4_packet from input arguments, ready for use in f_IPv4_enc() */ |
| 681 | template IPv4_packet ts_IP4(OCT4 srcaddr, OCT4 dstaddr, LIN1 proto, LIN2_BO_LAST tlen, octetstring payload) := { |
| 682 | header := { |
| 683 | ver := 4, |
| 684 | hlen := 5, |
| 685 | tos := 0, |
| 686 | tlen := tlen, |
| 687 | id := 35902, |
| 688 | res := '0'B, |
| 689 | dfrag := '1'B, |
| 690 | mfrag := '0'B, |
| 691 | foffset := 0, |
| 692 | ttl := 64, |
| 693 | proto := proto, |
| 694 | cksum := 0, |
| 695 | srcaddr := srcaddr, |
| 696 | dstaddr := dstaddr |
| 697 | }, |
| 698 | ext_headers := omit, |
| 699 | payload := payload |
| 700 | } |
| 701 | |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 702 | /* template to generate a 'Prefix Information' ICMPv6 option */ |
| 703 | template OptionField ts_ICMP6_OptPrefix(OCT16 prefix, INT1 prefix_len) := { |
| 704 | prefixInformation := { |
| 705 | typeField := 3, |
| 706 | lengthIndicator := 8, |
| 707 | prefixLength := prefix_len, |
| 708 | reserved1 := '000000'B, |
| 709 | a_Bit := '0'B, |
| 710 | l_Bit := '0'B, |
| 711 | validLifetime := oct2int('FFFFFFFF'O), |
| 712 | preferredLifetime := oct2int('FFFFFFFF'O), |
| 713 | reserved2 := '00000000'O, |
| 714 | prefix := prefix |
| 715 | } |
| 716 | } |
| 717 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 718 | /* template for sending an ICMPv6 echo request */ |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 719 | template PDU_ICMPv6 ts_ICMPv6_ERQ := { |
| 720 | echoRequest := { |
| 721 | typeField := 128, |
| 722 | code := 0, |
| 723 | checksum := '0000'O, |
| 724 | identifier := 0, |
| 725 | sequenceNr := 0, |
| 726 | data := ''O |
| 727 | } |
| 728 | } |
| 729 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 730 | /* template for sending an ICMPv6 router solicitation */ |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 731 | template PDU_ICMPv6 ts_ICMPv6_RS := { |
| 732 | routerSolicitation := { |
| 733 | typeField := 133, |
| 734 | code := 0, |
| 735 | checksum := '0000'O, |
| 736 | reserved := '00000000'O, |
| 737 | /* TODO: do we need 'Source link-layer address' ? */ |
| 738 | options := omit |
| 739 | } |
| 740 | } |
| 741 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 742 | /* template for sending an ICMPv6 router advertisement */ |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 743 | template PDU_ICMPv6 ts_ICMPv6_RA(OCT16 prefix, INT1 prefix_len) := { |
| 744 | routerAdvertisement := { |
| 745 | typeField := 134, |
| 746 | code := 0, |
| 747 | checksum := '0000'O, |
| 748 | curHopLimit := ?, |
| 749 | reserved := '000000'B, |
| 750 | o_Bit := '0'B, |
| 751 | m_Bit := '0'B, |
| 752 | routerLifetime := oct2int('FFFF'O), |
| 753 | reachableTime := oct2int('FFFFFFFF'O), |
| 754 | retransTimer := oct2int('FFFFFFFF'O), |
| 755 | options := { |
| 756 | ts_ICMP6_OptPrefix(prefix, prefix_len) |
| 757 | } |
| 758 | } |
| 759 | } |
| 760 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 761 | /* template for sending an ICMPv6 neighbor solicitation */ |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 762 | template PDU_ICMPv6 ts_ICMPv6_NS(OCT16 target_addr) := { |
| 763 | neighborSolicitation := { |
| 764 | typeField := 135, |
| 765 | code := 0, |
| 766 | checksum := '0000'O, |
| 767 | reserved := '00000000'O, |
| 768 | targetAddress := target_addr, |
| 769 | /* TODO: do we need 'Source link-layer address' ? */ |
| 770 | options := omit |
| 771 | } |
| 772 | } |
| 773 | |
| 774 | /* derive ICMPv6 link-local address from lower 64bit of link_id */ |
| 775 | /* template for receiving/matching an ICMPv6 'Prefix Information' option */ |
| 776 | template OptionField tr_ICMP6_OptPrefix(template OCT16 prefix, template INT1 prefix_len) := { |
| 777 | prefixInformation := { |
| 778 | typeField := 3, |
| 779 | lengthIndicator := 4, |
| 780 | prefixLength := prefix_len, |
| 781 | reserved1 := ?, |
| 782 | a_Bit := ?, |
| 783 | l_Bit := ?, |
| 784 | validLifetime := ?, |
| 785 | preferredLifetime := ?, |
| 786 | reserved2 := ?, |
| 787 | prefix := prefix |
| 788 | } |
| 789 | } |
| 790 | |
| 791 | /* template for receiving/matching an ICMPv6 router advertisement */ |
| 792 | template PDU_ICMPv6 tr_ICMPv6_RA(template OCT16 prefix, template INT1 prefix_len) := { |
| 793 | routerAdvertisement := { |
| 794 | typeField := 134, |
| 795 | code := 0, |
| 796 | checksum := ?, |
| 797 | curHopLimit := ?, |
| 798 | reserved := ?, |
| 799 | o_Bit := '0'B, |
| 800 | m_Bit := '0'B, |
| 801 | routerLifetime := ?, |
| 802 | reachableTime := ?, |
| 803 | retransTimer := ?, |
| 804 | options := { |
| 805 | tr_ICMP6_OptPrefix(prefix, prefix_len) |
| 806 | } |
| 807 | } |
| 808 | } |
| 809 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 810 | /* template for receiving/matching an ICMPv6 Destination Unreachable */ |
| 811 | template PDU_ICMPv6 tr_ICMPv6_DU := { |
| 812 | destinationUnreachable := { |
| 813 | typeField := 1, |
| 814 | code := ?, |
| 815 | checksum := ?, |
| 816 | unused := ?, |
| 817 | originalIpMsg := ? |
| 818 | } |
| 819 | } |
| 820 | |
Stefan Sperling | 6cd217e | 2018-03-30 15:17:34 +0200 | [diff] [blame] | 821 | /* template for receiving/matching an ICMPv6 echo request */ |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 822 | template PDU_ICMPv6 tr_ICMPv6_ERQ := { |
| 823 | echoRequest := { |
| 824 | typeField := 128, |
| 825 | code := 0, |
| 826 | checksum := ?, |
| 827 | identifier := ?, |
| 828 | sequenceNr := ?, |
| 829 | data := ? |
| 830 | } |
| 831 | } |
| 832 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 833 | /* template for receiving/matching an ICMPv6 echo reply */ |
| 834 | template PDU_ICMPv6 tr_ICMPv6_ERP(template octetstring data := *) := { |
| 835 | echoReply := { |
| 836 | typeField := 129, |
| 837 | code := 0, |
| 838 | checksum := ?, |
| 839 | identifier := ?, |
| 840 | sequenceNr := ?, |
| 841 | data := data |
| 842 | } |
| 843 | } |
| 844 | |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 845 | /* template to construct IPv6_packet from input arguments, ready for use in f_IPv6_enc() */ |
| 846 | template IPv6_packet ts_IP6(OCT16 srcaddr, OCT16 dstaddr, LIN1 nexthead, octetstring payload, LIN1 hlim := 255) := { |
| 847 | header := { |
| 848 | ver := 6, |
| 849 | trclass := 0, |
| 850 | flabel := 0, |
| 851 | plen := 0, |
| 852 | nexthead := nexthead, |
| 853 | hlim := hlim, |
| 854 | srcaddr := srcaddr, |
| 855 | dstaddr := dstaddr |
| 856 | }, |
| 857 | ext_headers := omit, |
| 858 | payload := payload |
| 859 | } |
| 860 | |
| 861 | function f_ipv6_link_local(in OCT16 link_id) return OCT16 { |
| 862 | return 'FE80000000000000'O & substr(link_id, 8, 8); |
| 863 | } |
| 864 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 865 | function f_ipv6_global(in OCT16 link_id) return OCT16 { |
| 866 | return substr(link_id, 0, 8) & '1234123412341234'O; |
| 867 | } |
| 868 | |
| 869 | /* Create a new different IPv6 addr from input. Starts mangling at byte prefix. */ |
| 870 | function f_ipv6_mangle(in OCT16 addr, in integer prefix := 0) return OCT16 { |
| 871 | var integer i; |
| 872 | var octetstring res := substr(addr, 0, prefix); |
| 873 | for (i := prefix; i < lengthof(addr); i := i + 1) { |
| 874 | var octetstring a := addr[i] xor4b '11'O; |
| 875 | res := res & a; |
| 876 | } |
| 877 | return res; |
| 878 | } |
| 879 | |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 880 | /* Compute solicited-node multicast address as per RFC4291 2.7.1 */ |
| 881 | function f_ipv6_sol_node_mcast(in OCT16 addr) return OCT16 { |
| 882 | return 'FF0200000000000000000001FF'O & substr(addr, 13, 3); |
| 883 | } |
| 884 | |
| 885 | /* generate and encode ICMPv6 router solicitation */ |
| 886 | function f_gen_icmpv6_router_solicitation(in OCT16 link_id) return octetstring { |
| 887 | const OCT16 c_ip6_all_router_mcast := 'FF020000000000000000000000000002'O; |
| 888 | var OCT16 saddr := f_ipv6_link_local(link_id); |
| 889 | |
| 890 | var octetstring tmp; |
| 891 | tmp := f_enc_PDU_ICMPv6(valueof(ts_ICMPv6_RS), saddr, c_ip6_all_router_mcast); |
| 892 | var IPv6_packet ip6 := valueof(ts_IP6(saddr, c_ip6_all_router_mcast, 58, tmp)); |
| 893 | |
| 894 | return f_IPv6_enc(ip6); |
| 895 | } |
| 896 | |
Pau Espin Pedrol | 5760421 | 2022-02-14 16:54:18 +0100 | [diff] [blame] | 897 | /* Get link-id from PDP Context EUA */ |
| 898 | function f_ctx_get_ipv6_interface_id(in PdpContext ctx) return OCT16 { |
| 899 | var OCT16 interface_id; |
| 900 | if (ischosen(ctx.eua.endUserAddress.endUserAddressIPv4andIPv6)) { |
| 901 | interface_id := ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address; |
| 902 | } else if (ischosen(ctx.eua.endUserAddress.endUserAddressIPv6)) { |
| 903 | interface_id := ctx.eua.endUserAddress.endUserAddressIPv6.ipv6_address; |
| 904 | } else { |
| 905 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected request to submit icmpv6 rs in IPv4 PDP context"); |
| 906 | } |
| 907 | return interface_id; |
| 908 | } |
| 909 | |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 910 | /* create ICMPv6 router solicitation deriving link-id from PDP Context EUA */ |
| 911 | function f_icmpv6_rs_for_pdp(in PdpContext ctx) return octetstring { |
Pau Espin Pedrol | 5760421 | 2022-02-14 16:54:18 +0100 | [diff] [blame] | 912 | var OCT16 interface_id := f_ctx_get_ipv6_interface_id(ctx); |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 913 | return f_gen_icmpv6_router_solicitation(interface_id); |
| 914 | } |
| 915 | |
| 916 | /* generate and encode ICMPv6 neighbor solicitation */ |
| 917 | function f_gen_icmpv6_neigh_solicit(in OCT16 saddr, in OCT16 daddr, in OCT16 tgt_addr) return octetstring { |
| 918 | var octetstring tmp; |
| 919 | tmp := f_enc_PDU_ICMPv6(valueof(ts_ICMPv6_NS(tgt_addr)), saddr, daddr); |
| 920 | var IPv6_packet ip6 := valueof(ts_IP6(saddr, daddr, 58, tmp)); |
| 921 | return f_IPv6_enc(ip6); |
| 922 | } |
| 923 | |
| 924 | /* generate and encode ICMPv6 neighbor solicitation for PDP Context */ |
| 925 | function f_gen_icmpv6_neigh_solicit_for_pdp(in PdpContext ctx) return octetstring { |
Pau Espin Pedrol | 5760421 | 2022-02-14 16:54:18 +0100 | [diff] [blame] | 926 | var OCT16 interface_id := f_ctx_get_ipv6_interface_id(ctx); |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 927 | var OCT16 link_local := f_ipv6_link_local(interface_id); |
| 928 | var OCT16 daddr := f_ipv6_sol_node_mcast(link_local); |
| 929 | |
| 930 | return f_gen_icmpv6_neigh_solicit(link_local, daddr, link_local); |
| 931 | } |
| 932 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 933 | /* Send an ICMPv4 echo msg through GTP given pdp ctx, and ip src and dst addr */ |
| 934 | function f_gen_icmpv4_echo(OCT4 saddr, OCT4 daddr) return octetstring { |
| 935 | var octetstring tmp := f_enc_PDU_ICMP(valueof(ts_ICMPv4_ERQ)); |
| 936 | var IPv4_packet ip4 := valueof(ts_IP4(saddr, daddr, 1, 50, tmp)); |
| 937 | var octetstring data := f_IPv4_enc(ip4); |
| 938 | var OCT2 cksum := f_IPv4_checksum(data); |
| 939 | data[10] := cksum[0]; |
| 940 | data[11] := cksum[1]; |
| 941 | return data; |
| 942 | } |
| 943 | |
| 944 | /* Send an ICMPv6 echo msg through GTP given pdp ctx, and ip src and dst addr */ |
| 945 | function f_gen_icmpv6_echo(OCT16 saddr, OCT16 daddr) return octetstring { |
| 946 | var octetstring tmp := f_enc_PDU_ICMPv6(valueof(ts_ICMPv6_ERQ), saddr, daddr); |
| 947 | var IPv6_packet ip6 := valueof(ts_IP6(saddr, daddr, 58, tmp)); |
| 948 | var octetstring data := f_IPv6_enc(ip6); |
| 949 | return data; |
| 950 | } |
| 951 | |
| 952 | /* Wait for ICMPv4 from GTP */ |
| 953 | function f_wait_icmp4(PdpContext ctx, template PDU_ICMP expected) runs on GT_CT { |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 954 | var Gtp1uUnitdata ud; |
| 955 | T_default.start; |
| 956 | alt { |
Pau Espin Pedrol | cd326c5 | 2022-02-14 18:57:43 +0100 | [diff] [blame] | 957 | [] GTPU.receive(tr_GTPU_GPDU(g_peer_u, ctx.teid)) -> value ud { |
Harald Welte | 3e0b039 | 2018-04-26 09:46:21 +0200 | [diff] [blame] | 958 | if (f_verify_gtpu_txseq(ud.gtpu, use_gtpu_txseq) == false) { |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 959 | setverdict(fail); |
| 960 | stop; |
| 961 | } |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 962 | var octetstring gpdu := ud.gtpu.gtpu_IEs.g_PDU_IEs.data; |
| 963 | var IPv4_packet ip4 := f_IPv4_dec(gpdu); |
| 964 | if (ip4.header.ver != 4) { |
| 965 | repeat; |
| 966 | } |
| 967 | var PDU_ICMP icmp4 := f_dec_PDU_ICMP(ip4.payload); |
| 968 | if (not match(icmp4, expected)) { |
| 969 | repeat; |
| 970 | } |
| 971 | } |
Pau Espin Pedrol | cd326c5 | 2022-02-14 18:57:43 +0100 | [diff] [blame] | 972 | [] GTPU.receive(tr_GTPU_GPDU(g_peer_u, ?)) -> value ud { |
| 973 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 974 | "Received wrong local TEID"); |
| 975 | } |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 976 | [] GTPU.receive { setverdict(fail); } |
| 977 | [] T_default.timeout { setverdict(fail); } |
| 978 | } |
| 979 | T_default.stop; |
| 980 | } |
| 981 | |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 982 | /* Wait for ICMPv4 echo request from GTP */ |
| 983 | function f_wait_icmp4_echo_request(PdpContext ctx) runs on GT_CT { |
| 984 | f_wait_icmp4(ctx, tr_ICMPv4_ERQ); |
| 985 | } |
| 986 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 987 | /* Wait for ICMPv4 echo reply (or unreachable) from GTP */ |
| 988 | function f_wait_icmp4_echo_reply(PdpContext ctx) runs on GT_CT { |
| 989 | f_wait_icmp4(ctx, (tr_ICMPv4_ERP, tr_ICMPv4_DU)); |
| 990 | } |
| 991 | |
| 992 | /* Wait for ICMPv6 from GTP */ |
| 993 | function f_wait_icmp6(PdpContext ctx, template PDU_ICMPv6 expected) runs on GT_CT { |
| 994 | var Gtp1uUnitdata ud; |
| 995 | T_default.start; |
| 996 | alt { |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 997 | [] GTPU.receive(tr_GTPU_GPDU(g_peer_u, ?)) -> value ud { |
Harald Welte | 3e0b039 | 2018-04-26 09:46:21 +0200 | [diff] [blame] | 998 | if (f_verify_gtpu_txseq(ud.gtpu, use_gtpu_txseq) == false) { |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 999 | setverdict(fail); |
| 1000 | stop; |
| 1001 | } |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 1002 | var octetstring gpdu := ud.gtpu.gtpu_IEs.g_PDU_IEs.data; |
| 1003 | var IPv6_packet ip6 := f_IPv6_dec(gpdu); |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1004 | if (ip6.header.ver != 6 or ip6.header.nexthead != 58) { |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 1005 | repeat; |
| 1006 | } |
| 1007 | var PDU_ICMPv6 icmp6 := f_dec_PDU_ICMPv6(ip6.payload); |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1008 | if (not match(icmp6, expected)) { |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 1009 | repeat; |
| 1010 | } |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1011 | /* We are waiting for RA, update ctx */ |
| 1012 | if (match(icmp6, tr_ICMPv6_RA(?, 64))) { |
| 1013 | ctx.ip6_prefix := icmp6.routerAdvertisement.options[0].prefixInformation.prefix; |
| 1014 | log("RA with /64 prefix ", ctx.ip6_prefix); |
| 1015 | } |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 1016 | } |
| 1017 | [] GTPU.receive(tr_GTPU_GPDU(?, ?)) { repeat; } |
| 1018 | [] GTPU.receive { setverdict(fail); } |
| 1019 | [] T_default.timeout { setverdict(fail); } |
| 1020 | } |
| 1021 | T_default.stop; |
| 1022 | } |
| 1023 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1024 | /* wait for GGSN to send us an ICMPv6 router advertisement */ |
| 1025 | function f_wait_rtr_adv(PdpContext ctx) runs on GT_CT { |
| 1026 | f_wait_icmp6(ctx, tr_ICMPv6_RA(?, 64)); |
| 1027 | } |
| 1028 | |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 1029 | /* Wait for ICMPv6 echo request from GTP */ |
| 1030 | function f_wait_icmp6_echo_request(PdpContext ctx) runs on GT_CT { |
| 1031 | f_wait_icmp6(ctx, tr_ICMPv6_ERQ); |
| 1032 | } |
| 1033 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1034 | /* Wait for ICMPv6 echo reply (or unreachable) from GTP */ |
| 1035 | function f_wait_icmp6_echo_reply(PdpContext ctx) runs on GT_CT { |
| 1036 | f_wait_icmp6(ctx, (tr_ICMPv6_ERP,tr_ICMPv6_DU)); |
| 1037 | } |
| 1038 | |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1039 | /* create ICMPv6 router solicitation deriving link-id from PDP Context EUA */ |
| 1040 | function f_icmpv6_rs_for_pdp46(in PdpContext ctx) return octetstring { |
| 1041 | var OCT16 interface_id := ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address; |
| 1042 | return f_gen_icmpv6_router_solicitation(interface_id); |
| 1043 | } |
| 1044 | |
| 1045 | /* generate and encode ICMPv6 neighbor solicitation for PDP Context */ |
| 1046 | function f_gen_icmpv6_neigh_solicit_for_pdp46(in PdpContext ctx) return octetstring { |
| 1047 | var OCT16 interface_id := ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address; |
| 1048 | var OCT16 link_local := f_ipv6_link_local(interface_id); |
| 1049 | var OCT16 daddr := f_ipv6_sol_node_mcast(link_local); |
| 1050 | |
| 1051 | return f_gen_icmpv6_neigh_solicit(link_local, daddr, link_local); |
| 1052 | } |
| 1053 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1054 | /* Assert we don't receive a ICMPv4/6 echo reply (or unreachable) from GTP */ |
| 1055 | function f_wait_gtpu_fail(PdpContext ctx) runs on GT_CT { |
| 1056 | T_default.start; |
| 1057 | alt { |
| 1058 | [] GTPU.receive { setverdict(fail); } |
| 1059 | [] T_default.timeout { } |
| 1060 | } |
| 1061 | T_default.stop; |
| 1062 | } |
| 1063 | |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1064 | /* list of protocols where we don't accept duplicates */ |
| 1065 | const OCT2List protocol_ids_nodupes := { 'C021'O, 'C023'O, 'C223'O, '8021'O }; |
| 1066 | private function f_PCO_permits_duplicates(OCT2 id) return boolean { |
| 1067 | var integer i; |
| 1068 | for (i := 0; i < lengthof(protocol_ids_nodupes); i := i+1) { |
| 1069 | if (id == protocol_ids_nodupes[i]) { |
| 1070 | return false; |
| 1071 | } |
| 1072 | } |
| 1073 | return true; |
| 1074 | } |
| 1075 | |
| 1076 | /* ensure that every given protocol Identifier exist only exactly once in the PCO */ |
| 1077 | function f_PCO_ensure_no_duplicates(ProtConfigOptions pco) { |
| 1078 | var OCT2List protocol_ids := {}; |
| 1079 | var integer i, j; |
| 1080 | for (i := 0; i < lengthof(pco.protocols); i := i+1) { |
| 1081 | var OCT2 id := pco.protocols[i].protocolID; |
| 1082 | for (j := 0; j < lengthof(protocol_ids); j := j+1) { |
| 1083 | if (not f_PCO_permits_duplicates(id) and id == protocol_ids[j]) { |
| 1084 | setverdict(fail, "Duplicate ProtocolID ", id, " already present in ", pco.protocols); |
| 1085 | } |
| 1086 | } |
| 1087 | protocol_ids := protocol_ids & { id }; |
| 1088 | } |
| 1089 | } |
| 1090 | |
Harald Welte | 0ef285b | 2017-08-13 20:06:01 +0200 | [diff] [blame] | 1091 | /* Test IPv6 context activation for dynamic IPv6 EUA without request of IPv6 DNS */ |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1092 | testcase TC_pdp6_act_deact() runs on GT_CT { |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 1093 | f_init(); |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 1094 | |
Harald Welte | ed09743 | 2017-08-13 13:28:49 +0200 | [diff] [blame] | 1095 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn))); |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 1096 | f_pdp_ctx_act(ctx); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1097 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1098 | f_shutdown_helper(); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1099 | } |
| 1100 | |
Harald Welte | 0ef285b | 2017-08-13 20:06:01 +0200 | [diff] [blame] | 1101 | /* Test IPv6 context activation for dynamic IPv6 EUA wirh request of IPv6 DNS in PCO */ |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1102 | testcase TC_pdp6_act_deact_pcodns() runs on GT_CT { |
| 1103 | f_init(); |
| 1104 | |
Harald Welte | ed09743 | 2017-08-13 13:28:49 +0200 | [diff] [blame] | 1105 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn))); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1106 | ctx.pco_req := valueof(ts_PCO_IPv6_DNS); |
| 1107 | f_pdp_ctx_act(ctx); |
Pau Espin Pedrol | 363ba48 | 2018-01-29 18:42:00 +0100 | [diff] [blame] | 1108 | |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1109 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Pau Espin Pedrol | 363ba48 | 2018-01-29 18:42:00 +0100 | [diff] [blame] | 1110 | /* verify PCO contains both primary and secondary DNS */ |
| 1111 | var OCT4 ggsn_ip6_dns1 := f_inet6_addr(m_ggsn_ip6_dns1); |
| 1112 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 1), ggsn_ip6_dns1)) { |
| 1113 | setverdict(fail, "Primary DNS IPv6 PCO option not found"); |
| 1114 | } |
| 1115 | |
| 1116 | var OCT4 ggsn_ip6_dns2 := f_inet6_addr(m_ggsn_ip6_dns2); |
| 1117 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 2), ggsn_ip6_dns2)) { |
| 1118 | setverdict(fail, "Secondary DNS IPv6 PCO option not found"); |
| 1119 | } |
| 1120 | |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1121 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1122 | f_shutdown_helper(); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1123 | } |
| 1124 | |
Harald Welte | 0ef285b | 2017-08-13 20:06:01 +0200 | [diff] [blame] | 1125 | /* Test PDP context activation for dynamic IPv6 EUA with IPv6 DNS in PCO and router solicitation/advertisement */ |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1126 | testcase TC_pdp6_act_deact_icmp6() runs on GT_CT { |
| 1127 | f_init(); |
| 1128 | |
Harald Welte | ed09743 | 2017-08-13 13:28:49 +0200 | [diff] [blame] | 1129 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn))); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1130 | ctx.pco_req := valueof(ts_PCO_IPv6_DNS); |
| 1131 | f_pdp_ctx_act(ctx); |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 1132 | |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1133 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Harald Welte | 231b941 | 2017-08-09 17:16:31 +0200 | [diff] [blame] | 1134 | //f_send_gtpu(ctx, c_router_solicit); |
| 1135 | //f_send_gtpu(ctx, c_neigh_solicit); |
| 1136 | |
| 1137 | f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx)); |
| 1138 | f_wait_rtr_adv(ctx); |
| 1139 | f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx)); |
| 1140 | |
Harald Welte | 811651e | 2017-08-05 15:25:06 +0200 | [diff] [blame] | 1141 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1142 | f_shutdown_helper(); |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 1143 | } |
| 1144 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1145 | /* Test PDP context activation for dynamic IPv6 EUA with IPv6 DNS in PCO and router solicitation/advertisement. |
| 1146 | Test we can send ICMPv6 ping over GTPU to DNS server. */ |
| 1147 | testcase TC_pdp6_act_deact_gtpu_access() runs on GT_CT { |
| 1148 | f_init(); |
| 1149 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn))); |
| 1150 | ctx.pco_req := valueof(ts_PCO_IPv6_DNS); |
| 1151 | f_pdp_ctx_act(ctx); |
| 1152 | |
| 1153 | f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx)); |
| 1154 | f_wait_rtr_adv(ctx); |
| 1155 | f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx)); |
| 1156 | |
| 1157 | var OCT16 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '0003'O); |
| 1158 | |
| 1159 | /* Check if we can use valid link-local src addr. */ |
| 1160 | var OCT16 saddr_ll := f_ipv6_link_local(ctx.eua.endUserAddress.endUserAddressIPv6.ipv6_address); |
| 1161 | f_send_gtpu(ctx, f_gen_icmpv6_echo(saddr_ll, dns1_addr)); |
Pau Espin Pedrol | b63d85f | 2022-02-07 16:11:47 +0100 | [diff] [blame] | 1162 | if (m_ggsn_impl == GGSN_IMPL_OSMOCOM) { |
| 1163 | f_wait_icmp6_echo_reply(ctx); |
| 1164 | } else { |
| 1165 | f_wait_gtpu_fail(ctx); |
| 1166 | } |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1167 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1168 | /* Check if we can use valid global src addr, should work */ |
| 1169 | var OCT16 saddr_glob := f_ipv6_global(ctx.eua.endUserAddress.endUserAddressIPv6.ipv6_address); |
| 1170 | f_send_gtpu(ctx, f_gen_icmpv6_echo(saddr_glob, dns1_addr)); |
| 1171 | f_wait_icmp6_echo_reply(ctx); |
| 1172 | |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1173 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1174 | f_shutdown_helper(); |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1175 | } |
| 1176 | |
| 1177 | /* Check that attempting RA with another ll src addr won't work, packet dropped: */ |
| 1178 | testcase TC_pdp6_act_deact_gtpu_access_wrong_ll_saddr() runs on GT_CT { |
| 1179 | f_init(); |
| 1180 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn))); |
| 1181 | ctx.pco_req := valueof(ts_PCO_IPv6_DNS); |
| 1182 | f_pdp_ctx_act(ctx); |
| 1183 | |
| 1184 | f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx)); |
| 1185 | f_wait_rtr_adv(ctx); |
| 1186 | f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx)); |
| 1187 | |
| 1188 | var OCT16 saddr_ll := f_ipv6_link_local(ctx.eua.endUserAddress.endUserAddressIPv6.ipv6_address); |
| 1189 | var OCT16 saddr_ll_wrong := f_ipv6_mangle(saddr_ll, 8); |
| 1190 | f_send_gtpu(ctx, f_gen_icmpv6_router_solicitation(saddr_ll_wrong)); |
| 1191 | f_wait_gtpu_fail(ctx); |
| 1192 | |
| 1193 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1194 | f_shutdown_helper(); |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1195 | } |
| 1196 | |
| 1197 | /* Assert that packets with wrong global src addr are dropped by GGSN */ |
| 1198 | testcase TC_pdp6_act_deact_gtpu_access_wrong_global_saddr() runs on GT_CT { |
| 1199 | f_init(); |
| 1200 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn))); |
| 1201 | ctx.pco_req := valueof(ts_PCO_IPv6_DNS); |
| 1202 | f_pdp_ctx_act(ctx); |
| 1203 | |
| 1204 | f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx)); |
| 1205 | f_wait_rtr_adv(ctx); |
| 1206 | f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx)); |
| 1207 | |
| 1208 | var OCT16 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '0003'O); |
| 1209 | var OCT16 saddr_glob := f_ipv6_global(ctx.eua.endUserAddress.endUserAddressIPv6.ipv6_address); |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1210 | var OCT16 saddr_wrong := f_ipv6_mangle(saddr_glob); |
| 1211 | f_send_gtpu(ctx, f_gen_icmpv6_echo(saddr_wrong, dns1_addr)); |
| 1212 | f_wait_gtpu_fail(ctx); |
| 1213 | |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1214 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1215 | f_shutdown_helper(); |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1216 | } |
| 1217 | |
| 1218 | /* Send an IPv4 ICMP ECHO REQUEST to APN6, should fail (packet dropped */ |
| 1219 | testcase TC_pdp6_act_deact_gtpu_access_ipv4_apn6() runs on GT_CT { |
| 1220 | f_init(); |
| 1221 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn))); |
| 1222 | ctx.pco_req := valueof(ts_PCO_IPv6_DNS); |
| 1223 | f_pdp_ctx_act(ctx); |
| 1224 | |
| 1225 | f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx)); |
| 1226 | f_wait_rtr_adv(ctx); |
| 1227 | f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx)); |
| 1228 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1229 | var OCT4 saddr_v4 := f_inet_addr("192.168.10.2"); |
| 1230 | var OCT4 daddr_v4 := f_inet_addr("8.8.8.8"); |
| 1231 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr_v4, daddr_v4)); |
| 1232 | f_wait_gtpu_fail(ctx); |
| 1233 | |
| 1234 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1235 | f_shutdown_helper(); |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1236 | } |
| 1237 | |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 1238 | /* Validate if different clients (pdp ctx) can reach one another through GGSN. */ |
| 1239 | testcase TC_pdp6_clients_interact() runs on GT_CT { |
| 1240 | f_init(); |
| 1241 | var PdpContext ctxA := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn))); |
| 1242 | var PdpContext ctxB := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn))); |
| 1243 | f_pdp_ctx_act(ctxA); |
| 1244 | f_send_gtpu(ctxA, f_icmpv6_rs_for_pdp(ctxA)); |
| 1245 | f_wait_rtr_adv(ctxA); |
| 1246 | f_send_gtpu(ctxA, f_gen_icmpv6_neigh_solicit_for_pdp(ctxA)); |
| 1247 | |
| 1248 | f_pdp_ctx_act(ctxB); |
| 1249 | f_send_gtpu(ctxB, f_icmpv6_rs_for_pdp(ctxB)); |
| 1250 | f_wait_rtr_adv(ctxB); |
| 1251 | f_send_gtpu(ctxB, f_gen_icmpv6_neigh_solicit_for_pdp(ctxB)); |
| 1252 | |
| 1253 | var OCT16 addrA_ll := f_ipv6_link_local(ctxA.eua.endUserAddress.endUserAddressIPv6.ipv6_address); |
| 1254 | var OCT16 addrB_ll := f_ipv6_link_local(ctxB.eua.endUserAddress.endUserAddressIPv6.ipv6_address); |
| 1255 | var OCT16 addrA_glob := f_ipv6_global(ctxA.eua.endUserAddress.endUserAddressIPv6.ipv6_address); |
| 1256 | var OCT16 addrB_glob := f_ipv6_global(ctxB.eua.endUserAddress.endUserAddressIPv6.ipv6_address); |
| 1257 | |
| 1258 | /* Validate if clients can interact using ll addr. */ |
| 1259 | f_send_gtpu(ctxA, f_gen_icmpv6_echo(addrA_ll, addrB_ll)); |
| 1260 | f_wait_gtpu_fail(ctxB); |
| 1261 | |
| 1262 | /* Validate if clients can interact using global addr. */ |
| 1263 | f_send_gtpu(ctxA, f_gen_icmpv6_echo(addrA_glob, addrB_glob)); |
| 1264 | f_wait_gtpu_fail(ctxB); |
| 1265 | |
| 1266 | f_pdp_ctx_del(ctxA, '1'B); |
Pau Espin Pedrol | bb2bb06 | 2019-09-03 12:28:12 +0200 | [diff] [blame] | 1267 | f_pdp_ctx_del(ctxB, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1268 | f_shutdown_helper(); |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 1269 | } |
| 1270 | |
Harald Welte | 0ef285b | 2017-08-13 20:06:01 +0200 | [diff] [blame] | 1271 | /* Test PDP context activation for dynamic IPv4 EUA without DNS request */ |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1272 | testcase TC_pdp4_act_deact() runs on GT_CT { |
| 1273 | f_init(); |
Harald Welte | ed09743 | 2017-08-13 13:28:49 +0200 | [diff] [blame] | 1274 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1275 | f_pdp_ctx_act(ctx); |
| 1276 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1277 | f_shutdown_helper(); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1278 | } |
| 1279 | |
Harald Welte | 0ef285b | 2017-08-13 20:06:01 +0200 | [diff] [blame] | 1280 | /* Test PDP context activation for dynamic IPv4 EUA with IPv4 DNS in IPCP */ |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1281 | testcase TC_pdp4_act_deact_ipcp() runs on GT_CT { |
| 1282 | f_init(); |
Pau Espin Pedrol | f69a438 | 2018-01-29 13:09:00 +0100 | [diff] [blame] | 1283 | var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1); |
| 1284 | var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2); |
Harald Welte | ed09743 | 2017-08-13 13:28:49 +0200 | [diff] [blame] | 1285 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
Harald Welte | dca8005 | 2017-08-13 20:01:38 +0200 | [diff] [blame] | 1286 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_IPCP); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1287 | f_pdp_ctx_act(ctx); |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1288 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Harald Welte | 71a3602 | 2017-12-04 18:55:58 +0100 | [diff] [blame] | 1289 | /* verify IPCP is at all contained */ |
| 1290 | if (not match(ctx.pco_neg, tr_PCO_Contains('8021'O))) { |
| 1291 | setverdict(fail, "IPCP not found in PCO"); |
| 1292 | } |
| 1293 | /* verify IPCP contains both primary and secondary DNS */ |
| 1294 | var IpcpPacket ipcp := dec_IpcpPacket(f_PCO_extract_proto(ctx.pco_neg, '8021'O)); |
Pau Espin Pedrol | f69a438 | 2018-01-29 13:09:00 +0100 | [diff] [blame] | 1295 | if (not match(ipcp, tr_IPCP_Ack_DNS(0, ggsn_ip4_dns1, ggsn_ip4_dns2))) { |
| 1296 | if (not match(ipcp, tr_IPCP_Ack_DNS(0))) { |
| 1297 | setverdict(fail, "Primary/Secondary DNS PCO IPCP option not found"); |
| 1298 | } else { |
| 1299 | setverdict(fail, "Primary/Secondary DNS PCO IPCP option found but not matching expected values"); |
| 1300 | } |
Harald Welte | 71a3602 | 2017-12-04 18:55:58 +0100 | [diff] [blame] | 1301 | } |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1302 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1303 | f_shutdown_helper(); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1304 | } |
| 1305 | |
Harald Welte | f829854 | 2019-04-10 10:15:28 +0200 | [diff] [blame] | 1306 | /* Test PDP context activation for dynamic IPv4 EUA with IPv4 DNS in IPCP + PAP authentication (broken) */ |
| 1307 | testcase TC_pdp4_act_deact_ipcp_pap_broken() runs on GT_CT { |
| 1308 | f_init(); |
| 1309 | var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1); |
| 1310 | var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2); |
| 1311 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1312 | ctx.pco_req := valueof(ts_PCO_PAP_IPv4_DNS); |
| 1313 | f_pdp_ctx_act(ctx); |
| 1314 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
| 1315 | /* verify IPCP is at all contained */ |
| 1316 | if (not match(ctx.pco_neg, tr_PCO_Contains('8021'O))) { |
| 1317 | setverdict(fail, "IPCP not found in PCO"); |
| 1318 | } |
| 1319 | /* verify IPCP contains both primary and secondary DNS */ |
| 1320 | var IpcpPacket ipcp := dec_IpcpPacket(f_PCO_extract_proto(ctx.pco_neg, '8021'O)); |
| 1321 | if (not match(ipcp, tr_IPCP_Ack_DNS(0, ggsn_ip4_dns1, ggsn_ip4_dns2))) { |
| 1322 | if (not match(ipcp, tr_IPCP_Ack_DNS(0))) { |
| 1323 | setverdict(fail, "Primary/Secondary DNS PCO IPCP option not found"); |
| 1324 | } else { |
| 1325 | setverdict(fail, "Primary/Secondary DNS PCO IPCP option found but not matching expected values"); |
| 1326 | } |
| 1327 | } |
| 1328 | /* verify that PAP is contained */ |
| 1329 | if (not match(ctx.pco_neg, tr_PCO_Contains('C023'O))) { |
| 1330 | setverdict(fail, "PAP not found in PCO"); |
| 1331 | } |
| 1332 | var PapPacket pap := dec_PapPacket(f_PCO_extract_proto(ctx.pco_neg, 'C023'O)); |
| 1333 | if (not match(pap, tr_PAP_AuthAck)) { |
| 1334 | setverdict(fail, "PAP isn't an AuthenticateAck: ", pap); |
| 1335 | } |
| 1336 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1337 | f_shutdown_helper(); |
Harald Welte | f829854 | 2019-04-10 10:15:28 +0200 | [diff] [blame] | 1338 | } |
| 1339 | |
Harald Welte | 0ef285b | 2017-08-13 20:06:01 +0200 | [diff] [blame] | 1340 | /* Test PDP context activation for dynamic IPv4 EUA with IPv4 DNS in PCO */ |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1341 | testcase TC_pdp4_act_deact_pcodns() runs on GT_CT { |
| 1342 | f_init(); |
Harald Welte | ed09743 | 2017-08-13 13:28:49 +0200 | [diff] [blame] | 1343 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
Harald Welte | dca8005 | 2017-08-13 20:01:38 +0200 | [diff] [blame] | 1344 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1345 | f_pdp_ctx_act(ctx); |
Pau Espin Pedrol | 363ba48 | 2018-01-29 18:42:00 +0100 | [diff] [blame] | 1346 | |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1347 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Pau Espin Pedrol | 363ba48 | 2018-01-29 18:42:00 +0100 | [diff] [blame] | 1348 | /* verify PCO contains both primary and secondary DNS */ |
| 1349 | var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1); |
| 1350 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 1), ggsn_ip4_dns1)) { |
| 1351 | setverdict(fail, "Primary DNS IPv4 PCO option not found"); |
| 1352 | } |
| 1353 | |
| 1354 | var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2); |
| 1355 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 2), ggsn_ip4_dns2)) { |
| 1356 | setverdict(fail, "Secondary DNS IPv4 PCO option not found"); |
| 1357 | } |
| 1358 | |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1359 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1360 | f_shutdown_helper(); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 1361 | } |
| 1362 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1363 | /* Test PDP context activation for dynamic IPv4 EUA. |
| 1364 | Test we can send ICMPv6 ping over GTPU to DNS server. */ |
| 1365 | testcase TC_pdp4_act_deact_gtpu_access() runs on GT_CT { |
| 1366 | f_init(); |
| 1367 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1368 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
| 1369 | f_pdp_ctx_act(ctx); |
| 1370 | |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1371 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1372 | var OCT4 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '000d'O); |
| 1373 | |
| 1374 | /* Check if we can use valid global src addr, should work */ |
| 1375 | var OCT4 saddr := ctx.eua.endUserAddress.endUserAddressIPv4.ipv4_address; |
| 1376 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr, dns1_addr)); |
| 1377 | f_wait_icmp4_echo_reply(ctx); |
| 1378 | |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1379 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1380 | f_shutdown_helper(); |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1381 | } |
| 1382 | |
| 1383 | /* Assert that packets with wrong global src addr are dropped by GGSN */ |
| 1384 | testcase TC_pdp4_act_deact_gtpu_access_wrong_saddr() runs on GT_CT { |
| 1385 | f_init(); |
| 1386 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1387 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
| 1388 | f_pdp_ctx_act(ctx); |
| 1389 | |
| 1390 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
| 1391 | var OCT4 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '000d'O); |
| 1392 | var OCT4 saddr := ctx.eua.endUserAddress.endUserAddressIPv4.ipv4_address; |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1393 | var OCT4 saddr_wrong := substr(saddr, 0, 3) & (saddr[3] xor4b '11'O); |
| 1394 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr_wrong, dns1_addr)); |
| 1395 | f_wait_gtpu_fail(ctx); |
| 1396 | |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1397 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1398 | f_shutdown_helper(); |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1399 | } |
| 1400 | |
| 1401 | /* Send an IPv6 RA to APN4, should fail (packet dropped) */ |
| 1402 | testcase TC_pdp4_act_deact_gtpu_access_ipv6_apn4() runs on GT_CT { |
| 1403 | f_init(); |
| 1404 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1405 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
| 1406 | f_pdp_ctx_act(ctx); |
| 1407 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1408 | /* Send an IPv6 RA to APN4, should fail (packet dropped) */ |
| 1409 | var OCT16 saddr_v6 := f_inet6_addr("fde4:8dba:82e1:2000:1:2:3:4"); |
| 1410 | f_send_gtpu(ctx, f_gen_icmpv6_router_solicitation(saddr_v6)); |
| 1411 | f_wait_gtpu_fail(ctx); |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1412 | |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1413 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1414 | f_shutdown_helper(); |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 1415 | } |
| 1416 | |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1417 | /* Helper function for tests below. */ |
| 1418 | function f_pdp4_clients_interact() runs on GT_CT { |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 1419 | f_init(); |
| 1420 | var PdpContext ctxA := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1421 | var PdpContext ctxB := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1422 | f_pdp_ctx_act(ctxA); |
| 1423 | f_pdp_ctx_act(ctxB); |
| 1424 | var OCT4 addrA := ctxA.eua.endUserAddress.endUserAddressIPv4.ipv4_address; |
| 1425 | var OCT4 addrB := ctxB.eua.endUserAddress.endUserAddressIPv4.ipv4_address; |
| 1426 | f_send_gtpu(ctxA, f_gen_icmpv4_echo(addrA, addrB)); |
| 1427 | f_wait_icmp4_echo_request(ctxB); |
| 1428 | |
| 1429 | f_pdp_ctx_del(ctxA, '1'B); |
Pau Espin Pedrol | bb2bb06 | 2019-09-03 12:28:12 +0200 | [diff] [blame] | 1430 | f_pdp_ctx_del(ctxB, '1'B); |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 1431 | } |
| 1432 | |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1433 | /* Validate if different clients (pdp ctx) can reach one another through GGSN. */ |
| 1434 | testcase TC_pdp4_clients_interact_with_txseq() runs on GT_CT { |
Harald Welte | 3e0b039 | 2018-04-26 09:46:21 +0200 | [diff] [blame] | 1435 | use_gtpu_txseq := true; |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1436 | f_pdp4_clients_interact(); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1437 | f_shutdown_helper(); |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1438 | } |
| 1439 | |
| 1440 | /* Validate if different clients (pdp ctx) can reach one another through GGSN (without Tx sequence number). */ |
| 1441 | testcase TC_pdp4_clients_interact_without_txseq() runs on GT_CT { |
Harald Welte | 3e0b039 | 2018-04-26 09:46:21 +0200 | [diff] [blame] | 1442 | use_gtpu_txseq := false; |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1443 | f_pdp4_clients_interact(); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1444 | f_shutdown_helper(); |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 1445 | } |
| 1446 | |
Harald Welte | dca8005 | 2017-08-13 20:01:38 +0200 | [diff] [blame] | 1447 | testcase TC_echo_req_resp() runs on GT_CT { |
| 1448 | f_init(); |
| 1449 | f_send_gtpc(ts_GTPC_PING(g_peer_c, g_c_seq_nr)); |
| 1450 | T_default.start; |
| 1451 | alt { |
| 1452 | [] GTPC.receive(tr_GTPC_PONG(g_peer_c)) { setverdict(pass); }; |
| 1453 | [] GTPC.receive { repeat; }; |
| 1454 | [] T_default.timeout { setverdict(fail); } |
| 1455 | } |
| 1456 | T_default.stop; |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1457 | f_shutdown_helper(); |
Harald Welte | dca8005 | 2017-08-13 20:01:38 +0200 | [diff] [blame] | 1458 | } |
| 1459 | |
Pau Espin Pedrol | 480e67f | 2022-02-09 16:37:47 +0100 | [diff] [blame] | 1460 | testcase TC_echo_req_resp_gtpu() runs on GT_CT { |
| 1461 | f_init(); |
| 1462 | GTPU.send(ts_GTPU_PING(g_peer_u, g_d_seq_nr)); |
| 1463 | T_default.start; |
| 1464 | alt { |
| 1465 | [] GTPU.receive(tr_GTPU_PONG(g_peer_u)) { setverdict(pass); }; |
| 1466 | [] GTPU.receive { repeat; }; |
| 1467 | [] T_default.timeout { setverdict(fail); } |
| 1468 | } |
| 1469 | T_default.stop; |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1470 | f_shutdown_helper(); |
Pau Espin Pedrol | 480e67f | 2022-02-09 16:37:47 +0100 | [diff] [blame] | 1471 | } |
| 1472 | |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1473 | /* Test if the parser can cope with PCO that only contain either a |
| 1474 | * single primary DNS or a secondary DNS. */ |
| 1475 | testcase TC_pdp4_act_deact_with_single_dns() runs on GT_CT { |
| 1476 | |
| 1477 | /* Note: an unpatched osmo-ggsn version will enter an endless-loop when |
| 1478 | * the test is executed. |
| 1479 | * see also: Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */ |
| 1480 | |
| 1481 | f_init(); |
| 1482 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1483 | var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1); |
| 1484 | var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2); |
| 1485 | var octetstring pco_neg_dns; |
| 1486 | var octetstring pco_neg_dns_expected; |
| 1487 | |
| 1488 | /* PCO with primary DNS only */ |
| 1489 | ctx.pco_req := valueof(ts_PCO_IPv4_PRI_DNS_IPCP); |
| 1490 | f_pdp_ctx_act(ctx); |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1491 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1492 | pco_neg_dns := f_PCO_extract_proto(ctx.pco_neg, '8021'O, 1); |
| 1493 | pco_neg_dns_expected := '0200000A8106'O & ggsn_ip4_dns1 |
| 1494 | /* Note: The prepended hex bytes encode the following information: |
| 1495 | * 0x02 = Configuration ACK |
| 1496 | * 0x00 = Identifier |
| 1497 | * 0x000a = Length |
| 1498 | * 0x81 = Type (Primary DNS Server Address) |
| 1499 | * 0x06 = Length |
| 1500 | * (4 byte IP-Address appended) */ |
| 1501 | if (not match(pco_neg_dns, pco_neg_dns_expected)) { |
| 1502 | setverdict(fail, "Primary DNS IPv4 PCO option not found"); |
| 1503 | } |
| 1504 | f_pdp_ctx_del(ctx, '1'B); |
| 1505 | |
| 1506 | /* PCO with secondary DNS only */ |
Harald Welte | 7ef6d10 | 2021-04-01 21:24:35 +0200 | [diff] [blame] | 1507 | ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1508 | ctx.pco_req := valueof(ts_PCO_IPv4_SEC_DNS_IPCP); |
| 1509 | f_pdp_ctx_act(ctx); |
| 1510 | pco_neg_dns := f_PCO_extract_proto(ctx.pco_neg, '8021'O, 1); |
| 1511 | pco_neg_dns_expected := '0200000A8306'O & ggsn_ip4_dns2 |
| 1512 | if (not match(pco_neg_dns, pco_neg_dns_expected)) { |
| 1513 | setverdict(fail, "Secondary DNS IPv4 PCO option not found"); |
| 1514 | } |
| 1515 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1516 | f_shutdown_helper(); |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1517 | } |
| 1518 | |
| 1519 | /* Test if the parser can cope with PCO that contains primary and secondary DNS in a separate IPCP container. |
| 1520 | * Note: an unpatched osmo-ggsn version will enter an endless-loop when the test is run |
| 1521 | * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288. */ |
| 1522 | testcase TC_pdp4_act_deact_with_separate_dns() runs on GT_CT { |
| 1523 | |
| 1524 | /* Note: an unpatched osmo-ggsn version will enter an endless-loop when |
| 1525 | * the test is executed. |
| 1526 | * see also: Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */ |
| 1527 | |
| 1528 | f_init(); |
| 1529 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1530 | var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1); |
| 1531 | var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2); |
| 1532 | var octetstring pco_neg_dns; |
| 1533 | var octetstring pco_neg_dns_expected; |
| 1534 | |
| 1535 | ctx.pco_req := valueof(ts_PCO_IPv4_SEPARATE_DNS_IPCP); |
| 1536 | f_pdp_ctx_act(ctx); |
| 1537 | |
| 1538 | /* Check if primary DNS is contained */ |
| 1539 | pco_neg_dns := f_PCO_extract_proto(ctx.pco_neg, '8021'O, 1); |
| 1540 | pco_neg_dns_expected := '0200000A8106'O & ggsn_ip4_dns1 |
| 1541 | if (not match(pco_neg_dns, pco_neg_dns_expected)) { |
| 1542 | setverdict(fail, "Primary DNS IPv4 PCO option not found"); |
| 1543 | } |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1544 | |
| 1545 | /* Check if secondary DNS is contained */ |
Stefan Sperling | 8e7a396 | 2018-07-19 19:24:38 +0200 | [diff] [blame] | 1546 | /* This used to fail due to a bug in osmo-ggsn, see OS#3381 */ |
| 1547 | pco_neg_dns := f_PCO_extract_proto(ctx.pco_neg, '8021'O, 2); |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1548 | pco_neg_dns_expected := '0200000A8306'O & ggsn_ip4_dns2 |
| 1549 | if (not match(pco_neg_dns, pco_neg_dns_expected)) { |
| 1550 | setverdict(fail, "Secondary DNS IPv4 PCO option not found"); |
| 1551 | } |
| 1552 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1553 | f_shutdown_helper(); |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 1554 | } |
| 1555 | |
Pau Espin Pedrol | cd326c5 | 2022-02-14 18:57:43 +0100 | [diff] [blame] | 1556 | /* Validate that SUT updates remote TEIC when requested through UpdatePDPContextRequest */ |
| 1557 | testcase TC_pdp4_act_update_teic() runs on GT_CT { |
| 1558 | f_init(); |
| 1559 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1560 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
| 1561 | f_pdp_ctx_act(ctx); |
| 1562 | |
| 1563 | /* UpdatePDPContestRequest changing the local TEIC */ |
| 1564 | var OCT4 new_teic := ctx.teic; |
| 1565 | new_teic[3] := new_teic[3] xor4b '11'O; |
| 1566 | f_pdp_ctx_update(ctx, new_teic := new_teic); |
| 1567 | |
| 1568 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1569 | f_shutdown_helper(); |
Pau Espin Pedrol | cd326c5 | 2022-02-14 18:57:43 +0100 | [diff] [blame] | 1570 | } |
| 1571 | |
| 1572 | /* Validate that SUT updates remote TEID when requested through UpdatePDPContextRequest */ |
| 1573 | testcase TC_pdp4_act_update_teid() runs on GT_CT { |
| 1574 | f_init(); |
| 1575 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1576 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
| 1577 | f_pdp_ctx_act(ctx); |
| 1578 | |
| 1579 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
| 1580 | var OCT4 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '000d'O); |
| 1581 | var OCT4 saddr := ctx.eua.endUserAddress.endUserAddressIPv4.ipv4_address; |
| 1582 | |
| 1583 | /* Data is sent (back) to the local TEID established during CreatePDPContext */ |
| 1584 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr, dns1_addr)); |
| 1585 | f_wait_icmp4_echo_reply(ctx); |
| 1586 | |
| 1587 | /* UpdatePDPContestRequest changing the local TEID */ |
| 1588 | var OCT4 new_teid := ctx.teid; |
| 1589 | new_teid[3] := new_teid[3] xor4b '11'O; |
| 1590 | f_pdp_ctx_update(ctx, new_teid := new_teid); |
| 1591 | |
| 1592 | /* Check if we can send data after updating the PDP context. Answer should be sent to the new TEID */ |
| 1593 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr, dns1_addr)); |
| 1594 | f_wait_icmp4_echo_reply(ctx); |
| 1595 | |
| 1596 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1597 | f_shutdown_helper(); |
Pau Espin Pedrol | cd326c5 | 2022-02-14 18:57:43 +0100 | [diff] [blame] | 1598 | } |
| 1599 | |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1600 | /* Test IPv4v6 context activation for dynamic IPv4v6 EUA without DNS request */ |
| 1601 | testcase TC_pdp46_act_deact() runs on GT_CT { |
| 1602 | f_init(); |
| 1603 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1604 | f_pdp_ctx_act(ctx); |
| 1605 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1606 | f_shutdown_helper(); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1607 | } |
| 1608 | |
| 1609 | /* Test PDP context activation for dynamic IPv4v6 EUA with IPv4 DNS in IPCP */ |
| 1610 | testcase TC_pdp46_act_deact_ipcp() runs on GT_CT { |
| 1611 | f_init(); |
| 1612 | var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1); |
| 1613 | var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2); |
| 1614 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1615 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_IPCP); |
| 1616 | f_pdp_ctx_act(ctx); |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1617 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1618 | /* verify IPCP is at all contained */ |
| 1619 | if (not match(ctx.pco_neg, tr_PCO_Contains('8021'O))) { |
| 1620 | setverdict(fail, "IPCP not found in PCO"); |
| 1621 | } |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1622 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1623 | /* verify IPCP contains both primary and secondary IPv4 DNS */ |
| 1624 | var IpcpPacket ipcp := dec_IpcpPacket(f_PCO_extract_proto(ctx.pco_neg, '8021'O)); |
| 1625 | if (not match(ipcp, tr_IPCP_Ack_DNS(0, ggsn_ip4_dns1, ggsn_ip4_dns2))) { |
| 1626 | if (not match(ipcp, tr_IPCP_Ack_DNS(0))) { |
| 1627 | setverdict(fail, "Primary/Secondary DNS PCO IPCP option not found"); |
| 1628 | } else { |
| 1629 | setverdict(fail, "Primary/Secondary DNS PCO IPCP option found but not matching expected values"); |
| 1630 | } |
| 1631 | } |
| 1632 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1633 | f_shutdown_helper(); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1634 | } |
| 1635 | |
| 1636 | /* Test PDP context activation for dynamic IPv4v6 EUA with IPv6 DNS in PCO and router solicitation/advertisement */ |
| 1637 | testcase TC_pdp46_act_deact_icmp6() runs on GT_CT { |
| 1638 | f_init(); |
| 1639 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1640 | ctx.pco_req := valueof(ts_PCO_IPv6_DNS); |
| 1641 | f_pdp_ctx_act(ctx); |
| 1642 | |
| 1643 | f_send_gtpu(ctx, f_icmpv6_rs_for_pdp46(ctx)); |
| 1644 | f_wait_rtr_adv(ctx); |
| 1645 | f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp46(ctx)); |
| 1646 | |
| 1647 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1648 | f_shutdown_helper(); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1649 | } |
| 1650 | |
| 1651 | /* Test IPv4v6 context activation for dynamic IPv4v6 EUA with request of IPv4 DNS in PCO */ |
| 1652 | testcase TC_pdp46_act_deact_pcodns4() runs on GT_CT { |
| 1653 | f_init(); |
| 1654 | |
| 1655 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1656 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
| 1657 | f_pdp_ctx_act(ctx); |
| 1658 | |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1659 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1660 | /* verify PCO contains both primary and secondary IPv4 DNS */ |
| 1661 | var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1); |
| 1662 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 1), ggsn_ip4_dns1)) { |
| 1663 | setverdict(fail, "Primary DNS IPv4 PCO option not found"); |
| 1664 | } |
| 1665 | |
| 1666 | var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2); |
| 1667 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 2), ggsn_ip4_dns2)) { |
| 1668 | setverdict(fail, "Secondary DNS IPv4 PCO option not found"); |
| 1669 | } |
| 1670 | |
| 1671 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1672 | f_shutdown_helper(); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1673 | } |
| 1674 | |
| 1675 | /* Test IPv4v6 context activation for dynamic IPv4v6 EUA with request of IPv6 DNS in PCO */ |
| 1676 | testcase TC_pdp46_act_deact_pcodns6() runs on GT_CT { |
| 1677 | f_init(); |
| 1678 | |
| 1679 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1680 | ctx.pco_req := valueof(ts_PCO_IPv6_DNS); |
| 1681 | f_pdp_ctx_act(ctx); |
| 1682 | |
Harald Welte | 79737b4 | 2019-04-10 10:39:30 +0200 | [diff] [blame] | 1683 | f_PCO_ensure_no_duplicates(ctx.pco_neg); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1684 | /* verify PCO contains both primary and secondary IPv6 DNS */ |
| 1685 | var OCT4 ggsn_ip6_dns1 := f_inet6_addr(m_ggsn_ip6_dns1); |
| 1686 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 1), ggsn_ip6_dns1)) { |
| 1687 | setverdict(fail, "Primary DNS IPv6 PCO option not found"); |
| 1688 | } |
| 1689 | |
| 1690 | var OCT4 ggsn_ip6_dns2 := f_inet6_addr(m_ggsn_ip6_dns2); |
| 1691 | if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 2), ggsn_ip6_dns2)) { |
| 1692 | setverdict(fail, "Secondary DNS IPv6 PCO option not found"); |
| 1693 | } |
| 1694 | |
| 1695 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1696 | f_shutdown_helper(); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1697 | } |
| 1698 | |
| 1699 | /* Test PDP context activation for dynamic IPv4v6 EUA. |
| 1700 | Test we can send ICMPv6 ping over GTPU to DNS server. */ |
| 1701 | testcase TC_pdp46_act_deact_gtpu_access() runs on GT_CT { |
| 1702 | f_init(); |
| 1703 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1704 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
| 1705 | f_pdp_ctx_act(ctx); |
| 1706 | |
| 1707 | var OCT4 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '000d'O); |
| 1708 | |
| 1709 | /* Check if we can use valid global src addr, should work */ |
| 1710 | var OCT4 saddr := ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv4_address; |
| 1711 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr, dns1_addr)); |
| 1712 | f_wait_icmp4_echo_reply(ctx); |
| 1713 | |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1714 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1715 | f_shutdown_helper(); |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1716 | } |
| 1717 | |
| 1718 | /* Assert that packets with wrong ipv4 src addr are dropped by GGSN on APN IPv4v6 */ |
| 1719 | testcase TC_pdp46_act_deact_gtpu_access_wrong_saddr_ipv4() runs on GT_CT { |
| 1720 | f_init(); |
| 1721 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1722 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
| 1723 | f_pdp_ctx_act(ctx); |
| 1724 | |
| 1725 | var OCT4 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '000d'O); |
| 1726 | var OCT4 saddr := ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv4_address; |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1727 | var OCT4 saddr_wrong := substr(saddr, 0, 3) & (saddr[3] xor4b '11'O); |
| 1728 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr_wrong, dns1_addr)); |
| 1729 | f_wait_gtpu_fail(ctx); |
| 1730 | |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1731 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1732 | f_shutdown_helper(); |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1733 | } |
| 1734 | |
Pau Espin Pedrol | c6ac695 | 2022-02-14 11:19:23 +0100 | [diff] [blame] | 1735 | /* Check that attempting RA with another ll src addr won't work, packet dropped: */ |
| 1736 | testcase TC_pdp46_act_deact_gtpu_access_wrong_ll_saddr_ipv6() runs on GT_CT { |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1737 | f_init(); |
| 1738 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1739 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
| 1740 | f_pdp_ctx_act(ctx); |
| 1741 | |
Pau Espin Pedrol | c6ac695 | 2022-02-14 11:19:23 +0100 | [diff] [blame] | 1742 | var OCT16 saddr_ll := f_ipv6_link_local(ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address); |
| 1743 | var OCT16 saddr_ll_wrong := f_ipv6_mangle(saddr_ll, 8); |
| 1744 | f_send_gtpu(ctx, f_gen_icmpv6_router_solicitation(saddr_ll_wrong)); |
| 1745 | f_wait_gtpu_fail(ctx); |
| 1746 | |
| 1747 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1748 | f_shutdown_helper(); |
Pau Espin Pedrol | c6ac695 | 2022-02-14 11:19:23 +0100 | [diff] [blame] | 1749 | } |
| 1750 | |
| 1751 | /* Assert that packets with wrong ipv6 global src addr are dropped by GGSN on APN IPv4v6 */ |
| 1752 | testcase TC_pdp46_act_deact_gtpu_access_wrong_global_saddr_ipv6() runs on GT_CT { |
| 1753 | f_init(); |
| 1754 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1755 | ctx.pco_req := valueof(ts_PCO_IPv6_DNS); |
| 1756 | f_pdp_ctx_act(ctx); |
| 1757 | |
| 1758 | f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx)); |
| 1759 | f_wait_rtr_adv(ctx); |
| 1760 | f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx)); |
| 1761 | |
| 1762 | var OCT16 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '0003'O); |
| 1763 | var OCT16 saddr_glob := f_ipv6_global(ctx.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address); |
| 1764 | var OCT16 saddr_wrong := f_ipv6_mangle(saddr_glob); |
| 1765 | f_send_gtpu(ctx, f_gen_icmpv6_echo(saddr_wrong, dns1_addr)); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1766 | f_wait_gtpu_fail(ctx); |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 1767 | |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1768 | f_pdp_ctx_del(ctx, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1769 | f_shutdown_helper(); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1770 | } |
| 1771 | |
| 1772 | /* Validate if different clients (pdp ctx) can reach one another through GGSN. */ |
| 1773 | testcase TC_pdp46_clients_interact() runs on GT_CT { |
| 1774 | f_init(); |
| 1775 | var PdpContext ctxA := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1776 | var PdpContext ctxB := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet46, valueof(t_EuaIPv4Dynv6Dyn))); |
| 1777 | f_pdp_ctx_act(ctxA); |
| 1778 | f_send_gtpu(ctxA, f_icmpv6_rs_for_pdp46(ctxA)); |
| 1779 | f_wait_rtr_adv(ctxA); |
| 1780 | f_send_gtpu(ctxA, f_gen_icmpv6_neigh_solicit_for_pdp46(ctxA)); |
| 1781 | |
| 1782 | f_pdp_ctx_act(ctxB); |
| 1783 | f_send_gtpu(ctxB, f_icmpv6_rs_for_pdp46(ctxB)); |
| 1784 | f_wait_rtr_adv(ctxB); |
| 1785 | f_send_gtpu(ctxB, f_gen_icmpv6_neigh_solicit_for_pdp46(ctxB)); |
| 1786 | |
| 1787 | var OCT16 addrA_ll := f_ipv6_link_local(ctxA.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address); |
| 1788 | var OCT16 addrB_ll := f_ipv6_link_local(ctxB.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address); |
| 1789 | var OCT16 addrA_glob := f_ipv6_global(ctxA.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address); |
| 1790 | var OCT16 addrB_glob := f_ipv6_global(ctxB.eua.endUserAddress.endUserAddressIPv4andIPv6.ipv6_address); |
| 1791 | |
| 1792 | /* Validate if clients can interact using ll addr. */ |
| 1793 | f_send_gtpu(ctxA, f_gen_icmpv6_echo(addrA_ll, addrB_ll)); |
| 1794 | f_wait_gtpu_fail(ctxB); |
| 1795 | |
| 1796 | /* Validate if clients can interact using global addr. */ |
| 1797 | f_send_gtpu(ctxA, f_gen_icmpv6_echo(addrA_glob, addrB_glob)); |
| 1798 | f_wait_gtpu_fail(ctxB); |
| 1799 | |
| 1800 | f_pdp_ctx_del(ctxA, '1'B); |
Pau Espin Pedrol | bb2bb06 | 2019-09-03 12:28:12 +0200 | [diff] [blame] | 1801 | f_pdp_ctx_del(ctxB, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1802 | f_shutdown_helper(); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 1803 | } |
| 1804 | |
Pau Espin Pedrol | 22d597f | 2019-08-21 16:16:58 +0200 | [diff] [blame] | 1805 | /* Test IPv4v6 context activation for dynamic IPv4v6 EUA on a v4-only APN */ |
| 1806 | testcase TC_pdp46_act_deact_apn4() runs on GT_CT { |
Pau Espin Pedrol | 0f464d6 | 2022-02-23 14:04:29 +0100 | [diff] [blame] | 1807 | const OCT1 cause_accept := '80'O; /* Normal accept cause */ |
| 1808 | const OCT1 cause_new_pdp_type := '81'O; /* Cause: New PDP type due to network preference */ |
| 1809 | const OCT1 cause_unknown_pdp := 'DC'O; /* Cause: Unknown PDP address or PDP type */ |
| 1810 | var CreatePDPContextResponse cpr; |
| 1811 | |
Pau Espin Pedrol | 22d597f | 2019-08-21 16:16:58 +0200 | [diff] [blame] | 1812 | f_init(); |
Pau Espin Pedrol | 22d597f | 2019-08-21 16:16:58 +0200 | [diff] [blame] | 1813 | var PdpContext ctx46 := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dynv6Dyn))); |
Pau Espin Pedrol | 0f464d6 | 2022-02-23 14:04:29 +0100 | [diff] [blame] | 1814 | cpr := f_pdp_ctx_act(ctx46, (cause_unknown_pdp, cause_new_pdp_type)); |
Pau Espin Pedrol | 22d597f | 2019-08-21 16:16:58 +0200 | [diff] [blame] | 1815 | |
Pau Espin Pedrol | 0f464d6 | 2022-02-23 14:04:29 +0100 | [diff] [blame] | 1816 | if (cpr.cause.causevalue == cause_new_pdp_type) { |
| 1817 | /* 3GPP TS 23.060 sec 9.2.1: "If the MS requests PDP type IPv4v6, |
| 1818 | * but the operator preferences dictate the use of a single IP |
| 1819 | * version only, the PDP type shall be changed to a single address |
| 1820 | * PDP type (IPv4 or IPv6) and a reason cause shall be returned to |
| 1821 | * the MS indicating that only the assigned PDP type is allowed. In |
| 1822 | * this case, the MS shall not request another PDP context for the |
| 1823 | * other PDP type during the existence of the PDP context." */ |
| 1824 | f_pdp_ctx_del(ctx46, '1'B); |
| 1825 | } else { |
| 1826 | /* 3GPP TS 23.060 sec 9.2.1 NOTE 5: If the MS requests PDP type |
| 1827 | * IPv4v6, and the PDP context is rejected due to "unknown PDP |
| 1828 | * type", the MS can attempt to establish dual-stack connectivity |
| 1829 | * by performing two PDP context request procedures to activate an |
| 1830 | * IPv4 PDP context and an IPv6 PDP context, both to the same APN. A |
| 1831 | * typical MS first attempts v4v6, and if rejected, then tries v4 |
| 1832 | * and v6 separetly */ |
| 1833 | var PdpContext ctx4 := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1834 | f_pdp_ctx_act(ctx4, cause_accept); /* Normal accept cause */ |
Pau Espin Pedrol | 22d597f | 2019-08-21 16:16:58 +0200 | [diff] [blame] | 1835 | |
Pau Espin Pedrol | 0f464d6 | 2022-02-23 14:04:29 +0100 | [diff] [blame] | 1836 | var PdpContext ctx6 := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv6Dyn))); |
| 1837 | f_pdp_ctx_act(ctx6, cause_unknown_pdp); /* Cause: Unknown PDP address or PDP type */ |
Pau Espin Pedrol | 22d597f | 2019-08-21 16:16:58 +0200 | [diff] [blame] | 1838 | |
Pau Espin Pedrol | 0f464d6 | 2022-02-23 14:04:29 +0100 | [diff] [blame] | 1839 | f_pdp_ctx_del(ctx4, '1'B); |
| 1840 | } |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1841 | f_shutdown_helper(); |
Pau Espin Pedrol | 22d597f | 2019-08-21 16:16:58 +0200 | [diff] [blame] | 1842 | } |
| 1843 | |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 1844 | /* Validate if 2nd CtxCreateReq with increased Recovery IE causes ggsn to drop 1st one (while keeping 2nd one). */ |
| 1845 | testcase TC_pdp_act2_recovery() runs on GT_CT { |
| 1846 | var Gtp1cUnitdata ud; |
| 1847 | var default d; |
| 1848 | var boolean ctxA_deleted := false; |
| 1849 | var boolean ctxB_created := false; |
| 1850 | |
| 1851 | f_init(); |
| 1852 | var PdpContext ctxA := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1853 | var PdpContext ctxB := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1854 | f_pdp_ctx_act(ctxA); |
| 1855 | |
Vadim Yanitskiy | d344b4a | 2022-02-09 18:28:18 +0600 | [diff] [blame] | 1856 | g_restart_ctr := int2oct((oct2int(g_restart_ctr) + 1) mod 256, 1); |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 1857 | |
| 1858 | log("sending 2nd CreatePDP (recovery increased)"); |
| 1859 | f_send_gtpc(ts_GTPC_CreatePDP(g_peer_c, g_c_seq_nr, ctxB.imsi, g_restart_ctr, |
| 1860 | ctxB.teid, ctxB.teic, ctxB.nsapi, ctxB.eua, ctxB.apn, |
| 1861 | g_sgsn_ip_c, g_sgsn_ip_u, ctxB.msisdn, ctxB.pco_req)); |
| 1862 | T_default.start; |
| 1863 | d := activate(pingpong()); |
| 1864 | alt { |
| 1865 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, createPDPContextResponse, ctxB.teic)) -> value ud { |
| 1866 | f_handle_create_req(ctxB, ud); |
| 1867 | if (not ctxB_created) { |
| 1868 | ctxB_created := true; |
| 1869 | setverdict(pass); |
| 1870 | } else { |
| 1871 | setverdict(fail, "Repeated createPDPContextResponse(ctxB)"); |
| 1872 | } |
| 1873 | |
| 1874 | if (not ctxA_deleted) { |
| 1875 | repeat; |
| 1876 | } |
| 1877 | } |
| 1878 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextRequest, ctxA.teic)) -> value ud { |
| 1879 | if (ispresent(ud.gtpc.gtpc_pdu.deletePDPContextRequest.tearDownIndicator)) { |
| 1880 | setverdict(pass); |
| 1881 | } else { |
| 1882 | setverdict(fail); |
| 1883 | } |
| 1884 | |
| 1885 | if (not ctxA_deleted) { |
| 1886 | ctxA_deleted := true; |
| 1887 | setverdict(pass); |
| 1888 | } else { |
| 1889 | setverdict(fail, "Repeated deletePDPContextRequest(ctxA)"); |
| 1890 | } |
| 1891 | |
| 1892 | if (not ctxB_created) { |
| 1893 | repeat; |
| 1894 | } |
| 1895 | } |
| 1896 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextRequest, ctxB.teic)) -> value ud { |
| 1897 | setverdict(fail, "GGSN dropping still valid pdp ctx"); |
| 1898 | } |
| 1899 | } |
| 1900 | deactivate(d); |
| 1901 | T_default.stop; |
| 1902 | |
| 1903 | f_pdp_ctx_del(ctxB, '1'B); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1904 | f_shutdown_helper(); |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 1905 | } |
| 1906 | |
| 1907 | |
Pau Espin Pedrol | 9a5f42f | 2019-05-27 20:04:35 +0200 | [diff] [blame] | 1908 | /* Send a duplicate echo req. osmo-ggsn maintains a queue for sent |
| 1909 | responses (60 seconds): If same delete req is sent and duplicate is |
| 1910 | detected, saved duplicate response should be sent back. */ |
| 1911 | testcase TC_act_deact_retrans_duplicate() runs on GT_CT { |
| 1912 | f_init(); |
| 1913 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1914 | f_pdp_ctx_act(ctx); |
| 1915 | f_pdp_ctx_del(ctx, '1'B); |
| 1916 | /* leave some time in between to make sure retransmit response queue keeps packets for a while */ |
| 1917 | f_sleep(1.0); |
| 1918 | /* g_c_seq_nr was increased during f_pdp_ctx_del(), we want a |
| 1919 | duplicate. If it was not a duplicate, osmo-ggsn would answer |
| 1920 | with a failure since that PDP ctx was already deleted. */ |
| 1921 | g_c_seq_nr := g_c_seq_nr - 1; |
Pau Espin Pedrol | 10ec96e | 2022-02-09 17:03:15 +0100 | [diff] [blame] | 1922 | f_pdp_ctx_del(ctx, '1'B, expect_diameter := false); |
Pau Espin Pedrol | 9a5f42f | 2019-05-27 20:04:35 +0200 | [diff] [blame] | 1923 | |
| 1924 | /* Now send a new pdp ctx del (increased seqnum). It should fail with cause "non-existent": */ |
| 1925 | var OCT1 cause_nonexistent := 'C0'O; |
Pau Espin Pedrol | 10ec96e | 2022-02-09 17:03:15 +0100 | [diff] [blame] | 1926 | f_pdp_ctx_del(ctx, '1'B, cause_nonexistent, expect_diameter := false); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1927 | f_shutdown_helper(); |
Pau Espin Pedrol | 9a5f42f | 2019-05-27 20:04:35 +0200 | [diff] [blame] | 1928 | } |
| 1929 | |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 1930 | /* Activate PDP context + trigger Recovery procedure through EchoResp */ |
| 1931 | testcase TC_pdp_act_restart_ctr_echo() runs on GT_CT { |
| 1932 | var Gtp1cUnitdata ud; |
Pau Espin Pedrol | 0511802 | 2022-02-17 19:49:13 +0100 | [diff] [blame] | 1933 | g_use_echo_intval := 5; |
| 1934 | timer T_echo; |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 1935 | f_init(); |
| 1936 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1937 | f_pdp_ctx_act(ctx); |
| 1938 | |
| 1939 | /* Wait to receive echo request and send initial Restart counter */ |
Pau Espin Pedrol | 0511802 | 2022-02-17 19:49:13 +0100 | [diff] [blame] | 1940 | T_echo.start(int2float(g_use_echo_intval) + 1.0); |
| 1941 | alt { |
| 1942 | [] GTPC.receive(tr_GTPC_PING(?)) -> value ud { |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 1943 | var uint16_t seq := oct2int(ud.gtpc.opt_part.sequenceNumber); |
| 1944 | GTPC.send(ts_GTPC_PONG(ud.peer, seq, g_restart_ctr)); |
Pau Espin Pedrol | 0511802 | 2022-02-17 19:49:13 +0100 | [diff] [blame] | 1945 | } |
| 1946 | [] T_echo.timeout { |
| 1947 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 1948 | "Timeout waiting for ping"); |
| 1949 | } |
| 1950 | } |
| 1951 | T_echo.stop; |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 1952 | |
| 1953 | /* Wait to receive second echo request and send incremented Restart |
| 1954 | counter. This will fake a restarted SGSN, and pdp ctx allocated |
| 1955 | should be released by GGSN */ |
Vadim Yanitskiy | d344b4a | 2022-02-09 18:28:18 +0600 | [diff] [blame] | 1956 | g_restart_ctr := int2oct((oct2int(g_restart_ctr) + 1) mod 256, 1); |
Pau Espin Pedrol | 0511802 | 2022-02-17 19:49:13 +0100 | [diff] [blame] | 1957 | T_echo.start(int2float(g_use_echo_intval) + 1.0); |
| 1958 | alt { |
| 1959 | [] GTPC.receive(tr_GTPC_PING(?)) -> value ud { |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 1960 | var uint16_t seq := oct2int(ud.gtpc.opt_part.sequenceNumber); |
| 1961 | GTPC.send(ts_GTPC_PONG(ud.peer, seq, g_restart_ctr)); |
Pau Espin Pedrol | 0511802 | 2022-02-17 19:49:13 +0100 | [diff] [blame] | 1962 | } |
| 1963 | [] T_echo.timeout { |
| 1964 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 1965 | "Timeout waiting for ping"); |
| 1966 | } |
| 1967 | } |
| 1968 | T_echo.stop; |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 1969 | f_pdp_ctx_exp_del_req(ctx, omit, true); |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 1970 | f_shutdown_helper(); |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 1971 | } |
| 1972 | |
Pau Espin Pedrol | 68c2af5 | 2022-02-25 11:56:17 +0100 | [diff] [blame] | 1973 | /* Test creation, user plane and deletion of big amount (1000) of concurrent PDP context */ |
| 1974 | testcase TC_lots_of_concurrent_pdp_ctx() runs on GT_CT { |
| 1975 | var Gtp1cUnitdata udc; |
| 1976 | var Gtp1uUnitdata udu; |
| 1977 | const integer num_ctx := 1000; |
| 1978 | var PdpContext ctx[num_ctx]; |
| 1979 | timer T_next := 0.01; |
| 1980 | var integer next_req_ctx := 0; |
| 1981 | var integer rx_resp_ctx := 0; |
| 1982 | var integer rx_pong := 0; |
| 1983 | var OCT4 dns1_addr; |
| 1984 | var OCT4 saddr; |
| 1985 | var integer teic; |
| 1986 | var integer idx; |
| 1987 | |
| 1988 | f_init(); |
| 1989 | |
| 1990 | for (var integer i := 0; i < num_ctx; i := i + 1) { |
| 1991 | ctx[i] := valueof(t_DefinePDP(f_rnd_imsi('26242'H), f_rnd_msisdn('1234'O), c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 1992 | ctx[i].teic := int2oct(i+1, 4); /* +1: skip TEIC=0 */ |
| 1993 | ctx[i].teid := int2oct(i+1, 4); /* +1: skip TEID=0 */ |
| 1994 | ctx[i].pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
| 1995 | } |
| 1996 | |
| 1997 | T_default.start(60.0); |
| 1998 | |
| 1999 | T_next.start; |
| 2000 | alt { |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 2001 | [Gx_PROC.checkstate("Connected")] as_DIA_Gx_CCR(INITIAL_REQUEST) { repeat; } |
| 2002 | [Gy_PROC.checkstate("Connected")] as_DIA_Gy_CCR(INITIAL_REQUEST) { repeat; } |
Pau Espin Pedrol | 68c2af5 | 2022-02-25 11:56:17 +0100 | [diff] [blame] | 2003 | [] pingpong(); |
| 2004 | [] T_next.timeout { |
| 2005 | f_send_gtpc(ts_GTPC_CreatePDP(g_peer_c, g_c_seq_nr, ctx[next_req_ctx].imsi, g_restart_ctr, |
| 2006 | ctx[next_req_ctx].teid, ctx[next_req_ctx].teic, ctx[next_req_ctx].nsapi, |
| 2007 | ctx[next_req_ctx].eua, ctx[next_req_ctx].apn, g_sgsn_ip_c, g_sgsn_ip_u, |
| 2008 | ctx[next_req_ctx].msisdn, ctx[next_req_ctx].pco_req, ctx[next_req_ctx].ratType, |
| 2009 | ctx[next_req_ctx].uli)); |
| 2010 | next_req_ctx := next_req_ctx + 1; |
| 2011 | if (next_req_ctx < num_ctx) { |
| 2012 | T_next.start; |
| 2013 | } |
| 2014 | repeat; |
| 2015 | } |
| 2016 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, createPDPContextResponse, ?)) -> value udc { |
| 2017 | teic := oct2int(udc.gtpc.teid); |
| 2018 | if (not match(teic, (1 .. num_ctx))) { |
| 2019 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2020 | "Rx Unexpected TEIC"); |
| 2021 | } |
| 2022 | idx := teic - 1; |
| 2023 | f_handle_create_req(ctx[idx], udc); |
| 2024 | rx_resp_ctx := rx_resp_ctx + 1; |
| 2025 | |
| 2026 | dns1_addr := f_PCO_extract_proto(ctx[idx].pco_neg, '000d'O); |
| 2027 | saddr := ctx[idx].eua.endUserAddress.endUserAddressIPv4.ipv4_address; |
| 2028 | f_send_gtpu(ctx[idx], f_gen_icmpv4_echo(saddr, dns1_addr)); |
| 2029 | repeat; |
| 2030 | } |
| 2031 | [] GTPU.receive(tr_GTPU_GPDU(g_peer_u, ?)) -> value udu { |
| 2032 | var octetstring gpdu := udu.gtpu.gtpu_IEs.g_PDU_IEs.data; |
| 2033 | var IPv4_packet ip4 := f_IPv4_dec(gpdu); |
| 2034 | if (ip4.header.ver != 4) { |
| 2035 | repeat; |
| 2036 | } |
| 2037 | var PDU_ICMP icmp4 := f_dec_PDU_ICMP(ip4.payload); |
| 2038 | if (not match(icmp4, (tr_ICMPv4_ERP, tr_ICMPv4_DU))) { |
| 2039 | repeat; |
| 2040 | } |
| 2041 | rx_pong := rx_pong + 1; |
| 2042 | if (rx_pong < num_ctx) { |
| 2043 | repeat; |
| 2044 | } |
| 2045 | setverdict(pass); |
| 2046 | } |
| 2047 | [] GTPC.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPC"); } |
| 2048 | [] GTPU.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPU"); } |
| 2049 | } |
| 2050 | |
| 2051 | /* Let's close them now: */ |
| 2052 | next_req_ctx := 0; |
| 2053 | rx_resp_ctx := 0; |
| 2054 | T_next.start; |
| 2055 | alt { |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 2056 | [Gx_PROC.checkstate("Connected")] as_DIA_Gx_CCR(TERMINATION_REQUEST) { repeat; } |
| 2057 | [Gy_PROC.checkstate("Connected")] as_DIA_Gy_CCR(TERMINATION_REQUEST) { repeat; } |
Pau Espin Pedrol | 68c2af5 | 2022-02-25 11:56:17 +0100 | [diff] [blame] | 2058 | [] pingpong(); |
| 2059 | [] T_next.timeout { |
| 2060 | f_send_gtpc(ts_GTPC_DeletePDP(g_peer_c, g_c_seq_nr, ctx[next_req_ctx].teic_remote, ctx[next_req_ctx].nsapi, '1'B)); |
| 2061 | next_req_ctx := next_req_ctx + 1; |
| 2062 | if (next_req_ctx < num_ctx) { |
| 2063 | T_next.start; |
| 2064 | } |
| 2065 | repeat; |
| 2066 | } |
| 2067 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextResponse, ?)) -> value udc { |
| 2068 | teic := oct2int(udc.gtpc.teid); |
| 2069 | if (not match(teic, (1 .. num_ctx))) { |
| 2070 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2071 | "Rx Unexpected TEIC"); |
| 2072 | } |
| 2073 | rx_resp_ctx := rx_resp_ctx + 1; |
| 2074 | if (rx_resp_ctx < num_ctx) { |
| 2075 | repeat; |
| 2076 | } |
| 2077 | setverdict(pass); |
| 2078 | } |
| 2079 | [] GTPC.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPC"); } |
| 2080 | [] GTPU.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPU"); } |
| 2081 | } |
| 2082 | T_next.stop; |
| 2083 | |
| 2084 | T_default.stop; |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 2085 | f_shutdown_helper(); |
Pau Espin Pedrol | 68c2af5 | 2022-02-25 11:56:17 +0100 | [diff] [blame] | 2086 | } |
| 2087 | |
Pau Espin Pedrol | bfea835 | 2022-02-28 12:11:26 +0100 | [diff] [blame] | 2088 | /* Test callocation of PDP contexts until reaching addr pool exhaustion */ |
| 2089 | type record of OCT4 TEIClist; |
| 2090 | testcase TC_addr_pool_exhaustion() runs on GT_CT { |
| 2091 | var Gtp1cUnitdata udc; |
| 2092 | var Gtp1uUnitdata udu; |
| 2093 | var PdpContext ctx; |
| 2094 | timer T_next := 0.005; |
| 2095 | var integer next_req_ctx := 0; |
| 2096 | var integer rx_resp_ctx := 0; |
| 2097 | var integer num_ctx; |
| 2098 | var boolean cont_req := true; |
| 2099 | var CreatePDPContextResponse cpr; |
| 2100 | var TEIClist teic_list := {}; |
| 2101 | var integer teic; |
| 2102 | |
| 2103 | f_init(); |
| 2104 | |
| 2105 | T_default.start(120.0); |
| 2106 | |
| 2107 | T_next.start; |
| 2108 | alt { |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 2109 | [Gx_PROC.checkstate("Connected")] as_DIA_Gx_CCR(INITIAL_REQUEST) { repeat; } |
| 2110 | [Gy_PROC.checkstate("Connected")] as_DIA_Gy_CCR(INITIAL_REQUEST) { repeat; } |
Pau Espin Pedrol | bfea835 | 2022-02-28 12:11:26 +0100 | [diff] [blame] | 2111 | [] pingpong(); |
| 2112 | [] T_next.timeout { |
| 2113 | if (cont_req) { |
| 2114 | if (next_req_ctx - rx_resp_ctx < 100) { /* if we have too many in progress, wait a bit to continue */ |
| 2115 | ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), f_rnd_msisdn('1234'O), c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
| 2116 | ctx.nsapi := '0001'B; |
| 2117 | ctx.teic := int2oct(next_req_ctx+1, 4); /* +1: skip TEIC=0 */ |
| 2118 | ctx.teid := int2oct(next_req_ctx+1, 4); /* +1: skip TEID=0 */ |
| 2119 | f_send_gtpc(ts_GTPC_CreatePDP(g_peer_c, g_c_seq_nr, ctx.imsi, g_restart_ctr, |
| 2120 | ctx.teid, ctx.teic, ctx.nsapi, |
| 2121 | ctx.eua, ctx.apn, g_sgsn_ip_c, g_sgsn_ip_u, |
| 2122 | ctx.msisdn, ctx.pco_req, ctx.ratType, |
| 2123 | ctx.uli)); |
| 2124 | next_req_ctx := next_req_ctx + 1; |
| 2125 | } |
| 2126 | T_next.start; |
| 2127 | } |
| 2128 | repeat; |
| 2129 | } |
| 2130 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, createPDPContextResponse, ?)) -> value udc { |
| 2131 | cpr := udc.gtpc.gtpc_pdu.createPDPContextResponse; |
| 2132 | |
| 2133 | if (cpr.cause.causevalue == '80'O) { |
| 2134 | teic_list := teic_list & {cpr.teidControlPlane.teidControlPlane}; |
| 2135 | } else { |
| 2136 | if (cont_req == true) { |
| 2137 | num_ctx := rx_resp_ctx; |
| 2138 | log("Successfully created ", num_ctx, " PDP contexts before exhausting the pool"); |
| 2139 | setverdict(pass); |
| 2140 | } |
| 2141 | cont_req := false; |
| 2142 | } |
| 2143 | rx_resp_ctx := rx_resp_ctx + 1; |
| 2144 | if (not cont_req and next_req_ctx == rx_resp_ctx) { |
| 2145 | break; |
| 2146 | } else { |
| 2147 | repeat; |
| 2148 | } |
| 2149 | } |
| 2150 | [] GTPC.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPC"); } |
| 2151 | [] GTPU.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPU"); } |
| 2152 | } |
| 2153 | |
| 2154 | /* Let's close them now: */ |
| 2155 | next_req_ctx := 0; |
| 2156 | rx_resp_ctx := 0; |
| 2157 | T_next.start; |
| 2158 | alt { |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 2159 | [Gx_PROC.checkstate("Connected")] as_DIA_Gx_CCR(TERMINATION_REQUEST) { repeat; } |
Pau Espin Pedrol | cb1e827 | 2022-04-20 14:43:43 +0200 | [diff] [blame] | 2160 | [Gy_PROC.checkstate("Connected")] as_DIA_Gy_CCR(TERMINATION_REQUEST) { repeat; } |
Pau Espin Pedrol | bfea835 | 2022-02-28 12:11:26 +0100 | [diff] [blame] | 2161 | [] pingpong(); |
| 2162 | [] T_next.timeout { |
| 2163 | f_send_gtpc(ts_GTPC_DeletePDP(g_peer_c, g_c_seq_nr, teic_list[next_req_ctx], '0001'B, '1'B)); |
| 2164 | next_req_ctx := next_req_ctx + 1; |
| 2165 | if (next_req_ctx < num_ctx) { |
| 2166 | T_next.start; |
| 2167 | } |
| 2168 | repeat; |
| 2169 | } |
| 2170 | [] GTPC.receive(tr_GTPC_MsgType(g_peer_c, deletePDPContextResponse, ?)) -> value udc { |
| 2171 | teic := oct2int(udc.gtpc.teid); |
| 2172 | if (not match(teic, (1 .. num_ctx))) { |
| 2173 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2174 | "Rx Unexpected TEIC"); |
| 2175 | } |
| 2176 | rx_resp_ctx := rx_resp_ctx + 1; |
| 2177 | if (rx_resp_ctx < num_ctx) { |
| 2178 | repeat; |
| 2179 | } |
| 2180 | setverdict(pass); |
| 2181 | } |
| 2182 | [] GTPC.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPC"); } |
| 2183 | [] GTPU.receive { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx Unexpected GTPU"); } |
| 2184 | } |
| 2185 | T_next.stop; |
| 2186 | |
| 2187 | T_default.stop; |
Pau Espin Pedrol | c441ce0 | 2022-03-07 14:35:45 +0100 | [diff] [blame] | 2188 | f_shutdown_helper(); |
Pau Espin Pedrol | bfea835 | 2022-02-28 12:11:26 +0100 | [diff] [blame] | 2189 | } |
| 2190 | |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 2191 | /* Test charging over Gy interface. */ |
| 2192 | testcase TC_gy_charging_cc_time() runs on GT_CT { |
| 2193 | var default d; |
| 2194 | |
| 2195 | g_gy_validity_time := 3; /* Grant access for 3 seconds, needs to be re-validated afterwards */ |
| 2196 | f_init(); |
Pau Espin Pedrol | 2fe8895 | 2022-05-03 14:56:15 +0200 | [diff] [blame^] | 2197 | var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234567890'O, c_ApnInternet, valueof(t_EuaIPv4Dyn))); |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 2198 | ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT); |
| 2199 | f_pdp_ctx_act(ctx); |
| 2200 | |
| 2201 | var OCT4 dns1_addr := f_PCO_extract_proto(ctx.pco_neg, '000d'O); |
| 2202 | |
| 2203 | /* Send some UL traffic: */ |
| 2204 | var OCT4 saddr := ctx.eua.endUserAddress.endUserAddressIPv4.ipv4_address; |
| 2205 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr, dns1_addr)); |
| 2206 | f_wait_icmp4_echo_reply(ctx); |
| 2207 | |
| 2208 | T_default.start(10.0); |
| 2209 | d := activate(pingpong()); |
| 2210 | |
| 2211 | g_gy_validity_time := 2; |
| 2212 | /* First update reports octests/pkt on both UL/DL (see icmp ping-pong above) */ |
| 2213 | as_DIA_Gy_CCR(UPDATE_REQUEST); |
| 2214 | |
| 2215 | /* Second update: 0 ul/dl pkt/octet should be reported, since nothing was sent */ |
| 2216 | as_DIA_Gy_CCR(UPDATE_REQUEST); |
| 2217 | |
| 2218 | /* Third update: make sure report contains again octets/pkts for both UL/DL: */ |
| 2219 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr, dns1_addr)); |
| 2220 | f_wait_icmp4_echo_reply(ctx); |
| 2221 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr, dns1_addr)); |
| 2222 | f_wait_icmp4_echo_reply(ctx); |
| 2223 | as_DIA_Gy_CCR(UPDATE_REQUEST); |
| 2224 | |
| 2225 | /* Let the CCA reach the GGSN */ |
| 2226 | f_sleep(0.5); |
| 2227 | deactivate(d); |
| 2228 | T_default.stop; |
| 2229 | |
| 2230 | /* Send some data and validate it is reported in the TERMINATION_REQUEST |
| 2231 | * (triggered by PFCP Session Deletion Response): */ |
| 2232 | f_send_gtpu(ctx, f_gen_icmpv4_echo(saddr, dns1_addr)); |
| 2233 | f_wait_icmp4_echo_reply(ctx); |
| 2234 | |
| 2235 | f_pdp_ctx_del(ctx, '1'B); |
| 2236 | |
| 2237 | |
| 2238 | f_shutdown_helper(); |
| 2239 | } |
| 2240 | |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 2241 | control { |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 2242 | execute(TC_pdp4_act_deact()); |
| 2243 | execute(TC_pdp4_act_deact_ipcp()); |
Harald Welte | f829854 | 2019-04-10 10:15:28 +0200 | [diff] [blame] | 2244 | execute(TC_pdp4_act_deact_ipcp_pap_broken()); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 2245 | execute(TC_pdp4_act_deact_pcodns()); |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 2246 | execute(TC_pdp4_act_deact_gtpu_access()); |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 2247 | execute(TC_pdp4_act_deact_gtpu_access_wrong_saddr()); |
| 2248 | execute(TC_pdp4_act_deact_gtpu_access_ipv6_apn4()); |
Stefan Sperling | c479e4f | 2018-04-03 19:34:16 +0200 | [diff] [blame] | 2249 | execute(TC_pdp4_clients_interact_with_txseq()); |
| 2250 | execute(TC_pdp4_clients_interact_without_txseq()); |
Philipp Maier | 33e5261 | 2018-05-30 17:22:02 +0200 | [diff] [blame] | 2251 | execute(TC_pdp4_act_deact_with_single_dns()); |
| 2252 | execute(TC_pdp4_act_deact_with_separate_dns()); |
Pau Espin Pedrol | cd326c5 | 2022-02-14 18:57:43 +0100 | [diff] [blame] | 2253 | execute(TC_pdp4_act_update_teic()); |
| 2254 | execute(TC_pdp4_act_update_teid()); |
Harald Welte | ed7a177 | 2017-08-09 20:26:20 +0200 | [diff] [blame] | 2255 | |
| 2256 | execute(TC_pdp6_act_deact()); |
| 2257 | execute(TC_pdp6_act_deact_pcodns()); |
| 2258 | execute(TC_pdp6_act_deact_icmp6()); |
Pau Espin Pedrol | 3d9338f | 2018-01-29 20:42:54 +0100 | [diff] [blame] | 2259 | execute(TC_pdp6_act_deact_gtpu_access()); |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 2260 | execute(TC_pdp6_act_deact_gtpu_access_wrong_ll_saddr()); |
| 2261 | execute(TC_pdp6_act_deact_gtpu_access_wrong_global_saddr()); |
| 2262 | execute(TC_pdp6_act_deact_gtpu_access_ipv4_apn6()); |
Pau Espin Pedrol | 6c7285d | 2018-01-30 17:20:22 +0100 | [diff] [blame] | 2263 | execute(TC_pdp6_clients_interact()); |
Harald Welte | dca8005 | 2017-08-13 20:01:38 +0200 | [diff] [blame] | 2264 | |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 2265 | execute(TC_pdp46_act_deact()); |
| 2266 | execute(TC_pdp46_act_deact_ipcp()); |
| 2267 | execute(TC_pdp46_act_deact_icmp6()); |
| 2268 | execute(TC_pdp46_act_deact_pcodns4()); |
| 2269 | execute(TC_pdp46_act_deact_pcodns6()); |
| 2270 | execute(TC_pdp46_act_deact_gtpu_access()); |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 2271 | execute(TC_pdp46_act_deact_gtpu_access_wrong_saddr_ipv4()); |
Pau Espin Pedrol | c6ac695 | 2022-02-14 11:19:23 +0100 | [diff] [blame] | 2272 | execute(TC_pdp46_act_deact_gtpu_access_wrong_ll_saddr_ipv6()); |
Pau Espin Pedrol | c8c0341 | 2022-02-11 13:39:26 +0100 | [diff] [blame] | 2273 | execute(TC_pdp46_act_deact_gtpu_access_wrong_global_saddr_ipv6()); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 2274 | execute(TC_pdp46_clients_interact()); |
Pau Espin Pedrol | 22d597f | 2019-08-21 16:16:58 +0200 | [diff] [blame] | 2275 | execute(TC_pdp46_act_deact_apn4()); |
Oliver Smith | ee6a088 | 2019-03-08 11:05:46 +0100 | [diff] [blame] | 2276 | |
Harald Welte | dca8005 | 2017-08-13 20:01:38 +0200 | [diff] [blame] | 2277 | execute(TC_echo_req_resp()); |
Pau Espin Pedrol | 480e67f | 2022-02-09 16:37:47 +0100 | [diff] [blame] | 2278 | execute(TC_echo_req_resp_gtpu()); |
Pau Espin Pedrol | fa1ca02 | 2019-08-23 18:58:53 +0200 | [diff] [blame] | 2279 | execute(TC_pdp_act2_recovery()); |
Pau Espin Pedrol | 9a5f42f | 2019-05-27 20:04:35 +0200 | [diff] [blame] | 2280 | execute(TC_act_deact_retrans_duplicate()); |
Pau Espin Pedrol | 6916ec4 | 2019-08-23 16:15:07 +0200 | [diff] [blame] | 2281 | |
Pau Espin Pedrol | 6f319f9 | 2020-01-03 20:18:57 +0100 | [diff] [blame] | 2282 | execute(TC_pdp_act_restart_ctr_echo()); |
Pau Espin Pedrol | 68c2af5 | 2022-02-25 11:56:17 +0100 | [diff] [blame] | 2283 | |
| 2284 | execute(TC_lots_of_concurrent_pdp_ctx()); |
Pau Espin Pedrol | bfea835 | 2022-02-28 12:11:26 +0100 | [diff] [blame] | 2285 | /* Keep at the end, crashes older osmo-ggsn versions (OS#5469): */ |
| 2286 | execute(TC_addr_pool_exhaustion()); |
Pau Espin Pedrol | 77fdd0b | 2022-03-08 14:03:33 +0100 | [diff] [blame] | 2287 | |
| 2288 | /* open5gs specific tests: */ |
| 2289 | if (m_ggsn_impl == GGSN_IMPL_OPEN5GS) { |
| 2290 | execute(TC_gy_charging_cc_time()); |
| 2291 | } |
Harald Welte | 94ade36 | 2017-08-04 00:36:55 +0200 | [diff] [blame] | 2292 | } |
Harald Welte | 379d45a | 2017-08-03 09:55:15 +0200 | [diff] [blame] | 2293 | } |