summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-08-01 09:54:40 +0200
committerHarald Welte <laforge@gnumonks.org>2019-09-05 14:23:35 +0200
commite3f435518bb4be1372d0bf1979c7baadc2e10002 (patch)
tree9e3a3c677349dcb8e92c61fce6c146f2d1dc5f5e
parentca78c8d15a3e95347d50a24e4d36b4a2b8f8227f (diff)
WIP: Initial skeleton of CBC tests
-rw-r--r--cbc/CBC_Tests.ttcn83
-rwxr-xr-xcbc/gen_links.sh38
-rwxr-xr-xcbc/regen_makefile.sh10
3 files changed, 131 insertions, 0 deletions
diff --git a/cbc/CBC_Tests.ttcn b/cbc/CBC_Tests.ttcn
new file mode 100644
index 0000000..1d5e7ab
--- /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 0000000..8dea495
--- /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_v11.2.0/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 0000000..fcacb17
--- /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