2017-07-16 05:35:10 +00:00
|
|
|
module L1CTL_Test {
|
|
|
|
import from GSM_Types all;
|
|
|
|
import from Osmocom_Types all;
|
|
|
|
import from L1CTL_Types all;
|
2017-07-16 13:44:44 +00:00
|
|
|
import from L1CTL_PortType all;
|
2017-07-16 05:35:10 +00:00
|
|
|
|
|
|
|
const octetstring c_ul_param_req := '1300000000000000001d0000'O;
|
|
|
|
const octetstring c_ul_data_req := '060a0128284018001d000103490615004001c0000000000000000000000000'O;
|
|
|
|
const octetstring c_ul_ccch_mode_req := '1000000002000000'O;
|
|
|
|
const octetstring c_ul_reset_req := '0d00000002000000'O;
|
|
|
|
const octetstring c_ul_dm_est_req := '050000002800000007000367000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005'O;
|
|
|
|
const octetstring c_ul_rach_req := '040000000000000012010008'O;
|
|
|
|
|
|
|
|
const octetstring c_dl_data_ind := '03000000900003670015f5613f3f00002d063f0328e36712ead000002b2b2b2b2b2b2b2b2b2b2b'O;
|
|
|
|
|
|
|
|
type component dummy_CT {
|
2017-07-16 13:44:44 +00:00
|
|
|
var charstring l1ctl_sock_path := "/tmp/osmocom_l2";
|
|
|
|
port L1CTL_PT L1CTL;
|
2017-07-16 05:35:10 +00:00
|
|
|
};
|
|
|
|
|
2017-07-16 19:05:18 +00:00
|
|
|
/* for generating RESET_REQ */
|
2017-07-16 13:44:44 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-07-16 19:05:18 +00:00
|
|
|
/* 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 := ?
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-07-16 13:44:44 +00:00
|
|
|
|
|
|
|
function f_init() runs on dummy_CT {
|
|
|
|
map(self:L1CTL, system:L1CTL);
|
|
|
|
L1CTL.send(L1CTL_connect:{path:=l1ctl_sock_path});
|
|
|
|
L1CTL.receive(L1CTL_connect_result:{result_code := SUCCESS, err:=omit});
|
2017-07-16 19:05:18 +00:00
|
|
|
|
|
|
|
L1CTL.send(t_L1ctlResetReq(L1CTL_RES_T_SCHED));
|
|
|
|
L1CTL.receive;
|
2017-07-16 13:44:44 +00:00
|
|
|
}
|
|
|
|
|
2017-07-16 05:35:10 +00:00
|
|
|
testcase TC_si1() runs on dummy_CT {
|
|
|
|
log("L1CTL_PARAM_REQ: ", dec_L1ctlUlMessage(c_ul_param_req));
|
|
|
|
log("L1CTL_DATA_REQ: ", dec_L1ctlUlMessage(c_ul_data_req));
|
|
|
|
log("L1CTL_CCCH_MODE_REQ: ", dec_L1ctlUlMessage(c_ul_ccch_mode_req));
|
|
|
|
log("L1CTL_RESET_REQ: ", dec_L1ctlUlMessage(c_ul_reset_req));
|
|
|
|
log("L1CTL_DM_EST_REQ: ", dec_L1ctlUlMessage(c_ul_dm_est_req));
|
|
|
|
log("L1CTL_RACH_REQ: ", dec_L1ctlUlMessage(c_ul_rach_req));
|
|
|
|
log("L1CTL_DATA_IND: ", dec_L1ctlDlMessage(c_dl_data_ind));
|
|
|
|
setverdict(pass);
|
|
|
|
}
|
2017-07-16 13:44:44 +00:00
|
|
|
|
2017-07-16 19:05:18 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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 := ?
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
2017-07-16 13:44:44 +00:00
|
|
|
testcase TC_l1ctl() runs on dummy_CT {
|
2017-07-16 19:05:18 +00:00
|
|
|
var GsmFrameNumber rach_fn;
|
|
|
|
var uint8_t ra := 23;
|
|
|
|
var ImmediateAssignment imm_ass;
|
|
|
|
|
2017-07-16 13:44:44 +00:00
|
|
|
f_init();
|
2017-07-16 19:05:18 +00:00
|
|
|
/* send FB/SB req to sync to cell */
|
|
|
|
f_L1CTL_FBSB(L1CTL, { false, 871 }, CCCH_MODE_COMBINED);
|
|
|
|
/* send RACH request and obtain FN at which it was sent */
|
|
|
|
rach_fn := f_L1CTL_RACH(L1CTL, ra);
|
|
|
|
/* wait for receiving matching IMM ASS */
|
|
|
|
imm_ass := f_L1CTL_WAIT_IMM_ASS(L1CTL, ra, rach_fn)
|
|
|
|
/* send DM_EST_REQ */
|
|
|
|
f_L1CTL_DM_EST_REQ_IA(L1CTL, imm_ass);
|
|
|
|
|
|
|
|
L1CTL.send(t_L1CTL_DATA_REQ(imm_ass.chan_desc.chan_nr, ts_RslLinkID_DCCH(0), '000102030405060708090a0b0c0d0e0f10111213141516'O));
|
|
|
|
L1CTL.send(t_L1CTL_DATA_REQ(imm_ass.chan_desc.chan_nr, ts_RslLinkID_DCCH(0), '000102030405060708090a0b0c0d0e0f10111213141516'O));
|
|
|
|
L1CTL.send(t_L1CTL_DATA_REQ(imm_ass.chan_desc.chan_nr, ts_RslLinkID_DCCH(0), '000102030405060708090a0b0c0d0e0f10111213141516'O));
|
|
|
|
|
|
|
|
L1CTL.send(t_L1CTL_DM_REL_REQ(imm_ass.chan_desc.chan_nr));
|
|
|
|
|
|
|
|
setverdict(pass);
|
2017-07-16 13:44:44 +00:00
|
|
|
}
|
2017-07-16 19:05:18 +00:00
|
|
|
|
2017-07-16 05:35:10 +00:00
|
|
|
control {
|
|
|
|
execute(TC_si1());
|
2017-07-16 13:44:44 +00:00
|
|
|
execute(TC_l1ctl());
|
2017-07-16 05:35:10 +00:00
|
|
|
}
|
|
|
|
}
|