Change in osmo-ttcn3-hacks[master]: library/PCUIF_Types: version 10: add frequency hopping parameters

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/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Aug 10 20:10:11 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19323 )

Change subject: library/PCUIF_Types: version 10: add frequency hopping parameters
......................................................................

library/PCUIF_Types: version 10: add frequency hopping parameters

This change introduces new version 10 specific extensions, in
particular: the frequency hopping parameters of each timeslot.
These parameters are used to compose Channel Description IE
in the packet resource assignment messages.

In order to maintain backwards compatibility with version 9 of
the PCUIF, and thus to still be able to run test cases against
the latest release of osmo-pcu, I kept the old parts of the
INFO.ind and gruoped them together with the new records
into union 'PCUIF_InfoTrxs'.

During decoding, the content of this union is resolved by the
TITAN's RAW codec itself, depending on value of the 'version'
field.  During the encoding, it's the responsibility of the
API user to set a proper field of the union.  I implemented
both f_PCUIF_ver_INFO_{Trxs,PDCHMask} helpers for that.

Version 9 is kept as default, so this change can be merged
independently of the actual implementation.  We can bump
it and remove the compatibility glue once the new versions
of both osmo-bts and osmo-pcu are released.

Change-Id: Idf11bc4ba3ff0b00b32f2beab8fd020c67119d05
Related: SYS#4868, OS#4547
---
M bts/BTS_Tests.ttcn
M library/PCUIF_Types.ttcn
M pcu/PCU_Tests.ttcn
3 files changed, 107 insertions(+), 13 deletions(-)

Approvals:
  neels: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 1c8127b..dfda043 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -5444,7 +5444,7 @@
 	var PCUIF_send_data sd;
 
 	[] PCU.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(bts_nr, ?))) -> value sd {
-		var bitstring pdch_mask := sd.data.u.info_ind.trx[trx_nr].pdch_mask;
+		var bitstring pdch_mask := f_PCUIF_ver_INFO_PDCHMask(sd.data.u.info_ind, trx_nr);
 		if (substr(pdch_mask, g_chan_nr.tn, 1) != exp) {
 			repeat;
 		}
diff --git a/library/PCUIF_Types.ttcn b/library/PCUIF_Types.ttcn
index 089403c..1c5b0af 100644
--- a/library/PCUIF_Types.ttcn
+++ b/library/PCUIF_Types.ttcn
@@ -20,7 +20,7 @@
 };
 
 const charstring PCU_SOCK_DEFAULT := "/tmp/pcu_bts";
-type integer PCUIF_Version (9); /* supported versions */
+type integer PCUIF_Version (9..10); /* supported versions */
 
 type enumerated PCUIF_MsgType {
 	PCU_IF_MSG_DATA_REQ		('00'O),
@@ -140,14 +140,38 @@
 	uint8_t		ts_nr
 } with { variant "" };
 
-type record PCUIF_InfoTrx {
+type record PCUIF_InfoTrxTs {
+	uint8_t			tsc,
+	uint8_t			hopping,
+	uint8_t			hsn,
+	uint8_t			maio,
+	bitstring		ma length(64)
+} with { variant (ma) "BYTEORDER(first), BITORDER(msb)" };
+private type record length(8) of PCUIF_InfoTrxTs PCUIF_InfoTrxTsList;
+
+/* Version >= 10 specific coding */
+private type record PCUIF_InfoV10Trx {
+	uint16_t		arfcn,
+	BIT8			pdch_mask,
+	uint32_t		hLayer1,
+	PCUIF_InfoTrxTsList	ts
+} with { variant (pdch_mask) "BITORDER(msb)" };
+private type record length(8) of PCUIF_InfoV10Trx PCUIF_InfoV10TrxList;
+
+/* Version <= 9 specific coding */
+private type record PCUIF_InfoV09Trx {
 	uint16_t	arfcn,
 	BIT8		pdch_mask,
 	OCT1		spare,
 	OCT8		tsc,
 	uint32_t	hLayer1
 } with { variant (pdch_mask) "BITORDER(msb)" };
-type record length(8) of PCUIF_InfoTrx PCUIF_InfoTrxs;
+private type record length(8) of PCUIF_InfoV09Trx PCUIF_InfoV09TrxList;
+
+type union PCUIF_InfoTrxs {
+	PCUIF_InfoV09TrxList	v09,
+	PCUIF_InfoV10TrxList	v10
+} with { variant "" };
 
 type record PCUIF_info_ind {
 	uint32_t	version,
@@ -187,7 +211,11 @@
 	record length(2) of uint16_t	local_pprt,
 	record length(2) of uint16_t	remote_port,
 	record length(2) of OCT4	remote_ip
-} with { variant "" }
+} with {
+	/* NOTE: TITAN is not smart enough to handle 'version < 10' and 'version > 9',
+	 * so we cannot support more than two versions at the same time here. Sigh. */
+	variant (trx) "CROSSTAG(v09, version = 9; v10, version = 10)"
+};
 
 type record PCUIF_act_req {
 	uint8_t		is_activate,
@@ -676,9 +704,41 @@
 	spare2 := '000'B
 };
 
-template (value) PCUIF_InfoTrx ts_PCUIF_InfoTrx(template (value) uint16_t arfcn := 871,
-						template (value) BIT8 pdch_mask := '00000001'B,
-						OCT1 tsc := '07'O) := {
+template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH0(template (value) uint3_t tsc := 7) := {
+	tsc := tsc,
+	hopping := 0,
+	hsn := 0, maio := 0,
+	ma := f_pad_bit(''B, 64, '0'B)
+};
+
+template (value) PCUIF_InfoTrxTs ts_PCUIF_InfoTrxTsH1(template (value) uint3_t tsc := 7,
+						      template (value) uint6_t hsn := 0,
+						      template (value) uint6_t maio := 0,
+						      template (value) bitstring ma := ''B) := {
+	tsc := tsc,
+	hopping := 1,
+	hsn := hsn,
+	maio := maio,
+	ma := f_pad_bit(valueof(ma), 64, '0'B)
+};
+
+template (value) PCUIF_InfoV10Trx ts_PCUIF_InfoV10Trx(template (value) uint16_t arfcn := 871,
+						      template (value) BIT8 pdch_mask := '00000001'B,
+						      template (value) uint3_t tsc := 7) := {
+	arfcn := arfcn,
+	pdch_mask := pdch_mask,
+	hLayer1 := 0,
+	ts := {
+		ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
+		ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
+		ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc),
+		ts_PCUIF_InfoTrxTsH0(tsc), ts_PCUIF_InfoTrxTsH0(tsc)
+	}
+};
+
+template (value) PCUIF_InfoV09Trx ts_PCUIF_InfoV09Trx(template (value) uint16_t arfcn := 871,
+						      template (value) BIT8 pdch_mask := '00000001'B,
+						      OCT1 tsc := '07'O) := {
 	arfcn := arfcn,
 	pdch_mask := pdch_mask,
 	spare := '00'O,
@@ -686,11 +746,25 @@
 	hLayer1 := 0
 }
 
-template (value) PCUIF_InfoTrx ts_PCUIF_InfoTrxNULL := ts_PCUIF_InfoTrx(0, '00000000'B, '00'O);
+template (value) PCUIF_InfoV09Trx ts_PCUIF_InfoV09TrxNULL := ts_PCUIF_InfoV09Trx(0, '00000000'B, '00'O);
 
-template (value) PCUIF_InfoTrxs ts_PCUIF_InfoTrxs_def := {
-		ts_PCUIF_InfoTrx, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL,
-		ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL };
+template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV09Trxs_def := {
+	v09 := {
+		ts_PCUIF_InfoV09Trx, ts_PCUIF_InfoV09TrxNULL,
+		ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL,
+		ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL,
+		ts_PCUIF_InfoV09TrxNULL, ts_PCUIF_InfoV09TrxNULL
+	}
+};
+
+template (value) PCUIF_InfoTrxs ts_PCUIF_InfoV10Trxs_def := {
+	v10 := {
+		ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx,
+		ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx,
+		ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx,
+		ts_PCUIF_InfoV10Trx, ts_PCUIF_InfoV10Trx
+	}
+};
 
 template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr,
 						 template (value) PCUIF_info_ind info_ind) := {
@@ -830,4 +904,24 @@
 }
 
 
+/* TODO: remove this as soon as we drop version 9 support */
+function f_PCUIF_ver_INFO_Trxs()
+return PCUIF_InfoTrxs {
+	if (PCUIF_Types.mp_pcuif_version >= 10) {
+		return valueof(ts_PCUIF_InfoV10Trxs_def);
+	} else {
+		return valueof(ts_PCUIF_InfoV09Trxs_def);
+	}
+}
+
+function f_PCUIF_ver_INFO_PDCHMask(in PCUIF_info_ind info, uint8_t trx_nr)
+return bitstring {
+	if (PCUIF_Types.mp_pcuif_version >= 10) {
+		return info.trx.v10[trx_nr].pdch_mask;
+	} else {
+		return info.trx.v09[trx_nr].pdch_mask;
+	}
+}
+
+
 } with { encode "RAW" variant "BYTEORDER(first)" };
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index f919dbe..dab87e0 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -62,7 +62,7 @@
 friend template (value) PCUIF_info_ind ts_PCUIF_INFO_default := {
 	version := PCUIF_Types.mp_pcuif_version,
 	flags := c_PCUIF_Flags_default,
-	trx := valueof(ts_PCUIF_InfoTrxs_def),
+	trx := f_PCUIF_ver_INFO_Trxs(),
 	bsic := 7,
 	mcc := 262,
 	mnc := 42,

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19323
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Idf11bc4ba3ff0b00b32f2beab8fd020c67119d05
Gerrit-Change-Number: 19323
Gerrit-PatchSet: 11
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-CC: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200810/06922e27/attachment.htm>


More information about the gerrit-log mailing list