bsc: Fix encoding of 2-digit MNC (paging tests)

The TTCN-3 data types are abstract data types,  Encoding artefacts
like 'F' for padding shouldn't be seen by the user.  Hence, let's
pass a 2-digit-long or 3-digit-long hexstring into the encoder
functions and let them determine if they should introduce any 'F'
for padding or not.

Change-Id: If4d3dfc16381493d7e710be746ed963975051fc1
This commit is contained in:
Harald Welte 2018-03-17 19:27:53 +01:00
parent 2caa106251
commit 24135bd27f
2 changed files with 3 additions and 3 deletions

View File

@ -949,7 +949,7 @@ type record Cell_Identity {
GsmLac lac,
GsmCellId ci
};
private const Cell_Identity cid := { '001'H, 'f01'H, 1, 0 };
private const Cell_Identity cid := { '001'H, '01'H, 1, 0 };
type set of integer BtsIdList;

View File

@ -665,8 +665,8 @@ template BSSMAP_FIELD_CellIdentificationList ts_BSSMAP_CIL_noCell := {
}
private function f_enc_mcc_mnc(GsmMcc mcc, GsmMnc mnc) return OCT3 {
if (mnc[0] == 'f'H) {
return hex2oct(mcc[1] & mcc[0] & mnc[0] & mcc[2] & mnc[2] & mnc[1]);
if (lengthof(mnc) == 2) {
return hex2oct(mcc[1] & mcc[0] & 'F'H & mcc[2] & mnc[1] & mnc[0]);
} else {
return hex2oct(mcc[1] & mcc[0] & mnc[2] & mcc[2] & mnc[1] & mnc[0]);
}