aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-08-01 09:54:40 +0200
committerHarald Welte <laforge@osmocom.org>2021-01-12 19:08:37 +0100
commit1dfca71ddfd5f8c89d173657662f5a4c5ce47a78 (patch)
tree450591a72c8beeceb9b7885b807deaff5ab068d8
parent9e04d5e039a682033d2e4e0c85c0920f1f240a06 (diff)
WIP: Initial skeleton of CBC tests
-rw-r--r--cbc/CBC_Tests.cfg18
-rw-r--r--cbc/CBC_Tests.default10
-rw-r--r--cbc/CBC_Tests.ttcn83
-rwxr-xr-xcbc/gen_links.sh38
-rwxr-xr-xcbc/regen_makefile.sh10
-rw-r--r--library/CBSP_Templates.ttcn2
6 files changed, 160 insertions, 1 deletions
diff --git a/cbc/CBC_Tests.cfg b/cbc/CBC_Tests.cfg
new file mode 100644
index 00000000..7c2a3acc
--- /dev/null
+++ b/cbc/CBC_Tests.cfg
@@ -0,0 +1,18 @@
+[ORDERED_INCLUDE]
+# Common configuration, shared between test suites
+"../Common.cfg"
+# testsuite specific configuration, not expected to change
+"./CBC_Tests.default"
+
+# Local configuration below
+
+[LOGGING]
+
+[TESTPORT_PARAMETERS]
+
+[MODULE_PARAMETERS]
+
+[MAIN_CONTROLLER]
+
+[EXECUTE]
+CBC_Tests.control
diff --git a/cbc/CBC_Tests.default b/cbc/CBC_Tests.default
new file mode 100644
index 00000000..22e40b5c
--- /dev/null
+++ b/cbc/CBC_Tests.default
@@ -0,0 +1,10 @@
+[LOGGING]
+mtc.FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC;
+
+[TESTPORT_PARAMETERS]
+*.CBCVTY.PROMPT1 := "OsmoCBC> "
+
+[MODULE_PARAMETERS]
+// Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoCBC";
+
+[EXECUTE]
diff --git a/cbc/CBC_Tests.ttcn b/cbc/CBC_Tests.ttcn
new file mode 100644
index 00000000..1d5e7ab0
--- /dev/null
+++ b/cbc/CBC_Tests.ttcn
@@ -0,0 +1,83 @@
+module CBC_Tests {
+
+import from Osmocom_Types all;
+
+import from BSSAP_Types all;
+import from CBSP_Types all;
+import from CBSP_Templates all;
+import from CBSP_Adapter all;
+import from CBSP_CodecPort all;
+
+modulepar {
+ charstring mp_cbc_host := "127.0.0.1";
+ integer mp_cbc_port := 48049;
+};
+
+type component test_CT extends CBSP_Adapter_CT {
+};
+
+private function f_init() runs on test_CT {
+ CBSP_Adapter.f_connect(mp_cbc_host, mp_cbc_port, "", -1);
+}
+
+testcase TC_foo() runs on test_CT {
+ f_init();
+ var BSSMAP_FIELD_CellIdentificationList cell_list := {
+ cIl_allInBSS := ''O
+ };
+ f_cbsp_send(ts_CBSP_RESTART(cell_list, CBSP_BC_MSGT_CBS, CBSP_RI_DATA_LOST));
+ f_cbsp_send(ts_CBSP_RESTART(cell_list, CBSP_BC_MSGT_EMERG, CBSP_RI_DATA_LOST));
+ f_sleep(10.0);
+}
+
+/* test whether or not we receive a KEEP-ALIVE at all */
+testcase TC_rx_keepalive() runs on test_CT {
+ f_init();
+ f_cbsp_exp(tr_CBSP_KEEP_ALIVE(?));
+ setverdict(pass);
+}
+
+testcase TC_rx_keepalive_timeout() runs on test_CT {
+ var CBSP_PDU rx;
+ var CBSP_IE ie;
+
+ f_init();
+ rx := f_cbsp_exp(tr_CBSP_KEEP_ALIVE(?));
+ f_cbsp_find_ie(rx, CBSP_IEI_KEEP_ALIVE_REP_PERIOD, ie);
+
+ setverdict(pass);
+}
+
+testcase TC_selftest() runs on test_CT {
+ const octetstring c_load_q := '0700000d0400080000f110012345671200'O;
+ const octetstring c_load_q_compl := '0800000f0a000a0000f1100123456700001200'O;
+ const octetstring c_reset := '1000000b0400080000f11001234567'O;
+ const octetstring c_reset_compl := '1100000b0400080000f11001234567'O;
+ const octetstring c_msg_sts_q := '0a0000130e022b0200000400080000f110012345671200'O;
+ const octetstring c_msg_sts_q_fail := '0c0000140e022b0200000900090000f11001234567021200'O;
+ const octetstring c_kill := '040000110e00000200000400080000f11001234567'O;
+ const octetstring c_kill_fail := '060000120e00000200000900090000f1100123456702'O;
+ const octetstring c_write_repl := '010000c70e022b0300300400080000f110012345671200050006000407000613020c400107f4f29c9e769f5de337b90c921d1b8d46a3d168341a8d46a3d168341a8d46a3d168341a8d46a3d168341a8d46a3d168341a8d46a3d168341a8d46a3d168341a8d46a3d168341a8d46a3d168341a8d46a3d100'O;
+ const octetstring c_write_repl_compl := '020000130e022b0300300400080000f110012345671200'O;
+ const octetstring c_write_repl_fail := '030000140e022b0300300900090000f110012345670d1200'O;
+ const octetstring c_msg_s_q := '0a0000130e022b0200900400080000f110012345671200'O;
+ const octetstring c_msg_s_q_compl := '0b0000160e022b02009008000b0000f110012345670008001200'O;
+ const octetstring c_kill_compl := '050000160e022b02008008000b0000f110012345670006001200'O;
+
+ log(dec_CBSP_PDU(c_load_q));
+ log(dec_CBSP_PDU(c_load_q_compl));
+ log(dec_CBSP_PDU(c_reset));
+ log(dec_CBSP_PDU(c_reset_compl));
+ log(dec_CBSP_PDU(c_msg_sts_q));
+ log(dec_CBSP_PDU(c_msg_sts_q_fail));
+ log(dec_CBSP_PDU(c_kill));
+ log(dec_CBSP_PDU(c_kill_fail));
+ log(dec_CBSP_PDU(c_write_repl));
+ log(dec_CBSP_PDU(c_write_repl_compl));
+ log(dec_CBSP_PDU(c_write_repl_fail));
+ log(dec_CBSP_PDU(c_msg_s_q));
+ log(dec_CBSP_PDU(c_msg_s_q_compl));
+ log(dec_CBSP_PDU(c_kill_compl));
+}
+
+}
diff --git a/cbc/gen_links.sh b/cbc/gen_links.sh
new file mode 100755
index 00000000..5c0c3fb4
--- /dev/null
+++ b/cbc/gen_links.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+BASEDIR=../deps
+
+. ../gen_links.sh.inc
+
+DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
+FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc TCCInterface.cc TCCInterface_ip.h"
+FILES+=" TCCEncoding_Functions.ttcn TCCEncoding.cc " # GSM 7-bit coding
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.TestPorts.Common_Components.Socket-API/src
+FILES="Socket_API_Definitions.ttcn"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.TestPorts.IPL4asp/src
+FILES="IPL4asp_Functions.ttcn IPL4asp_PT.cc IPL4asp_PT.hh IPL4asp_PortType.ttcn IPL4asp_Types.ttcn IPL4asp_discovery.cc IPL4asp_protocol_L234.hh"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.TestPorts.SCTPasp/src
+FILES="SCTPasp_PT.cc SCTPasp_PT.hh SCTPasp_PortType.ttcn SCTPasp_Types.ttcn"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.TestPorts.TELNETasp/src
+FILES="TELNETasp_PT.cc TELNETasp_PT.hh TELNETasp_PortType.ttcn"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.ProtocolModules.BSSMAP/src
+FILES="BSSAP_Types.ttcn"
+gen_links $DIR $FILES
+
+DIR=../library
+FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc "
+FILES+="CBSP_Types.ttcn CBSP_Templates.ttcn "
+FILES+="CBSP_CodecPort.ttcn CBSP_CodecPort_CtrlFunct.ttcn CBSP_CodecPort_CtrlFunctdef.cc CBSP_Adapter.ttcn "
+gen_links $DIR $FILES
+
+ignore_pp_results
diff --git a/cbc/regen_makefile.sh b/cbc/regen_makefile.sh
new file mode 100755
index 00000000..fcacb178
--- /dev/null
+++ b/cbc/regen_makefile.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+FILES="*.ttcn TCCConversion.cc TCCInterface.cc TCCEncoding.cc IPL4asp_PT.cc IPL4asp_discovery.cc TELNETasp_PT.cc Native_FunctionDefs.cc SCTPasp_PT.cc CBSP_CodecPort_CtrlFunctdef.cc "
+#FILES+="*.ttcnpp *.c *.asn"
+
+export CPPFLAGS_TTCN3=""
+
+../regen-makefile.sh CBC_Tests.ttcn $FILES
+
+sed -i -e 's/^LINUX_LIBS = -lxml2/LINUX_LIBS = -lxml2 -lfftranscode/' Makefile
diff --git a/library/CBSP_Templates.ttcn b/library/CBSP_Templates.ttcn
index 5ee1f33b..906dc92a 100644
--- a/library/CBSP_Templates.ttcn
+++ b/library/CBSP_Templates.ttcn
@@ -54,7 +54,7 @@ function tr_CbspChannelInd(template uint8_t val := ?) return template CBSP_IE {
if (istemplatekind(val, "omit")) {
ie := omit;
} else if (istemplatekind(val, "*")) {
- ie := tr_CBSP_IE({channel_ind := ?}) ifpresent;
+ ie := tr_CBSP_IE({channel_ind := ?}); //ifpresent;
} else {
ie := tr_CBSP_IE({channel_ind := val});
}