lapdm: Updated to recent changes in library code (make it compile again)

This commit is contained in:
Harald Welte 2017-07-30 22:51:04 +02:00
parent 43e060a50d
commit ffcad68801
5 changed files with 58 additions and 5 deletions

View File

@ -91,6 +91,30 @@ module L1CTL_Test {
}
}
template LapdmFrame t_nopayload(template GsmSapi sapi) := {
b := {
addr := tr_LapdmAddr(sapi, true),
ctrl := ?,
len := 0,
m := false,
el := 1,
payload := ''O
}
}
template LapdmFrame LAPDm_B_DISC(template GsmSapi sapi) modifies t_nopayload := {
b := {
ctrl := t_LapdmCtrlDISC(true)
}
}
template LapdmFrame LAPDm_B_RR(template GsmSapi sapi, template uint3_t nr) modifies t_nopayload := {
b := {
ctrl := t_LapdmCtrlRR(nr, false)
}
}
function f_test_sabm_results_in_ua(uint8_t sapi, boolean use_sacch, octetstring payload) runs on dummy_CT return boolean {
var LAPDm_ph_data phd;
var boolean result := false;
@ -106,6 +130,7 @@ module L1CTL_Test {
[] LAPDM.receive(t_PH_DATA(?, ?, ?)) -> value phd { log("Other PH-DATA: ", phd); repeat; }
[] T.timeout { }
}
LAPDM.send(t_PH_DATA(sapi, use_sacch, LAPDm_B_RR(sapi, 0)));
f_release_dcch();
return result;
}
@ -169,8 +194,22 @@ module L1CTL_Test {
f_release_dcch();
}
/* we test that a re-transmitted SABM with identical payload will result in the retransmission of a
* SABM. This is required during the contention resolution procedure as specified in 8.4.1.4 */
testcase TC_sabm_retransmit() runs on dummy_CT {
const octetstring payload := '00FEFEDEADBEEF'O;
f_init();
if (not f_test_sabm_results_in_ua(0, false, payload)) {
setverdict(fail, "UA not received for first SABM");
}
if (not f_test_sabm_results_in_ua(0, false, payload)) {
setverdict(fail, "UA not received for second SABM");
}
setverdict(pass);
}
testcase TC_foo() runs on dummy_CT {
var LapdmFrame lf;
/*
var LapdmFrame lf := valueof(LAPDm_B_UA(0, ''O));
log("ENC UA: ", enc_LapdmFrame(lf));
@ -180,6 +219,16 @@ module L1CTL_Test {
log("DEC UI AF: ", dec_LapdmAddressField('03'O));
*/
lf := valueof(LAPDm_B_RR(0, 0));
log("ENC RR: ", enc_LapdmFrame(lf));
lf := valueof(LAPDm_B_UA(0, ''O));
log("ENC UA: ", enc_LapdmFrame(lf));
lf := valueof(LAPDm_B_UI(0, ''O));
log("ENC UI: ", enc_LapdmFrame(lf));
log("DEC UI CU: ", dec_LapdmCtrlU('03'O));
log("DEC UI CT: ", dec_LapdmCtrl('03'O));
@ -194,9 +243,12 @@ module L1CTL_Test {
control {
execute(TC_foo());
execute(TC_sabm_ua_dcch_sapi0());
/*
execute(TC_sabm_ua_dcch_sapi0_nopayload());
execute(TC_sabm_ua_dcch_sapi3());
execute(TC_sabm_ua_dcch_sapi4());
execute(TC_sabm_contention());
execute(TC_sabm_retransmit());
*/
}
}

View File

@ -3,6 +3,7 @@
* all kinds of hand-crafted LAPDm frames for testing of the remote LAPDm layer */
module LAPDm_RAW_PT {
import from GSM_Types all;
import from GSM_RR_Types all;
import from Osmocom_Types all;
import from L1CTL_Types all;
import from L1CTL_PortType all;

View File

@ -40,21 +40,21 @@ module LAPDm_Types {
};
type record LapdmCtrlI {
BIT1 spare,
BIT1 spare ('0'B),
uint3_t n_s,
boolean p,
uint3_t n_r
} with { variant "FIELDORDER(lsb)" };
type record LapdmCtrlS {
BIT2 spare,
BIT2 spare ('01'B),
LapdmSBits s,
boolean p_f,
uint3_t n_r
} with { variant "FIELDORDER(lsb)" };
type record LapdmCtrlU {
BIT2 spare,
BIT2 spare ('11'B),
LapdmU2Bits u2,
boolean p_f,
LapdmUBits u

View File

@ -18,5 +18,5 @@ gen_links $DIR $FILES
DIR=../library
FILES="General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn L1CTL_PortType.ttcn L1CTL_Types.ttcn"
FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn RLCMAC_CSN1_Types.ttcn Osmocom_Types.ttcn L1CTL_PortType.ttcn L1CTL_Types.ttcn"
gen_links $DIR $FILES

View File

@ -5,5 +5,5 @@ FILES="*.ttcn UD_PT.cc UD_PT.hh"
ttcn3_makefilegen -f L1CTL_Test.ttcn $FILES
sed -i -e 's/# TTCN3_DIR = /TTCN3_DIR = \/usr/' Makefile
sed -i -e 's/LDFLAGS = /LDFLAGS = -L \/usr\/lib\/titan `pkg-config --libs libnetfilter_conntrack`/' Makefile
sed -i -e 's/TTCN3_LIB = ttcn3-parallel/TTCN3_LIB = ttcn3/' Makefile
#sed -i -e 's/TTCN3_LIB = ttcn3-parallel/TTCN3_LIB = ttcn3/' Makefile
sed -i -e 's/CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)\/include/CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)\/include -I\/usr\/include\/titan/' Makefile