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_Types.ttcn b/lapd/L1CTL_Types.ttcn
index 2b9219c..e4bbcf1 100644
--- a/lapd/L1CTL_Types.ttcn
+++ b/lapd/L1CTL_Types.ttcn
@@ -301,4 +301,149 @@
with { extension "prototype(convert) decode(RAW)" };
+
+
+ /* for generating RESET_REQ */
+ template L1ctlUlMessage t_L1ctlResetReq(template L1ctlResetType rst_type) := {
+ header := t_L1ctlHeader(L1CTL_RESET_REQ),
+ ul_info := omit,
+ payload := {
+ reset_req := {
+ reset_type := rst_type,
+ padding := '000000'O
+ }
+ }
+ };
+
+ /* for generating FBSB_REQ */
+ template L1ctlUlMessage t_L1CTL_FBSB_REQ(template Arfcn arfcn, template L1ctlFbsbFlags flags, uint8_t sync_info_idx, L1ctlCcchMode ccch_mode, GsmRxLev rxlev_exp) := {
+ header := t_L1ctlHeader(L1CTL_FBSB_REQ),
+ ul_info := omit,
+ payload := {
+ fbsb_req := {
+ arfcn := arfcn,
+ timeout_tdma_frames := 10,
+ freq_err_thresh1 := 10000,
+ freq_err_thresh2 := 800,
+ num_freqerr_avg := 3,
+ flags := flags,
+ sync_info_idx := sync_info_idx,
+ ccch_mode := ccch_mode,
+ rxlev_exp := rxlev_exp
+ }
+ }
+ };
+
+ /* for matching against incoming FBSB_CONF */
+ template L1ctlDlMessage t_L1CTL_FBSB_CONF(template uint8_t result) := {
+ header := t_L1ctlHeader(L1CTL_FBSB_CONF),
+ dl_info := ?,
+ payload := {
+ fbsb_conf := {
+ initial_freq_err := ?,
+ result := result,
+ bsic := ?
+ }
+ }
+ };
+
+ template L1ctlUlMessage t_L1CTL_RACH_REQ(uint8_t ra, uint8_t combined, uint16_t offset) := {
+ header := t_L1ctlHeader(L1CTL_RACH_REQ),
+ ul_info := {
+ chan_nr := t_RslChanNr_RACH(0),
+ link_id := ts_RslLinkID_DCCH(0),
+ padding := '0000'O
+ },
+ payload := {
+ rach_req := {
+ ra := ra,
+ combined := combined,
+ offset := offset
+ }
+ }
+ }
+
+ template L1ctlUlMessage t_L1CTL_DM_EST_REQ(Arfcn arfcn, RslChannelNr chan_nr, GsmTsc tsc) := {
+ header := t_L1ctlHeader(L1CTL_DM_EST_REQ),
+ ul_info := {
+ chan_nr := chan_nr,
+ link_id := ts_RslLinkID_DCCH(0),
+ padding := '0000'O
+ },
+ payload := {
+ dm_est_req := {
+ tsc := tsc,
+ h := 0,
+ arfcn := arfcn,
+ hopping := omit,
+ tch_mode := 0,
+ audio_mode := t_L1CTL_AudioModeNone
+ }
+ }
+ }
+
+ template L1ctlUlMessage t_L1CTL_DM_REL_REQ(RslChannelNr chan_nr) := {
+ header := t_L1ctlHeader(L1CTL_DM_EST_REQ),
+ ul_info := {
+ chan_nr := chan_nr,
+ link_id := ts_RslLinkID_DCCH(0),
+ padding := '0000'O
+ },
+ payload := {
+ other := ''O
+ }
+ }
+
+ template L1ctlUlMessage t_L1CTL_DATA_REQ(template RslChannelNr chan_nr, template RslLinkId link_id, octetstring l2_data) := {
+ header := t_L1ctlHeader(L1CTL_DATA_REQ),
+ ul_info := {
+ chan_nr := chan_nr,
+ link_id := link_id,
+ padding := '0000'O
+ },
+ payload := {
+ other := l2_data
+ }
+ }
+
+ /* for matching against incoming RACH_CONF */
+ template L1ctlDlMessage t_L1CTL_RACH_CONF := {
+ header := t_L1ctlHeader(L1CTL_RACH_CONF),
+ dl_info := ?,
+ payload := ?
+ };
+
+ /* for matching against incoming RACH_CONF */
+ template L1ctlDlMessage t_L1CTL_DATA_IND(template RslChannelNr chan_nr) := {
+ header := t_L1ctlHeader(L1CTL_DATA_IND),
+ dl_info := {
+ chan_nr := chan_nr,
+ link_id := ?,
+ arfcn := ?,
+ frame_nr := ?,
+ rx_level := ?,
+ snr := ?,
+ num_biterr := ?,
+ fire_crc := ?
+ },
+ payload := {
+ data_ind := ?
+ }
+ };
+
+ template GsmRrMessage t_RR_IMM_ASS(uint8_t ra, uint8_t fn) := {
+ header := t_RrHeader(IMMEDIATE_ASSIGNMENT, ?),
+ payload := {
+ imm_ass := {
+ ded_or_tbf := ?,
+ page_mode := ?,
+ chan_desc := ?,
+ pkt_chan_desc := omit,
+ req_ref := f_compute_ReqRef(ra, fn),
+ timing_advance := ?,
+ mobile_allocation := ?
+ }
+ }
+ };
+
} with { encode "RAW" };