aboutsummaryrefslogtreecommitdiffstats
path: root/sgsn/SGSN_Tests_NS.ttcn
blob: e5d012f232bf4cceefce4193df9e7bff33203315 (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
module SGSN_Tests_NS {

/* Osmocom SGSN test suite in TTCN-3
 * (C) 2020 sysmocom - s.f.m.c. GmbH
 * All rights reserved.
 *
 * Released under the terms of GNU General Public License, Version 2 or
 * (at your option) any later version.
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

import from Osmocom_Types all;
import from Osmocom_Gb_Types all;
import from Osmocom_VTY_Functions all;
import from NS_Types all;
import from RAW_NS all;
import from SGSN_Tests all;

type component RAW_Test_CT extends RAW_NS_CT, test_CT {
}

testcase TC_NS_connect_reset() runs on RAW_Test_CT {
	f_init_vty();
	f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);

	/* Send a NS-ALIVE */
	f_outgoing_ns_reset();

	f_sleep(1.0);
	f_clean_ns_codec();
}

testcase TC_NS_connect_alive() runs on RAW_Test_CT {
	f_init_vty();
	f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);

	/* Send a NS-ALIVE */
	NSCP[0].send(t_NS_ALIVE);
	alt {
	[] NSCP[0].receive(t_NS_ALIVE_ACK);
	[] NSCP[0].receive(tr_NS_STATUS(*)) { setverdict(fail); }
	[] NSCP[0].receive { repeat; }
	}

	f_sleep(1.0);
	f_clean_ns_codec();
}

/* perform outgoing SNS-SIZE procedure */
testcase TC_SNS_size() runs on RAW_Test_CT {
	f_init_vty();
	f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
	g_handle_rx_alive := true;

	f_outgoing_sns_size();
	setverdict(pass);
}

/* outgoing SNS-SIZE procedure with more BSS side IPs than SGSN can handle */
testcase TC_SNS_size_too_big() runs on RAW_Test_CT {
	f_init_vty();
	f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
	g_handle_rx_alive := true;

	f_outgoing_sns_size(cause := NS_CAUSE_INVALID_NR_OF_NSVCS, num_ip := 100);
	setverdict(pass);
}

/* perform outgoing SNS-CONFIG procedure (for BSS) */
testcase TC_SNS_config_bss() runs on RAW_Test_CT {
	f_init_vty();
	f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
	g_handle_rx_alive := true;

	f_outgoing_sns_size();
	f_outgoing_sns_config();
	setverdict(pass);
}

/* perform incoming SNS-CONFIG procedure (for SGSN) */
testcase TC_SNS_config_sgsn() runs on RAW_Test_CT {
	f_init_vty();
	f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
	g_handle_rx_alive := true;

	f_outgoing_sns_size();
	f_outgoing_sns_config();
	f_incoming_sns_config();
	setverdict(pass);
}

/* perform full SNS handshake and then outbound NS-ALIVE */
testcase TC_SNS_and_alive() runs on RAW_Test_CT {
	f_init_vty();
	f_init_ns_codec(mp_nsconfig[0], guard_secs := 120.0);
	g_handle_rx_alive := true;

	f_outgoing_sns_size();
	f_outgoing_sns_config();
	f_incoming_sns_config();
	f_outgoing_ns_alive();
	setverdict(pass);
}

control {

	if (mp_nsconfig[0].handle_sns) {
		execute( TC_SNS_size() );
		execute( TC_SNS_size_too_big() );
		execute( TC_SNS_config_bss() );
		execute( TC_SNS_config_sgsn() );
		execute( TC_SNS_and_alive() );
	} else {
		execute( TC_NS_connect_alive() );
		execute( TC_NS_connect_reset() );
	}
}

}