[MERGED] osmo-ttcn3-hacks[master]: bsc: Fix encoding of 2-digit MNC (paging tests)

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Mar 17 19:34:49 UTC 2018


Harald Welte has submitted this change and it was merged.

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


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
---
M bsc/BSC_Tests.ttcn
M library/BSSMAP_Templates.ttcn
2 files changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 355f3e2..a0e0559 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -949,7 +949,7 @@
 	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;
 
diff --git a/library/BSSMAP_Templates.ttcn b/library/BSSMAP_Templates.ttcn
index 5d2bff2..5d13899 100644
--- a/library/BSSMAP_Templates.ttcn
+++ b/library/BSSMAP_Templates.ttcn
@@ -665,8 +665,8 @@
 }
 
 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]);
 	}

-- 
To view, visit https://gerrit.osmocom.org/7354
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If4d3dfc16381493d7e710be746ed963975051fc1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list