Change in osmo-ttcn3-hacks[master]: bsc CBSP: f_gen_page(): allow passing explicit payload len

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
Thu Aug 13 05:36:29 UTC 2020


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

Change subject: bsc CBSP: f_gen_page(): allow passing explicit payload len
......................................................................

bsc CBSP: f_gen_page(): allow passing explicit payload len

Keep the default of using a random payload length, but also allow picking one
specifically. TC_cbsp_write_bss() will use this in a subsequent patch.

Change-Id: I259da42cbcbfdfe930aabb45c9de8a2b67c69629
---
M bsc/BSC_Tests_CBSP.ttcn
1 file changed, 11 insertions(+), 7 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/bsc/BSC_Tests_CBSP.ttcn b/bsc/BSC_Tests_CBSP.ttcn
index f54de9b..ea080a2 100644
--- a/bsc/BSC_Tests_CBSP.ttcn
+++ b/bsc/BSC_Tests_CBSP.ttcn
@@ -135,13 +135,17 @@
 	}
 }
 
-function f_gen_page() return CBSP_IE {
-	/* The maximum CBSP page payload space is 88, but 6 bytes of payload header are added in the first page: the
-	 * maximum length generated here thus is 82. The minimum generated length is 1 (avoiding zero length).
-	 * note, f_rnd_int(82) returns [0..81], so this results in a len ranging [1..82]: */
-	var integer len := 1 + f_rnd_int(82);
-	var octetstring payload := f_rnd_octstring(len);
-	return valueof(ts_CbspMsgContent(payload, len));
+/* Generate a CBSP payload: random size for payload_len == 0, or specific fixed size for payload_len > 0. */
+function f_gen_page(integer payload_len := 0) return CBSP_IE {
+	if (payload_len < 1) {
+		/* The maximum CBSP page payload space is 88, but 6 bytes of payload header are added in the first page:
+		 * the maximum length generated here thus is 82. The minimum generated length is 1 (avoiding zero
+		 * length). Note, f_rnd_int(82) returns [0..81], so this results in a len ranging [1..82]: */
+		payload_len := 1 + f_rnd_int(82);
+	}
+	log("Generating CBSP payload: ", payload_len, " octets");
+	var octetstring payload := f_rnd_octstring(payload_len);
+	return valueof(ts_CbspMsgContent(payload, payload_len));
 }
 
 function f_cbsp_reset_bss(integer idx) runs on CBSP_Adapter_CT {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19438
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: I259da42cbcbfdfe930aabb45c9de8a2b67c69629
Gerrit-Change-Number: 19438
Gerrit-PatchSet: 4
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200813/9a6c946b/attachment.htm>


More information about the gerrit-log mailing list