summaryrefslogtreecommitdiffstats
path: root/stp/STP_Tests_Common.ttcn
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2019-10-17 11:09:05 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2019-11-12 13:05:41 +0100
commit0db4413ff62531f1b76f3f3228645596de846fba (patch)
tree3e44f726edae7b6c8f8c288183b3cae9f161e31c /stp/STP_Tests_Common.ttcn
parent3ffb3af476ff10969dae706bfd4c45aa99f3eb80 (diff)
stp: Introduce STP_Tests*.ttcn for testing OsmoSTP
In the past, we were automatically running [large parts of] the nplab M3UA and SUA test suites, but those implement only a fraction of the functionality. Particularly, they don't cover the non-standard IPA behavior, and they don't cover RKM (routing key management). Let's introduce an initial set of STP tests with this patch. We try to not duplicate nplab here, and implement bits not covered there. Change-Id: I628a87385cac0dfe708a0d74a5088fbd5a4790cd
Diffstat (limited to 'stp/STP_Tests_Common.ttcn')
-rw-r--r--stp/STP_Tests_Common.ttcn64
1 files changed, 64 insertions, 0 deletions
diff --git a/stp/STP_Tests_Common.ttcn b/stp/STP_Tests_Common.ttcn
new file mode 100644
index 00000000..aee5a886
--- /dev/null
+++ b/stp/STP_Tests_Common.ttcn
@@ -0,0 +1,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;
+}
+
+
+
+}