Change in osmo-ttcn3-hacks[master]: bsc: add BSC_Tests_2.TC_imm_ass_pre_chan_ack

neels gerrit-no-reply at lists.osmocom.org
Sun Aug 8 01:57:31 UTC 2021


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


Change subject: bsc: add BSC_Tests_2.TC_imm_ass_pre_chan_ack
......................................................................

bsc: add BSC_Tests_2.TC_imm_ass_pre_chan_ack

Add tests for the new early Imm Ass feature:
  'immediate-assignment (post-chan-ack|pre-chan-ack)'
as implemented in 0b44493d3de03d2750527e224df67b473fe39f93

In this patch I propose to open a new file for BSC tests, simply
BSC_Tests_2.ttcn. The reason is that modifying BSC_Tests.ttcn in tiny
ways causes many other files that import BSC_Tests to be recompiled
again and again for every dev cycle: for example the LCLS and CBSP test
suites. By placing my new test in a separate file, I reduced the waiting
time for titan compilation while developing the new tests. I will
definitely do so again for future test development, so I thought why not
see whether you guys also like this idea.

Alternatively I can move the new, now finished, tests into
BSC_Tests.ttcn, and just keep BSC_Tests_2.ttcn on my private branch.

(I previously argued that there is no problem with huge ttcn files, but
I see now that pespin was right to favor reducing the file size. The
most benefit probably comes from removed dependency builds.)

Related: SYS#5559
Change-Id: If71f4562d532b6c5faf55f5fd073449a8a137ebf
---
M bsc/BSC_Tests.cfg
M bsc/BSC_Tests.ttcn
A bsc/BSC_Tests_2.ttcn
M library/GSM_RR_Types.ttcn
4 files changed, 197 insertions(+), 2 deletions(-)



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

diff --git a/bsc/BSC_Tests.cfg b/bsc/BSC_Tests.cfg
index 610e0f7..b5ca989 100644
--- a/bsc/BSC_Tests.cfg
+++ b/bsc/BSC_Tests.cfg
@@ -16,6 +16,7 @@
 
 [EXECUTE]
 BSC_Tests.control
+BSC_Tests_2.control
 BSC_Tests_CBSP.control
 #BSC_Tests.TC_chan_act_noreply
 #BSC_Tests.TC_chan_act_ack_noest
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 0a11a48..f9900f7 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -21,6 +21,7 @@
  */
 
 friend module BSC_Tests_VAMOS;
+friend module BSC_Tests_2;
 
 import from Misc_Helpers all;
 import from General_Types all;
diff --git a/bsc/BSC_Tests_2.ttcn b/bsc/BSC_Tests_2.ttcn
new file mode 100644
index 0000000..bbf869f
--- /dev/null
+++ b/bsc/BSC_Tests_2.ttcn
@@ -0,0 +1,192 @@
+module BSC_Tests_2 {
+
+import from BSC_Tests all;
+
+import from Misc_Helpers all;
+import from General_Types all;
+import from Osmocom_Types all;
+import from GSM_Types all;
+import from IPL4asp_Types all;
+
+import from BSSAP_Types all;
+import from RAN_Adapter all;
+import from BSSAP_LE_Adapter all;
+import from BSSAP_LE_CodecPort all;
+import from BSSAP_LE_Types all;
+import from BSSLAP_Types all;
+import from BSSAP_CodecPort all;
+import from BSSMAP_Templates all;
+import from IPA_Emulation all;
+import from IPA_CodecPort all;
+import from IPA_Types all;
+import from IPA_Testing all;
+import from RSL_Types all;
+import from RSL_Emulation all;
+import from MGCP_Emulation all;
+import from MGCP_Templates all;
+import from MGCP_Types all;
+import from MGCP_CodecPort all;
+
+import from Osmocom_CTRL_Functions all;
+import from Osmocom_CTRL_Types all;
+import from Osmocom_CTRL_Adapter all;
+
+import from StatsD_Types all;
+import from StatsD_CodecPort all;
+import from StatsD_CodecPort_CtrlFunct all;
+import from StatsD_Checker all;
+
+import from Osmocom_VTY_Functions all;
+import from TELNETasp_PortType all;
+
+import from MobileL3_CommonIE_Types all;
+import from MobileL3_Types all;
+import from MobileL3_RRM_Types all;
+import from L3_Templates all;
+import from GSM_RR_Types all;
+
+import from SCCP_Templates all;
+import from BSSMAP_Templates all;
+import from BSSMAP_LE_Templates all;
+
+import from SCCPasp_Types all;
+
+import from GSM_SystemInformation all;
+import from GSM_RestOctets all;
+import from TCCConversion_Functions all;
+
+function f_exp_ipa_rx_nonfatal(integer bts_nr, template (present) RSL_Message t_rx, float t_secs := 2.0,
+			       IpaStreamId sid := IPAC_PROTO_RSL_TRX0, boolean ignore_other_rx := true)
+runs on test_CT return template (omit) RSL_Message {
+	var ASP_RSL_Unitdata rx_rsl_ud;
+	timer T := t_secs;
+
+	T.start;
+	alt {
+	[] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(t_rx, sid)) -> value rx_rsl_ud {
+		T.stop;
+		}
+	[ignore_other_rx] IPA_RSL[bts_nr].receive { repeat; }
+	[not ignore_other_rx] IPA_RSL[bts_nr].receive {
+			log("f_exp_ipa_rx_nonfatal(): Got different message than ", t_rx);
+			T.stop;
+			return omit;
+		}
+	[] T.timeout {
+			return omit;
+		}
+	}
+	return rx_rsl_ud.rsl;
+}
+
+private function f_vty_set_imm_ass(TELNETasp_PT pt, BtsNr bts_nr := 0, charstring imm_ass_setting := "post-chan-ack") {
+	f_vty_enter_cfg_bts(pt, bts_nr);
+	f_vty_transceive(pt, "immediate-assignment " & imm_ass_setting);
+	f_vty_transceive(pt, "exit");
+	f_vty_transceive(pt, "exit");
+	f_vty_transceive(pt, "exit");
+}
+
+private function f_verify_imm_ass(RSL_Message imm_ass, template uint8_t ra := ?, template GsmFrameNumber fn := ?,
+				  template RslChannelNr chan_nr := ?)
+{
+	var RSL_IE_Body full_imm_ass_info;
+	if (not f_rsl_find_ie(imm_ass, RSL_IE_FULL_IMM_ASS_INFO, full_imm_ass_info)) {
+		setverdict(fail, "RSL Full Immediate Assign Info IE is absent");
+		mtc.stop;
+	}
+
+	var GsmRrMessage rr_imm_ass := dec_GsmRrMessage(full_imm_ass_info.full_imm_ass_info.payload);
+	var template GsmRrMessage expect_imm_ass := tr_IMM_ASS(ra := ra,
+							       fn := fn,
+							       ch_desc := tr_ChanDescH0(chan_nr),
+							       page_mode := ?);
+	if (not match(rr_imm_ass, expect_imm_ass)) {
+		log("Error: expected ", expect_imm_ass, " got ", rr_imm_ass);
+		setverdict(fail, "Failed to match Immediate Assignment");
+		mtc.stop;
+	}
+}
+
+testcase TC_imm_ass_post_chan_ack() runs on test_CT {
+	var RSL_Message chan_act;
+	var RSL_Message imm_ass;
+
+	f_init(1, false);
+	f_sleep(1.0);
+
+	/* (should be the default anyway, just to make things clear) */
+	f_vty_set_imm_ass(BSCVTY, 0, "post-chan-ack");
+
+	/* RA containing reason=LU */
+	var GsmFrameNumber fn := 2342;
+	var uint8_t ra := 2;
+	f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn));
+
+	chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV));
+
+	/* First send the Chan Act ACK */
+	var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr;
+	f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn + 10));
+
+	/* Then expect the Immediate Assignment, after we ACKed the chan act */
+	imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0));
+
+	f_verify_imm_ass(imm_ass, ra, fn, chan_nr);
+
+	/* Check that the lchan is working */
+	var octetstring l3 := '00010203040506'O;
+	f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3));
+
+	var BSSAP_N_CONNECT_ind rx_c_ind;
+	BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind;
+	BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId));
+
+	f_sleep(1.0);
+	f_shutdown_helper();
+}
+
+testcase TC_imm_ass_pre_chan_ack() runs on test_CT {
+	var RSL_Message chan_act;
+	var RSL_Message imm_ass;
+
+	f_init(1, false);
+	f_sleep(1.0);
+
+	f_vty_set_imm_ass(BSCVTY, 0, "pre-chan-ack");
+
+	/* RA containing reason=LU */
+	var GsmFrameNumber fn := 2342;
+	var uint8_t ra := 2;
+	f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn));
+
+	/* (set bts 0 cfg back to default) */
+	f_vty_set_imm_ass(BSCVTY);
+
+	chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV));
+	var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr;
+
+	/* *FIRST* expect the Immediate Assignment, before we ACK the chan act */
+	imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0));
+	f_verify_imm_ass(imm_ass, ra, fn, chan_nr);
+
+	/* Only now send the Chan Act ACK */
+	f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10));
+
+	/* Check that the lchan is working */
+	var octetstring l3 := '00010203040506'O;
+	f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3));
+
+	var BSSAP_N_CONNECT_ind rx_c_ind;
+	BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind;
+	BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId));
+
+	f_sleep(1.0);
+	f_shutdown_helper();
+}
+
+control {
+	execute( TC_imm_ass_post_chan_ack() );
+	execute( TC_imm_ass_pre_chan_ack() );
+}
+}
diff --git a/library/GSM_RR_Types.ttcn b/library/GSM_RR_Types.ttcn
index 78db7a5..f7b00e1 100644
--- a/library/GSM_RR_Types.ttcn
+++ b/library/GSM_RR_Types.ttcn
@@ -1038,7 +1038,8 @@
 	template GsmRrMessage tr_IMM_ASS(template uint8_t ra := ?, template GsmFrameNumber fn := ?,
 					 template TimingAdvance ta := ?,
 					 template ChannelDescription ch_desc := ?,
-					 template MobileAllocationLV ma := ?) := {
+					 template MobileAllocationLV ma := ?,
+					 template PageMode page_mode := PAGE_MODE_NORMAL) := {
 		header := t_RrHeader(IMMEDIATE_ASSIGNMENT, ?),
 		payload := {
 			imm_ass := {
@@ -1048,7 +1049,7 @@
 					downlink := false,
 					tbf := false
 				},
-				page_mode := PAGE_MODE_NORMAL,
+				page_mode := page_mode,
 				chan_desc := ch_desc,
 				pkt_chan_desc := omit,
 				req_ref := tr_compute_ReqRef(ra, fn),

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25168
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: If71f4562d532b6c5faf55f5fd073449a8a137ebf
Gerrit-Change-Number: 25168
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/20210808/f72cc0eb/attachment.htm>


More information about the gerrit-log mailing list