aboutsummaryrefslogtreecommitdiffstats
path: root/stp/STP_Tests_Common.ttcn
blob: aee5a886fc70d7b7985fcbd02767edfa3b3cec55 (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
module STP_Tests_Common {

/* Osmocom STP test suite in in TTCN-3
 * (C) 2019 Harald Welte <laforge@gnumonks.org>
 * 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
 */

friend module STP_Tests;
friend module STP_Tests_M3UA;
friend module STP_Tests_IPA;

import from TELNETasp_PortType all;
import from Osmocom_VTY_Functions all;

import from IPL4asp_Types all;

modulepar {
	charstring mp_stp_ip := "127.0.0.1";
	charstring mp_local_ip := "127.0.0.1";
}

friend template (value) SctpTuple ts_SCTP(template (omit) integer ppid := 3,
					   template (omit) integer stream := 0) := {
	sinfo_stream := stream,
	sinfo_ppid := ppid,
	remSocks := omit,
	assocId := omit
}

type component Test_CT {
	port TELNETasp_PT VTY;
	timer g_Tguard := 30.0;
	var boolean g_test_initialized := false;
}

private altstep as_gTguard() runs on Test_CT {
	[] g_Tguard.timeout {
		setverdict(fail, "Global guard timer timed out");
		mtc.stop;
		}
}

friend function f_init_common() runs on Test_CT {
	if (g_test_initialized) {
		return;
	}
	g_test_initialized := true;

	map(self:VTY, system:VTY);
	f_vty_set_prompts(VTY);
	f_vty_transceive(VTY, "enable");

	activate(as_gTguard());
	g_Tguard.start;
}



}