fixup library/PCUIF_Types: version 10: do not add redundant padding

Unlike osmo-pcu, osmo-bts does check length of the messages received
over the PCU interface, so I7a532d7abff8af354e40c5d706bb882efc6f905f
caused all the related test cases in ttcn3-bts-test to fail.

Reverting it is not a solution, because we cannot maintain different
padding attributes for two different protocol versions.  Let's add
a wrapper function that would call enc_PCUIF_Message() and append
padding depending on the configured protocol version.  In addition,
let's add a module parameter that would allow us to (optionally)
disable padding for ttcn3-pcu-test.

This change makes all broken PCUIF specific test cases pass.

Change-Id: Ica9e0c49c8b16e7d585a481670762c6433c61118
This commit is contained in:
Vadim Yanitskiy 2020-09-15 19:15:01 +07:00
parent ad70991d51
commit 220fa204da
2 changed files with 23 additions and 1 deletions

View File

@ -23,7 +23,7 @@ type record PCUIF_send_data {
private function PCUIF_to_UD(in PCUIF_send_data pin, out UD_send_data pout) {
pout.id := pin.id;
pout.data := enc_PCUIF_Message(pin.data);
pout.data := enc_pad_PCUIF_Message(pin.data);
} with { extension "prototype(fast)" };
private function fix_padding(inout PCUIF_data data) {

View File

@ -18,6 +18,8 @@ import from Native_Functions all;
modulepar {
/* PCUIF version supported by the IUT */
PCUIF_Version mp_pcuif_version := 9;
/* Whether to pad outgoing messages */
boolean mp_pcuif_padding := true;
};
const charstring PCU_SOCK_DEFAULT := "/tmp/pcu_bts";
@ -317,6 +319,26 @@ external function enc_PCUIF_Message(in PCUIF_Message pdu) return octetstring
external function dec_PCUIF_Message(in octetstring stream) return PCUIF_Message
with { extension "prototype(convert) decode(RAW)" };
function enc_pad_PCUIF_Message(in PCUIF_Message pdu)
return octetstring {
var octetstring stream;
var integer len;
stream := enc_PCUIF_Message(pdu);
if (not mp_pcuif_padding) {
return stream;
}
select (mp_pcuif_version) {
case (9) { len := 212; }
/* FIXME: 1006 % 4 > 0 (alignment) */
case (10) { len := 1006; }
case else { len := 0; }
}
return f_pad_oct(stream, len, '00'O);
}
/* Generic template for matching messages by type and/or the BTS number */
template PCUIF_Message tr_PCUIF_MSG(template PCUIF_MsgType msg_type := ?,