Harald Welte | 0db4413 | 2019-10-17 11:09:05 +0200 | [diff] [blame] | 1 | module STP_Tests_Common { |
| 2 | |
| 3 | /* Osmocom STP test suite in in TTCN-3 |
| 4 | * (C) 2019 Harald Welte <laforge@gnumonks.org> |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Released under the terms of GNU General Public License, Version 2 or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 11 | */ |
| 12 | |
| 13 | friend module STP_Tests; |
| 14 | friend module STP_Tests_M3UA; |
| 15 | friend module STP_Tests_IPA; |
| 16 | |
| 17 | import from TELNETasp_PortType all; |
| 18 | import from Osmocom_VTY_Functions all; |
| 19 | |
| 20 | import from IPL4asp_Types all; |
| 21 | |
Harald Welte | 0db4413 | 2019-10-17 11:09:05 +0200 | [diff] [blame] | 22 | type component Test_CT { |
| 23 | port TELNETasp_PT VTY; |
| 24 | timer g_Tguard := 30.0; |
| 25 | var boolean g_test_initialized := false; |
| 26 | } |
| 27 | |
| 28 | private altstep as_gTguard() runs on Test_CT { |
| 29 | [] g_Tguard.timeout { |
| 30 | setverdict(fail, "Global guard timer timed out"); |
| 31 | mtc.stop; |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | friend function f_init_common() runs on Test_CT { |
| 36 | if (g_test_initialized) { |
| 37 | return; |
| 38 | } |
| 39 | g_test_initialized := true; |
| 40 | |
| 41 | map(self:VTY, system:VTY); |
| 42 | f_vty_set_prompts(VTY); |
| 43 | f_vty_transceive(VTY, "enable"); |
| 44 | |
| 45 | activate(as_gTguard()); |
| 46 | g_Tguard.start; |
| 47 | } |
| 48 | |
| 49 | |
| 50 | |
| 51 | } |