[PATCH] osmo-ttcn3-hacks[master]: MSC_Tests: Add testcase TC_cr_before_reset

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

dexter gerrit-no-reply at lists.osmocom.org
Wed Mar 7 17:41:17 UTC 2018


Review at  https://gerrit.osmocom.org/7147

MSC_Tests: Add testcase TC_cr_before_reset

This testcase triggers a bug in the BSSMAP reset logic that tricks
the MSC into a deadlock situation. The bug can only be triggered on
a freshly started MSC, otherwise the testcase will not have any
effect at all. That's why it its important that this is the first
testcase to be executed. If the IUT (MSC) is still affected by the
bug. It will enter the deadlog situation and all subsequent testcases
should fail until the IUT (MSC) is restarted. The matching real-life
scenario would be that the MSC restarts. The BSC is not informed by
the restart, so it continues to make connections (which fail) until
it notices that the MSC was down and the execution of a BSSMAP reset
procedure is required.

See also Gerrit Change Id:
I3fdcec5dbeaa0e21fd6a92568a623faa368239be

Closes: OS#4120
Change-Id: I1d7575e5bec9edabcc832c754d19dc5ba489861a
---
M msc/MSC_Tests.ttcn
1 file changed, 66 insertions(+), 0 deletions(-)


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

diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 976cf0d..cecee69 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -63,6 +63,16 @@
 	port IPA_CTRL_PT GSUP_IPA_EVENT;
 	/* VTY to MSC */
 	port TELNETasp_PT MSCVTY;
+
+	/* A port to directly send BSSAP messages. This port is used for
+	 * tests that require low level access to sen arbitrary BSSAP
+	 * messages. Run f_init_bssap_direct() to connect and initialize */
+	port BSSAP_CODEC_PT BSSAP_DIRECT;
+
+	/* When BSSAP messages are directly sent, then the connection
+	 * handler is not active, which means that also no guard timer is
+	 * set up. The following timer will serve as a replacement */
+	timer Tguard_direct := 60.0;
 }
 
 modulepar {
@@ -89,6 +99,14 @@
 	};
 }
 
+/* altstep for the global guard timer (only used when BSSAP_DIRECT
+ * is used for communication */
+private altstep as_Tguard_direct() runs on MTC_CT {
+	[] Tguard_direct.timeout {
+		setverdict(fail, "Tguard timeout");
+		self.stop;
+	}
+}
 
 function f_init_mncc(charstring id) runs on MTC_CT {
 	id := id & "-MNCC";
@@ -170,6 +188,18 @@
 	f_vty_config(MSCVTY, "network", "authentication optional");
 	f_vty_config(MSCVTY, "msc", "assign-tmsi");
 	f_vty_config(MSCVTY, "network", "encryption a5 0");
+}
+
+/* Initialize for a direct connection to BSSAP. This function is an alternative
+ * to f_init() when the high level functions of the BSC_ConnectionHandler are
+ * not needed. */
+function f_init_bssap_direct() runs on MTC_CT {
+	f_bssap_init(g_bssap, mp_bssap_cfg, "MSC_Test", omit);
+	connect(g_bssap.vc_SCCP:SCCP_SP_PORT, self:BSSAP_DIRECT);
+
+	/* Start guard timer and activate it as default */
+	Tguard_direct.start
+	activate(as_Tguard_direct());
 }
 
 template PDU_BSSAP ts_BSSAP_BSSMAP := {
@@ -1599,6 +1629,41 @@
 	vc_conn.done;
 }
 
+testcase TC_cr_before_reset() runs on MTC_CT {
+	timer T := 4.0;
+	var boolean reset_ack_seen := false;
+	f_init_bssap_direct();
+
+	/* Make a blind connection attemt, to trigger the deadlock condition */
+	BSSAP_DIRECT.send(ts_BSSAP_CONNECT_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, 1, omit));
+
+	/* Send a BSSMAP reset */
+	BSSAP_DIRECT.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0)));
+	T.start
+	alt {
+	[] BSSAP_DIRECT.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_ResetAck)) {
+		reset_ack_seen := true;
+		repeat;
+	}
+
+	/* Acknowledge MSC sided reset requests */
+	[] BSSAP_DIRECT.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) {
+		BSSAP_DIRECT.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_ResetAck));
+		repeat;
+	}
+
+	/* Ignore all other messages (e.g CR from the connection request) */
+	[] BSSAP_DIRECT.receive { repeat }
+
+	/* If we got no BSSMAP RESET ACK back, then the MSC entered the
+	 * deadlock situation. The MSC is then unable to respond to any
+	 * further BSSMAP RESET or any other sort of traffic. */
+	[reset_ack_seen == true] T.timeout { setverdict(pass) }
+	[reset_ack_seen == false] T.timeout {
+		setverdict(fail, "no BSSMAP RESET ACK seen!");
+	}
+	}	
+}
 
 
 
@@ -1616,6 +1681,7 @@
 
 
 control {
+	execute( TC_cr_before_reset() );
 	execute( TC_lu_imsi_noauth_tmsi() );
 	execute( TC_lu_imsi_noauth_notmsi() );
 	execute( TC_lu_imsi_reject() );

-- 
To view, visit https://gerrit.osmocom.org/7147
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d7575e5bec9edabcc832c754d19dc5ba489861a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>



More information about the gerrit-log mailing list