l1ctl/lapdm test infrastructure: Move helper functions out
moving all templates into L1CTL_Types as well as helper functions into
L1CTL_PortType allows us to have a clean L1CTL_Test.ttcn where we can
focus on actual test cases. At the moment it's just a PoC that can
establish dedicated mode and send a SABM frame to the BTS, which is
properly echo'ed back in the UA, as expected for contention resolution.
diff --git a/lapd/L1CTL_PortType.ttcn b/lapd/L1CTL_PortType.ttcn
index d726ce4..92d3d11 100644
--- a/lapd/L1CTL_PortType.ttcn
+++ b/lapd/L1CTL_PortType.ttcn
@@ -3,6 +3,8 @@
import from L1CTL_Types all;
import from UD_PortType all;
import from UD_Types all;
+ import from Osmocom_Types all;
+ import from GSM_Types all;
type record L1CTL_connect {
charstring path
@@ -13,6 +15,59 @@
charstring err optional
}
+ function f_L1CTL_FBSB(L1CTL_PT pt, Arfcn arfcn, L1ctlCcchMode ccch_mode := CCCH_MODE_COMBINED) {
+ timer T := 5.0;
+ pt.send(t_L1CTL_FBSB_REQ(arfcn, t_L1CTL_FBSB_F_ALL, 0, ccch_mode, 0));
+ T.start
+ alt {
+ [] pt.receive(t_L1CTL_FBSB_CONF(0)) {};
+ [] pt.receive { repeat; };
+ [] T.timeout { setverdict(fail, "Timeout in FBSB") };
+ }
+ }
+
+ function f_L1CTL_RACH(L1CTL_PT pt, uint8_t ra, uint8_t combined := 1, uint16_t offset := 0) return GsmFrameNumber {
+ var L1ctlDlMessage rc;
+ var GsmFrameNumber fn;
+ timer T := 2.0;
+ T.start
+ pt.send(t_L1CTL_RACH_REQ(ra, 0, 0))
+ alt {
+ [] pt.receive(t_L1CTL_RACH_CONF) -> value rc { fn := rc.dl_info.frame_nr };
+ [] pt.receive { repeat; };
+ [] T.timeout { setverdict(fail, "Timeout in RACH") };
+ }
+ return fn;
+ }
+
+ function f_L1CTL_WAIT_IMM_ASS(L1CTL_PT pt, uint8_t ra, GsmFrameNumber rach_fn) return ImmediateAssignment {
+ var L1ctlDlMessage dl;
+ var GsmRrMessage rr;
+ timer T := 10.0;
+ T.start;
+ alt {
+ [] pt.receive(t_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0))) -> value dl {
+ rr := dec_GsmRrMessage(dl.payload.data_ind.payload);
+ log("PCH/AGCN DL RR: ", rr);
+ if (match(rr, t_RR_IMM_ASS(ra, rach_fn))) {
+ log("Received IMM.ASS for our RACH!");
+ } else {
+ repeat;
+ }
+ };
+ [] pt.receive { repeat };
+ [] T.timeout { setverdict(fail, "Timeout waiting for IMM ASS") };
+ }
+ T.stop;
+ return rr.payload.imm_ass;
+ }
+
+ /* Send DM_EST_REQ from parameters derived from IMM ASS */
+ function f_L1CTL_DM_EST_REQ_IA(L1CTL_PT pt, ImmediateAssignment imm_ass) {
+ pt.send(t_L1CTL_DM_EST_REQ({ false, imm_ass.chan_desc.arfcn }, imm_ass.chan_desc.chan_nr, imm_ass.chan_desc.tsc));
+ }
+
+
private function L1CTL_to_UD_connect(in L1CTL_connect pin, out UD_connect pout) {
pout.path := pin.path;
pout.id := 0;