Harald Welte | 900d01a | 2019-08-13 13:27:51 +0200 | [diff] [blame] | 1 | module SGSN_Tests_Iu { |
| 2 | |
| 3 | import from Osmocom_Types all; |
Neels Hofmeyr | 3ee71d8 | 2022-03-08 21:46:41 +0100 | [diff] [blame] | 4 | import from Osmocom_VTY_Functions all; |
Harald Welte | 900d01a | 2019-08-13 13:27:51 +0200 | [diff] [blame] | 5 | |
| 6 | import from SGSN_Tests all; |
| 7 | |
| 8 | import from RAN_Adapter all; |
| 9 | import from RAN_Emulation all; |
| 10 | import from RANAP_Templates all; |
| 11 | import from RANAP_PDU_Descriptions all; |
| 12 | import from RANAP_IEs all; |
| 13 | |
Vadim Yanitskiy | f0bbadc | 2024-05-15 00:41:23 +0500 | [diff] [blame^] | 14 | private function f_init() runs on test_CT { |
| 15 | g_ranap_enable := true; |
| 16 | SGSN_Tests.f_init(); |
| 17 | } |
Harald Welte | 900d01a | 2019-08-13 13:27:51 +0200 | [diff] [blame] | 18 | |
| 19 | private function f_TC_iu_attach(charstring id) runs on BSSGP_ConnHdlr { |
| 20 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
| 21 | |
| 22 | /* first perform regular attach */ |
Alexander Couzens | b1ce118 | 2019-09-15 22:43:40 +0200 | [diff] [blame] | 23 | f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 3); |
Harald Welte | 900d01a | 2019-08-13 13:27:51 +0200 | [diff] [blame] | 24 | setverdict(pass); |
| 25 | } |
| 26 | testcase TC_iu_attach() runs on test_CT { |
| 27 | /* MS -> SGSN: Attach Request IMSI |
| 28 | * MS <- SGSN: Identity Request IMEI |
| 29 | * MS -> SGSN: Identity Response IMEI |
| 30 | * MS <- SGSN: Auth Request |
| 31 | * MS -> SGSN: Auth Response |
| 32 | * MS <- SGSN: Attach Accept |
| 33 | * MS -> SGSN: Attach Complete |
| 34 | */ |
| 35 | var BSSGP_ConnHdlr vc_conn; |
Harald Welte | 900d01a | 2019-08-13 13:27:51 +0200 | [diff] [blame] | 36 | f_init(); |
| 37 | f_sleep(1.0); |
| 38 | vc_conn := f_start_handler(refers(f_TC_iu_attach), testcasename(), g_gb, 1001); |
| 39 | vc_conn.done; |
| 40 | f_cleanup(); |
| 41 | } |
| 42 | |
Neels Hofmeyr | 3ee71d8 | 2022-03-08 21:46:41 +0100 | [diff] [blame] | 43 | testcase TC_iu_attach_encr() runs on test_CT { |
| 44 | /* MS -> SGSN: Attach Request IMSI |
| 45 | * MS <- SGSN: Identity Request IMEI |
| 46 | * MS -> SGSN: Identity Response IMEI |
| 47 | * MS <- SGSN: Auth Request |
| 48 | * MS -> SGSN: Auth Response |
| 49 | * MS <- SGSN: Security Mode Command |
| 50 | * MS -> SGSN: Security Mode Complete |
| 51 | * hNodeB <- SGSN: Common Id |
| 52 | * MS <- SGSN: Attach Accept |
| 53 | * MS -> SGSN: Attach Complete |
| 54 | */ |
| 55 | var BSSGP_ConnHdlr vc_conn; |
Neels Hofmeyr | 3ee71d8 | 2022-03-08 21:46:41 +0100 | [diff] [blame] | 56 | f_init(); |
| 57 | f_vty_config(SGSNVTY, "sgsn", "encryption uea 1 2"); |
| 58 | f_sleep(1.0); |
| 59 | vc_conn := f_start_handler(refers(f_TC_iu_attach), testcasename(), g_gb, 1001, expect_ciph := true); |
| 60 | vc_conn.done; |
| 61 | f_vty_config(SGSNVTY, "sgsn", "encryption uea 0"); |
| 62 | f_cleanup(); |
| 63 | } |
| 64 | |
Alexander Couzens | e5f4a91 | 2019-08-12 18:07:27 +0200 | [diff] [blame] | 65 | private function f_TC_iu_attach_geran_rau(charstring id) runs on BSSGP_ConnHdlr { |
| 66 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
Harald Welte | 900d01a | 2019-08-13 13:27:51 +0200 | [diff] [blame] | 67 | |
Alexander Couzens | e5f4a91 | 2019-08-12 18:07:27 +0200 | [diff] [blame] | 68 | /* first perform regular attach */ |
Alexander Couzens | b1ce118 | 2019-09-15 22:43:40 +0200 | [diff] [blame] | 69 | f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 3); |
Alexander Couzens | e5f4a91 | 2019-08-12 18:07:27 +0200 | [diff] [blame] | 70 | |
| 71 | /* do a routing area update */ |
| 72 | f_routing_area_update(g_pars.ra); |
| 73 | } |
| 74 | |
| 75 | testcase TC_iu_attach_geran_rau() runs on test_CT { |
| 76 | /* MS <-> SGSN: Successful Attach over Iu |
| 77 | * MS <-> SGSN: Routing Area Update over Geran |
| 78 | */ |
| 79 | var BSSGP_ConnHdlr vc_conn; |
Alexander Couzens | e5f4a91 | 2019-08-12 18:07:27 +0200 | [diff] [blame] | 80 | f_init(); |
| 81 | f_sleep(1.0); |
| 82 | vc_conn := f_start_handler(refers(f_TC_iu_attach_geran_rau), testcasename(), g_gb, 1002); |
| 83 | vc_conn.done; |
| 84 | f_cleanup(); |
| 85 | } |
Harald Welte | 900d01a | 2019-08-13 13:27:51 +0200 | [diff] [blame] | 86 | |
Alexander Couzens | 6da25e3 | 2019-08-16 03:50:44 +0200 | [diff] [blame] | 87 | private function f_TC_geran_attach_iu_rau(charstring id) runs on BSSGP_ConnHdlr { |
| 88 | var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip)); |
| 89 | |
| 90 | /* first perform regular attach */ |
Alexander Couzens | b1ce118 | 2019-09-15 22:43:40 +0200 | [diff] [blame] | 91 | f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 0); |
Alexander Couzens | 6da25e3 | 2019-08-16 03:50:44 +0200 | [diff] [blame] | 92 | |
| 93 | /* do a routing area update */ |
Alexander Couzens | be76d9c | 2019-09-15 22:48:03 +0200 | [diff] [blame] | 94 | f_routing_area_update(g_pars.ra, ran_index := 3); |
Alexander Couzens | 6da25e3 | 2019-08-16 03:50:44 +0200 | [diff] [blame] | 95 | setverdict(pass); |
| 96 | } |
| 97 | |
| 98 | testcase TC_geran_attach_iu_rau() runs on test_CT { |
| 99 | /* MS <-> SGSN: Successful Attach over Geran |
| 100 | * MS <-> SGSN: Routing Area Update over Iu |
| 101 | */ |
| 102 | var BSSGP_ConnHdlr vc_conn; |
Alexander Couzens | 6da25e3 | 2019-08-16 03:50:44 +0200 | [diff] [blame] | 103 | f_init(); |
| 104 | f_sleep(1.0); |
| 105 | vc_conn := f_start_handler(refers(f_TC_geran_attach_iu_rau), testcasename(), g_gb, 1003); |
| 106 | vc_conn.done; |
| 107 | f_cleanup(); |
| 108 | } |
| 109 | |
Harald Welte | 900d01a | 2019-08-13 13:27:51 +0200 | [diff] [blame] | 110 | control { |
| 111 | execute( TC_iu_attach() ); |
Neels Hofmeyr | 3ee71d8 | 2022-03-08 21:46:41 +0100 | [diff] [blame] | 112 | execute( TC_iu_attach_encr() ); |
Daniel Willmann | 69cfc5e | 2020-01-22 18:23:46 +0100 | [diff] [blame] | 113 | execute( TC_iu_attach_geran_rau() ); |
| 114 | execute( TC_geran_attach_iu_rau() ); |
Harald Welte | 900d01a | 2019-08-13 13:27:51 +0200 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | |
| 118 | } |