library/GSM_RR_Types.ttcn: introduce generic tr_IMM_TBF_ASS
Both 't_IMM_ASS_TBF_DL' and 't_RR_IMM_ASS_TBF_DL' templates were
introduced for a specific task - matching Packet Immediate
Assignment (Downlink TBF) by TLLI.
In the upcoming changes we will also need to match Uplink TBF
assignment, and more generic fields such as Timing Advance.
Let's add a generic template for Packet Immediate Assignment
and allow passing IaRestOctets as a parameter.
Change-Id: I492cf990820ba153ea71469b8b623e56e031e549
diff --git a/library/GSM_RR_Types.ttcn b/library/GSM_RR_Types.ttcn
index 3d2f76a..70009ac 100644
--- a/library/GSM_RR_Types.ttcn
+++ b/library/GSM_RR_Types.ttcn
@@ -884,6 +884,32 @@
}
};
+ /* TODO: implement send version of this template */
+ template GsmRrMessage tr_IMM_TBF_ASS(template boolean dl := ?,
+ template uint8_t ra := ?,
+ template GsmFrameNumber fn := ?,
+ template TimingAdvance ta := ?,
+ template PacketChannelDescription ch_desc := ?,
+ template IaRestOctets rest := ?) := {
+ header := t_RrHeader(IMMEDIATE_ASSIGNMENT, ?),
+ payload := {
+ imm_ass := {
+ ded_or_tbf := {
+ spare := ?,
+ tma := ?,
+ downlink := dl,
+ tbf := true
+ },
+ page_mode := ?,
+ chan_desc := omit,
+ pkt_chan_desc := ch_desc,
+ req_ref := tr_compute_ReqRef(ra, fn),
+ timing_advance := ta,
+ mobile_allocation := ?,
+ rest_octets := rest
+ }
+ }
+ };
template (value) GsmRrL3Message ts_MEAS_REP(boolean valid, uint6_t rxl_f, uint6_t rxl_s,
uint3_t rxq_f, uint3_t rxq_s,
@@ -908,37 +934,4 @@
}
};
- /* TODO: introduce generic TBF Assignment template for DL and UL */
- template ImmediateAssignment t_IMM_ASS_TBF_DL(template GprsTlli tlli) := {
- ded_or_tbf := {
- spare := ?,
- tma := ?,
- downlink := ?,
- tbf := true
- },
- page_mode := ?,
- chan_desc := omit,
- pkt_chan_desc := {
- channel_Type_spare := ?,
- tn := ?,
- tsc := ?,
- presence := ?,
- zero := *,
- one := omit
- },
- req_ref := ?,
- timing_advance := ?,
- mobile_allocation := ?,
- rest_octets := tr_IaRestOctets_DLAss(tr_PacketDlAssign(tlli))
- };
-
- template GsmRrMessage t_RR_IMM_ASS_TBF_DL(template GprsTlli tlli) := {
- header := t_RrHeader(IMMEDIATE_ASSIGNMENT, ?),
- payload := {
- imm_ass := t_IMM_ASS_TBF_DL(tlli)
- }
- };
-
-
-
} with { encode "RAW" ; variant "FIELDORDER(msb)" }
diff --git a/library/L1CTL_PortType.ttcn b/library/L1CTL_PortType.ttcn
index 2423715..3c83c3d 100644
--- a/library/L1CTL_PortType.ttcn
+++ b/library/L1CTL_PortType.ttcn
@@ -152,15 +152,18 @@
}
function f_L1CTL_WAIT_IMM_ASS_TBF_DL(L1CTL_PT pt, GprsTlli tlli) return ImmediateAssignment {
+ var template PacketDlAssign dl_ass := tr_PacketDlAssign(tlli);
+ var template IaRestOctets rest := tr_IaRestOctets_DLAss(dl_ass);
var L1ctlDlMessage dl;
var GsmRrMessage rr;
timer T := 10.0;
T.start;
alt {
[] pt.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0))) -> value dl {
+ /* TODO: use decmatch tr_IaRestOctets_DLAss(...) instead */
rr := dec_GsmRrMessage(dl.payload.data_ind.payload);
log("PCH/AGCN DL RR: ", rr);
- if (match(rr, t_RR_IMM_ASS_TBF_DL(tlli))) {
+ if (match(rr, tr_IMM_TBF_ASS(dl := true, rest := rest))) {
log("Received IMM.ASS for our TLLI!");
} else {
repeat;
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index 4ef71fa..838b6e1 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -591,6 +591,8 @@
}
function f_wait_tbf_dl(TbfNr tbf_nr, GprsTlli tlli) runs on dummy_CT return ImmediateAssignment {
+ var template PacketDlAssign dl_ass := tr_PacketDlAssign(tlli);
+ var template IaRestOctets rest := tr_IaRestOctets_DLAss(dl_ass);
var LAPDm_ph_data ph_data;
var GsmRrMessage rr;
timer T := 10.0;
@@ -599,7 +601,7 @@
[] L1.receive(LAPDm_ph_data:{sacch:=?,sapi:=0,lapdm:={bbis:=?}}) -> value ph_data {
rr := dec_GsmRrMessage(ph_data.lapdm.bbis.payload);
log("PCH/AGCH DL RR: ", rr);
- if (match(rr, t_RR_IMM_ASS_TBF_DL(tlli))) {
+ if (match(rr, tr_IMM_TBF_ASS(dl := true, rest := rest))) {
var TbfPars tbf_pars := valueof(t_TbfParsInit);
log("Received IMM.ASS for our TLLI!");
tbf_pars.tfi[rr.payload.imm_ass.pkt_chan_desc.tn] :=