Change in osmo-ttcn3-hacks[master]: bsc: test TSC in various messages

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

neels gerrit-no-reply at lists.osmocom.org
Fri Jun 4 21:09:06 UTC 2021


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24564 )


Change subject: bsc: test TSC in various messages
......................................................................

bsc: test TSC in various messages

In a recent osmo-bsc patch:

"allow explixit TSC Set and TSC on chan activ / modif / assignment"
c33eb8d56943b8981523754b081967e6ff5f245d
Ic665125255d7354f5499d10dda1dd866ab243d24

I accidentally changed the default behavior of the Training Sequence
Code sent to BTS and MS. So now, make sure that we verify the expected
Training Sequence Code in BSC_Tests, in:

RSL Channel Activate
RR Immediate Assignment
RR Assignment Command
RR Channel Mode Modify
RSL Mode Modify

Related: OS#5172 SYS#5315
Change-Id: Id67a949e0f61ec8123976eb8d336f04510c55c01
---
M bsc/BSC_Tests.ttcn
M bsc/MSC_ConnectionHandler.ttcn
M library/RSL_Emulation.ttcn
3 files changed, 76 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/64/24564/1

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 6f603b1..9ea0269 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -684,6 +684,9 @@
 	pars.exp_ms_power_level := mp_exp_ms_power_level;
 	pars.mscpool.bssap_idx := bssap_idx;
 
+	/* BTS 0 has BSIC 10 (and no explicit timeslot training_sequence_code config), so expecting TSC = (BSIC & 7) = 2 */
+	pars.expect_tsc := 2;
+
 	return pars;
 }
 
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index ec90abe..c29ccd4 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -590,7 +590,8 @@
 	TestHdlrParamsMSCPool mscpool,
 	boolean		media_mgw_offer_ipv6,
 	OCT3		last_used_eutran_plmn optional,
-	boolean		expect_channel_mode_modify
+	boolean		expect_channel_mode_modify,
+	uint3_t		expect_tsc optional
 };
 
 /* Note: Do not use valueof() to get a value of this template, use
@@ -627,13 +628,19 @@
 	},
 	media_mgw_offer_ipv6 := true,
 	last_used_eutran_plmn := omit,
-	expect_channel_mode_modify := false
+	expect_channel_mode_modify := false,
+	expect_tsc := omit
 }
 
 function f_create_chan_and_exp() runs on MSC_ConnHdlr {
 	var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
 	var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi));
 	var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info);
+	var template uint3_t tsc := ?;
+
+	if (not istemplatekind(g_pars.expect_tsc, "omit")) {
+		tsc := g_pars.expect_tsc;
+	}
 
 	f_create_bssmap_exp(l3_enc);
 	/* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */
@@ -859,6 +866,14 @@
 
 }
 
+private function rr_chan_desc_tsc(ChannelDescription2_V cd2)
+	return uint3_t
+{
+	var uint3_t tsc := oct2int(cd2.octet3);
+	tsc := tsc / 32; /* shl 5 */
+	return tsc;
+}
+
 altstep as_assignment(inout AssignmentState st) runs on MSC_ConnHdlr {
 	var RSL_Message rsl;
 	[not st.rr_ass_cmpl_seen] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl {
@@ -867,6 +882,16 @@
 		if (ischosen(l3.msgs.rrm.assignmentCommand)) {
 			var RslChannelNr new_chan_nr;
 			var GsmArfcn arfcn;
+
+			if (not istemplatekind(g_pars.expect_tsc, "omit")) {
+				var uint3_t got_tsc := rr_chan_desc_tsc(l3.msgs.rrm.assignmentCommand.descrOf1stChAfterTime);
+				if (not match(got_tsc, g_pars.expect_tsc)) {
+					setverdict(fail, "RR Assignment: unexpected TSC in Channel Description: expected ",
+						   g_pars.expect_tsc, " got ", got_tsc);
+					mtc.stop;
+				}
+			}
+
 			f_ChDesc2RslChanNr(l3.msgs.rrm.assignmentCommand.descrOf1stChAfterTime,
 					   new_chan_nr, arfcn);
 			/* FIXME: Determine TRX NR by ARFCN, instead of hard-coded TRX0! */
@@ -1264,6 +1289,32 @@
 				   " to signalling mode, but got spd_ind == ", rsl_spd_ind);
 			mtc.stop;
 		}
+
+		if (not istemplatekind(g_pars.expect_tsc, "omit")) {
+			var uint3_t got_tsc := rr_chan_desc_tsc(st.rr_channel_mode_modify_msg.msgs.rrm.channelModeModify.channelDescription);
+			if (not match(got_tsc, g_pars.expect_tsc)) {
+				setverdict(fail, "RR Channel Mode Modify: unexpected TSC in Channel Description: expected ",
+					   g_pars.expect_tsc, " got ", got_tsc);
+				mtc.stop;
+			}
+		}
+
+	} else {
+		/* not exp_modify, so this did a Channel Activate */
+
+		/* Check the TSC */
+		if (not istemplatekind(g_pars.expect_tsc, "omit")) {
+			var RSL_Message chan_act := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr);
+			var RSL_IE_Body ie;
+			if (f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, ie)) {
+				var uint3_t got_tsc := ie.chan_ident.ch_desc.v.tsc;
+				if (not match(got_tsc, g_pars.expect_tsc)) {
+					setverdict(fail, "RSL CHANnel ACTIVation: unexpected TSC in Channel Description: expected ",
+						   g_pars.expect_tsc, " got ", got_tsc);
+					mtc.stop;
+				}
+			}
+		}
 	}
 
 	/* When the BSC detects that LCLS is possible it will cross the
diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index cb8b763..91fa2db 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -135,18 +135,37 @@
 }
 
 /* establish a dedicated channel using 'ra' */
-function f_chan_est(OCT1 ra, octetstring est_l3, template RslLinkId link_id, GsmFrameNumber fn := 23)
+function f_chan_est(OCT1 ra, octetstring est_l3, template RslLinkId link_id, GsmFrameNumber fn := 23,
+		    template uint3_t tsc := ?)
 runs on RSL_DchanHdlr {
 	var RSL_Message rx_rsl;
 	var GsmRrMessage rr;
 
 	/* request a channel to be established */
 	RSL.send(ts_RSLDC_ChanRqd(ra, fn));
+	/* At this point the BSC sends a CHAN ACTIV which we always ACK. Checking it below. */
 	/* expect immediate assignment */
 	rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN);
 	rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload);
+	if (not match(rr.payload.imm_ass.chan_desc.tsc, tsc)) {
+		setverdict(fail, "Immediate Assignment: unexpected TSC in Channel Description: expected ", tsc, " got ",
+			   rr.payload.imm_ass.chan_desc.tsc);
+		mtc.stop;
+	}
 	g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr;
 	RSL.send(ts_RSL_EST_IND(g_chan_nr, valueof(link_id), est_l3));
+
+	/* Check above CHAN ACTIV */
+	var RSL_Message chan_act := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr);
+	var RSL_IE_Body ie;
+	if (f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, ie)) {
+		var uint3_t got_tsc := ie.chan_ident.ch_desc.v.tsc;
+		if (not match(got_tsc, tsc)) {
+			setverdict(fail, "RSL CHANnel ACTIVation: unexpected TSC in Channel Description: expected ",
+				   tsc, " got ", got_tsc);
+			mtc.stop;
+		}
+	}
 }
 
 function f_deact_chan(RSL_Cause cause) runs on RSL_DchanHdlr

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24564
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: Id67a949e0f61ec8123976eb8d336f04510c55c01
Gerrit-Change-Number: 24564
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210604/14b8a780/attachment.htm>


More information about the gerrit-log mailing list