WIP: Initial skeleton of CBC tests

Change-Id: I38286e8a3dd0f39bd25f631dcbb3ff4f8d4c221f
This commit is contained in:
Harald Welte 2019-08-01 09:54:40 +02:00 committed by Harald Welte
parent 9e04d5e039
commit 1dfca71ddf
6 changed files with 160 additions and 1 deletions

18
cbc/CBC_Tests.cfg Normal file
View File

@ -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

10
cbc/CBC_Tests.default Normal file
View File

@ -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]

83
cbc/CBC_Tests.ttcn Normal file
View File

@ -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));
}
}

38
cbc/gen_links.sh Executable file
View File

@ -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

10
cbc/regen_makefile.sh Executable file
View File

@ -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

View File

@ -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});
}