Change in osmo-ttcn3-hacks[master]: pcu: Convert f_handle_pkt_neighbor_cell_data impl to use alt statements

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
Sat Feb 13 08:20:21 UTC 2021


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

Change subject: pcu: Convert f_handle_pkt_neighbor_cell_data impl to use alt statements
......................................................................

pcu: Convert f_handle_pkt_neighbor_cell_data impl to use alt statements

Change-Id: Iac9306cdcf16d9eaa750f6ca10f0c9df6f2c7453
---
M pcu/GPRS_Components.ttcn
M pcu/PCU_Tests.ttcn
2 files changed, 111 insertions(+), 73 deletions(-)

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



diff --git a/pcu/GPRS_Components.ttcn b/pcu/GPRS_Components.ttcn
index 34b7e79..e59c18d 100644
--- a/pcu/GPRS_Components.ttcn
+++ b/pcu/GPRS_Components.ttcn
@@ -533,6 +533,17 @@
 	}
 }
 
+altstep as_ms_rx_fail_dummy(inout GprsMS ms, template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum)
+runs on MS_BTS_IFACE_CT {
+	var BTS_PDTCH_Block data_msg;
+	[] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr,
+					   tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH),
+					   tr_RLCMAC_DUMMY_CTRL())) -> value data_msg {
+		setverdict(fail, "Unexpected Dummy Ctrl block ", data_msg);
+		f_shutdown(__BFILE__, __LINE__);
+	}
+}
+
 altstep as_ms_rx_pkt_ass_pacch(inout GprsMS ms, out uint32_t poll_fn,
 			       template RlcmacDlBlock t_pkt_ass := ?,
 			       template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum,
@@ -807,6 +818,101 @@
 	BTS.send(pcu_msg_cnf);
 }
 
+
+altstep as_ms_rx_pkt_neighbor_cell_data(inout GprsMS ms, octetstring exp_si,
+					inout uint5_t exp_container_idx /* := 0 */,
+					inout integer si_offset /* := 0 */,
+					template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum)
+runs on MS_BTS_IFACE_CT {
+	var integer len;
+	var octetstring exp_si_chunk;
+	var GlobalTfi gtfi := { is_dl_tfi := false, tfi := ms.ul_tbf.tfi };
+	var BTS_PDTCH_Block data_msg;
+	var boolean do_repeat := true;
+
+	[] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH),
+							tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_NEIGH_CELL_DATA(gtfi, exp_container_idx))
+			)) -> value data_msg {
+
+		var PacketNeighbourCellData neigh_data := data_msg.dl_block.ctrl.payload.u.neighbour_cell_data;
+		var PacketNeighbourCellDataContainer cont := neigh_data.container_list[0];
+
+		if (cont.cd_length == 31) { /* continues on next message */
+			len := lengthof(cont.container_data);
+			exp_si_chunk := substr(exp_si, si_offset, len);
+			if (cont.container_data != exp_si_chunk) {
+				setverdict(fail, "Rx unexpected SI chunk at offset ", si_offset, ": ",
+					   cont.container_data, " vs exp ", exp_si_chunk);
+				f_shutdown(__BFILE__, __LINE__);
+			}
+			si_offset := si_offset + len;
+		} else if (cont.cd_length == 0) {
+			/* we are done */
+			if (si_offset != lengthof(exp_si)) {
+				setverdict(fail, "Rx unexpectd SI length ", si_offset,
+					   " vs exp ", lengthof(exp_si));
+				f_shutdown(__BFILE__, __LINE__);
+			}
+			do_repeat := false;
+		} else { /* data length, last message */
+			len := cont.cd_length;
+			exp_si_chunk := substr(exp_si, si_offset, len);
+			if (cont.container_data != exp_si_chunk) {
+				setverdict(fail, "Rx unexpected SI chunk at offset ", si_offset, ": ",
+					   cont.container_data, " vs exp ", exp_si_chunk);
+				f_shutdown(__BFILE__, __LINE__);
+			}
+			si_offset := si_offset + len;
+			/* we are done */
+			if (si_offset != lengthof(exp_si)) {
+				setverdict(fail, "Rx unexpectd SI length ", si_offset,
+					   " vs exp ", lengthof(exp_si));
+				f_shutdown(__BFILE__, __LINE__);
+			}
+			do_repeat := false;
+		}
+
+		exp_container_idx := exp_container_idx + 1;
+
+		if (do_repeat) {
+			BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr,
+						  sapi := PCU_IF_SAPI_PDTCH, fn := 0,
+						  arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)),
+						  block_nr := nr.blk_nr));
+			repeat;
+		}
+	}
+}
+
+/* Handle groups of PKT NEIGHBOUR CELL DATA packets */
+function f_ms_handle_pkt_neighbor_cell_data(inout GprsMS ms, octetstring exp_si)
+runs on MS_BTS_IFACE_CT {
+	var uint5_t exp_container_idx := 0;
+	var integer si_offset := 0;
+	var BTS_PDTCH_Block data_msg;
+	template (value) TsTrxBtsNum nr := ts_TsTrxBtsNum;
+
+	BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr,
+				  sapi := PCU_IF_SAPI_PDTCH, fn := 0,
+				  arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)),
+				  block_nr := nr.blk_nr));
+	alt {
+	[exp_container_idx == 0] as_ms_rx_ignore_dummy(ms, nr);
+	[exp_container_idx > 0]	 as_ms_rx_fail_dummy(ms, nr);
+	[]	as_ms_rx_pkt_neighbor_cell_data(ms, exp_si, exp_container_idx, si_offset, nr);
+	[] 	BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr, tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH),
+					   tr_RLCMAC_DL_CTRL(?, ?)
+			)) -> value data_msg {
+				var GlobalTfi gtfi := { is_dl_tfi := false, tfi := ms.ul_tbf.tfi };
+				setverdict(fail, "Rx unexpected DL block: ", data_msg.dl_block, " vs exp ",
+					   tr_RLCMAC_DL_CTRL(?, tr_RlcMacDlCtrl_PKT_NEIGH_CELL_DATA(gtfi, exp_container_idx)));
+				f_shutdown(__BFILE__, __LINE__);
+		}
+	};
+
+	return;
+}
+
 ////////////////////////
 // Low level APIs
 ////////////////////////
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index cd7a4ec..a937bf4 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -3544,74 +3544,6 @@
 	return dl_block;
 }
 
-/* Handle groups of PKT NEIGHBOUR CELL DATA packets */
-private function f_handle_pkt_neighbor_cell_data(inout GprsMS ms, octetstring exp_si)
-runs on RAW_PCU_Test_CT {
-	var RlcmacDlBlock dl_block;
-	var uint32_t sched_fn;
-	var integer i := 0;
-	var uint5_t exp_container_idx := 0;
-	var integer si_offset := 0;
-	var integer len;
-	var octetstring exp_si_chunk;
-	var GlobalTfi gtfi := { is_dl_tfi := false, tfi := ms.ul_tbf.tfi };
-
-	dl_block := f_skip_dummy(50, sched_fn);
-
-	while (true) {
-		var template RlcmacDlCtrlMsg exp_msg; exp_msg :=
-				tr_RlcMacDlCtrl_PKT_NEIGH_CELL_DATA(gtfi, exp_container_idx);
-
-		/* Make sure last Dl block is a Pkt Neighbour Cell Data */
-		if (not match(dl_block, tr_RLCMAC_DL_CTRL(?, exp_msg))) {
-			setverdict(fail, "Rx unexpected DL block: ", dl_block, " vs exp ", tr_RLCMAC_DL_CTRL(?, exp_msg));
-			f_shutdown(__BFILE__, __LINE__);
-		}
-		var PacketNeighbourCellData neigh_data := dl_block.ctrl.payload.u.neighbour_cell_data;
-		var PacketNeighbourCellDataContainer cont := neigh_data.container_list[0];
-
-		if (cont.cd_length == 31) { /* continues on next message */
-			len := lengthof(cont.container_data);
-			exp_si_chunk := substr(exp_si, si_offset, len);
-			if (cont.container_data != exp_si_chunk) {
-				setverdict(fail, "Rx unexpected SI chunk at offset ", si_offset, ": ",
-					   cont.container_data, " vs exp ", exp_si_chunk);
-				f_shutdown(__BFILE__, __LINE__);
-			}
-			si_offset := si_offset + len;
-		} else if (cont.cd_length == 0) {
-			/* we are done */
-			if (si_offset != lengthof(exp_si)) {
-				setverdict(fail, "Rx unexpectd SI length ", si_offset,
-					   " vs exp ", lengthof(exp_si));
-				f_shutdown(__BFILE__, __LINE__);
-			}
-			break;
-		} else { /* data length, last message */
-			len := cont.cd_length;
-			exp_si_chunk := substr(exp_si, si_offset, len);
-			if (cont.container_data != exp_si_chunk) {
-				setverdict(fail, "Rx unexpected SI chunk at offset ", si_offset, ": ",
-					   cont.container_data, " vs exp ", exp_si_chunk);
-				f_shutdown(__BFILE__, __LINE__);
-				return;
-			}
-			si_offset := si_offset + len;
-			/* we are done */
-			if (si_offset != lengthof(exp_si)) {
-				setverdict(fail, "Rx unexpectd SI length ", si_offset,
-					   " vs exp ", lengthof(exp_si));
-				f_shutdown(__BFILE__, __LINE__);
-			}
-			break;
-		}
-
-		exp_container_idx := exp_container_idx + 1;
-		f_rx_rlcmac_dl_block(dl_block, sched_fn);
-	}
-	return;
-}
-
 private function f_outbound_nacc_rim_tx_resp(PCUIF_info_ind info_ind)
 runs on RAW_PCU_Test_CT {
 	var BssgpCellId src := valueof(ts_BssgpCellId(ts_RAI(ts_LAI(f_enc_BcdMccMnc(info_ind.mcc, info_ind.mnc, info_ind.mnc_3_digits == 1),
@@ -3693,7 +3625,7 @@
 	}
 
 	/* Announce SI back to MS, continue NACC procedure */
-	f_handle_pkt_neighbor_cell_data(ms, si_default);
+	f_ms_handle_pkt_neighbor_cell_data(ms, si_default);
 
 	/* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */
 	f_rx_rlcmac_dl_block(dl_block, sched_fn);
@@ -4213,7 +4145,7 @@
 	}
 
 	/* Announce SI back to MS, continue NACC procedure */
-	f_handle_pkt_neighbor_cell_data(ms, si_default);
+	f_ms_handle_pkt_neighbor_cell_data(ms, si_default);
 
 	/* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */
 	f_rx_rlcmac_dl_block(dl_block, sched_fn);
@@ -4296,7 +4228,7 @@
 	}
 
 	/* Announce SI back to MS, continue NACC procedure */
-	f_handle_pkt_neighbor_cell_data(ms, si_default);
+	f_ms_handle_pkt_neighbor_cell_data(ms, si_default);
 
 	/* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */
 	f_rx_rlcmac_dl_block(dl_block, sched_fn);
@@ -4379,7 +4311,7 @@
 	as_outbound_nacc_rim_resolve(info_ind);
 
 	/* Announce SI back to MS, continue NACC procedure */
-	f_handle_pkt_neighbor_cell_data(ms, si_default);
+	f_ms_handle_pkt_neighbor_cell_data(ms, si_default);
 
 	/* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */
 	f_rx_rlcmac_dl_block(dl_block, sched_fn);
@@ -4464,7 +4396,7 @@
 	as_outbound_nacc_rim_resolve(info_ind);
 
 	/* Announce SI back to MS, continue NACC procedure */
-	f_handle_pkt_neighbor_cell_data(ms, si_default);
+	f_ms_handle_pkt_neighbor_cell_data(ms, si_default);
 
 	/* Obtain a Downlink block and make sure it is a Pkt Cell Chg Continue */
 	f_rx_rlcmac_dl_block(dl_block, sched_fn);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22856
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: Iac9306cdcf16d9eaa750f6ca10f0c9df6f2c7453
Gerrit-Change-Number: 22856
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210213/bdb0c16d/attachment.htm>


More information about the gerrit-log mailing list