introduce a TTCN3 test suite for SCCP

This test suite acts as an SCCP server on top of M3UA.

SCCP tests are run against the sccp_demo_user program which
can be found in libosmo-sccp/examples. This program must be
started in client mode: sccp_demo_user -c
The SCCP test suite should then work out of the box with
the provided SCCP_Tests.cfg file and this additional change
to sccp_demo_user default point codes:
https://gerrit.osmocom.org/#/c/libosmo-sccp/+/9652/

There is currently only one test, for the libosmo-sccp crash
reported as issue OS#2666. The implementation of this test
is currently using an ugly workaround due to shortcomings of
the M3UA Emulation layer (see source code comments). Whether
a better solution is feasible is still to be determined.

The test requires a patch to the SCCP Protocol Emulation which
has been submitted upstream: https://git.eclipse.org/r/#/c/124552/

Change-Id: I03f5e8b282a7396b45417495c88d8fb81b26cda8
Related: OS#2666
diff --git a/library/BSSAP_Adapter.ttcn b/library/BSSAP_Adapter.ttcn
index b29d03f..ada66d2 100644
--- a/library/BSSAP_Adapter.ttcn
+++ b/library/BSSAP_Adapter.ttcn
@@ -18,6 +18,7 @@
 import from SCCP_Types all;
 import from SCCPasp_Types all;
 import from SCCP_Emulation all;
+import from SCCP_Templates all;
 
 import from SCTPasp_Types all;
 import from SCTPasp_PortType all;
@@ -59,20 +60,6 @@
 	integer rctx
 };
 
-/* construct a SCCP_PAR_Address with just PC + SSN and no GT */
-template (value) SCCP_PAR_Address ts_SccpAddr_PC_SSN(integer pc, integer ssn, octetstring sio,
-							charstring sccp_srv_type) := {
-	addressIndicator := {
-		pointCodeIndic := '1'B,
-		ssnIndicator := '1'B,
-		globalTitleIndic := '0000'B,
-		routingIndicator := '1'B
-	},
-	signPointCode := SCCP_SPC_int2bit(pc, sccp_srv_type, sio),
-	subsystemNumber := ssn,
-	globalTitle := omit
-}
-
 private function init_pars(inout BSSAP_Adapter ba, in BSSAP_Configuration cfg) {
 	ba.sccp_pars := {
 		sio := {
diff --git a/library/SCCP_Templates.ttcn b/library/SCCP_Templates.ttcn
new file mode 100644
index 0000000..f4019b8
--- /dev/null
+++ b/library/SCCP_Templates.ttcn
@@ -0,0 +1,47 @@
+/* (C) 2018 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
+ * All Rights Reserved
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ */
+
+module SCCP_Templates {
+
+import from SCCP_Types all;
+import from SCCPasp_Types all;
+import from SCCP_Emulation all;
+
+/* construct a SCCP_PAR_Address with just PC + SSN and no GT */
+template (value) SCCP_PAR_Address ts_SccpAddr_PC_SSN(integer pc, integer ssn, octetstring sio,
+							charstring sccp_srv_type) := {
+	addressIndicator := {
+		pointCodeIndic := '1'B,
+		ssnIndicator := '1'B,
+		globalTitleIndic := '0000'B,
+		routingIndicator := '1'B
+	},
+	signPointCode := SCCP_SPC_int2bit(pc, sccp_srv_type, sio),
+	subsystemNumber := ssn,
+	globalTitle := omit
+}
+
+/* construct a SCCP_PAR_Address with only GT */
+template (value) SCCP_PAR_Address ts_SccpAddr_GT(hexstring global_address) := {
+	addressIndicator := {
+		pointCodeIndic := '0'B,
+		ssnIndicator := '0'B,
+		globalTitleIndic := '0001'B, // NAI only
+		routingIndicator := cg_route_on_GT // route on GT
+	},
+	signPointCode := omit,
+	subsystemNumber := omit,
+	globalTitle := {
+		gti0001 := {
+			natureOfAddress := '0000011'B,
+			oddeven := '0'B,
+			globalTitleAddress := global_address
+		}
+	}
+}
+
+}