aboutsummaryrefslogtreecommitdiffstats
path: root/sgsn/SGSN_Tests_Iu.ttcn
blob: 0a589b9f276ef8c0a5cf0128fd4f8083ac0236f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
module SGSN_Tests_Iu {

import from Osmocom_Types all;
import from Osmocom_VTY_Functions all;

import from SGSN_Tests all;
import from BSSGP_Emulation all;

import from RAN_Adapter all;
import from RAN_Emulation all;
import from RANAP_Templates all;
import from RANAP_PDU_Descriptions all;
import from RANAP_IEs all;

private function f_init() runs on test_CT {
	g_ranap_enable := true;
	SGSN_Tests.f_init();

	/* default VTY configuration */
	f_vty_config(SGSNVTY, "sgsn", "encryption uea 0");
}

private function f_TC_iu_attach(charstring id) runs on BSSGP_ConnHdlr {
	var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));

	/* first perform regular attach */
	f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 3);
	setverdict(pass);
}
testcase TC_iu_attach() runs on test_CT {
	/* MS -> SGSN: Attach Request IMSI
	 * MS <- SGSN: Identity Request IMEI
	 * MS -> SGSN: Identity Response IMEI
	 * MS <- SGSN: Auth Request
	 * MS -> SGSN: Auth Response
	 * MS <- SGSN: Attach Accept
	 * MS -> SGSN: Attach Complete
	 */
	var BSSGP_ConnHdlr vc_conn;
	f_init();
	f_sleep(1.0);
	f_vty_config(SGSNVTY, "sgsn", "encryption uea 0");
	vc_conn := f_start_handler(refers(f_TC_iu_attach), testcasename(), g_gb, 1001);
	vc_conn.done;
	f_cleanup();
}

testcase TC_iu_attach_encr() runs on test_CT {
	/* MS -> SGSN: Attach Request IMSI
	 * MS <- SGSN: Identity Request IMEI
	 * MS -> SGSN: Identity Response IMEI
	 * MS <- SGSN: Auth Request
	 * MS -> SGSN: Auth Response
	 * MS <- SGSN: Security Mode Command
	 * MS -> SGSN: Security Mode Complete
	 * hNodeB <- SGSN: Common Id
	 * MS <- SGSN: Attach Accept
	 * MS -> SGSN: Attach Complete
	 */
	var BSSGP_ConnHdlr vc_conn;
	f_init();
	f_vty_config(SGSNVTY, "sgsn", "encryption uea 1 2");
	f_sleep(1.0);
	vc_conn := f_start_handler(refers(f_TC_iu_attach), testcasename(), g_gb, 1001, expect_ciph := true);
	vc_conn.done;
	f_cleanup();
}

private function f_TC_iu_attach_geran_rau(charstring id) runs on BSSGP_ConnHdlr {
	var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));

	/* first perform regular attach */
	f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 3);

	/* we got a new TLLI, register it */
	f_bssgp_client_unregister(g_pars.imsi);
	f_bssgp_client_register(g_pars.imsi, g_pars.tlli);

	/* do a routing area update */
	f_routing_area_update(g_pars.ra);
}

testcase TC_iu_attach_geran_rau() runs on test_CT {
	/* MS <-> SGSN: Successful Attach over Iu
	 * MS <-> SGSN: Routing Area Update over Geran
	 */
	var BSSGP_ConnHdlr vc_conn;
	f_init();
	f_sleep(1.0);
	vc_conn := f_start_handler(refers(f_TC_iu_attach_geran_rau), testcasename(), g_gb, 1002);
	vc_conn.done;
	f_cleanup();
}

private function f_TC_geran_attach_iu_rau(charstring id) runs on BSSGP_ConnHdlr {
	var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));

	/* first perform regular attach */
	f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 0);

	/* do a routing area update */
	f_routing_area_update(g_pars.ra, ran_index := 3);
	setverdict(pass);
}

testcase TC_geran_attach_iu_rau() runs on test_CT {
	/* MS <-> SGSN: Successful Attach over Geran
	 * MS <-> SGSN: Routing Area Update over Iu
	 */
	var BSSGP_ConnHdlr vc_conn;
	f_init();
	f_sleep(1.0);
	vc_conn := f_start_handler(refers(f_TC_geran_attach_iu_rau), testcasename(), g_gb, 1003);
	vc_conn.done;
	f_cleanup();
}

control {
	execute( TC_iu_attach() );
	execute( TC_iu_attach_encr() );
	execute( TC_iu_attach_geran_rau() );
	execute( TC_geran_attach_iu_rau() );
}


}