library/PCUIF_Types: clean up, drop remains of PCUIFv10

Change-Id: Ibfe8558cb9f335d8c29348063b0ff02b138dd4c7
Related: osmo-pcu.git I68a3f59d5c960ae3a4fbd74f9d4a894295cb9ed8
Related: docker-playground.git If0b2209af645f391817f65b4227736b52ca59e2e
Related: docker-playground.git I70f0c30d6c514614095dcbbcac5d025001861fbc
Related: OS#6191
This commit is contained in:
Vadim Yanitskiy 2023-12-15 15:19:09 +07:00 committed by fixeria
parent 284387a865
commit 8f86bbee5a
4 changed files with 51 additions and 160 deletions

View File

@ -5790,17 +5790,13 @@ testcase TC_pcu_data_req_pch() runs on test_CT {
f_TC_pcu_act_req(0, 0, 7, true);
if (mp_pcuif_version < 11) {
/* three characters prefix: last 3 digits of IMSI as ASCII */
f_pcu_data_req(0, 0, 0, 0, 0, PCU_IF_SAPI_PCH, '313233'O & c_PCU_DATA);
} else {
var PCUIF_pch pch;
pch.msg_id := '01020304'O;
pch.imsi := "00101000000000123";
pch.data := c_PCU_DATA;
pch.confirm := false;
f_pcu_data_req(0, 0, 0, 0, 0, PCU_IF_SAPI_PCH_2, enc_PCUIF_pch(pch));
}
var PCUIF_pch pch := {
msg_id := '01020304'O,
imsi := "00101000000000123",
data := c_PCU_DATA,
confirm := false
};
f_pcu_data_req(0, 0, 0, 0, 0, PCU_IF_SAPI_PCH_2, enc_PCUIF_pch(pch));
T.start;
alt {

View File

@ -38,7 +38,6 @@ private function UD_to_PCUIF(in UD_send_data pin, out PCUIF_send_data pout) {
/* HACK: fix padding in decoded message. Due to a bug in TITAN, we
* cannot just use its 'PADDING' attribute because it breaks decoding. */
if (ischosen(pout.data.u.data_req)) { fix_padding(pout.data.u.data_req); }
if (ischosen(pout.data.u.data_cnf)) { fix_padding(pout.data.u.data_cnf); }
if (ischosen(pout.data.u.data_ind)) { fix_padding(pout.data.u.data_ind); }
} with { extension "prototype(fast)" };
@ -141,27 +140,15 @@ function f_pcuif_listen(PCUIF_CODEC_PT pt, charstring sock) return integer {
function f_PCUIF_tx_imm_ass_pch(PCUIF_CODEC_PT pt, integer conn_id, octetstring imm_ass, hexstring imsi,
uint8_t bts_nr := 0, boolean wait_for_cnf := true, OCT4 msg_id := '01020304'O) {
var PCUIF_send_data sd;
timer T := 3.0;
if (mp_pcuif_version < 11) {
/* append 3 last imsi digits so that the BTS is able to compute paging group */
var hexstring last_digits := substr(imsi, lengthof(imsi)-3, 3);
log("3 last imsi digits: ", last_digits);
var octetstring prefix := ''O;
for (var integer i := 0; i < 3; i := i+1) {
prefix := prefix & int2oct(hex2int('30'H) + hex2int(last_digits[i]), 1);
}
pt.send(t_SD_PCUIF(conn_id,
ts_PCUIF_DATA_REQ(bts_nr, 0, 0, 0, 0, PCU_IF_SAPI_PCH, prefix & imm_ass)));
} else {
var PCUIF_pch pch;
pch.msg_id := msg_id;
pch.imsi := hex2str(imsi);
pch.data := imm_ass;
pch.confirm := true;
pt.send(t_SD_PCUIF(conn_id, ts_PCUIF_DATA_REQ(bts_nr, 0, 0, 0, 0, PCU_IF_SAPI_PCH_2, enc_PCUIF_pch(pch))));
}
var PCUIF_pch pch := {
msg_id := msg_id,
imsi := hex2str(imsi),
data := imm_ass,
confirm := true
};
pt.send(t_SD_PCUIF(conn_id, ts_PCUIF_DATA_REQ(bts_nr, 0, 0, 0, 0, PCU_IF_SAPI_PCH_2, enc_PCUIF_pch(pch))));
/* Exit early when the caller is not interested in the confirmation message */
if (wait_for_cnf == false) {
@ -170,23 +157,8 @@ function f_PCUIF_tx_imm_ass_pch(PCUIF_CODEC_PT pt, integer conn_id, octetstring
T.start;
alt {
[] pt.receive(t_SD_PCUIF(conn_id, tr_PCUIF_DATA_CNF(bts_nr, 0, 0, PCU_IF_SAPI_PCH))) -> value sd {
if (mp_pcuif_version >= 11) {
setverdict(fail, "expecting tr_PCUIF_DATA_CNF_2 in PCUIF v.11 or later");
mtc.stop;
} else {
log("IMM.ASS was sent on PCH at fn ", sd.data.u.data_cnf.fn);
return;
}
}
[] pt.receive(t_SD_PCUIF(conn_id, tr_PCUIF_DATA_CNF_2(bts_nr, PCU_IF_SAPI_PCH_2))) -> value sd {
if (mp_pcuif_version < 11) {
setverdict(fail, "expecting tr_PCUIF_DATA_CNF in PCUIF v.10 or earlier");
mtc.stop;
} else {
log("IMM.ASS was sent on PCH");
return;
}
[] pt.receive(t_SD_PCUIF(conn_id, tr_PCUIF_DATA_CNF_2(bts_nr, PCU_IF_SAPI_PCH_2))) {
log("IMM.ASS was sent on PCH");
}
[] pt.receive { repeat; }
[] T.timeout {
@ -200,22 +172,14 @@ function f_PCUIF_tx_imm_ass_pch(PCUIF_CODEC_PT pt, integer conn_id, octetstring
* blocks that contain actually a valid immediate assignment message. Otherweise no confirmation is sent back */
function f_PCUIF_tx_mac_block_agch(PCUIF_CODEC_PT pt, integer conn_id, octetstring mac_block, boolean confirm := true,
uint8_t bts_nr := 0, boolean wait_for_cnf := true, OCT4 msg_id := '01020304'O) {
var PCUIF_send_data sd;
timer T := 3.0;
if (mp_pcuif_version < 11) {
if (wait_for_cnf == true) {
setverdict(fail, "confirmation for AGCH not supported in PCUIF v.10 or earlier");
}
pt.send(t_SD_PCUIF(conn_id,
ts_PCUIF_DATA_REQ(bts_nr, 0, 0, 0, 0, PCU_IF_SAPI_AGCH, mac_block)));
} else {
var PCUIF_agch agch;
agch.msg_id := msg_id;
agch.data := mac_block;
agch.confirm := confirm;
pt.send(t_SD_PCUIF(conn_id, ts_PCUIF_DATA_REQ(bts_nr, 0, 0, 0, 0, PCU_IF_SAPI_AGCH_2, enc_PCUIF_agch(agch))));
}
var PCUIF_agch agch := {
msg_id := msg_id,
data := mac_block,
confirm := confirm
};
pt.send(t_SD_PCUIF(conn_id, ts_PCUIF_DATA_REQ(bts_nr, 0, 0, 0, 0, PCU_IF_SAPI_AGCH_2, enc_PCUIF_agch(agch))));
/* Exit early when the caller is not interested in the confirmation message */
if (wait_for_cnf == false) {
@ -224,14 +188,8 @@ function f_PCUIF_tx_mac_block_agch(PCUIF_CODEC_PT pt, integer conn_id, octetstri
T.start;
alt {
[] pt.receive(t_SD_PCUIF(conn_id, tr_PCUIF_DATA_CNF_2(bts_nr, PCU_IF_SAPI_AGCH_2))) -> value sd {
if (mp_pcuif_version < 11) {
setverdict(fail, "got tr_PCUIF_DATA_CNF_DT, but AGCH confirmation is not supported in PCUIF v.10 or earlier");
mtc.stop;
} else {
log("IMM.ASS was sent on AGCH");
return;
}
[] pt.receive(t_SD_PCUIF(conn_id, tr_PCUIF_DATA_CNF_2(bts_nr, PCU_IF_SAPI_AGCH_2))) {
log("IMM.ASS was sent on AGCH");
}
[] pt.receive { repeat; }
[] T.timeout {

View File

@ -21,11 +21,11 @@ modulepar {
};
const charstring PCU_SOCK_DEFAULT := "/tmp/pcu_bts";
type integer PCUIF_Version (9..12); /* supported versions */
type integer PCUIF_Version (11..12); /* supported versions */
type enumerated PCUIF_MsgType {
PCU_IF_MSG_DATA_REQ ('00'O),
PCU_IF_MSG_DATA_CNF ('01'O),
/* RFU, removed in PCUIFv11 ('01'O), */
PCU_IF_MSG_DATA_IND ('02'O),
PCU_IF_MSG_SUSP_REQ ('03'O),
PCU_IF_MSG_APP_INFO_REQ ('04'O),
@ -48,8 +48,8 @@ type enumerated PCUIF_MsgType {
type enumerated PCUIF_Sapi {
PCU_IF_SAPI_UNKNOWN ('00'O),
PCU_IF_SAPI_RACH ('01'O),
PCU_IF_SAPI_AGCH ('02'O),
PCU_IF_SAPI_PCH ('03'O),
/* RFU, removed in PCUIFv11 ('02'O), */
/* RFU, removed in PCUIFv11 ('03'O), */
PCU_IF_SAPI_BCCH ('04'O),
PCU_IF_SAPI_PDTCH ('05'O),
PCU_IF_SAPI_PRACH ('06'O),
@ -361,7 +361,6 @@ external function dec_PCUIF_agch(in octetstring stream) return PCUIF_agch
type union PCUIF_MsgUnion {
PCUIF_data data_req,
PCUIF_data data_cnf,
PCUIF_data_cnf data_cnf2,
PCUIF_data data_ind,
PCUIF_susp_req susp_req,
@ -385,7 +384,6 @@ type record PCUIF_Message {
PCUIF_MsgUnion u
} with { variant (u) "CROSSTAG(
data_req, msg_type = PCU_IF_MSG_DATA_REQ;
data_cnf, msg_type = PCU_IF_MSG_DATA_CNF;
data_cnf2, msg_type = PCU_IF_MSG_DATA_CNF_2;
data_ind, msg_type = PCU_IF_MSG_DATA_IND;
susp_req, msg_type = PCU_IF_MSG_SUSP_REQ;
@ -667,60 +665,6 @@ template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr,
}
}
template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr,
template (value) uint8_t trx_nr,
template (value) uint8_t ts_nr,
template (value) uint8_t block_nr,
template (value) uint32_t fn,
template (value) uint16_t arfcn,
template (value) PCUIF_Sapi sapi,
template (value) octetstring data) := {
msg_type := PCU_IF_MSG_DATA_CNF,
bts_nr := bts_nr,
spare := '0000'O,
u := {
data_cnf := {
sapi := sapi,
len := 0, /* overwritten */
data := data,
fn := fn,
arfcn := arfcn,
trx_nr := trx_nr,
ts_nr := ts_nr,
block_nr := block_nr,
rssi := 0,
ber10k := 0,
ta_offs_qbits := 0,
lqual_cb := 0
}
}
}
template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?,
template uint8_t trx_nr := ?,
template uint8_t ts_nr := ?,
template PCUIF_Sapi sapi := ?,
template octetstring data := ?) := {
msg_type := PCU_IF_MSG_DATA_CNF,
bts_nr := bts_nr,
spare := ?,
u := {
data_cnf := {
sapi := sapi,
len := ?,
data := data,
fn := ?,
arfcn := ?,
trx_nr := trx_nr,
ts_nr := ts_nr,
block_nr := ?,
rssi := ?,
ber10k := ?,
ta_offs_qbits := ?,
lqual_cb := ?
}
}
}
template (value) PCUIF_Message ts_PCUIF_DATA_CNF_2(template (value) uint8_t bts_nr,
template (value) PCUIF_Sapi sapi,
template (value) OCT4 msg_id) := {

View File

@ -502,7 +502,6 @@ runs on RAW_PCU_BTS_CT {
/* Wait until the PCU is connected */
PCUIF.receive(tr_RAW_PCU_EV(PCU_EV_CONNECT));
var template PCUIF_Sapi tr_ccch_sapi := (PCU_IF_SAPI_PCH, PCU_IF_SAPI_PCH_2, PCU_IF_SAPI_AGCH, PCU_IF_SAPI_AGCH_2);
alt {
/* Wait for TXT.ind (PCU_VERSION) and respond with INFO.ind (SI13) */
[] PCUIF.receive(tr_PCUIF_TXT_IND(bts_nr, PCU_VERSION, ?)) -> value pcu_msg {
@ -538,40 +537,34 @@ runs on RAW_PCU_BTS_CT {
"/TS" & int2str(pcu_msg.u.act_req.ts_nr));
repeat;
}
[decode_data_req] PCUIF.receive(tr_PCUIF_DATA_REQ(bts_nr, ?, ?, sapi := tr_ccch_sapi)) -> value pcu_msg {
var octetstring data;
var PCUIF_pch pch;
var PCUIF_agch agch;
[decode_data_req] PCUIF.receive(tr_PCUIF_DATA_REQ(bts_nr, ?, ?, sapi := PCU_IF_SAPI_PCH_2)) -> value pcu_msg {
var charstring imsi_filter_regexp := "(\d*)"; /* numbers only */
var PCUIF_pch pch;
/* On PCH the payload is prefixed with paging group (3 octets): skip it.
* TODO: add an additional template parameter, so we can match it. */
if (pcu_msg.u.data_req.sapi == PCU_IF_SAPI_PCH) {
data := substr(pcu_msg.u.data_req.data, 3, pcu_msg.u.data_req.len - 3);
} else if (pcu_msg.u.data_req.sapi == PCU_IF_SAPI_AGCH) {
data := pcu_msg.u.data_req.data;
}
pcu_msg_rr.bts_nr := bts_nr;
pcu_msg_rr.raw := pcu_msg.u.data_req;
if (pcu_msg_rr.raw.sapi == PCU_IF_SAPI_PCH_2) {
pch := dec_PCUIF_pch(pcu_msg_rr.raw.data);
pcu_msg_rr.msg_id := pch.msg_id;
pcu_msg_rr.imsi := regexp(pch.imsi, imsi_filter_regexp, 0);
pcu_msg_rr.rr_msg := dec_GsmRrMessage(pch.data);
pcu_msg_rr.confirm := pch.confirm;
} else if (pcu_msg_rr.raw.sapi == PCU_IF_SAPI_AGCH_2) {
agch := dec_PCUIF_agch(pcu_msg_rr.raw.data);
pcu_msg_rr.imsi := omit;
pcu_msg_rr.msg_id := agch.msg_id;
pcu_msg_rr.rr_msg := dec_GsmRrMessage(agch.data);
pcu_msg_rr.confirm := agch.confirm;
} else {
pcu_msg_rr.msg_id := omit;
pcu_msg_rr.imsi := omit;
pcu_msg_rr.rr_msg := dec_GsmRrMessage(data);
pcu_msg_rr.confirm := omit;
}
pch := dec_PCUIF_pch(pcu_msg_rr.raw.data);
pcu_msg_rr.msg_id := pch.msg_id;
pcu_msg_rr.imsi := regexp(pch.imsi, imsi_filter_regexp, 0);
pcu_msg_rr.rr_msg := dec_GsmRrMessage(pch.data);
pcu_msg_rr.confirm := pch.confirm;
TC.send(pcu_msg_rr);
repeat;
}
[decode_data_req] PCUIF.receive(tr_PCUIF_DATA_REQ(bts_nr, ?, ?, sapi := PCU_IF_SAPI_AGCH_2)) -> value pcu_msg {
var PCUIF_agch agch;
pcu_msg_rr.bts_nr := bts_nr;
pcu_msg_rr.raw := pcu_msg.u.data_req;
agch := dec_PCUIF_agch(pcu_msg_rr.raw.data);
pcu_msg_rr.imsi := omit;
pcu_msg_rr.msg_id := agch.msg_id;
pcu_msg_rr.rr_msg := dec_GsmRrMessage(agch.data);
pcu_msg_rr.confirm := agch.confirm;
TC.send(pcu_msg_rr);
repeat;
}